EVOLUTION-MANAGER
Edit File: wit_tb_bin.js
//# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/base.js var I;function Ta(b){var c=0;return function(){return c<b.length?{done:!1,value:b[c++]}:{done:!0}}}function Ya(b){return{next:Ta(b)}}function fb(b){var c="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return c?c.call(b):Ya(b)}var lb=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b}(this),sb="function"==typeof Object.defineProperties?Object.defineProperty:function(b,c,e){b!=Array.prototype&&b!=Object.prototype&&(b[c]=e.value)}; function wb(b,c){if(c){var e=lb;b=b.split(".");for(var g=0;g<b.length-1;g++){var k=b[g];k in e||(e[k]={});e=e[k]}b=b[b.length-1];g=e[b];c=c(g);c!=g&&null!=c&&sb(e,b,{configurable:!0,writable:!0,value:c})}} wb("Promise",function(b){function c(m){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var p=this.createResolveAndReject_();try{m(p.resolve,p.reject)}catch(n){p.reject(n)}}function e(){this.batch_=null}function g(m){switch(typeof m){case "object":return null!=m;case "function":return!0;default:return!1}}function k(m){return m instanceof c?m:new c(function(p){p(m)})}if(b)return b;e.prototype.asyncExecute=function(m){if(null==this.batch_){this.batch_=[];var p=this;this.asyncExecuteFunction(function(){p.executeBatch_()})}this.batch_.push(m)}; var q=lb.setTimeout;e.prototype.asyncExecuteFunction=function(m){q(m,0)};e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var m=this.batch_;this.batch_=[];for(var p=0;p<m.length;++p){var n=m[p];m[p]=null;try{n()}catch(t){this.asyncThrow_(t)}}}this.batch_=null};e.prototype.asyncThrow_=function(m){this.asyncExecuteFunction(function(){throw m;})};c.prototype.createResolveAndReject_=function(){function m(t){return function(v){n||(n=!0,t.call(p,v))}}var p=this,n=!1;return{resolve:m(this.resolveTo_), reject:m(this.reject_)}};c.prototype.resolveTo_=function(m){m===this?this.reject_(new TypeError("A Promise cannot resolve to itself")):m instanceof c?this.settleSameAsPromise_(m):g(m)?this.resolveToNonPromiseObj_(m):this.fulfill_(m)};c.prototype.resolveToNonPromiseObj_=function(m){var p=void 0;try{p=m.then}catch(n){this.reject_(n);return}"function"==typeof p?this.settleSameAsThenable_(p,m):this.fulfill_(m)};c.prototype.reject_=function(m){this.settle_(2,m)};c.prototype.fulfill_=function(m){this.settle_(1, m)};c.prototype.settle_=function(m,p){if(0!=this.state_)throw Error("Cannot settle("+m+", "+p+"): Promise already settled in state"+this.state_);this.state_=m;this.result_=p;this.executeOnSettledCallbacks_()};c.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var m=0;m<this.onSettledCallbacks_.length;++m)l.asyncExecute(this.onSettledCallbacks_[m]);this.onSettledCallbacks_=null}};var l=new e;c.prototype.settleSameAsPromise_=function(m){var p=this.createResolveAndReject_(); m.callWhenSettled_(p.resolve,p.reject)};c.prototype.settleSameAsThenable_=function(m,p){var n=this.createResolveAndReject_();try{m.call(p,n.resolve,n.reject)}catch(t){n.reject(t)}};c.prototype.then=function(m,p){function n(y,z){return"function"==typeof y?function(A){try{t(y(A))}catch(D){v(D)}}:z}var t,v,x=new c(function(y,z){t=y;v=z});this.callWhenSettled_(n(m,t),n(p,v));return x};c.prototype.catch=function(m){return this.then(void 0,m)};c.prototype.callWhenSettled_=function(m,p){function n(){switch(t.state_){case 1:m(t.result_); break;case 2:p(t.result_);break;default:throw Error("Unexpected state: "+t.state_);}}var t=this;null==this.onSettledCallbacks_?l.asyncExecute(n):this.onSettledCallbacks_.push(n)};c.resolve=k;c.reject=function(m){return new c(function(p,n){n(m)})};c.race=function(m){return new c(function(p,n){for(var t=fb(m),v=t.next();!v.done;v=t.next())k(v.value).callWhenSettled_(p,n)})};c.all=function(m){var p=fb(m),n=p.next();return n.done?k([]):new c(function(t,v){function x(A){return function(D){y[A]=D;z--;0== z&&t(y)}}var y=[],z=0;do y.push(void 0),z++,k(n.value).callWhenSettled_(x(y.length-1),v),n=p.next();while(!n.done)})};return c});wb("Promise.prototype.finally",function(b){return b?b:function(c){return this.then(function(e){return Promise.resolve(c()).then(function(){return e})},function(e){return Promise.resolve(c()).then(function(){throw e;})})}}); function xb(b){function c(g){return b.next(g)}function e(g){return b.throw(g)}return new Promise(function(g,k){function q(l){l.done?g(l.value):Promise.resolve(l.value).then(c,e).then(q,k)}q(b.next())})}function yb(b){return xb(b())}function Db(b){return void 0!==b}function Fb(b){return"string"==typeof b} function Hb(b){var c=typeof b;if("object"==c)if(b){if(b instanceof Array)return"array";if(b instanceof Object)return c;var e=Object.prototype.toString.call(b);if("[object Window]"==e)return"object";if("[object Array]"==e||"number"==typeof b.length&&"undefined"!=typeof b.splice&&"undefined"!=typeof b.propertyIsEnumerable&&!b.propertyIsEnumerable("splice"))return"array";if("[object Function]"==e||"undefined"!=typeof b.call&&"undefined"!=typeof b.propertyIsEnumerable&&!b.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==c&&"undefined"==typeof b.call)return"object";return c}function Jb(b){return null===b}function Kb(b){return"array"==Hb(b)}function Mb(b,c){function e(){}e.prototype=c.prototype;b.superClass_=c.prototype;b.prototype=new e;b.prototype.constructor=b;b.base=function(g,k,q){for(var l=Array(arguments.length-2),m=2;m<arguments.length;m++)l[m-2]=arguments[m];return c.prototype[k].apply(g,l)}}; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/transitionalforwarddeclarations.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/debug/error.js function Pb(b){if(Error.captureStackTrace)Error.captureStackTrace(this,Pb);else{var c=Error().stack;c&&(this.stack=c)}b&&(this.message=String(b));this.reportErrorToServer=!0}Mb(Pb,Error);Pb.prototype.name="CustomError"; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/dom/nodetype.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/asserts/asserts.js function Sb(b,c){Pb.call(this,Yb(b,c));this.messagePattern=b}Mb(Sb,Pb);Sb.prototype.name="AssertionError";function bc(b){throw b;}function Yb(b,c){b=b.split("%s");for(var e="",g=b.length-1,k=0;k<g;k++)e+=b[k]+(k<c.length?c[k]:"%s");return e+b[g]}function hc(b,c){bc(new Sb("Failure"+(b?": "+b:""),Array.prototype.slice.call(arguments,1)))}; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/array/array.js var ic=Array.prototype.forEach?function(b,c){Array.prototype.forEach.call(b,c,void 0)}:function(b,c){for(var e=b.length,g=Fb(b)?b.split(""):b,k=0;k<e;k++)k in g&&c.call(void 0,g[k],k,b)},sc=Array.prototype.map?function(b,c){return Array.prototype.map.call(b,c,void 0)}:function(b,c){for(var e=b.length,g=Array(e),k=Fb(b)?b.split(""):b,q=0;q<e;q++)q in k&&(g[q]=c.call(void 0,k[q],q,b));return g}; function Cc(b,c,e){return 2>=arguments.length?Array.prototype.slice.call(b,c):Array.prototype.slice.call(b,c,e)}; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/crypt/crypt.js function Dc(b){if(8192>=b.length)return String.fromCharCode.apply(null,b);for(var c="",e=0;e<b.length;e+=8192)c+=String.fromCharCode.apply(null,Cc(b,e,e+8192));return c}; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/dom/asserts.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/functions/functions.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/dom/htmlelement.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/dom/tagname.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/object/object.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/dom/tags.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/trustedtypes.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/string/typedstring.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/string/const.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/safescript.js function Ec(){this.privateDoNotAccessOrElseSafeScriptWrappedValue_="";this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=Kc}Ec.prototype.implementsGoogStringTypedString=!0;var Kc={};Ec.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()};Ec.prototype.toString=function(){return"SafeScript{"+this.privateDoNotAccessOrElseSafeScriptWrappedValue_+"}"}; Ec.prototype.initSecurityPrivateDoNotAccessOrElse_=function(b){this.privateDoNotAccessOrElseSafeScriptWrappedValue_=b;return this};(function(b){return(new Ec).initSecurityPrivateDoNotAccessOrElse_(b)})(""); //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/fs/url.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/i18n/bidi.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/trustedresourceurl.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/string/internal.js function Lc(b){return/^[\s\xa0]*$/.test(b)}function Mc(b){return-1!="\x3d.".indexOf(b)}; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/safeurl.js function Nc(){this.privateDoNotAccessOrElseSafeUrlWrappedValue_="";this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=cd}I=Nc.prototype;I.implementsGoogStringTypedString=!0;I.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()};I.implementsGoogI18nBidiDirectionalString=!0;I.getDirection=function(){return 1};I.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"};var cd={}; (function(b){var c=new Nc;c.privateDoNotAccessOrElseSafeUrlWrappedValue_=b;return c})("about:blank"); //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/safestyle.js function dd(){this.privateDoNotAccessOrElseSafeStyleWrappedValue_="";this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=ed}dd.prototype.implementsGoogStringTypedString=!0;var ed={};dd.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_};dd.prototype.toString=function(){return"SafeStyle{"+this.privateDoNotAccessOrElseSafeStyleWrappedValue_+"}"}; dd.prototype.initSecurityPrivateDoNotAccessOrElse_=function(b){this.privateDoNotAccessOrElseSafeStyleWrappedValue_=b;return this};(function(b){return(new dd).initSecurityPrivateDoNotAccessOrElse_(b)})(""); //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/safestylesheet.js function fd(){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_="";this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=gd}fd.prototype.implementsGoogStringTypedString=!0;var gd={};fd.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_};fd.prototype.toString=function(){return"SafeStyleSheet{"+this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_+"}"}; fd.prototype.initSecurityPrivateDoNotAccessOrElse_=function(b){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=b;return this};(function(b){return(new fd).initSecurityPrivateDoNotAccessOrElse_(b)})(""); //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/labs/useragent/util.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/labs/useragent/browser.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/safehtml.js function hd(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_="";this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=yd;this.dir_=null}I=hd.prototype;I.implementsGoogI18nBidiDirectionalString=!0;I.getDirection=function(){return this.dir_};I.implementsGoogStringTypedString=!0;I.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()};I.toString=function(){return"SafeHtml{"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"};var yd={}; function zd(b){(new hd).initSecurityPrivateDoNotAccessOrElse_(b,0)}hd.prototype.initSecurityPrivateDoNotAccessOrElse_=function(b,c){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=b;this.dir_=c;return this};zd("\x3c!DOCTYPE html\x3e");zd("");zd("\x3cbr\x3e"); //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/html/uncheckedconversions.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/dom/safe.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/string/string.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/labs/useragent/engine.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/labs/useragent/platform.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/reflect/reflect.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/useragent/useragent.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/useragent/product.js //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/crypt/base64.js function Ad(b){return Mc(b)}var Pd={},Qd=null;function Rd(b,c){!1===c||void 0===c?c=0:!0===c&&(c=3);Sd();c=Pd[c];for(var e=[],g=0;g<b.length;g+=3){var k=b[g],q=g+1<b.length,l=q?b[g+1]:0,m=g+2<b.length,p=m?b[g+2]:0,n=k>>2;k=(k&3)<<4|l>>4;l=(l&15)<<2|p>>6;p&=63;m||(p=64,q||(l=64));e.push(c[n],c[k],c[l]||"",c[p]||"")}return e.join("")} function Td(b){var c=b.length,e=3*c/4;e%3?e=Math.floor(e):Ad(b[c-1])&&(e=Ad(b[c-2])?e-2:e-1);var g=new Uint8Array(e),k=0;Ud(b,function(q){g[k++]=q});return g.subarray(0,k)}function Ud(b,c){function e(p){for(;g<b.length;){var n=b.charAt(g++),t=Qd[n];if(null!=t)return t;if(!Lc(n))throw Error("Unknown base64 encoding at char: "+n);}return p}Sd();for(var g=0;;){var k=e(-1),q=e(0),l=e(64),m=e(64);if(64===m&&-1===k)break;c(k<<2|q>>4);64!=l&&(c(q<<4&240|l>>2),64!=m&&c(l<<6&192|m))}} function Sd(){if(!Qd){Qd={};for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),c=["+/\x3d","+/","-_\x3d","-_.","-_"],e=0;5>e;e++){var g=b.concat(c[e].split(""));Pd[e]=g;for(var k=0;k<g.length;k++){var q=g[k];void 0===Qd[q]&&(Qd[q]=k)}}}}; //# sourceURL=build:/external/com_google_protobuf_js/binary/arith.js function Vd(b,c){this.lo=b;this.hi=c}I=Vd.prototype;I.cmp=function(b){return this.hi<b.hi||this.hi==b.hi&&this.lo<b.lo?-1:this.hi==b.hi&&this.lo==b.lo?0:1};I.rightShift=function(){return new Vd((this.lo>>>1|(this.hi&1)<<31)>>>0,this.hi>>>1>>>0)};I.leftShift=function(){return new Vd(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)};I.msb=function(){return!!(this.hi&2147483648)};I.lsb=function(){return!!(this.lo&1)};I.zero=function(){return 0==this.lo&&0==this.hi}; I.add=function(b){return new Vd((this.lo+b.lo&4294967295)>>>0>>>0,((this.hi+b.hi&4294967295)>>>0)+(4294967296<=this.lo+b.lo?1:0)>>>0)};I.sub=function(b){return new Vd((this.lo-b.lo&4294967295)>>>0>>>0,((this.hi-b.hi&4294967295)>>>0)-(0>this.lo-b.lo?1:0)>>>0)};function Wd(b){var c=b&65535,e=b>>>16;b=10*c+65536*(0*c&65535)+65536*(10*e&65535);for(c=0*e+(0*c>>>16)+(10*e>>>16);4294967296<=b;)b-=4294967296,c+=1;return new Vd(b>>>0,c>>>0)} I.mul=function(){var b=Wd(this.lo),c=Wd(this.hi);c.hi=c.lo;c.lo=0;return b.add(c)};I.div=function(){for(var b=new Vd(0,0),c=new Vd(this.lo,this.hi),e=new Vd(10,0),g=new Vd(1,0);!e.msb();)e=e.leftShift(),g=g.leftShift();for(;!g.zero();)0>=e.cmp(c)&&(b=b.add(g),c=c.sub(e)),e=e.rightShift(),g=g.rightShift();return[b,c]};I.toString=function(){for(var b="",c=this;!c.zero();){c=c.div();var e=c[0];b=c[1].lo+b;c=e}""==b&&(b="0");return b}; function Xd(b){for(var c=new Vd(0,0),e=new Vd(0,0),g=0;g<b.length;g++){if("0">b[g]||"9"<b[g])return null;e.lo=parseInt(b[g],10);c=c.mul().add(e)}return c}I.clone=function(){return new Vd(this.lo,this.hi)};function pe(b,c){this.lo=b;this.hi=c}pe.prototype.add=function(b){return new pe((this.lo+b.lo&4294967295)>>>0>>>0,((this.hi+b.hi&4294967295)>>>0)+(4294967296<=this.lo+b.lo?1:0)>>>0)}; pe.prototype.sub=function(b){return new pe((this.lo-b.lo&4294967295)>>>0>>>0,((this.hi-b.hi&4294967295)>>>0)-(0>this.lo-b.lo?1:0)>>>0)};pe.prototype.clone=function(){return new pe(this.lo,this.hi)};pe.prototype.toString=function(){var b=0!=(this.hi&2147483648),c=new Vd(this.lo,this.hi);b&&(c=(new Vd(0,0)).sub(c));return(b?"-":"")+c.toString()};function qe(b){var c=0<b.length&&"-"==b[0];c&&(b=b.substring(1));b=Xd(b);if(null===b)return null;c&&(b=(new Vd(0,0)).sub(b));return new pe(b.lo,b.hi)}; //# sourceURL=build:/external/com_google_protobuf_js/binary/constants.js function re(b){switch(b){case 5:case 3:case 13:case 4:case 17:case 18:case 8:case 14:case 31:return 0;case 1:case 6:case 16:case 30:return 1;case 9:case 11:case 12:return 2;case 2:case 7:case 15:return 5;default:return-1}}; //# sourceURL=build:/external/com_google_protobuf_js/binary/utils.js var se=0,te=0;function ue(b){var c=b>>>0;b=Math.floor((b-c)/4294967296)>>>0;se=c;te=b}function Ze(b){var c=0>b;b=Math.abs(b);var e=b>>>0;b=Math.floor((b-e)/4294967296);b>>>=0;c&&(b=~b>>>0,e=(~e>>>0)+1,4294967295<e&&(e=0,b++,4294967295<b&&(b=0)));se=e;te=b}function $e(b){var c=0>b;b=2*Math.abs(b);ue(b);b=se;var e=te;c&&(0==b?0==e?e=b=4294967295:(e--,b=4294967295):b--);se=b;te=e} function af(b){var c=0>b?1:0;b=c?-b:b;if(0===b)0<1/b?se=te=0:(te=0,se=2147483648);else if(isNaN(b))te=0,se=2147483647;else if(3.4028234663852886E38<b)te=0,se=(c<<31|2139095040)>>>0;else if(1.1754943508222875E-38>b)b=Math.round(b/Math.pow(2,-149)),te=0,se=(c<<31|b)>>>0;else{var e=Math.floor(Math.log(b)/Math.LN2);b*=Math.pow(2,-e);b=Math.round(8388608*b)&8388607;te=0;se=(c<<31|e+127<<23|b)>>>0}} function bf(b){var c=0>b?1:0;b=c?-b:b;if(0===b)te=0<1/b?0:2147483648,se=0;else if(isNaN(b))te=2147483647,se=4294967295;else if(1.7976931348623157E308<b)te=(c<<31|2146435072)>>>0,se=0;else if(2.2250738585072014E-308>b)b/=Math.pow(2,-1074),te=(c<<31|b/4294967296)>>>0,se=b>>>0;else{var e=Math.floor(Math.log(b)/Math.LN2);1024==e&&(e=1023);b*=Math.pow(2,-e);te=(c<<31|e+1023<<20|1048576*b&1048575)>>>0;se=4503599627370496*b>>>0}} function cf(b){var c=b.charCodeAt(4),e=b.charCodeAt(5),g=b.charCodeAt(6),k=b.charCodeAt(7);se=b.charCodeAt(0)+(b.charCodeAt(1)<<8)+(b.charCodeAt(2)<<16)+(b.charCodeAt(3)<<24)>>>0;te=c+(e<<8)+(g<<16)+(k<<24)>>>0}function df(b,c){return 4294967296*c+b}function ef(b,c){var e=c&2147483648;e&&(b=~b+1>>>0,c=~c>>>0,0==b&&(c=c+1>>>0));b=df(b,c);return e?-b:b}function ff(b,c){var e=b&1;b=(b>>>1|c<<31)>>>0;c>>>=1;e&&(b=b+1>>>0,0==b&&(c=c+1>>>0));b=df(b,c);return e?-b:b} function gf(b){var c=2*(b>>31)+1,e=b>>>23&255;b&=8388607;return 255==e?b?NaN:Infinity*c:0==e?c*Math.pow(2,-149)*b:c*Math.pow(2,e-150)*(b+Math.pow(2,23))}function hf(b,c){var e=2*(c>>31)+1,g=c>>>20&2047;b=4294967296*(c&1048575)+b;return 2047==g?b?NaN:Infinity*e:0==g?e*Math.pow(2,-1074)*b:e*Math.pow(2,g-1075)*(b+4503599627370496)}function jf(b,c){return String.fromCharCode(b>>>0&255,b>>>8&255,b>>>16&255,b>>>24&255,c>>>0&255,c>>>8&255,c>>>16&255,c>>>24&255)}var lg="0123456789abcdef".split(""); function mg(b,c){function e(m){for(var p=1E7,n=0;7>n;n++){p/=10;var t=m/p%10>>>0;if(0!=t||q)q=!0,l+=k[t]}}if(2097151>=c)return""+(4294967296*c+b);var g=(b>>>24|c<<8)>>>0&16777215;c=c>>16&65535;b=(b&16777215)+6777216*g+6710656*c;g+=8147497*c;c*=2;1E7<=b&&(g+=Math.floor(b/1E7),b%=1E7);1E7<=g&&(c+=Math.floor(g/1E7),g%=1E7);var k=lg,q=!1,l="";(c||q)&&e(c);(g||q)&&e(g);(b||q)&&e(b);return l}function ng(b,c){var e=c&2147483648;e&&(b=~b+1>>>0,c=~c+(0==b?1:0)>>>0);b=mg(b,c);return e?"-"+b:b} function og(b){function c(l,m){for(var p=0;8>p&&(1!==l||0<m);p++)m=l*k[p]+m,k[p]=m&255,m>>>=8}function e(){for(var l=0;8>l;l++)k[l]=~k[l]&255}var g=!1;"-"===b[0]&&(g=!0,b=b.slice(1));for(var k=[0,0,0,0,0,0,0,0],q=0;q<b.length;q++)c(10,lg.indexOf(b[q]));g&&(e(),c(1,1));return Dc(k)} function pg(b){if(b.constructor===Uint8Array)return b;if(b.constructor===ArrayBuffer)return new Uint8Array(b);if("undefined"!=typeof Buffer&&b.constructor===Buffer)return new Uint8Array(b);if(b.constructor===Array)return new Uint8Array(b);if(b.constructor===String)return Td(b);hc("Type not convertible to Uint8Array.");return new Uint8Array(0)}; //# sourceURL=build:/external/com_google_protobuf_js/binary/decoder.js function qg(b,c,e){this.bytes_=null;this.tempHigh_=this.tempLow_=this.cursor_=this.end_=this.start_=0;this.error_=!1;b&&this.setBlock(b,c,e)}var rg=[];function sg(b,c,e){if(rg.length){var g=rg.pop();b&&g.setBlock(b,c,e);return g}return new qg(b,c,e)}I=qg.prototype;I.free=function(){this.clear();100>rg.length&&rg.push(this)};I.clone=function(){return sg(this.bytes_,this.start_,this.end_-this.start_)};I.clear=function(){this.bytes_=null;this.cursor_=this.end_=this.start_=0;this.error_=!1}; I.getBuffer=function(){return this.bytes_};I.setBlock=function(b,c,e){this.bytes_=pg(b);this.start_=Db(c)?c:0;this.end_=Db(e)?this.start_+e:this.bytes_.length;this.cursor_=this.start_};I.getEnd=function(){return this.end_};I.setEnd=function(b){this.end_=b};I.reset=function(){this.cursor_=this.start_};I.getCursor=function(){return this.cursor_};I.setCursor=function(b){this.cursor_=b};I.advance=function(b){this.cursor_+=b};I.atEnd=function(){return this.cursor_==this.end_}; I.pastEnd=function(){return this.cursor_>this.end_};I.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_}; I.readSplitVarint64_=function(){for(var b,c=0,e,g=0;4>g;g++)if(b=this.bytes_[this.cursor_++],c|=(b&127)<<7*g,128>b){this.tempLow_=c>>>0;this.tempHigh_=0;return}b=this.bytes_[this.cursor_++];c|=(b&127)<<28;e=0|(b&127)>>4;if(128>b)this.tempLow_=c>>>0,this.tempHigh_=e>>>0;else{for(g=0;5>g;g++)if(b=this.bytes_[this.cursor_++],e|=(b&127)<<7*g+3,128>b){this.tempLow_=c>>>0;this.tempHigh_=e>>>0;return}hc("Failed to read varint, encoding is invalid.");this.error_=!0}}; I.skipVarint=function(){for(;this.bytes_[this.cursor_]&128;)this.cursor_++;this.cursor_++};I.unskipVarint=function(b){for(;128<b;)this.cursor_--,b>>>=7;this.cursor_--}; I.readUnsignedVarint32=function(){var b=this.bytes_;var c=b[this.cursor_+0];var e=c&127;if(128>c)return this.cursor_+=1,e;c=b[this.cursor_+1];e|=(c&127)<<7;if(128>c)return this.cursor_+=2,e;c=b[this.cursor_+2];e|=(c&127)<<14;if(128>c)return this.cursor_+=3,e;c=b[this.cursor_+3];e|=(c&127)<<21;if(128>c)return this.cursor_+=4,e;c=b[this.cursor_+4];e|=(c&15)<<28;if(128>c)return this.cursor_+=5,e>>>0;this.cursor_+=5;128<=b[this.cursor_++]&&128<=b[this.cursor_++]&&128<=b[this.cursor_++]&&128<=b[this.cursor_++]&& this.cursor_++;return e};I.readSignedVarint32=qg.prototype.readUnsignedVarint32;I.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()};I.readSignedVarint32String=function(){return this.readSignedVarint32().toString()};I.readZigzagVarint32=function(){var b=this.readUnsignedVarint32();return b>>>1^-(b&1)};I.readUnsignedVarint64=function(){this.readSplitVarint64_();return df(this.tempLow_,this.tempHigh_)}; I.readUnsignedVarint64String=function(){this.readSplitVarint64_();return mg(this.tempLow_,this.tempHigh_)};I.readSignedVarint64=function(){this.readSplitVarint64_();return ef(this.tempLow_,this.tempHigh_)};I.readSignedVarint64String=function(){this.readSplitVarint64_();return ng(this.tempLow_,this.tempHigh_)};I.readZigzagVarint64=function(){this.readSplitVarint64_();return ff(this.tempLow_,this.tempHigh_)};I.readZigzagVarint64String=function(){return this.readZigzagVarint64().toString()}; I.readUint8=function(){var b=this.bytes_[this.cursor_+0];this.cursor_+=1;return b};I.readUint16=function(){var b=this.bytes_[this.cursor_+0],c=this.bytes_[this.cursor_+1];this.cursor_+=2;return b<<0|c<<8};I.readUint32=function(){var b=this.bytes_[this.cursor_+0],c=this.bytes_[this.cursor_+1],e=this.bytes_[this.cursor_+2],g=this.bytes_[this.cursor_+3];this.cursor_+=4;return(b<<0|c<<8|e<<16|g<<24)>>>0};I.readUint64=function(){var b=this.readUint32(),c=this.readUint32();return df(b,c)}; I.readUint64String=function(){var b=this.readUint32(),c=this.readUint32();return mg(b,c)};I.readInt8=function(){var b=this.bytes_[this.cursor_+0];this.cursor_+=1;return b<<24>>24};I.readInt16=function(){var b=this.bytes_[this.cursor_+0],c=this.bytes_[this.cursor_+1];this.cursor_+=2;return(b<<0|c<<8)<<16>>16};I.readInt32=function(){var b=this.bytes_[this.cursor_+0],c=this.bytes_[this.cursor_+1],e=this.bytes_[this.cursor_+2],g=this.bytes_[this.cursor_+3];this.cursor_+=4;return b<<0|c<<8|e<<16|g<<24}; I.readInt64=function(){var b=this.readUint32(),c=this.readUint32();return ef(b,c)};I.readInt64String=function(){var b=this.readUint32(),c=this.readUint32();return ng(b,c)};I.readFloat=function(){var b=this.readUint32();return gf(b)};I.readDouble=function(){var b=this.readUint32(),c=this.readUint32();return hf(b,c)};I.readBool=function(){return!!this.bytes_[this.cursor_++]};I.readEnum=function(){return this.readSignedVarint32()}; I.readString=function(b){var c=this.bytes_,e=this.cursor_;b=e+b;for(var g=[],k="";e<b;){var q=c[e++];if(128>q)g.push(q);else if(192>q)continue;else if(224>q){var l=c[e++];g.push((q&31)<<6|l&63)}else if(240>q){l=c[e++];var m=c[e++];g.push((q&15)<<12|(l&63)<<6|m&63)}else if(248>q){l=c[e++];m=c[e++];var p=c[e++];q=(q&7)<<18|(l&63)<<12|(m&63)<<6|p&63;q-=65536;g.push((q>>10&1023)+55296,(q&1023)+56320)}8192<=g.length&&(k+=String.fromCharCode.apply(null,g),g.length=0)}k+=Dc(g);this.cursor_=e;return k}; I.readStringWithLength=function(){var b=this.readUnsignedVarint32();return this.readString(b)};I.readBytes=function(b){if(0>b||this.cursor_+b>this.bytes_.length)return this.error_=!0,hc("Invalid byte length!"),new Uint8Array(0);var c=this.bytes_.subarray(this.cursor_,this.cursor_+b);this.cursor_+=b;return c};I.readVarintHash64=function(){this.readSplitVarint64_();return jf(this.tempLow_,this.tempHigh_)}; I.readFixedHash64=function(){var b=this.bytes_,c=this.cursor_,e=b[c+0],g=b[c+1],k=b[c+2],q=b[c+3],l=b[c+4],m=b[c+5],p=b[c+6];b=b[c+7];this.cursor_+=8;return String.fromCharCode(e,g,k,q,l,m,p,b)}; //# sourceURL=build:/external/com_google_protobuf_js/binary/encoder.js function tg(){this.buffer_=[]}I=tg.prototype;I.length=function(){return this.buffer_.length};I.end=function(){var b=this.buffer_;this.buffer_=[];return b};I.writeSplitVarint64=function(b,c){for(;0<c||127<b;)this.buffer_.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;this.buffer_.push(b)};I.writeSplitFixed64=function(b,c){this.writeUint32(b);this.writeUint32(c)};I.writeUnsignedVarint32=function(b){for(;127<b;)this.buffer_.push(b&127|128),b>>>=7;this.buffer_.push(b)}; I.writeSignedVarint32=function(b){if(0<=b)this.writeUnsignedVarint32(b);else{for(var c=0;9>c;c++)this.buffer_.push(b&127|128),b>>=7;this.buffer_.push(1)}};I.writeUnsignedVarint64=function(b){Ze(b);this.writeSplitVarint64(se,te)};I.writeSignedVarint64=function(b){Ze(b);this.writeSplitVarint64(se,te)};I.writeZigzagVarint32=function(b){this.writeUnsignedVarint32((b<<1^b>>31)>>>0)};I.writeZigzagVarint64=function(b){$e(b);this.writeSplitVarint64(se,te)}; I.writeZigzagVarint64String=function(b){this.writeZigzagVarint64(parseInt(b,10))};I.writeUint8=function(b){this.buffer_.push(b>>>0&255)};I.writeUint16=function(b){this.buffer_.push(b>>>0&255);this.buffer_.push(b>>>8&255)};I.writeUint32=function(b){this.buffer_.push(b>>>0&255);this.buffer_.push(b>>>8&255);this.buffer_.push(b>>>16&255);this.buffer_.push(b>>>24&255)};I.writeUint64=function(b){ue(b);this.writeUint32(se);this.writeUint32(te)};I.writeInt8=function(b){this.buffer_.push(b>>>0&255)}; I.writeInt16=function(b){this.buffer_.push(b>>>0&255);this.buffer_.push(b>>>8&255)};I.writeInt32=function(b){this.buffer_.push(b>>>0&255);this.buffer_.push(b>>>8&255);this.buffer_.push(b>>>16&255);this.buffer_.push(b>>>24&255)};I.writeInt64=function(b){Ze(b);this.writeSplitFixed64(se,te)};I.writeInt64String=function(b){cf(og(b));this.writeSplitFixed64(se,te)};I.writeFloat=function(b){af(b);this.writeUint32(se)};I.writeDouble=function(b){bf(b);this.writeUint32(se);this.writeUint32(te)}; I.writeBool=function(b){this.buffer_.push(b?1:0)};I.writeEnum=function(b){this.writeSignedVarint32(b)};I.writeBytes=function(b){this.buffer_.push.apply(this.buffer_,b)};I.writeVarintHash64=function(b){cf(b);this.writeSplitVarint64(se,te)};I.writeFixedHash64=function(b){cf(b);this.writeUint32(se);this.writeUint32(te)}; I.writeString=function(b){for(var c=this.buffer_.length,e=0;e<b.length;e++){var g=b.charCodeAt(e);if(128>g)this.buffer_.push(g);else if(2048>g)this.buffer_.push(g>>6|192),this.buffer_.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&e+1<b.length){var k=b.charCodeAt(e+1);56320<=k&&57343>=k&&(g=1024*(g-55296)+k-56320+65536,this.buffer_.push(g>>18|240),this.buffer_.push(g>>12&63|128),this.buffer_.push(g>>6&63|128),this.buffer_.push(g&63|128),e++)}else this.buffer_.push(g>>12|224),this.buffer_.push(g>> 6&63|128),this.buffer_.push(g&63|128)}return this.buffer_.length-c}; //# sourceURL=build:/external/com_google_protobuf_js/binary/reader.js function ug(b,c,e){this.decoder_=sg(b,c,e);this.fieldCursor_=this.decoder_.getCursor();this.nextWireType_=this.nextField_=-1;this.error_=!1;this.readCallbacks_=null}var vg=[];I=ug.prototype;I.alloc=function(b,c,e){if(vg.length){var g=vg.pop();b&&g.decoder_.setBlock(b,c,e);return g}return new ug(b,c,e)};I.free=function(){this.decoder_.clear();this.nextWireType_=this.nextField_=-1;this.error_=!1;this.readCallbacks_=null;100>vg.length&&vg.push(this)};I.getFieldCursor=function(){return this.fieldCursor_}; I.getCursor=function(){return this.decoder_.getCursor()};I.getBuffer=function(){return this.decoder_.getBuffer()};I.getFieldNumber=function(){return this.nextField_};I.getWireType=function(){return this.nextWireType_};I.isEndGroup=function(){return 4==this.nextWireType_};I.getError=function(){return this.error_||this.decoder_.getError()};I.setBlock=function(b,c,e){this.decoder_.setBlock(b,c,e);this.nextWireType_=this.nextField_=-1}; I.reset=function(){this.decoder_.reset();this.nextWireType_=this.nextField_=-1};I.advance=function(b){this.decoder_.advance(b)}; I.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return hc("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var b=this.decoder_.readUnsignedVarint32(),c=b>>>3;b&=7;if(0!=b&&5!=b&&1!=b&&2!=b&&3!=b&&4!=b)return hc("Invalid wire type: %s (at position %s)",b,this.fieldCursor_),this.error_=!0,!1;this.nextField_=c;this.nextWireType_=b;return!0};I.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)}; I.skipMatchingFields=function(){var b=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==b;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()};I.skipVarintField=function(){0!=this.nextWireType_?(hc("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()};I.skipDelimitedField=function(){if(2!=this.nextWireType_)hc("Invalid wire type for skipDelimitedField"),this.skipField();else{var b=this.decoder_.readUnsignedVarint32();this.decoder_.advance(b)}}; I.skipFixed32Field=function(){5!=this.nextWireType_?(hc("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)};I.skipFixed64Field=function(){1!=this.nextWireType_?(hc("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)}; I.skipGroup=function(){var b=this.nextField_;do{if(!this.nextField()){hc("Unmatched start-group tag: stream EOF");this.error_=!0;break}if(4==this.nextWireType_){this.nextField_!=b&&(hc("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}while(1)};I.skipField=function(){switch(this.nextWireType_){case 0:this.skipVarintField();break;case 1:this.skipFixed64Field();break;case 2:this.skipDelimitedField();break;case 5:this.skipFixed32Field();break;case 3:this.skipGroup();break;default:hc("Invalid wire encoding for field.")}}; I.registerReadCallback=function(b,c){Jb(this.readCallbacks_)&&(this.readCallbacks_={});this.readCallbacks_[b]=c};I.runReadCallback=function(b){return(0,this.readCallbacks_[b])(this)}; I.readAny=function(b){this.nextWireType_=re(b);switch(b){case 1:return this.readDouble();case 2:return this.readFloat();case 3:return this.readInt64();case 4:return this.readUint64();case 5:return this.readInt32();case 6:return this.readFixed64();case 7:return this.readFixed32();case 8:return this.readBool();case 9:return this.readString();case 10:hc("Group field type not supported in readAny()");case 11:hc("Message field type not supported in readAny()");case 12:return this.readBytes();case 13:return this.readUint32(); case 14:return this.readEnum();case 15:return this.readSfixed32();case 16:return this.readSfixed64();case 17:return this.readSint32();case 18:return this.readSint64();case 30:return this.readFixedHash64();case 31:return this.readVarintHash64();default:hc("Invalid field type in readAny()")}return 0};I.readMessage=function(b,c){var e=this.decoder_.getEnd(),g=this.decoder_.readUnsignedVarint32();g=this.decoder_.getCursor()+g;this.decoder_.setEnd(g);c(b,this);this.decoder_.setCursor(g);this.decoder_.setEnd(e)}; I.readGroup=function(b,c,e){e(c,this);this.error_||4==this.nextWireType_||(hc("Group submessage did not end with an END_GROUP tag"),this.error_=!0)};I.getFieldDecoder=function(){var b=this.decoder_.readUnsignedVarint32(),c=this.decoder_.getCursor(),e=c+b;b=sg(this.decoder_.getBuffer(),c,b);this.decoder_.setCursor(e);return b};I.readInt32=function(){return this.decoder_.readSignedVarint32()};I.readInt32String=function(){return this.decoder_.readSignedVarint32String()};I.readInt64=function(){return this.decoder_.readSignedVarint64()}; I.readInt64String=function(){return this.decoder_.readSignedVarint64String()};I.readUint32=function(){return this.decoder_.readUnsignedVarint32()};I.readUint32String=function(){return this.decoder_.readUnsignedVarint32String()};I.readUint64=function(){return this.decoder_.readUnsignedVarint64()};I.readUint64String=function(){return this.decoder_.readUnsignedVarint64String()};I.readSint32=function(){return this.decoder_.readZigzagVarint32()};I.readSint64=function(){return this.decoder_.readZigzagVarint64()}; I.readSint64String=function(){return this.decoder_.readZigzagVarint64String()};I.readFixed32=function(){return this.decoder_.readUint32()};I.readFixed64=function(){return this.decoder_.readUint64()};I.readFixed64String=function(){return this.decoder_.readUint64String()};I.readSfixed32=function(){return this.decoder_.readInt32()};I.readSfixed32String=function(){return this.decoder_.readInt32().toString()};I.readSfixed64=function(){return this.decoder_.readInt64()};I.readSfixed64String=function(){return this.decoder_.readInt64String()}; I.readFloat=function(){return this.decoder_.readFloat()};I.readDouble=function(){return this.decoder_.readDouble()};I.readBool=function(){return!!this.decoder_.readUnsignedVarint32()};I.readEnum=function(){return this.decoder_.readSignedVarint64()};I.readString=function(){var b=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(b)};I.readBytes=function(){var b=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(b)};I.readVarintHash64=function(){return this.decoder_.readVarintHash64()}; I.readFixedHash64=function(){return this.decoder_.readFixedHash64()};I.readPackedField_=function(b){var c=this.decoder_.readUnsignedVarint32();c=this.decoder_.getCursor()+c;for(var e=[];this.decoder_.getCursor()<c;)e.push(b.call(this.decoder_));return e};I.readPackedInt32=function(){return this.readPackedField_(this.decoder_.readSignedVarint32)};I.readPackedInt32String=function(){return this.readPackedField_(this.decoder_.readSignedVarint32String)};I.readPackedInt64=function(){return this.readPackedField_(this.decoder_.readSignedVarint64)}; I.readPackedInt64String=function(){return this.readPackedField_(this.decoder_.readSignedVarint64String)};I.readPackedUint32=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32)};I.readPackedUint32String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32String)};I.readPackedUint64=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64)};I.readPackedUint64String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64String)}; I.readPackedSint32=function(){return this.readPackedField_(this.decoder_.readZigzagVarint32)};I.readPackedSint64=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64)};I.readPackedSint64String=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64String)};I.readPackedFixed32=function(){return this.readPackedField_(this.decoder_.readUint32)};I.readPackedFixed64=function(){return this.readPackedField_(this.decoder_.readUint64)};I.readPackedFixed64String=function(){return this.readPackedField_(this.decoder_.readUint64String)}; I.readPackedSfixed32=function(){return this.readPackedField_(this.decoder_.readInt32)};I.readPackedSfixed64=function(){return this.readPackedField_(this.decoder_.readInt64)};I.readPackedSfixed64String=function(){return this.readPackedField_(this.decoder_.readInt64String)};I.readPackedFloat=function(){return this.readPackedField_(this.decoder_.readFloat)};I.readPackedDouble=function(){return this.readPackedField_(this.decoder_.readDouble)};I.readPackedBool=function(){return this.readPackedField_(this.decoder_.readBool)}; I.readPackedEnum=function(){return this.readPackedField_(this.decoder_.readEnum)};I.readPackedVarintHash64=function(){return this.readPackedField_(this.decoder_.readVarintHash64)};I.readPackedFixedHash64=function(){return this.readPackedField_(this.decoder_.readFixedHash64)}; //# sourceURL=build:/external/com_google_protobuf_js/binary/writer.js function wg(){this.blocks_=[];this.totalLength_=0;this.encoder_=new tg;this.bookmarks_=[]}I=wg.prototype;I.appendUint8Array_=function(b){var c=this.encoder_.end();this.blocks_.push(c);this.blocks_.push(b);this.totalLength_+=c.length+b.length};I.beginDelimited_=function(b){this.writeFieldHeader_(b,2);b=this.encoder_.end();this.blocks_.push(b);this.totalLength_+=b.length;b.push(this.totalLength_);return b}; I.endDelimited_=function(b){var c=b.pop();for(c=this.totalLength_+this.encoder_.length()-c;127<c;)b.push(c&127|128),c>>>=7,this.totalLength_++;b.push(c);this.totalLength_++};I.writeSerializedMessage=function(b,c,e){this.appendUint8Array_(b.subarray(c,e))};I.maybeWriteSerializedMessage=function(b,c,e){null!=b&&null!=c&&null!=e&&this.writeSerializedMessage(b,c,e)};I.reset=function(){this.blocks_=[];this.encoder_.end();this.totalLength_=0;this.bookmarks_=[]}; I.getResultBuffer=function(){for(var b=new Uint8Array(this.totalLength_+this.encoder_.length()),c=this.blocks_,e=c.length,g=0,k=0;k<e;k++){var q=c[k];b.set(q,g);g+=q.length}c=this.encoder_.end();b.set(c,g);this.blocks_=[b];return b};I.getResultBase64String=function(b){return Rd(this.getResultBuffer(),b)};I.beginSubMessage=function(b){this.bookmarks_.push(this.beginDelimited_(b))};I.endSubMessage=function(){this.endDelimited_(this.bookmarks_.pop())}; I.writeFieldHeader_=function(b,c){this.encoder_.writeUnsignedVarint32(8*b+c)}; I.writeAny=function(b,c,e){switch(b){case 1:this.writeDouble(c,e);break;case 2:this.writeFloat(c,e);break;case 3:this.writeInt64(c,e);break;case 4:this.writeUint64(c,e);break;case 5:this.writeInt32(c,e);break;case 6:this.writeFixed64(c,e);break;case 7:this.writeFixed32(c,e);break;case 8:this.writeBool(c,e);break;case 9:this.writeString(c,e);break;case 10:hc("Group field type not supported in writeAny()");break;case 11:hc("Message field type not supported in writeAny()");break;case 12:this.writeBytes(c, e);break;case 13:this.writeUint32(c,e);break;case 14:this.writeEnum(c,e);break;case 15:this.writeSfixed32(c,e);break;case 16:this.writeSfixed64(c,e);break;case 17:this.writeSint32(c,e);break;case 18:this.writeSint64(c,e);break;case 30:this.writeFixedHash64(c,e);break;case 31:this.writeVarintHash64(c,e);break;default:hc("Invalid field type in writeAny()")}};I.writeUnsignedVarint32_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeUnsignedVarint32(c))}; I.writeSignedVarint32_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeSignedVarint32(c))};I.writeUnsignedVarint64_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeUnsignedVarint64(c))};I.writeSignedVarint64_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeSignedVarint64(c))};I.writeZigzagVarint32_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeZigzagVarint32(c))}; I.writeZigzagVarint64_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeZigzagVarint64(c))};I.writeZigzagVarint64String_=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeZigzagVarint64String(c))};I.writeInt32=function(b,c){null!=c&&this.writeSignedVarint32_(b,c)};I.writeInt32String=function(b,c){null!=c&&this.writeSignedVarint32_(b,parseInt(c,10))};I.writeInt64=function(b,c){null!=c&&this.writeSignedVarint64_(b,c)}; I.writeInt64String=function(b,c){null!=c&&(c=qe(c),this.writeFieldHeader_(b,0),this.encoder_.writeSplitVarint64(c.lo,c.hi))};I.writeUint32=function(b,c){null!=c&&this.writeUnsignedVarint32_(b,c)};I.writeUint32String=function(b,c){null!=c&&this.writeUnsignedVarint32_(b,parseInt(c,10))};I.writeUint64=function(b,c){null!=c&&this.writeUnsignedVarint64_(b,c)};I.writeUint64String=function(b,c){null!=c&&(c=Xd(c),this.writeFieldHeader_(b,0),this.encoder_.writeSplitVarint64(c.lo,c.hi))}; I.writeSint32=function(b,c){null!=c&&this.writeZigzagVarint32_(b,c)};I.writeSint64=function(b,c){null!=c&&this.writeZigzagVarint64_(b,c)};I.writeSint64String=function(b,c){null!=c&&this.writeZigzagVarint64String_(b,c)};I.writeFixed32=function(b,c){null!=c&&(this.writeFieldHeader_(b,5),this.encoder_.writeUint32(c))};I.writeFixed64=function(b,c){null!=c&&(this.writeFieldHeader_(b,1),this.encoder_.writeUint64(c))}; I.writeFixed64String=function(b,c){null!=c&&(c=Xd(c),this.writeFieldHeader_(b,1),this.encoder_.writeSplitFixed64(c.lo,c.hi))};I.writeSfixed32=function(b,c){null!=c&&(this.writeFieldHeader_(b,5),this.encoder_.writeInt32(c))};I.writeSfixed64=function(b,c){null!=c&&(this.writeFieldHeader_(b,1),this.encoder_.writeInt64(c))};I.writeSfixed64String=function(b,c){null!=c&&(c=qe(c),this.writeFieldHeader_(b,1),this.encoder_.writeSplitFixed64(c.lo,c.hi))}; I.writeFloat=function(b,c){null!=c&&(this.writeFieldHeader_(b,5),this.encoder_.writeFloat(c))};I.writeDouble=function(b,c){null!=c&&(this.writeFieldHeader_(b,1),this.encoder_.writeDouble(c))};I.writeBool=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeBool(c))};I.writeEnum=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeSignedVarint32(c))};I.writeString=function(b,c){null!=c&&(b=this.beginDelimited_(b),this.encoder_.writeString(c),this.endDelimited_(b))}; I.writeBytes=function(b,c){null!=c&&(c=pg(c),this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(c.length),this.appendUint8Array_(c))};I.writeMessage=function(b,c,e){null!=c&&(b=this.beginDelimited_(b),e(c,this),this.endDelimited_(b))};I.writeMessageSet=function(b,c,e){null!=c&&(this.writeFieldHeader_(1,3),this.writeFieldHeader_(2,0),this.encoder_.writeSignedVarint32(b),b=this.beginDelimited_(3),e(c,this),this.endDelimited_(b),this.writeFieldHeader_(1,4))}; I.writeGroup=function(b,c,e){null!=c&&(this.writeFieldHeader_(b,3),e(c,this),this.writeFieldHeader_(b,4))};I.writeFixedHash64=function(b,c){null!=c&&(this.writeFieldHeader_(b,1),this.encoder_.writeFixedHash64(c))};I.writeVarintHash64=function(b,c){null!=c&&(this.writeFieldHeader_(b,0),this.encoder_.writeVarintHash64(c))};I.writeRepeatedInt32=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeSignedVarint32_(b,c[e])}; I.writeRepeatedInt32String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeInt32String(b,c[e])};I.writeRepeatedInt64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeSignedVarint64_(b,c[e])};I.writeRepeatedInt64String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeInt64String(b,c[e])};I.writeRepeatedUint32=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeUnsignedVarint32_(b,c[e])}; I.writeRepeatedUint32String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeUint32String(b,c[e])};I.writeRepeatedUint64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeUnsignedVarint64_(b,c[e])};I.writeRepeatedUint64String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeUint64String(b,c[e])};I.writeRepeatedSint32=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeZigzagVarint32_(b,c[e])}; I.writeRepeatedSint64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeZigzagVarint64_(b,c[e])};I.writeRepeatedSint64String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeZigzagVarint64String_(b,c[e])};I.writeRepeatedFixed32=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeFixed32(b,c[e])};I.writeRepeatedFixed64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeFixed64(b,c[e])}; I.writeRepeatedFixed64String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeFixed64String(b,c[e])};I.writeRepeatedSfixed32=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeSfixed32(b,c[e])};I.writeRepeatedSfixed64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeSfixed64(b,c[e])};I.writeRepeatedSfixed64String=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeSfixed64String(b,c[e])}; I.writeRepeatedFloat=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeFloat(b,c[e])};I.writeRepeatedDouble=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeDouble(b,c[e])};I.writeRepeatedBool=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeBool(b,c[e])};I.writeRepeatedEnum=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeEnum(b,c[e])};I.writeRepeatedString=function(b){if(null!=b)for(var c=0;c<b.length;c++)this.writeString(1,b[c])}; I.writeRepeatedBytes=function(b){if(null!=b)for(var c=0;c<b.length;c++)this.writeBytes(1,b[c])};I.writeRepeatedMessage=function(b,c,e){if(null!=c)for(var g=0;g<c.length;g++){var k=this.beginDelimited_(b);e(c[g],this);this.endDelimited_(k)}};I.writeRepeatedGroup=function(b,c,e){if(null!=c)for(var g=0;g<c.length;g++)this.writeFieldHeader_(b,3),e(c[g],this),this.writeFieldHeader_(b,4)};I.writeRepeatedFixedHash64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeFixedHash64(b,c[e])}; I.writeRepeatedVarintHash64=function(b,c){if(null!=c)for(var e=0;e<c.length;e++)this.writeVarintHash64(b,c[e])};I.writePackedInt32=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeSignedVarint32(c[e]);this.endDelimited_(b)}};I.writePackedInt32String=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeSignedVarint32(parseInt(c[e],10));this.endDelimited_(b)}}; I.writePackedInt64=function(b){if(null!=b&&b.length){for(var c=this.beginDelimited_(1),e=0;e<b.length;e++)this.encoder_.writeSignedVarint64(b[e]);this.endDelimited_(c)}};I.writePackedInt64String=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++){var g=qe(c[e]);this.encoder_.writeSplitVarint64(g.lo,g.hi)}this.endDelimited_(b)}}; I.writePackedUint32=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeUnsignedVarint32(c[e]);this.endDelimited_(b)}};I.writePackedUint32String=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeUnsignedVarint32(parseInt(c[e],10));this.endDelimited_(b)}}; I.writePackedUint64=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeUnsignedVarint64(c[e]);this.endDelimited_(b)}};I.writePackedUint64String=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++){var g=Xd(c[e]);this.encoder_.writeSplitVarint64(g.lo,g.hi)}this.endDelimited_(b)}}; I.writePackedSint32=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeZigzagVarint32(c[e]);this.endDelimited_(b)}};I.writePackedSint64=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeZigzagVarint64(c[e]);this.endDelimited_(b)}}; I.writePackedSint64String=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeZigzagVarint64(parseInt(c[e],10));this.endDelimited_(b)}};I.writePackedFixed32=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(4*c.length),b=0;b<c.length;b++)this.encoder_.writeUint32(c[b])}; I.writePackedFixed64=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(8*c.length),b=0;b<c.length;b++)this.encoder_.writeUint64(c[b])};I.writePackedFixed64String=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(8*c.length),b=0;b<c.length;b++){var e=Xd(c[b]);this.encoder_.writeSplitFixed64(e.lo,e.hi)}}; I.writePackedSfixed32=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(4*c.length),b=0;b<c.length;b++)this.encoder_.writeInt32(c[b])};I.writePackedSfixed64=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(8*c.length),b=0;b<c.length;b++)this.encoder_.writeInt64(c[b])}; I.writePackedSfixed64String=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(8*c.length),b=0;b<c.length;b++)this.encoder_.writeInt64String(c[b])};I.writePackedFloat=function(b){if(null!=b&&b.length){this.writeFieldHeader_(1,2);this.encoder_.writeUnsignedVarint32(4*b.length);for(var c=0;c<b.length;c++)this.encoder_.writeFloat(b[c])}}; I.writePackedDouble=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(8*c.length),b=0;b<c.length;b++)this.encoder_.writeDouble(c[b])};I.writePackedBool=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(c.length),b=0;b<c.length;b++)this.encoder_.writeBool(c[b])}; I.writePackedEnum=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeEnum(c[e]);this.endDelimited_(b)}};I.writePackedFixedHash64=function(b,c){if(null!=c&&c.length)for(this.writeFieldHeader_(b,2),this.encoder_.writeUnsignedVarint32(8*c.length),b=0;b<c.length;b++)this.encoder_.writeFixedHash64(c[b])}; I.writePackedVarintHash64=function(b,c){if(null!=c&&c.length){b=this.beginDelimited_(b);for(var e=0;e<c.length;e++)this.encoder_.writeVarintHash64(c[e]);this.endDelimited_(b)}}; //# sourceURL=build:/external/com_google_protobuf_js/map.js function xg(b,c){this.arr_=b;this.valueCtor_=c;this.map_={};this.arrClean=!0;0<this.arr_.length&&this.loadFromArray_()}xg.prototype.loadFromArray_=function(){for(var b=0;b<this.arr_.length;b++){var c=this.arr_[b],e=c[0];this.map_[e.toString()]=new yg(e,c[1])}this.arrClean=!0}; xg.prototype.toArray=function(){if(this.arrClean){if(this.valueCtor_){var b=this.map_,c;for(c in b)if(Object.prototype.hasOwnProperty.call(b,c)){var e=b[c].valueWrapper;e&&e.toArray()}}}else{this.arr_.length=0;b=this.stringKeys_();b.sort();for(c=0;c<b.length;c++){var g=this.map_[b[c]];(e=g.valueWrapper)&&e.toArray();this.arr_.push([g.key,g.value])}this.arrClean=!0}return this.arr_}; xg.prototype.toObject=function(b,c){for(var e=this.toArray(),g=[],k=0;k<e.length;k++){var q=this.map_[e[k][0].toString()];this.wrapEntry_(q);var l=q.valueWrapper;l?g.push([q.key,c(b,l)]):g.push([q.key,q.value])}return g};function zg(b){this.idx_=0;this.arr_=b}zg.prototype.next=function(){return this.idx_<this.arr_.length?{done:!1,value:this.arr_[this.idx_++]}:{done:!0,value:void 0}};"undefined"!=typeof Symbol&&(zg.prototype[Symbol.iterator]=function(){return this});I=xg.prototype;I.getLength=function(){return this.stringKeys_().length}; I.clear=function(){this.map_={};this.arrClean=!1};I.del=function(b){b=b.toString();var c=this.map_.hasOwnProperty(b);delete this.map_[b];this.arrClean=!1;return c};I.getEntryList=function(){var b=[],c=this.stringKeys_();c.sort();for(var e=0;e<c.length;e++){var g=this.map_[c[e]];b.push([g.key,g.value])}return b};I.entries=function(){var b=[],c=this.stringKeys_();c.sort();for(var e=0;e<c.length;e++){var g=this.map_[c[e]];b.push([g.key,this.wrapEntry_(g)])}return new zg(b)}; I.keys=function(){var b=[],c=this.stringKeys_();c.sort();for(var e=0;e<c.length;e++)b.push(this.map_[c[e]].key);return new zg(b)};I.values=function(){var b=[],c=this.stringKeys_();c.sort();for(var e=0;e<c.length;e++)b.push(this.wrapEntry_(this.map_[c[e]]));return new zg(b)};I.forEach=function(b,c){var e=this.stringKeys_();e.sort();for(var g=0;g<e.length;g++){var k=this.map_[e[g]];b.call(c,this.wrapEntry_(k),k.key,this)}}; I.set=function(b,c){var e=new yg(b);this.valueCtor_?(e.valueWrapper=c,e.value=c.toArray()):e.value=c;this.map_[b.toString()]=e;this.arrClean=!1;return this};I.wrapEntry_=function(b){return this.valueCtor_?(b.valueWrapper||(b.valueWrapper=new this.valueCtor_(b.value)),b.valueWrapper):b.value};I.get=function(b){if(b=this.map_[b.toString()])return this.wrapEntry_(b)};I.has=function(b){return b.toString()in this.map_}; I.serializeBinary=function(b,c,e,g,k){var q=this.stringKeys_();q.sort();for(var l=0;l<q.length;l++){var m=this.map_[q[l]];c.beginSubMessage(b);e.call(c,1,m.key);this.valueCtor_?g.call(c,2,this.wrapEntry_(m),k):g.call(c,2,m.value);c.endSubMessage()}};function Ag(b,c,e){for(var g=ug.prototype.readString,k=ug.prototype.readMessage,q="",l=void 0;c.nextField()&&!c.isEndGroup();){var m=c.getFieldNumber();1==m?q=g.call(c):2==m&&(b.valueCtor_?(l=new b.valueCtor_,k.call(c,l,e)):l=k.call(c))}b.set(q,l)} I.stringKeys_=function(){var b=this.map_,c=[],e;for(e in b)Object.prototype.hasOwnProperty.call(b,e)&&c.push(e);return c};function yg(b,c){this.key=b;this.value=c;this.valueWrapper=void 0}; //# sourceURL=build:/external/com_google_protobuf_js/message.js function Bg(){}var Cg="function"==typeof Uint8Array;Bg.prototype.getJsPbMessageId=function(){return this.messageId_};function Dg(b,c){return c+b.arrayIndexOffset_}function Eg(b,c){return c-b.arrayIndexOffset_} function Fg(b,c,e,g){b.wrappers_=null;c||(c=[]);b.messageId_=void 0;b.arrayIndexOffset_=-1;b.array=c;Gg(b);b.convertedPrimitiveFields_={};if(e)for(c=0;c<e.length;c++){var k=e[c];k<b.pivot_?(k=Dg(b,k),b.array[k]=b.array[k]||Hg):(Gh(b),b.extensionObject_[k]=b.extensionObject_[k]||Hg)}if(g&&g.length)for(c=0;c<g.length;c++)Hh(b,g[c])}var Hg=Object.freeze?Object.freeze([]):[];function Ih(b){return Kb(b)}function Jh(b){return null!==b&&"object"==typeof b&&!Ih(b)&&!(Cg&&b instanceof Uint8Array)} function Gg(b){var c=b.array.length;if(c){--c;var e=b.array[c];if(Jh(e)){b.pivot_=Eg(b,c);b.extensionObject_=e;return}}b.pivot_=Number.MAX_VALUE}function Gh(b){var c=Dg(b,b.pivot_);b.array[c]||(b.extensionObject_=b.array[c]={})}function Kh(b,c,e){for(var g=[],k=0;k<b.length;k++)g[k]=c.call(b[k],e,b[k]);return g}function Lh(b,c){if(c<b.pivot_){c=Dg(b,c);var e=b.array[c];return e===Hg?b.array[c]=[]:e}if(b.extensionObject_)return e=b.extensionObject_[c],e===Hg?b.extensionObject_[c]=[]:e} function Mh(b,c){return Lh(b,c)}function Nh(b,c){b=Lh(b,c);return null==b?b:+b}function Oh(b){var c=Mh(b,1);b.convertedPrimitiveFields_||(b.convertedPrimitiveFields_={});if(!b.convertedPrimitiveFields_[1]){for(var e=0;e<c.length;e++)c[e]=+c[e];b.convertedPrimitiveFields_[1]=!0}return c}function Ph(b){if(null==b||Fb(b))return b;if(Cg&&b instanceof Uint8Array)return Rd(b);hc("Cannot coerce to b64 string: "+Hb(b));return null} function Qh(b){if(null==b||b instanceof Uint8Array)return b;if(Fb(b))return Td(b);hc("Cannot coerce to Uint8Array: "+Hb(b));return null}function Rh(b){Sh(b);return!b.length||Fb(b[0])?b:sc(b,Ph)}function Th(b){Sh(b);return!b.length||b[0]instanceof Uint8Array?b:sc(b,Qh)}function Sh(b){if(b&&1<b.length){var c=Hb(b[0]);ic(b,function(e){Hb(e)!=c&&hc("Inconsistent type in JSPB repeated field array. Got "+Hb(e)+" expected "+c)})}}function Uh(b,c,e){b=Lh(b,c);return null==b?e:b} function Vh(b,c){b=Nh(b,c);return null==b?0:b}function Wh(b,c,e){b.wrappers_||(b.wrappers_={});if(1 in b.wrappers_)return b.wrappers_[1];if(!c)return c=Lh(b,1),c||(c=[],Xh(b,1,c)),b.wrappers_[1]=new xg(c,e)}function Xh(b,c,e){c<b.pivot_?b.array[Dg(b,c)]=e:(Gh(b),b.extensionObject_[c]=e)}function Yh(b,c,e){kj(b,c,e,0)}function lj(b,c,e){kj(b,c,e,0)}function mj(b,c,e){kj(b,c,e,"")}function nj(b,c,e){kj(b,c,e,0)}function kj(b,c,e,g){e!==g?Xh(b,c,e):b.array[Dg(b,c)]=null} function oj(b,c,e){b=Mh(b,1);void 0!=e?b.splice(e,0,c):b.push(c)}function pj(b,c,e,g){(e=Hh(b,e))&&e!==c&&void 0!==g&&(b.wrappers_&&e in b.wrappers_&&(b.wrappers_[e]=void 0),Xh(b,e,void 0));Xh(b,c,g)}function Hh(b,c){for(var e,g,k=0;k<c.length;k++){var q=c[k],l=Lh(b,q);null!=l&&(e=q,g=l,Xh(b,q,void 0))}return e?(Xh(b,e,g),e):0}function qj(b,c,e){b.wrappers_||(b.wrappers_={});if(!b.wrappers_[e]){var g=Lh(b,e);g&&(b.wrappers_[e]=new c(g))}return b.wrappers_[e]} function rj(b,c,e){sj(b,c,e);c=b.wrappers_[e];c==Hg&&(c=b.wrappers_[e]=[]);return c}function sj(b,c,e){b.wrappers_||(b.wrappers_={});if(!b.wrappers_[e]){for(var g=Mh(b,e),k=[],q=0;q<g.length;q++)k[q]=new c(g[q]);b.wrappers_[e]=k}}function tj(b,c,e){b.wrappers_||(b.wrappers_={});var g=e?e.toArray():e;b.wrappers_[c]=e;Xh(b,c,g)}function uj(b,c,e,g){b.wrappers_||(b.wrappers_={});var k=g?g.toArray():g;b.wrappers_[c]=g;pj(b,c,e,k)} function vj(b,c,e){b.wrappers_||(b.wrappers_={});e=e||[];for(var g=[],k=0;k<e.length;k++)g[k]=e[k].toArray();b.wrappers_[c]=e;Xh(b,c,g)}function wj(b,c,e,g,k){sj(b,g,c);var q=b.wrappers_[c];q||(q=b.wrappers_[c]=[]);e=e?e:new g;b=Mh(b,c);void 0!=k?(q.splice(k,0,e),b.splice(k,0,e.toArray())):(q.push(e),b.push(e.toArray()));return e}I=Bg.prototype; I.syncMapFields_=function(){if(this.wrappers_)for(var b in this.wrappers_){var c=this.wrappers_[b];if(Kb(c))for(var e=0;e<c.length;e++)c[e]&&c[e].toArray();else c&&c.toArray()}};I.toArray=function(){this.syncMapFields_();return this.array};I.toString=function(){this.syncMapFields_();return this.array.toString()}; I.getExtension=function(b){if(this.extensionObject_){this.wrappers_||(this.wrappers_={});var c=b.fieldIndex;if(b.isRepeated){if(b.isMessageType())return this.wrappers_[c]||(this.wrappers_[c]=sc(this.extensionObject_[c]||[],function(e){return new b.ctor(e)})),this.wrappers_[c]}else if(b.isMessageType())return!this.wrappers_[c]&&this.extensionObject_[c]&&(this.wrappers_[c]=new b.ctor(this.extensionObject_[c])),this.wrappers_[c];return this.extensionObject_[c]}}; I.setExtension=function(b,c){this.wrappers_||(this.wrappers_={});Gh(this);var e=b.fieldIndex;b.isRepeated?(c=c||[],b.isMessageType()?(this.wrappers_[e]=c,this.extensionObject_[e]=sc(c,function(g){return g.toArray()})):this.extensionObject_[e]=c):b.isMessageType()?(this.wrappers_[e]=c,this.extensionObject_[e]=c?c.toArray():c):this.extensionObject_[e]=c;return this};I.cloneMessage=function(){return xj(this)};I.clone=function(){return xj(this)}; function xj(b){return new b.constructor(yj(b.toArray()))}function yj(b){if(Kb(b)){for(var c=Array(b.length),e=0;e<b.length;e++){var g=b[e];null!=g&&(c[e]="object"==typeof g?yj(g):g)}return c}if(Cg&&b instanceof Uint8Array)return new Uint8Array(b);c={};for(e in b)g=b[e],null!=g&&(c[e]="object"==typeof g?yj(g):g);return c}; //# sourceURL=build:/external/com_google_protobuf_js/debug.js //# sourceURL=build:/bazel-out/darwin-fastbuild/bin/external/org_tensorflow/tensorflow/core/example_protos.js function zj(b){Fg(this,b,Aj,null)}Mb(zj,Bg);function Bj(b){Fg(this,b,Cj,null)}Mb(Bj,Bg);function Dj(b){Fg(this,b,Ej,null)}Mb(Dj,Bg);function Fj(b){Fg(this,b,null,Gj)}Mb(Fj,Bg);function Hj(b){Fg(this,b,null,null)}Mb(Hj,Bg);function Ij(b){Fg(this,b,Jj,null)}Mb(Ij,Bg);function Kj(b){Fg(this,b,null,null)}Mb(Kj,Bg);var Aj=[1];I=zj.prototype;I.toObject=function(b){return Lj(b,this)};function Lj(b,c){var e={valueList:c.getValueList_asB64()};b&&(e.$jspbMessageInstance=c);return e} function Mj(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readBytes();b.addValue(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Zk(this,b);return b.getResultBuffer()};function Zk(b,c){b=b.getValueList_asU8();0<b.length&&c.writeRepeatedBytes(b)}I.getValueList=function(){return Mh(this,1)};I.getValueList_asB64=function(){return Rh(this.getValueList())};I.getValueList_asU8=function(){return Th(this.getValueList())}; I.setValueList=function(b){Xh(this,1,b||[])};I.addValue=function(b,c){oj(this,b,c)};I.clearValueList=function(){this.setValueList([])};var Cj=[1];I=Bj.prototype;I.toObject=function(b){return $k(b,this)};function $k(b,c){var e,g={valueList:null==(e=Oh(c))?void 0:e};b&&(g.$jspbMessageInstance=c);return g}function al(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readPackedFloat();b.setValueList(e);break;default:c.skipField()}return b} I.serializeBinary=function(){var b=new wg;bl(this,b);return b.getResultBuffer()};function bl(b,c){b=b.getValueList();0<b.length&&c.writePackedFloat(b)}I.getValueList=function(){return Oh(this)};I.setValueList=function(b){Xh(this,1,b||[])};I.addValue=function(b,c){oj(this,b,c)};I.clearValueList=function(){this.setValueList([])};var Ej=[1];I=Dj.prototype;I.toObject=function(b){return cl(b,this)};function cl(b,c){var e,g={valueList:null==(e=Mh(c,1))?void 0:e};b&&(g.$jspbMessageInstance=c);return g} function dl(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readPackedInt64();b.setValueList(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;el(this,b);return b.getResultBuffer()};function el(b,c){b=b.getValueList();0<b.length&&c.writePackedInt64(b)}I.getValueList=function(){return Mh(this,1)};I.setValueList=function(b){Xh(this,1,b||[])};I.addValue=function(b,c){oj(this,b,c)};I.clearValueList=function(){this.setValueList([])}; var Gj=[[1,2,3]];I=Fj.prototype;I.getKindCase=function(){return Hh(this,Gj[0])};I.toObject=function(b){return fl(b,this)};function fl(b,c){var e,g={bytesList:(e=c.getBytesList())&&Lj(b,e),floatList:(e=c.getFloatList())&&$k(b,e),int64List:(e=c.getInt64List())&&cl(b,e)};b&&(g.$jspbMessageInstance=c);return g} function gl(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new zj;c.readMessage(e,Mj);b.setBytesList(e);break;case 2:e=new Bj;c.readMessage(e,al);b.setFloatList(e);break;case 3:e=new Dj;c.readMessage(e,dl);b.setInt64List(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;hl(this,b);return b.getResultBuffer()}; function hl(b,c){var e=b.getBytesList();null!=e&&c.writeMessage(1,e,Zk);e=b.getFloatList();null!=e&&c.writeMessage(2,e,bl);e=b.getInt64List();null!=e&&c.writeMessage(3,e,el)}I.getBytesList=function(){return qj(this,zj,1)};I.setBytesList=function(b){uj(this,1,Gj[0],b)};I.clearBytesList=function(){this.setBytesList(void 0)};I.hasBytesList=function(){return null!=Lh(this,1)};I.getFloatList=function(){return qj(this,Bj,2)};I.setFloatList=function(b){uj(this,2,Gj[0],b)};I.clearFloatList=function(){this.setFloatList(void 0)}; I.hasFloatList=function(){return null!=Lh(this,2)};I.getInt64List=function(){return qj(this,Dj,3)};I.setInt64List=function(b){uj(this,3,Gj[0],b)};I.clearInt64List=function(){this.setInt64List(void 0)};I.hasInt64List=function(){return null!=Lh(this,3)};Hj.prototype.toObject=function(b){return il(b,this)};function il(b,c){var e,g={featureMap:(e=c.getFeatureMap())?e.toObject(b,fl):[]};b&&(g.$jspbMessageInstance=c);return g} function jl(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=b.getFeatureMap();c.readMessage(e,function(g,k){Ag(g,k,gl)});break;default:c.skipField()}return b}Hj.prototype.serializeBinary=function(){var b=new wg;kl(this,b);return b.getResultBuffer()};function kl(b,c){(b=b.getFeatureMap(!0))&&0<b.getLength()&&b.serializeBinary(1,c,wg.prototype.writeString,wg.prototype.writeMessage,hl)}Hj.prototype.getFeatureMap=function(b){return Wh(this,b,Fj)}; Hj.prototype.clearFeatureMap=function(){this.getFeatureMap().clear()};var Jj=[1];I=Ij.prototype;I.toObject=function(b){return ll(b,this)};function ll(b,c){var e={featureList:Kh(c.getFeatureList(),fl,b)};b&&(e.$jspbMessageInstance=c);return e}function ml(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Fj;c.readMessage(e,gl);b.addFeature(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;nl(this,b);return b.getResultBuffer()}; function nl(b,c){b=b.getFeatureList();0<b.length&&c.writeRepeatedMessage(1,b,hl)}I.getFeatureList=function(){return rj(this,Fj,1)};I.setFeatureList=function(b){vj(this,1,b)};I.addFeature=function(b,c){return wj(this,1,b,Fj,c)};I.clearFeatureList=function(){this.setFeatureList([])};Kj.prototype.toObject=function(b){return ol(b,this)};function ol(b,c){var e,g={featureListMap:(e=c.getFeatureListMap())?e.toObject(b,ll):[]};b&&(g.$jspbMessageInstance=c);return g} function pl(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=b.getFeatureListMap();c.readMessage(e,function(g,k){Ag(g,k,ml)});break;default:c.skipField()}return b}Kj.prototype.serializeBinary=function(){var b=new wg;ql(this,b);return b.getResultBuffer()};function ql(b,c){(b=b.getFeatureListMap(!0))&&0<b.getLength()&&b.serializeBinary(1,c,wg.prototype.writeString,wg.prototype.writeMessage,nl)}Kj.prototype.getFeatureListMap=function(b){return Wh(this,b,Ij)}; Kj.prototype.clearFeatureListMap=function(){this.getFeatureListMap().clear()};function rl(b){Fg(this,b,null,null)}Mb(rl,Bg);function sl(b){Fg(this,b,null,null)}Mb(sl,Bg);I=rl.prototype;I.toObject=function(b){return tl(b,this)};function tl(b,c){var e,g={features:(e=c.getFeatures())&&il(b,e)};b&&(g.$jspbMessageInstance=c);return g}function ul(b){b=new ug(b);var c=new rl;return vl(c,b)} function vl(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Hj;c.readMessage(e,jl);b.setFeatures(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;wl(this,b);return b.getResultBuffer()};function wl(b,c){b=b.getFeatures();null!=b&&c.writeMessage(1,b,kl)}I.getFeatures=function(){return qj(this,Hj,1)};I.setFeatures=function(b){tj(this,1,b)};I.clearFeatures=function(){this.setFeatures(void 0)}; I.hasFeatures=function(){return null!=Lh(this,1)};I=sl.prototype;I.toObject=function(b){return xl(b,this)};function xl(b,c){var e,g={context:(e=c.getContext())&&il(b,e),featureLists:(e=c.getFeatureLists())&&ol(b,e)};b&&(g.$jspbMessageInstance=c);return g}function yl(b){b=new ug(b);var c=new sl;return zl(c,b)} function zl(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Hj;c.readMessage(e,jl);b.setContext(e);break;case 2:e=new Kj;c.readMessage(e,pl);b.setFeatureLists(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Al(this,b);return b.getResultBuffer()};function Al(b,c){var e=b.getContext();null!=e&&c.writeMessage(1,e,kl);e=b.getFeatureLists();null!=e&&c.writeMessage(2,e,ql)}I.getContext=function(){return qj(this,Hj,1)}; I.setContext=function(b){tj(this,1,b)};I.clearContext=function(){this.setContext(void 0)};I.hasContext=function(){return null!=Lh(this,1)};I.getFeatureLists=function(){return qj(this,Kj,2)};I.setFeatureLists=function(b){tj(this,2,b)};I.clearFeatureLists=function(){this.setFeatureLists(void 0)};I.hasFeatureLists=function(){return null!=Lh(this,2)}; //# sourceURL=build:/bazel-out/darwin-fastbuild/bin/external/ai_google_pair_facets/facets_overview/proto/feature_statistics_proto.js function Bl(b){Fg(this,b,Cl,null)}Mb(Bl,Bg);function Dl(b){Fg(this,b,El,null)}Mb(Dl,Bg);function Fl(b){Fg(this,b,Gl,null)}Mb(Fl,Bg);function Hl(b){Fg(this,b,Il,Jl)}Mb(Hl,Bg);function Kl(b){Fg(this,b,null,null)}Mb(Kl,Bg);function Ll(b){Fg(this,b,null,Ml)}Mb(Ll,Bg);function Nl(b){Fg(this,b,Ol,null)}Mb(Nl,Bg);function Pl(b){Fg(this,b,Ql,null)}Mb(Pl,Bg);function Rl(b){Fg(this,b,null,null)}Mb(Rl,Bg);function Sl(b){Fg(this,b,Tl,null)}Mb(Sl,Bg);function Ul(b){Fg(this,b,Vl,null)}Mb(Ul,Bg); function Wl(b){Fg(this,b,null,null)}Mb(Wl,Bg);function Xl(b){Fg(this,b,null,null)}Mb(Xl,Bg);function Yl(b){Fg(this,b,null,null)}Mb(Yl,Bg);function Zl(b){Fg(this,b,$l,null)}Mb(Zl,Bg);function am(b){Fg(this,b,null,null)}Mb(am,Bg);function bm(b){Fg(this,b,cm,null)}Mb(bm,Bg);function dm(b){Fg(this,b,null,null)}Mb(dm,Bg);var Cl=[1];I=Bl.prototype;I.toObject=function(b){return em(b,this)};function em(b,c){var e={datasetsList:Kh(c.getDatasetsList(),fm,b)};b&&(e.$jspbMessageInstance=c);return e} function gm(b){b=new ug(b);var c=new Bl;return hm(c,b)}function hm(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Fl;c.readMessage(e,im);b.addDatasets(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;jm(this,b);return b.getResultBuffer()};function jm(b,c){b=b.getDatasetsList();0<b.length&&c.writeRepeatedMessage(1,b,km)}I.getDatasetsList=function(){return rj(this,Fl,1)};I.setDatasetsList=function(){vj(this,1,[])}; I.addDatasets=function(b){wj(this,1,b,Fl,void 0)};I.clearDatasetsList=function(){this.setDatasetsList()};var El=[1];I=Dl.prototype;I.toObject=function(b){return lm(b,this)};function lm(b,c){var e,g={stepList:null==(e=Mh(c,1))?void 0:e};b&&(g.$jspbMessageInstance=c);return g}function mm(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readString();b.addStep(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;nm(this,b);return b.getResultBuffer()}; function nm(b,c){b=b.getStepList();0<b.length&&c.writeRepeatedString(b)}I.getStepList=function(){return Mh(this,1)};I.setStepList=function(){Xh(this,1,[])};I.addStep=function(b){oj(this,b,void 0)};I.clearStepList=function(){this.setStepList()};var Gl=[3];I=Fl.prototype;I.toObject=function(b){return fm(b,this)};function fm(b,c){var e={name:Uh(c,1,""),numExamples:Uh(c,2,0),weightedNumExamples:Vh(c,4),featuresList:Kh(c.getFeaturesList(),om,b)};b&&(e.$jspbMessageInstance=c);return e} function im(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readString();b.setName(e);break;case 2:e=c.readUint64();b.setNumExamples(e);break;case 4:e=c.readDouble();b.setWeightedNumExamples(e);break;case 3:e=new Hl;c.readMessage(e,pm);b.addFeatures(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;km(this,b);return b.getResultBuffer()}; function km(b,c){var e=b.getName();0<e.length&&c.writeString(1,e);e=b.getNumExamples();0!==e&&c.writeUint64(2,e);e=b.getWeightedNumExamples();0!==e&&c.writeDouble(4,e);e=b.getFeaturesList();0<e.length&&c.writeRepeatedMessage(3,e,qm)}I.getName=function(){return Uh(this,1,"")};I.setName=function(b){mj(this,1,b)};I.getNumExamples=function(){return Uh(this,2,0)};I.setNumExamples=function(b){Yh(this,2,b)};I.getWeightedNumExamples=function(){return Vh(this,4)}; I.setWeightedNumExamples=function(b){lj(this,4,b)};I.getFeaturesList=function(){return rj(this,Hl,3)};I.setFeaturesList=function(){vj(this,3,[])};I.addFeatures=function(b){wj(this,3,b,Hl,void 0)};I.clearFeaturesList=function(){this.setFeaturesList()};var Il=[6],Jl=[[1,8],[3,4,5,7]];I=Hl.prototype;I.getFieldIdCase=function(){return Hh(this,Jl[0])};I.getStatsCase=function(){return Hh(this,Jl[1])};I.toObject=function(b){return om(b,this)}; function om(b,c){var e,g={name:Uh(c,1,""),path:(e=c.getPath())&&lm(b,e),type:Uh(c,2,0),numStats:(e=c.getNumStats())&&rm(b,e),stringStats:(e=c.getStringStats())&&sm(b,e),bytesStats:(e=c.getBytesStats())&&tm(b,e),structStats:(e=c.getStructStats())&&um(b,e),customStatsList:Kh(c.getCustomStatsList(),vm,b)};b&&(g.$jspbMessageInstance=c);return g} function pm(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readString();b.setName(e);break;case 8:e=new Dl;c.readMessage(e,mm);b.setPath(e);break;case 2:e=c.readEnum();b.setType(e);break;case 3:e=new Nl;c.readMessage(e,wm);b.setNumStats(e);break;case 4:e=new Pl;c.readMessage(e,xm);b.setStringStats(e);break;case 5:e=new Wl;c.readMessage(e,ym);b.setBytesStats(e);break;case 7:e=new Xl;c.readMessage(e,ho);b.setStructStats(e);break;case 6:e=new Ll;c.readMessage(e,io); b.addCustomStats(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;qm(this,b);return b.getResultBuffer()}; function qm(b,c){var e=Lh(b,1);null!=e&&c.writeString(1,e);e=b.getPath();null!=e&&c.writeMessage(8,e,nm);e=b.getType();0!==e&&c.writeEnum(2,e);e=b.getNumStats();null!=e&&c.writeMessage(3,e,jo);e=b.getStringStats();null!=e&&c.writeMessage(4,e,ko);e=b.getBytesStats();null!=e&&c.writeMessage(5,e,lo);e=b.getStructStats();null!=e&&c.writeMessage(7,e,mo);e=b.getCustomStatsList();0<e.length&&c.writeRepeatedMessage(6,e,no)}I.getName=function(){return Uh(this,1,"")};I.setName=function(b){pj(this,1,Jl[0],b)}; I.clearName=function(){pj(this,1,Jl[0],void 0)};I.hasName=function(){return null!=Lh(this,1)};I.getPath=function(){return qj(this,Dl,8)};I.setPath=function(b){uj(this,8,Jl[0],b)};I.clearPath=function(){this.setPath(void 0)};I.hasPath=function(){return null!=Lh(this,8)};I.getType=function(){return Uh(this,2,0)};I.setType=function(b){nj(this,2,b)};I.getNumStats=function(){return qj(this,Nl,3)};I.setNumStats=function(b){uj(this,3,Jl[1],b)};I.clearNumStats=function(){this.setNumStats(void 0)}; I.hasNumStats=function(){return null!=Lh(this,3)};I.getStringStats=function(){return qj(this,Pl,4)};I.setStringStats=function(b){uj(this,4,Jl[1],b)};I.clearStringStats=function(){this.setStringStats(void 0)};I.hasStringStats=function(){return null!=Lh(this,4)};I.getBytesStats=function(){return qj(this,Wl,5)};I.setBytesStats=function(b){uj(this,5,Jl[1],b)};I.clearBytesStats=function(){this.setBytesStats(void 0)};I.hasBytesStats=function(){return null!=Lh(this,5)}; I.getStructStats=function(){return qj(this,Xl,7)};I.setStructStats=function(b){uj(this,7,Jl[1],b)};I.clearStructStats=function(){this.setStructStats(void 0)};I.hasStructStats=function(){return null!=Lh(this,7)};I.getCustomStatsList=function(){return rj(this,Ll,6)};I.setCustomStatsList=function(){vj(this,6,[])};I.addCustomStats=function(b){wj(this,6,b,Ll,void 0)};I.clearCustomStatsList=function(){this.setCustomStatsList()};I=Kl.prototype;I.toObject=function(b){return oo(b,this)}; function oo(b,c){var e={numNonMissing:Vh(c,1),numMissing:Vh(c,2),avgNumValues:Vh(c,3),totNumValues:Vh(c,4)};b&&(e.$jspbMessageInstance=c);return e}function po(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readDouble();b.setNumNonMissing(e);break;case 2:e=c.readDouble();b.setNumMissing(e);break;case 3:e=c.readDouble();b.setAvgNumValues(e);break;case 4:e=c.readDouble();b.setTotNumValues(e);break;default:c.skipField()}return b} I.serializeBinary=function(){var b=new wg;qo(this,b);return b.getResultBuffer()};function qo(b,c){var e=b.getNumNonMissing();0!==e&&c.writeDouble(1,e);e=b.getNumMissing();0!==e&&c.writeDouble(2,e);e=b.getAvgNumValues();0!==e&&c.writeDouble(3,e);e=b.getTotNumValues();0!==e&&c.writeDouble(4,e)}I.getNumNonMissing=function(){return Vh(this,1)};I.setNumNonMissing=function(b){lj(this,1,b)};I.getNumMissing=function(){return Vh(this,2)};I.setNumMissing=function(b){lj(this,2,b)}; I.getAvgNumValues=function(){return Vh(this,3)};I.setAvgNumValues=function(b){lj(this,3,b)};I.getTotNumValues=function(){return Vh(this,4)};I.setTotNumValues=function(b){lj(this,4,b)};var Ml=[[2,3,4,5]];I=Ll.prototype;I.getValCase=function(){return Hh(this,Ml[0])};I.toObject=function(b){return vm(b,this)}; function vm(b,c){var e,g={name:Uh(c,1,""),num:Vh(c,2),str:Uh(c,3,""),histogram:(e=c.getHistogram())&&ro(b,e),rankHistogram:(e=c.getRankHistogram())&&so(b,e)};b&&(g.$jspbMessageInstance=c);return g} function io(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readString();b.setName(e);break;case 2:e=c.readDouble();b.setNum(e);break;case 3:e=c.readString();b.setStr(e);break;case 4:e=new Zl;c.readMessage(e,to);b.setHistogram(e);break;case 5:e=new bm;c.readMessage(e,uo);b.setRankHistogram(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;no(this,b);return b.getResultBuffer()}; function no(b,c){var e=b.getName();0<e.length&&c.writeString(1,e);e=Lh(b,2);null!=e&&c.writeDouble(2,e);e=Lh(b,3);null!=e&&c.writeString(3,e);e=b.getHistogram();null!=e&&c.writeMessage(4,e,vo);e=b.getRankHistogram();null!=e&&c.writeMessage(5,e,wo)}I.getName=function(){return Uh(this,1,"")};I.setName=function(b){mj(this,1,b)};I.getNum=function(){return Vh(this,2)};I.setNum=function(b){pj(this,2,Ml[0],b)};I.clearNum=function(){pj(this,2,Ml[0],void 0)};I.hasNum=function(){return null!=Lh(this,2)}; I.getStr=function(){return Uh(this,3,"")};I.setStr=function(b){pj(this,3,Ml[0],b)};I.clearStr=function(){pj(this,3,Ml[0],void 0)};I.hasStr=function(){return null!=Lh(this,3)};I.getHistogram=function(){return qj(this,Zl,4)};I.setHistogram=function(b){uj(this,4,Ml[0],b)};I.clearHistogram=function(){this.setHistogram(void 0)};I.hasHistogram=function(){return null!=Lh(this,4)};I.getRankHistogram=function(){return qj(this,bm,5)};I.setRankHistogram=function(b){uj(this,5,Ml[0],b)};I.clearRankHistogram=function(){this.setRankHistogram(void 0)}; I.hasRankHistogram=function(){return null!=Lh(this,5)};var Ol=[8];I=Nl.prototype;I.toObject=function(b){return rm(b,this)};function rm(b,c){var e,g={commonStats:(e=c.getCommonStats())&&xo(b,e),mean:Vh(c,2),stdDev:Vh(c,3),numZeros:Uh(c,4,0),min:Vh(c,5),median:Vh(c,6),max:Vh(c,7),histogramsList:Kh(c.getHistogramsList(),ro,b),weightedNumericStats:(e=c.getWeightedNumericStats())&&yo(b,e)};b&&(g.$jspbMessageInstance=c);return g} function wm(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Yl;c.readMessage(e,zo);b.setCommonStats(e);break;case 2:e=c.readDouble();b.setMean(e);break;case 3:e=c.readDouble();b.setStdDev(e);break;case 4:e=c.readUint64();b.setNumZeros(e);break;case 5:e=c.readDouble();b.setMin(e);break;case 6:e=c.readDouble();b.setMedian(e);break;case 7:e=c.readDouble();b.setMax(e);break;case 8:e=new Zl;c.readMessage(e,to);b.addHistograms(e);break;case 9:e=new Sl;c.readMessage(e, Ao);b.setWeightedNumericStats(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;jo(this,b);return b.getResultBuffer()}; function jo(b,c){var e=b.getCommonStats();null!=e&&c.writeMessage(1,e,Bo);e=b.getMean();0!==e&&c.writeDouble(2,e);e=b.getStdDev();0!==e&&c.writeDouble(3,e);e=b.getNumZeros();0!==e&&c.writeUint64(4,e);e=b.getMin();0!==e&&c.writeDouble(5,e);e=b.getMedian();0!==e&&c.writeDouble(6,e);e=b.getMax();0!==e&&c.writeDouble(7,e);e=b.getHistogramsList();0<e.length&&c.writeRepeatedMessage(8,e,vo);e=b.getWeightedNumericStats();null!=e&&c.writeMessage(9,e,Co)}I.getCommonStats=function(){return qj(this,Yl,1)}; I.setCommonStats=function(b){tj(this,1,b)};I.clearCommonStats=function(){this.setCommonStats(void 0)};I.hasCommonStats=function(){return null!=Lh(this,1)};I.getMean=function(){return Vh(this,2)};I.setMean=function(b){lj(this,2,b)};I.getStdDev=function(){return Vh(this,3)};I.setStdDev=function(b){lj(this,3,b)};I.getNumZeros=function(){return Uh(this,4,0)};I.setNumZeros=function(b){Yh(this,4,b)};I.getMin=function(){return Vh(this,5)};I.setMin=function(b){lj(this,5,b)}; I.getMedian=function(){return Vh(this,6)};I.setMedian=function(b){lj(this,6,b)};I.getMax=function(){return Vh(this,7)};I.setMax=function(b){lj(this,7,b)};I.getHistogramsList=function(){return rj(this,Zl,8)};I.setHistogramsList=function(b){vj(this,8,b)};I.addHistograms=function(b){return wj(this,8,b,Zl,void 0)};I.clearHistogramsList=function(){this.setHistogramsList([])};I.getWeightedNumericStats=function(){return qj(this,Sl,9)};I.setWeightedNumericStats=function(b){tj(this,9,b)}; I.clearWeightedNumericStats=function(){this.setWeightedNumericStats(void 0)};I.hasWeightedNumericStats=function(){return null!=Lh(this,9)};var Ql=[3];Pl.prototype.toObject=function(b){return sm(b,this)};function sm(b,c){var e,g={commonStats:(e=c.getCommonStats())&&xo(b,e),unique:Uh(c,2,0),topValuesList:Kh(c.getTopValuesList(),Do,b),avgLength:Vh(c,4),rankHistogram:(e=c.getRankHistogram())&&so(b,e),weightedStringStats:(e=c.getWeightedStringStats())&&Eo(b,e)};b&&(g.$jspbMessageInstance=c);return g} function xm(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Yl;c.readMessage(e,zo);b.setCommonStats(e);break;case 2:e=c.readUint64();b.setUnique(e);break;case 3:e=new Rl;c.readMessage(e,Fo);b.addTopValues(e);break;case 4:e=c.readFloat();b.setAvgLength(e);break;case 5:e=new bm;c.readMessage(e,uo);b.setRankHistogram(e);break;case 6:e=new Ul;c.readMessage(e,Go);b.setWeightedStringStats(e);break;default:c.skipField()}return b} Pl.prototype.serializeBinary=function(){var b=new wg;ko(this,b);return b.getResultBuffer()};function ko(b,c){var e=b.getCommonStats();null!=e&&c.writeMessage(1,e,Bo);e=b.getUnique();0!==e&&c.writeUint64(2,e);e=b.getTopValuesList();0<e.length&&c.writeRepeatedMessage(3,e,Ho);e=b.getAvgLength();0!==e&&c.writeFloat(4,e);e=b.getRankHistogram();null!=e&&c.writeMessage(5,e,wo);e=b.getWeightedStringStats();null!=e&&c.writeMessage(6,e,Io)}I=Rl.prototype;I.toObject=function(b){return Do(b,this)}; function Do(b,c){var e={deprecatedFreq:Uh(c,1,0),value:Uh(c,2,""),frequency:Vh(c,3)};b&&(e.$jspbMessageInstance=c);return e}function Fo(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readUint64();b.setDeprecatedFreq(e);break;case 2:e=c.readString();b.setValue(e);break;case 3:e=c.readDouble();b.setFrequency(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Ho(this,b);return b.getResultBuffer()}; function Ho(b,c){var e=b.getDeprecatedFreq();0!==e&&c.writeUint64(1,e);e=b.getValue();0<e.length&&c.writeString(2,e);e=b.getFrequency();0!==e&&c.writeDouble(3,e)}I.getDeprecatedFreq=function(){return Uh(this,1,0)};I.setDeprecatedFreq=function(b){Yh(this,1,b)};I.getValue=function(){return Uh(this,2,"")};I.setValue=function(b){mj(this,2,b)};I.getFrequency=function(){return Vh(this,3)};I.setFrequency=function(b){lj(this,3,b)};I=Pl.prototype;I.getCommonStats=function(){return qj(this,Yl,1)}; I.setCommonStats=function(b){tj(this,1,b)};I.clearCommonStats=function(){this.setCommonStats(void 0)};I.hasCommonStats=function(){return null!=Lh(this,1)};I.getUnique=function(){return Uh(this,2,0)};I.setUnique=function(b){Yh(this,2,b)};I.getTopValuesList=function(){return rj(this,Rl,3)};I.setTopValuesList=function(b){vj(this,3,b)};I.addTopValues=function(b){return wj(this,3,b,Rl,void 0)};I.clearTopValuesList=function(){this.setTopValuesList([])};I.getAvgLength=function(){return Vh(this,4)}; I.setAvgLength=function(b){lj(this,4,b)};I.getRankHistogram=function(){return qj(this,bm,5)};I.setRankHistogram=function(b){tj(this,5,b)};I.clearRankHistogram=function(){this.setRankHistogram(void 0)};I.hasRankHistogram=function(){return null!=Lh(this,5)};I.getWeightedStringStats=function(){return qj(this,Ul,6)};I.setWeightedStringStats=function(b){tj(this,6,b)};I.clearWeightedStringStats=function(){this.setWeightedStringStats(void 0)};I.hasWeightedStringStats=function(){return null!=Lh(this,6)}; var Tl=[4];I=Sl.prototype;I.toObject=function(b){return yo(b,this)};function yo(b,c){var e={mean:Vh(c,1),stdDev:Vh(c,2),median:Vh(c,3),histogramsList:Kh(c.getHistogramsList(),ro,b)};b&&(e.$jspbMessageInstance=c);return e} function Ao(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readDouble();b.setMean(e);break;case 2:e=c.readDouble();b.setStdDev(e);break;case 3:e=c.readDouble();b.setMedian(e);break;case 4:e=new Zl;c.readMessage(e,to);b.addHistograms(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Co(this,b);return b.getResultBuffer()}; function Co(b,c){var e=b.getMean();0!==e&&c.writeDouble(1,e);e=b.getStdDev();0!==e&&c.writeDouble(2,e);e=b.getMedian();0!==e&&c.writeDouble(3,e);e=b.getHistogramsList();0<e.length&&c.writeRepeatedMessage(4,e,vo)}I.getMean=function(){return Vh(this,1)};I.setMean=function(b){lj(this,1,b)};I.getStdDev=function(){return Vh(this,2)};I.setStdDev=function(b){lj(this,2,b)};I.getMedian=function(){return Vh(this,3)};I.setMedian=function(b){lj(this,3,b)};I.getHistogramsList=function(){return rj(this,Zl,4)}; I.setHistogramsList=function(b){vj(this,4,b)};I.addHistograms=function(b){return wj(this,4,b,Zl,void 0)};I.clearHistogramsList=function(){this.setHistogramsList([])};var Vl=[1];I=Ul.prototype;I.toObject=function(b){return Eo(b,this)};function Eo(b,c){var e,g={topValuesList:Kh(c.getTopValuesList(),Do,b),rankHistogram:(e=c.getRankHistogram())&&so(b,e)};b&&(g.$jspbMessageInstance=c);return g} function Go(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Rl;c.readMessage(e,Fo);b.addTopValues(e);break;case 2:e=new bm;c.readMessage(e,uo);b.setRankHistogram(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Io(this,b);return b.getResultBuffer()};function Io(b,c){var e=b.getTopValuesList();0<e.length&&c.writeRepeatedMessage(1,e,Ho);e=b.getRankHistogram();null!=e&&c.writeMessage(2,e,wo)} I.getTopValuesList=function(){return rj(this,Rl,1)};I.setTopValuesList=function(b){vj(this,1,b)};I.addTopValues=function(b){return wj(this,1,b,Rl,void 0)};I.clearTopValuesList=function(){this.setTopValuesList([])};I.getRankHistogram=function(){return qj(this,bm,2)};I.setRankHistogram=function(b){tj(this,2,b)};I.clearRankHistogram=function(){this.setRankHistogram(void 0)};I.hasRankHistogram=function(){return null!=Lh(this,2)};I=Wl.prototype;I.toObject=function(b){return tm(b,this)}; function tm(b,c){var e,g={commonStats:(e=c.getCommonStats())&&xo(b,e),unique:Uh(c,2,0),avgNumBytes:Vh(c,3),minNumBytes:Vh(c,4),maxNumBytes:Vh(c,5)};b&&(g.$jspbMessageInstance=c);return g} function ym(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Yl;c.readMessage(e,zo);b.setCommonStats(e);break;case 2:e=c.readUint64();b.setUnique(e);break;case 3:e=c.readFloat();b.setAvgNumBytes(e);break;case 4:e=c.readFloat();b.setMinNumBytes(e);break;case 5:e=c.readFloat();b.setMaxNumBytes(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;lo(this,b);return b.getResultBuffer()}; function lo(b,c){var e=b.getCommonStats();null!=e&&c.writeMessage(1,e,Bo);e=b.getUnique();0!==e&&c.writeUint64(2,e);e=b.getAvgNumBytes();0!==e&&c.writeFloat(3,e);e=b.getMinNumBytes();0!==e&&c.writeFloat(4,e);e=b.getMaxNumBytes();0!==e&&c.writeFloat(5,e)}I.getCommonStats=function(){return qj(this,Yl,1)};I.setCommonStats=function(b){tj(this,1,b)};I.clearCommonStats=function(){this.setCommonStats(void 0)};I.hasCommonStats=function(){return null!=Lh(this,1)};I.getUnique=function(){return Uh(this,2,0)}; I.setUnique=function(b){Yh(this,2,b)};I.getAvgNumBytes=function(){return Vh(this,3)};I.setAvgNumBytes=function(b){lj(this,3,b)};I.getMinNumBytes=function(){return Vh(this,4)};I.setMinNumBytes=function(b){lj(this,4,b)};I.getMaxNumBytes=function(){return Vh(this,5)};I.setMaxNumBytes=function(b){lj(this,5,b)};I=Xl.prototype;I.toObject=function(b){return um(b,this)};function um(b,c){var e,g={commonStats:(e=c.getCommonStats())&&xo(b,e)};b&&(g.$jspbMessageInstance=c);return g} function ho(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new Yl;c.readMessage(e,zo);b.setCommonStats(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;mo(this,b);return b.getResultBuffer()};function mo(b,c){b=b.getCommonStats();null!=b&&c.writeMessage(1,b,Bo)}I.getCommonStats=function(){return qj(this,Yl,1)};I.setCommonStats=function(b){tj(this,1,b)};I.clearCommonStats=function(){this.setCommonStats(void 0)}; I.hasCommonStats=function(){return null!=Lh(this,1)};I=Yl.prototype;I.toObject=function(b){return xo(b,this)}; function xo(b,c){var e,g={numNonMissing:Uh(c,1,0),numMissing:Uh(c,2,0),minNumValues:Uh(c,3,0),maxNumValues:Uh(c,4,0),avgNumValues:Vh(c,5),totNumValues:Uh(c,8,0),numValuesHistogram:(e=c.getNumValuesHistogram())&&ro(b,e),weightedCommonStats:(e=c.getWeightedCommonStats())&&oo(b,e),featureListLengthHistogram:(e=c.getFeatureListLengthHistogram())&&ro(b,e)};b&&(g.$jspbMessageInstance=c);return g} function zo(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readUint64();b.setNumNonMissing(e);break;case 2:e=c.readUint64();b.setNumMissing(e);break;case 3:e=c.readUint64();b.setMinNumValues(e);break;case 4:e=c.readUint64();b.setMaxNumValues(e);break;case 5:e=c.readFloat();b.setAvgNumValues(e);break;case 8:e=c.readUint64();b.setTotNumValues(e);break;case 6:e=new Zl;c.readMessage(e,to);b.setNumValuesHistogram(e);break;case 7:e=new Kl;c.readMessage(e,po);b.setWeightedCommonStats(e); break;case 9:e=new Zl;c.readMessage(e,to);b.setFeatureListLengthHistogram(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Bo(this,b);return b.getResultBuffer()}; function Bo(b,c){var e=b.getNumNonMissing();0!==e&&c.writeUint64(1,e);e=b.getNumMissing();0!==e&&c.writeUint64(2,e);e=b.getMinNumValues();0!==e&&c.writeUint64(3,e);e=b.getMaxNumValues();0!==e&&c.writeUint64(4,e);e=b.getAvgNumValues();0!==e&&c.writeFloat(5,e);e=b.getTotNumValues();0!==e&&c.writeUint64(8,e);e=b.getNumValuesHistogram();null!=e&&c.writeMessage(6,e,vo);e=b.getWeightedCommonStats();null!=e&&c.writeMessage(7,e,qo);e=b.getFeatureListLengthHistogram();null!=e&&c.writeMessage(9,e,vo)} I.getNumNonMissing=function(){return Uh(this,1,0)};I.setNumNonMissing=function(b){Yh(this,1,b)};I.getNumMissing=function(){return Uh(this,2,0)};I.setNumMissing=function(b){Yh(this,2,b)};I.getMinNumValues=function(){return Uh(this,3,0)};I.setMinNumValues=function(b){Yh(this,3,b)};I.getMaxNumValues=function(){return Uh(this,4,0)};I.setMaxNumValues=function(b){Yh(this,4,b)};I.getAvgNumValues=function(){return Vh(this,5)};I.setAvgNumValues=function(b){lj(this,5,b)}; I.getTotNumValues=function(){return Uh(this,8,0)};I.setTotNumValues=function(b){Yh(this,8,b)};I.getNumValuesHistogram=function(){return qj(this,Zl,6)};I.setNumValuesHistogram=function(b){tj(this,6,b)};I.clearNumValuesHistogram=function(){this.setNumValuesHistogram(void 0)};I.hasNumValuesHistogram=function(){return null!=Lh(this,6)};I.getWeightedCommonStats=function(){return qj(this,Kl,7)};I.setWeightedCommonStats=function(b){tj(this,7,b)};I.clearWeightedCommonStats=function(){this.setWeightedCommonStats(void 0)}; I.hasWeightedCommonStats=function(){return null!=Lh(this,7)};I.getFeatureListLengthHistogram=function(){return qj(this,Zl,9)};I.setFeatureListLengthHistogram=function(b){tj(this,9,b)};I.clearFeatureListLengthHistogram=function(){this.setFeatureListLengthHistogram(void 0)};I.hasFeatureListLengthHistogram=function(){return null!=Lh(this,9)};var $l=[3];Zl.prototype.toObject=function(b){return ro(b,this)}; function ro(b,c){var e={numNan:Uh(c,1,0),numUndefined:Uh(c,2,0),bucketsList:Kh(c.getBucketsList(),Jo,b),type:Uh(c,4,0),name:Uh(c,5,"")};b&&(e.$jspbMessageInstance=c);return e} function to(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readUint64();b.setNumNan(e);break;case 2:e=c.readUint64();b.setNumUndefined(e);break;case 3:e=new am;c.readMessage(e,Ko);b.addBuckets(e);break;case 4:e=c.readEnum();b.setType(e);break;case 5:e=c.readString();b.setName(e);break;default:c.skipField()}return b}Zl.prototype.serializeBinary=function(){var b=new wg;vo(this,b);return b.getResultBuffer()}; function vo(b,c){var e=b.getNumNan();0!==e&&c.writeUint64(1,e);e=b.getNumUndefined();0!==e&&c.writeUint64(2,e);e=b.getBucketsList();0<e.length&&c.writeRepeatedMessage(3,e,Lo);e=b.getType();0!==e&&c.writeEnum(4,e);e=b.getName();0<e.length&&c.writeString(5,e)}I=am.prototype;I.toObject=function(b){return Jo(b,this)};function Jo(b,c){var e={lowValue:Vh(c,1),highValue:Vh(c,2),deprecatedCount:Uh(c,3,0),sampleCount:Vh(c,4)};b&&(e.$jspbMessageInstance=c);return e} function Ko(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readDouble();b.setLowValue(e);break;case 2:e=c.readDouble();b.setHighValue(e);break;case 3:e=c.readUint64();b.setDeprecatedCount(e);break;case 4:e=c.readDouble();b.setSampleCount(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Lo(this,b);return b.getResultBuffer()}; function Lo(b,c){var e=b.getLowValue();0!==e&&c.writeDouble(1,e);e=b.getHighValue();0!==e&&c.writeDouble(2,e);e=b.getDeprecatedCount();0!==e&&c.writeUint64(3,e);e=b.getSampleCount();0!==e&&c.writeDouble(4,e)}I.getLowValue=function(){return Vh(this,1)};I.setLowValue=function(b){lj(this,1,b)};I.getHighValue=function(){return Vh(this,2)};I.setHighValue=function(b){lj(this,2,b)};I.getDeprecatedCount=function(){return Uh(this,3,0)};I.setDeprecatedCount=function(b){Yh(this,3,b)}; I.getSampleCount=function(){return Vh(this,4)};I.setSampleCount=function(b){lj(this,4,b)};I=Zl.prototype;I.getNumNan=function(){return Uh(this,1,0)};I.setNumNan=function(b){Yh(this,1,b)};I.getNumUndefined=function(){return Uh(this,2,0)};I.setNumUndefined=function(b){Yh(this,2,b)};I.getBucketsList=function(){return rj(this,am,3)};I.setBucketsList=function(b){vj(this,3,b)};I.addBuckets=function(b){return wj(this,3,b,am,void 0)};I.clearBucketsList=function(){this.setBucketsList([])}; I.getType=function(){return Uh(this,4,0)};I.setType=function(b){nj(this,4,b)};I.getName=function(){return Uh(this,5,"")};I.setName=function(b){mj(this,5,b)};var cm=[1];bm.prototype.toObject=function(b){return so(b,this)};function so(b,c){var e={bucketsList:Kh(c.getBucketsList(),Mo,b),name:Uh(c,2,"")};b&&(e.$jspbMessageInstance=c);return e} function uo(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=new dm;c.readMessage(e,No);b.addBuckets(e);break;case 2:e=c.readString();b.setName(e);break;default:c.skipField()}return b}bm.prototype.serializeBinary=function(){var b=new wg;wo(this,b);return b.getResultBuffer()};function wo(b,c){var e=b.getBucketsList();0<e.length&&c.writeRepeatedMessage(1,e,Oo);e=b.getName();0<e.length&&c.writeString(2,e)}I=dm.prototype;I.toObject=function(b){return Mo(b,this)}; function Mo(b,c){var e={lowRank:Uh(c,1,0),highRank:Uh(c,2,0),deprecatedCount:Uh(c,3,0),label:Uh(c,4,""),sampleCount:Vh(c,5)};b&&(e.$jspbMessageInstance=c);return e} function No(b,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var e=c.readUint64();b.setLowRank(e);break;case 2:e=c.readUint64();b.setHighRank(e);break;case 3:e=c.readUint64();b.setDeprecatedCount(e);break;case 4:e=c.readString();b.setLabel(e);break;case 5:e=c.readDouble();b.setSampleCount(e);break;default:c.skipField()}return b}I.serializeBinary=function(){var b=new wg;Oo(this,b);return b.getResultBuffer()}; function Oo(b,c){var e=b.getLowRank();0!==e&&c.writeUint64(1,e);e=b.getHighRank();0!==e&&c.writeUint64(2,e);e=b.getDeprecatedCount();0!==e&&c.writeUint64(3,e);e=b.getLabel();0<e.length&&c.writeString(4,e);e=b.getSampleCount();0!==e&&c.writeDouble(5,e)}I.getLowRank=function(){return Uh(this,1,0)};I.setLowRank=function(b){Yh(this,1,b)};I.getHighRank=function(){return Uh(this,2,0)};I.setHighRank=function(b){Yh(this,2,b)};I.getDeprecatedCount=function(){return Uh(this,3,0)}; I.setDeprecatedCount=function(b){Yh(this,3,b)};I.getLabel=function(){return Uh(this,4,"")};I.setLabel=function(b){mj(this,4,b)};I.getSampleCount=function(){return Vh(this,5)};I.setSampleCount=function(b){lj(this,5,b)};I=bm.prototype;I.getBucketsList=function(){return rj(this,dm,1)};I.setBucketsList=function(b){vj(this,1,b)};I.addBuckets=function(b){return wj(this,1,b,dm,void 0)};I.clearBucketsList=function(){this.setBucketsList([])};I.getName=function(){return Uh(this,2,"")}; I.setName=function(b){mj(this,2,b)}; //# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/deps.js //# sourceURL=build://security.html.js window.Polymer={strictTemplatePolicy:!0}; // Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. !function(a,b){var c={},d={},e={},f=null;!function(a,b){function c(a){if("number"==typeof a)return a;var b={};for(var c in a)b[c]=a[c];return b}function d(){this._delay=0,this._endDelay=0,this._fill="none",this._iterationStart=0,this._iterations=1,this._duration=0,this._playbackRate=1,this._direction="normal",this._easing="linear",this._easingFunction=w}function e(){return a.isDeprecated("Invalid timing inputs","2016-03-02","TypeError exceptions will be thrown instead.",!0)}function f(b,c,e){var f=new d;return c&&(f.fill="both",f.duration="auto"),"number"!=typeof b||isNaN(b)?void 0!==b&&Object.getOwnPropertyNames(b).forEach(function(c){if("auto"!=b[c]){if(("number"==typeof f[c]||"duration"==c)&&("number"!=typeof b[c]||isNaN(b[c])))return;if("fill"==c&&-1==u.indexOf(b[c]))return;if("direction"==c&&-1==v.indexOf(b[c]))return;if("playbackRate"==c&&1!==b[c]&&a.isDeprecated("AnimationEffectTiming.playbackRate","2014-11-28","Use Animation.playbackRate instead."))return;f[c]=b[c]}}):f.duration=b,f}function g(a){return"number"==typeof a&&(a=isNaN(a)?{duration:0}:{duration:a}),a}function h(b,c){return b=a.numericTimingToObject(b),f(b,c)}function i(a,b,c,d){return 0>a||a>1||0>c||c>1?w:function(e){function f(a,b,c){return 3*a*(1-c)*(1-c)*c+3*b*(1-c)*c*c+c*c*c}if(0==e||1==e)return e;for(var g=0,h=1;;){var i=(g+h)/2,j=f(a,c,i);if(Math.abs(e-j)<1e-4)return f(b,d,i);e>j?g=i:h=i}}}function j(a,b){return function(c){if(c>=1)return 1;var d=1/a;return c+=b*d,c-c%d}}function k(a){B||(B=document.createElement("div").style),B.animationTimingFunction="",B.animationTimingFunction=a;var b=B.animationTimingFunction;if(""==b&&e())throw new TypeError(a+" is not a valid value for easing");var c=D.exec(b);if(c)return i.apply(this,c.slice(1).map(Number));var d=E.exec(b);if(d)return j(Number(d[1]),{start:x,middle:y,end:z}[d[2]]);var f=A[b];return f?f:w}function l(a){return Math.abs(m(a)/a.playbackRate)}function m(a){return a.duration*a.iterations}function n(a,b,c){return null==b?F:b<c.delay?G:b>=c.delay+a?H:I}function o(a,b,c,d,e){switch(d){case G:return"backwards"==b||"both"==b?0:null;case I:return c-e;case H:return"forwards"==b||"both"==b?a:null;case F:return null}}function p(a,b,c,d){return(d.playbackRate<0?b-a:b)*d.playbackRate+c}function q(a,b,c,d,e){return c===1/0||c===-(1/0)||c-d==b&&e.iterations&&(e.iterations+e.iterationStart)%1==0?a:c%a}function r(a,b,c,d){return 0===c?0:b==a?d.iterationStart+d.iterations-1:Math.floor(c/a)}function s(a,b,c,d){var e=a%2>=1,f="normal"==d.direction||d.direction==(e?"alternate-reverse":"alternate"),g=f?c:b-c,h=g/b;return b*d._easingFunction(h)}function t(a,b,c){var d=n(a,b,c),e=o(a,c.fill,b,d,c.delay);if(null===e)return null;if(0===a)return d===G?0:1;var f=c.iterationStart*c.duration,g=p(a,e,f,c),h=q(c.duration,m(c),g,f,c),i=r(c.duration,h,g,c);return s(i,c.duration,h,c)/c.duration}var u="backwards|forwards|both|none".split("|"),v="reverse|alternate|alternate-reverse".split("|"),w=function(a){return a};d.prototype={_setMember:function(b,c){this["_"+b]=c,this._effect&&(this._effect._timingInput[b]=c,this._effect._timing=a.normalizeTimingInput(this._effect._timingInput),this._effect.activeDuration=a.calculateActiveDuration(this._effect._timing),this._effect._animation&&this._effect._animation._rebuildUnderlyingAnimation())},get playbackRate(){return this._playbackRate},set delay(a){this._setMember("delay",a)},get delay(){return this._delay},set endDelay(a){this._setMember("endDelay",a)},get endDelay(){return this._endDelay},set fill(a){this._setMember("fill",a)},get fill(){return this._fill},set iterationStart(a){if((isNaN(a)||0>a)&&e())throw new TypeError("iterationStart must be a non-negative number, received: "+timing.iterationStart);this._setMember("iterationStart",a)},get iterationStart(){return this._iterationStart},set duration(a){if("auto"!=a&&(isNaN(a)||0>a)&&e())throw new TypeError("duration must be non-negative or auto, received: "+a);this._setMember("duration",a)},get duration(){return this._duration},set direction(a){this._setMember("direction",a)},get direction(){return this._direction},set easing(a){this._easingFunction=k(a),this._setMember("easing",a)},get easing(){return this._easing},set iterations(a){if((isNaN(a)||0>a)&&e())throw new TypeError("iterations must be non-negative, received: "+a);this._setMember("iterations",a)},get iterations(){return this._iterations}};var x=1,y=.5,z=0,A={ease:i(.25,.1,.25,1),"ease-in":i(.42,0,1,1),"ease-out":i(0,0,.58,1),"ease-in-out":i(.42,0,.58,1),"step-start":j(1,x),"step-middle":j(1,y),"step-end":j(1,z)},B=null,C="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",D=new RegExp("cubic-bezier\\("+C+","+C+","+C+","+C+"\\)"),E=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/,F=0,G=1,H=2,I=3;a.cloneTimingInput=c,a.makeTiming=f,a.numericTimingToObject=g,a.normalizeTimingInput=h,a.calculateActiveDuration=l,a.calculateTimeFraction=t,a.calculatePhase=n,a.toTimingFunction=k}(c,f),function(a,b){function c(a,b){return a in j?j[a][b]||b:b}function d(a,b,d){var e=g[a];if(e){h.style[a]=b;for(var f in e){var i=e[f],j=h.style[i];d[i]=c(i,j)}}else d[a]=c(a,b)}function e(a){var b=[];for(var c in a)if(!(c in["easing","offset","composite"])){var d=a[c];Array.isArray(d)||(d=[d]);for(var e,f=d.length,g=0;f>g;g++)e={},"offset"in a?e.offset=a.offset:1==f?e.offset=1:e.offset=g/(f-1),"easing"in a&&(e.easing=a.easing),"composite"in a&&(e.composite=a.composite),e[c]=d[g],b.push(e)}return b.sort(function(a,b){return a.offset-b.offset}),b}function f(a){function b(){var a=c.length;null==c[a-1].offset&&(c[a-1].offset=1),a>1&&null==c[0].offset&&(c[0].offset=0);for(var b=0,d=c[0].offset,e=1;a>e;e++){var f=c[e].offset;if(null!=f){for(var g=1;e-b>g;g++)c[b+g].offset=d+(f-d)*g/(e-b);b=e,d=f}}}if(null==a)return[];window.Symbol&&Symbol.iterator&&Array.prototype.from&&a[Symbol.iterator]&&(a=Array.from(a)),Array.isArray(a)||(a=e(a));for(var c=a.map(function(a){var b={};for(var c in a){var e=a[c];if("offset"==c){if(null!=e&&(e=Number(e),!isFinite(e)))throw new TypeError("keyframe offsets must be numbers.")}else{if("composite"==c)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"add compositing is not supported"};e=""+e}d(c,e,b)}return void 0==b.offset&&(b.offset=null),b}),f=!0,g=-(1/0),h=0;h<c.length;h++){var i=c[h].offset;if(null!=i){if(g>i)throw{code:DOMException.INVALID_MODIFICATION_ERR,name:"InvalidModificationError",message:"Keyframes are not loosely sorted by offset. Sort or specify offsets."};g=i}else f=!1}return c=c.filter(function(a){return a.offset>=0&&a.offset<=1}),f||b(),c}var g={background:["backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundAttachment","backgroundOrigin","backgroundClip","backgroundColor"],border:["borderTopColor","borderTopStyle","borderTopWidth","borderRightColor","borderRightStyle","borderRightWidth","borderBottomColor","borderBottomStyle","borderBottomWidth","borderLeftColor","borderLeftStyle","borderLeftWidth"],borderBottom:["borderBottomWidth","borderBottomStyle","borderBottomColor"],borderColor:["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],borderLeft:["borderLeftWidth","borderLeftStyle","borderLeftColor"],borderRadius:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],borderRight:["borderRightWidth","borderRightStyle","borderRightColor"],borderTop:["borderTopWidth","borderTopStyle","borderTopColor"],borderWidth:["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],flex:["flexGrow","flexShrink","flexBasis"],font:["fontFamily","fontSize","fontStyle","fontVariant","fontWeight","lineHeight"],margin:["marginTop","marginRight","marginBottom","marginLeft"],outline:["outlineColor","outlineStyle","outlineWidth"],padding:["paddingTop","paddingRight","paddingBottom","paddingLeft"]},h=document.createElementNS("http://www.w3.org/1999/xhtml","div"),i={thin:"1px",medium:"3px",thick:"5px"},j={borderBottomWidth:i,borderLeftWidth:i,borderRightWidth:i,borderTopWidth:i,fontSize:{"xx-small":"60%","x-small":"75%",small:"89%",medium:"100%",large:"120%","x-large":"150%","xx-large":"200%"},fontWeight:{normal:"400",bold:"700"},outlineWidth:i,textShadow:{none:"0px 0px 0px transparent"},boxShadow:{none:"0px 0px 0px 0px transparent"}};a.convertToArrayForm=e,a.normalizeKeyframes=f}(c,f),function(a){var b={};a.isDeprecated=function(a,c,d,e){var f=e?"are":"is",g=new Date,h=new Date(c);return h.setMonth(h.getMonth()+3),h>g?(a in b||console.warn("Web Animations: "+a+" "+f+" deprecated and will stop working on "+h.toDateString()+". "+d),b[a]=!0,!1):!0},a.deprecated=function(b,c,d,e){var f=e?"are":"is";if(a.isDeprecated(b,c,d,e))throw new Error(b+" "+f+" no longer supported. "+d)}}(c),function(){if(document.documentElement.animate){var a=document.documentElement.animate([],0),b=!0;if(a&&(b=!1,"play|currentTime|pause|reverse|playbackRate|cancel|finish|startTime|playState".split("|").forEach(function(c){void 0===a[c]&&(b=!0)})),!b)return}!function(a,b,c){function d(a){for(var b={},c=0;c<a.length;c++)for(var d in a[c])if("offset"!=d&&"easing"!=d&&"composite"!=d){var e={offset:a[c].offset,easing:a[c].easing,value:a[c][d]};b[d]=b[d]||[],b[d].push(e)}for(var f in b){var g=b[f];if(0!=g[0].offset||1!=g[g.length-1].offset)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"Partial keyframes are not supported"}}return b}function e(c){var d=[];for(var e in c)for(var f=c[e],g=0;g<f.length-1;g++){var h=f[g].offset,i=f[g+1].offset,j=f[g].value,k=f[g+1].value,l=f[g].easing;h==i&&(1==i?j=k:k=j),d.push({startTime:h,endTime:i,easing:a.toTimingFunction(l?l:"linear"),property:e,interpolation:b.propertyInterpolation(e,j,k)})}return d.sort(function(a,b){return a.startTime-b.startTime}),d}b.convertEffectInput=function(c){var f=a.normalizeKeyframes(c),g=d(f),h=e(g);return function(a,c){if(null!=c)h.filter(function(a){return 0>=c&&0==a.startTime||c>=1&&1==a.endTime||c>=a.startTime&&c<=a.endTime}).forEach(function(d){var e=c-d.startTime,f=d.endTime-d.startTime,g=0==f?0:d.easing(e/f);b.apply(a,d.property,d.interpolation(g))});else for(var d in g)"offset"!=d&&"easing"!=d&&"composite"!=d&&b.clear(a,d)}}}(c,d,f),function(a,b,c){function d(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function e(a,b,c){h[c]=h[c]||[],h[c].push([a,b])}function f(a,b,c){for(var f=0;f<c.length;f++){var g=c[f];e(a,b,d(g))}}function g(c,e,f){var g=c;/-/.test(c)&&!a.isDeprecated("Hyphenated property names","2016-03-22","Use camelCase instead.",!0)&&(g=d(c)),"initial"!=e&&"initial"!=f||("initial"==e&&(e=i[g]),"initial"==f&&(f=i[g]));for(var j=e==f?[]:h[g],k=0;j&&k<j.length;k++){var l=j[k][0](e),m=j[k][0](f);if(void 0!==l&&void 0!==m){var n=j[k][1](l,m);if(n){var o=b.Interpolation.apply(null,n);return function(a){return 0==a?e:1==a?f:o(a)}}}}return b.Interpolation(!1,!0,function(a){return a?f:e})}var h={};b.addPropertiesHandler=f;var i={backgroundColor:"transparent",backgroundPosition:"0% 0%",borderBottomColor:"currentColor",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",borderBottomWidth:"3px",borderLeftColor:"currentColor",borderLeftWidth:"3px",borderRightColor:"currentColor",borderRightWidth:"3px",borderSpacing:"2px",borderTopColor:"currentColor",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderTopWidth:"3px",bottom:"auto",clip:"rect(0px, 0px, 0px, 0px)",color:"black",fontSize:"100%",fontWeight:"400",height:"auto",left:"auto",letterSpacing:"normal",lineHeight:"120%",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",marginTop:"0px",maxHeight:"none",maxWidth:"none",minHeight:"0px",minWidth:"0px",opacity:"1.0",outlineColor:"invert",outlineOffset:"0px",outlineWidth:"3px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",paddingTop:"0px",right:"auto",textIndent:"0px",textShadow:"0px 0px 0px transparent",top:"auto",transform:"",verticalAlign:"0px",visibility:"visible",width:"auto",wordSpacing:"normal",zIndex:"auto"};b.propertyInterpolation=g}(c,d,f),function(a,b,c){function d(b){var c=a.calculateActiveDuration(b),d=function(d){return a.calculateTimeFraction(c,d,b)};return d._totalDuration=b.delay+c+b.endDelay,d._isCurrent=function(d){var e=a.calculatePhase(c,d,b);return e===PhaseActive||e===PhaseBefore},d}b.KeyframeEffect=function(c,e,f,g){var h,i=d(a.normalizeTimingInput(f)),j=b.convertEffectInput(e),k=function(){j(c,h)};return k._update=function(a){return h=i(a),null!==h},k._clear=function(){j(c,null)},k._hasSameTarget=function(a){return c===a},k._isCurrent=i._isCurrent,k._totalDuration=i._totalDuration,k._id=g,k},b.NullEffect=function(a){var b=function(){a&&(a(),a=null)};return b._update=function(){return null},b._totalDuration=0,b._isCurrent=function(){return!1},b._hasSameTarget=function(){return!1},b}}(c,d,f),function(a,b){a.apply=function(b,c,d){b.style[a.propertyName(c)]=d},a.clear=function(b,c){b.style[a.propertyName(c)]=""}}(d,f),function(a){window.Element.prototype.animate=function(b,c){var d="";return c&&c.id&&(d=c.id),a.timeline._play(a.KeyframeEffect(this,b,c,d))}}(d),function(a,b){function c(a,b,d){if("number"==typeof a&&"number"==typeof b)return a*(1-d)+b*d;if("boolean"==typeof a&&"boolean"==typeof b)return.5>d?a:b;if(a.length==b.length){for(var e=[],f=0;f<a.length;f++)e.push(c(a[f],b[f],d));return e}throw"Mismatched interpolation arguments "+a+":"+b}a.Interpolation=function(a,b,d){return function(e){return d(c(a,b,e))}}}(d,f),function(a,b,c){a.sequenceNumber=0;var d=function(a,b,c){this.target=a,this.currentTime=b,this.timelineTime=c,this.type="finish",this.bubbles=!1,this.cancelable=!1,this.currentTarget=a,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()};b.Animation=function(b){this.id="",b&&b._id&&(this.id=b._id),this._sequenceNumber=a.sequenceNumber++,this._currentTime=0,this._startTime=null,this._paused=!1,this._playbackRate=1,this._inTimeline=!0,this._finishedFlag=!0,this.onfinish=null,this._finishHandlers=[],this._effect=b,this._inEffect=this._effect._update(0),this._idle=!0,this._currentTimePending=!1},b.Animation.prototype={_ensureAlive:function(){this.playbackRate<0&&0===this.currentTime?this._inEffect=this._effect._update(-1):this._inEffect=this._effect._update(this.currentTime),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,b.timeline._animations.push(this))},_tickCurrentTime:function(a,b){a!=this._currentTime&&(this._currentTime=a,this._isFinished&&!b&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this._ensureAlive())},get currentTime(){return this._idle||this._currentTimePending?null:this._currentTime},set currentTime(a){a=+a,isNaN(a)||(b.restart(),this._paused||null==this._startTime||(this._startTime=this._timeline.currentTime-a/this._playbackRate),this._currentTimePending=!1,this._currentTime!=a&&(this._tickCurrentTime(a,!0),b.invalidateEffects()))},get startTime(){return this._startTime},set startTime(a){a=+a,isNaN(a)||this._paused||this._idle||(this._startTime=a,this._tickCurrentTime((this._timeline.currentTime-this._startTime)*this.playbackRate),b.invalidateEffects())},get playbackRate(){return this._playbackRate},set playbackRate(a){if(a!=this._playbackRate){var b=this.currentTime;this._playbackRate=a,this._startTime=null,"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!=b&&(this.currentTime=b)}},get _isFinished(){return!this._idle&&(this._playbackRate>0&&this._currentTime>=this._totalDuration||this._playbackRate<0&&this._currentTime<=0)},get _totalDuration(){return this._effect._totalDuration},get playState(){return this._idle?"idle":null==this._startTime&&!this._paused&&0!=this.playbackRate||this._currentTimePending?"pending":this._paused?"paused":this._isFinished?"finished":"running"},play:function(){this._paused=!1,(this._isFinished||this._idle)&&(this._currentTime=this._playbackRate>0?0:this._totalDuration,this._startTime=null),this._finishedFlag=!1,this._idle=!1,this._ensureAlive(),b.invalidateEffects()},pause:function(){this._isFinished||this._paused||this._idle||(this._currentTimePending=!0),this._startTime=null,this._paused=!0},finish:function(){this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this._currentTimePending=!1,b.invalidateEffects())},cancel:function(){this._inEffect&&(this._inEffect=!1,this._idle=!0,this._finishedFlag=!0,this.currentTime=0,this._startTime=null,this._effect._update(null),b.invalidateEffects())},reverse:function(){this.playbackRate*=-1,this.play()},addEventListener:function(a,b){"function"==typeof b&&"finish"==a&&this._finishHandlers.push(b)},removeEventListener:function(a,b){if("finish"==a){var c=this._finishHandlers.indexOf(b);c>=0&&this._finishHandlers.splice(c,1)}},_fireEvents:function(a){if(this._isFinished){if(!this._finishedFlag){var b=new d(this,this._currentTime,a),c=this._finishHandlers.concat(this.onfinish?[this.onfinish]:[]);setTimeout(function(){c.forEach(function(a){a.call(b.target,b)})},0),this._finishedFlag=!0}}else this._finishedFlag=!1},_tick:function(a,b){this._idle||this._paused||(null==this._startTime?b&&(this.startTime=a-this._currentTime/this.playbackRate):this._isFinished||this._tickCurrentTime((a-this._startTime)*this.playbackRate)),b&&(this._currentTimePending=!1,this._fireEvents(a))},get _needsTick(){return this.playState in{pending:1,running:1}||!this._finishedFlag}}}(c,d,f),function(a,b,c){function d(a){var b=j;j=[],a<p.currentTime&&(a=p.currentTime),h(a,!0),b.forEach(function(b){b[1](a)}),g(),l=void 0}function e(a,b){return a._sequenceNumber-b._sequenceNumber}function f(){this._animations=[],this.currentTime=window.performance&&performance.now?performance.now():0}function g(){o.forEach(function(a){a()}),o.length=0}function h(a,c){n=!1;var d=b.timeline;d.currentTime=a,d._animations.sort(e),m=!1;var f=d._animations;d._animations=[];var g=[],h=[];f=f.filter(function(b){b._tick(a,c),b._inEffect?h.push(b._effect):g.push(b._effect),b._needsTick&&(m=!0);var d=b._inEffect||b._needsTick;return b._inTimeline=d,d}),o.push.apply(o,g),o.push.apply(o,h),d._animations.push.apply(d._animations,f),m&&requestAnimationFrame(function(){})}var i=window.requestAnimationFrame,j=[],k=0;window.requestAnimationFrame=function(a){var b=k++;return 0==j.length&&i(d),j.push([b,a]),b},window.cancelAnimationFrame=function(a){j.forEach(function(b){b[0]==a&&(b[1]=function(){})})},f.prototype={_play:function(c){c._timing=a.normalizeTimingInput(c.timing);var d=new b.Animation(c);return d._idle=!1,d._timeline=this,this._animations.push(d),b.restart(),b.invalidateEffects(),d}};var l=void 0,m=!1,n=!1;b.restart=function(){return m||(m=!0,requestAnimationFrame(function(){}),n=!0),n},b.invalidateEffects=function(){h(b.timeline.currentTime,!1),g()};var o=[],p=new f;b.timeline=p}(c,d,f),function(a){function b(a,b){var c=a.exec(b);return c?(c=a.ignoreCase?c[0].toLowerCase():c[0],[c,b.substr(c.length)]):void 0}function c(a,b){b=b.replace(/^\s*/,"");var c=a(b);return c?[c[0],c[1].replace(/^\s*/,"")]:void 0}function d(a,d,e){a=c.bind(null,a);for(var f=[];;){var g=a(e);if(!g)return[f,e];if(f.push(g[0]),e=g[1],g=b(d,e),!g||""==g[1])return[f,e];e=g[1]}}function e(a,b){for(var c=0,d=0;d<b.length&&(!/\s|,/.test(b[d])||0!=c);d++)if("("==b[d])c++;else if(")"==b[d]&&(c--,0==c&&d++,0>=c))break;var e=a(b.substr(0,d));return void 0==e?void 0:[e,b.substr(d)]}function f(a,b){for(var c=a,d=b;c&&d;)c>d?c%=d:d%=c;return c=a*b/(c+d)}function g(a){return function(b){var c=a(b);return c&&(c[0]=void 0),c}}function h(a,b){return function(c){var d=a(c);return d?d:[b,c]}}function i(b,c){for(var d=[],e=0;e<b.length;e++){var f=a.consumeTrimmed(b[e],c);if(!f||""==f[0])return;void 0!==f[0]&&d.push(f[0]),c=f[1]}return""==c?d:void 0}function j(a,b,c,d,e){for(var g=[],h=[],i=[],j=f(d.length,e.length),k=0;j>k;k++){var l=b(d[k%d.length],e[k%e.length]);if(!l)return;g.push(l[0]),h.push(l[1]),i.push(l[2])}return[g,h,function(b){var d=b.map(function(a,b){return i[b](a)}).join(c);return a?a(d):d}]}function k(a,b,c){for(var d=[],e=[],f=[],g=0,h=0;h<c.length;h++)if("function"==typeof c[h]){var i=c[h](a[g],b[g++]);d.push(i[0]),e.push(i[1]),f.push(i[2])}else!function(a){d.push(!1),e.push(!1),f.push(function(){return c[a]})}(h);return[d,e,function(a){for(var b="",c=0;c<a.length;c++)b+=f[c](a[c]);return b}]}a.consumeToken=b,a.consumeTrimmed=c,a.consumeRepeated=d,a.consumeParenthesised=e,a.ignore=g,a.optional=h,a.consumeList=i,a.mergeNestedRepeated=j.bind(null,null),a.mergeWrappedNestedRepeated=j,a.mergeList=k}(d),function(a){function b(b){function c(b){var c=a.consumeToken(/^inset/i,b);if(c)return d.inset=!0,c;var c=a.consumeLengthOrPercent(b);if(c)return d.lengths.push(c[0]),c;var c=a.consumeColor(b);return c?(d.color=c[0],c):void 0}var d={inset:!1,lengths:[],color:null},e=a.consumeRepeated(c,/^/,b);return e&&e[0].length?[d,e[1]]:void 0}function c(c){var d=a.consumeRepeated(b,/^,/,c);return d&&""==d[1]?d[0]:void 0}function d(b,c){for(;b.lengths.length<Math.max(b.lengths.length,c.lengths.length);)b.lengths.push({px:0});for(;c.lengths.length<Math.max(b.lengths.length,c.lengths.length);)c.lengths.push({px:0});if(b.inset==c.inset&&!!b.color==!!c.color){for(var d,e=[],f=[[],0],g=[[],0],h=0;h<b.lengths.length;h++){var i=a.mergeDimensions(b.lengths[h],c.lengths[h],2==h);f[0].push(i[0]),g[0].push(i[1]),e.push(i[2])}if(b.color&&c.color){var j=a.mergeColors(b.color,c.color);f[1]=j[0],g[1]=j[1],d=j[2]}return[f,g,function(a){for(var c=b.inset?"inset ":" ",f=0;f<e.length;f++)c+=e[f](a[0][f])+" ";return d&&(c+=d(a[1])),c}]}}function e(b,c,d,e){function f(a){return{inset:a,color:[0,0,0,0],lengths:[{px:0},{px:0},{px:0},{px:0}]}}for(var g=[],h=[],i=0;i<d.length||i<e.length;i++){var j=d[i]||f(e[i].inset),k=e[i]||f(d[i].inset);g.push(j),h.push(k)}return a.mergeNestedRepeated(b,c,g,h)}var f=e.bind(null,d,", ");a.addPropertiesHandler(c,f,["box-shadow","text-shadow"])}(d),function(a,b){function c(a){return a.toFixed(3).replace(".000","")}function d(a,b,c){return Math.min(b,Math.max(a,c))}function e(a){return/^\s*[-+]?(\d*\.)?\d+\s*$/.test(a)?Number(a):void 0}function f(a,b){return[a,b,c]}function g(a,b){return 0!=a?i(0,1/0)(a,b):void 0}function h(a,b){return[a,b,function(a){return Math.round(d(1,1/0,a))}]}function i(a,b){return function(e,f){return[e,f,function(e){return c(d(a,b,e))}]}}function j(a,b){return[a,b,Math.round]}a.clamp=d,a.addPropertiesHandler(e,i(0,1/0),["border-image-width","line-height"]),a.addPropertiesHandler(e,i(0,1),["opacity","shape-image-threshold"]),a.addPropertiesHandler(e,g,["flex-grow","flex-shrink"]),a.addPropertiesHandler(e,h,["orphans","widows"]),a.addPropertiesHandler(e,j,["z-index"]),a.parseNumber=e,a.mergeNumbers=f,a.numberToString=c}(d,f),function(a,b){function c(a,b){return"visible"==a||"visible"==b?[0,1,function(c){return 0>=c?a:c>=1?b:"visible"}]:void 0}a.addPropertiesHandler(String,c,["visibility"])}(d),function(a,b){function c(a){a=a.trim(),f.fillStyle="#000",f.fillStyle=a;var b=f.fillStyle;if(f.fillStyle="#fff",f.fillStyle=a,b==f.fillStyle){f.fillRect(0,0,1,1);var c=f.getImageData(0,0,1,1).data;f.clearRect(0,0,1,1);var d=c[3]/255;return[c[0]*d,c[1]*d,c[2]*d,d]}}function d(b,c){return[b,c,function(b){function c(a){return Math.max(0,Math.min(255,a))}if(b[3])for(var d=0;3>d;d++)b[d]=Math.round(c(b[d]/b[3]));return b[3]=a.numberToString(a.clamp(0,1,b[3])),"rgba("+b.join(",")+")"}]}var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=e.height=1;var f=e.getContext("2d");a.addPropertiesHandler(c,d,["background-color","border-bottom-color","border-left-color","border-right-color","border-top-color","color","outline-color","text-decoration-color"]),a.consumeColor=a.consumeParenthesised.bind(null,c),a.mergeColors=d}(d,f),function(a,b){function c(a,b){if(b=b.trim().toLowerCase(),"0"==b&&"px".search(a)>=0)return{px:0};if(/^[^(]*$|^calc/.test(b)){b=b.replace(/calc\(/g,"(");var c={};b=b.replace(a,function(a){return c[a]=null,"U"+a});for(var d="U("+a.source+")",e=b.replace(/[-+]?(\d*\.)?\d+/g,"N").replace(new RegExp("N"+d,"g"),"D").replace(/\s[+-]\s/g,"O").replace(/\s/g,""),f=[/N\*(D)/g,/(N|D)[*\/]N/g,/(N|D)O\1/g,/\((N|D)\)/g],g=0;g<f.length;)f[g].test(e)?(e=e.replace(f[g],"$1"),g=0):g++;if("D"==e){for(var h in c){var i=eval(b.replace(new RegExp("U"+h,"g"),"").replace(new RegExp(d,"g"),"*0"));if(!isFinite(i))return;c[h]=i}return c}}}function d(a,b){return e(a,b,!0)}function e(b,c,d){var e,f=[];for(e in b)f.push(e);for(e in c)f.indexOf(e)<0&&f.push(e);return b=f.map(function(a){return b[a]||0}),c=f.map(function(a){return c[a]||0}),[b,c,function(b){var c=b.map(function(c,e){return 1==b.length&&d&&(c=Math.max(c,0)),a.numberToString(c)+f[e]}).join(" + ");return b.length>1?"calc("+c+")":c}]}var f="px|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc",g=c.bind(null,new RegExp(f,"g")),h=c.bind(null,new RegExp(f+"|%","g")),i=c.bind(null,/deg|rad|grad|turn/g);a.parseLength=g,a.parseLengthOrPercent=h,a.consumeLengthOrPercent=a.consumeParenthesised.bind(null,h),a.parseAngle=i,a.mergeDimensions=e;var j=a.consumeParenthesised.bind(null,g),k=a.consumeRepeated.bind(void 0,j,/^/),l=a.consumeRepeated.bind(void 0,k,/^,/);a.consumeSizePairList=l;var m=function(a){var b=l(a);return b&&""==b[1]?b[0]:void 0},n=a.mergeNestedRepeated.bind(void 0,d," "),o=a.mergeNestedRepeated.bind(void 0,n,",");a.mergeNonNegativeSizePair=n,a.addPropertiesHandler(m,o,["background-size"]),a.addPropertiesHandler(h,d,["border-bottom-width","border-image-width","border-left-width","border-right-width","border-top-width","flex-basis","font-size","height","line-height","max-height","max-width","outline-width","width"]),a.addPropertiesHandler(h,e,["border-bottom-left-radius","border-bottom-right-radius","border-top-left-radius","border-top-right-radius","bottom","left","letter-spacing","margin-bottom","margin-left","margin-right","margin-top","min-height","min-width","outline-offset","padding-bottom","padding-left","padding-right","padding-top","perspective","right","shape-margin","text-indent","top","vertical-align","word-spacing"])}(d,f),function(a,b){function c(b){return a.consumeLengthOrPercent(b)||a.consumeToken(/^auto/,b)}function d(b){var d=a.consumeList([a.ignore(a.consumeToken.bind(null,/^rect/)),a.ignore(a.consumeToken.bind(null,/^\(/)),a.consumeRepeated.bind(null,c,/^,/),a.ignore(a.consumeToken.bind(null,/^\)/))],b);return d&&4==d[0].length?d[0]:void 0}function e(b,c){return"auto"==b||"auto"==c?[!0,!1,function(d){var e=d?b:c;if("auto"==e)return"auto";var f=a.mergeDimensions(e,e);return f[2](f[0])}]:a.mergeDimensions(b,c)}function f(a){return"rect("+a+")"}var g=a.mergeWrappedNestedRepeated.bind(null,f,e,", ");a.parseBox=d,a.mergeBoxes=g,a.addPropertiesHandler(d,g,["clip"])}(d,f),function(a,b){function c(a){return function(b){var c=0;return a.map(function(a){return a===k?b[c++]:a})}}function d(a){return a}function e(b){if(b=b.toLowerCase().trim(),"none"==b)return[];for(var c,d=/\s*(\w+)\(([^)]*)\)/g,e=[],f=0;c=d.exec(b);){if(c.index!=f)return;f=c.index+c[0].length;var g=c[1],h=n[g];if(!h)return;var i=c[2].split(","),j=h[0];if(j.length<i.length)return;for(var k=[],o=0;o<j.length;o++){var p,q=i[o],r=j[o];if(p=q?{A:function(b){return"0"==b.trim()?m:a.parseAngle(b)},N:a.parseNumber,T:a.parseLengthOrPercent,L:a.parseLength}[r.toUpperCase()](q):{a:m,n:k[0],t:l}[r],void 0===p)return;k.push(p)}if(e.push({t:g,d:k}),d.lastIndex==b.length)return e}}function f(a){return a.toFixed(6).replace(".000000","")}function g(b,c){if(b.decompositionPair!==c){b.decompositionPair=c;var d=a.makeMatrixDecomposition(b)}if(c.decompositionPair!==b){c.decompositionPair=b;var e=a.makeMatrixDecomposition(c)}return null==d[0]||null==e[0]?[[!1],[!0],function(a){return a?c[0].d:b[0].d}]:(d[0].push(0),e[0].push(1),[d,e,function(b){var c=a.quat(d[0][3],e[0][3],b[5]),g=a.composeMatrix(b[0],b[1],b[2],c,b[4]),h=g.map(f).join(",");return h}])}function h(a){return a.replace(/[xy]/,"")}function i(a){return a.replace(/(x|y|z|3d)?$/,"3d")}function j(b,c){var d=a.makeMatrixDecomposition&&!0,e=!1;if(!b.length||!c.length){b.length||(e=!0,b=c,c=[]);for(var f=0;f<b.length;f++){var j=b[f].t,k=b[f].d,l="scale"==j.substr(0,5)?1:0;c.push({t:j,d:k.map(function(a){if("number"==typeof a)return l;var b={};for(var c in a)b[c]=l;return b})})}}var m=function(a,b){return"perspective"==a&&"perspective"==b||("matrix"==a||"matrix3d"==a)&&("matrix"==b||"matrix3d"==b)},o=[],p=[],q=[];if(b.length!=c.length){if(!d)return;var r=g(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]]}else for(var f=0;f<b.length;f++){var j,s=b[f].t,t=c[f].t,u=b[f].d,v=c[f].d,w=n[s],x=n[t];if(m(s,t)){if(!d)return;var r=g([b[f]],[c[f]]);o.push(r[0]),p.push(r[1]),q.push(["matrix",[r[2]]])}else{if(s==t)j=s;else if(w[2]&&x[2]&&h(s)==h(t))j=h(s),u=w[2](u),v=x[2](v);else{if(!w[1]||!x[1]||i(s)!=i(t)){if(!d)return;var r=g(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]];break}j=i(s),u=w[1](u),v=x[1](v)}for(var y=[],z=[],A=[],B=0;B<u.length;B++){var C="number"==typeof u[B]?a.mergeNumbers:a.mergeDimensions,r=C(u[B],v[B]);y[B]=r[0],z[B]=r[1],A.push(r[2])}o.push(y),p.push(z),q.push([j,A])}}if(e){var D=o;o=p,p=D}return[o,p,function(a){return a.map(function(a,b){var c=a.map(function(a,c){return q[b][1][c](a)}).join(",");return"matrix"==q[b][0]&&16==c.split(",").length&&(q[b][0]="matrix3d"),q[b][0]+"("+c+")"}).join(" ")}]}var k=null,l={px:0},m={deg:0},n={matrix:["NNNNNN",[k,k,0,0,k,k,0,0,0,0,1,0,k,k,0,1],d],matrix3d:["NNNNNNNNNNNNNNNN",d],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",c([k,k,1]),d],scalex:["N",c([k,1,1]),c([k,1])],scaley:["N",c([1,k,1]),c([1,k])],scalez:["N",c([1,1,k])],scale3d:["NNN",d],skew:["Aa",null,d],skewx:["A",null,c([k,m])],skewy:["A",null,c([m,k])],translate:["Tt",c([k,k,l]),d],translatex:["T",c([k,l,l]),c([k,l])],translatey:["T",c([l,k,l]),c([l,k])],translatez:["L",c([l,l,k])],translate3d:["TTL",d]};a.addPropertiesHandler(e,j,["transform"])}(d,f),function(a,b){function c(a,b){b.concat([a]).forEach(function(b){b in document.documentElement.style&&(d[a]=b)})}var d={};c("transform",["webkitTransform","msTransform"]),c("transformOrigin",["webkitTransformOrigin"]),c("perspective",["webkitPerspective"]),c("perspectiveOrigin",["webkitPerspectiveOrigin"]),a.propertyName=function(a){return d[a]||a}}(d,f)}(),!function(){if(void 0===document.createElement("div").animate([]).oncancel){var a;if(window.performance&&performance.now)var a=function(){return performance.now()};else var a=function(){return Date.now()};var b=function(a,b,c){this.target=a,this.currentTime=b,this.timelineTime=c,this.type="cancel",this.bubbles=!1,this.cancelable=!1,this.currentTarget=a,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()},c=window.Element.prototype.animate;window.Element.prototype.animate=function(d,e){var f=c.call(this,d,e);f._cancelHandlers=[],f.oncancel=null;var g=f.cancel;f.cancel=function(){g.call(this);var c=new b(this,null,a()),d=this._cancelHandlers.concat(this.oncancel?[this.oncancel]:[]);setTimeout(function(){d.forEach(function(a){a.call(c.target,c)})},0)};var h=f.addEventListener;f.addEventListener=function(a,b){"function"==typeof b&&"cancel"==a?this._cancelHandlers.push(b):h.call(this,a,b)};var i=f.removeEventListener;return f.removeEventListener=function(a,b){if("cancel"==a){var c=this._cancelHandlers.indexOf(b);c>=0&&this._cancelHandlers.splice(c,1)}else i.call(this,a,b)},f}}}(),function(a){var b=document.documentElement,c=null,d=!1;try{var e=getComputedStyle(b).getPropertyValue("opacity"),f="0"==e?"1":"0";c=b.animate({opacity:[f,f]},{duration:1}),c.currentTime=0,d=getComputedStyle(b).getPropertyValue("opacity")==f}catch(g){}finally{c&&c.cancel()}if(!d){var h=window.Element.prototype.animate;window.Element.prototype.animate=function(b,c){return window.Symbol&&Symbol.iterator&&Array.prototype.from&&b[Symbol.iterator]&&(b=Array.from(b)),Array.isArray(b)||null===b||(b=a.convertToArrayForm(b)),h.call(this,b,c)}}}(c),!function(a,b,c){function d(a){var b=window.document.timeline;b.currentTime=a,b._discardAnimations(),0==b._animations.length?f=!1:requestAnimationFrame(d); }var e=window.requestAnimationFrame;window.requestAnimationFrame=function(a){return e(function(b){window.document.timeline._updateAnimationsPromises(),a(b),window.document.timeline._updateAnimationsPromises()})},b.AnimationTimeline=function(){this._animations=[],this.currentTime=void 0},b.AnimationTimeline.prototype={getAnimations:function(){return this._discardAnimations(),this._animations.slice()},_updateAnimationsPromises:function(){b.animationsWithPromises=b.animationsWithPromises.filter(function(a){return a._updatePromises()})},_discardAnimations:function(){this._updateAnimationsPromises(),this._animations=this._animations.filter(function(a){return"finished"!=a.playState&&"idle"!=a.playState})},_play:function(a){var c=new b.Animation(a,this);return this._animations.push(c),b.restartWebAnimationsNextTick(),c._updatePromises(),c._animation.play(),c._updatePromises(),c},play:function(a){return a&&a.remove(),this._play(a)}};var f=!1;b.restartWebAnimationsNextTick=function(){f||(f=!0,requestAnimationFrame(d))};var g=new b.AnimationTimeline;b.timeline=g;try{Object.defineProperty(window.document,"timeline",{configurable:!0,get:function(){return g}})}catch(h){}try{window.document.timeline=g}catch(h){}}(c,e,f),function(a,b,c){b.animationsWithPromises=[],b.Animation=function(b,c){if(this.id="",b&&b._id&&(this.id=b._id),this.effect=b,b&&(b._animation=this),!c)throw new Error("Animation with null timeline is not supported");this._timeline=c,this._sequenceNumber=a.sequenceNumber++,this._holdTime=0,this._paused=!1,this._isGroup=!1,this._animation=null,this._childAnimations=[],this._callback=null,this._oldPlayState="idle",this._rebuildUnderlyingAnimation(),this._animation.cancel(),this._updatePromises()},b.Animation.prototype={_updatePromises:function(){var a=this._oldPlayState,b=this.playState;return this._readyPromise&&b!==a&&("idle"==b?(this._rejectReadyPromise(),this._readyPromise=void 0):"pending"==a?this._resolveReadyPromise():"pending"==b&&(this._readyPromise=void 0)),this._finishedPromise&&b!==a&&("idle"==b?(this._rejectFinishedPromise(),this._finishedPromise=void 0):"finished"==b?this._resolveFinishedPromise():"finished"==a&&(this._finishedPromise=void 0)),this._oldPlayState=this.playState,this._readyPromise||this._finishedPromise},_rebuildUnderlyingAnimation:function(){this._updatePromises();var a,c,d,e,f=!!this._animation;f&&(a=this.playbackRate,c=this._paused,d=this.startTime,e=this.currentTime,this._animation.cancel(),this._animation._wrapper=null,this._animation=null),(!this.effect||this.effect instanceof window.KeyframeEffect)&&(this._animation=b.newUnderlyingAnimationForKeyframeEffect(this.effect),b.bindAnimationForKeyframeEffect(this)),(this.effect instanceof window.SequenceEffect||this.effect instanceof window.GroupEffect)&&(this._animation=b.newUnderlyingAnimationForGroup(this.effect),b.bindAnimationForGroup(this)),this.effect&&this.effect._onsample&&b.bindAnimationForCustomEffect(this),f&&(1!=a&&(this.playbackRate=a),null!==d?this.startTime=d:null!==e?this.currentTime=e:null!==this._holdTime&&(this.currentTime=this._holdTime),c&&this.pause()),this._updatePromises()},_updateChildren:function(){if(this.effect&&"idle"!=this.playState){var a=this.effect._timing.delay;this._childAnimations.forEach(function(c){this._arrangeChildren(c,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c.effect))}.bind(this))}},_setExternalAnimation:function(a){if(this.effect&&this._isGroup)for(var b=0;b<this.effect.children.length;b++)this.effect.children[b]._animation=a,this._childAnimations[b]._setExternalAnimation(a)},_constructChildAnimations:function(){if(this.effect&&this._isGroup){var a=this.effect._timing.delay;this._removeChildAnimations(),this.effect.children.forEach(function(c){var d=window.document.timeline._play(c);this._childAnimations.push(d),d.playbackRate=this.playbackRate,this._paused&&d.pause(),c._animation=this.effect._animation,this._arrangeChildren(d,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c))}.bind(this))}},_arrangeChildren:function(a,b){null===this.startTime?a.currentTime=this.currentTime-b/this.playbackRate:a.startTime!==this.startTime+b/this.playbackRate&&(a.startTime=this.startTime+b/this.playbackRate)},get timeline(){return this._timeline},get playState(){return this._animation?this._animation.playState:"idle"},get finished(){return window.Promise?(this._finishedPromise||(-1==b.animationsWithPromises.indexOf(this)&&b.animationsWithPromises.push(this),this._finishedPromise=new Promise(function(a,b){this._resolveFinishedPromise=function(){a(this)},this._rejectFinishedPromise=function(){b({type:DOMException.ABORT_ERR,name:"AbortError"})}}.bind(this)),"finished"==this.playState&&this._resolveFinishedPromise()),this._finishedPromise):(console.warn("Animation Promises require JavaScript Promise constructor"),null)},get ready(){return window.Promise?(this._readyPromise||(-1==b.animationsWithPromises.indexOf(this)&&b.animationsWithPromises.push(this),this._readyPromise=new Promise(function(a,b){this._resolveReadyPromise=function(){a(this)},this._rejectReadyPromise=function(){b({type:DOMException.ABORT_ERR,name:"AbortError"})}}.bind(this)),"pending"!==this.playState&&this._resolveReadyPromise()),this._readyPromise):(console.warn("Animation Promises require JavaScript Promise constructor"),null)},get onfinish(){return this._animation.onfinish},set onfinish(a){"function"==typeof a?this._animation.onfinish=function(b){b.target=this,a.call(this,b)}.bind(this):this._animation.onfinish=a},get oncancel(){return this._animation.oncancel},set oncancel(a){"function"==typeof a?this._animation.oncancel=function(b){b.target=this,a.call(this,b)}.bind(this):this._animation.oncancel=a},get currentTime(){this._updatePromises();var a=this._animation.currentTime;return this._updatePromises(),a},set currentTime(a){this._updatePromises(),this._animation.currentTime=isFinite(a)?a:Math.sign(a)*Number.MAX_VALUE,this._register(),this._forEachChild(function(b,c){b.currentTime=a-c}),this._updatePromises()},get startTime(){return this._animation.startTime},set startTime(a){this._updatePromises(),this._animation.startTime=isFinite(a)?a:Math.sign(a)*Number.MAX_VALUE,this._register(),this._forEachChild(function(b,c){b.startTime=a+c}),this._updatePromises()},get playbackRate(){return this._animation.playbackRate},set playbackRate(a){this._updatePromises();var b=this.currentTime;this._animation.playbackRate=a,this._forEachChild(function(b){b.playbackRate=a}),"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!==b&&(this.currentTime=b),this._updatePromises()},play:function(){this._updatePromises(),this._paused=!1,this._animation.play(),-1==this._timeline._animations.indexOf(this)&&this._timeline._animations.push(this),this._register(),b.awaitStartTime(this),this._forEachChild(function(a){var b=a.currentTime;a.play(),a.currentTime=b}),this._updatePromises()},pause:function(){this._updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._animation.pause(),this._register(),this._forEachChild(function(a){a.pause()}),this._paused=!0,this._updatePromises()},finish:function(){this._updatePromises(),this._animation.finish(),this._register(),this._updatePromises()},cancel:function(){this._updatePromises(),this._animation.cancel(),this._register(),this._removeChildAnimations(),this._updatePromises()},reverse:function(){this._updatePromises();var a=this.currentTime;this._animation.reverse(),this._forEachChild(function(a){a.reverse()}),null!==a&&(this.currentTime=a),this._updatePromises()},addEventListener:function(a,b){var c=b;"function"==typeof b&&(c=function(a){a.target=this,b.call(this,a)}.bind(this),b._wrapper=c),this._animation.addEventListener(a,c)},removeEventListener:function(a,b){this._animation.removeEventListener(a,b&&b._wrapper||b)},_removeChildAnimations:function(){for(;this._childAnimations.length;)this._childAnimations.pop().cancel()},_forEachChild:function(b){var c=0;if(this.effect.children&&this._childAnimations.length<this.effect.children.length&&this._constructChildAnimations(),this._childAnimations.forEach(function(a){b.call(this,a,c),this.effect instanceof window.SequenceEffect&&(c+=a.effect.activeDuration)}.bind(this)),"pending"!=this.playState){var d=this.effect._timing,e=this.currentTime;null!==e&&(e=a.calculateTimeFraction(a.calculateActiveDuration(d),e,d)),(null==e||isNaN(e))&&this._removeChildAnimations()}}},window.Animation=b.Animation}(c,e,f),function(a,b,c){function d(b){this._frames=a.normalizeKeyframes(b)}function e(){for(var a=!1;i.length;){var b=i.shift();b._updateChildren(),a=!0}return a}var f=function(a){if(a._animation=void 0,a instanceof window.SequenceEffect||a instanceof window.GroupEffect)for(var b=0;b<a.children.length;b++)f(a.children[b])};b.removeMulti=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d._parent?(-1==b.indexOf(d._parent)&&b.push(d._parent),d._parent.children.splice(d._parent.children.indexOf(d),1),d._parent=null,f(d)):d._animation&&d._animation.effect==d&&(d._animation.cancel(),d._animation.effect=new KeyframeEffect(null,[]),d._animation._callback&&(d._animation._callback._animation=null),d._animation._rebuildUnderlyingAnimation(),f(d))}for(c=0;c<b.length;c++)b[c]._rebuild()},b.KeyframeEffect=function(b,c,e,f){return this.target=b,this._parent=null,e=a.numericTimingToObject(e),this._timingInput=a.cloneTimingInput(e),this._timing=a.normalizeTimingInput(e),this.timing=a.makeTiming(e,!1,this),this.timing._effect=this,"function"==typeof c?(a.deprecated("Custom KeyframeEffect","2015-06-22","Use KeyframeEffect.onsample instead."),this._normalizedKeyframes=c):this._normalizedKeyframes=new d(c),this._keyframes=c,this.activeDuration=a.calculateActiveDuration(this._timing),this._id=f,this},b.KeyframeEffect.prototype={getFrames:function(){return"function"==typeof this._normalizedKeyframes?this._normalizedKeyframes:this._normalizedKeyframes._frames},set onsample(a){if("function"==typeof this.getFrames())throw new Error("Setting onsample on custom effect KeyframeEffect is not supported.");this._onsample=a,this._animation&&this._animation._rebuildUnderlyingAnimation()},get parent(){return this._parent},clone:function(){if("function"==typeof this.getFrames())throw new Error("Cloning custom effects is not supported.");var b=new KeyframeEffect(this.target,[],a.cloneTimingInput(this._timingInput),this._id);return b._normalizedKeyframes=this._normalizedKeyframes,b._keyframes=this._keyframes,b},remove:function(){b.removeMulti([this])}};var g=Element.prototype.animate;Element.prototype.animate=function(a,c){var d="";return c&&c.id&&(d=c.id),b.timeline._play(new b.KeyframeEffect(this,a,c,d))};var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");b.newUnderlyingAnimationForKeyframeEffect=function(a){if(a){var b=a.target||h,c=a._keyframes;"function"==typeof c&&(c=[]);var d=a._timingInput;d.id=a._id}else var b=h,c=[],d=0;return g.apply(b,[c,d])},b.bindAnimationForKeyframeEffect=function(a){a.effect&&"function"==typeof a.effect._normalizedKeyframes&&b.bindAnimationForCustomEffect(a)};var i=[];b.awaitStartTime=function(a){null===a.startTime&&a._isGroup&&(0==i.length&&requestAnimationFrame(e),i.push(a))};var j=window.getComputedStyle;Object.defineProperty(window,"getComputedStyle",{configurable:!0,enumerable:!0,value:function(){window.document.timeline._updateAnimationsPromises();var a=j.apply(this,arguments);return e()&&(a=j.apply(this,arguments)),window.document.timeline._updateAnimationsPromises(),a}}),window.KeyframeEffect=b.KeyframeEffect,window.Element.prototype.getAnimations=function(){return document.timeline.getAnimations().filter(function(a){return null!==a.effect&&a.effect.target==this}.bind(this))}}(c,e,f),function(a,b,c){function d(a){a._registered||(a._registered=!0,g.push(a),h||(h=!0,requestAnimationFrame(e)))}function e(a){var b=g;g=[],b.sort(function(a,b){return a._sequenceNumber-b._sequenceNumber}),b=b.filter(function(a){a();var b=a._animation?a._animation.playState:"idle";return"running"!=b&&"pending"!=b&&(a._registered=!1),a._registered}),g.push.apply(g,b),g.length?(h=!0,requestAnimationFrame(e)):h=!1}var f=(document.createElementNS("http://www.w3.org/1999/xhtml","div"),0);b.bindAnimationForCustomEffect=function(b){var c,e=b.effect.target,g="function"==typeof b.effect.getFrames();c=g?b.effect.getFrames():b.effect._onsample;var h=b.effect.timing,i=null;h=a.normalizeTimingInput(h);var j=function(){var d=j._animation?j._animation.currentTime:null;null!==d&&(d=a.calculateTimeFraction(a.calculateActiveDuration(h),d,h),isNaN(d)&&(d=null)),d!==i&&(g?c(d,e,b.effect):c(d,b.effect,b.effect._animation)),i=d};j._animation=b,j._registered=!1,j._sequenceNumber=f++,b._callback=j,d(j)};var g=[],h=!1;b.Animation.prototype._register=function(){this._callback&&d(this._callback)}}(c,e,f),function(a,b,c){function d(a){return a._timing.delay+a.activeDuration+a._timing.endDelay}function e(b,c,d){this._id=d,this._parent=null,this.children=b||[],this._reparent(this.children),c=a.numericTimingToObject(c),this._timingInput=a.cloneTimingInput(c),this._timing=a.normalizeTimingInput(c,!0),this.timing=a.makeTiming(c,!0,this),this.timing._effect=this,"auto"===this._timing.duration&&(this._timing.duration=this.activeDuration)}window.SequenceEffect=function(){e.apply(this,arguments)},window.GroupEffect=function(){e.apply(this,arguments)},e.prototype={_isAncestor:function(a){for(var b=this;null!==b;){if(b==a)return!0;b=b._parent}return!1},_rebuild:function(){for(var a=this;a;)"auto"===a.timing.duration&&(a._timing.duration=a.activeDuration),a=a._parent;this._animation&&this._animation._rebuildUnderlyingAnimation()},_reparent:function(a){b.removeMulti(a);for(var c=0;c<a.length;c++)a[c]._parent=this},_putChild:function(a,b){for(var c=b?"Cannot append an ancestor or self":"Cannot prepend an ancestor or self",d=0;d<a.length;d++)if(this._isAncestor(a[d]))throw{type:DOMException.HIERARCHY_REQUEST_ERR,name:"HierarchyRequestError",message:c};for(var d=0;d<a.length;d++)b?this.children.push(a[d]):this.children.unshift(a[d]);this._reparent(a),this._rebuild()},append:function(){this._putChild(arguments,!0)},prepend:function(){this._putChild(arguments,!1)},get parent(){return this._parent},get firstChild(){return this.children.length?this.children[0]:null},get lastChild(){return this.children.length?this.children[this.children.length-1]:null},clone:function(){for(var b=a.cloneTimingInput(this._timingInput),c=[],d=0;d<this.children.length;d++)c.push(this.children[d].clone());return this instanceof GroupEffect?new GroupEffect(c,b):new SequenceEffect(c,b)},remove:function(){b.removeMulti([this])}},window.SequenceEffect.prototype=Object.create(e.prototype),Object.defineProperty(window.SequenceEffect.prototype,"activeDuration",{get:function(){var a=0;return this.children.forEach(function(b){a+=d(b)}),Math.max(a,0)}}),window.GroupEffect.prototype=Object.create(e.prototype),Object.defineProperty(window.GroupEffect.prototype,"activeDuration",{get:function(){var a=0;return this.children.forEach(function(b){a=Math.max(a,d(b))}),a}}),b.newUnderlyingAnimationForGroup=function(c){var d,e=null,f=function(b){var c=d._wrapper;return c&&"pending"!=c.playState&&c.effect?null==b?void c._removeChildAnimations():0==b&&c.playbackRate<0&&(e||(e=a.normalizeTimingInput(c.effect.timing)),b=a.calculateTimeFraction(a.calculateActiveDuration(e),-1,e),isNaN(b)||null==b)?(c._forEachChild(function(a){a.currentTime=-1}),void c._removeChildAnimations()):void 0:void 0},g=new KeyframeEffect(null,[],c._timing,c._id);return g.onsample=f,d=b.timeline._play(g)},b.bindAnimationForGroup=function(a){a._animation._wrapper=a,a._isGroup=!0,b.awaitStartTime(a),a._constructChildAnimations(),a._setExternalAnimation(a)},b.groupChildDuration=d}(c,e,f),b["true"]=a}({},function(){return this}()); /** @license @nocompile Copyright (c) 2018 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ (function(){/* Copyright (c) 2016 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ 'use strict';var n,p="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};function ba(){ba=function(){};p.Symbol||(p.Symbol=ca)}var ca=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}(); function da(){ba();var a=p.Symbol.iterator;a||(a=p.Symbol.iterator=p.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});da=function(){}}function ea(a){var b=0;return fa(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function fa(a){da();a={next:a};a[p.Symbol.iterator]=function(){return this};return a}function ia(a){da();var b=a[Symbol.iterator];return b?b.call(a):ea(a)} function ja(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c} (function(){if(!function(){var a=document.createEvent("Event");a.initEvent("foo",!0,!0);a.preventDefault();return a.defaultPrevented}()){var a=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(a.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var b=/Trident/.test(navigator.userAgent);if(!window.CustomEvent||b&&"function"!==typeof window.CustomEvent)window.CustomEvent=function(a,b){b=b||{};var c=document.createEvent("CustomEvent"); c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c},window.CustomEvent.prototype=window.Event.prototype;if(!window.Event||b&&"function"!==typeof window.Event){var c=window.Event;window.Event=function(a,b){b=b||{};var c=document.createEvent("Event");c.initEvent(a,!!b.bubbles,!!b.cancelable);return c};if(c)for(var d in c)window.Event[d]=c[d];window.Event.prototype=c.prototype}if(!window.MouseEvent||b&&"function"!==typeof window.MouseEvent){b=window.MouseEvent;window.MouseEvent=function(a, b){b=b||{};var c=document.createEvent("MouseEvent");c.initMouseEvent(a,!!b.bubbles,!!b.cancelable,b.view||window,b.detail,b.screenX,b.screenY,b.clientX,b.clientY,b.ctrlKey,b.altKey,b.shiftKey,b.metaKey,b.button,b.relatedTarget);return c};if(b)for(d in b)window.MouseEvent[d]=b[d];window.MouseEvent.prototype=b.prototype}Array.from||(Array.from=function(a){return[].slice.call(a)});Object.assign||(Object.assign=function(a,b){for(var c=[].slice.call(arguments,1),d=0,e;d<c.length;d++)if(e=c[d])for(var f= a,m=e,q=Object.getOwnPropertyNames(m),x=0;x<q.length;x++)e=q[x],f[e]=m[e];return a})})(window.WebComponents);(function(){function a(){}function b(a,b){if(!a.childNodes.length)return[];switch(a.nodeType){case Node.DOCUMENT_NODE:return ua.call(a,b);case Node.DOCUMENT_FRAGMENT_NODE:return lb.call(a,b);default:return U.call(a,b)}}var c="undefined"===typeof HTMLTemplateElement,d=!(document.createDocumentFragment().cloneNode()instanceof DocumentFragment),e=!1;/Trident/.test(navigator.userAgent)&&function(){function a(a,b){if(a instanceof DocumentFragment)for(var d;d=a.firstChild;)c.call(this,d,b);else c.call(this, a,b);return a}e=!0;var b=Node.prototype.cloneNode;Node.prototype.cloneNode=function(a){a=b.call(this,a);this instanceof DocumentFragment&&(a.__proto__=DocumentFragment.prototype);return a};DocumentFragment.prototype.querySelectorAll=HTMLElement.prototype.querySelectorAll;DocumentFragment.prototype.querySelector=HTMLElement.prototype.querySelector;Object.defineProperties(DocumentFragment.prototype,{nodeType:{get:function(){return Node.DOCUMENT_FRAGMENT_NODE},configurable:!0},localName:{get:function(){}, configurable:!0},nodeName:{get:function(){return"#document-fragment"},configurable:!0}});var c=Node.prototype.insertBefore;Node.prototype.insertBefore=a;var d=Node.prototype.appendChild;Node.prototype.appendChild=function(b){b instanceof DocumentFragment?a.call(this,b,null):d.call(this,b);return b};var f=Node.prototype.removeChild,g=Node.prototype.replaceChild;Node.prototype.replaceChild=function(b,c){b instanceof DocumentFragment?(a.call(this,b,c),f.call(this,c)):g.call(this,b,c);return c};Document.prototype.createDocumentFragment= function(){var a=this.createElement("df");a.__proto__=DocumentFragment.prototype;return a};var h=Document.prototype.importNode;Document.prototype.importNode=function(a,b){b=h.call(this,a,b||!1);a instanceof DocumentFragment&&(b.__proto__=DocumentFragment.prototype);return b}}();var f=Node.prototype.cloneNode,g=Document.prototype.createElement,h=Document.prototype.importNode,k=Node.prototype.removeChild,l=Node.prototype.appendChild,m=Node.prototype.replaceChild,q=DOMParser.prototype.parseFromString, x=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML")||{get:function(){return this.innerHTML},set:function(a){this.innerHTML=a}},M=Object.getOwnPropertyDescriptor(window.Node.prototype,"childNodes")||{get:function(){return this.childNodes}},U=Element.prototype.querySelectorAll,ua=Document.prototype.querySelectorAll,lb=DocumentFragment.prototype.querySelectorAll,mb=function(){if(!c){var a=document.createElement("template"),b=document.createElement("template");b.content.appendChild(document.createElement("div")); a.content.appendChild(b);a=a.cloneNode(!0);return 0===a.content.childNodes.length||0===a.content.firstChild.content.childNodes.length||d}}();if(c){var S=document.implementation.createHTMLDocument("template"),C=!0,V=document.createElement("style");V.textContent="template{display:none;}";var ha=document.head;ha.insertBefore(V,ha.firstElementChild);a.prototype=Object.create(HTMLElement.prototype);var va=!document.createElement("div").hasOwnProperty("innerHTML");a.G=function(b){if(!b.content&&b.namespaceURI=== document.documentElement.namespaceURI){b.content=S.createDocumentFragment();for(var c;c=b.firstChild;)l.call(b.content,c);if(va)b.__proto__=a.prototype;else if(b.cloneNode=function(b){return a.a(this,b)},C)try{P(b),W(b)}catch(Tg){C=!1}a.C(b.content)}};var X={option:["select"],thead:["table"],col:["colgroup","table"],tr:["tbody","table"],th:["tr","tbody","table"],td:["tr","tbody","table"]},P=function(b){Object.defineProperty(b,"innerHTML",{get:function(){return nb(this)},set:function(b){var c=X[(/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(b)|| ["",""])[1].toLowerCase()];if(c)for(var d=0;d<c.length;d++)b="<"+c[d]+">"+b+"</"+c[d]+">";S.body.innerHTML=b;for(a.C(S);this.content.firstChild;)k.call(this.content,this.content.firstChild);b=S.body;if(c)for(d=0;d<c.length;d++)b=b.lastChild;for(;b.firstChild;)l.call(this.content,b.firstChild)},configurable:!0})},W=function(a){Object.defineProperty(a,"outerHTML",{get:function(){return"<template>"+this.innerHTML+"</template>"},set:function(a){if(this.parentNode){S.body.innerHTML=a;for(a=this.ownerDocument.createDocumentFragment();S.body.firstChild;)l.call(a, S.body.firstChild);m.call(this.parentNode,a,this)}else throw Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");},configurable:!0})};P(a.prototype);W(a.prototype);a.C=function(c){c=b(c,"template");for(var d=0,e=c.length,f;d<e&&(f=c[d]);d++)a.G(f)};document.addEventListener("DOMContentLoaded",function(){a.C(document)});Document.prototype.createElement=function(){var b=g.apply(this,arguments);"template"===b.localName&&a.G(b);return b};DOMParser.prototype.parseFromString= function(){var b=q.apply(this,arguments);a.C(b);return b};Object.defineProperty(HTMLElement.prototype,"innerHTML",{get:function(){return nb(this)},set:function(b){x.set.call(this,b);a.C(this)},configurable:!0,enumerable:!0});var Ve=/[&\u00A0"]/g,yc=/[&\u00A0<>]/g,zc=function(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}};V=function(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b};var We=V("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")), Xe=V("style script xmp iframe noembed noframes plaintext noscript".split(" ")),nb=function(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):M.get.call(a),e=0,f=d.length,g;e<f&&(g=d[e]);e++){a:{var h=g;var k=a;var l=b;switch(h.nodeType){case Node.ELEMENT_NODE:for(var P=h.localName,m="<"+P,W=h.attributes,q=0;k=W[q];q++)m+=" "+k.name+'="'+k.value.replace(Ve,zc)+'"';m+=">";h=We[P]?m:m+nb(h,l)+"</"+P+">";break a;case Node.TEXT_NODE:h=h.data;h=k&&Xe[k.localName]?h:h.replace(yc,zc);break a; case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h),Error("not implemented");}}c+=h}return c}}if(c||mb){a.a=function(a,b){var c=f.call(a,!1);this.G&&this.G(c);b&&(l.call(c.content,f.call(a.content,!0)),ob(c.content,a.content));return c};var ob=function(c,d){if(d.querySelectorAll&&(d=b(d,"template"),0!==d.length)){c=b(c,"template");for(var e=0,f=c.length,g,h;e<f;e++)h=d[e],g=c[e],a&&a.G&&a.G(h),m.call(g.parentNode,Ye.call(h,!0),g)}},Ye=Node.prototype.cloneNode= function(b){if(!e&&d&&this instanceof DocumentFragment)if(b)var c=Ze.call(this.ownerDocument,this,!0);else return this.ownerDocument.createDocumentFragment();else this.nodeType===Node.ELEMENT_NODE&&"template"===this.localName&&this.namespaceURI==document.documentElement.namespaceURI?c=a.a(this,b):c=f.call(this,b);b&&ob(c,this);return c},Ze=Document.prototype.importNode=function(c,d){d=d||!1;if("template"===c.localName)return a.a(c,d);var e=h.call(this,c,d);if(d){ob(e,c);c=b(e,'script:not([type]),script[type="application/javascript"],script[type="text/javascript"]'); for(var f,k=0;k<c.length;k++){f=c[k];d=g.call(document,"script");d.textContent=f.textContent;for(var l=f.attributes,P=0,W;P<l.length;P++)W=l[P],d.setAttribute(W.name,W.value);m.call(f.parentNode,d,f)}}return e}}c&&(window.HTMLTemplateElement=a)})();var ka=setTimeout;function la(){}function ma(a,b){return function(){a.apply(b,arguments)}}function r(a){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!==typeof a)throw new TypeError("not a function");this.u=0;this.ma=!1;this.h=void 0;this.I=[];na(a,this)} function oa(a,b){for(;3===a.u;)a=a.h;0===a.u?a.I.push(b):(a.ma=!0,pa(function(){var c=1===a.u?b.Na:b.Oa;if(null===c)(1===a.u?qa:ra)(b.ga,a.h);else{try{var d=c(a.h)}catch(e){ra(b.ga,e);return}qa(b.ga,d)}}))}function qa(a,b){try{if(b===a)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"===typeof b||"function"===typeof b)){var c=b.then;if(b instanceof r){a.u=3;a.h=b;sa(a);return}if("function"===typeof c){na(ma(c,b),a);return}}a.u=1;a.h=b;sa(a)}catch(d){ra(a,d)}} function ra(a,b){a.u=2;a.h=b;sa(a)}function sa(a){2===a.u&&0===a.I.length&&pa(function(){a.ma||"undefined"!==typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",a.h)});for(var b=0,c=a.I.length;b<c;b++)oa(a,a.I[b]);a.I=null}function ta(a,b,c){this.Na="function"===typeof a?a:null;this.Oa="function"===typeof b?b:null;this.ga=c}function na(a,b){var c=!1;try{a(function(a){c||(c=!0,qa(b,a))},function(a){c||(c=!0,ra(b,a))})}catch(d){c||(c=!0,ra(b,d))}} r.prototype["catch"]=function(a){return this.then(null,a)};r.prototype.then=function(a,b){var c=new this.constructor(la);oa(this,new ta(a,b,c));return c};r.prototype["finally"]=function(a){var b=this.constructor;return this.then(function(c){return b.resolve(a()).then(function(){return c})},function(c){return b.resolve(a()).then(function(){return b.reject(c)})})}; function wa(a){return new r(function(b,c){function d(a,g){try{if(g&&("object"===typeof g||"function"===typeof g)){var h=g.then;if("function"===typeof h){h.call(g,function(b){d(a,b)},c);return}}e[a]=g;0===--f&&b(e)}catch(m){c(m)}}if(!a||"undefined"===typeof a.length)throw new TypeError("Promise.all accepts an array");var e=Array.prototype.slice.call(a);if(0===e.length)return b([]);for(var f=e.length,g=0;g<e.length;g++)d(g,e[g])})} function xa(a){return a&&"object"===typeof a&&a.constructor===r?a:new r(function(b){b(a)})}function ya(a){return new r(function(b,c){c(a)})}function za(a){return new r(function(b,c){for(var d=0,e=a.length;d<e;d++)a[d].then(b,c)})}var pa="function"===typeof setImmediate&&function(a){setImmediate(a)}||function(a){ka(a,0)};/* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ if(!window.Promise){window.Promise=r;r.prototype.then=r.prototype.then;r.all=wa;r.race=za;r.resolve=xa;r.reject=ya;var Aa=document.createTextNode(""),Ba=[];(new MutationObserver(function(){for(var a=Ba.length,b=0;b<a;b++)Ba[b]();Ba.splice(0,a)})).observe(Aa,{characterData:!0});pa=function(a){Ba.push(a);Aa.textContent=0<Aa.textContent.length?"":"a"}};(function(a){function b(a,b){if("function"===typeof window.CustomEvent)return new CustomEvent(a,b);var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c}function c(a){if(M)return a.ownerDocument!==document?a.ownerDocument:null;var b=a.__importDoc;if(!b&&a.parentNode){b=a.parentNode;if("function"===typeof b.closest)b=b.closest("link[rel=import]");else for(;!h(b)&&(b=b.parentNode););a.__importDoc=b}return b}function d(a){var b=m(document,"link[rel=import]:not([import-dependency])"), c=b.length;c?q(b,function(b){return g(b,function(){0===--c&&a()})}):a()}function e(a){function b(){"loading"!==document.readyState&&document.body&&(document.removeEventListener("readystatechange",b),a())}document.addEventListener("readystatechange",b);b()}function f(a){e(function(){return d(function(){return a&&a()})})}function g(a,b){if(a.__loaded)b&&b();else if("script"===a.localName&&!a.src||"style"===a.localName&&!a.firstChild)a.__loaded=!0,b&&b();else{var c=function(d){a.removeEventListener(d.type, c);a.__loaded=!0;b&&b()};a.addEventListener("load",c);ha&&"style"===a.localName||a.addEventListener("error",c)}}function h(a){return a.nodeType===Node.ELEMENT_NODE&&"link"===a.localName&&"import"===a.rel}function k(){var a=this;this.a={};this.b=0;this.c=new MutationObserver(function(b){return a.Ja(b)});this.c.observe(document.head,{childList:!0,subtree:!0});this.loadImports(document)}function l(a){q(m(a,"template"),function(a){q(m(a.content,'script:not([type]),script[type="application/javascript"],script[type="text/javascript"],script[type="module"]'), function(a){var b=document.createElement("script");q(a.attributes,function(a){return b.setAttribute(a.name,a.value)});b.textContent=a.textContent;a.parentNode.replaceChild(b,a)});l(a.content)})}function m(a,b){return a.childNodes.length?a.querySelectorAll(b):U}function q(a,b,c){var d=a?a.length:0,e=c?-1:1;for(c=c?d-1:0;c<d&&0<=c;c+=e)b(a[c],c)}var x=document.createElement("link"),M="import"in x,U=x.querySelectorAll("*"),ua=null;!1==="currentScript"in document&&Object.defineProperty(document,"currentScript", {get:function(){return ua||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null)},configurable:!0});var lb=/(url\()([^)]*)(\))/g,mb=/(@import[\s]+(?!url\())([^;]*)(;)/g,S=/(<link[^>]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,C={Ea:function(a,b){a.href&&a.setAttribute("href",C.X(a.getAttribute("href"),b));a.src&&a.setAttribute("src",C.X(a.getAttribute("src"),b));if("style"===a.localName){var c=C.qa(a.textContent,b,lb);a.textContent=C.qa(c,b,mb)}},qa:function(a,b,c){return a.replace(c, function(a,c,d,e){a=d.replace(/["']/g,"");b&&(a=C.X(a,b));return c+"'"+a+"'"+e})},X:function(a,b){if(void 0===C.aa){C.aa=!1;try{var c=new URL("b","http://a");c.pathname="c%20d";C.aa="http://a/c%20d"===c.href}catch(yc){}}if(C.aa)return(new URL(a,b)).href;c=C.xa;c||(c=document.implementation.createHTMLDocument("temp"),C.xa=c,c.ja=c.createElement("base"),c.head.appendChild(c.ja),c.ia=c.createElement("a"));c.ja.href=b;c.ia.href=a;return c.ia.href||a}},V={async:!0,load:function(a,b,c){if(a)if(a.match(/^data:/)){a= a.split(",");var d=a[1];d=-1<a[0].indexOf(";base64")?atob(d):decodeURIComponent(d);b(d)}else{var e=new XMLHttpRequest;e.open("GET",a,V.async);e.onload=function(){var a=e.responseURL||e.getResponseHeader("Location");a&&0===a.indexOf("/")&&(a=(location.origin||location.protocol+"//"+location.host)+a);var d=e.response||e.responseText;304===e.status||0===e.status||200<=e.status&&300>e.status?b(d,a):c(d)};e.send()}else c("error: href must be specified")}},ha=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent); k.prototype.loadImports=function(a){var b=this;a=m(a,"link[rel=import]");q(a,function(a){return b.g(a)})};k.prototype.g=function(a){var b=this,c=a.href;if(void 0!==this.a[c]){var d=this.a[c];d&&d.__loaded&&(a.__import=d,this.f(a))}else this.b++,this.a[c]="pending",V.load(c,function(a,d){a=b.Ka(a,d||c);b.a[c]=a;b.b--;b.loadImports(a);b.l()},function(){b.a[c]=null;b.b--;b.l()})};k.prototype.Ka=function(a,b){if(!a)return document.createDocumentFragment();ha&&(a=a.replace(S,function(a,b,c){return-1=== a.indexOf("type=")?b+" type=import-disable "+c:a}));var c=document.createElement("template");c.innerHTML=a;if(c.content)a=c.content,l(a);else for(a=document.createDocumentFragment();c.firstChild;)a.appendChild(c.firstChild);if(c=a.querySelector("base"))b=C.X(c.getAttribute("href"),b),c.removeAttribute("href");c=m(a,'link[rel=import],link[rel=stylesheet][href][type=import-disable],style:not([type]),link[rel=stylesheet][href]:not([type]),script:not([type]),script[type="application/javascript"],script[type="text/javascript"],script[type="module"]'); var d=0;q(c,function(a){g(a);C.Ea(a,b);a.setAttribute("import-dependency","");if("script"===a.localName&&!a.src&&a.textContent){if("module"===a.type)throw Error("Inline module scripts are not supported in HTML Imports.");a.setAttribute("src","data:text/javascript;charset=utf-8,"+encodeURIComponent(a.textContent+("\n//# sourceURL="+b+(d?"-"+d:"")+".js\n")));a.textContent="";d++}});return a};k.prototype.l=function(){var a=this;if(!this.b){this.c.disconnect();this.flatten(document);var b=!1,c=!1,d=function(){c&& b&&(a.loadImports(document),a.b||(a.c.observe(document.head,{childList:!0,subtree:!0}),a.da()))};this.Ma(function(){c=!0;d()});this.La(function(){b=!0;d()})}};k.prototype.flatten=function(a){var b=this;a=m(a,"link[rel=import]");q(a,function(a){var c=b.a[a.href];(a.__import=c)&&c.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(b.a[a.href]=a,a.readyState="loading",a.__import=a,b.flatten(c),a.appendChild(c))})};k.prototype.La=function(a){function b(e){if(e<d){var f=c[e],h=document.createElement("script");f.removeAttribute("import-dependency"); q(f.attributes,function(a){return h.setAttribute(a.name,a.value)});ua=h;f.parentNode.replaceChild(h,f);g(h,function(){ua=null;b(e+1)})}else a()}var c=m(document,"script[import-dependency]"),d=c.length;b(0)};k.prototype.Ma=function(a){var b=m(document,"style[import-dependency],link[rel=stylesheet][import-dependency]"),d=b.length;if(d){var e=ha&&!!document.querySelector("link[rel=stylesheet][href][type=import-disable]");q(b,function(b){g(b,function(){b.removeAttribute("import-dependency");0===--d&& a()});if(e&&b.parentNode!==document.head){var f=document.createElement(b.localName);f.__appliedElement=b;f.setAttribute("type","import-placeholder");b.parentNode.insertBefore(f,b.nextSibling);for(f=c(b);f&&c(f);)f=c(f);f.parentNode!==document.head&&(f=null);document.head.insertBefore(b,f);b.removeAttribute("type")}})}else a()};k.prototype.da=function(){var a=this,b=m(document,"link[rel=import]");q(b,function(b){return a.f(b)},!0)};k.prototype.f=function(a){a.__loaded||(a.__loaded=!0,a.import&&(a.import.readyState= "complete"),a.dispatchEvent(b(a.import?"load":"error",{bubbles:!1,cancelable:!1,detail:void 0})))};k.prototype.Ja=function(a){var b=this;q(a,function(a){return q(a.addedNodes,function(a){a&&a.nodeType===Node.ELEMENT_NODE&&(h(a)?b.g(a):b.loadImports(a))})})};var va=null;if(M)x=m(document,"link[rel=import]"),q(x,function(a){a.import&&"loading"===a.import.readyState||(a.__loaded=!0)}),x=function(a){a=a.target;h(a)&&(a.__loaded=!0)},document.addEventListener("load",x,!0),document.addEventListener("error", x,!0);else{var X=Object.getOwnPropertyDescriptor(Node.prototype,"baseURI");Object.defineProperty((!X||X.configurable?Node:Element).prototype,"baseURI",{get:function(){var a=h(this)?this:c(this);return a?a.href:X&&X.get?X.get.call(this):(document.querySelector("base")||window.location).href},configurable:!0,enumerable:!0});Object.defineProperty(HTMLLinkElement.prototype,"import",{get:function(){return this.__import||null},configurable:!0,enumerable:!0});e(function(){va=new k})}f(function(){return document.dispatchEvent(b("HTMLImportsLoaded", {cancelable:!0,bubbles:!0,detail:void 0}))});a.useNative=M;a.whenReady=f;a.importForElement=c;a.loadImports=function(a){va&&va.loadImports(a)}})(window.HTMLImports=window.HTMLImports||{});/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ window.WebComponents=window.WebComponents||{flags:{}};var Ca=document.querySelector('script[src*="webcomponents-lite.js"]'),Da=/wc-(.+)/,t={};if(!t.noOpts){location.search.slice(1).split("&").forEach(function(a){a=a.split("=");var b;a[0]&&(b=a[0].match(Da))&&(t[b[1]]=a[1]||!0)});if(Ca)for(var Ea=0,Fa=void 0;Fa=Ca.attributes[Ea];Ea++)"src"!==Fa.name&&(t[Fa.name]=Fa.value||!0);if(t.log&&t.log.split){var Ga=t.log.split(",");t.log={};Ga.forEach(function(a){t.log[a]=!0})}else t.log={}} window.WebComponents.flags=t;var Ha=t.shadydom;Ha&&(window.ShadyDOM=window.ShadyDOM||{},window.ShadyDOM.force=Ha);var Ia=t.register||t.ce;Ia&&window.customElements&&(window.customElements.forcePolyfill=Ia);/* Copyright (c) 2016 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ function Ja(){this.pa=this.root=null;this.T=!1;this.D=this.P=this.ca=this.assignedSlot=this.assignedNodes=this.H=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.K=void 0;this.ka=this.la=!1;this.O={}}Ja.prototype.toJSON=function(){return{}};function u(a){a.__shady||(a.__shady=new Ja);return a.__shady}function v(a){return a&&a.__shady};var w=window.ShadyDOM||{};w.Ga=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var Ka=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");w.m=!!(Ka&&Ka.configurable&&Ka.get);w.ea=w.force||!w.Ga;w.J=w.noPatch||!1;w.oa=w.preferPerformance;function y(a){return(a=v(a))&&void 0!==a.firstChild}function z(a){return"ShadyRoot"===a.za}function La(a){return(a=(a=v(a))&&a.root)&&Ma(a)} var Na=Element.prototype,Oa=Na.matches||Na.matchesSelector||Na.mozMatchesSelector||Na.msMatchesSelector||Na.oMatchesSelector||Na.webkitMatchesSelector,Pa=document.createTextNode(""),Qa=0,Ra=[];(new MutationObserver(function(){for(;Ra.length;)try{Ra.shift()()}catch(a){throw Pa.textContent=Qa++,a;}})).observe(Pa,{characterData:!0});function Sa(a){Ra.push(a);Pa.textContent=Qa++}var Ta=!!document.contains;function Ua(a,b){for(;b;){if(b==a)return!0;b=b.__shady_parentNode}return!1} function Va(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(b){return a[b]};a.namedItem=function(b){if("length"!==b&&isNaN(b)&&a[b])return a[b];for(var c=ia(a),d=c.next();!d.done;d=c.next())if(d=d.value,(d.getAttribute("id")||d.getAttribute("name"))==b)return d;return null};return a} function A(a,b,c,d){c=void 0===c?"":c;for(var e in b){var f=b[e];if(!(d&&0<=d.indexOf(e))){f.configurable=!0;var g=c+e;if(f.value)a[g]=f.value;else try{Object.defineProperty(a,g,f)}catch(h){}}}}function B(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b};var Wa=[],Xa;function Ya(a){Xa||(Xa=!0,Sa(Za));Wa.push(a)}function Za(){Xa=!1;for(var a=!!Wa.length;Wa.length;)Wa.shift()();return a}Za.list=Wa;function $a(){this.a=!1;this.addedNodes=[];this.removedNodes=[];this.S=new Set}function ab(a){a.a||(a.a=!0,Sa(function(){a.flush()}))}$a.prototype.flush=function(){if(this.a){this.a=!1;var a=this.takeRecords();a.length&&this.S.forEach(function(b){b(a)})}};$a.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; function bb(a,b){var c=u(a);c.H||(c.H=new $a);c.H.S.add(b);var d=c.H;return{ya:b,F:d,Aa:a,takeRecords:function(){return d.takeRecords()}}}function cb(a){var b=a&&a.F;b&&(b.S.delete(a.ya),b.S.size||(u(a.Aa).H=null))} function db(a,b){var c=b.getRootNode();return a.map(function(a){var b=c===a.target.getRootNode();if(b&&a.addedNodes){if(b=Array.from(a.addedNodes).filter(function(a){return c===a.getRootNode()}),b.length)return a=Object.create(a),Object.defineProperty(a,"addedNodes",{value:b,configurable:!0}),a}else if(b)return a}).filter(function(a){return a})};var eb=/[&\u00A0"]/g,fb=/[&\u00A0<>]/g;function gb(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}}function hb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var ib=hb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),jb=hb("style script xmp iframe noembed noframes plaintext noscript".split(" ")); function kb(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,g=void 0;e<f&&(g=d[e]);e++){a:{var h=g;var k=a,l=b;switch(h.nodeType){case Node.ELEMENT_NODE:k=h.localName;for(var m="<"+k,q=h.attributes,x=0,M;M=q[x];x++)m+=" "+M.name+'="'+M.value.replace(eb,gb)+'"';m+=">";h=ib[k]?m:m+kb(h,l)+"</"+k+">";break a;case Node.TEXT_NODE:h=h.data;h=k&&jb[k.localName]?h:h.replace(fb,gb);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h), Error("not implemented");}}c+=h}return c};var pb=w.m,qb={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},rb={};function sb(a){rb[a]=function(b){return b["__shady_native_"+a]}}function tb(a,b){A(a,b,"__shady_native_");for(var c in b)sb(c)}function D(a,b){b=void 0===b?[]:b;for(var c=0;c<b.length;c++){var d=b[c],e=Object.getOwnPropertyDescriptor(a,d);e&&(Object.defineProperty(a,"__shady_native_"+d,e),e.value?qb[d]||(qb[d]=e.value):sb(d))}} var E=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),F=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),ub=document.implementation.createHTMLDocument("inert");function vb(a){for(var b;b=a.__shady_native_firstChild;)a.__shady_native_removeChild(b)}var wb=["firstElementChild","lastElementChild","children","childElementCount"],xb=["querySelector","querySelectorAll"]; function yb(){var a=["dispatchEvent","addEventListener","removeEventListener"];window.EventTarget?D(window.EventTarget.prototype,a):(D(Node.prototype,a),D(Window.prototype,a));pb?D(Node.prototype,"parentNode firstChild lastChild previousSibling nextSibling childNodes parentElement textContent".split(" ")):tb(Node.prototype,{parentNode:{get:function(){E.currentNode=this;return E.parentNode()}},firstChild:{get:function(){E.currentNode=this;return E.firstChild()}},lastChild:{get:function(){E.currentNode= this;return E.lastChild()}},previousSibling:{get:function(){E.currentNode=this;return E.previousSibling()}},nextSibling:{get:function(){E.currentNode=this;return E.nextSibling()}},childNodes:{get:function(){var a=[];E.currentNode=this;for(var c=E.firstChild();c;)a.push(c),c=E.nextSibling();return a}},parentElement:{get:function(){F.currentNode=this;return F.parentNode()}},textContent:{get:function(){switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:for(var a=document.createTreeWalker(this, NodeFilter.SHOW_TEXT,null,!1),c="",d;d=a.nextNode();)c+=d.nodeValue;return c;default:return this.nodeValue}},set:function(a){if("undefined"===typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:vb(this);(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_native_insertBefore(document.createTextNode(a),void 0);break;default:this.nodeValue=a}}}});D(Node.prototype,"appendChild insertBefore removeChild replaceChild cloneNode contains".split(" ")); a={firstElementChild:{get:function(){F.currentNode=this;return F.firstChild()}},lastElementChild:{get:function(){F.currentNode=this;return F.lastChild()}},children:{get:function(){var a=[];F.currentNode=this;for(var c=F.firstChild();c;)a.push(c),c=F.nextSibling();return Va(a)}},childElementCount:{get:function(){return this.children?this.children.length:0}}};pb?(D(Element.prototype,wb),D(Element.prototype,["previousElementSibling","nextElementSibling","innerHTML"]),Object.getOwnPropertyDescriptor(HTMLElement.prototype, "children")&&D(HTMLElement.prototype,["children"]),Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&D(HTMLElement.prototype,["innerHTML"])):(tb(Element.prototype,a),tb(Element.prototype,{previousElementSibling:{get:function(){F.currentNode=this;return F.previousSibling()}},nextElementSibling:{get:function(){F.currentNode=this;return F.nextSibling()}},innerHTML:{get:function(){return kb(this,function(a){return a.__shady_native_childNodes})},set:function(a){var b="template"===this.localName? this.content:this;vb(b);var d=this.localName||"div";d=this.namespaceURI&&this.namespaceURI!==ub.namespaceURI?ub.createElementNS(this.namespaceURI,d):ub.createElement(d);d.innerHTML=a;for(a="template"===this.localName?d.content:d;d=a.__shady_native_firstChild;)b.__shady_native_insertBefore(d,void 0)}}}));D(Element.prototype,"setAttribute getAttribute hasAttribute removeAttribute focus blur".split(" "));D(Element.prototype,xb);D(HTMLElement.prototype,["focus","blur","contains"]);pb&&D(HTMLElement.prototype, ["parentElement","children","innerHTML"]);window.HTMLTemplateElement&&D(window.HTMLTemplateElement.prototype,["innerHTML"]);pb?D(DocumentFragment.prototype,wb):tb(DocumentFragment.prototype,a);D(DocumentFragment.prototype,xb);pb?(D(Document.prototype,wb),D(Document.prototype,["activeElement"])):tb(Document.prototype,a);D(Document.prototype,["importNode","getElementById"]);D(Document.prototype,xb)};var zb=B({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent=a},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get innerHTML(){return this.__shady_innerHTML}, set innerHTML(a){return this.__shady_innerHTML=a},get shadowRoot(){return this.__shady_shadowRoot}}),Ab=B({get parentElement(){return this.__shady_parentElement},get parentNode(){return this.__shady_parentNode},get nextSibling(){return this.__shady_nextSibling},get previousSibling(){return this.__shady_previousSibling},get nextElementSibling(){return this.__shady_nextElementSibling},get previousElementSibling(){return this.__shady_previousElementSibling},get className(){return this.__shady_className}, set className(a){return this.__shady_className=a}}),Bb;for(Bb in zb)zb[Bb].enumerable=!1;for(var Cb in Ab)Ab[Cb].enumerable=!1;var Db=w.m||w.J,Eb=Db?function(){}:function(a){var b=u(a);b.la||(b.la=!0,A(a,Ab))},Fb=Db?function(){}:function(a){var b=u(a);b.ka||(b.ka=!0,A(a,zb))};var Gb="__eventWrappers"+Date.now(),Hb=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),Ib={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0, pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0,drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},Jb={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0}; function Kb(a){return a instanceof Node?a.__shady_getRootNode():a}function Lb(a,b){var c=[],d=a;for(a=Kb(a);d;)c.push(d),d.__shady_assignedSlot?d=d.__shady_assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d=d.host:d=d.__shady_parentNode;c[c.length-1]===document&&c.push(window);return c}function Mb(a){a.__composedPath||(a.__composedPath=Lb(a.target,!0));return a.__composedPath} function Nb(a,b){if(!z)return a;a=Lb(a,!0);for(var c=0,d,e=void 0,f,g=void 0;c<b.length;c++)if(d=b[c],f=Kb(d),f!==e&&(g=a.indexOf(f),e=f),!z(f)||-1<g)return d}function Ob(a){function b(b,d){b=new a(b,d);b.__composed=d&&!!d.composed;return b}b.__proto__=a;b.prototype=a.prototype;return b}var Pb={focus:!0,blur:!0};function Qb(a){return a.__target!==a.target||a.__relatedTarget!==a.relatedTarget} function Rb(a,b,c){if(c=b.__handlers&&b.__handlers[a.type]&&b.__handlers[a.type][c])for(var d=0,e;(e=c[d])&&(!Qb(a)||a.target!==a.relatedTarget)&&(e.call(b,a),!a.__immediatePropagationStopped);d++);} function Sb(a){var b=a.composedPath();Object.defineProperty(a,"currentTarget",{get:function(){return d},configurable:!0});for(var c=b.length-1;0<=c;c--){var d=b[c];Rb(a,d,"capture");if(a.Z)return}Object.defineProperty(a,"eventPhase",{get:function(){return Event.AT_TARGET}});var e;for(c=0;c<b.length;c++){d=b[c];var f=v(d);f=f&&f.root;if(0===c||f&&f===e)if(Rb(a,d,"bubble"),d!==window&&(e=d.__shady_getRootNode()),a.Z)break}} function Tb(a,b,c,d,e,f){for(var g=0;g<a.length;g++){var h=a[g],k=h.type,l=h.capture,m=h.once,q=h.passive;if(b===h.node&&c===k&&d===l&&e===m&&f===q)return g}return-1} function Ub(a,b,c){if(b){var d=typeof b;if("function"===d||"object"===d)if("object"!==d||b.handleEvent&&"function"===typeof b.handleEvent){if(Jb[a])return this.__shady_native_addEventListener(a,b,c);if(c&&"object"===typeof c){var e=!!c.capture;var f=!!c.once;var g=!!c.passive}else e=!!c,g=f=!1;var h=c&&c.$||this,k=b[Gb];if(k){if(-1<Tb(k,h,a,e,f,g))return}else b[Gb]=[];k=function(e){f&&this.__shady_removeEventListener(a,b,c);e.__target||Vb(e);if(h!==this){var g=Object.getOwnPropertyDescriptor(e,"currentTarget"); Object.defineProperty(e,"currentTarget",{get:function(){return h},configurable:!0})}e.__previousCurrentTarget=e.currentTarget;if(!z(h)||-1!=e.composedPath().indexOf(h))if(e.composed||-1<e.composedPath().indexOf(h))if(Qb(e)&&e.target===e.relatedTarget)e.eventPhase===Event.BUBBLING_PHASE&&e.stopImmediatePropagation();else if(e.eventPhase===Event.CAPTURING_PHASE||e.bubbles||e.target===h||h instanceof Window){var k="function"===d?b.call(h,e):b.handleEvent&&b.handleEvent(e);h!==this&&(g?(Object.defineProperty(e, "currentTarget",g),g=null):delete e.currentTarget);return k}};b[Gb].push({node:h,type:a,capture:e,once:f,passive:g,Ya:k});Pb[a]?(this.__handlers=this.__handlers||{},this.__handlers[a]=this.__handlers[a]||{capture:[],bubble:[]},this.__handlers[a][e?"capture":"bubble"].push(k)):this.__shady_native_addEventListener(a,k,c)}}} function Wb(a,b,c){if(b){if(Jb[a])return this.__shady_native_removeEventListener(a,b,c);if(c&&"object"===typeof c){var d=!!c.capture;var e=!!c.once;var f=!!c.passive}else d=!!c,f=e=!1;var g=c&&c.$||this,h=void 0;var k=null;try{k=b[Gb]}catch(l){}k&&(e=Tb(k,g,a,d,e,f),-1<e&&(h=k.splice(e,1)[0].Ya,k.length||(b[Gb]=void 0)));this.__shady_native_removeEventListener(a,h||b,c);h&&Pb[a]&&this.__handlers&&this.__handlers[a]&&(a=this.__handlers[a][d?"capture":"bubble"],h=a.indexOf(h),-1<h&&a.splice(h,1))}} function Xb(){for(var a in Pb)window.__shady_native_addEventListener(a,function(a){a.__target||(Vb(a),Sb(a))},!0)} var Yb=B({get composed(){void 0===this.__composed&&(Hb?this.__composed="focusin"===this.type||"focusout"===this.type||Hb(this):!1!==this.isTrusted&&(this.__composed=Ib[this.type]));return this.__composed||!1},composedPath:function(){this.__composedPath||(this.__composedPath=Lb(this.__target,this.composed));return this.__composedPath},get target(){return Nb(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.__relatedTarget)return null;this.__relatedTargetComposedPath|| (this.__relatedTargetComposedPath=Lb(this.__relatedTarget,!0));return Nb(this.currentTarget||this.__previousCurrentTarget,this.__relatedTargetComposedPath)},stopPropagation:function(){Event.prototype.stopPropagation.call(this);this.Z=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.Z=this.__immediatePropagationStopped=!0}}); function Vb(a){a.__target=a.target;a.__relatedTarget=a.relatedTarget;if(w.m){var b=Object.getPrototypeOf(a);if(!Object.hasOwnProperty(b,"__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;A(c,Yb);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else A(a,Yb)}var Zb=Ob(Event),$b=Ob(CustomEvent),ac=Ob(MouseEvent); function bc(){if(!Hb&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var a=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(a)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}}var cc=Object.getOwnPropertyNames(Document.prototype).filter(function(a){return"on"===a.substring(0,2)});function dc(a,b){return{index:a,L:[],R:b}} function ec(a,b,c,d){var e=0,f=0,g=0,h=0,k=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(g=0;g<k;g++)if(a[g]!==c[g])break a;g=k}if(b==a.length&&d==c.length){h=a.length;for(var l=c.length,m=0;m<k-g&&fc(a[--h],c[--l]);)m++;h=m}e+=g;f+=g;b-=h;d-=h;if(0==b-e&&0==d-f)return[];if(e==b){for(b=dc(e,0);f<d;)b.L.push(c[f++]);return[b]}if(f==d)return[dc(e,b-e)];k=e;g=f;d=d-g+1;h=b-k+1;b=Array(d);for(l=0;l<d;l++)b[l]=Array(h),b[l][0]=l;for(l=0;l<h;l++)b[0][l]=l;for(l=1;l<d;l++)for(m=1;m<h;m++)if(a[k+m-1]===c[g+l-1])b[l][m]= b[l-1][m-1];else{var q=b[l-1][m]+1,x=b[l][m-1]+1;b[l][m]=q<x?q:x}k=b.length-1;g=b[0].length-1;d=b[k][g];for(a=[];0<k||0<g;)0==k?(a.push(2),g--):0==g?(a.push(3),k--):(h=b[k-1][g-1],l=b[k-1][g],m=b[k][g-1],q=l<m?l<h?l:h:m<h?m:h,q==h?(h==d?a.push(0):(a.push(1),d=h),k--,g--):q==l?(a.push(3),k--,d=l):(a.push(2),g--,d=m));a.reverse();b=void 0;k=[];for(g=0;g<a.length;g++)switch(a[g]){case 0:b&&(k.push(b),b=void 0);e++;f++;break;case 1:b||(b=dc(e,0));b.R++;e++;b.L.push(c[f]);f++;break;case 2:b||(b=dc(e,0)); b.R++;e++;break;case 3:b||(b=dc(e,0)),b.L.push(c[f]),f++}b&&k.push(b);return k}function fc(a,b){return a===b};function gc(a,b,c){Eb(a);c=c||null;var d=u(a),e=u(b),f=c?u(c):null;d.previousSibling=c?f.previousSibling:b.__shady_lastChild;if(f=v(d.previousSibling))f.nextSibling=a;if(f=v(d.nextSibling=c))f.previousSibling=a;d.parentNode=b;c?c===e.firstChild&&(e.firstChild=a):(e.lastChild=a,e.firstChild||(e.firstChild=a));e.childNodes=null} function hc(a,b,c){Fb(b);var d=u(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){d=a.__shady_childNodes;for(var e=0;e<d.length;e++)gc(d[e],b,c);a=u(a);b=void 0!==a.firstChild?null:void 0;a.firstChild=a.lastChild=b;a.childNodes=b}else gc(a,b,c)} function ic(a,b){var c=u(a);b=u(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(u(a).nextSibling=d);d&&(u(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)} function jc(a){var b=u(a);if(void 0===b.firstChild){b.childNodes=null;var c=b.firstChild=a.__shady_native_firstChild||null;b.lastChild=a.__shady_native_lastChild||null;Fb(a);b=c;for(c=void 0;b;b=b.__shady_native_nextSibling){var d=u(b);d.parentNode=a;d.nextSibling=b.__shady_native_nextSibling||null;d.previousSibling=c||null;c=b;Eb(b)}}};var kc=null;function G(){kc||(kc=window.ShadyCSS&&window.ShadyCSS.ScopingShim);return kc||null}function lc(a,b){var c=G();c&&c.unscopeNode(a,b)}function mc(a,b){var c=G();if(!c)return!0;if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){c=!0;a=a.__shady_childNodes;for(var d=0;c&&d<a.length;d++)c=c&&mc(a[d],b);return c}return a.nodeType!==Node.ELEMENT_NODE?!0:c.currentScopeForNode(a)===b}function nc(a){if(a.nodeType!==Node.ELEMENT_NODE)return"";var b=G();return b?b.currentScopeForNode(a):""} function oc(a,b){if(a){a.nodeType===Node.ELEMENT_NODE&&b(a);a=a.__shady_childNodes;for(var c=0,d;c<a.length;c++)d=a[c],d.nodeType===Node.ELEMENT_NODE&&oc(d,b)}};var pc=window.document,qc=w.oa,rc=Object.getOwnPropertyDescriptor(Node.prototype,"isConnected"),sc=rc&&rc.get;function tc(a){for(var b;b=a.__shady_firstChild;)a.__shady_removeChild(b)}function uc(a){var b=v(a);if(b&&void 0!==b.K){b=a.__shady_childNodes;for(var c=0,d=b.length,e=void 0;c<d&&(e=b[c]);c++)uc(e)}if(a=v(a))a.K=void 0}function vc(a){var b=a;a&&"slot"===a.localName&&(b=(b=(b=v(a))&&b.D)&&b.length?b[0]:vc(a.__shady_nextSibling));return b} function wc(a,b,c){if(a=(a=v(a))&&a.H)b&&a.addedNodes.push(b),c&&a.removedNodes.push(c),ab(a)} var Cc=B({get parentNode(){var a=v(this);a=a&&a.parentNode;return void 0!==a?a:this.__shady_native_parentNode},get firstChild(){var a=v(this);a=a&&a.firstChild;return void 0!==a?a:this.__shady_native_firstChild},get lastChild(){var a=v(this);a=a&&a.lastChild;return void 0!==a?a:this.__shady_native_lastChild},get nextSibling(){var a=v(this);a=a&&a.nextSibling;return void 0!==a?a:this.__shady_native_nextSibling},get previousSibling(){var a=v(this);a=a&&a.previousSibling;return void 0!==a?a:this.__shady_native_previousSibling}, get childNodes(){if(y(this)){var a=v(this);if(!a.childNodes){a.childNodes=[];for(var b=this.__shady_firstChild;b;b=b.__shady_nextSibling)a.childNodes.push(b)}var c=a.childNodes}else c=this.__shady_native_childNodes;c.item=function(a){return c[a]};return c},get parentElement(){var a=v(this);(a=a&&a.parentNode)&&a.nodeType!==Node.ELEMENT_NODE&&(a=null);return void 0!==a?a:this.__shady_native_parentElement},get isConnected(){if(sc&&sc.call(this))return!0;if(this.nodeType==Node.DOCUMENT_FRAGMENT_NODE)return!1; var a=this.ownerDocument;if(Ta){if(a.__shady_native_contains(this))return!0}else if(a.documentElement&&a.documentElement.__shady_native_contains(this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.__shady_parentNode||(z(a)?a.host:void 0);return!!(a&&a instanceof Document)},get textContent(){if(y(this)){for(var a=[],b=0,c=this.__shady_childNodes,d;d=c[b];b++)d.nodeType!==Node.COMMENT_NODE&&a.push(d.__shady_textContent);return a.join("")}return this.__shady_native_textContent},set textContent(a){if("undefined"=== typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!y(this)&&w.m){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&tc(this);this.__shady_native_textContent=a}else tc(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==pc&&a.ownerDocument!==pc)return this.__shady_native_insertBefore(a, b),a;if(a===this)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent.");if(b){var c=v(b);c=c&&c.parentNode;if(void 0!==c&&c!==this||void 0===c&&b.__shady_native_parentNode!==this)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(b===a)return a;var d=[],e=(c=xc(this))?c.host.localName:nc(this),f=a.__shady_parentNode;if(f){var g=nc(a);f.__shady_removeChild(a,!!c|| !xc(a))}f=!0;var h=(!qc||void 0===a.__noInsertionPoint)&&!mc(a,e),k=c&&!a.__noInsertionPoint&&(!qc||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(k||h)h&&(g=g||nc(a)),oc(a,function(a){k&&"slot"===a.localName&&d.push(a);if(h){var b=g;G()&&(b&&lc(a,b),(b=G())&&b.scopeNode(a,e))}});if("slot"===this.localName||d.length)d.length&&(c.c=c.c||[],c.a=c.a||[],c.b=c.b||{},c.c.push.apply(c.c,d instanceof Array?d:ja(ia(d)))),c&&Ac(c);y(this)&&(hc(a,this,b),c=v(this),La(this)?(Ac(c.root),f=!1):c.root&&(f=!1));f? (c=z(this)?this.host:this,b?(b=vc(b),c.__shady_native_insertBefore(a,b)):c.__shady_native_appendChild(a)):a.ownerDocument!==this.ownerDocument&&this.ownerDocument.adoptNode(a);wc(this,a);return a},appendChild:function(a){return this.__shady_insertBefore(a)},removeChild:function(a,b){b=void 0===b?!1:b;if(this.ownerDocument!==pc)return this.__shady_native_removeChild(a);if(a.__shady_parentNode!==this)throw Error("The node to be removed is not a child of this node: "+a);var c=xc(a),d=c&&Bc(c,a),e=v(this); if(y(this)&&(ic(a,this),La(this))){Ac(e.root);var f=!0}if(G()&&!b&&c){var g=nc(a);oc(a,function(a){lc(a,g)})}uc(a);c&&((b=this&&"slot"===this.localName)&&(f=!0),(d||b)&&Ac(c));f||(f=z(this)?this.host:this,(!e.root&&"slot"!==a.localName||f===a.__shady_native_parentNode)&&f.__shady_native_removeChild(a));wc(this,null,a);return a},replaceChild:function(a,b){this.__shady_insertBefore(a,b);this.__shady_removeChild(b);return a},cloneNode:function(a){if("template"==this.localName)return this.__shady_native_cloneNode(a); var b=this.__shady_native_cloneNode(!1);if(a&&b.nodeType!==Node.ATTRIBUTE_NODE){a=this.__shady_childNodes;for(var c=0,d;c<a.length;c++)d=a[c].__shady_cloneNode(!0),b.__shady_appendChild(d)}return b},getRootNode:function(a){if(this&&this.nodeType){var b=u(this),c=b.K;void 0===c&&(z(this)?(c=this,b.K=c):(c=(c=this.__shady_parentNode)?c.__shady_getRootNode(a):this,document.documentElement.__shady_native_contains(this)&&(b.K=c)));return c}},contains:function(a){return Ua(this,a)}});function Dc(a,b,c){var d=[];Ec(a.__shady_childNodes,b,c,d);return d}function Ec(a,b,c,d){for(var e=0,f=a.length,g=void 0;e<f&&(g=a[e]);e++){var h;if(h=g.nodeType===Node.ELEMENT_NODE){h=g;var k=b,l=c,m=d,q=k(h);q&&m.push(h);l&&l(q)?h=q:(Ec(h.__shady_childNodes,k,l,m),h=void 0)}if(h)break}} var Fc=B({get firstElementChild(){var a=v(this);if(a&&void 0!==a.firstChild){for(a=this.__shady_firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_firstElementChild},get lastElementChild(){var a=v(this);if(a&&void 0!==a.lastChild){for(a=this.__shady_lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_lastElementChild},get children(){return y(this)?Va(Array.prototype.filter.call(this.__shady_childNodes, function(a){return a.nodeType===Node.ELEMENT_NODE})):this.__shady_native_children},get childElementCount(){var a=this.__shady_children;return a?a.length:0}}),Gc=B({querySelector:function(a){return Dc(this,function(b){return Oa.call(b,a)},function(a){return!!a})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(this.__shady_native_querySelectorAll(a));var c=this.__shady_getRootNode();return b.filter(function(a){return a.__shady_getRootNode()==c})}return Dc(this,function(b){return Oa.call(b, a)})}}),Hc=w.oa?Object.assign({},Fc):Fc;Object.assign(Fc,Gc);var Ic=B({getElementById:function(a){return""===a?null:Dc(this,function(b){return b.id==a},function(a){return!!a})[0]||null}});var Jc=B({get activeElement(){var a=w.m?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!z(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=xc(a);b&&b!==this;)a=b.host,b=xc(a);return this===document?b?null:a:b===this?a:null}});var Kc=document.implementation.createHTMLDocument("inert"),Lc=B({get innerHTML(){return y(this)?kb("template"===this.localName?this.content:this,function(a){return a.__shady_childNodes}):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{tc(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==Kc.namespaceURI?Kc.createElementNS(this.namespaceURI,b):Kc.createElement(b);for(w.m?b.__shady_native_innerHTML=a:b.innerHTML= a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var Mc=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.$=this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.$=this;this.host.__shady_removeEventListener(a,b,c)}});function Nc(a,b){A(a,Mc,b);A(a,Jc,b);A(a,Lc,b);A(a,Fc,b);w.J&&!b?(A(a,Cc,b),A(a,Ic,b)):w.m||(A(a,Ab),A(a,zb))};var Oc={},Pc=w.deferConnectionCallbacks&&"loading"===document.readyState,Qc;function Rc(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b} function Sc(a,b,c){if(a!==Oc)throw new TypeError("Illegal constructor");this.za="ShadyRoot";this.host=b;this.mode=c&&c.mode;jc(b);a=u(b);a.root=this;a.pa="closed"!==this.mode?this:null;a=u(this);a.firstChild=a.lastChild=a.parentNode=a.nextSibling=a.previousSibling=null;a.childNodes=[];this.ba=this.B=!1;this.c=this.b=this.a=null;if(w.preferPerformance)for(;a=b.__shady_native_firstChild;)b.__shady_native_removeChild(a);else Ac(this)}function Ac(a){a.B||(a.B=!0,Ya(function(){return Tc(a)}))} function Tc(a){var b;if(b=a.B){for(var c;a;)a:{a.B&&(c=a),b=a;a=b.host.__shady_getRootNode();if(z(a)&&(b=v(b.host))&&0<b.N)break a;a=void 0}b=c}(c=b)&&c._renderSelf()} Sc.prototype._renderSelf=function(){var a=Pc;Pc=!0;this.B=!1;if(this.a){Uc(this);for(var b=0,c;b<this.a.length;b++){c=this.a[b];var d=v(c),e=d.assignedNodes;d.assignedNodes=[];d.D=[];if(d.ca=e)for(d=0;d<e.length;d++){var f=v(e[d]);f.P=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(b=this.host.__shady_firstChild;b;b=b.__shady_nextSibling)Vc(this,b);for(b=0;b<this.a.length;b++){c=this.a[b];e=v(c);if(!e.assignedNodes.length)for(d=c.__shady_firstChild;d;d=d.__shady_nextSibling)Vc(this, d,c);(d=(d=v(c.__shady_parentNode))&&d.root)&&(Ma(d)||d.B)&&d._renderSelf();Wc(this,e.D,e.assignedNodes);if(d=e.ca){for(f=0;f<d.length;f++)v(d[f]).P=null;e.ca=null;d.length>e.assignedNodes.length&&(e.T=!0)}e.T&&(e.T=!1,Xc(this,c))}c=this.a;b=[];for(e=0;e<c.length;e++)d=c[e].__shady_parentNode,(f=v(d))&&f.root||!(0>b.indexOf(d))||b.push(d);for(c=0;c<b.length;c++){f=b[c];e=f===this?this.host:f;d=[];f=f.__shady_childNodes;for(var g=0;g<f.length;g++){var h=f[g];if("slot"==h.localName){h=v(h).D;for(var k= 0;k<h.length;k++)d.push(h[k])}else d.push(h)}f=Array.prototype.slice.call(e.__shady_native_childNodes);g=ec(d,d.length,f,f.length);k=h=0;for(var l=void 0;h<g.length&&(l=g[h]);h++){for(var m=0,q=void 0;m<l.L.length&&(q=l.L[m]);m++)q.__shady_native_parentNode===e&&e.__shady_native_removeChild(q),f.splice(l.index+k,1);k-=l.R}k=0;for(l=void 0;k<g.length&&(l=g[k]);k++)for(h=f[l.index],m=l.index;m<l.index+l.R;m++)q=d[m],e.__shady_native_insertBefore(q,h),f.splice(m,0,q)}}if(!w.preferPerformance&&!this.ba)for(b= this.host.__shady_childNodes,c=0,e=b.length;c<e;c++)d=b[c],f=v(d),d.__shady_native_parentNode!==this.host||"slot"!==d.localName&&f.assignedSlot||this.host.__shady_native_removeChild(d);this.ba=!0;Pc=a;Qc&&Qc()};function Vc(a,b,c){var d=u(b),e=d.P;d.P=null;c||(c=(a=a.b[b.__shady_slot||"__catchall"])&&a[0]);c?(u(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(u(d.assignedSlot).T=!0)} function Wc(a,b,c){for(var d=0,e=void 0;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=v(e).assignedNodes;f&&f.length&&Wc(a,b,f)}else b.push(c[d])}function Xc(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=v(b);b.assignedSlot&&Xc(a,b.assignedSlot)} function Uc(a){if(a.c&&a.c.length){for(var b=a.c,c,d=0;d<b.length;d++){var e=b[d];jc(e);var f=e.__shady_parentNode;jc(f);f=v(f);f.N=(f.N||0)+1;f=Yc(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var g in c)a.b[g]=Zc(a.b[g]);a.c=[]}}function Yc(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.wa=b} function Zc(a){return a.sort(function(a,c){a=Rc(a);for(var b=Rc(c),e=0;e<a.length;e++){c=a[e];var f=b[e];if(c!==f)return a=Array.from(c.__shady_parentNode.__shady_childNodes),a.indexOf(c)-a.indexOf(f)}})} function Bc(a,b){if(a.a){Uc(a);var c=a.b,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var g=e[f];if(Ua(b,g)){e.splice(f,1);var h=a.a.indexOf(g);0<=h&&(a.a.splice(h,1),(h=v(g.__shady_parentNode))&&h.N&&h.N--);f--;g=v(g);if(h=g.D)for(var k=0;k<h.length;k++){var l=h[k],m=l.__shady_native_parentNode;m&&m.__shady_native_removeChild(l)}g.D=[];g.assignedNodes=[];h=!0}}return h}}function Ma(a){Uc(a);return!(!a.a||!a.a.length)} (function(a){a.__proto__=DocumentFragment.prototype;Nc(a,"__shady_");Nc(a);Object.defineProperties(a,{nodeType:{value:Node.DOCUMENT_FRAGMENT_NODE,configurable:!0},nodeName:{value:"#document-fragment",configurable:!0},nodeValue:{value:null,configurable:!0}});["localName","namespaceURI","prefix"].forEach(function(b){Object.defineProperty(a,b,{value:void 0,configurable:!0})});["ownerDocument","baseURI","isConnected"].forEach(function(b){Object.defineProperty(a,b,{get:function(){return this.host[b]}, configurable:!0})})})(Sc.prototype); if(window.customElements&&w.ea&&!w.preferPerformance){var $c=new Map;Qc=function(){var a=[];$c.forEach(function(b,c){a.push([c,b])});$c.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.ua():c.va()}};Pc&&document.addEventListener("readystatechange",function(){Pc=!1;Qc()},{once:!0});var ad=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.ua=function(){Pc?$c.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback= a.prototype.va=function(){Pc?this.isConnected||$c.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},bd=window.customElements.define;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;bd.call(window.customElements,a,ad(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d}})}function xc(a){a=a.__shady_getRootNode();if(z(a))return a};function cd(a){this.node=a}n=cd.prototype;n.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};n.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};n.appendChild=function(a){return this.node.__shady_appendChild(a)};n.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};n.removeChild=function(a){return this.node.__shady_removeChild(a)};n.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)}; n.cloneNode=function(a){return this.node.__shady_cloneNode(a)};n.getRootNode=function(a){return this.node.__shady_getRootNode(a)};n.contains=function(a){return this.node.__shady_contains(a)};n.dispatchEvent=function(a){return this.node.__shady_dispatchEvent(a)};n.setAttribute=function(a,b){this.node.__shady_setAttribute(a,b)};n.getAttribute=function(a){return this.node.__shady_native_getAttribute(a)};n.hasAttribute=function(a){return this.node.__shady_native_hasAttribute(a)};n.removeAttribute=function(a){this.node.__shady_removeAttribute(a)}; n.attachShadow=function(a){return this.node.__shady_attachShadow(a)};n.focus=function(){this.node.__shady_native_focus()};n.blur=function(){this.node.__shady_blur()};n.importNode=function(a,b){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_importNode(a,b)};n.getElementById=function(a){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_getElementById(a)};n.querySelector=function(a){return this.node.__shady_querySelector(a)}; n.querySelectorAll=function(a,b){return this.node.__shady_querySelectorAll(a,b)};n.assignedNodes=function(a){if("slot"===this.node.localName)return this.node.__shady_assignedNodes(a)}; p.Object.defineProperties(cd.prototype,{activeElement:{configurable:!0,enumerable:!0,get:function(){if(z(this.node)||this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_activeElement}},_activeElement:{configurable:!0,enumerable:!0,get:function(){return this.activeElement}},host:{configurable:!0,enumerable:!0,get:function(){if(z(this.node))return this.node.host}},parentNode:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_parentNode}},firstChild:{configurable:!0, enumerable:!0,get:function(){return this.node.__shady_firstChild}},lastChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastChild}},nextSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextSibling}},previousSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousSibling}},childNodes:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childNodes}},parentElement:{configurable:!0,enumerable:!0, get:function(){return this.node.__shady_parentElement}},firstElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_firstElementChild}},lastElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastElementChild}},nextElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextElementSibling}},previousElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousElementSibling}}, children:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_children}},childElementCount:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childElementCount}},shadowRoot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_shadowRoot}},assignedSlot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_assignedSlot}},isConnected:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_isConnected}},innerHTML:{configurable:!0, enumerable:!0,get:function(){return this.node.__shady_innerHTML},set:function(a){this.node.__shady_innerHTML=a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}}}); cc.forEach(function(a){Object.defineProperty(cd.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})});var dd=new WeakMap;function ed(a){if(z(a)||a instanceof cd)return a;var b=dd.get(a);b||(b=new cd(a),dd.set(a,b));return b};var fd=B({dispatchEvent:function(a){Za();return this.__shady_native_dispatchEvent(a)},addEventListener:Ub,removeEventListener:Wb});var gd=B({get assignedSlot(){var a=this.__shady_parentNode;(a=a&&a.__shady_shadowRoot)&&Tc(a);return(a=v(this))&&a.assignedSlot||null}});var hd=window.document;function id(a,b){if("slot"===b)a=a.__shady_parentNode,La(a)&&Ac(v(a).root);else if("slot"===a.localName&&"name"===b&&(b=xc(a))){if(b.a){Uc(b);var c=a.wa,d=Yc(a);if(d!==c){c=b.b[c];var e=c.indexOf(a);0<=e&&c.splice(e,1);c=b.b[d]||(b.b[d]=[]);c.push(a);1<c.length&&(b.b[d]=Zc(c))}}Ac(b)}} var jd=B({get previousElementSibling(){var a=v(this);if(a&&void 0!==a.previousSibling){for(a=this.__shady_previousSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_previousElementSibling},get nextElementSibling(){var a=v(this);if(a&&void 0!==a.nextSibling){for(a=this.__shady_nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_nextElementSibling},get slot(){return this.getAttribute("slot")}, set slot(a){this.__shady_setAttribute("slot",a)},get shadowRoot(){var a=v(this);return a&&a.pa||null},get className(){return this.getAttribute("class")||""},set className(a){this.__shady_setAttribute("class",a)},setAttribute:function(a,b){if(this.ownerDocument!==hd)this.__shady_native_setAttribute(a,b);else{var c;(c=G())&&"class"===a?(c.setElementClass(this,b),c=!0):c=!1;c||(this.__shady_native_setAttribute(a,b),id(this,a))}},removeAttribute:function(a){this.__shady_native_removeAttribute(a);id(this, a)},attachShadow:function(a){if(!this)throw Error("Must provide a host.");if(!a)throw Error("Not enough arguments.");return new Sc(Oc,this,a)}});var kd=B({blur:function(){var a=v(this);(a=(a=a&&a.root)&&a.activeElement)?a.__shady_blur():this.__shady_native_blur()}});cc.forEach(function(a){kd[a]={set:function(b){var c=u(this),d=a.substring(2);c.O[a]&&this.removeEventListener(d,c.O[a]);this.__shady_addEventListener(d,b);c.O[a]=b},get:function(){var b=v(this);return b&&b.O[a]},configurable:!0}});var ld=B({assignedNodes:function(a){if("slot"===this.localName){var b=this.__shady_getRootNode();b&&z(b)&&Tc(b);return(b=v(this))?(a&&a.flatten?b.D:b.assignedNodes)||[]:[]}}});var md=window.document,nd=B({importNode:function(a,b){if(a.ownerDocument!==md||"template"===a.localName)return this.__shady_native_importNode(a,b);var c=this.__shady_native_importNode(a,!1);if(b){a=a.__shady_childNodes;b=0;for(var d;b<a.length;b++)d=this.__shady_importNode(a[b],!0),c.__shady_appendChild(d)}return c}});var od=B({addEventListener:Ub.bind(window),removeEventListener:Wb.bind(window)});var pd={};Object.getOwnPropertyDescriptor(HTMLElement.prototype,"parentElement")&&(pd.parentElement=Cc.parentElement);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"contains")&&(pd.contains=Cc.contains);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")&&(pd.children=Fc.children);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&(pd.innerHTML=Lc.innerHTML);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"className")&&(pd.className=jd.className); var qd={EventTarget:[fd],Node:[Cc,window.EventTarget?null:fd],Text:[gd],Element:[jd,Fc,gd,!w.m||"innerHTML"in Element.prototype?Lc:null,window.HTMLSlotElement?null:ld],HTMLElement:[kd,pd],HTMLSlotElement:[ld],DocumentFragment:[Hc,Ic],Document:[nd,Hc,Ic,Jc],Window:[od]},rd=w.m?null:["innerHTML","textContent"];function sd(a){var b=a?null:rd,c={},d;for(d in qd)c.W=window[d]&&window[d].prototype,qd[d].forEach(function(c){return function(d){return c.W&&d&&A(c.W,d,a,b)}}(c)),c={W:c.W}};if(w.ea){var ShadyDOM={inUse:w.ea,patch:function(a){Fb(a);Eb(a);return a},isShadyRoot:z,enqueue:Ya,flush:Za,flushInitial:function(a){!a.ba&&a.B&&Tc(a)},settings:w,filterMutations:db,observeChildren:bb,unobserveChildren:cb,deferConnectionCallbacks:w.deferConnectionCallbacks,preferPerformance:w.preferPerformance,handlesDynamicScoping:!0,wrap:w.J?ed:function(a){return a},Wrapper:cd,composedPath:Mb,noPatch:w.J,nativeMethods:qb,nativeTree:rb};window.ShadyDOM=ShadyDOM;yb();sd("__shady_");Object.defineProperty(document, "_activeElement",Jc.activeElement);A(Window.prototype,od,"__shady_");w.J||(sd(),bc());Xb();window.Event=Zb;window.CustomEvent=$b;window.MouseEvent=ac;window.ShadowRoot=Sc};var td=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function ud(a){var b=td.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return!b&&a}function H(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return!(!a||!(a.__CE_isImportDocument||a instanceof Document))} function vd(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null} function wd(a,b,c){c=void 0===c?new Set:c;for(var d=a;d;){if(d.nodeType===Node.ELEMENT_NODE){var e=d;b(e);var f=e.localName;if("link"===f&&"import"===e.getAttribute("rel")){d=e.import;if(d instanceof Node&&!c.has(d))for(c.add(d),d=d.firstChild;d;d=d.nextSibling)wd(d,b,c);d=vd(a,e);continue}else if("template"===f){d=vd(a,e);continue}if(e=e.__CE_shadowRoot)for(e=e.firstChild;e;e=e.nextSibling)wd(e,b,c)}d=d.firstChild?d.firstChild:vd(a,d)}}function I(a,b,c){a[b]=c};function xd(){this.a=new Map;this.g=new Map;this.f=[];this.c=!1}function yd(a,b,c){a.a.set(b,c);a.g.set(c.constructorFunction,c)}function zd(a,b){a.c=!0;a.f.push(b)}function Ad(a,b){a.c&&wd(b,function(b){return a.b(b)})}xd.prototype.b=function(a){if(this.c&&!a.__CE_patched){a.__CE_patched=!0;for(var b=0;b<this.f.length;b++)this.f[b](a)}};function J(a,b){var c=[];wd(b,function(a){return c.push(a)});for(b=0;b<c.length;b++){var d=c[b];1===d.__CE_state?a.connectedCallback(d):Bd(a,d)}} function K(a,b){var c=[];wd(b,function(a){return c.push(a)});for(b=0;b<c.length;b++){var d=c[b];1===d.__CE_state&&a.disconnectedCallback(d)}} function L(a,b,c){c=void 0===c?{}:c;var d=c.Xa||new Set,e=c.Y||function(b){return Bd(a,b)},f=[];wd(b,function(b){if("link"===b.localName&&"import"===b.getAttribute("rel")){var c=b.import;c instanceof Node&&(c.__CE_isImportDocument=!0,c.__CE_hasRegistry=!0);c&&"complete"===c.readyState?c.__CE_documentLoadHandled=!0:b.addEventListener("load",function(){var c=b.import;if(!c.__CE_documentLoadHandled){c.__CE_documentLoadHandled=!0;var f=new Set(d);f.delete(c);L(a,c,{Xa:f,Y:e})}})}else f.push(b)},d);if(a.c)for(b= 0;b<f.length;b++)a.b(f[b]);for(b=0;b<f.length;b++)e(f[b])} function Bd(a,b){if(void 0===b.__CE_state){var c=b.ownerDocument;if(c.defaultView||c.__CE_isImportDocument&&c.__CE_hasRegistry)if(c=a.a.get(b.localName)){c.constructionStack.push(b);var d=c.constructorFunction;try{try{if(new d!==b)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{c.constructionStack.pop()}}catch(g){throw b.__CE_state=2,g;}b.__CE_state=1;b.__CE_definition=c;if(c.attributeChangedCallback)for(c=c.observedAttributes,d=0;d<c.length;d++){var e= c[d],f=b.getAttribute(e);null!==f&&a.attributeChangedCallback(b,e,null,f,null)}H(b)&&a.connectedCallback(b)}}}xd.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a)};xd.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a)}; xd.prototype.attributeChangedCallback=function(a,b,c,d,e){var f=a.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(b)&&f.attributeChangedCallback.call(a,b,c,d,e)};function Cd(a){var b=document;this.b=a;this.a=b;this.F=void 0;L(this.b,this.a);"loading"===this.a.readyState&&(this.F=new MutationObserver(this.c.bind(this)),this.F.observe(this.a,{childList:!0,subtree:!0}))}function Dd(a){a.F&&a.F.disconnect()}Cd.prototype.c=function(a){var b=this.a.readyState;"interactive"!==b&&"complete"!==b||Dd(this);for(b=0;b<a.length;b++)for(var c=a[b].addedNodes,d=0;d<c.length;d++)L(this.b,c[d])};function Ed(){var a=this;this.a=this.h=void 0;this.b=new Promise(function(b){a.a=b;a.h&&b(a.h)})}Ed.prototype.resolve=function(a){if(this.h)throw Error("Already resolved.");this.h=a;this.a&&this.a(a)};function N(a){this.c=!1;this.a=a;this.l=new Map;this.f=function(a){return a()};this.b=!1;this.g=[];this.da=new Cd(a)}n=N.prototype; n.sa=function(a,b){var c=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!ud(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this.a.a.get(a))throw Error("A custom element with name '"+a+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var d=function(a){var b=e[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function."); return b},e=b.prototype;if(!(e instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var f=d("connectedCallback");var g=d("disconnectedCallback");var h=d("adoptedCallback");var k=d("attributeChangedCallback");var l=b.observedAttributes||[]}catch(m){return}finally{this.c=!1}b={localName:a,constructorFunction:b,connectedCallback:f,disconnectedCallback:g,adoptedCallback:h,attributeChangedCallback:k,observedAttributes:l,constructionStack:[]};yd(this.a, a,b);this.g.push(b);this.b||(this.b=!0,this.f(function(){return Fd(c)}))};n.Y=function(a){L(this.a,a)}; function Fd(a){if(!1!==a.b){a.b=!1;for(var b=a.g,c=[],d=new Map,e=0;e<b.length;e++)d.set(b[e].localName,[]);L(a.a,document,{Y:function(b){if(void 0===b.__CE_state){var e=b.localName,f=d.get(e);f?f.push(b):a.a.a.get(e)&&c.push(b)}}});for(e=0;e<c.length;e++)Bd(a.a,c[e]);for(;0<b.length;){var f=b.shift();e=f.localName;f=d.get(f.localName);for(var g=0;g<f.length;g++)Bd(a.a,f[g]);(e=a.l.get(e))&&e.resolve(void 0)}}}n.get=function(a){if(a=this.a.a.get(a))return a.constructorFunction}; n.ta=function(a){if(!ud(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this.l.get(a);if(b)return b.b;b=new Ed;this.l.set(a,b);this.a.a.get(a)&&!this.g.some(function(b){return b.localName===a})&&b.resolve(void 0);return b.b};n.Pa=function(a){Dd(this.da);var b=this.f;this.f=function(c){return a(function(){return b(c)})}};window.CustomElementRegistry=N;N.prototype.define=N.prototype.sa;N.prototype.upgrade=N.prototype.Y;N.prototype.get=N.prototype.get; N.prototype.whenDefined=N.prototype.ta;N.prototype.polyfillWrapFlushCallback=N.prototype.Pa;var Gd=window.Document.prototype.createElement,Hd=window.Document.prototype.createElementNS,Id=window.Document.prototype.importNode,Jd=window.Document.prototype.prepend,Kd=window.Document.prototype.append,Ld=window.DocumentFragment.prototype.prepend,Md=window.DocumentFragment.prototype.append,Nd=window.Node.prototype.cloneNode,Od=window.Node.prototype.appendChild,Pd=window.Node.prototype.insertBefore,Qd=window.Node.prototype.removeChild,Rd=window.Node.prototype.replaceChild,Sd=Object.getOwnPropertyDescriptor(window.Node.prototype, "textContent"),Td=window.Element.prototype.attachShadow,Ud=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),Vd=window.Element.prototype.getAttribute,Wd=window.Element.prototype.setAttribute,Xd=window.Element.prototype.removeAttribute,Yd=window.Element.prototype.getAttributeNS,Zd=window.Element.prototype.setAttributeNS,$d=window.Element.prototype.removeAttributeNS,ae=window.Element.prototype.insertAdjacentElement,be=window.Element.prototype.insertAdjacentHTML,ce=window.Element.prototype.prepend, de=window.Element.prototype.append,ee=window.Element.prototype.before,fe=window.Element.prototype.after,ge=window.Element.prototype.replaceWith,he=window.Element.prototype.remove,ie=window.HTMLElement,je=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ke=window.HTMLElement.prototype.insertAdjacentElement,le=window.HTMLElement.prototype.insertAdjacentHTML;var me=new function(){};function ne(){var a=oe;window.HTMLElement=function(){function b(){var b=this.constructor,d=a.g.get(b);if(!d)throw Error("The custom element being constructed was not registered with `customElements`.");var e=d.constructionStack;if(0===e.length)return e=Gd.call(document,d.localName),Object.setPrototypeOf(e,b.prototype),e.__CE_state=1,e.__CE_definition=d,a.b(e),e;d=e.length-1;var f=e[d];if(f===me)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times."); e[d]=me;Object.setPrototypeOf(f,b.prototype);a.b(f);return f}b.prototype=ie.prototype;Object.defineProperty(b.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:b});return b}()};function pe(a,b,c){function d(b){return function(c){for(var d=[],e=0;e<arguments.length;++e)d[e]=arguments[e];e=[];for(var f=[],l=0;l<d.length;l++){var m=d[l];m instanceof Element&&H(m)&&f.push(m);if(m instanceof DocumentFragment)for(m=m.firstChild;m;m=m.nextSibling)e.push(m);else e.push(m)}b.apply(this,d);for(d=0;d<f.length;d++)K(a,f[d]);if(H(this))for(d=0;d<e.length;d++)f=e[d],f instanceof Element&&J(a,f)}}void 0!==c.V&&(b.prepend=d(c.V));void 0!==c.append&&(b.append=d(c.append))};function qe(){var a=oe;I(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var c=a.a.get(b);if(c)return new c.constructorFunction}b=Gd.call(this,b);a.b(b);return b});I(Document.prototype,"importNode",function(b,c){b=Id.call(this,b,!!c);this.__CE_hasRegistry?L(a,b):Ad(a,b);return b});I(Document.prototype,"createElementNS",function(b,c){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var d=a.a.get(c);if(d)return new d.constructorFunction}b=Hd.call(this, b,c);a.b(b);return b});pe(a,Document.prototype,{V:Jd,append:Kd})};function re(){function a(a,d){Object.defineProperty(a,"textContent",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(a){if(this.nodeType===Node.TEXT_NODE)d.set.call(this,a);else{var c=void 0;if(this.firstChild){var e=this.childNodes,h=e.length;if(0<h&&H(this)){c=Array(h);for(var k=0;k<h;k++)c[k]=e[k]}}d.set.call(this,a);if(c)for(a=0;a<c.length;a++)K(b,c[a])}}})}var b=oe;I(Node.prototype,"insertBefore",function(a,d){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes); a=Pd.call(this,a,d);if(H(this))for(d=0;d<c.length;d++)J(b,c[d]);return a}c=H(a);d=Pd.call(this,a,d);c&&K(b,a);H(this)&&J(b,a);return d});I(Node.prototype,"appendChild",function(a){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=Od.call(this,a);if(H(this))for(var e=0;e<c.length;e++)J(b,c[e]);return a}c=H(a);e=Od.call(this,a);c&&K(b,a);H(this)&&J(b,a);return e});I(Node.prototype,"cloneNode",function(a){a=Nd.call(this,!!a);this.ownerDocument.__CE_hasRegistry?L(b,a): Ad(b,a);return a});I(Node.prototype,"removeChild",function(a){var c=H(a),e=Qd.call(this,a);c&&K(b,a);return e});I(Node.prototype,"replaceChild",function(a,d){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=Rd.call(this,a,d);if(H(this))for(K(b,d),d=0;d<c.length;d++)J(b,c[d]);return a}c=H(a);var f=Rd.call(this,a,d),g=H(this);g&&K(b,d);c&&K(b,a);g&&J(b,a);return f});Sd&&Sd.get?a(Node.prototype,Sd):zd(b,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){for(var a= [],b=0;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)Qd.call(this,this.firstChild);Od.call(this,document.createTextNode(a))}})})};function se(a){function b(b){return function(c){for(var d=[],e=0;e<arguments.length;++e)d[e]=arguments[e];e=[];for(var h=[],k=0;k<d.length;k++){var l=d[k];l instanceof Element&&H(l)&&h.push(l);if(l instanceof DocumentFragment)for(l=l.firstChild;l;l=l.nextSibling)e.push(l);else e.push(l)}b.apply(this,d);for(d=0;d<h.length;d++)K(a,h[d]);if(H(this))for(d=0;d<e.length;d++)h=e[d],h instanceof Element&&J(a,h)}}var c=Element.prototype;void 0!==ee&&(c.before=b(ee));void 0!==ee&&(c.after=b(fe));void 0!==ge&& I(c,"replaceWith",function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];d=[];for(var g=[],h=0;h<c.length;h++){var k=c[h];k instanceof Element&&H(k)&&g.push(k);if(k instanceof DocumentFragment)for(k=k.firstChild;k;k=k.nextSibling)d.push(k);else d.push(k)}h=H(this);ge.apply(this,c);for(c=0;c<g.length;c++)K(a,g[c]);if(h)for(K(a,this),c=0;c<d.length;c++)g=d[c],g instanceof Element&&J(a,g)});void 0!==he&&I(c,"remove",function(){var b=H(this);he.call(this);b&&K(a,this)})};function te(){function a(a,b){Object.defineProperty(a,"innerHTML",{enumerable:b.enumerable,configurable:!0,get:b.get,set:function(a){var c=this,e=void 0;H(this)&&(e=[],wd(this,function(a){a!==c&&e.push(a)}));b.set.call(this,a);if(e)for(var f=0;f<e.length;f++){var g=e[f];1===g.__CE_state&&d.disconnectedCallback(g)}this.ownerDocument.__CE_hasRegistry?L(d,this):Ad(d,this);return a}})}function b(a,b){I(a,"insertAdjacentElement",function(a,c){var e=H(c);a=b.call(this,a,c);e&&K(d,c);H(a)&&J(d,c);return a})} function c(a,b){function c(a,b){for(var c=[];a!==b;a=a.nextSibling)c.push(a);for(b=0;b<c.length;b++)L(d,c[b])}I(a,"insertAdjacentHTML",function(a,d){a=a.toLowerCase();if("beforebegin"===a){var e=this.previousSibling;b.call(this,a,d);c(e||this.parentNode.firstChild,this)}else if("afterbegin"===a)e=this.firstChild,b.call(this,a,d),c(this.firstChild,e);else if("beforeend"===a)e=this.lastChild,b.call(this,a,d),c(e||this.firstChild,null);else if("afterend"===a)e=this.nextSibling,b.call(this,a,d),c(this.nextSibling, e);else throw new SyntaxError("The value provided ("+String(a)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");})}var d=oe;Td&&I(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=Td.call(this,a)});Ud&&Ud.get?a(Element.prototype,Ud):je&&je.get?a(HTMLElement.prototype,je):zd(d,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){return Nd.call(this,!0).innerHTML},set:function(a){var b="template"===this.localName,c=b?this.content:this,d=Hd.call(document, this.namespaceURI,this.localName);for(d.innerHTML=a;0<c.childNodes.length;)Qd.call(c,c.childNodes[0]);for(a=b?d.content:d;0<a.childNodes.length;)Od.call(c,a.childNodes[0])}})});I(Element.prototype,"setAttribute",function(a,b){if(1!==this.__CE_state)return Wd.call(this,a,b);var c=Vd.call(this,a);Wd.call(this,a,b);b=Vd.call(this,a);d.attributeChangedCallback(this,a,c,b,null)});I(Element.prototype,"setAttributeNS",function(a,b,c){if(1!==this.__CE_state)return Zd.call(this,a,b,c);var e=Yd.call(this,a, b);Zd.call(this,a,b,c);c=Yd.call(this,a,b);d.attributeChangedCallback(this,b,e,c,a)});I(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return Xd.call(this,a);var b=Vd.call(this,a);Xd.call(this,a);null!==b&&d.attributeChangedCallback(this,a,b,null,null)});I(Element.prototype,"removeAttributeNS",function(a,b){if(1!==this.__CE_state)return $d.call(this,a,b);var c=Yd.call(this,a,b);$d.call(this,a,b);var e=Yd.call(this,a,b);c!==e&&d.attributeChangedCallback(this,b,c,e,a)});ke?b(HTMLElement.prototype, ke):ae?b(Element.prototype,ae):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");le?c(HTMLElement.prototype,le):be?c(Element.prototype,be):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched.");pe(d,Element.prototype,{V:ce,append:de});se(d)};var ue=window.customElements;if(!ue||ue.forcePolyfill||"function"!=typeof ue.define||"function"!=typeof ue.get){var oe=new xd;ne();qe();pe(oe,DocumentFragment.prototype,{V:Ld,append:Md});re();te();document.__CE_hasRegistry=!0;var customElements=new N(oe);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements})};function ve(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""} function we(a){a=a.replace(xe,"").replace(ye,"");var b=ze,c=a,d=new ve;d.start=0;d.end=c.length;for(var e=d,f=0,g=c.length;f<g;f++)if("{"===c[f]){e.rules||(e.rules=[]);var h=e,k=h.rules[h.rules.length-1]||null;e=new ve;e.start=f+1;e.parent=h;e.previous=k;h.rules.push(e)}else"}"===c[f]&&(e.end=f+1,e=e.parent||d);return b(d,a)} function ze(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=Ae(c),c=c.replace(Be," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=Ce:c.match(De)&&(a.type=Ee,a.keyframesName=a.selector.split(Be).pop()):a.type=0===c.indexOf("--")?Fe:Ge);if(c=a.rules)for(var d=0,e=c.length,f=void 0;d<e&&(f=c[d]);d++)ze(f, b);return a}function Ae(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})} function He(a,b,c){c=void 0===c?"":c;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=e.length,h=void 0;f<g&&(h=e[f]);f++)d=He(h,b,d)}else b?b=a.cssText:(b=a.cssText,b=b.replace(Ie,"").replace(Je,""),b=b.replace(Ke,"").replace(Le,"")),(d=b.trim())&&(d=" "+d+"\n")}d&&(a.selector&&(c+=a.selector+" {\n"),c+=d,a.selector&&(c+="}\n\n"));return c} var Ge=1,Ee=7,Ce=4,Fe=1E3,xe=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ye=/@import[^;]*;/gim,Ie=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,Je=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,Ke=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,Le=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,De=/^@[^\s]*keyframes/,Be=/\s+/g;var O=!(window.ShadyDOM&&window.ShadyDOM.inUse),Me;function Ne(a){Me=a&&a.shimcssproperties?!1:O||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var Oe;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(Oe=window.ShadyCSS.cssBuild);var Pe=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime); window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?Me=window.ShadyCSS.nativeCss:window.ShadyCSS?(Ne(window.ShadyCSS),window.ShadyCSS=void 0):Ne(window.WebComponents&&window.WebComponents.flags);var Q=Me,Qe=Oe;var Re=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,Se=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,Te=/(--[\w-]+)\s*([:,;)]|$)/gi,Ue=/(animation\s*:)|(animation-name\s*:)/,$e=/@media\s(.*)/,af=/\{[^}]*\}/g;var bf=new Set;function cf(a,b){if(!a)return"";"string"===typeof a&&(a=we(a));b&&df(a,b);return He(a,Q)}function ef(a){!a.__cssRules&&a.textContent&&(a.__cssRules=we(a.textContent));return a.__cssRules||null}function ff(a){return!!a.parent&&a.parent.type===Ee}function df(a,b,c,d){if(a){var e=!1,f=a.type;if(d&&f===Ce){var g=a.selector.match($e);g&&(window.matchMedia(g[1]).matches||(e=!0))}f===Ge?b(a):c&&f===Ee?c(a):f===Fe&&(e=!0);if((a=a.rules)&&!e)for(e=0,f=a.length,g=void 0;e<f&&(g=a[e]);e++)df(g,b,c,d)}} function gf(a,b,c,d){var e=document.createElement("style");b&&e.setAttribute("scope",b);e.textContent=a;hf(e,c,d);return e}var jf=null;function kf(a){a=document.createComment(" Shady DOM styles for "+a+" ");var b=document.head;b.insertBefore(a,(jf?jf.nextSibling:null)||b.firstChild);return jf=a}function hf(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);jf?a.compareDocumentPosition(jf)===Node.DOCUMENT_POSITION_PRECEDING&&(jf=a):jf=a} function lf(a,b){for(var c=0,d=a.length;b<d;b++)if("("===a[b])c++;else if(")"===a[b]&&0===--c)return b;return-1}function mf(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");var d=lf(a,c+3),e=a.substring(c+4,d);c=a.substring(0,c);a=mf(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)}function nf(a,b){O?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)} var of=window.ShadyDOM&&window.ShadyDOM.wrap||function(a){return a};function pf(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,M:c}}function qf(a){for(var b=[],c="",d=0;0<=d&&d<a.length;d++)if("("===a[d]){var e=lf(a,d);c+=a.slice(d,e+1);d=e}else","===a[d]?(b.push(c),c=""):c+=a[d];c&&b.push(c);return b} function rf(a){if(void 0!==Qe)return Qe;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""} function sf(a){a=void 0===a?"":a;return""!==a&&Q?O?"shadow"===a:"shady"===a:!1};function tf(){}function uf(a,b){vf(R,a,function(a){wf(a,b||"")})}function vf(a,b,c){b.nodeType===Node.ELEMENT_NODE&&c(b);var d;"template"===b.localName?d=(b.content||b._content||b).childNodes:d=b.children||b.childNodes;if(d)for(b=0;b<d.length;b++)vf(a,d[b],c)} function wf(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var d=a.getAttribute("class");c?d&&(b=d.replace("style-scope","").replace(b,""),nf(a,b)):nf(a,(d?d+" ":"")+"style-scope "+b)}}function xf(a,b,c){vf(R,a,function(a){wf(a,b,!0);wf(a,c)})}function yf(a,b){vf(R,a,function(a){wf(a,b||"",!0)})} function zf(a,b,c,d,e){var f=R;e=void 0===e?"":e;""===e&&(O||"shady"===(void 0===d?"":d)?e=cf(b,c):(a=pf(a),e=Af(f,b,a.is,a.M,c)+"\n\n"));return e.trim()}function Af(a,b,c,d,e){var f=Bf(c,d);c=c?"."+c:"";return cf(b,function(b){b.c||(b.selector=b.j=Cf(a,b,a.b,c,f),b.c=!0);e&&e(b,c,f)})}function Bf(a,b){return b?"[is="+a+"]":a} function Cf(a,b,c,d,e){var f=qf(b.selector);if(!ff(b)){b=0;for(var g=f.length,h=void 0;b<g&&(h=f[b]);b++)f[b]=c.call(a,h,d,e)}return f.filter(function(a){return!!a}).join(",")}function Df(a){return a.replace(Ef,function(a,c,d){-1<d.indexOf("+")?d=d.replace(/\+/g,"___"):-1<d.indexOf("___")&&(d=d.replace(/___/g,"+"));return":"+c+"("+d+")"})} function Ff(a){for(var b=[],c;c=a.match(Gf);){var d=c.index,e=lf(a,d);if(-1===e)throw Error(c.input+" selector missing ')'");c=a.slice(d,e+1);a=a.replace(c,"\ue000");b.push(c)}return{ha:a,matches:b}}function Hf(a,b){var c=a.split("\ue000");return b.reduce(function(a,b,f){return a+b+c[f+1]},c[0])} tf.prototype.b=function(a,b,c){var d=!1;a=a.trim();var e=Ef.test(a);e&&(a=a.replace(Ef,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=Df(a));var f=Gf.test(a);if(f){var g=Ff(a);a=g.ha;g=g.matches}a=a.replace(If,":host $1");a=a.replace(Jf,function(a,e,f){d||(a=Kf(f,e,b,c),d=d||a.stop,e=a.Ca,f=a.value);return e+f});f&&(a=Hf(a,g));e&&(a=Df(a));return a}; function Kf(a,b,c,d){var e=a.indexOf("::slotted");0<=a.indexOf(":host")?a=Lf(a,d):0!==e&&(a=c?Mf(a,c):a);c=!1;0<=e&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Nf,function(a,b){return" > "+b}))}a=a.replace(Of,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,Ca:b,stop:f}} function Mf(a,b){a=a.split(/(\[.+?\])/);for(var c=[],d=0;d<a.length;d++)if(1===d%2)c.push(a[d]);else{var e=a[d];if(""!==e||d!==a.length-1)e=e.split(":"),e[0]+=b,c.push(e.join(":"))}return c.join("")}function Lf(a,b){var c=a.match(Pf);return(c=c&&c[2].trim()||"")?c[0].match(Qf)?a.replace(Pf,function(a,c,f){return b+f}):c.split(Qf)[0]===b?c:"should_not_match":a.replace(":host",b)}function Rf(a){":root"===a.selector&&(a.selector="html")} tf.prototype.c=function(a){return a.match(":host")?"":a.match("::slotted")?this.b(a,":not(.style-scope)"):Mf(a.trim(),":not(.style-scope)")};p.Object.defineProperties(tf.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}}); var Ef=/:(nth[-\w]+)\(([^)]+)\)/,Jf=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Qf=/[[.:#*]/,If=/^(::slotted)/,Pf=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Nf=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Of=/(.*):dir\((?:(ltr|rtl))\)/,Gf=/:(?:matches|any|-(?:webkit|moz)-any)/,R=new tf;function Sf(a,b,c,d,e){this.A=a||null;this.b=b||null;this.fa=c||[];this.o=null;this.cssBuild=e||"";this.M=d||"";this.a=this.s=this.w=null}function T(a){return a?a.__styleInfo:null}function Tf(a,b){return a.__styleInfo=b}Sf.prototype.c=function(){return this.A};Sf.prototype._getStyleRules=Sf.prototype.c;function Uf(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var Vf=navigator.userAgent.match("Trident");function Wf(){}function Xf(a){var b={},c=[],d=0;df(a,function(a){Yf(a);a.index=d++;a=a.i.cssText;for(var c;c=Te.exec(a);){var e=c[1];":"!==c[2]&&(b[e]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var e in b)a.push(e);return a} function Yf(a){if(!a.i){var b={},c={};Zf(a,c)&&(b.v=c,a.rules=null);b.cssText=a.parsedCssText.replace(af,"").replace(Re,"");a.i=b}}function Zf(a,b){var c=a.i;if(c){if(c.v)return Object.assign(b,c.v),!0}else{c=a.parsedCssText;for(var d;a=Re.exec(c);){d=(a[2]||a[3]).trim();if("inherit"!==d||"unset"!==d)b[a[1].trim()]=d;d=!0}return d}} function $f(a,b,c){b&&(b=0<=b.indexOf(";")?ag(a,b,c):mf(b,function(b,e,f,g){if(!e)return b+g;(e=$f(a,c[e],c))&&"initial"!==e?"apply-shim-inherit"===e&&(e="inherit"):e=$f(a,c[f]||f,c)||f;return b+(e||"")+g}));return b&&b.trim()||""} function ag(a,b,c){b=b.split(";");for(var d=0,e,f;d<b.length;d++)if(e=b[d]){Se.lastIndex=0;if(f=Se.exec(e))e=$f(a,c[f[1]],c);else if(f=e.indexOf(":"),-1!==f){var g=e.substring(f);g=g.trim();g=$f(a,g,c)||g;e=e.substring(0,f)+g}b[d]=e&&e.lastIndexOf(";")===e.length-1?e.slice(0,-1):e||""}return b.join(";")} function bg(a,b){var c={},d=[];df(a,function(a){a.i||Yf(a);var e=a.j||a.parsedSelector;b&&a.i.v&&e&&Uf.call(b,e)&&(Zf(a,c),a=a.index,e=parseInt(a/32,10),d[e]=(d[e]||0)|1<<a%32)},null,!0);return{v:c,key:d}} function cg(a,b,c,d){b.i||Yf(b);if(b.i.v){var e=pf(a);a=e.is;e=e.M;e=a?Bf(a,e):"html";var f=b.parsedSelector,g=":host > *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===c&&(g=f===e+" > *."+e||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(e));if(g||h)c=e,h&&(b.j||(b.j=Cf(R,b,R.b,a?"."+a:"",e)),c=b.j||e),d({ha:c,Ia:h,Za:g})}}function dg(a,b,c){var d={},e={};df(b,function(b){cg(a,b,c,function(c){Uf.call(a._element||a,c.ha)&&(c.Ia?Zf(b,d):Zf(b,e))})},null,!0);return{Ra:e,Ha:d}} function eg(a,b,c,d){var e=pf(b),f=Bf(e.is,e.M),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])"),h=T(b);e=h.A;h=h.cssBuild;var k=fg(e,d);return zf(b,e,function(b){var e="";b.i||Yf(b);b.i.cssText&&(e=ag(a,b.i.cssText,c));b.cssText=e;if(!O&&!ff(b)&&b.cssText){var h=e=b.cssText;null==b.na&&(b.na=Ue.test(e));if(b.na)if(null==b.U){b.U=[];for(var l in k)h=k[l],h=h(e),e!==h&&(e=h,b.U.push(l))}else{for(l=0;l<b.U.length;++l)h=k[b.U[l]],e=h(e);h=e}b.cssText=h;b.j=b.j|| b.selector;e="."+d;l=qf(b.j);h=0;for(var M=l.length,U=void 0;h<M&&(U=l[h]);h++)l[h]=U.match(g)?U.replace(f,e):e+" "+U;b.selector=l.join(",")}},h)}function fg(a,b){a=a.b;var c={};if(!O&&a)for(var d=0,e=a[d];d<a.length;e=a[++d]){var f=e,g=b;f.f=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+g;f.j=f.j||f.selector;f.selector=f.j.replace(f.keyframesName,f.a);c[e.keyframesName]=gg(e)}return c}function gg(a){return function(b){return b.replace(a.f,a.a)}} function hg(a,b){var c=ig,d=ef(a);a.textContent=cf(d,function(a){var d=a.cssText=a.parsedCssText;a.i&&a.i.cssText&&(d=d.replace(Ie,"").replace(Je,""),a.cssText=ag(c,d,b))})}p.Object.defineProperties(Wf.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var ig=new Wf;var jg={},kg=window.customElements;if(kg&&!O&&!Pe){var lg=kg.define;kg.define=function(a,b,c){jg[a]||(jg[a]=kf(a));lg.call(kg,a,b,c)}};function mg(){this.cache={}}mg.prototype.store=function(a,b,c,d){var e=this.cache[a]||[];e.push({v:b,styleElement:c,s:d});100<e.length&&e.shift();this.cache[a]=e};function ng(){}var og=new RegExp(R.a+"\\s*([^\\s]*)");function pg(a){return(a=(a.classList&&a.classList.value?a.classList.value:a.getAttribute("class")||"").match(og))?a[1]:""}function qg(a){var b=of(a).getRootNode();return b===a||b===a.ownerDocument?"":(a=b.host)?pf(a).is:""} function rg(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var d=0;d<c.addedNodes.length;d++){var e=c.addedNodes[d];if(e.nodeType===Node.ELEMENT_NODE){var f=e.getRootNode(),g=pg(e);if(g&&f===e.ownerDocument&&("style"!==e.localName&&"template"!==e.localName||""===rf(e)))yf(e,g);else if(f instanceof ShadowRoot)for(f=qg(e),f!==g&&xf(e,g,f),e=window.ShadyDOM.nativeMethods.querySelectorAll.call(e,":not(."+R.a+")"),g=0;g<e.length;g++){f=e[g]; var h=qg(f);h&&wf(f,h)}}}}} if(!(O||window.ShadyDOM&&window.ShadyDOM.handlesDynamicScoping)){var sg=new MutationObserver(rg),tg=function(a){sg.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)tg(document);else{var ug=function(){tg(document.body)};window.HTMLImports?window.HTMLImports.whenReady(ug):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){ug();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange", a)}else ug()})}ng=function(){rg(sg.takeRecords())}}var vg=ng;var wg={};var xg=Promise.resolve();function yg(a){if(a=wg[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function zg(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function Ag(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,xg.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var Bg={},Cg=new mg;function Y(){this.l={};this.c=document.documentElement;var a=new ve;a.rules=[];this.f=Tf(this.c,new Sf(a));this.g=!1;this.b=this.a=null}n=Y.prototype;n.flush=function(){vg()};n.Fa=function(a){return ef(a)};n.Va=function(a){return cf(a)};n.prepareTemplate=function(a,b,c){this.prepareTemplateDom(a,b);this.prepareTemplateStyles(a,b,c)}; n.prepareTemplateStyles=function(a,b,c){if(!a._prepared&&!Pe){O||jg[b]||(jg[b]=kf(b));a._prepared=!0;a.name=b;a.extends=c;wg[b]=a;var d=rf(a),e=sf(d);c={is:b,extends:c};for(var f=[],g=a.content.querySelectorAll("style"),h=0;h<g.length;h++){var k=g[h];if(k.hasAttribute("shady-unscoped")){if(!O){var l=k.textContent;bf.has(l)||(bf.add(l),l=k.cloneNode(!0),document.head.appendChild(l));k.parentNode.removeChild(k)}}else f.push(k.textContent),k.parentNode.removeChild(k)}f=f.join("").trim()+(Bg[b]||""); Dg(this);if(!e){if(g=!d)g=Se.test(f)||Re.test(f),Se.lastIndex=0,Re.lastIndex=0;h=we(f);g&&Q&&this.a&&this.a.transformRules(h,b);a._styleAst=h}g=[];Q||(g=Xf(a._styleAst));if(!g.length||Q)h=O?a.content:null,b=jg[b]||null,d=zf(c,a._styleAst,null,d,e?f:""),d=d.length?gf(d,c.is,h,b):null,a._style=d;a.a=g}};n.Qa=function(a,b){Bg[b]=a.join(" ")};n.prepareTemplateDom=function(a,b){if(!Pe){var c=rf(a);O||"shady"===c||a._domPrepared||(a._domPrepared=!0,uf(a.content,b))}}; function Eg(a){var b=pf(a),c=b.is;b=b.M;var d=jg[c]||null,e=wg[c];if(e){c=e._styleAst;var f=e.a;e=rf(e);b=new Sf(c,d,f,b,e);Tf(a,b);return b}}function Fg(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.ra(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.g)&&a.flushCustomStyles()})})} function Dg(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=yg);Fg(a)} n.flushCustomStyles=function(){if(!Pe&&(Dg(this),this.b)){var a=this.b.processStyles();if(this.b.enqueued&&!sf(this.f.cssBuild)){if(Q){if(!this.f.cssBuild)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&Q&&this.a){var d=ef(c);Dg(this);this.a.transformRules(d);c.textContent=cf(d)}}}else{Gg(this,this.c,this.f);for(b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&hg(c,this.f.w);this.g&&this.styleDocument()}this.b.enqueued=!1}}}; n.styleElement=function(a,b){if(Pe){if(b){T(a)||Tf(a,new Sf(null));var c=T(a);c.o=c.o||{};Object.assign(c.o,b);Hg(this,a,c)}}else if(c=T(a)||Eg(a))if(a!==this.c&&(this.g=!0),b&&(c.o=c.o||{},Object.assign(c.o,b)),Q)Hg(this,a,c);else if(this.flush(),Gg(this,a,c),c.fa&&c.fa.length){b=pf(a).is;var d;a:{if(d=Cg.cache[b])for(var e=d.length-1;0<=e;e--){var f=d[e];b:{var g=c.fa;for(var h=0;h<g.length;h++){var k=g[h];if(f.v[k]!==c.w[k]){g=!1;break b}}g=!0}if(g){d=f;break a}}d=void 0}g=d?d.styleElement:null; e=c.s;(f=d&&d.s)||(f=this.l[b]=(this.l[b]||0)+1,f=b+"-"+f);c.s=f;f=c.s;h=ig;h=g?g.textContent||"":eg(h,a,c.w,f);k=T(a);var l=k.a;l&&!O&&l!==g&&(l._useCount--,0>=l._useCount&&l.parentNode&&l.parentNode.removeChild(l));O?k.a?(k.a.textContent=h,g=k.a):h&&(g=gf(h,f,a.shadowRoot,k.b)):g?g.parentNode||(Vf&&-1<h.indexOf("@media")&&(g.textContent=h),hf(g,null,k.b)):h&&(g=gf(h,f,null,k.b));g&&(g._useCount=g._useCount||0,k.a!=g&&g._useCount++,k.a=g);f=g;O||(g=c.s,k=h=a.getAttribute("class")||"",e&&(k=h.replace(new RegExp("\\s*x-scope\\s*"+ e+"\\s*","g")," ")),k+=(k?" ":"")+"x-scope "+g,h!==k&&nf(a,k));d||Cg.store(b,c.w,f,c.s)}}; function Hg(a,b,c){var d=pf(b).is;if(c.o){var e=c.o,f;for(f in e)null===f?b.style.removeProperty(f):b.style.setProperty(f,e[f])}e=wg[d];if(!(!e&&b!==a.c||e&&""!==rf(e))&&e&&e._style&&!zg(e)){if(zg(e)||e._applyShimValidatingVersion!==e._applyShimNextVersion)Dg(a),a.a&&a.a.transformRules(e._styleAst,d),e._style.textContent=zf(b,c.A),Ag(e);O&&(a=b.shadowRoot)&&(a=a.querySelector("style"))&&(a.textContent=zf(b,c.A));c.A=e._styleAst}} function Ig(a,b){return(b=of(b).getRootNode().host)?T(b)||Eg(b)?b:Ig(a,b):a.c}function Gg(a,b,c){var d=Ig(a,b),e=T(d),f=e.w;d===a.c||f||(Gg(a,d,e),f=e.w);a=Object.create(f||null);d=dg(b,c.A,c.cssBuild);b=bg(e.A,b).v;Object.assign(a,d.Ha,b,d.Ra);b=c.o;for(var g in b)if((e=b[g])||0===e)a[g]=e;g=ig;b=Object.getOwnPropertyNames(a);for(e=0;e<b.length;e++)d=b[e],a[d]=$f(g,a[d],a);c.w=a}n.styleDocument=function(a){this.styleSubtree(this.c,a)}; n.styleSubtree=function(a,b){var c=of(a),d=c.shadowRoot;(d||a===this.c)&&this.styleElement(a,b);if(a=d&&(d.children||d.childNodes))for(c=0;c<a.length;c++)this.styleSubtree(a[c]);else if(c=c.children||c.childNodes)for(a=0;a<c.length;a++)this.styleSubtree(c[a])}; n.ra=function(a){var b=this,c=rf(a);c!==this.f.cssBuild&&(this.f.cssBuild=c);if(!sf(c)){var d=ef(a);df(d,function(a){if(O)Rf(a);else{var d=R;a.selector=a.parsedSelector;Rf(a);a.selector=a.j=Cf(d,a,d.c,void 0,void 0)}Q&&""===c&&(Dg(b),b.a&&b.a.transformRule(a))});Q?a.textContent=cf(d):this.f.A.rules.push(d)}};n.getComputedStyleValue=function(a,b){var c;Q||(c=(T(a)||T(Ig(this,a))).w[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""}; n.Ua=function(a,b){var c=of(a).getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var d=a.getAttribute("class");if(d){d=d.split(/\s/);for(var e=0;e<d.length;e++)if(d[e]===R.a){c=d[e+1];break}}}c&&b.push(R.a,c);Q||(c=T(a))&&c.s&&b.push(ig.a,c.s);nf(a,b.join(" "))};n.Ba=function(a){return T(a)};n.Ta=function(a,b){wf(a,b)};n.Wa=function(a,b){wf(a,b,!0)};n.Sa=function(a){return qg(a)};n.Da=function(a){return pg(a)};Y.prototype.flush=Y.prototype.flush;Y.prototype.prepareTemplate=Y.prototype.prepareTemplate; Y.prototype.styleElement=Y.prototype.styleElement;Y.prototype.styleDocument=Y.prototype.styleDocument;Y.prototype.styleSubtree=Y.prototype.styleSubtree;Y.prototype.getComputedStyleValue=Y.prototype.getComputedStyleValue;Y.prototype.setElementClass=Y.prototype.Ua;Y.prototype._styleInfoForNode=Y.prototype.Ba;Y.prototype.transformCustomStyleForDocument=Y.prototype.ra;Y.prototype.getStyleAst=Y.prototype.Fa;Y.prototype.styleAstToString=Y.prototype.Va;Y.prototype.flushCustomStyles=Y.prototype.flushCustomStyles; Y.prototype.scopeNode=Y.prototype.Ta;Y.prototype.unscopeNode=Y.prototype.Wa;Y.prototype.scopeForNode=Y.prototype.Sa;Y.prototype.currentScopeForNode=Y.prototype.Da;Y.prototype.prepareAdoptedCssText=Y.prototype.Qa;Object.defineProperties(Y.prototype,{nativeShadow:{get:function(){return O}},nativeCss:{get:function(){return Q}}});var Z=new Y,Jg,Kg;window.ShadyCSS&&(Jg=window.ShadyCSS.ApplyShim,Kg=window.ShadyCSS.CustomStyleInterface); window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplate(a,b,c)},prepareTemplateDom:function(a,b){Z.prepareTemplateDom(a,b)},prepareTemplateStyles:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplateStyles(a,b,c)},styleSubtree:function(a,b){Z.flushCustomStyles();Z.styleSubtree(a,b)},styleElement:function(a){Z.flushCustomStyles();Z.styleElement(a)},styleDocument:function(a){Z.flushCustomStyles();Z.styleDocument(a)},flushCustomStyles:function(){Z.flushCustomStyles()}, getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:Q,nativeShadow:O,cssBuild:Qe,disableRuntime:Pe};Jg&&(window.ShadyCSS.ApplyShim=Jg);Kg&&(window.ShadyCSS.CustomStyleInterface=Kg);var Lg=window.customElements,Mg=window.HTMLImports,Ng=window.HTMLTemplateElement;window.WebComponents=window.WebComponents||{};if(Lg&&Lg.polyfillWrapFlushCallback){var Og,Pg=function(){if(Og){Ng.C&&Ng.C(window.document);var a=Og;Og=null;a();return!0}},Qg=Mg.whenReady;Lg.polyfillWrapFlushCallback(function(a){Og=a;Qg(Pg)});Mg.whenReady=function(a){Qg(function(){Pg()?Mg.whenReady(a):a()})}} Mg.whenReady(function(){requestAnimationFrame(function(){window.WebComponents.ready=!0;document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})});var Rg=document.createElement("style");Rg.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var Sg=document.querySelector("head");Sg.insertBefore(Rg,Sg.firstChild);}).call(this); (function(){/* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ 'use strict';var l=!(window.ShadyDOM&&window.ShadyDOM.inUse),p;function r(a){p=a&&a.shimcssproperties?!1:l||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var t;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(t=window.ShadyCSS.cssBuild);var aa=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime); window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?p=window.ShadyCSS.nativeCss:window.ShadyCSS?(r(window.ShadyCSS),window.ShadyCSS=void 0):r(window.WebComponents&&window.WebComponents.flags);var u=p,v=t;function w(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""} function x(a){a=a.replace(ba,"").replace(ca,"");var b=y,c=a,e=new w;e.start=0;e.end=c.length;for(var d=e,f=0,g=c.length;f<g;f++)if("{"===c[f]){d.rules||(d.rules=[]);var h=d,k=h.rules[h.rules.length-1]||null;d=new w;d.start=f+1;d.parent=h;d.previous=k;h.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)} function y(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=da(c),c=c.replace(z," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=A:c.match(ea)&&(a.type=B,a.keyframesName=a.selector.split(z).pop()):a.type=0===c.indexOf("--")?C:D);if(c=a.rules)for(var e=0,d=c.length,f=void 0;e<d&&(f=c[e]);e++)y(f,b); return a}function da(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})} function E(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=d.length,h=void 0;f<g&&(h=d[f]);f++)e=E(h,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(fa,"").replace(ha,""),b=b.replace(ia,"").replace(ja,"")),(e=b.trim())&&(e=" "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c} var D=1,B=7,A=4,C=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,ha=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ia=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ja=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ea=/^@[^\s]*keyframes/,z=/\s+/g;var G=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,H=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ka=/@media\s(.*)/;var I=new Set;function J(a){if(!a)return"";"string"===typeof a&&(a=x(a));return E(a,u)}function K(a){!a.__cssRules&&a.textContent&&(a.__cssRules=x(a.textContent));return a.__cssRules||null}function L(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===A){var g=a.selector.match(ka);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===D?b(a):c&&f===B?c(a):f===C&&(d=!0);if((a=a.rules)&&!d)for(d=0,f=a.length,g=void 0;d<f&&(g=a[d]);d++)L(g,b,c,e)}} function M(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");a:{var e=0;var d=c+3;for(var f=a.length;d<f;d++)if("("===a[d])e++;else if(")"===a[d]&&0===--e)break a;d=-1}e=a.substring(c+4,d);c=a.substring(0,c);a=M(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)} function N(a){if(void 0!==v)return v;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""};var la=/;\s*/m,ma=/^\s*(initial)|(inherit)\s*$/,O=/\s*!important/;function P(){this.a={}}P.prototype.set=function(a,b){a=a.trim();this.a[a]={h:b,i:{}}};P.prototype.get=function(a){a=a.trim();return this.a[a]||null};var Q=null;function R(){this.b=this.c=null;this.a=new P}R.prototype.o=function(a){a=H.test(a)||G.test(a);H.lastIndex=0;G.lastIndex=0;return a}; R.prototype.m=function(a,b){if(void 0===a._gatheredStyle){var c=[];for(var e=a.content.querySelectorAll("style"),d=0;d<e.length;d++){var f=e[d];if(f.hasAttribute("shady-unscoped")){if(!l){var g=f.textContent;I.has(g)||(I.add(g),g=f.cloneNode(!0),document.head.appendChild(g));f.parentNode.removeChild(f)}}else c.push(f.textContent),f.parentNode.removeChild(f)}(c=c.join("").trim())?(e=document.createElement("style"),e.textContent=c,a.content.insertBefore(e,a.content.firstChild),c=e):c=null;a._gatheredStyle= c}return(a=a._gatheredStyle)?this.j(a,b):null};R.prototype.j=function(a,b){b=void 0===b?"":b;var c=K(a);this.l(c,b);a.textContent=J(c);return c};R.prototype.f=function(a){var b=this,c=K(a);L(c,function(a){":root"===a.selector&&(a.selector="html");b.g(a)});a.textContent=J(c);return c};R.prototype.l=function(a,b){var c=this;this.c=b;L(a,function(a){c.g(a)});this.c=null};R.prototype.g=function(a){a.cssText=na(this,a.parsedCssText,a);":root"===a.selector&&(a.selector=":host > *")}; function na(a,b,c){b=b.replace(G,function(b,d,f,g){return oa(a,b,d,f,g,c)});return S(a,b,c)}function pa(a,b){for(var c=b;c.parent;)c=c.parent;var e={},d=!1;L(c,function(c){(d=d||c===b)||c.selector===b.selector&&Object.assign(e,T(a,c.parsedCssText))});return e} function S(a,b,c){for(var e;e=H.exec(b);){var d=e[0],f=e[1];e=e.index;var g=b.slice(0,e+d.indexOf("@apply"));b=b.slice(e+d.length);var h=c?pa(a,c):{};Object.assign(h,T(a,g));d=void 0;var k=a;f=f.replace(la,"");var n=[];var m=k.a.get(f);m||(k.a.set(f,{}),m=k.a.get(f));if(m){k.c&&(m.i[k.c]=!0);var q=m.h;for(d in q)k=h&&h[d],m=[d,": var(",f,"_-_",d],k&&m.push(",",k.replace(O,"")),m.push(")"),O.test(q[d])&&m.push(" !important"),n.push(m.join(""))}d=n.join("; ");b=g+d+b;H.lastIndex=e+d.length}return b} function T(a,b,c){c=void 0===c?!1:c;b=b.split(";");for(var e,d,f={},g=0,h;g<b.length;g++)if(e=b[g])if(h=e.split(":"),1<h.length){e=h[0].trim();d=h.slice(1).join(":");if(c){var k=a;h=e;var n=ma.exec(d);n&&(n[1]?(k.b||(k.b=document.createElement("meta"),k.b.setAttribute("apply-shim-measure",""),k.b.style.all="initial",document.head.appendChild(k.b)),h=window.getComputedStyle(k.b).getPropertyValue(h)):h="apply-shim-inherit",d=h)}f[e]=d}return f}function qa(a,b){if(Q)for(var c in b.i)c!==a.c&&Q(c)} function oa(a,b,c,e,d,f){e&&M(e,function(b,c){c&&a.a.get(c)&&(d="@apply "+c+";")});if(!d)return b;var g=S(a,""+d,f);f=b.slice(0,b.indexOf("--"));var h=g=T(a,g,!0),k=a.a.get(c),n=k&&k.h;n?h=Object.assign(Object.create(n),g):a.a.set(c,h);var m=[],q,Z=!1;for(q in h){var F=g[q];void 0===F&&(F="initial");!n||q in n||(Z=!0);m.push(c+"_-_"+q+": "+F)}Z&&qa(a,k);k&&(k.h=h);e&&(f=b+";"+f);return f+m.join("; ")+";"}R.prototype.detectMixin=R.prototype.o;R.prototype.transformStyle=R.prototype.j; R.prototype.transformCustomStyle=R.prototype.f;R.prototype.transformRules=R.prototype.l;R.prototype.transformRule=R.prototype.g;R.prototype.transformTemplate=R.prototype.m;R.prototype._separator="_-_";Object.defineProperty(R.prototype,"invalidCallback",{get:function(){return Q},set:function(a){Q=a}});var U={};var ra=Promise.resolve();function sa(a){if(a=U[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function ta(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ua(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,ra.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var V=new R;function W(){this.a=null;V.invalidCallback=sa}function X(a){!a.a&&window.ShadyCSS.CustomStyleInterface&&(a.a=window.ShadyCSS.CustomStyleInterface,a.a.transformCallback=function(a){V.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&a.flushCustomStyles()})})}W.prototype.prepareTemplate=function(a,b){X(this);""===N(a)&&(U[b]=a,b=V.m(a,b),a._styleAst=b)}; W.prototype.flushCustomStyles=function(){X(this);if(this.a){var a=this.a.processStyles();if(this.a.enqueued){for(var b=0;b<a.length;b++){var c=this.a.getStyleForCustomStyle(a[b]);c&&V.f(c)}this.a.enqueued=!1}}}; W.prototype.styleSubtree=function(a,b){X(this);if(b)for(var c in b)null===c?a.style.removeProperty(c):a.style.setProperty(c,b[c]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b]);else for(a=a.children||a.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b])}; W.prototype.styleElement=function(a){X(this);var b=a.localName,c;b?-1<b.indexOf("-")?c=b:c=a.getAttribute&&a.getAttribute("is")||"":c=a.is;b=U[c];if(!(b&&""!==N(b)||!b||ta(b))){if(ta(b)||b._applyShimValidatingVersion!==b._applyShimNextVersion)this.prepareTemplate(b,c),ua(b);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=b._styleAst,a.textContent=J(b._styleAst)}};W.prototype.styleDocument=function(a){X(this);this.styleSubtree(document.body,a)}; if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Y=new W,va=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,b){Y.flushCustomStyles();Y.prepareTemplate(a,b)},prepareTemplateStyles:function(a,b,c){window.ShadyCSS.prepareTemplate(a,b,c)},prepareTemplateDom:function(){},styleSubtree:function(a,b){Y.flushCustomStyles();Y.styleSubtree(a,b)},styleElement:function(a){Y.flushCustomStyles();Y.styleElement(a)},styleDocument:function(a){Y.flushCustomStyles(); Y.styleDocument(a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){Y.flushCustomStyles()},nativeCss:u,nativeShadow:l,cssBuild:v,disableRuntime:aa};va&&(window.ShadyCSS.CustomStyleInterface=va)}window.ShadyCSS.ApplyShim=V;}).call(this); (function() { 'use strict'; const userPolymer = window.Polymer; /** * @namespace Polymer * @summary Polymer is a lightweight library built on top of the web * standards-based Web Components API's, and makes it easy to build your * own custom HTML elements. * @param {!PolymerInit} info Prototype for the custom element. It must contain * an `is` property to specify the element name. Other properties populate * the element prototype. The `properties`, `observers`, `hostAttributes`, * and `listeners` properties are processed to create element features. * @return {!Object} Returns a custom element class for the given provided * prototype `info` object. The name of the element if given by `info.is`. */ window.Polymer = function(info) { return window.Polymer._polymerFn(info); }; // support user settings on the Polymer object if (userPolymer) { Object.assign(Polymer, userPolymer); } // To be plugged by legacy implementation if loaded /* eslint-disable valid-jsdoc */ /** * @param {!PolymerInit} info Prototype for the custom element. It must contain * an `is` property to specify the element name. Other properties populate * the element prototype. The `properties`, `observers`, `hostAttributes`, * and `listeners` properties are processed to create element features. * @return {!Object} Returns a custom element class for the given provided * prototype `info` object. The name of the element if given by `info.is`. */ window.Polymer._polymerFn = function(info) { // eslint-disable-line no-unused-vars throw new Error('Load polymer.html to use the Polymer() function.'); }; /* eslint-enable */ window.Polymer.version = '2.7.0'; /* eslint-disable no-unused-vars */ /* When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property] We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling. */ window.JSCompiler_renameProperty = function(prop, obj) { return prop; }; /* eslint-enable */ })(); (function() { 'use strict'; let CSS_URL_RX = /(url\()([^)]*)(\))/g; let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/; let workingURL; let resolveDoc; /** * Resolves the given URL against the provided `baseUri'. * * Note that this function performs no resolution for URLs that start * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose * URL resolution, use `window.URL`. * * @memberof Polymer.ResolveUrl * @param {string} url Input URL to resolve * @param {?string=} baseURI Base URI to resolve the URL against * @return {string} resolved URL */ function resolveUrl(url, baseURI) { if (url && ABS_URL.test(url)) { return url; } // Lazy feature detection. if (workingURL === undefined) { workingURL = false; try { const u = new URL('b', 'http://a'); u.pathname = 'c%20d'; workingURL = (u.href === 'http://a/c%20d'); } catch (e) { // silently fail } } if (!baseURI) { baseURI = document.baseURI || window.location.href; } if (workingURL) { return (new URL(url, baseURI)).href; } // Fallback to creating an anchor into a disconnected document. if (!resolveDoc) { resolveDoc = document.implementation.createHTMLDocument('temp'); resolveDoc.base = resolveDoc.createElement('base'); resolveDoc.head.appendChild(resolveDoc.base); resolveDoc.anchor = resolveDoc.createElement('a'); resolveDoc.body.appendChild(resolveDoc.anchor); } resolveDoc.base.href = baseURI; resolveDoc.anchor.href = url; return resolveDoc.anchor.href || url; } /** * Resolves any relative URL's in the given CSS text against the provided * `ownerDocument`'s `baseURI`. * * @memberof Polymer.ResolveUrl * @param {string} cssText CSS text to process * @param {string} baseURI Base URI to resolve the URL against * @return {string} Processed CSS text with resolved URL's */ function resolveCss(cssText, baseURI) { return cssText.replace(CSS_URL_RX, function(m, pre, url, post) { return pre + '\'' + resolveUrl(url.replace(/["']/g, ''), baseURI) + '\'' + post; }); } /** * Returns a path from a given `url`. The path includes the trailing * `/` from the url. * * @memberof Polymer.ResolveUrl * @param {string} url Input URL to transform * @return {string} resolved path */ function pathFromUrl(url) { return url.substring(0, url.lastIndexOf('/') + 1); } /** * Module with utilities for resolving relative URL's. * * @namespace * @memberof Polymer * @summary Module with utilities for resolving relative URL's. */ Polymer.ResolveUrl = { resolveCss: resolveCss, resolveUrl: resolveUrl, pathFromUrl: pathFromUrl }; })(); /** @suppress {deprecated} */ (function() { 'use strict'; /** * Sets the global, legacy settings. * * @deprecated * @namespace * @memberof Polymer */ Polymer.Settings = Polymer.Settings || {}; Polymer.Settings.useShadow = !(window.ShadyDOM); Polymer.Settings.useNativeCSSProperties = Boolean(!window.ShadyCSS || window.ShadyCSS.nativeCss); Polymer.Settings.useNativeCustomElements = !(window.customElements.polyfillWrapFlushCallback); /** * Globally settable property that is automatically assigned to * `Polymer.ElementMixin` instances, useful for binding in templates to * make URL's relative to an application's root. Defaults to the main * document URL, but can be overridden by users. It may be useful to set * `Polymer.rootPath` to provide a stable application mount path when * using client side routing. * * @memberof Polymer */ Polymer.rootPath = Polymer.rootPath || Polymer.ResolveUrl.pathFromUrl(document.baseURI || window.location.href); /** * Sets the global rootPath property used by `Polymer.ElementMixin` and * available via `Polymer.rootPath`. * * @memberof Polymer * @param {string} path The new root path * @return {void} */ Polymer.setRootPath = function(path) { Polymer.rootPath = path; }; /** * A global callback used to sanitize any value before inserting it into the DOM. The callback signature is: * * Polymer = { * sanitizeDOMValue: function(value, name, type, node) { ... } * } * * Where: * * `value` is the value to sanitize. * `name` is the name of an attribute or property (for example, href). * `type` indicates where the value is being inserted: one of property, attribute, or text. * `node` is the node where the value is being inserted. * * @type {(function(*,string,string,Node):*)|undefined} * @memberof Polymer */ Polymer.sanitizeDOMValue = Polymer.sanitizeDOMValue || null; /** * Sets the global sanitizeDOMValue available via `Polymer.sanitizeDOMValue`. * * @memberof Polymer * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback * @return {void} */ Polymer.setSanitizeDOMValue = function(newSanitizeDOMValue) { Polymer.sanitizeDOMValue = newSanitizeDOMValue; }; /** * Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures. * When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother * scrolling performance. * Defaults to `false` for backwards compatibility. * * @memberof Polymer */ Polymer.passiveTouchGestures = Polymer.passiveTouchGestures || false; /** * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. * * @memberof Polymer * @param {boolean} usePassive enable or disable passive touch gestures globally * @return {void} */ Polymer.setPassiveTouchGestures = function(usePassive) { Polymer.passiveTouchGestures = usePassive; }; Polymer.legacyOptimizations = Polymer.legacyOptimizations || window.PolymerSettings && window.PolymerSettings.legacyOptimizations || false; /** * Sets `legacyOptimizations` globally for all elements. Enables * optimizations when only legacy Polymer() style elements are used. * * @memberof Polymer * @param {boolean} useLegacyOptimizations enable or disable legacy optimizations globally. * @return {void} */ Polymer.setLegacyOptimizations = function(useLegacyOptimizations) { Polymer.legacyOptimizations = useLegacyOptimizations; }; })(); (function() { 'use strict'; // unique global id for deduping mixins. let dedupeId = 0; /** * @constructor * @extends {Function} * @private */ function MixinFunction(){} /** @type {(WeakMap | undefined)} */ MixinFunction.prototype.__mixinApplications; /** @type {(Object | undefined)} */ MixinFunction.prototype.__mixinSet; /* eslint-disable valid-jsdoc */ /** * Wraps an ES6 class expression mixin such that the mixin is only applied * if it has not already been applied its base argument. Also memoizes mixin * applications. * * @memberof Polymer * @template T * @param {T} mixin ES6 class expression mixin to wrap * @return {T} * @suppress {invalidCasts} */ Polymer.dedupingMixin = function(mixin) { let mixinApplications = /** @type {!MixinFunction} */(mixin).__mixinApplications; if (!mixinApplications) { mixinApplications = new WeakMap(); /** @type {!MixinFunction} */(mixin).__mixinApplications = mixinApplications; } // maintain a unique id for each mixin let mixinDedupeId = dedupeId++; function dedupingMixin(base) { let baseSet = /** @type {!MixinFunction} */(base).__mixinSet; if (baseSet && baseSet[mixinDedupeId]) { return base; } let map = mixinApplications; let extended = map.get(base); if (!extended) { extended = /** @type {!Function} */(mixin)(base); map.set(base, extended); } // copy inherited mixin set from the extended class, or the base class // NOTE: we avoid use of Set here because some browser (IE11) // cannot extend a base Set via the constructor. let mixinSet = Object.create(/** @type {!MixinFunction} */(extended).__mixinSet || baseSet || null); mixinSet[mixinDedupeId] = true; /** @type {!MixinFunction} */(extended).__mixinSet = mixinSet; return extended; } return /** @type {T} */ (dedupingMixin); }; /* eslint-enable valid-jsdoc */ })(); (function() { 'use strict'; const MODULE_STYLE_LINK_SELECTOR = 'link[rel=import][type~=css]'; const INCLUDE_ATTR = 'include'; const SHADY_UNSCOPED_ATTR = 'shady-unscoped'; function importModule(moduleId) { const /** Polymer.DomModule */ PolymerDomModule = customElements.get('dom-module'); if (!PolymerDomModule) { return null; } return PolymerDomModule.import(moduleId); } function styleForImport(importDoc) { // NOTE: polyfill affordance. // under the HTMLImports polyfill, there will be no 'body', // but the import pseudo-doc can be used directly. let container = importDoc.body ? importDoc.body : importDoc; const importCss = Polymer.ResolveUrl.resolveCss(container.textContent, importDoc.baseURI); const style = document.createElement('style'); style.textContent = importCss; return style; } /** @typedef {{assetpath: string}} */ let templateWithAssetPath; // eslint-disable-line no-unused-vars /** * Module with utilities for collection CSS text from `<templates>`, external * stylesheets, and `dom-module`s. * * @namespace * @memberof Polymer * @summary Module with utilities for collection CSS text from various sources. */ const StyleGather = { /** * Returns a list of <style> elements in a space-separated list of `dom-module`s. * * @memberof Polymer.StyleGather * @param {string} moduleIds List of dom-module id's within which to * search for css. * @return {!Array<!HTMLStyleElement>} Array of contained <style> elements * @this {StyleGather} */ stylesFromModules(moduleIds) { const modules = moduleIds.trim().split(/\s+/); const styles = []; for (let i=0; i < modules.length; i++) { styles.push(...this.stylesFromModule(modules[i])); } return styles; }, /** * Returns a list of <style> elements in a given `dom-module`. * Styles in a `dom-module` can come either from `<style>`s within the * first `<template>`, or else from one or more * `<link rel="import" type="css">` links outside the template. * * @memberof Polymer.StyleGather * @param {string} moduleId dom-module id to gather styles from * @return {!Array<!HTMLStyleElement>} Array of contained styles. * @this {StyleGather} */ stylesFromModule(moduleId) { const m = importModule(moduleId); if (!m) { console.warn('Could not find style data in module named', moduleId); return []; } if (m._styles === undefined) { const styles = []; // module imports: <link rel="import" type="css"> styles.push(...this._stylesFromModuleImports(m)); // include css from the first template in the module const template = m.querySelector('template'); if (template) { styles.push(...this.stylesFromTemplate(template, /** @type {templateWithAssetPath} */(m).assetpath)); } m._styles = styles; } return m._styles; }, /** * Returns the `<style>` elements within a given template. * * @memberof Polymer.StyleGather * @param {!HTMLTemplateElement} template Template to gather styles from * @param {string} baseURI baseURI for style content * @return {!Array<!HTMLStyleElement>} Array of styles * @this {StyleGather} */ stylesFromTemplate(template, baseURI) { if (!template._styles) { const styles = []; // if element is a template, get content from its .content const e$ = template.content.querySelectorAll('style'); for (let i=0; i < e$.length; i++) { let e = e$[i]; // support style sharing by allowing styles to "include" // other dom-modules that contain styling let include = e.getAttribute(INCLUDE_ATTR); if (include) { styles.push(...this.stylesFromModules(include).filter(function(item, index, self) { return self.indexOf(item) === index; })); } if (baseURI) { e.textContent = Polymer.ResolveUrl.resolveCss(e.textContent, baseURI); } styles.push(e); } template._styles = styles; } return template._styles; }, /** * Returns a list of <style> elements from stylesheets loaded via `<link rel="import" type="css">` links within the specified `dom-module`. * * @memberof Polymer.StyleGather * @param {string} moduleId Id of `dom-module` to gather CSS from * @return {!Array<!HTMLStyleElement>} Array of contained styles. * @this {StyleGather} */ stylesFromModuleImports(moduleId) { let m = importModule(moduleId); return m ? this._stylesFromModuleImports(m) : []; }, /** * @memberof Polymer.StyleGather * @this {StyleGather} * @param {!HTMLElement} module dom-module element that could contain `<link rel="import" type="css">` styles * @return {!Array<!HTMLStyleElement>} Array of contained styles */ _stylesFromModuleImports(module) { const styles = []; const p$ = module.querySelectorAll(MODULE_STYLE_LINK_SELECTOR); for (let i=0; i < p$.length; i++) { let p = p$[i]; if (p.import) { const importDoc = p.import; const unscoped = p.hasAttribute(SHADY_UNSCOPED_ATTR); if (unscoped && !importDoc._unscopedStyle) { const style = styleForImport(importDoc); style.setAttribute(SHADY_UNSCOPED_ATTR, ''); importDoc._unscopedStyle = style; } else if (!importDoc._style) { importDoc._style = styleForImport(importDoc); } styles.push(unscoped ? importDoc._unscopedStyle : importDoc._style); } } return styles; }, /** * * Returns CSS text of styles in a space-separated list of `dom-module`s. * Note: This method is deprecated, use `stylesFromModules` instead. * * @deprecated * @memberof Polymer.StyleGather * @param {string} moduleIds List of dom-module id's within which to * search for css. * @return {string} Concatenated CSS content from specified `dom-module`s * @this {StyleGather} */ cssFromModules(moduleIds) { let modules = moduleIds.trim().split(/\s+/); let cssText = ''; for (let i=0; i < modules.length; i++) { cssText += this.cssFromModule(modules[i]); } return cssText; }, /** * Returns CSS text of styles in a given `dom-module`. CSS in a `dom-module` * can come either from `<style>`s within the first `<template>`, or else * from one or more `<link rel="import" type="css">` links outside the * template. * * Any `<styles>` processed are removed from their original location. * Note: This method is deprecated, use `styleFromModule` instead. * * @deprecated * @memberof Polymer.StyleGather * @param {string} moduleId dom-module id to gather styles from * @return {string} Concatenated CSS content from specified `dom-module` * @this {StyleGather} */ cssFromModule(moduleId) { let m = importModule(moduleId); if (m && m._cssText === undefined) { // module imports: <link rel="import" type="css"> let cssText = this._cssFromModuleImports(m); // include css from the first template in the module let t = m.querySelector('template'); if (t) { cssText += this.cssFromTemplate(t, /** @type {templateWithAssetPath} */(m).assetpath); } m._cssText = cssText || null; } if (!m) { console.warn('Could not find style data in module named', moduleId); } return m && m._cssText || ''; }, /** * Returns CSS text of `<styles>` within a given template. * * Any `<styles>` processed are removed from their original location. * Note: This method is deprecated, use `styleFromTemplate` instead. * * @deprecated * @memberof Polymer.StyleGather * @param {!HTMLTemplateElement} template Template to gather styles from * @param {string} baseURI Base URI to resolve the URL against * @return {string} Concatenated CSS content from specified template * @this {StyleGather} */ cssFromTemplate(template, baseURI) { let cssText = ''; const e$ = this.stylesFromTemplate(template, baseURI); // if element is a template, get content from its .content for (let i=0; i < e$.length; i++) { let e = e$[i]; if (e.parentNode) { e.parentNode.removeChild(e); } cssText += e.textContent; } return cssText; }, /** * Returns CSS text from stylesheets loaded via `<link rel="import" type="css">` * links within the specified `dom-module`. * * Note: This method is deprecated, use `stylesFromModuleImports` instead. * * @deprecated * * @memberof Polymer.StyleGather * @param {string} moduleId Id of `dom-module` to gather CSS from * @return {string} Concatenated CSS content from links in specified `dom-module` * @this {StyleGather} */ cssFromModuleImports(moduleId) { let m = importModule(moduleId); return m ? this._cssFromModuleImports(m) : ''; }, /** * @deprecated * @memberof Polymer.StyleGather * @this {StyleGather} * @param {!HTMLElement} module dom-module element that could contain `<link rel="import" type="css">` styles * @return {string} Concatenated CSS content from links in the dom-module */ _cssFromModuleImports(module) { let cssText = ''; let styles = this._stylesFromModuleImports(module); for (let i=0; i < styles.length; i++) { cssText += styles[i].textContent; } return cssText; } }; Polymer.StyleGather = StyleGather; })(); (function() { 'use strict'; let modules = {}; let lcModules = {}; function setModule(id, module) { // store id separate from lowercased id so that // in all cases mixedCase id will stored distinctly // and lowercase version is a fallback modules[id] = lcModules[id.toLowerCase()] = module; } function findModule(id) { return modules[id] || lcModules[id.toLowerCase()]; } function styleOutsideTemplateCheck(inst) { if (inst.querySelector('style')) { console.warn('dom-module %s has style outside template', inst.id); } } /** * The `dom-module` element registers the dom it contains to the name given * by the module's id attribute. It provides a unified database of dom * accessible via its static `import` API. * * A key use case of `dom-module` is for providing custom element `<template>`s * via HTML imports that are parsed by the native HTML parser, that can be * relocated during a bundling pass and still looked up by `id`. * * Example: * * <dom-module id="foo"> * <img src="stuff.png"> * </dom-module> * * Then in code in some other location that cannot access the dom-module above * * let img = customElements.get('dom-module').import('foo', 'img'); * * @customElement * @extends HTMLElement * @memberof Polymer * @summary Custom element that provides a registry of relocatable DOM content * by `id` that is agnostic to bundling. * @unrestricted */ class DomModule extends HTMLElement { static get observedAttributes() { return ['id']; } /** * Retrieves the element specified by the css `selector` in the module * registered by `id`. For example, this.import('foo', 'img'); * @param {string} id The id of the dom-module in which to search. * @param {string=} selector The css selector by which to find the element. * @return {Element} Returns the element which matches `selector` in the * module registered at the specified `id`. */ static import(id, selector) { if (id) { let m = findModule(id); if (m && selector) { return m.querySelector(selector); } return m; } return null; } /* eslint-disable no-unused-vars */ /** * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. * @param {?string} namespace Attribute namespace. * @return {void} */ attributeChangedCallback(name, old, value, namespace) { if (old !== value) { this.register(); } } /* eslint-enable no-unused-args */ /** * The absolute URL of the original location of this `dom-module`. * * This value will differ from this element's `ownerDocument` in the * following ways: * - Takes into account any `assetpath` attribute added during bundling * to indicate the original location relative to the bundled location * - Uses the HTMLImports polyfill's `importForElement` API to ensure * the path is relative to the import document's location since * `ownerDocument` is not currently polyfilled */ get assetpath() { // Don't override existing assetpath. if (!this.__assetpath) { // note: assetpath set via an attribute must be relative to this // element's location; accomodate polyfilled HTMLImports const owner = window.HTMLImports && HTMLImports.importForElement ? HTMLImports.importForElement(this) || document : this.ownerDocument; const url = Polymer.ResolveUrl.resolveUrl( this.getAttribute('assetpath') || '', owner.baseURI); this.__assetpath = Polymer.ResolveUrl.pathFromUrl(url); } return this.__assetpath; } /** * Registers the dom-module at a given id. This method should only be called * when a dom-module is imperatively created. For * example, `document.createElement('dom-module').register('foo')`. * @param {string=} id The id at which to register the dom-module. * @return {void} */ register(id) { id = id || this.id; if (id) { // Under strictTemplatePolicy, reject and null out any re-registered // dom-module since it is ambiguous whether first-in or last-in is trusted if (Polymer.strictTemplatePolicy && findModule(id) !== undefined) { setModule(id, null); throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`); } this.id = id; setModule(id, this); styleOutsideTemplateCheck(this); } } } DomModule.prototype['modules'] = modules; customElements.define('dom-module', DomModule); /** @const */ Polymer.DomModule = DomModule; })(); (function() { 'use strict'; /** * Module with utilities for manipulating structured data path strings. * * @namespace * @memberof Polymer * @summary Module with utilities for manipulating structured data path strings. */ const Path = { /** * Returns true if the given string is a structured data path (has dots). * * Example: * * ``` * Polymer.Path.isPath('foo.bar.baz') // true * Polymer.Path.isPath('foo') // false * ``` * * @memberof Polymer.Path * @param {string} path Path string * @return {boolean} True if the string contained one or more dots */ isPath: function(path) { return path.indexOf('.') >= 0; }, /** * Returns the root property name for the given path. * * Example: * * ``` * Polymer.Path.root('foo.bar.baz') // 'foo' * Polymer.Path.root('foo') // 'foo' * ``` * * @memberof Polymer.Path * @param {string} path Path string * @return {string} Root property name */ root: function(path) { let dotIndex = path.indexOf('.'); if (dotIndex === -1) { return path; } return path.slice(0, dotIndex); }, /** * Given `base` is `foo.bar`, `foo` is an ancestor, `foo.bar` is not * Returns true if the given path is an ancestor of the base path. * * Example: * * ``` * Polymer.Path.isAncestor('foo.bar', 'foo') // true * Polymer.Path.isAncestor('foo.bar', 'foo.bar') // false * Polymer.Path.isAncestor('foo.bar', 'foo.bar.baz') // false * ``` * * @memberof Polymer.Path * @param {string} base Path string to test against. * @param {string} path Path string to test. * @return {boolean} True if `path` is an ancestor of `base`. */ isAncestor: function(base, path) { // base.startsWith(path + '.'); return base.indexOf(path + '.') === 0; }, /** * Given `base` is `foo.bar`, `foo.bar.baz` is an descendant * * Example: * * ``` * Polymer.Path.isDescendant('foo.bar', 'foo.bar.baz') // true * Polymer.Path.isDescendant('foo.bar', 'foo.bar') // false * Polymer.Path.isDescendant('foo.bar', 'foo') // false * ``` * * @memberof Polymer.Path * @param {string} base Path string to test against. * @param {string} path Path string to test. * @return {boolean} True if `path` is a descendant of `base`. */ isDescendant: function(base, path) { // path.startsWith(base + '.'); return path.indexOf(base + '.') === 0; }, /** * Replaces a previous base path with a new base path, preserving the * remainder of the path. * * User must ensure `path` has a prefix of `base`. * * Example: * * ``` * Polymer.Path.translate('foo.bar', 'zot', 'foo.bar.baz') // 'zot.baz' * ``` * * @memberof Polymer.Path * @param {string} base Current base string to remove * @param {string} newBase New base string to replace with * @param {string} path Path to translate * @return {string} Translated string */ translate: function(base, newBase, path) { return newBase + path.slice(base.length); }, /** * @param {string} base Path string to test against * @param {string} path Path string to test * @return {boolean} True if `path` is equal to `base` * @this {Path} */ matches: function(base, path) { return (base === path) || this.isAncestor(base, path) || this.isDescendant(base, path); }, /** * Converts array-based paths to flattened path. String-based paths * are returned as-is. * * Example: * * ``` * Polymer.Path.normalize(['foo.bar', 0, 'baz']) // 'foo.bar.0.baz' * Polymer.Path.normalize('foo.bar.0.baz') // 'foo.bar.0.baz' * ``` * * @memberof Polymer.Path * @param {string | !Array<string|number>} path Input path * @return {string} Flattened path */ normalize: function(path) { if (Array.isArray(path)) { let parts = []; for (let i=0; i<path.length; i++) { let args = path[i].toString().split('.'); for (let j=0; j<args.length; j++) { parts.push(args[j]); } } return parts.join('.'); } else { return path; } }, /** * Splits a path into an array of property names. Accepts either arrays * of path parts or strings. * * Example: * * ``` * Polymer.Path.split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz'] * Polymer.Path.split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz'] * ``` * * @memberof Polymer.Path * @param {string | !Array<string|number>} path Input path * @return {!Array<string>} Array of path parts * @this {Path} * @suppress {checkTypes} */ split: function(path) { if (Array.isArray(path)) { return this.normalize(path).split('.'); } return path.toString().split('.'); }, /** * Reads a value from a path. If any sub-property in the path is `undefined`, * this method returns `undefined` (will never throw. * * @memberof Polymer.Path * @param {Object} root Object from which to dereference path from * @param {string | !Array<string|number>} path Path to read * @param {Object=} info If an object is provided to `info`, the normalized * (flattened) path will be set to `info.path`. * @return {*} Value at path, or `undefined` if the path could not be * fully dereferenced. * @this {Path} */ get: function(root, path, info) { let prop = root; let parts = this.split(path); // Loop over path parts[0..n-1] and dereference for (let i=0; i<parts.length; i++) { if (!prop) { return; } let part = parts[i]; prop = prop[part]; } if (info) { info.path = parts.join('.'); } return prop; }, /** * Sets a value to a path. If any sub-property in the path is `undefined`, * this method will no-op. * * @memberof Polymer.Path * @param {Object} root Object from which to dereference path from * @param {string | !Array<string|number>} path Path to set * @param {*} value Value to set to path * @return {string | undefined} The normalized version of the input path * @this {Path} */ set: function(root, path, value) { let prop = root; let parts = this.split(path); let last = parts[parts.length-1]; if (parts.length > 1) { // Loop over path parts[0..n-2] and dereference for (let i=0; i<parts.length-1; i++) { let part = parts[i]; prop = prop[part]; if (!prop) { return; } } // Set value to object at end of path prop[last] = value; } else { // Simple property set prop[path] = value; } return parts.join('.'); } }; /** * Returns true if the given string is a structured data path (has dots). * * This function is deprecated. Use `Polymer.Path.isPath` instead. * * Example: * * ``` * Polymer.Path.isDeep('foo.bar.baz') // true * Polymer.Path.isDeep('foo') // false * ``` * * @deprecated * @memberof Polymer.Path * @param {string} path Path string * @return {boolean} True if the string contained one or more dots */ Path.isDeep = Path.isPath; Polymer.Path = Path; })(); (function() { 'use strict'; const caseMap = {}; const DASH_TO_CAMEL = /-[a-z]/g; const CAMEL_TO_DASH = /([A-Z])/g; /** * Module with utilities for converting between "dash-case" and "camelCase" * identifiers. * * @namespace * @memberof Polymer * @summary Module that provides utilities for converting between "dash-case" * and "camelCase". */ const CaseMap = { /** * Converts "dash-case" identifier (e.g. `foo-bar-baz`) to "camelCase" * (e.g. `fooBarBaz`). * * @memberof Polymer.CaseMap * @param {string} dash Dash-case identifier * @return {string} Camel-case representation of the identifier */ dashToCamelCase(dash) { return caseMap[dash] || ( caseMap[dash] = dash.indexOf('-') < 0 ? dash : dash.replace(DASH_TO_CAMEL, (m) => m[1].toUpperCase() ) ); }, /** * Converts "camelCase" identifier (e.g. `fooBarBaz`) to "dash-case" * (e.g. `foo-bar-baz`). * * @memberof Polymer.CaseMap * @param {string} camel Camel-case identifier * @return {string} Dash-case representation of the identifier */ camelToDashCase(camel) { return caseMap[camel] || ( caseMap[camel] = camel.replace(CAMEL_TO_DASH, '-$1').toLowerCase() ); } }; Polymer.CaseMap = CaseMap; })(); (function() { 'use strict'; // Microtask implemented using Mutation Observer let microtaskCurrHandle = 0; let microtaskLastHandle = 0; let microtaskCallbacks = []; let microtaskNodeContent = 0; let microtaskNode = document.createTextNode(''); new window.MutationObserver(microtaskFlush).observe(microtaskNode, {characterData: true}); function microtaskFlush() { const len = microtaskCallbacks.length; for (let i = 0; i < len; i++) { let cb = microtaskCallbacks[i]; if (cb) { try { cb(); } catch (e) { setTimeout(() => { throw e; }); } } } microtaskCallbacks.splice(0, len); microtaskLastHandle += len; } /** * Module that provides a number of strategies for enqueuing asynchronous * tasks. Each sub-module provides a standard `run(fn)` interface that returns a * handle, and a `cancel(handle)` interface for canceling async tasks before * they run. * * @namespace * @memberof Polymer * @summary Module that provides a number of strategies for enqueuing asynchronous * tasks. */ Polymer.Async = { /** * Async interface wrapper around `setTimeout`. * * @namespace * @memberof Polymer.Async * @summary Async interface wrapper around `setTimeout`. */ timeOut: { /** * Returns a sub-module with the async interface providing the provided * delay. * * @memberof Polymer.Async.timeOut * @param {number=} delay Time to wait before calling callbacks in ms * @return {!AsyncInterface} An async timeout interface */ after(delay) { return { run(fn) { return window.setTimeout(fn, delay); }, cancel(handle) { window.clearTimeout(handle); } }; }, /** * Enqueues a function called in the next task. * * @memberof Polymer.Async.timeOut * @param {!Function} fn Callback to run * @param {number=} delay Delay in milliseconds * @return {number} Handle used for canceling task */ run(fn, delay) { return window.setTimeout(fn, delay); }, /** * Cancels a previously enqueued `timeOut` callback. * * @memberof Polymer.Async.timeOut * @param {number} handle Handle returned from `run` of callback to cancel * @return {void} */ cancel(handle) { window.clearTimeout(handle); } }, /** * Async interface wrapper around `requestAnimationFrame`. * * @namespace * @memberof Polymer.Async * @summary Async interface wrapper around `requestAnimationFrame`. */ animationFrame: { /** * Enqueues a function called at `requestAnimationFrame` timing. * * @memberof Polymer.Async.animationFrame * @param {function(number):void} fn Callback to run * @return {number} Handle used for canceling task */ run(fn) { return window.requestAnimationFrame(fn); }, /** * Cancels a previously enqueued `animationFrame` callback. * * @memberof Polymer.Async.animationFrame * @param {number} handle Handle returned from `run` of callback to cancel * @return {void} */ cancel(handle) { window.cancelAnimationFrame(handle); } }, /** * Async interface wrapper around `requestIdleCallback`. Falls back to * `setTimeout` on browsers that do not support `requestIdleCallback`. * * @namespace * @memberof Polymer.Async * @summary Async interface wrapper around `requestIdleCallback`. */ idlePeriod: { /** * Enqueues a function called at `requestIdleCallback` timing. * * @memberof Polymer.Async.idlePeriod * @param {function(!IdleDeadline):void} fn Callback to run * @return {number} Handle used for canceling task */ run(fn) { return window.requestIdleCallback ? window.requestIdleCallback(fn) : window.setTimeout(fn, 16); }, /** * Cancels a previously enqueued `idlePeriod` callback. * * @memberof Polymer.Async.idlePeriod * @param {number} handle Handle returned from `run` of callback to cancel * @return {void} */ cancel(handle) { window.cancelIdleCallback ? window.cancelIdleCallback(handle) : window.clearTimeout(handle); } }, /** * Async interface for enqueuing callbacks that run at microtask timing. * * Note that microtask timing is achieved via a single `MutationObserver`, * and thus callbacks enqueued with this API will all run in a single * batch, and not interleaved with other microtasks such as promises. * Promises are avoided as an implementation choice for the time being * due to Safari bugs that cause Promises to lack microtask guarantees. * * @namespace * @memberof Polymer.Async * @summary Async interface for enqueuing callbacks that run at microtask * timing. */ microTask: { /** * Enqueues a function called at microtask timing. * * @memberof Polymer.Async.microTask * @param {!Function=} callback Callback to run * @return {number} Handle used for canceling task */ run(callback) { microtaskNode.textContent = microtaskNodeContent++; microtaskCallbacks.push(callback); return microtaskCurrHandle++; }, /** * Cancels a previously enqueued `microTask` callback. * * @memberof Polymer.Async.microTask * @param {number} handle Handle returned from `run` of callback to cancel * @return {void} */ cancel(handle) { const idx = handle - microtaskLastHandle; if (idx >= 0) { if (!microtaskCallbacks[idx]) { throw new Error('invalid async handle: ' + handle); } microtaskCallbacks[idx] = null; } } } }; })(); (function () { 'use strict'; /** @const {!AsyncInterface} */ const microtask = Polymer.Async.microTask; /** * Element class mixin that provides basic meta-programming for creating one * or more property accessors (getter/setter pair) that enqueue an async * (batched) `_propertiesChanged` callback. * * For basic usage of this mixin, call `MyClass.createProperties(props)` * once at class definition time to create property accessors for properties * named in props, implement `_propertiesChanged` to react as desired to * property changes, and implement `static get observedAttributes()` and * include lowercase versions of any property names that should be set from * attributes. Last, call `this._enableProperties()` in the element's * `connectedCallback` to enable the accessors. * * @mixinFunction * @polymer * @memberof Polymer * @summary Element class mixin for reacting to property changes from * generated property accessors. */ Polymer.PropertiesChanged = Polymer.dedupingMixin(superClass => { /** * @polymer * @mixinClass * @extends {superClass} * @implements {Polymer_PropertiesChanged} * @unrestricted */ class PropertiesChanged extends superClass { /** * Creates property accessors for the given property names. * @param {!Object} props Object whose keys are names of accessors. * @return {void} * @protected */ static createProperties(props) { const proto = this.prototype; for (let prop in props) { // don't stomp an existing accessor if (!(prop in proto)) { proto._createPropertyAccessor(prop); } } } /** * Returns an attribute name that corresponds to the given property. * The attribute name is the lowercased property name. Override to * customize this mapping. * @param {string} property Property to convert * @return {string} Attribute name corresponding to the given property. * * @protected */ static attributeNameForProperty(property) { return property.toLowerCase(); } /** * Override point to provide a type to which to deserialize a value to * a given property. * @param {string} name Name of property * * @protected */ static typeForProperty(name) { } //eslint-disable-line no-unused-vars /** * Creates a setter/getter pair for the named property with its own * local storage. The getter returns the value in the local storage, * and the setter calls `_setProperty`, which updates the local storage * for the property and enqueues a `_propertiesChanged` callback. * * This method may be called on a prototype or an instance. Calling * this method may overwrite a property value that already exists on * the prototype/instance by creating the accessor. * * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created; the * protected `_setProperty` function must be used to set the property * @return {void} * @protected */ _createPropertyAccessor(property, readOnly) { this._addPropertyToAttributeMap(property); if (!this.hasOwnProperty('__dataHasAccessor')) { this.__dataHasAccessor = Object.assign({}, this.__dataHasAccessor); } if (!this.__dataHasAccessor[property]) { this.__dataHasAccessor[property] = true; this._definePropertyAccessor(property, readOnly); } } /** * Adds the given `property` to a map matching attribute names * to property names, using `attributeNameForProperty`. This map is * used when deserializing attribute values to properties. * * @param {string} property Name of the property */ _addPropertyToAttributeMap(property) { if (!this.hasOwnProperty('__dataAttributes')) { this.__dataAttributes = Object.assign({}, this.__dataAttributes); } if (!this.__dataAttributes[property]) { const attr = this.constructor.attributeNameForProperty(property); this.__dataAttributes[attr] = property; } } /** * Defines a property accessor for the given property. * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created * @return {void} */ _definePropertyAccessor(property, readOnly) { Object.defineProperty(this, property, { /* eslint-disable valid-jsdoc */ /** @this {PropertiesChanged} */ get() { return this._getProperty(property); }, /** @this {PropertiesChanged} */ set: readOnly ? function () {} : function (value) { this._setProperty(property, value); } /* eslint-enable */ }); } constructor() { super(); this.__dataEnabled = false; this.__dataReady = false; this.__dataInvalid = false; this.__data = {}; this.__dataPending = null; this.__dataOld = null; this.__dataInstanceProps = null; this.__serializing = false; this._initializeProperties(); } /** * Lifecycle callback called when properties are enabled via * `_enableProperties`. * * Users may override this function to implement behavior that is * dependent on the element having its property data initialized, e.g. * from defaults (initialized from `constructor`, `_initializeProperties`), * `attributeChangedCallback`, or values propagated from host e.g. via * bindings. `super.ready()` must be called to ensure the data system * becomes enabled. * * @return {void} * @public */ ready() { this.__dataReady = true; this._flushProperties(); } /** * Initializes the local storage for property accessors. * * Provided as an override point for performing any setup work prior * to initializing the property accessor system. * * @return {void} * @protected */ _initializeProperties() { // Capture instance properties; these will be set into accessors // during first flush. Don't set them here, since we want // these to overwrite defaults/constructor assignments for (let p in this.__dataHasAccessor) { if (this.hasOwnProperty(p)) { this.__dataInstanceProps = this.__dataInstanceProps || {}; this.__dataInstanceProps[p] = this[p]; delete this[p]; } } } /** * Called at ready time with bag of instance properties that overwrote * accessors when the element upgraded. * * The default implementation sets these properties back into the * setter at ready time. This method is provided as an override * point for customizing or providing more efficient initialization. * * @param {Object} props Bag of property values that were overwritten * when creating property accessors. * @return {void} * @protected */ _initializeInstanceProperties(props) { Object.assign(this, props); } /** * Updates the local storage for a property (via `_setPendingProperty`) * and enqueues a `_proeprtiesChanged` callback. * * @param {string} property Name of the property * @param {*} value Value to set * @return {void} * @protected */ _setProperty(property, value) { if (this._setPendingProperty(property, value)) { this._invalidateProperties(); } } /** * Returns the value for the given property. * @param {string} property Name of property * @return {*} Value for the given property * @protected */ _getProperty(property) { return this.__data[property]; } /* eslint-disable no-unused-vars */ /** * Updates the local storage for a property, records the previous value, * and adds it to the set of "pending changes" that will be passed to the * `_propertiesChanged` callback. This method does not enqueue the * `_propertiesChanged` callback. * * @param {string} property Name of the property * @param {*} value Value to set * @param {boolean=} ext Not used here; affordance for closure * @return {boolean} Returns true if the property changed * @protected */ _setPendingProperty(property, value, ext) { let old = this.__data[property]; let changed = this._shouldPropertyChange(property, value, old); if (changed) { if (!this.__dataPending) { this.__dataPending = {}; this.__dataOld = {}; } // Ensure old is captured from the last turn if (this.__dataOld && !(property in this.__dataOld)) { this.__dataOld[property] = old; } this.__data[property] = value; this.__dataPending[property] = value; } return changed; } /* eslint-enable */ /** * Marks the properties as invalid, and enqueues an async * `_propertiesChanged` callback. * * @return {void} * @protected */ _invalidateProperties() { if (!this.__dataInvalid && this.__dataReady) { this.__dataInvalid = true; microtask.run(() => { if (this.__dataInvalid) { this.__dataInvalid = false; this._flushProperties(); } }); } } /** * Call to enable property accessor processing. Before this method is * called accessor values will be set but side effects are * queued. When called, any pending side effects occur immediately. * For elements, generally `connectedCallback` is a normal spot to do so. * It is safe to call this method multiple times as it only turns on * property accessors once. * * @return {void} * @protected */ _enableProperties() { if (!this.__dataEnabled) { this.__dataEnabled = true; if (this.__dataInstanceProps) { this._initializeInstanceProperties(this.__dataInstanceProps); this.__dataInstanceProps = null; } this.ready(); } } /** * Calls the `_propertiesChanged` callback with the current set of * pending changes (and old values recorded when pending changes were * set), and resets the pending set of changes. Generally, this method * should not be called in user code. * * @return {void} * @protected */ _flushProperties() { const props = this.__data; const changedProps = this.__dataPending; const old = this.__dataOld; if (this._shouldPropertiesChange(props, changedProps, old)) { this.__dataPending = null; this.__dataOld = null; this._propertiesChanged(props, changedProps, old); } } /** * Called in `_flushProperties` to determine if `_propertiesChanged` * should be called. The default implementation returns true if * properties are pending. Override to customize when * `_propertiesChanged` is called. * @param {!Object} currentProps Bag of all current accessor values * @param {!Object} changedProps Bag of properties changed since the last * call to `_propertiesChanged` * @param {!Object} oldProps Bag of previous values for each property * in `changedProps` * @return {boolean} true if changedProps is truthy */ _shouldPropertiesChange(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars return Boolean(changedProps); } /** * Callback called when any properties with accessors created via * `_createPropertyAccessor` have been set. * * @param {!Object} currentProps Bag of all current accessor values * @param {!Object} changedProps Bag of properties changed since the last * call to `_propertiesChanged` * @param {!Object} oldProps Bag of previous values for each property * in `changedProps` * @return {void} * @protected */ _propertiesChanged(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars } /** * Method called to determine whether a property value should be * considered as a change and cause the `_propertiesChanged` callback * to be enqueued. * * The default implementation returns `true` if a strict equality * check fails. The method always returns false for `NaN`. * * Override this method to e.g. provide stricter checking for * Objects/Arrays when using immutable patterns. * * @param {string} property Property name * @param {*} value New property value * @param {*} old Previous property value * @return {boolean} Whether the property should be considered a change * and enqueue a `_proeprtiesChanged` callback * @protected */ _shouldPropertyChange(property, value, old) { return ( // Strict equality check (old !== value && // This ensures (old==NaN, value==NaN) always returns false (old === old || value === value)) ); } /** * Implements native Custom Elements `attributeChangedCallback` to * set an attribute value to a property via `_attributeToProperty`. * * @param {string} name Name of attribute that changed * @param {?string} old Old attribute value * @param {?string} value New attribute value * @param {?string} namespace Attribute namespace. * @return {void} * @suppress {missingProperties} Super may or may not implement the callback */ attributeChangedCallback(name, old, value, namespace) { if (old !== value) { this._attributeToProperty(name, value); } if (super.attributeChangedCallback) { super.attributeChangedCallback(name, old, value, namespace); } } /** * Deserializes an attribute to its associated property. * * This method calls the `_deserializeValue` method to convert the string to * a typed value. * * @param {string} attribute Name of attribute to deserialize. * @param {?string} value of the attribute. * @param {*=} type type to deserialize to, defaults to the value * returned from `typeForProperty` * @return {void} */ _attributeToProperty(attribute, value, type) { if (!this.__serializing) { const map = this.__dataAttributes; const property = map && map[attribute] || attribute; this[property] = this._deserializeValue(value, type || this.constructor.typeForProperty(property)); } } /** * Serializes a property to its associated attribute. * * @suppress {invalidCasts} Closure can't figure out `this` is an element. * * @param {string} property Property name to reflect. * @param {string=} attribute Attribute name to reflect to. * @param {*=} value Property value to refect. * @return {void} */ _propertyToAttribute(property, attribute, value) { this.__serializing = true; value = (arguments.length < 3) ? this[property] : value; this._valueToNodeAttribute(/** @type {!HTMLElement} */(this), value, attribute || this.constructor.attributeNameForProperty(property)); this.__serializing = false; } /** * Sets a typed value to an HTML attribute on a node. * * This method calls the `_serializeValue` method to convert the typed * value to a string. If the `_serializeValue` method returns `undefined`, * the attribute will be removed (this is the default for boolean * type `false`). * * @param {Element} node Element to set attribute to. * @param {*} value Value to serialize. * @param {string} attribute Attribute name to serialize to. * @return {void} */ _valueToNodeAttribute(node, value, attribute) { const str = this._serializeValue(value); if (str === undefined) { node.removeAttribute(attribute); } else { node.setAttribute(attribute, str); } } /** * Converts a typed JavaScript value to a string. * * This method is called when setting JS property values to * HTML attributes. Users may override this method to provide * serialization for custom types. * * @param {*} value Property value to serialize. * @return {string | undefined} String serialized from the provided * property value. */ _serializeValue(value) { switch (typeof value) { case 'boolean': return value ? '' : undefined; default: return value != null ? value.toString() : undefined; } } /** * Converts a string to a typed JavaScript value. * * This method is called when reading HTML attribute values to * JS properties. Users may override this method to provide * deserialization for custom `type`s. Types for `Boolean`, `String`, * and `Number` convert attributes to the expected types. * * @param {?string} value Value to deserialize. * @param {*=} type Type to deserialize the string to. * @return {*} Typed value deserialized from the provided string. */ _deserializeValue(value, type) { switch (type) { case Boolean: return (value !== null); case Number: return Number(value); default: return value; } } } return PropertiesChanged; }); })(); (function() { 'use strict'; let caseMap = Polymer.CaseMap; // Save map of native properties; this forms a blacklist or properties // that won't have their values "saved" by `saveAccessorValue`, since // reading from an HTMLElement accessor from the context of a prototype throws const nativeProperties = {}; let proto = HTMLElement.prototype; while (proto) { let props = Object.getOwnPropertyNames(proto); for (let i=0; i<props.length; i++) { nativeProperties[props[i]] = true; } proto = Object.getPrototypeOf(proto); } /** * Used to save the value of a property that will be overridden with * an accessor. If the `model` is a prototype, the values will be saved * in `__dataProto`, and it's up to the user (or downstream mixin) to * decide how/when to set these values back into the accessors. * If `model` is already an instance (it has a `__data` property), then * the value will be set as a pending property, meaning the user should * call `_invalidateProperties` or `_flushProperties` to take effect * * @param {Object} model Prototype or instance * @param {string} property Name of property * @return {void} * @private */ function saveAccessorValue(model, property) { // Don't read/store value for any native properties since they could throw if (!nativeProperties[property]) { let value = model[property]; if (value !== undefined) { if (model.__data) { // Adding accessor to instance; update the property // It is the user's responsibility to call _flushProperties model._setPendingProperty(property, value); } else { // Adding accessor to proto; save proto's value for instance-time use if (!model.__dataProto) { model.__dataProto = {}; } else if (!model.hasOwnProperty(JSCompiler_renameProperty('__dataProto', model))) { model.__dataProto = Object.create(model.__dataProto); } model.__dataProto[property] = value; } } } } /** * Element class mixin that provides basic meta-programming for creating one * or more property accessors (getter/setter pair) that enqueue an async * (batched) `_propertiesChanged` callback. * * For basic usage of this mixin: * * - Declare attributes to observe via the standard `static get observedAttributes()`. Use * `dash-case` attribute names to represent `camelCase` property names. * - Implement the `_propertiesChanged` callback on the class. * - Call `MyClass.createPropertiesForAttributes()` **once** on the class to generate * property accessors for each observed attribute. This must be called before the first * instance is created, for example, by calling it before calling `customElements.define`. * It can also be called lazily from the element's `constructor`, as long as it's guarded so * that the call is only made once, when the first instance is created. * - Call `this._enableProperties()` in the element's `connectedCallback` to enable * the accessors. * * Any `observedAttributes` will automatically be * deserialized via `attributeChangedCallback` and set to the associated * property using `dash-case`-to-`camelCase` convention. * * @mixinFunction * @polymer * @appliesMixin Polymer.PropertiesChanged * @memberof Polymer * @summary Element class mixin for reacting to property changes from * generated property accessors. */ Polymer.PropertyAccessors = Polymer.dedupingMixin(superClass => { /** * @constructor * @extends {superClass} * @implements {Polymer_PropertiesChanged} * @unrestricted * @private */ const base = Polymer.PropertiesChanged(superClass); /** * @polymer * @mixinClass * @implements {Polymer_PropertyAccessors} * @extends {base} * @unrestricted */ class PropertyAccessors extends base { /** * Generates property accessors for all attributes in the standard * static `observedAttributes` array. * * Attribute names are mapped to property names using the `dash-case` to * `camelCase` convention * * @return {void} */ static createPropertiesForAttributes() { let a$ = this.observedAttributes; for (let i=0; i < a$.length; i++) { this.prototype._createPropertyAccessor(caseMap.dashToCamelCase(a$[i])); } } /** * Returns an attribute name that corresponds to the given property. * By default, converts camel to dash case, e.g. `fooBar` to `foo-bar`. * @param {string} property Property to convert * @return {string} Attribute name corresponding to the given property. * * @protected */ static attributeNameForProperty(property) { return caseMap.camelToDashCase(property); } /** * Overrides PropertiesChanged implementation to initialize values for * accessors created for values that already existed on the element * prototype. * * @return {void} * @protected */ _initializeProperties() { if (this.__dataProto) { this._initializeProtoProperties(this.__dataProto); this.__dataProto = null; } super._initializeProperties(); } /** * Called at instance time with bag of properties that were overwritten * by accessors on the prototype when accessors were created. * * The default implementation sets these properties back into the * setter at instance time. This method is provided as an override * point for customizing or providing more efficient initialization. * * @param {Object} props Bag of property values that were overwritten * when creating property accessors. * @return {void} * @protected */ _initializeProtoProperties(props) { for (let p in props) { this._setProperty(p, props[p]); } } /** * Ensures the element has the given attribute. If it does not, * assigns the given value to the attribute. * * @suppress {invalidCasts} Closure can't figure out `this` is infact an element * * @param {string} attribute Name of attribute to ensure is set. * @param {string} value of the attribute. * @return {void} */ _ensureAttribute(attribute, value) { const el = /** @type {!HTMLElement} */(this); if (!el.hasAttribute(attribute)) { this._valueToNodeAttribute(el, value, attribute); } } /** * Overrides PropertiesChanged implemention to serialize objects as JSON. * * @param {*} value Property value to serialize. * @return {string | undefined} String serialized from the provided property value. */ _serializeValue(value) { /* eslint-disable no-fallthrough */ switch (typeof value) { case 'object': if (value instanceof Date) { return value.toString(); } else if (value) { try { return JSON.stringify(value); } catch(x) { return ''; } } default: return super._serializeValue(value); } } /** * Converts a string to a typed JavaScript value. * * This method is called by Polymer when reading HTML attribute values to * JS properties. Users may override this method on Polymer element * prototypes to provide deserialization for custom `type`s. Note, * the `type` argument is the value of the `type` field provided in the * `properties` configuration object for a given property, and is * by convention the constructor for the type to deserialize. * * * @param {?string} value Attribute value to deserialize. * @param {*=} type Type to deserialize the string to. * @return {*} Typed value deserialized from the provided string. */ _deserializeValue(value, type) { /** * @type {*} */ let outValue; switch (type) { case Object: try { outValue = JSON.parse(/** @type {string} */(value)); } catch(x) { // allow non-JSON literals like Strings and Numbers outValue = value; } break; case Array: try { outValue = JSON.parse(/** @type {string} */(value)); } catch(x) { outValue = null; console.warn(`Polymer::Attributes: couldn't decode Array as JSON: ${value}`); } break; case Date: outValue = isNaN(value) ? String(value) : Number(value); outValue = new Date(outValue); break; default: outValue = super._deserializeValue(value, type); break; } return outValue; } /* eslint-enable no-fallthrough */ /** * Overrides PropertiesChanged implementation to save existing prototype * property value so that it can be reset. * @param {string} property Name of the property * @param {boolean=} readOnly When true, no setter is created * * When calling on a prototype, any overwritten values are saved in * `__dataProto`, and it is up to the subclasser to decide how/when * to set those properties back into the accessor. When calling on an * instance, the overwritten value is set via `_setPendingProperty`, * and the user should call `_invalidateProperties` or `_flushProperties` * for the values to take effect. * @protected * @return {void} */ _definePropertyAccessor(property, readOnly) { saveAccessorValue(this, property); super._definePropertyAccessor(property, readOnly); } /** * Returns true if this library created an accessor for the given property. * * @param {string} property Property name * @return {boolean} True if an accessor was created */ _hasAccessor(property) { return this.__dataHasAccessor && this.__dataHasAccessor[property]; } /** * Returns true if the specified property has a pending change. * * @param {string} prop Property name * @return {boolean} True if property has a pending change * @protected */ _isPropertyPending(prop) { return Boolean(this.__dataPending && (prop in this.__dataPending)); } } return PropertyAccessors; }); })(); (function() { 'use strict'; const walker = document.createTreeWalker(document, NodeFilter.SHOW_ALL, null, false); // 1.x backwards-compatible auto-wrapper for template type extensions // This is a clear layering violation and gives favored-nation status to // dom-if and dom-repeat templates. This is a conceit we're choosing to keep // a.) to ease 1.x backwards-compatibility due to loss of `is`, and // b.) to maintain if/repeat capability in parser-constrained elements // (e.g. table, select) in lieu of native CE type extensions without // massive new invention in this space (e.g. directive system) const templateExtensions = { 'dom-if': true, 'dom-repeat': true }; function wrapTemplateExtension(node) { let is = node.getAttribute('is'); if (is && templateExtensions[is]) { let t = node; t.removeAttribute('is'); node = t.ownerDocument.createElement(is); t.parentNode.replaceChild(node, t); node.appendChild(t); while(t.attributes.length) { node.setAttribute(t.attributes[0].name, t.attributes[0].value); t.removeAttribute(t.attributes[0].name); } } return node; } function findTemplateNode(root, nodeInfo) { // recursively ascend tree until we hit root let parent = nodeInfo.parentInfo && findTemplateNode(root, nodeInfo.parentInfo); // unwind the stack, returning the indexed node at each level if (parent) { // note: marginally faster than indexing via childNodes // (http://jsperf.com/childnodes-lookup) walker.currentNode = parent; for (let n=walker.firstChild(), i=0; n; n=walker.nextSibling()) { if (nodeInfo.parentIndex === i++) { return n; } } } else { return root; } } // construct `$` map (from id annotations) function applyIdToMap(inst, map, node, nodeInfo) { if (nodeInfo.id) { map[nodeInfo.id] = node; } } // install event listeners (from event annotations) function applyEventListener(inst, node, nodeInfo) { if (nodeInfo.events && nodeInfo.events.length) { for (let j=0, e$=nodeInfo.events, e; (j<e$.length) && (e=e$[j]); j++) { inst._addMethodEventListenerToNode(node, e.name, e.value, inst); } } } // push configuration references at configure time function applyTemplateContent(inst, node, nodeInfo) { if (nodeInfo.templateInfo) { node._templateInfo = nodeInfo.templateInfo; } } function createNodeEventHandler(context, eventName, methodName) { // Instances can optionally have a _methodHost which allows redirecting where // to find methods. Currently used by `templatize`. context = context._methodHost || context; let handler = function(e) { if (context[methodName]) { context[methodName](e, e.detail); } else { console.warn('listener method `' + methodName + '` not defined'); } }; return handler; } /** * Element mixin that provides basic template parsing and stamping, including * the following template-related features for stamped templates: * * - Declarative event listeners (`on-eventname="listener"`) * - Map of node id's to stamped node instances (`this.$.id`) * - Nested template content caching/removal and re-installation (performance * optimization) * * @mixinFunction * @polymer * @memberof Polymer * @summary Element class mixin that provides basic template parsing and stamping */ Polymer.TemplateStamp = Polymer.dedupingMixin(superClass => { /** * @polymer * @mixinClass * @implements {Polymer_TemplateStamp} */ class TemplateStamp extends superClass { /** * Scans a template to produce template metadata. * * Template-specific metadata are stored in the object returned, and node- * specific metadata are stored in objects in its flattened `nodeInfoList` * array. Only nodes in the template that were parsed as nodes of * interest contain an object in `nodeInfoList`. Each `nodeInfo` object * contains an `index` (`childNodes` index in parent) and optionally * `parent`, which points to node info of its parent (including its index). * * The template metadata object returned from this method has the following * structure (many fields optional): * * ```js * { * // Flattened list of node metadata (for nodes that generated metadata) * nodeInfoList: [ * { * // `id` attribute for any nodes with id's for generating `$` map * id: {string}, * // `on-event="handler"` metadata * events: [ * { * name: {string}, // event name * value: {string}, // handler method name * }, ... * ], * // Notes when the template contained a `<slot>` for shady DOM * // optimization purposes * hasInsertionPoint: {boolean}, * // For nested `<template>`` nodes, nested template metadata * templateInfo: {object}, // nested template metadata * // Metadata to allow efficient retrieval of instanced node * // corresponding to this metadata * parentInfo: {number}, // reference to parent nodeInfo> * parentIndex: {number}, // index in parent's `childNodes` collection * infoIndex: {number}, // index of this `nodeInfo` in `templateInfo.nodeInfoList` * }, * ... * ], * // When true, the template had the `strip-whitespace` attribute * // or was nested in a template with that setting * stripWhitespace: {boolean}, * // For nested templates, nested template content is moved into * // a document fragment stored here; this is an optimization to * // avoid the cost of nested template cloning * content: {DocumentFragment} * } * ``` * * This method kicks off a recursive treewalk as follows: * * ``` * _parseTemplate <---------------------+ * _parseTemplateContent | * _parseTemplateNode <------------|--+ * _parseTemplateNestedTemplate --+ | * _parseTemplateChildNodes ---------+ * _parseTemplateNodeAttributes * _parseTemplateNodeAttribute * * ``` * * These methods may be overridden to add custom metadata about templates * to either `templateInfo` or `nodeInfo`. * * Note that this method may be destructive to the template, in that * e.g. event annotations may be removed after being noted in the * template metadata. * * @param {!HTMLTemplateElement} template Template to parse * @param {TemplateInfo=} outerTemplateInfo Template metadata from the outer * template, for parsing nested templates * @return {!TemplateInfo} Parsed template metadata */ static _parseTemplate(template, outerTemplateInfo) { // since a template may be re-used, memo-ize metadata if (!template._templateInfo) { let templateInfo = template._templateInfo = {}; templateInfo.nodeInfoList = []; templateInfo.stripWhiteSpace = Polymer.legacyOptimizations || (outerTemplateInfo && outerTemplateInfo.stripWhiteSpace) || template.hasAttribute('strip-whitespace'); this._parseTemplateContent(template, templateInfo, {parent: null}); } return template._templateInfo; } static _parseTemplateContent(template, templateInfo, nodeInfo) { return this._parseTemplateNode(template.content, templateInfo, nodeInfo); } /** * Parses template node and adds template and node metadata based on * the current node, and its `childNodes` and `attributes`. * * This method may be overridden to add custom node or template specific * metadata based on this node. * * @param {Node} node Node to parse * @param {!TemplateInfo} templateInfo Template metadata for current template * @param {!NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` */ static _parseTemplateNode(node, templateInfo, nodeInfo) { let noted; let element = /** @type {Element} */(node); if (element.localName == 'template' && !element.hasAttribute('preserve-content')) { noted = this._parseTemplateNestedTemplate(element, templateInfo, nodeInfo) || noted; } else if (element.localName === 'slot') { // For ShadyDom optimization, indicating there is an insertion point templateInfo.hasInsertionPoint = true; } walker.currentNode = element; if (walker.firstChild()) { noted = this._parseTemplateChildNodes(element, templateInfo, nodeInfo) || noted; } if (element.hasAttributes && element.hasAttributes()) { noted = this._parseTemplateNodeAttributes(element, templateInfo, nodeInfo) || noted; } return noted; } /** * Parses template child nodes for the given root node. * * This method also wraps whitelisted legacy template extensions * (`is="dom-if"` and `is="dom-repeat"`) with their equivalent element * wrappers, collapses text nodes, and strips whitespace from the template * if the `templateInfo.stripWhitespace` setting was provided. * * @param {Node} root Root node whose `childNodes` will be parsed * @param {!TemplateInfo} templateInfo Template metadata for current template * @param {!NodeInfo} nodeInfo Node metadata for current template. * @return {void} */ static _parseTemplateChildNodes(root, templateInfo, nodeInfo) { if (root.localName === 'script' || root.localName === 'style') { return; } walker.currentNode = root; for (let node=walker.firstChild(), parentIndex=0, next; node; node=next) { // Wrap templates if (node.localName == 'template') { node = wrapTemplateExtension(node); } // collapse adjacent textNodes: fixes an IE issue that can cause // text nodes to be inexplicably split =( // note that root.normalize() should work but does not so we do this // manually. walker.currentNode = node; next = walker.nextSibling(); if (node.nodeType === Node.TEXT_NODE) { let /** Node */ n = next; while (n && (n.nodeType === Node.TEXT_NODE)) { node.textContent += n.textContent; next = walker.nextSibling(); root.removeChild(n); n = next; } // optionally strip whitespace if (templateInfo.stripWhiteSpace && !node.textContent.trim()) { root.removeChild(node); continue; } } let childInfo = { parentIndex, parentInfo: nodeInfo }; if (this._parseTemplateNode(node, templateInfo, childInfo)) { childInfo.infoIndex = templateInfo.nodeInfoList.push(/** @type {!NodeInfo} */(childInfo)) - 1; } // Increment if not removed walker.currentNode = node; if (walker.parentNode()) { parentIndex++; } } } /** * Parses template content for the given nested `<template>`. * * Nested template info is stored as `templateInfo` in the current node's * `nodeInfo`. `template.content` is removed and stored in `templateInfo`. * It will then be the responsibility of the host to set it back to the * template and for users stamping nested templates to use the * `_contentForTemplate` method to retrieve the content for this template * (an optimization to avoid the cost of cloning nested template content). * * @param {HTMLTemplateElement} node Node to parse (a <template>) * @param {TemplateInfo} outerTemplateInfo Template metadata for current template * that includes the template `node` * @param {!NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` */ static _parseTemplateNestedTemplate(node, outerTemplateInfo, nodeInfo) { let templateInfo = this._parseTemplate(node, outerTemplateInfo); let content = templateInfo.content = node.content.ownerDocument.createDocumentFragment(); content.appendChild(node.content); nodeInfo.templateInfo = templateInfo; return true; } /** * Parses template node attributes and adds node metadata to `nodeInfo` * for nodes of interest. * * @param {Element} node Node to parse * @param {TemplateInfo} templateInfo Template metadata for current template * @param {NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` */ static _parseTemplateNodeAttributes(node, templateInfo, nodeInfo) { // Make copy of original attribute list, since the order may change // as attributes are added and removed let noted = false; let attrs = Array.from(node.attributes); for (let i=attrs.length-1, a; (a=attrs[i]); i--) { noted = this._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, a.name, a.value) || noted; } return noted; } /** * Parses a single template node attribute and adds node metadata to * `nodeInfo` for attributes of interest. * * This implementation adds metadata for `on-event="handler"` attributes * and `id` attributes. * * @param {Element} node Node to parse * @param {!TemplateInfo} templateInfo Template metadata for current template * @param {!NodeInfo} nodeInfo Node metadata for current template. * @param {string} name Attribute name * @param {string} value Attribute value * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` */ static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { // events (on-*) if (name.slice(0, 3) === 'on-') { node.removeAttribute(name); nodeInfo.events = nodeInfo.events || []; nodeInfo.events.push({ name: name.slice(3), value }); return true; } // static id else if (name === 'id') { nodeInfo.id = value; return true; } return false; } /** * Returns the `content` document fragment for a given template. * * For nested templates, Polymer performs an optimization to cache nested * template content to avoid the cost of cloning deeply nested templates. * This method retrieves the cached content for a given template. * * @param {HTMLTemplateElement} template Template to retrieve `content` for * @return {DocumentFragment} Content fragment */ static _contentForTemplate(template) { let templateInfo = /** @type {HTMLTemplateElementWithInfo} */ (template)._templateInfo; return (templateInfo && templateInfo.content) || template.content; } /** * Clones the provided template content and returns a document fragment * containing the cloned dom. * * The template is parsed (once and memoized) using this library's * template parsing features, and provides the following value-added * features: * * Adds declarative event listeners for `on-event="handler"` attributes * * Generates an "id map" for all nodes with id's under `$` on returned * document fragment * * Passes template info including `content` back to templates as * `_templateInfo` (a performance optimization to avoid deep template * cloning) * * Note that the memoized template parsing process is destructive to the * template: attributes for bindings and declarative event listeners are * removed after being noted in notes, and any nested `<template>.content` * is removed and stored in notes as well. * * @param {!HTMLTemplateElement} template Template to stamp * @return {!StampedTemplate} Cloned template content */ _stampTemplate(template) { // Polyfill support: bootstrap the template if it has not already been if (template && !template.content && window.HTMLTemplateElement && HTMLTemplateElement.decorate) { HTMLTemplateElement.decorate(template); } let templateInfo = this.constructor._parseTemplate(template); let nodeInfo = templateInfo.nodeInfoList; let content = templateInfo.content || template.content; let dom = /** @type {DocumentFragment} */ (document.importNode(content, true)); // NOTE: ShadyDom optimization indicating there is an insertion point dom.__noInsertionPoint = !templateInfo.hasInsertionPoint; let nodes = dom.nodeList = new Array(nodeInfo.length); dom.$ = {}; for (let i=0, l=nodeInfo.length, info; (i<l) && (info=nodeInfo[i]); i++) { let node = nodes[i] = findTemplateNode(dom, info); applyIdToMap(this, dom.$, node, info); applyTemplateContent(this, node, info); applyEventListener(this, node, info); } dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign return dom; } /** * Adds an event listener by method name for the event provided. * * This method generates a handler function that looks up the method * name at handling time. * * @param {!Node} node Node to add listener on * @param {string} eventName Name of event * @param {string} methodName Name of method * @param {*=} context Context the method will be called on (defaults * to `node`) * @return {Function} Generated handler function */ _addMethodEventListenerToNode(node, eventName, methodName, context) { context = context || node; let handler = createNodeEventHandler(context, eventName, methodName); this._addEventListenerToNode(node, eventName, handler); return handler; } /** * Override point for adding custom or simulated event handling. * * @param {!Node} node Node to add event listener to * @param {string} eventName Name of event * @param {function(!Event):void} handler Listener function to add * @return {void} */ _addEventListenerToNode(node, eventName, handler) { node.addEventListener(eventName, handler); } /** * Override point for adding custom or simulated event handling. * * @param {!Node} node Node to remove event listener from * @param {string} eventName Name of event * @param {function(!Event):void} handler Listener function to remove * @return {void} */ _removeEventListenerFromNode(node, eventName, handler) { node.removeEventListener(eventName, handler); } } return TemplateStamp; }); })(); (function() { 'use strict'; /** @const {Object} */ const CaseMap = Polymer.CaseMap; // Monotonically increasing unique ID used for de-duping effects triggered // from multiple properties in the same turn let dedupeId = 0; /** * Property effect types; effects are stored on the prototype using these keys * @enum {string} */ const TYPES = { COMPUTE: '__computeEffects', REFLECT: '__reflectEffects', NOTIFY: '__notifyEffects', PROPAGATE: '__propagateEffects', OBSERVE: '__observeEffects', READ_ONLY: '__readOnly' }; /** @const {RegExp} */ const capitalAttributeRegex = /[A-Z]/; /** * @typedef {{ * name: (string | undefined), * structured: (boolean | undefined), * wildcard: (boolean | undefined) * }} */ let DataTrigger; //eslint-disable-line no-unused-vars /** * @typedef {{ * info: ?, * trigger: (!DataTrigger | undefined), * fn: (!Function | undefined) * }} */ let DataEffect; //eslint-disable-line no-unused-vars let PropertyEffectsType; //eslint-disable-line no-unused-vars /** * Ensures that the model has an own-property map of effects for the given type. * The model may be a prototype or an instance. * * Property effects are stored as arrays of effects by property in a map, * by named type on the model. e.g. * * __computeEffects: { * foo: [ ... ], * bar: [ ... ] * } * * If the model does not yet have an effect map for the type, one is created * and returned. If it does, but it is not an own property (i.e. the * prototype had effects), the the map is deeply cloned and the copy is * set on the model and returned, ready for new effects to be added. * * @param {Object} model Prototype or instance * @param {string} type Property effect type * @return {Object} The own-property map of effects for the given type * @private */ function ensureOwnEffectMap(model, type) { let effects = model[type]; if (!effects) { effects = model[type] = {}; } else if (!model.hasOwnProperty(type)) { effects = model[type] = Object.create(model[type]); for (let p in effects) { let protoFx = effects[p]; let instFx = effects[p] = Array(protoFx.length); for (let i=0; i<protoFx.length; i++) { instFx[i] = protoFx[i]; } } } return effects; } // -- effects ---------------------------------------------- /** * Runs all effects of a given type for the given set of property changes * on an instance. * * @param {!PropertyEffectsType} inst The instance with effects to run * @param {Object} effects Object map of property-to-Array of effects * @param {Object} props Bag of current property changes * @param {Object=} oldProps Bag of previous values for changed properties * @param {boolean=} hasPaths True with `props` contains one or more paths * @param {*=} extraArgs Additional metadata to pass to effect function * @return {boolean} True if an effect ran for this property * @private */ function runEffects(inst, effects, props, oldProps, hasPaths, extraArgs) { if (effects) { let ran = false; let id = dedupeId++; for (let prop in props) { if (runEffectsForProperty(inst, effects, id, prop, props, oldProps, hasPaths, extraArgs)) { ran = true; } } return ran; } return false; } /** * Runs a list of effects for a given property. * * @param {!PropertyEffectsType} inst The instance with effects to run * @param {Object} effects Object map of property-to-Array of effects * @param {number} dedupeId Counter used for de-duping effects * @param {string} prop Name of changed property * @param {*} props Changed properties * @param {*} oldProps Old properties * @param {boolean=} hasPaths True with `props` contains one or more paths * @param {*=} extraArgs Additional metadata to pass to effect function * @return {boolean} True if an effect ran for this property * @private */ function runEffectsForProperty(inst, effects, dedupeId, prop, props, oldProps, hasPaths, extraArgs) { let ran = false; let rootProperty = hasPaths ? Polymer.Path.root(prop) : prop; let fxs = effects[rootProperty]; if (fxs) { for (let i=0, l=fxs.length, fx; (i<l) && (fx=fxs[i]); i++) { if ((!fx.info || fx.info.lastRun !== dedupeId) && (!hasPaths || pathMatchesTrigger(prop, fx.trigger))) { if (fx.info) { fx.info.lastRun = dedupeId; } fx.fn(inst, prop, props, oldProps, fx.info, hasPaths, extraArgs); ran = true; } } } return ran; } /** * Determines whether a property/path that has changed matches the trigger * criteria for an effect. A trigger is a descriptor with the following * structure, which matches the descriptors returned from `parseArg`. * e.g. for `foo.bar.*`: * ``` * trigger: { * name: 'a.b', * structured: true, * wildcard: true * } * ``` * If no trigger is given, the path is deemed to match. * * @param {string} path Path or property that changed * @param {DataTrigger} trigger Descriptor * @return {boolean} Whether the path matched the trigger */ function pathMatchesTrigger(path, trigger) { if (trigger) { let triggerPath = trigger.name; return (triggerPath == path) || (trigger.structured && Polymer.Path.isAncestor(triggerPath, path)) || (trigger.wildcard && Polymer.Path.isDescendant(triggerPath, path)); } else { return true; } } /** * Implements the "observer" effect. * * Calls the method with `info.methodName` on the instance, passing the * new and old values. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {string} property Name of property * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {?} info Effect metadata * @return {void} * @private */ function runObserverEffect(inst, property, props, oldProps, info) { let fn = typeof info.method === "string" ? inst[info.method] : info.method; let changedProp = info.property; if (fn) { fn.call(inst, inst.__data[changedProp], oldProps[changedProp]); } else if (!info.dynamicFn) { console.warn('observer method `' + info.method + '` not defined'); } } /** * Runs "notify" effects for a set of changed properties. * * This method differs from the generic `runEffects` method in that it * will dispatch path notification events in the case that the property * changed was a path and the root property for that path didn't have a * "notify" effect. This is to maintain 1.0 behavior that did not require * `notify: true` to ensure object sub-property notifications were * sent. * * @param {!PropertyEffectsType} inst The instance with effects to run * @param {Object} notifyProps Bag of properties to notify * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {boolean} hasPaths True with `props` contains one or more paths * @return {void} * @private */ function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) { // Notify let fxs = inst[TYPES.NOTIFY]; let notified; let id = dedupeId++; // Try normal notify effects; if none, fall back to try path notification for (let prop in notifyProps) { if (notifyProps[prop]) { if (fxs && runEffectsForProperty(inst, fxs, id, prop, props, oldProps, hasPaths)) { notified = true; } else if (hasPaths && notifyPath(inst, prop, props)) { notified = true; } } } // Flush host if we actually notified and host was batching // And the host has already initialized clients; this prevents // an issue with a host observing data changes before clients are ready. let host; if (notified && (host = inst.__dataHost) && host._invalidateProperties) { host._invalidateProperties(); } } /** * Dispatches {property}-changed events with path information in the detail * object to indicate a sub-path of the property was changed. * * @param {!PropertyEffectsType} inst The element from which to fire the event * @param {string} path The path that was changed * @param {Object} props Bag of current property changes * @return {boolean} Returns true if the path was notified * @private */ function notifyPath(inst, path, props) { let rootProperty = Polymer.Path.root(path); if (rootProperty !== path) { let eventName = Polymer.CaseMap.camelToDashCase(rootProperty) + '-changed'; dispatchNotifyEvent(inst, eventName, props[path], path); return true; } return false; } /** * Dispatches {property}-changed events to indicate a property (or path) * changed. * * @param {!PropertyEffectsType} inst The element from which to fire the event * @param {string} eventName The name of the event to send ('{property}-changed') * @param {*} value The value of the changed property * @param {string | null | undefined} path If a sub-path of this property changed, the path * that changed (optional). * @return {void} * @private * @suppress {invalidCasts} */ function dispatchNotifyEvent(inst, eventName, value, path) { let detail = { value: value, queueProperty: true }; if (path) { detail.path = path; } /** @type {!HTMLElement} */(inst).dispatchEvent(new CustomEvent(eventName, { detail })); } /** * Implements the "notify" effect. * * Dispatches a non-bubbling event named `info.eventName` on the instance * with a detail object containing the new `value`. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {string} property Name of property * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {?} info Effect metadata * @param {boolean} hasPaths True with `props` contains one or more paths * @return {void} * @private */ function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) { let rootProperty = hasPaths ? Polymer.Path.root(property) : property; let path = rootProperty != property ? property : null; let value = path ? Polymer.Path.get(inst, path) : inst.__data[property]; if (path && value === undefined) { value = props[property]; // specifically for .splices } dispatchNotifyEvent(inst, info.eventName, value, path); } /** * Handler function for 2-way notification events. Receives context * information captured in the `addNotifyListener` closure from the * `__notifyListeners` metadata. * * Sets the value of the notified property to the host property or path. If * the event contained path information, translate that path to the host * scope's name for that path first. * * @param {CustomEvent} event Notification event (e.g. '<property>-changed') * @param {!PropertyEffectsType} inst Host element instance handling the notification event * @param {string} fromProp Child element property that was bound * @param {string} toPath Host property/path that was bound * @param {boolean} negate Whether the binding was negated * @return {void} * @private */ function handleNotification(event, inst, fromProp, toPath, negate) { let value; let detail = /** @type {Object} */(event.detail); let fromPath = detail && detail.path; if (fromPath) { toPath = Polymer.Path.translate(fromProp, toPath, fromPath); value = detail && detail.value; } else { value = event.currentTarget[fromProp]; } value = negate ? !value : value; if (!inst[TYPES.READ_ONLY] || !inst[TYPES.READ_ONLY][toPath]) { if (inst._setPendingPropertyOrPath(toPath, value, true, Boolean(fromPath)) && (!detail || !detail.queueProperty)) { inst._invalidateProperties(); } } } /** * Implements the "reflect" effect. * * Sets the attribute named `info.attrName` to the given property value. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {string} property Name of property * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {?} info Effect metadata * @return {void} * @private */ function runReflectEffect(inst, property, props, oldProps, info) { let value = inst.__data[property]; if (Polymer.sanitizeDOMValue) { value = Polymer.sanitizeDOMValue(value, info.attrName, 'attribute', /** @type {Node} */(inst)); } inst._propertyToAttribute(property, info.attrName, value); } /** * Runs "computed" effects for a set of changed properties. * * This method differs from the generic `runEffects` method in that it * continues to run computed effects based on the output of each pass until * there are no more newly computed properties. This ensures that all * properties that will be computed by the initial set of changes are * computed before other effects (binding propagation, observers, and notify) * run. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {!Object} changedProps Bag of changed properties * @param {!Object} oldProps Bag of previous values for changed properties * @param {boolean} hasPaths True with `props` contains one or more paths * @return {void} * @private */ function runComputedEffects(inst, changedProps, oldProps, hasPaths) { let computeEffects = inst[TYPES.COMPUTE]; if (computeEffects) { let inputProps = changedProps; while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) { Object.assign(oldProps, inst.__dataOld); Object.assign(changedProps, inst.__dataPending); inputProps = inst.__dataPending; inst.__dataPending = null; } } } /** * Implements the "computed property" effect by running the method with the * values of the arguments specified in the `info` object and setting the * return value to the computed property specified. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {string} property Name of property * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {?} info Effect metadata * @return {void} * @private */ function runComputedEffect(inst, property, props, oldProps, info) { let result = runMethodEffect(inst, property, props, oldProps, info); let computedProp = info.methodInfo; if (inst.__dataHasAccessor && inst.__dataHasAccessor[computedProp]) { inst._setPendingProperty(computedProp, result, true); } else { inst[computedProp] = result; } } /** * Computes path changes based on path links set up using the `linkPaths` * API. * * @param {!PropertyEffectsType} inst The instance whose props are changing * @param {string | !Array<(string|number)>} path Path that has changed * @param {*} value Value of changed path * @return {void} * @private */ function computeLinkedPaths(inst, path, value) { let links = inst.__dataLinkedPaths; if (links) { let link; for (let a in links) { let b = links[a]; if (Polymer.Path.isDescendant(a, path)) { link = Polymer.Path.translate(a, b, path); inst._setPendingPropertyOrPath(link, value, true, true); } else if (Polymer.Path.isDescendant(b, path)) { link = Polymer.Path.translate(b, a, path); inst._setPendingPropertyOrPath(link, value, true, true); } } } } // -- bindings ---------------------------------------------- /** * Adds binding metadata to the current `nodeInfo`, and binding effects * for all part dependencies to `templateInfo`. * * @param {Function} constructor Class that `_parseTemplate` is currently * running on * @param {TemplateInfo} templateInfo Template metadata for current template * @param {NodeInfo} nodeInfo Node metadata for current template node * @param {string} kind Binding kind, either 'property', 'attribute', or 'text' * @param {string} target Target property name * @param {!Array<!BindingPart>} parts Array of binding part metadata * @param {string=} literal Literal text surrounding binding parts (specified * only for 'property' bindings, since these must be initialized as part * of boot-up) * @return {void} * @private */ function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) { // Create binding metadata and add to nodeInfo nodeInfo.bindings = nodeInfo.bindings || []; let /** Binding */ binding = { kind, target, parts, literal, isCompound: (parts.length !== 1) }; nodeInfo.bindings.push(binding); // Add listener info to binding metadata if (shouldAddListener(binding)) { let {event, negate} = binding.parts[0]; binding.listenerEvent = event || (CaseMap.camelToDashCase(target) + '-changed'); binding.listenerNegate = negate; } // Add "propagate" property effects to templateInfo let index = templateInfo.nodeInfoList.length; for (let i=0; i<binding.parts.length; i++) { let part = binding.parts[i]; part.compoundIndex = i; addEffectForBindingPart(constructor, templateInfo, binding, part, index); } } /** * Adds property effects to the given `templateInfo` for the given binding * part. * * @param {Function} constructor Class that `_parseTemplate` is currently * running on * @param {TemplateInfo} templateInfo Template metadata for current template * @param {!Binding} binding Binding metadata * @param {!BindingPart} part Binding part metadata * @param {number} index Index into `nodeInfoList` for this node * @return {void} */ function addEffectForBindingPart(constructor, templateInfo, binding, part, index) { if (!part.literal) { if (binding.kind === 'attribute' && binding.target[0] === '-') { console.warn('Cannot set attribute ' + binding.target + ' because "-" is not a valid attribute starting character'); } else { let dependencies = part.dependencies; let info = { index, binding, part, evaluator: constructor }; for (let j=0; j<dependencies.length; j++) { let trigger = dependencies[j]; if (typeof trigger == 'string') { trigger = parseArg(trigger); trigger.wildcard = true; } constructor._addTemplatePropertyEffect(templateInfo, trigger.rootProperty, { fn: runBindingEffect, info, trigger }); } } } } /** * Implements the "binding" (property/path binding) effect. * * Note that binding syntax is overridable via `_parseBindings` and * `_evaluateBinding`. This method will call `_evaluateBinding` for any * non-literal parts returned from `_parseBindings`. However, * there is no support for _path_ bindings via custom binding parts, * as this is specific to Polymer's path binding syntax. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {string} path Name of property * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {?} info Effect metadata * @param {boolean} hasPaths True with `props` contains one or more paths * @param {Array} nodeList List of nodes associated with `nodeInfoList` template * metadata * @return {void} * @private */ function runBindingEffect(inst, path, props, oldProps, info, hasPaths, nodeList) { let node = nodeList[info.index]; let binding = info.binding; let part = info.part; // Subpath notification: transform path and set to client // e.g.: foo="{{obj.sub}}", path: 'obj.sub.prop', set 'foo.prop'=obj.sub.prop if (hasPaths && part.source && (path.length > part.source.length) && (binding.kind == 'property') && !binding.isCompound && node.__isPropertyEffectsClient && node.__dataHasAccessor && node.__dataHasAccessor[binding.target]) { let value = props[path]; path = Polymer.Path.translate(part.source, binding.target, path); if (node._setPendingPropertyOrPath(path, value, false, true)) { inst._enqueueClient(node); } } else { let value = info.evaluator._evaluateBinding(inst, part, path, props, oldProps, hasPaths); // Propagate value to child applyBindingValue(inst, node, binding, part, value); } } /** * Sets the value for an "binding" (binding) effect to a node, * either as a property or attribute. * * @param {!PropertyEffectsType} inst The instance owning the binding effect * @param {Node} node Target node for binding * @param {!Binding} binding Binding metadata * @param {!BindingPart} part Binding part metadata * @param {*} value Value to set * @return {void} * @private */ function applyBindingValue(inst, node, binding, part, value) { value = computeBindingValue(node, value, binding, part); if (Polymer.sanitizeDOMValue) { value = Polymer.sanitizeDOMValue(value, binding.target, binding.kind, node); } if (binding.kind == 'attribute') { // Attribute binding inst._valueToNodeAttribute(/** @type {Element} */(node), value, binding.target); } else { // Property binding let prop = binding.target; if (node.__isPropertyEffectsClient && node.__dataHasAccessor && node.__dataHasAccessor[prop]) { if (!node[TYPES.READ_ONLY] || !node[TYPES.READ_ONLY][prop]) { if (node._setPendingProperty(prop, value)) { inst._enqueueClient(node); } } } else { inst._setUnmanagedPropertyToNode(node, prop, value); } } } /** * Transforms an "binding" effect value based on compound & negation * effect metadata, as well as handling for special-case properties * * @param {Node} node Node the value will be set to * @param {*} value Value to set * @param {!Binding} binding Binding metadata * @param {!BindingPart} part Binding part metadata * @return {*} Transformed value to set * @private */ function computeBindingValue(node, value, binding, part) { if (binding.isCompound) { let storage = node.__dataCompoundStorage[binding.target]; storage[part.compoundIndex] = value; value = storage.join(''); } if (binding.kind !== 'attribute') { // Some browsers serialize `undefined` to `"undefined"` if (binding.target === 'textContent' || (binding.target === 'value' && (node.localName === 'input' || node.localName === 'textarea'))) { value = value == undefined ? '' : value; } } return value; } /** * Returns true if a binding's metadata meets all the requirements to allow * 2-way binding, and therefore a `<property>-changed` event listener should be * added: * - used curly braces * - is a property (not attribute) binding * - is not a textContent binding * - is not compound * * @param {!Binding} binding Binding metadata * @return {boolean} True if 2-way listener should be added * @private */ function shouldAddListener(binding) { return Boolean(binding.target) && binding.kind != 'attribute' && binding.kind != 'text' && !binding.isCompound && binding.parts[0].mode === '{'; } /** * Setup compound binding storage structures, notify listeners, and dataHost * references onto the bound nodeList. * * @param {!PropertyEffectsType} inst Instance that bas been previously bound * @param {TemplateInfo} templateInfo Template metadata * @return {void} * @private */ function setupBindings(inst, templateInfo) { // Setup compound storage, dataHost, and notify listeners let {nodeList, nodeInfoList} = templateInfo; if (nodeInfoList.length) { for (let i=0; i < nodeInfoList.length; i++) { let info = nodeInfoList[i]; let node = nodeList[i]; let bindings = info.bindings; if (bindings) { for (let i=0; i<bindings.length; i++) { let binding = bindings[i]; setupCompoundStorage(node, binding); addNotifyListener(node, inst, binding); } } node.__dataHost = inst; } } } /** * Initializes `__dataCompoundStorage` local storage on a bound node with * initial literal data for compound bindings, and sets the joined * literal parts to the bound property. * * When changes to compound parts occur, they are first set into the compound * storage array for that property, and then the array is joined to result in * the final value set to the property/attribute. * * @param {Node} node Bound node to initialize * @param {Binding} binding Binding metadata * @return {void} * @private */ function setupCompoundStorage(node, binding) { if (binding.isCompound) { // Create compound storage map let storage = node.__dataCompoundStorage || (node.__dataCompoundStorage = {}); let parts = binding.parts; // Copy literals from parts into storage for this binding let literals = new Array(parts.length); for (let j=0; j<parts.length; j++) { literals[j] = parts[j].literal; } let target = binding.target; storage[target] = literals; // Configure properties with their literal parts if (binding.literal && binding.kind == 'property') { node[target] = binding.literal; } } } /** * Adds a 2-way binding notification event listener to the node specified * * @param {Object} node Child element to add listener to * @param {!PropertyEffectsType} inst Host element instance to handle notification event * @param {Binding} binding Binding metadata * @return {void} * @private */ function addNotifyListener(node, inst, binding) { if (binding.listenerEvent) { let part = binding.parts[0]; node.addEventListener(binding.listenerEvent, function(e) { handleNotification(e, inst, binding.target, part.source, part.negate); }); } } // -- for method-based effects (complexObserver & computed) -------------- /** * Adds property effects for each argument in the method signature (and * optionally, for the method name if `dynamic` is true) that calls the * provided effect function. * * @param {Element | Object} model Prototype or instance * @param {!MethodSignature} sig Method signature metadata * @param {string} type Type of property effect to add * @param {Function} effectFn Function to run when arguments change * @param {*=} methodInfo Effect-specific information to be included in * method effect metadata * @param {boolean|Object=} dynamicFn Boolean or object map indicating whether * method names should be included as a dependency to the effect. Note, * defaults to true if the signature is static (sig.static is true). * @return {void} * @private */ function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFn) { dynamicFn = sig.static || (dynamicFn && (typeof dynamicFn !== 'object' || dynamicFn[sig.methodName])); let info = { methodName: sig.methodName, args: sig.args, methodInfo, dynamicFn }; for (let i=0, arg; (i<sig.args.length) && (arg=sig.args[i]); i++) { if (!arg.literal) { model._addPropertyEffect(arg.rootProperty, type, { fn: effectFn, info: info, trigger: arg }); } } if (dynamicFn) { model._addPropertyEffect(sig.methodName, type, { fn: effectFn, info: info }); } } /** * Calls a method with arguments marshaled from properties on the instance * based on the method signature contained in the effect metadata. * * Multi-property observers, computed properties, and inline computing * functions call this function to invoke the method, then use the return * value accordingly. * * @param {!PropertyEffectsType} inst The instance the effect will be run on * @param {string} property Name of property * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {?} info Effect metadata * @return {*} Returns the return value from the method invocation * @private */ function runMethodEffect(inst, property, props, oldProps, info) { // Instances can optionally have a _methodHost which allows redirecting where // to find methods. Currently used by `templatize`. let context = inst._methodHost || inst; let fn = context[info.methodName]; if (fn) { let args = inst._marshalArgs(info.args, property, props); return fn.apply(context, args); } else if (!info.dynamicFn) { console.warn('method `' + info.methodName + '` not defined'); } } const emptyArray = []; // Regular expressions used for binding const IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')'; const NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')'; const SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')'; const DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')'; const STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')'; const ARGUMENT = '(?:(' + IDENT + '|' + NUMBER + '|' + STRING + ')\\s*' + ')'; const ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')'; const ARGUMENT_LIST = '(?:' + '\\(\\s*' + '(?:' + ARGUMENTS + '?' + ')' + '\\)\\s*' + ')'; const BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')'; // Group 3 const OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*'; const CLOSE_BRACKET = '(?:]]|}})'; const NEGATE = '(?:(!)\\s*)?'; // Group 2 const EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET; const bindingRegex = new RegExp(EXPRESSION, "g"); /** * Create a string from binding parts of all the literal parts * * @param {!Array<BindingPart>} parts All parts to stringify * @return {string} String made from the literal parts */ function literalFromParts(parts) { let s = ''; for (let i=0; i<parts.length; i++) { let literal = parts[i].literal; s += literal || ''; } return s; } /** * Parses an expression string for a method signature, and returns a metadata * describing the method in terms of `methodName`, `static` (whether all the * arguments are literals), and an array of `args` * * @param {string} expression The expression to parse * @return {?MethodSignature} The method metadata object if a method expression was * found, otherwise `undefined` * @private */ function parseMethod(expression) { // tries to match valid javascript property names let m = expression.match(/([^\s]+?)\(([\s\S]*)\)/); if (m) { let methodName = m[1]; let sig = { methodName, static: true, args: emptyArray }; if (m[2].trim()) { // replace escaped commas with comma entity, split on un-escaped commas let args = m[2].replace(/\\,/g, ',').split(','); return parseArgs(args, sig); } else { return sig; } } return null; } /** * Parses an array of arguments and sets the `args` property of the supplied * signature metadata object. Sets the `static` property to false if any * argument is a non-literal. * * @param {!Array<string>} argList Array of argument names * @param {!MethodSignature} sig Method signature metadata object * @return {!MethodSignature} The updated signature metadata object * @private */ function parseArgs(argList, sig) { sig.args = argList.map(function(rawArg) { let arg = parseArg(rawArg); if (!arg.literal) { sig.static = false; } return arg; }, this); return sig; } /** * Parses an individual argument, and returns an argument metadata object * with the following fields: * * { * value: 'prop', // property/path or literal value * literal: false, // whether argument is a literal * structured: false, // whether the property is a path * rootProperty: 'prop', // the root property of the path * wildcard: false // whether the argument was a wildcard '.*' path * } * * @param {string} rawArg The string value of the argument * @return {!MethodArg} Argument metadata object * @private */ function parseArg(rawArg) { // clean up whitespace let arg = rawArg.trim() // replace comma entity with comma .replace(/,/g, ',') // repair extra escape sequences; note only commas strictly need // escaping, but we allow any other char to be escaped since its // likely users will do this .replace(/\\(.)/g, '\$1') ; // basic argument descriptor let a = { name: arg, value: '', literal: false }; // detect literal value (must be String or Number) let fc = arg[0]; if (fc === '-') { fc = arg[1]; } if (fc >= '0' && fc <= '9') { fc = '#'; } switch(fc) { case "'": case '"': a.value = arg.slice(1, -1); a.literal = true; break; case '#': a.value = Number(arg); a.literal = true; break; } // if not literal, look for structured path if (!a.literal) { a.rootProperty = Polymer.Path.root(arg); // detect structured path (has dots) a.structured = Polymer.Path.isPath(arg); if (a.structured) { a.wildcard = (arg.slice(-2) == '.*'); if (a.wildcard) { a.name = arg.slice(0, -2); } } } return a; } // data api /** * Sends array splice notifications (`.splices` and `.length`) * * Note: this implementation only accepts normalized paths * * @param {!PropertyEffectsType} inst Instance to send notifications to * @param {Array} array The array the mutations occurred on * @param {string} path The path to the array that was mutated * @param {Array} splices Array of splice records * @return {void} * @private */ function notifySplices(inst, array, path, splices) { let splicesPath = path + '.splices'; inst.notifyPath(splicesPath, { indexSplices: splices }); inst.notifyPath(path + '.length', array.length); // Null here to allow potentially large splice records to be GC'ed. inst.__data[splicesPath] = {indexSplices: null}; } /** * Creates a splice record and sends an array splice notification for * the described mutation * * Note: this implementation only accepts normalized paths * * @param {!PropertyEffectsType} inst Instance to send notifications to * @param {Array} array The array the mutations occurred on * @param {string} path The path to the array that was mutated * @param {number} index Index at which the array mutation occurred * @param {number} addedCount Number of added items * @param {Array} removed Array of removed items * @return {void} * @private */ function notifySplice(inst, array, path, index, addedCount, removed) { notifySplices(inst, array, path, [{ index: index, addedCount: addedCount, removed: removed, object: array, type: 'splice' }]); } /** * Returns an upper-cased version of the string. * * @param {string} name String to uppercase * @return {string} Uppercased string * @private */ function upper(name) { return name[0].toUpperCase() + name.substring(1); } /** * Element class mixin that provides meta-programming for Polymer's template * binding and data observation (collectively, "property effects") system. * * This mixin uses provides the following key static methods for adding * property effects to an element class: * - `addPropertyEffect` * - `createPropertyObserver` * - `createMethodObserver` * - `createNotifyingProperty` * - `createReadOnlyProperty` * - `createReflectedProperty` * - `createComputedProperty` * - `bindTemplate` * * Each method creates one or more property accessors, along with metadata * used by this mixin's implementation of `_propertiesChanged` to perform * the property effects. * * Underscored versions of the above methods also exist on the element * prototype for adding property effects on instances at runtime. * * Note that this mixin overrides several `PropertyAccessors` methods, in * many cases to maintain guarantees provided by the Polymer 1.x features; * notably it changes property accessors to be synchronous by default * whereas the default when using `PropertyAccessors` standalone is to be * async by default. * * @mixinFunction * @polymer * @appliesMixin Polymer.TemplateStamp * @appliesMixin Polymer.PropertyAccessors * @memberof Polymer * @summary Element class mixin that provides meta-programming for Polymer's * template binding and data observation system. */ Polymer.PropertyEffects = Polymer.dedupingMixin(superClass => { /** * @constructor * @extends {superClass} * @implements {Polymer_PropertyAccessors} * @implements {Polymer_TemplateStamp} * @unrestricted * @private */ const propertyEffectsBase = Polymer.TemplateStamp(Polymer.PropertyAccessors(superClass)); /** * @polymer * @mixinClass * @implements {Polymer_PropertyEffects} * @extends {propertyEffectsBase} * @unrestricted */ class PropertyEffects extends propertyEffectsBase { constructor() { super(); /** @type {boolean} */ // Used to identify users of this mixin, ala instanceof this.__isPropertyEffectsClient = true; /** @type {number} */ // NOTE: used to track re-entrant calls to `_flushProperties` // path changes dirty check against `__dataTemp` only during one "turn" // and are cleared when `__dataCounter` returns to 0. this.__dataCounter = 0; /** @type {boolean} */ this.__dataClientsReady; /** @type {Array} */ this.__dataPendingClients; /** @type {Object} */ this.__dataToNotify; /** @type {Object} */ this.__dataLinkedPaths; /** @type {boolean} */ this.__dataHasPaths; /** @type {Object} */ this.__dataCompoundStorage; /** @type {Polymer_PropertyEffects} */ this.__dataHost; /** @type {!Object} */ this.__dataTemp; /** @type {boolean} */ this.__dataClientsInitialized; /** @type {!Object} */ this.__data; /** @type {!Object} */ this.__dataPending; /** @type {!Object} */ this.__dataOld; /** @type {Object} */ this.__computeEffects; /** @type {Object} */ this.__reflectEffects; /** @type {Object} */ this.__notifyEffects; /** @type {Object} */ this.__propagateEffects; /** @type {Object} */ this.__observeEffects; /** @type {Object} */ this.__readOnly; /** @type {!TemplateInfo} */ this.__templateInfo; } get PROPERTY_EFFECT_TYPES() { return TYPES; } /** * @return {void} */ _initializeProperties() { super._initializeProperties(); hostStack.registerHost(this); this.__dataClientsReady = false; this.__dataPendingClients = null; this.__dataToNotify = null; this.__dataLinkedPaths = null; this.__dataHasPaths = false; // May be set on instance prior to upgrade this.__dataCompoundStorage = this.__dataCompoundStorage || null; this.__dataHost = this.__dataHost || null; this.__dataTemp = {}; this.__dataClientsInitialized = false; } /** * Overrides `Polymer.PropertyAccessors` implementation to provide a * more efficient implementation of initializing properties from * the prototype on the instance. * * @override * @param {Object} props Properties to initialize on the prototype * @return {void} */ _initializeProtoProperties(props) { this.__data = Object.create(props); this.__dataPending = Object.create(props); this.__dataOld = {}; } /** * Overrides `Polymer.PropertyAccessors` implementation to avoid setting * `_setProperty`'s `shouldNotify: true`. * * @override * @param {Object} props Properties to initialize on the instance * @return {void} */ _initializeInstanceProperties(props) { let readOnly = this[TYPES.READ_ONLY]; for (let prop in props) { if (!readOnly || !readOnly[prop]) { this.__dataPending = this.__dataPending || {}; this.__dataOld = this.__dataOld || {}; this.__data[prop] = this.__dataPending[prop] = props[prop]; } } } // Prototype setup ---------------------------------------- /** * Equivalent to static `addPropertyEffect` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} property Property that should trigger the effect * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES * @param {Object=} effect Effect metadata object * @return {void} * @protected */ _addPropertyEffect(property, type, effect) { this._createPropertyAccessor(property, type == TYPES.READ_ONLY); // effects are accumulated into arrays per property based on type let effects = ensureOwnEffectMap(this, type)[property]; if (!effects) { effects = this[type][property] = []; } effects.push(effect); } /** * Removes the given property effect. * * @param {string} property Property the effect was associated with * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES * @param {Object=} effect Effect metadata object to remove * @return {void} */ _removePropertyEffect(property, type, effect) { let effects = ensureOwnEffectMap(this, type)[property]; let idx = effects.indexOf(effect); if (idx >= 0) { effects.splice(idx, 1); } } /** * Returns whether the current prototype/instance has a property effect * of a certain type. * * @param {string} property Property name * @param {string=} type Effect type, from this.PROPERTY_EFFECT_TYPES * @return {boolean} True if the prototype/instance has an effect of this type * @protected */ _hasPropertyEffect(property, type) { let effects = this[type]; return Boolean(effects && effects[property]); } /** * Returns whether the current prototype/instance has a "read only" * accessor for the given property. * * @param {string} property Property name * @return {boolean} True if the prototype/instance has an effect of this type * @protected */ _hasReadOnlyEffect(property) { return this._hasPropertyEffect(property, TYPES.READ_ONLY); } /** * Returns whether the current prototype/instance has a "notify" * property effect for the given property. * * @param {string} property Property name * @return {boolean} True if the prototype/instance has an effect of this type * @protected */ _hasNotifyEffect(property) { return this._hasPropertyEffect(property, TYPES.NOTIFY); } /** * Returns whether the current prototype/instance has a "reflect to attribute" * property effect for the given property. * * @param {string} property Property name * @return {boolean} True if the prototype/instance has an effect of this type * @protected */ _hasReflectEffect(property) { return this._hasPropertyEffect(property, TYPES.REFLECT); } /** * Returns whether the current prototype/instance has a "computed" * property effect for the given property. * * @param {string} property Property name * @return {boolean} True if the prototype/instance has an effect of this type * @protected */ _hasComputedEffect(property) { return this._hasPropertyEffect(property, TYPES.COMPUTE); } // Runtime ---------------------------------------- /** * Sets a pending property or path. If the root property of the path in * question had no accessor, the path is set, otherwise it is enqueued * via `_setPendingProperty`. * * This function isolates relatively expensive functionality necessary * for the public API (`set`, `setProperties`, `notifyPath`, and property * change listeners via {{...}} bindings), such that it is only done * when paths enter the system, and not at every propagation step. It * also sets a `__dataHasPaths` flag on the instance which is used to * fast-path slower path-matching code in the property effects host paths. * * `path` can be a path string or array of path parts as accepted by the * public API. * * @param {string | !Array<number|string>} path Path to set * @param {*} value Value to set * @param {boolean=} shouldNotify Set to true if this change should * cause a property notification event dispatch * @param {boolean=} isPathNotification If the path being set is a path * notification of an already changed value, as opposed to a request * to set and notify the change. In the latter `false` case, a dirty * check is performed and then the value is set to the path before * enqueuing the pending property change. * @return {boolean} Returns true if the property/path was enqueued in * the pending changes bag. * @protected */ _setPendingPropertyOrPath(path, value, shouldNotify, isPathNotification) { if (isPathNotification || Polymer.Path.root(Array.isArray(path) ? path[0] : path) !== path) { // Dirty check changes being set to a path against the actual object, // since this is the entry point for paths into the system; from here // the only dirty checks are against the `__dataTemp` cache to prevent // duplicate work in the same turn only. Note, if this was a notification // of a change already set to a path (isPathNotification: true), // we always let the change through and skip the `set` since it was // already dirty checked at the point of entry and the underlying // object has already been updated if (!isPathNotification) { let old = Polymer.Path.get(this, path); path = /** @type {string} */ (Polymer.Path.set(this, path, value)); // Use property-accessor's simpler dirty check if (!path || !super._shouldPropertyChange(path, value, old)) { return false; } } this.__dataHasPaths = true; if (this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify)) { computeLinkedPaths(this, path, value); return true; } } else { if (this.__dataHasAccessor && this.__dataHasAccessor[path]) { return this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify); } else { this[path] = value; } } return false; } /** * Applies a value to a non-Polymer element/node's property. * * The implementation makes a best-effort at binding interop: * Some native element properties have side-effects when * re-setting the same value (e.g. setting `<input>.value` resets the * cursor position), so we do a dirty-check before setting the value. * However, for better interop with non-Polymer custom elements that * accept objects, we explicitly re-set object changes coming from the * Polymer world (which may include deep object changes without the * top reference changing), erring on the side of providing more * information. * * Users may override this method to provide alternate approaches. * * @param {!Node} node The node to set a property on * @param {string} prop The property to set * @param {*} value The value to set * @return {void} * @protected */ _setUnmanagedPropertyToNode(node, prop, value) { // It is a judgment call that resetting primitives is // "bad" and resettings objects is also "good"; alternatively we could // implement a whitelist of tag & property values that should never // be reset (e.g. <input>.value && <select>.value) if (value !== node[prop] || typeof value == 'object') { node[prop] = value; } } /** * Overrides the `PropertiesChanged` implementation to introduce special * dirty check logic depending on the property & value being set: * * 1. Any value set to a path (e.g. 'obj.prop': 42 or 'obj.prop': {...}) * Stored in `__dataTemp`, dirty checked against `__dataTemp` * 2. Object set to simple property (e.g. 'prop': {...}) * Stored in `__dataTemp` and `__data`, dirty checked against * `__dataTemp` by default implementation of `_shouldPropertyChange` * 3. Primitive value set to simple property (e.g. 'prop': 42) * Stored in `__data`, dirty checked against `__data` * * The dirty-check is important to prevent cycles due to two-way * notification, but paths and objects are only dirty checked against any * previous value set during this turn via a "temporary cache" that is * cleared when the last `_propertiesChanged` exits. This is so: * a. any cached array paths (e.g. 'array.3.prop') may be invalidated * due to array mutations like shift/unshift/splice; this is fine * since path changes are dirty-checked at user entry points like `set` * b. dirty-checking for objects only lasts one turn to allow the user * to mutate the object in-place and re-set it with the same identity * and have all sub-properties re-propagated in a subsequent turn. * * The temp cache is not necessarily sufficient to prevent invalid array * paths, since a splice can happen during the same turn (with pathological * user code); we could introduce a "fixup" for temporarily cached array * paths if needed: https://github.com/Polymer/polymer/issues/4227 * * @override * @param {string} property Name of the property * @param {*} value Value to set * @param {boolean=} shouldNotify True if property should fire notification * event (applies only for `notify: true` properties) * @return {boolean} Returns true if the property changed */ _setPendingProperty(property, value, shouldNotify) { let isPath = this.__dataHasPaths && Polymer.Path.isPath(property); let prevProps = isPath ? this.__dataTemp : this.__data; if (this._shouldPropertyChange(property, value, prevProps[property])) { if (!this.__dataPending) { this.__dataPending = {}; this.__dataOld = {}; } // Ensure old is captured from the last turn if (!(property in this.__dataOld)) { this.__dataOld[property] = this.__data[property]; } // Paths are stored in temporary cache (cleared at end of turn), // which is used for dirty-checking, all others stored in __data if (isPath) { this.__dataTemp[property] = value; } else { this.__data[property] = value; } // All changes go into pending property bag, passed to _propertiesChanged this.__dataPending[property] = value; // Track properties that should notify separately if (isPath || (this[TYPES.NOTIFY] && this[TYPES.NOTIFY][property])) { this.__dataToNotify = this.__dataToNotify || {}; this.__dataToNotify[property] = shouldNotify; } return true; } return false; } /** * Overrides base implementation to ensure all accessors set `shouldNotify` * to true, for per-property notification tracking. * * @override * @param {string} property Name of the property * @param {*} value Value to set * @return {void} */ _setProperty(property, value) { if (this._setPendingProperty(property, value, true)) { this._invalidateProperties(); } } /** * Overrides `PropertyAccessor`'s default async queuing of * `_propertiesChanged`: if `__dataReady` is false (has not yet been * manually flushed), the function no-ops; otherwise flushes * `_propertiesChanged` synchronously. * * @override * @return {void} */ _invalidateProperties() { if (this.__dataReady) { this._flushProperties(); } } /** * Enqueues the given client on a list of pending clients, whose * pending property changes can later be flushed via a call to * `_flushClients`. * * @param {Object} client PropertyEffects client to enqueue * @return {void} * @protected */ _enqueueClient(client) { this.__dataPendingClients = this.__dataPendingClients || []; if (client !== this) { this.__dataPendingClients.push(client); } } /** * Overrides superclass implementation. * * @return {void} * @protected */ _flushProperties() { this.__dataCounter++; super._flushProperties(); this.__dataCounter--; } /** * Flushes any clients previously enqueued via `_enqueueClient`, causing * their `_flushProperties` method to run. * * @return {void} * @protected */ _flushClients() { if (!this.__dataClientsReady) { this.__dataClientsReady = true; this._readyClients(); // Override point where accessors are turned on; importantly, // this is after clients have fully readied, providing a guarantee // that any property effects occur only after all clients are ready. this.__dataReady = true; } else { this.__enableOrFlushClients(); } } // NOTE: We ensure clients either enable or flush as appropriate. This // handles two corner cases: // (1) clients flush properly when connected/enabled before the host // enables; e.g. // (a) Templatize stamps with no properties and does not flush and // (b) the instance is inserted into dom and // (c) then the instance flushes. // (2) clients enable properly when not connected/enabled when the host // flushes; e.g. // (a) a template is runtime stamped and not yet connected/enabled // (b) a host sets a property, causing stamped dom to flush // (c) the stamped dom enables. __enableOrFlushClients() { let clients = this.__dataPendingClients; if (clients) { this.__dataPendingClients = null; for (let i=0; i < clients.length; i++) { let client = clients[i]; if (!client.__dataEnabled) { client._enableProperties(); } else if (client.__dataPending) { client._flushProperties(); } } } } /** * Perform any initial setup on client dom. Called before the first * `_flushProperties` call on client dom and before any element * observers are called. * * @return {void} * @protected */ _readyClients() { this.__enableOrFlushClients(); } /** * Sets a bag of property changes to this instance, and * synchronously processes all effects of the properties as a batch. * * Property names must be simple properties, not paths. Batched * path propagation is not supported. * * @param {Object} props Bag of one or more key-value pairs whose key is * a property and value is the new value to set for that property. * @param {boolean=} setReadOnly When true, any private values set in * `props` will be set. By default, `setProperties` will not set * `readOnly: true` root properties. * @return {void} * @public */ setProperties(props, setReadOnly) { for (let path in props) { if (setReadOnly || !this[TYPES.READ_ONLY] || !this[TYPES.READ_ONLY][path]) { //TODO(kschaaf): explicitly disallow paths in setProperty? // wildcard observers currently only pass the first changed path // in the `info` object, and you could do some odd things batching // paths, e.g. {'foo.bar': {...}, 'foo': null} this._setPendingPropertyOrPath(path, props[path], true); } } this._invalidateProperties(); } /** * Overrides `PropertyAccessors` so that property accessor * side effects are not enabled until after client dom is fully ready. * Also calls `_flushClients` callback to ensure client dom is enabled * that was not enabled as a result of flushing properties. * * @override * @return {void} */ ready() { // It is important that `super.ready()` is not called here as it // immediately turns on accessors. Instead, we wait until `readyClients` // to enable accessors to provide a guarantee that clients are ready // before processing any accessors side effects. this._flushProperties(); // If no data was pending, `_flushProperties` will not `flushClients` // so ensure this is done. if (!this.__dataClientsReady) { this._flushClients(); } // Before ready, client notifications do not trigger _flushProperties. // Therefore a flush is necessary here if data has been set. if (this.__dataPending) { this._flushProperties(); } } /** * Implements `PropertyAccessors`'s properties changed callback. * * Runs each class of effects for the batch of changed properties in * a specific order (compute, propagate, reflect, observe, notify). * * @param {!Object} currentProps Bag of all current accessor values * @param {!Object} changedProps Bag of properties changed since the last * call to `_propertiesChanged` * @param {!Object} oldProps Bag of previous values for each property * in `changedProps` * @return {void} */ _propertiesChanged(currentProps, changedProps, oldProps) { // ---------------------------- // let c = Object.getOwnPropertyNames(changedProps || {}); // window.debug && console.group(this.localName + '#' + this.id + ': ' + c); // if (window.debug) { debugger; } // ---------------------------- let hasPaths = this.__dataHasPaths; this.__dataHasPaths = false; // Compute properties runComputedEffects(this, changedProps, oldProps, hasPaths); // Clear notify properties prior to possible reentry (propagate, observe), // but after computing effects have a chance to add to them let notifyProps = this.__dataToNotify; this.__dataToNotify = null; // Propagate properties to clients this._propagatePropertyChanges(changedProps, oldProps, hasPaths); // Flush clients this._flushClients(); // Reflect properties runEffects(this, this[TYPES.REFLECT], changedProps, oldProps, hasPaths); // Observe properties runEffects(this, this[TYPES.OBSERVE], changedProps, oldProps, hasPaths); // Notify properties to host if (notifyProps) { runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths); } // Clear temporary cache at end of turn if (this.__dataCounter == 1) { this.__dataTemp = {}; } // ---------------------------- // window.debug && console.groupEnd(this.localName + '#' + this.id + ': ' + c); // ---------------------------- } /** * Called to propagate any property changes to stamped template nodes * managed by this element. * * @param {Object} changedProps Bag of changed properties * @param {Object} oldProps Bag of previous values for changed properties * @param {boolean} hasPaths True with `props` contains one or more paths * @return {void} * @protected */ _propagatePropertyChanges(changedProps, oldProps, hasPaths) { if (this[TYPES.PROPAGATE]) { runEffects(this, this[TYPES.PROPAGATE], changedProps, oldProps, hasPaths); } let templateInfo = this.__templateInfo; while (templateInfo) { runEffects(this, templateInfo.propertyEffects, changedProps, oldProps, hasPaths, templateInfo.nodeList); templateInfo = templateInfo.nextTemplateInfo; } } /** * Aliases one data path as another, such that path notifications from one * are routed to the other. * * @param {string | !Array<string|number>} to Target path to link. * @param {string | !Array<string|number>} from Source path to link. * @return {void} * @public */ linkPaths(to, from) { to = Polymer.Path.normalize(to); from = Polymer.Path.normalize(from); this.__dataLinkedPaths = this.__dataLinkedPaths || {}; this.__dataLinkedPaths[to] = from; } /** * Removes a data path alias previously established with `_linkPaths`. * * Note, the path to unlink should be the target (`to`) used when * linking the paths. * * @param {string | !Array<string|number>} path Target path to unlink. * @return {void} * @public */ unlinkPaths(path) { path = Polymer.Path.normalize(path); if (this.__dataLinkedPaths) { delete this.__dataLinkedPaths[path]; } } /** * Notify that an array has changed. * * Example: * * this.items = [ {name: 'Jim'}, {name: 'Todd'}, {name: 'Bill'} ]; * ... * this.items.splice(1, 1, {name: 'Sam'}); * this.items.push({name: 'Bob'}); * this.notifySplices('items', [ * { index: 1, removed: [{name: 'Todd'}], addedCount: 1, object: this.items, type: 'splice' }, * { index: 3, removed: [], addedCount: 1, object: this.items, type: 'splice'} * ]); * * @param {string} path Path that should be notified. * @param {Array} splices Array of splice records indicating ordered * changes that occurred to the array. Each record should have the * following fields: * * index: index at which the change occurred * * removed: array of items that were removed from this index * * addedCount: number of new items added at this index * * object: a reference to the array in question * * type: the string literal 'splice' * * Note that splice records _must_ be normalized such that they are * reported in index order (raw results from `Object.observe` are not * ordered and must be normalized/merged before notifying). * @return {void} * @public */ notifySplices(path, splices) { let info = {path: ''}; let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); notifySplices(this, array, info.path, splices); } /** * Convenience method for reading a value from a path. * * Note, if any part in the path is undefined, this method returns * `undefined` (this method does not throw when dereferencing undefined * paths). * * @param {(string|!Array<(string|number)>)} path Path to the value * to read. The path may be specified as a string (e.g. `foo.bar.baz`) * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that * bracketed expressions are not supported; string-based path parts * *must* be separated by dots. Note that when dereferencing array * indices, the index may be used as a dotted part directly * (e.g. `users.12.name` or `['users', 12, 'name']`). * @param {Object=} root Root object from which the path is evaluated. * @return {*} Value at the path, or `undefined` if any part of the path * is undefined. * @public */ get(path, root) { return Polymer.Path.get(root || this, path); } /** * Convenience method for setting a value to a path and notifying any * elements bound to the same path. * * Note, if any part in the path except for the last is undefined, * this method does nothing (this method does not throw when * dereferencing undefined paths). * * @param {(string|!Array<(string|number)>)} path Path to the value * to write. The path may be specified as a string (e.g. `'foo.bar.baz'`) * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that * bracketed expressions are not supported; string-based path parts * *must* be separated by dots. Note that when dereferencing array * indices, the index may be used as a dotted part directly * (e.g. `'users.12.name'` or `['users', 12, 'name']`). * @param {*} value Value to set at the specified path. * @param {Object=} root Root object from which the path is evaluated. * When specified, no notification will occur. * @return {void} * @public */ set(path, value, root) { if (root) { Polymer.Path.set(root, path, value); } else { if (!this[TYPES.READ_ONLY] || !this[TYPES.READ_ONLY][/** @type {string} */(path)]) { if (this._setPendingPropertyOrPath(path, value, true)) { this._invalidateProperties(); } } } } /** * Adds items onto the end of the array at the path specified. * * The arguments after `path` and return value match that of * `Array.prototype.push`. * * This method notifies other paths to the same array that a * splice occurred to the array. * * @param {string | !Array<string|number>} path Path to array. * @param {...*} items Items to push onto array * @return {number} New length of the array. * @public */ push(path, ...items) { let info = {path: ''}; let array = /** @type {Array}*/(Polymer.Path.get(this, path, info)); let len = array.length; let ret = array.push(...items); if (items.length) { notifySplice(this, array, info.path, len, items.length, []); } return ret; } /** * Removes an item from the end of array at the path specified. * * The arguments after `path` and return value match that of * `Array.prototype.pop`. * * This method notifies other paths to the same array that a * splice occurred to the array. * * @param {string | !Array<string|number>} path Path to array. * @return {*} Item that was removed. * @public */ pop(path) { let info = {path: ''}; let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); let hadLength = Boolean(array.length); let ret = array.pop(); if (hadLength) { notifySplice(this, array, info.path, array.length, 0, [ret]); } return ret; } /** * Starting from the start index specified, removes 0 or more items * from the array and inserts 0 or more new items in their place. * * The arguments after `path` and return value match that of * `Array.prototype.splice`. * * This method notifies other paths to the same array that a * splice occurred to the array. * * @param {string | !Array<string|number>} path Path to array. * @param {number} start Index from which to start removing/inserting. * @param {number} deleteCount Number of items to remove. * @param {...*} items Items to insert into array. * @return {Array} Array of removed items. * @public */ splice(path, start, deleteCount, ...items) { let info = {path : ''}; let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); // Normalize fancy native splice handling of crazy start values if (start < 0) { start = array.length - Math.floor(-start); } else if (start) { start = Math.floor(start); } // array.splice does different things based on the number of arguments // you pass in. Therefore, array.splice(0) and array.splice(0, undefined) // do different things. In the former, the whole array is cleared. In the // latter, no items are removed. // This means that we need to detect whether 1. one of the arguments // is actually passed in and then 2. determine how many arguments // we should pass on to the native array.splice // let ret; // Omit any additional arguments if they were not passed in if (arguments.length === 2) { ret = array.splice(start); // Either start was undefined and the others were defined, but in this // case we can safely pass on all arguments // // Note: this includes the case where none of the arguments were passed in, // e.g. this.splice('array'). However, if both start and deleteCount // are undefined, array.splice will not modify the array (as expected) } else { ret = array.splice(start, deleteCount, ...items); } // At the end, check whether any items were passed in (e.g. insertions) // or if the return array contains items (e.g. deletions). // Only notify if items were added or deleted. if (items.length || ret.length) { notifySplice(this, array, info.path, start, items.length, ret); } return ret; } /** * Removes an item from the beginning of array at the path specified. * * The arguments after `path` and return value match that of * `Array.prototype.pop`. * * This method notifies other paths to the same array that a * splice occurred to the array. * * @param {string | !Array<string|number>} path Path to array. * @return {*} Item that was removed. * @public */ shift(path) { let info = {path: ''}; let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); let hadLength = Boolean(array.length); let ret = array.shift(); if (hadLength) { notifySplice(this, array, info.path, 0, 0, [ret]); } return ret; } /** * Adds items onto the beginning of the array at the path specified. * * The arguments after `path` and return value match that of * `Array.prototype.push`. * * This method notifies other paths to the same array that a * splice occurred to the array. * * @param {string | !Array<string|number>} path Path to array. * @param {...*} items Items to insert info array * @return {number} New length of the array. * @public */ unshift(path, ...items) { let info = {path: ''}; let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); let ret = array.unshift(...items); if (items.length) { notifySplice(this, array, info.path, 0, items.length, []); } return ret; } /** * Notify that a path has changed. * * Example: * * this.item.user.name = 'Bob'; * this.notifyPath('item.user.name'); * * @param {string} path Path that should be notified. * @param {*=} value Value at the path (optional). * @return {void} * @public */ notifyPath(path, value) { /** @type {string} */ let propPath; if (arguments.length == 1) { // Get value if not supplied let info = {path: ''}; value = Polymer.Path.get(this, path, info); propPath = info.path; } else if (Array.isArray(path)) { // Normalize path if needed propPath = Polymer.Path.normalize(path); } else { propPath = /** @type{string} */(path); } if (this._setPendingPropertyOrPath(propPath, value, true, true)) { this._invalidateProperties(); } } /** * Equivalent to static `createReadOnlyProperty` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} property Property name * @param {boolean=} protectedSetter Creates a custom protected setter * when `true`. * @return {void} * @protected */ _createReadOnlyProperty(property, protectedSetter) { this._addPropertyEffect(property, TYPES.READ_ONLY); if (protectedSetter) { this['_set' + upper(property)] = /** @this {PropertyEffects} */function(value) { this._setProperty(property, value); }; } } /** * Equivalent to static `createPropertyObserver` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} property Property name * @param {string|function(*,*)} method Function or name of observer method to call * @param {boolean=} dynamicFn Whether the method name should be included as * a dependency to the effect. * @return {void} * @protected */ _createPropertyObserver(property, method, dynamicFn) { let info = { property, method, dynamicFn: Boolean(dynamicFn) }; this._addPropertyEffect(property, TYPES.OBSERVE, { fn: runObserverEffect, info, trigger: {name: property} }); if (dynamicFn) { this._addPropertyEffect(/** @type {string} */(method), TYPES.OBSERVE, { fn: runObserverEffect, info, trigger: {name: method} }); } } /** * Equivalent to static `createMethodObserver` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} expression Method expression * @param {boolean|Object=} dynamicFn Boolean or object map indicating * whether method names should be included as a dependency to the effect. * @return {void} * @protected */ _createMethodObserver(expression, dynamicFn) { let sig = parseMethod(expression); if (!sig) { throw new Error("Malformed observer expression '" + expression + "'"); } createMethodEffect(this, sig, TYPES.OBSERVE, runMethodEffect, null, dynamicFn); } /** * Equivalent to static `createNotifyingProperty` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} property Property name * @return {void} * @protected */ _createNotifyingProperty(property) { this._addPropertyEffect(property, TYPES.NOTIFY, { fn: runNotifyEffect, info: { eventName: CaseMap.camelToDashCase(property) + '-changed', property: property } }); } /** * Equivalent to static `createReflectedProperty` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} property Property name * @return {void} * @protected */ _createReflectedProperty(property) { let attr = this.constructor.attributeNameForProperty(property); if (attr[0] === '-') { console.warn('Property ' + property + ' cannot be reflected to attribute ' + attr + ' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property instead.'); } else { this._addPropertyEffect(property, TYPES.REFLECT, { fn: runReflectEffect, info: { attrName: attr } }); } } /** * Equivalent to static `createComputedProperty` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * @param {string} property Name of computed property to set * @param {string} expression Method expression * @param {boolean|Object=} dynamicFn Boolean or object map indicating * whether method names should be included as a dependency to the effect. * @return {void} * @protected */ _createComputedProperty(property, expression, dynamicFn) { let sig = parseMethod(expression); if (!sig) { throw new Error("Malformed computed expression '" + expression + "'"); } createMethodEffect(this, sig, TYPES.COMPUTE, runComputedEffect, property, dynamicFn); } /** * Gather the argument values for a method specified in the provided array * of argument metadata. * * The `path` and `value` arguments are used to fill in wildcard descriptor * when the method is being called as a result of a path notification. * * @param {!Array<!MethodArg>} args Array of argument metadata * @param {string} path Property/path name that triggered the method effect * @param {Object} props Bag of current property changes * @return {Array<*>} Array of argument values * @private */ _marshalArgs(args, path, props) { const data = this.__data; let values = []; for (let i=0, l=args.length; i<l; i++) { let arg = args[i]; let name = arg.name; let v; if (arg.literal) { v = arg.value; } else { if (arg.structured) { v = Polymer.Path.get(data, name); // when data is not stored e.g. `splices` if (v === undefined) { v = props[name]; } } else { v = data[name]; } } if (arg.wildcard) { // Only send the actual path changed info if the change that // caused the observer to run matched the wildcard let baseChanged = (name.indexOf(path + '.') === 0); let matches = (path.indexOf(name) === 0 && !baseChanged); values[i] = { path: matches ? path : name, value: matches ? props[path] : v, base: v }; } else { values[i] = v; } } return values; } // -- static class methods ------------ /** * Ensures an accessor exists for the specified property, and adds * to a list of "property effects" that will run when the accessor for * the specified property is set. Effects are grouped by "type", which * roughly corresponds to a phase in effect processing. The effect * metadata should be in the following form: * * { * fn: effectFunction, // Reference to function to call to perform effect * info: { ... } // Effect metadata passed to function * trigger: { // Optional triggering metadata; if not provided * name: string // the property is treated as a wildcard * structured: boolean * wildcard: boolean * } * } * * Effects are called from `_propertiesChanged` in the following order by * type: * * 1. COMPUTE * 2. PROPAGATE * 3. REFLECT * 4. OBSERVE * 5. NOTIFY * * Effect functions are called with the following signature: * * effectFunction(inst, path, props, oldProps, info, hasPaths) * * @param {string} property Property that should trigger the effect * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES * @param {Object=} effect Effect metadata object * @return {void} * @protected */ static addPropertyEffect(property, type, effect) { this.prototype._addPropertyEffect(property, type, effect); } /** * Creates a single-property observer for the given property. * * @param {string} property Property name * @param {string|function(*,*)} method Function or name of observer method to call * @param {boolean=} dynamicFn Whether the method name should be included as * a dependency to the effect. * @return {void} * @protected */ static createPropertyObserver(property, method, dynamicFn) { this.prototype._createPropertyObserver(property, method, dynamicFn); } /** * Creates a multi-property "method observer" based on the provided * expression, which should be a string in the form of a normal JavaScript * function signature: `'methodName(arg1, [..., argn])'`. Each argument * should correspond to a property or path in the context of this * prototype (or instance), or may be a literal string or number. * * @param {string} expression Method expression * @param {boolean|Object=} dynamicFn Boolean or object map indicating * @return {void} * whether method names should be included as a dependency to the effect. * @protected */ static createMethodObserver(expression, dynamicFn) { this.prototype._createMethodObserver(expression, dynamicFn); } /** * Causes the setter for the given property to dispatch `<property>-changed` * events to notify of changes to the property. * * @param {string} property Property name * @return {void} * @protected */ static createNotifyingProperty(property) { this.prototype._createNotifyingProperty(property); } /** * Creates a read-only accessor for the given property. * * To set the property, use the protected `_setProperty` API. * To create a custom protected setter (e.g. `_setMyProp()` for * property `myProp`), pass `true` for `protectedSetter`. * * Note, if the property will have other property effects, this method * should be called first, before adding other effects. * * @param {string} property Property name * @param {boolean=} protectedSetter Creates a custom protected setter * when `true`. * @return {void} * @protected */ static createReadOnlyProperty(property, protectedSetter) { this.prototype._createReadOnlyProperty(property, protectedSetter); } /** * Causes the setter for the given property to reflect the property value * to a (dash-cased) attribute of the same name. * * @param {string} property Property name * @return {void} * @protected */ static createReflectedProperty(property) { this.prototype._createReflectedProperty(property); } /** * Creates a computed property whose value is set to the result of the * method described by the given `expression` each time one or more * arguments to the method changes. The expression should be a string * in the form of a normal JavaScript function signature: * `'methodName(arg1, [..., argn])'` * * @param {string} property Name of computed property to set * @param {string} expression Method expression * @param {boolean|Object=} dynamicFn Boolean or object map indicating whether * method names should be included as a dependency to the effect. * @return {void} * @protected */ static createComputedProperty(property, expression, dynamicFn) { this.prototype._createComputedProperty(property, expression, dynamicFn); } /** * Parses the provided template to ensure binding effects are created * for them, and then ensures property accessors are created for any * dependent properties in the template. Binding effects for bound * templates are stored in a linked list on the instance so that * templates can be efficiently stamped and unstamped. * * @param {!HTMLTemplateElement} template Template containing binding * bindings * @return {!TemplateInfo} Template metadata object * @protected */ static bindTemplate(template) { return this.prototype._bindTemplate(template); } // -- binding ---------------------------------------------- /** * Equivalent to static `bindTemplate` API but can be called on * an instance to add effects at runtime. See that method for * full API docs. * * This method may be called on the prototype (for prototypical template * binding, to avoid creating accessors every instance) once per prototype, * and will be called with `runtimeBinding: true` by `_stampTemplate` to * create and link an instance of the template metadata associated with a * particular stamping. * * @param {!HTMLTemplateElement} template Template containing binding * bindings * @param {boolean=} instanceBinding When false (default), performs * "prototypical" binding of the template and overwrites any previously * bound template for the class. When true (as passed from * `_stampTemplate`), the template info is instanced and linked into * the list of bound templates. * @return {!TemplateInfo} Template metadata object; for `runtimeBinding`, * this is an instance of the prototypical template info * @protected */ _bindTemplate(template, instanceBinding) { let templateInfo = this.constructor._parseTemplate(template); let wasPreBound = this.__templateInfo == templateInfo; // Optimization: since this is called twice for proto-bound templates, // don't attempt to recreate accessors if this template was pre-bound if (!wasPreBound) { for (let prop in templateInfo.propertyEffects) { this._createPropertyAccessor(prop); } } if (instanceBinding) { // For instance-time binding, create instance of template metadata // and link into list of templates if necessary templateInfo = /** @type {!TemplateInfo} */(Object.create(templateInfo)); templateInfo.wasPreBound = wasPreBound; if (!wasPreBound && this.__templateInfo) { let last = this.__templateInfoLast || this.__templateInfo; this.__templateInfoLast = last.nextTemplateInfo = templateInfo; templateInfo.previousTemplateInfo = last; return templateInfo; } } return this.__templateInfo = templateInfo; } /** * Adds a property effect to the given template metadata, which is run * at the "propagate" stage of `_propertiesChanged` when the template * has been bound to the element via `_bindTemplate`. * * The `effect` object should match the format in `_addPropertyEffect`. * * @param {Object} templateInfo Template metadata to add effect to * @param {string} prop Property that should trigger the effect * @param {Object=} effect Effect metadata object * @return {void} * @protected */ static _addTemplatePropertyEffect(templateInfo, prop, effect) { let hostProps = templateInfo.hostProps = templateInfo.hostProps || {}; hostProps[prop] = true; let effects = templateInfo.propertyEffects = templateInfo.propertyEffects || {}; let propEffects = effects[prop] = effects[prop] || []; propEffects.push(effect); } /** * Stamps the provided template and performs instance-time setup for * Polymer template features, including data bindings, declarative event * listeners, and the `this.$` map of `id`'s to nodes. A document fragment * is returned containing the stamped DOM, ready for insertion into the * DOM. * * This method may be called more than once; however note that due to * `shadycss` polyfill limitations, only styles from templates prepared * using `ShadyCSS.prepareTemplate` will be correctly polyfilled (scoped * to the shadow root and support CSS custom properties), and note that * `ShadyCSS.prepareTemplate` may only be called once per element. As such, * any styles required by in runtime-stamped templates must be included * in the main element template. * * @param {!HTMLTemplateElement} template Template to stamp * @return {!StampedTemplate} Cloned template content * @override * @protected */ _stampTemplate(template) { // Ensures that created dom is `_enqueueClient`'d to this element so // that it can be flushed on next call to `_flushProperties` hostStack.beginHosting(this); let dom = super._stampTemplate(template); hostStack.endHosting(this); let templateInfo = /** @type {!TemplateInfo} */(this._bindTemplate(template, true)); // Add template-instance-specific data to instanced templateInfo templateInfo.nodeList = dom.nodeList; // Capture child nodes to allow unstamping of non-prototypical templates if (!templateInfo.wasPreBound) { let nodes = templateInfo.childNodes = []; for (let n=dom.firstChild; n; n=n.nextSibling) { nodes.push(n); } } dom.templateInfo = templateInfo; // Setup compound storage, 2-way listeners, and dataHost for bindings setupBindings(this, templateInfo); // Flush properties into template nodes if already booted if (this.__dataReady) { runEffects(this, templateInfo.propertyEffects, this.__data, null, false, templateInfo.nodeList); } return dom; } /** * Removes and unbinds the nodes previously contained in the provided * DocumentFragment returned from `_stampTemplate`. * * @param {!StampedTemplate} dom DocumentFragment previously returned * from `_stampTemplate` associated with the nodes to be removed * @return {void} * @protected */ _removeBoundDom(dom) { // Unlink template info let templateInfo = dom.templateInfo; if (templateInfo.previousTemplateInfo) { templateInfo.previousTemplateInfo.nextTemplateInfo = templateInfo.nextTemplateInfo; } if (templateInfo.nextTemplateInfo) { templateInfo.nextTemplateInfo.previousTemplateInfo = templateInfo.previousTemplateInfo; } if (this.__templateInfoLast == templateInfo) { this.__templateInfoLast = templateInfo.previousTemplateInfo; } templateInfo.previousTemplateInfo = templateInfo.nextTemplateInfo = null; // Remove stamped nodes let nodes = templateInfo.childNodes; for (let i=0; i<nodes.length; i++) { let node = nodes[i]; node.parentNode.removeChild(node); } } /** * Overrides default `TemplateStamp` implementation to add support for * parsing bindings from `TextNode`'s' `textContent`. A `bindings` * array is added to `nodeInfo` and populated with binding metadata * with information capturing the binding target, and a `parts` array * with one or more metadata objects capturing the source(s) of the * binding. * * @override * @param {Node} node Node to parse * @param {TemplateInfo} templateInfo Template metadata for current template * @param {NodeInfo} nodeInfo Node metadata for current template node * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _parseTemplateNode(node, templateInfo, nodeInfo) { let noted = super._parseTemplateNode(node, templateInfo, nodeInfo); if (node.nodeType === Node.TEXT_NODE) { let parts = this._parseBindings(node.textContent, templateInfo); if (parts) { // Initialize the textContent with any literal parts // NOTE: default to a space here so the textNode remains; some browsers // (IE) omit an empty textNode following cloneNode/importNode. node.textContent = literalFromParts(parts) || ' '; addBinding(this, templateInfo, nodeInfo, 'text', 'textContent', parts); noted = true; } } return noted; } /** * Overrides default `TemplateStamp` implementation to add support for * parsing bindings from attributes. A `bindings` * array is added to `nodeInfo` and populated with binding metadata * with information capturing the binding target, and a `parts` array * with one or more metadata objects capturing the source(s) of the * binding. * * @override * @param {Element} node Node to parse * @param {TemplateInfo} templateInfo Template metadata for current template * @param {NodeInfo} nodeInfo Node metadata for current template node * @param {string} name Attribute name * @param {string} value Attribute value * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { let parts = this._parseBindings(value, templateInfo); if (parts) { // Attribute or property let origName = name; let kind = 'property'; // The only way we see a capital letter here is if the attr has // a capital letter in it per spec. In this case, to make sure // this binding works, we go ahead and make the binding to the attribute. if (capitalAttributeRegex.test(name)) { kind = 'attribute'; } else if (name[name.length-1] == '$') { name = name.slice(0, -1); kind = 'attribute'; } // Initialize attribute bindings with any literal parts let literal = literalFromParts(parts); if (literal && kind == 'attribute') { // Ensure a ShadyCSS template scoped style is not removed // when a class$ binding's initial literal value is set. if (name == 'class' && node.hasAttribute('class')) { literal += ' ' + node.getAttribute(name); } node.setAttribute(name, literal); } // Clear attribute before removing, since IE won't allow removing // `value` attribute if it previously had a value (can't // unconditionally set '' before removing since attributes with `$` // can't be set using setAttribute) if (node.localName === 'input' && origName === 'value') { node.setAttribute(origName, ''); } // Remove annotation node.removeAttribute(origName); // Case hackery: attributes are lower-case, but bind targets // (properties) are case sensitive. Gambit is to map dash-case to // camel-case: `foo-bar` becomes `fooBar`. // Attribute bindings are excepted. if (kind === 'property') { name = Polymer.CaseMap.dashToCamelCase(name); } addBinding(this, templateInfo, nodeInfo, kind, name, parts, literal); return true; } else { return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value); } } /** * Overrides default `TemplateStamp` implementation to add support for * binding the properties that a nested template depends on to the template * as `_host_<property>`. * * @override * @param {Node} node Node to parse * @param {TemplateInfo} templateInfo Template metadata for current template * @param {NodeInfo} nodeInfo Node metadata for current template node * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) { let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo); // Merge host props into outer template and add bindings let hostProps = nodeInfo.templateInfo.hostProps; let mode = '{'; for (let source in hostProps) { let parts = [{ mode, source, dependencies: [source] }]; addBinding(this, templateInfo, nodeInfo, 'property', '_host_' + source, parts); } return noted; } /** * Called to parse text in a template (either attribute values or * textContent) into binding metadata. * * Any overrides of this method should return an array of binding part * metadata representing one or more bindings found in the provided text * and any "literal" text in between. Any non-literal parts will be passed * to `_evaluateBinding` when any dependencies change. The only required * fields of each "part" in the returned array are as follows: * * - `dependencies` - Array containing trigger metadata for each property * that should trigger the binding to update * - `literal` - String containing text if the part represents a literal; * in this case no `dependencies` are needed * * Additional metadata for use by `_evaluateBinding` may be provided in * each part object as needed. * * The default implementation handles the following types of bindings * (one or more may be intermixed with literal strings): * - Property binding: `[[prop]]` * - Path binding: `[[object.prop]]` * - Negated property or path bindings: `[[!prop]]` or `[[!object.prop]]` * - Two-way property or path bindings (supports negation): * `{{prop}}`, `{{object.prop}}`, `{{!prop}}` or `{{!object.prop}}` * - Inline computed method (supports negation): * `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]` * * The default implementation uses a regular expression for best * performance. However, the regular expression uses a white-list of * allowed characters in a data-binding, which causes problems for * data-bindings that do use characters not in this white-list. * * Instead of updating the white-list with all allowed characters, * there is a StrictBindingParser (see lib/mixins/strict-binding-parser) * that uses a state machine instead. This state machine is able to handle * all characters. However, it is slightly less performant, therefore we * extracted it into a separate optional mixin. * * @param {string} text Text to parse from attribute or textContent * @param {Object} templateInfo Current template metadata * @return {Array<!BindingPart>} Array of binding part metadata * @protected */ static _parseBindings(text, templateInfo) { let parts = []; let lastIndex = 0; let m; // Example: "literal1{{prop}}literal2[[!compute(foo,bar)]]final" // Regex matches: // Iteration 1: Iteration 2: // m[1]: '{{' '[[' // m[2]: '' '!' // m[3]: 'prop' 'compute(foo,bar)' while ((m = bindingRegex.exec(text)) !== null) { // Add literal part if (m.index > lastIndex) { parts.push({literal: text.slice(lastIndex, m.index)}); } // Add binding part let mode = m[1][0]; let negate = Boolean(m[2]); let source = m[3].trim(); let customEvent = false, notifyEvent = '', colon = -1; if (mode == '{' && (colon = source.indexOf('::')) > 0) { notifyEvent = source.substring(colon + 2); source = source.substring(0, colon); customEvent = true; } let signature = parseMethod(source); let dependencies = []; if (signature) { // Inline computed function let {args, methodName} = signature; for (let i=0; i<args.length; i++) { let arg = args[i]; if (!arg.literal) { dependencies.push(arg); } } let dynamicFns = templateInfo.dynamicFns; if (dynamicFns && dynamicFns[methodName] || signature.static) { dependencies.push(methodName); signature.dynamicFn = true; } } else { // Property or path dependencies.push(source); } parts.push({ source, mode, negate, customEvent, signature, dependencies, event: notifyEvent }); lastIndex = bindingRegex.lastIndex; } // Add a final literal part if (lastIndex && lastIndex < text.length) { let literal = text.substring(lastIndex); if (literal) { parts.push({ literal: literal }); } } if (parts.length) { return parts; } else { return null; } } /** * Called to evaluate a previously parsed binding part based on a set of * one or more changed dependencies. * * @param {this} inst Element that should be used as scope for * binding dependencies * @param {BindingPart} part Binding part metadata * @param {string} path Property/path that triggered this effect * @param {Object} props Bag of current property changes * @param {Object} oldProps Bag of previous values for changed properties * @param {boolean} hasPaths True with `props` contains one or more paths * @return {*} Value the binding part evaluated to * @protected */ static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) { let value; if (part.signature) { value = runMethodEffect(inst, path, props, oldProps, part.signature); } else if (path != part.source) { value = Polymer.Path.get(inst, part.source); } else { if (hasPaths && Polymer.Path.isPath(path)) { value = Polymer.Path.get(inst, path); } else { value = inst.__data[path]; } } if (part.negate) { value = !value; } return value; } } // make a typing for closure :P PropertyEffectsType = PropertyEffects; return PropertyEffects; }); /** * Helper api for enqueuing client dom created by a host element. * * By default elements are flushed via `_flushProperties` when * `connectedCallback` is called. Elements attach their client dom to * themselves at `ready` time which results from this first flush. * This provides an ordering guarantee that the client dom an element * creates is flushed before the element itself (i.e. client `ready` * fires before host `ready`). * * However, if `_flushProperties` is called *before* an element is connected, * as for example `Templatize` does, this ordering guarantee cannot be * satisfied because no elements are connected. (Note: Bound elements that * receive data do become enqueued clients and are properly ordered but * unbound elements are not.) * * To maintain the desired "client before host" ordering guarantee for this * case we rely on the "host stack. Client nodes registers themselves with * the creating host element when created. This ensures that all client dom * is readied in the proper order, maintaining the desired guarantee. * * @private */ let hostStack = { stack: [], /** * @param {*} inst Instance to add to hostStack * @return {void} * @this {hostStack} */ registerHost(inst) { if (this.stack.length) { let host = this.stack[this.stack.length-1]; host._enqueueClient(inst); } }, /** * @param {*} inst Instance to begin hosting * @return {void} * @this {hostStack} */ beginHosting(inst) { this.stack.push(inst); }, /** * @param {*} inst Instance to end hosting * @return {void} * @this {hostStack} */ endHosting(inst) { let stackLen = this.stack.length; if (stackLen && this.stack[stackLen-1] == inst) { this.stack.pop(); } } }; })(); (function() { 'use strict'; /** * Provides basic tracking of element definitions (registrations) and * instance counts. * * @namespace * @summary Provides basic tracking of element definitions (registrations) and * instance counts. */ Polymer.telemetry = { /** * Total number of Polymer element instances created. * @type {number} */ instanceCount: 0, /** * Array of Polymer element classes that have been finalized. * @type {Array<Polymer.Element>} */ registrations: [], /** * @param {!PolymerElementConstructor} prototype Element prototype to log * @this {this} * @private */ _regLog: function(prototype) { console.log('[' + prototype.is + ']: registered'); }, /** * Registers a class prototype for telemetry purposes. * @param {HTMLElement} prototype Element prototype to register * @this {this} * @protected */ register: function(prototype) { this.registrations.push(prototype); Polymer.log && this._regLog(prototype); }, /** * Logs all elements registered with an `is` to the console. * @public * @this {this} */ dumpRegistrations: function() { this.registrations.forEach(this._regLog); } }; })(); (function() { 'use strict'; /** * Creates a copy of `props` with each property normalized such that * upgraded it is an object with at least a type property { type: Type}. * * @param {Object} props Properties to normalize * @return {Object} Copy of input `props` with normalized properties that * are in the form {type: Type} * @private */ function normalizeProperties(props) { const output = {}; for (let p in props) { const o = props[p]; output[p] = (typeof o === 'function') ? {type: o} : o; } return output; } /** * Mixin that provides a minimal starting point to using the PropertiesChanged * mixin by providing a mechanism to declare properties in a static * getter (e.g. static get properties() { return { foo: String } }). Changes * are reported via the `_propertiesChanged` method. * * This mixin provides no specific support for rendering. Users are expected * to create a ShadowRoot and put content into it and update it in whatever * way makes sense. This can be done in reaction to properties changing by * implementing `_propertiesChanged`. * * @mixinFunction * @polymer * @appliesMixin Polymer.PropertiesChanged * @memberof Polymer * @summary Mixin that provides a minimal starting point for using * the PropertiesChanged mixin by providing a declarative `properties` object. */ Polymer.PropertiesMixin = Polymer.dedupingMixin(superClass => { /** * @constructor * @extends {superClass} * @implements {Polymer_PropertiesChanged} * @private */ const base = Polymer.PropertiesChanged(superClass); /** * Returns the super class constructor for the given class, if it is an * instance of the PropertiesMixin. * * @param {!PropertiesMixinConstructor} constructor PropertiesMixin constructor * @return {PropertiesMixinConstructor} Super class constructor */ function superPropertiesClass(constructor) { const superCtor = Object.getPrototypeOf(constructor); // Note, the `PropertiesMixin` class below only refers to the class // generated by this call to the mixin; the instanceof test only works // because the mixin is deduped and guaranteed only to apply once, hence // all constructors in a proto chain will see the same `PropertiesMixin` return (superCtor.prototype instanceof PropertiesMixin) ? /** @type {PropertiesMixinConstructor} */ (superCtor) : null; } /** * Returns a memoized version of the `properties` object for the * given class. Properties not in object format are converted to at * least {type}. * * @param {PropertiesMixinConstructor} constructor PropertiesMixin constructor * @return {Object} Memoized properties object */ function ownProperties(constructor) { if (!constructor.hasOwnProperty(JSCompiler_renameProperty('__ownProperties', constructor))) { let props = null; if (constructor.hasOwnProperty(JSCompiler_renameProperty('properties', constructor))) { const properties = constructor.properties; if (properties) { props = normalizeProperties(properties); } } constructor.__ownProperties = props; } return constructor.__ownProperties; } /** * @polymer * @mixinClass * @extends {base} * @implements {Polymer_PropertiesMixin} * @unrestricted */ class PropertiesMixin extends base { /** * Implements standard custom elements getter to observes the attributes * listed in `properties`. * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static get observedAttributes() { if (!this.hasOwnProperty('__observedAttributes')) { Polymer.telemetry.register(this.prototype); const props = this._properties; this.__observedAttributes = props ? Object.keys(props).map(p => this.attributeNameForProperty(p)) : []; } return this.__observedAttributes; } /** * Finalizes an element definition, including ensuring any super classes * are also finalized. This includes ensuring property * accessors exist on the element prototype. This method calls * `_finalizeClass` to finalize each constructor in the prototype chain. * @return {void} */ static finalize() { if (!this.hasOwnProperty(JSCompiler_renameProperty('__finalized', this))) { const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this)); if (superCtor) { superCtor.finalize(); } this.__finalized = true; this._finalizeClass(); } } /** * Finalize an element class. This includes ensuring property * accessors exist on the element prototype. This method is called by * `finalize` and finalizes the class constructor. * * @protected */ static _finalizeClass() { const props = ownProperties(/** @type {PropertiesMixinConstructor} */(this)); if (props) { this.createProperties(props); } } /** * Returns a memoized version of all properties, including those inherited * from super classes. Properties not in object format are converted to * at least {type}. * * @return {Object} Object containing properties for this class * @protected */ static get _properties() { if (!this.hasOwnProperty( JSCompiler_renameProperty('__properties', this))) { const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this)); this.__properties = Object.assign({}, superCtor && superCtor._properties, ownProperties(/** @type {PropertiesMixinConstructor} */(this))); } return this.__properties; } /** * Overrides `PropertiesChanged` method to return type specified in the * static `properties` object for the given property. * @param {string} name Name of property * @return {*} Type to which to deserialize attribute * * @protected */ static typeForProperty(name) { const info = this._properties[name]; return info && info.type; } /** * Overrides `PropertiesChanged` method and adds a call to * `finalize` which lazily configures the element's property accessors. * @override * @return {void} */ _initializeProperties() { Polymer.telemetry.instanceCount++; this.constructor.finalize(); super._initializeProperties(); } /** * Called when the element is added to a document. * Calls `_enableProperties` to turn on property system from * `PropertiesChanged`. * @suppress {missingProperties} Super may or may not implement the callback * @return {void} */ connectedCallback() { if (super.connectedCallback) { super.connectedCallback(); } this._enableProperties(); } /** * Called when the element is removed from a document * @suppress {missingProperties} Super may or may not implement the callback * @return {void} */ disconnectedCallback() { if (super.disconnectedCallback) { super.disconnectedCallback(); } } } return PropertiesMixin; }); })(); (function() { 'use strict'; const builtCSS = window.ShadyCSS && window.ShadyCSS['cssBuild']; /** * Element class mixin that provides the core API for Polymer's meta-programming * features including template stamping, data-binding, attribute deserialization, * and property change observation. * * Subclassers may provide the following static getters to return metadata * used to configure Polymer's features for the class: * * - `static get is()`: When the template is provided via a `dom-module`, * users should return the `dom-module` id from a static `is` getter. If * no template is needed or the template is provided directly via the * `template` getter, there is no need to define `is` for the element. * * - `static get template()`: Users may provide the template directly (as * opposed to via `dom-module`) by implementing a static `template` getter. * The getter may return an `HTMLTemplateElement` or a string, which will * automatically be parsed into a template. * * - `static get properties()`: Should return an object describing * property-related metadata used by Polymer features (key: property name * value: object containing property metadata). Valid keys in per-property * metadata include: * - `type` (String|Number|Object|Array|...): Used by * `attributeChangedCallback` to determine how string-based attributes * are deserialized to JavaScript property values. * - `notify` (boolean): Causes a change in the property to fire a * non-bubbling event called `<property>-changed`. Elements that have * enabled two-way binding to the property use this event to observe changes. * - `readOnly` (boolean): Creates a getter for the property, but no setter. * To set a read-only property, use the private setter method * `_setProperty(property, value)`. * - `observer` (string): Observer method name that will be called when * the property changes. The arguments of the method are * `(value, previousValue)`. * - `computed` (string): String describing method and dependent properties * for computing the value of this property (e.g. `'computeFoo(bar, zot)'`). * Computed properties are read-only by default and can only be changed * via the return value of the computing method. * * - `static get observers()`: Array of strings describing multi-property * observer methods and their dependent properties (e.g. * `'observeABC(a, b, c)'`). * * The base class provides default implementations for the following standard * custom element lifecycle callbacks; users may override these, but should * call the super method to ensure * - `constructor`: Run when the element is created or upgraded * - `connectedCallback`: Run each time the element is connected to the * document * - `disconnectedCallback`: Run each time the element is disconnected from * the document * - `attributeChangedCallback`: Run each time an attribute in * `observedAttributes` is set or removed (note: this element's default * `observedAttributes` implementation will automatically return an array * of dash-cased attributes based on `properties`) * * @mixinFunction * @polymer * @appliesMixin Polymer.PropertyEffects * @appliesMixin Polymer.PropertiesMixin * @memberof Polymer * @property rootPath {string} Set to the value of `Polymer.rootPath`, * which defaults to the main document path * @property importPath {string} Set to the value of the class's static * `importPath` property, which defaults to the path of this element's * `dom-module` (when `is` is used), but can be overridden for other * import strategies. * @summary Element class mixin that provides the core API for Polymer's * meta-programming features. */ Polymer.ElementMixin = Polymer.dedupingMixin(base => { /** * @constructor * @extends {base} * @implements {Polymer_PropertyEffects} * @implements {Polymer_PropertiesMixin} * @private */ const polymerElementBase = Polymer.PropertiesMixin(Polymer.PropertyEffects(base)); /** * Returns a list of properties with default values. * This list is created as an optimization since it is a subset of * the list returned from `_properties`. * This list is used in `_initializeProperties` to set property defaults. * * @param {PolymerElementConstructor} constructor Element class * @return {PolymerElementProperties} Flattened properties for this class * that have default values * @private */ function propertyDefaults(constructor) { if (!constructor.hasOwnProperty( JSCompiler_renameProperty('__propertyDefaults', constructor))) { constructor.__propertyDefaults = null; let props = constructor._properties; for (let p in props) { let info = props[p]; if ('value' in info) { constructor.__propertyDefaults = constructor.__propertyDefaults || {}; constructor.__propertyDefaults[p] = info; } } } return constructor.__propertyDefaults; } /** * Returns a memoized version of the `observers` array. * @param {PolymerElementConstructor} constructor Element class * @return {Array} Array containing own observers for the given class * @protected */ function ownObservers(constructor) { if (!constructor.hasOwnProperty( JSCompiler_renameProperty('__ownObservers', constructor))) { constructor.__ownObservers = constructor.hasOwnProperty(JSCompiler_renameProperty('observers', constructor)) ? /** @type {PolymerElementConstructor} */ (constructor).observers : null; } return constructor.__ownObservers; } /** * Creates effects for a property. * * Note, once a property has been set to * `readOnly`, `computed`, `reflectToAttribute`, or `notify` * these values may not be changed. For example, a subclass cannot * alter these settings. However, additional `observers` may be added * by subclasses. * * The info object should contain property metadata as follows: * * * `type`: {function} type to which an attribute matching the property * is deserialized. Note the property is camel-cased from a dash-cased * attribute. For example, 'foo-bar' attribute is deserialized to a * property named 'fooBar'. * * * `readOnly`: {boolean} creates a readOnly property and * makes a private setter for the private of the form '_setFoo' for a * property 'foo', * * * `computed`: {string} creates a computed property. A computed property * is also automatically set to `readOnly: true`. The value is calculated * by running a method and arguments parsed from the given string. For * example 'compute(foo)' will compute a given property when the * 'foo' property changes by executing the 'compute' method. This method * must return the computed value. * * * `reflectToAttribute`: {boolean} If true, the property value is reflected * to an attribute of the same name. Note, the attribute is dash-cased * so a property named 'fooBar' is reflected as 'foo-bar'. * * * `notify`: {boolean} sends a non-bubbling notification event when * the property changes. For example, a property named 'foo' sends an * event named 'foo-changed' with `event.detail` set to the value of * the property. * * * observer: {string} name of a method that runs when the property * changes. The arguments of the method are (value, previousValue). * * Note: Users may want control over modifying property * effects via subclassing. For example, a user might want to make a * reflectToAttribute property not do so in a subclass. We've chosen to * disable this because it leads to additional complication. * For example, a readOnly effect generates a special setter. If a subclass * disables the effect, the setter would fail unexpectedly. * Based on feedback, we may want to try to make effects more malleable * and/or provide an advanced api for manipulating them. * Also consider adding warnings when an effect cannot be changed. * * @param {!PolymerElement} proto Element class prototype to add accessors * and effects to * @param {string} name Name of the property. * @param {Object} info Info object from which to create property effects. * Supported keys: * @param {Object} allProps Flattened map of all properties defined in this * element (including inherited properties) * @return {void} * @private */ function createPropertyFromConfig(proto, name, info, allProps) { // computed forces readOnly... if (info.computed) { info.readOnly = true; } // Note, since all computed properties are readOnly, this prevents // adding additional computed property effects (which leads to a confusing // setup where multiple triggers for setting a property) // While we do have `hasComputedEffect` this is set on the property's // dependencies rather than itself. if (info.computed && !proto._hasReadOnlyEffect(name)) { proto._createComputedProperty(name, info.computed, allProps); } if (info.readOnly && !proto._hasReadOnlyEffect(name)) { proto._createReadOnlyProperty(name, !info.computed); } if (info.reflectToAttribute && !proto._hasReflectEffect(name)) { proto._createReflectedProperty(name); } if (info.notify && !proto._hasNotifyEffect(name)) { proto._createNotifyingProperty(name); } // always add observer if (info.observer) { proto._createPropertyObserver(name, info.observer, allProps[info.observer]); } // always create the mapping from attribute back to property for deserialization. proto._addPropertyToAttributeMap(name); } /** * Process all style elements in the element template. Styles with the * `include` attribute are processed such that any styles in * the associated "style modules" are included in the element template. * @param {PolymerElementConstructor} klass Element class * @param {!HTMLTemplateElement} template Template to process * @param {string} is Name of element * @param {string} baseURI Base URI for element * @private */ function processElementStyles(klass, template, is, baseURI) { if (!builtCSS) { const templateStyles = template.content.querySelectorAll('style'); const stylesWithImports = Polymer.StyleGather.stylesFromTemplate(template); // insert styles from <link rel="import" type="css"> at the top of the template const linkedStyles = Polymer.StyleGather.stylesFromModuleImports(is); const firstTemplateChild = template.content.firstElementChild; for (let idx = 0; idx < linkedStyles.length; idx++) { let s = linkedStyles[idx]; s.textContent = klass._processStyleText(s.textContent, baseURI); template.content.insertBefore(s, firstTemplateChild); } // keep track of the last "concrete" style in the template we have encountered let templateStyleIndex = 0; // ensure all gathered styles are actually in this template. for (let i = 0; i < stylesWithImports.length; i++) { let s = stylesWithImports[i]; let templateStyle = templateStyles[templateStyleIndex]; // if the style is not in this template, it's been "included" and // we put a clone of it in the template before the style that included it if (templateStyle !== s) { s = s.cloneNode(true); templateStyle.parentNode.insertBefore(s, templateStyle); } else { templateStyleIndex++; } s.textContent = klass._processStyleText(s.textContent, baseURI); } } if (window.ShadyCSS) { window.ShadyCSS.prepareTemplate(template, is); } } /** * Look up template from dom-module for element * * @param {!string} is Element name to look up * @return {!HTMLTemplateElement} Template found in dom module, or * undefined if not found * @protected */ function getTemplateFromDomModule(is) { let template = null; if (is && Polymer.DomModule) { template = Polymer.DomModule.import(is, 'template'); // Under strictTemplatePolicy, require any element with an `is` // specified to have a dom-module if (Polymer.strictTemplatePolicy && !template) { throw new Error(`strictTemplatePolicy: expecting dom-module or null template for ${is}`); } } return template; } /** * @polymer * @mixinClass * @unrestricted * @implements {Polymer_ElementMixin} */ class PolymerElement extends polymerElementBase { /** * Override of PropertiesMixin _finalizeClass to create observers and * find the template. * @return {void} * @protected * @override * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _finalizeClass() { super._finalizeClass(); const observers = ownObservers(this); if (observers) { this.createObservers(observers, this._properties); } this._prepareTemplate(); } static _prepareTemplate() { // note: create "working" template that is finalized at instance time let template = /** @type {PolymerElementConstructor} */ (this).template; if (template) { if (typeof template === 'string') { let t = document.createElement('template'); t.innerHTML = template; template = t; } else if (!Polymer.legacyOptimizations) { template = template.cloneNode(true); } } this.prototype._template = template; } /** * Override of PropertiesChanged createProperties to create accessors * and property effects for all of the properties. * @return {void} * @protected * @override */ static createProperties(props) { for (let p in props) { createPropertyFromConfig(this.prototype, p, props[p], props); } } /** * Creates observers for the given `observers` array. * Leverages `PropertyEffects` to create observers. * @param {Object} observers Array of observer descriptors for * this class * @param {Object} dynamicFns Object containing keys for any properties * that are functions and should trigger the effect when the function * reference is changed * @return {void} * @protected */ static createObservers(observers, dynamicFns) { const proto = this.prototype; for (let i=0; i < observers.length; i++) { proto._createMethodObserver(observers[i], dynamicFns); } } /** * Returns the template that will be stamped into this element's shadow root. * * If a `static get is()` getter is defined, the default implementation * will return the first `<template>` in a `dom-module` whose `id` * matches this element's `is`. * * Users may override this getter to return an arbitrary template * (in which case the `is` getter is unnecessary). The template returned * may be either an `HTMLTemplateElement` or a string that will be * automatically parsed into a template. * * Note that when subclassing, if the super class overrode the default * implementation and the subclass would like to provide an alternate * template via a `dom-module`, it should override this getter and * return `Polymer.DomModule.import(this.is, 'template')`. * * If a subclass would like to modify the super class template, it should * clone it rather than modify it in place. If the getter does expensive * work such as cloning/modifying a template, it should memoize the * template for maximum performance: * * let memoizedTemplate; * class MySubClass extends MySuperClass { * static get template() { * if (!memoizedTemplate) { * memoizedTemplate = MySuperClass.template.cloneNode(true); * let subContent = document.createElement('div'); * subContent.textContent = 'This came from MySubClass'; * memoizedTemplate.content.appendChild(subContent); * } * return memoizedTemplate; * } * } * * @return {HTMLTemplateElement|string} Template to be stamped */ static get template() { // Explanation of template-related properties: // - constructor.template (this getter): the template for the class. // This can come from the prototype (for legacy elements), from a // dom-module, or from the super class's template (or can be overridden // altogether by the user) // - constructor._template: memoized version of constructor.template // - prototype._template: working template for the element, which will be // parsed and modified in place. It is a cloned version of // constructor.template, saved in _finalizeClass(). Note that before // this getter is called, for legacy elements this could be from a // _template field on the info object passed to Polymer(), a behavior, // or set in registered(); once the static getter runs, a clone of it // will overwrite it on the prototype as the working template. if (!this.hasOwnProperty(JSCompiler_renameProperty('_template', this))) { this._template = // If user has put template on prototype (e.g. in legacy via registered // callback or info object), prefer that first this.prototype.hasOwnProperty(JSCompiler_renameProperty('_template', this.prototype)) ? this.prototype._template : // Look in dom-module associated with this element's is (getTemplateFromDomModule(/** @type {PolymerElementConstructor}*/ (this).is) || // Next look for superclass template (call the super impl this // way so that `this` points to the superclass) Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.template); } return this._template; } /** * Set the template. * * @param {!HTMLTemplateElement|string} value Template to set. */ static set template(value) { this._template = value; } /** * Path matching the url from which the element was imported. * * This path is used to resolve url's in template style cssText. * The `importPath` property is also set on element instances and can be * used to create bindings relative to the import path. * * For elements defined in ES modules, users should implement * `static get importMeta() { return import.meta; }`, and the default * implementation of `importPath` will return `import.meta.url`'s path. * For elements defined in HTML imports, this getter will return the path * to the document containing a `dom-module` element matching this * element's static `is` property. * * Note, this path should contain a trailing `/`. * * @return {string} The import path for this element class * @suppress {missingProperties} */ static get importPath() { if (!this.hasOwnProperty(JSCompiler_renameProperty('_importPath', this))) { const meta = this.importMeta; if (meta) { this._importPath = Polymer.ResolveUrl.pathFromUrl(meta.url); } else { const module = Polymer.DomModule && Polymer.DomModule.import(/** @type {PolymerElementConstructor} */ (this).is); this._importPath = (module && module.assetpath) || Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.importPath; } } return this._importPath; } constructor() { super(); /** @type {HTMLTemplateElement} */ this._template; /** @type {string} */ this._importPath; /** @type {string} */ this.rootPath; /** @type {string} */ this.importPath; /** @type {StampedTemplate | HTMLElement | ShadowRoot} */ this.root; /** @type {!Object<string, !Element>} */ this.$; } /** * Overrides the default `Polymer.PropertyAccessors` to ensure class * metaprogramming related to property accessors and effects has * completed (calls `finalize`). * * It also initializes any property defaults provided via `value` in * `properties` metadata. * * @return {void} * @override * @suppress {invalidCasts} */ _initializeProperties() { this.constructor.finalize(); // note: finalize template when we have access to `localName` to // avoid dependence on `is` for polyfilling styling. this.constructor._finalizeTemplate(/** @type {!HTMLElement} */(this).localName); super._initializeProperties(); // set path defaults this.rootPath = Polymer.rootPath; this.importPath = this.constructor.importPath; // apply property defaults... let p$ = propertyDefaults(this.constructor); if (!p$) { return; } for (let p in p$) { let info = p$[p]; // Don't set default value if there is already an own property, which // happens when a `properties` property with default but no effects had // a property set (e.g. bound) by its host before upgrade if (!this.hasOwnProperty(p)) { let value = typeof info.value == 'function' ? info.value.call(this) : info.value; // Set via `_setProperty` if there is an accessor, to enable // initializing readOnly property defaults if (this._hasAccessor(p)) { this._setPendingProperty(p, value, true); } else { this[p] = value; } } } } /** * Gather style text for a style element in the template. * * @param {string} cssText Text containing styling to process * @param {string} baseURI Base URI to rebase CSS paths against * @return {string} The processed CSS text * @protected */ static _processStyleText(cssText, baseURI) { return Polymer.ResolveUrl.resolveCss(cssText, baseURI); } /** * Configures an element `proto` to function with a given `template`. * The element name `is` and extends `ext` must be specified for ShadyCSS * style scoping. * * @param {string} is Tag name (or type extension name) for this element * @return {void} * @protected */ static _finalizeTemplate(is) { /** @const {HTMLTemplateElement} */ const template = this.prototype._template; if (template && !template.__polymerFinalized) { template.__polymerFinalized = true; const importPath = this.importPath; const baseURI = importPath ? Polymer.ResolveUrl.resolveUrl(importPath) : ''; // e.g. support `include="module-name"`, and ShadyCSS processElementStyles(this, template, is, baseURI); this.prototype._bindTemplate(template); } } /** * Provides a default implementation of the standard Custom Elements * `connectedCallback`. * * The default implementation enables the property effects system and * flushes any pending properties, and updates shimmed CSS properties * when using the ShadyCSS scoping/custom properties polyfill. * * @suppress {missingProperties, invalidCasts} Super may or may not implement the callback * @return {void} */ connectedCallback() { if (window.ShadyCSS && this._template) { window.ShadyCSS.styleElement(/** @type {!HTMLElement} */(this)); } super.connectedCallback(); } /** * Stamps the element template. * * @return {void} * @override */ ready() { if (this._template) { this.root = this._stampTemplate(this._template); this.$ = this.root.$; } super.ready(); } /** * Implements `PropertyEffects`'s `_readyClients` call. Attaches * element dom by calling `_attachDom` with the dom stamped from the * element's template via `_stampTemplate`. Note that this allows * client dom to be attached to the element prior to any observers * running. * * @return {void} * @override */ _readyClients() { if (this._template) { this.root = this._attachDom(/** @type {StampedTemplate} */(this.root)); } // The super._readyClients here sets the clients initialized flag. // We must wait to do this until after client dom is created/attached // so that this flag can be checked to prevent notifications fired // during this process from being handled before clients are ready. super._readyClients(); } /** * Attaches an element's stamped dom to itself. By default, * this method creates a `shadowRoot` and adds the dom to it. * However, this method may be overridden to allow an element * to put its dom in another location. * * @throws {Error} * @suppress {missingReturn} * @param {StampedTemplate} dom to attach to the element. * @return {ShadowRoot} node to which the dom has been attached. */ _attachDom(dom) { if (this.attachShadow) { if (dom) { if (!this.shadowRoot) { this.attachShadow({mode: 'open'}); } this.shadowRoot.appendChild(dom); return this.shadowRoot; } return null; } else { throw new Error('ShadowDOM not available. ' + // TODO(sorvell): move to compile-time conditional when supported 'Polymer.Element can create dom as children instead of in ' + 'ShadowDOM by setting `this.root = this;\` before \`ready\`.'); } } /** * When using the ShadyCSS scoping and custom property shim, causes all * shimmed styles in this element (and its subtree) to be updated * based on current custom property values. * * The optional parameter overrides inline custom property styles with an * object of properties where the keys are CSS properties, and the values * are strings. * * Example: `this.updateStyles({'--color': 'blue'})` * * These properties are retained unless a value of `null` is set. * * Note: This function does not support updating CSS mixins. * You can not dynamically change the value of an `@apply`. * * @param {Object=} properties Bag of custom property key/values to * apply to this element. * @return {void} * @suppress {invalidCasts} */ updateStyles(properties) { if (window.ShadyCSS) { window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */(this), properties); } } /** * Rewrites a given URL relative to a base URL. The base URL defaults to * the original location of the document containing the `dom-module` for * this element. This method will return the same URL before and after * bundling. * * Note that this function performs no resolution for URLs that start * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose * URL resolution, use `window.URL`. * * @param {string} url URL to resolve. * @param {string=} base Optional base URL to resolve against, defaults * to the element's `importPath` * @return {string} Rewritten URL relative to base */ resolveUrl(url, base) { if (!base && this.importPath) { base = Polymer.ResolveUrl.resolveUrl(this.importPath); } return Polymer.ResolveUrl.resolveUrl(url, base); } /** * Overrides `PropertyAccessors` to add map of dynamic functions on * template info, for consumption by `PropertyEffects` template binding * code. This map determines which method templates should have accessors * created for them. * * @override * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _parseTemplateContent(template, templateInfo, nodeInfo) { templateInfo.dynamicFns = templateInfo.dynamicFns || this._properties; return super._parseTemplateContent(template, templateInfo, nodeInfo); } } return PolymerElement; }); /** * When using the ShadyCSS scoping and custom property shim, causes all * shimmed `styles` (via `custom-style`) in the document (and its subtree) * to be updated based on current custom property values. * * The optional parameter overrides inline custom property styles with an * object of properties where the keys are CSS properties, and the values * are strings. * * Example: `Polymer.updateStyles({'--color': 'blue'})` * * These properties are retained unless a value of `null` is set. * * @param {Object=} props Bag of custom property key/values to * apply to the document. * @return {void} */ Polymer.updateStyles = function(props) { if (window.ShadyCSS) { window.ShadyCSS.styleDocument(props); } }; })(); (function() { 'use strict'; /** * @summary Collapse multiple callbacks into one invocation after a timer. * @memberof Polymer */ class Debouncer { constructor() { this._asyncModule = null; this._callback = null; this._timer = null; } /** * Sets the scheduler; that is, a module with the Async interface, * a callback and optional arguments to be passed to the run function * from the async module. * * @param {!AsyncInterface} asyncModule Object with Async interface. * @param {function()} callback Callback to run. * @return {void} */ setConfig(asyncModule, callback) { this._asyncModule = asyncModule; this._callback = callback; this._timer = this._asyncModule.run(() => { this._timer = null; this._callback(); }); } /** * Cancels an active debouncer and returns a reference to itself. * * @return {void} */ cancel() { if (this.isActive()) { this._asyncModule.cancel(this._timer); this._timer = null; } } /** * Flushes an active debouncer and returns a reference to itself. * * @return {void} */ flush() { if (this.isActive()) { this.cancel(); this._callback(); } } /** * Returns true if the debouncer is active. * * @return {boolean} True if active. */ isActive() { return this._timer != null; } /** * Creates a debouncer if no debouncer is passed as a parameter * or it cancels an active debouncer otherwise. The following * example shows how a debouncer can be called multiple times within a * microtask and "debounced" such that the provided callback function is * called once. Add this method to a custom element: * * _debounceWork() { * this._debounceJob = Polymer.Debouncer.debounce(this._debounceJob, * Polymer.Async.microTask, () => { * this._doWork(); * }); * } * * If the `_debounceWork` method is called multiple times within the same * microtask, the `_doWork` function will be called only once at the next * microtask checkpoint. * * Note: In testing it is often convenient to avoid asynchrony. To accomplish * this with a debouncer, you can use `Polymer.enqueueDebouncer` and * `Polymer.flush`. For example, extend the above example by adding * `Polymer.enqueueDebouncer(this._debounceJob)` at the end of the * `_debounceWork` method. Then in a test, call `Polymer.flush` to ensure * the debouncer has completed. * * @param {Debouncer?} debouncer Debouncer object. * @param {!AsyncInterface} asyncModule Object with Async interface * @param {function()} callback Callback to run. * @return {!Debouncer} Returns a debouncer object. */ static debounce(debouncer, asyncModule, callback) { if (debouncer instanceof Debouncer) { debouncer.cancel(); } else { debouncer = new Debouncer(); } debouncer.setConfig(asyncModule, callback); return debouncer; } } /** @const */ Polymer.Debouncer = Debouncer; })(); (function() { 'use strict'; // detect native touch action support let HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string'; let GESTURE_KEY = '__polymerGestures'; let HANDLED_OBJ = '__polymerGesturesHandled'; let TOUCH_ACTION = '__polymerGesturesTouchAction'; // radius for tap and track let TAP_DISTANCE = 25; let TRACK_DISTANCE = 5; // number of last N track positions to keep let TRACK_LENGTH = 2; // Disabling "mouse" handlers for 2500ms is enough let MOUSE_TIMEOUT = 2500; let MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'click']; // an array of bitmask values for mapping MouseEvent.which to MouseEvent.buttons let MOUSE_WHICH_TO_BUTTONS = [0, 1, 4, 2]; let MOUSE_HAS_BUTTONS = (function() { try { return new MouseEvent('test', {buttons: 1}).buttons === 1; } catch (e) { return false; } })(); /** * @param {string} name Possible mouse event name * @return {boolean} true if mouse event, false if not */ function isMouseEvent(name) { return MOUSE_EVENTS.indexOf(name) > -1; } /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */ // check for passive event listeners let SUPPORTS_PASSIVE = false; (function() { try { let opts = Object.defineProperty({}, 'passive', {get() {SUPPORTS_PASSIVE = true;}}); window.addEventListener('test', null, opts); window.removeEventListener('test', null, opts); } catch(e) {} })(); /** * Generate settings for event listeners, dependant on `Polymer.passiveTouchGestures` * * @param {string} eventName Event name to determine if `{passive}` option is needed * @return {{passive: boolean} | undefined} Options to use for addEventListener and removeEventListener */ function PASSIVE_TOUCH(eventName) { if (isMouseEvent(eventName) || eventName === 'touchend') { return; } if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.passiveTouchGestures) { return {passive: true}; } else { return; } } // Check for touch-only devices let IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/); let GestureRecognizer = function(){}; // eslint-disable-line no-unused-vars /** @type {function(): void} */ GestureRecognizer.prototype.reset; /** @type {function(MouseEvent): void | undefined} */ GestureRecognizer.prototype.mousedown; /** @type {(function(MouseEvent): void | undefined)} */ GestureRecognizer.prototype.mousemove; /** @type {(function(MouseEvent): void | undefined)} */ GestureRecognizer.prototype.mouseup; /** @type {(function(TouchEvent): void | undefined)} */ GestureRecognizer.prototype.touchstart; /** @type {(function(TouchEvent): void | undefined)} */ GestureRecognizer.prototype.touchmove; /** @type {(function(TouchEvent): void | undefined)} */ GestureRecognizer.prototype.touchend; /** @type {(function(MouseEvent): void | undefined)} */ GestureRecognizer.prototype.click; // keep track of any labels hit by the mouseCanceller /** @type {!Array<!HTMLLabelElement>} */ const clickedLabels = []; /** @type {!Object<boolean>} */ const labellable = { 'button': true, 'input': true, 'keygen': true, 'meter': true, 'output': true, 'textarea': true, 'progress': true, 'select': true }; // Defined at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute /** @type {!Object<boolean>} */ const canBeDisabled = { 'button': true, 'command': true, 'fieldset': true, 'input': true, 'keygen': true, 'optgroup': true, 'option': true, 'select': true, 'textarea': true }; /** * @param {HTMLElement} el Element to check labelling status * @return {boolean} element can have labels */ function canBeLabelled(el) { return labellable[el.localName] || false; } /** * @param {HTMLElement} el Element that may be labelled. * @return {!Array<!HTMLLabelElement>} Relevant label for `el` */ function matchingLabels(el) { let labels = Array.from(/** @type {HTMLInputElement} */(el).labels || []); // IE doesn't have `labels` and Safari doesn't populate `labels` // if element is in a shadowroot. // In this instance, finding the non-ancestor labels is enough, // as the mouseCancellor code will handle ancstor labels if (!labels.length) { labels = []; let root = el.getRootNode(); // if there is an id on `el`, check for all labels with a matching `for` attribute if (el.id) { let matching = root.querySelectorAll(`label[for = ${el.id}]`); for (let i = 0; i < matching.length; i++) { labels.push(/** @type {!HTMLLabelElement} */(matching[i])); } } } return labels; } // touch will make synthetic mouse events // `preventDefault` on touchend will cancel them, // but this breaks `<input>` focus and link clicks // disable mouse handlers for MOUSE_TIMEOUT ms after // a touchend to ignore synthetic mouse events let mouseCanceller = function(mouseEvent) { // Check for sourceCapabilities, used to distinguish synthetic events // if mouseEvent did not come from a device that fires touch events, // it was made by a real mouse and should be counted // http://wicg.github.io/InputDeviceCapabilities/#dom-inputdevicecapabilities-firestouchevents let sc = mouseEvent.sourceCapabilities; if (sc && !sc.firesTouchEvents) { return; } // skip synthetic mouse events mouseEvent[HANDLED_OBJ] = {skip: true}; // disable "ghost clicks" if (mouseEvent.type === 'click') { let clickFromLabel = false; let path = mouseEvent.composedPath && mouseEvent.composedPath(); if (path) { for (let i = 0; i < path.length; i++) { if (path[i].nodeType === Node.ELEMENT_NODE) { if (path[i].localName === 'label') { clickedLabels.push(path[i]); } else if (canBeLabelled(path[i])) { let ownerLabels = matchingLabels(path[i]); // check if one of the clicked labels is labelling this element for (let j = 0; j < ownerLabels.length; j++) { clickFromLabel = clickFromLabel || clickedLabels.indexOf(ownerLabels[j]) > -1; } } } if (path[i] === POINTERSTATE.mouse.target) { return; } } } // if one of the clicked labels was labelling the target element, // this is not a ghost click if (clickFromLabel) { return; } mouseEvent.preventDefault(); mouseEvent.stopPropagation(); } }; /** * @param {boolean=} setup True to add, false to remove. * @return {void} */ function setupTeardownMouseCanceller(setup) { let events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS; for (let i = 0, en; i < events.length; i++) { en = events[i]; if (setup) { // reset clickLabels array clickedLabels.length = 0; document.addEventListener(en, mouseCanceller, true); } else { document.removeEventListener(en, mouseCanceller, true); } } } function ignoreMouse(e) { if (!POINTERSTATE.mouse.mouseIgnoreJob) { setupTeardownMouseCanceller(true); } let unset = function() { setupTeardownMouseCanceller(); POINTERSTATE.mouse.target = null; POINTERSTATE.mouse.mouseIgnoreJob = null; }; POINTERSTATE.mouse.target = e.composedPath()[0]; POINTERSTATE.mouse.mouseIgnoreJob = Polymer.Debouncer.debounce( POINTERSTATE.mouse.mouseIgnoreJob , Polymer.Async.timeOut.after(MOUSE_TIMEOUT) , unset); } /** * @param {MouseEvent} ev event to test for left mouse button down * @return {boolean} has left mouse button down */ function hasLeftMouseButton(ev) { let type = ev.type; // exit early if the event is not a mouse event if (!isMouseEvent(type)) { return false; } // ev.button is not reliable for mousemove (0 is overloaded as both left button and no buttons) // instead we use ev.buttons (bitmask of buttons) or fall back to ev.which (deprecated, 0 for no buttons, 1 for left button) if (type === 'mousemove') { // allow undefined for testing events let buttons = ev.buttons === undefined ? 1 : ev.buttons; if ((ev instanceof window.MouseEvent) && !MOUSE_HAS_BUTTONS) { buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0; } // buttons is a bitmask, check that the left button bit is set (1) return Boolean(buttons & 1); } else { // allow undefined for testing events let button = ev.button === undefined ? 0 : ev.button; // ev.button is 0 in mousedown/mouseup/click for left button activation return button === 0; } } function isSyntheticClick(ev) { if (ev.type === 'click') { // ev.detail is 0 for HTMLElement.click in most browsers if (ev.detail === 0) { return true; } // in the worst case, check that the x/y position of the click is within // the bounding box of the target of the event // Thanks IE 10 >:( let t = Gestures._findOriginalTarget(ev); // make sure the target of the event is an element so we can use getBoundingClientRect, // if not, just assume it is a synthetic click if (!t.nodeType || /** @type {Element} */(t).nodeType !== Node.ELEMENT_NODE) { return true; } let bcr = /** @type {Element} */(t).getBoundingClientRect(); // use page x/y to account for scrolling let x = ev.pageX, y = ev.pageY; // ev is a synthetic click if the position is outside the bounding box of the target return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom)); } return false; } let POINTERSTATE = { mouse: { target: null, mouseIgnoreJob: null }, touch: { x: 0, y: 0, id: -1, scrollDecided: false } }; function firstTouchAction(ev) { let ta = 'auto'; let path = ev.composedPath && ev.composedPath(); if (path) { for (let i = 0, n; i < path.length; i++) { n = path[i]; if (n[TOUCH_ACTION]) { ta = n[TOUCH_ACTION]; break; } } } return ta; } function trackDocument(stateObj, movefn, upfn) { stateObj.movefn = movefn; stateObj.upfn = upfn; document.addEventListener('mousemove', movefn); document.addEventListener('mouseup', upfn); } function untrackDocument(stateObj) { document.removeEventListener('mousemove', stateObj.movefn); document.removeEventListener('mouseup', stateObj.upfn); stateObj.movefn = null; stateObj.upfn = null; } // use a document-wide touchend listener to start the ghost-click prevention mechanism // Use passive event listeners, if supported, to not affect scrolling performance document.addEventListener('touchend', ignoreMouse, SUPPORTS_PASSIVE ? {passive: true} : false); /** * Module for adding listeners to a node for the following normalized * cross-platform "gesture" events: * - `down` - mouse or touch went down * - `up` - mouse or touch went up * - `tap` - mouse click or finger tap * - `track` - mouse drag or touch move * * @namespace * @memberof Polymer * @summary Module for adding cross-platform gesture event listeners. */ const Gestures = { gestures: {}, recognizers: [], /** * Finds the element rendered on the screen at the provided coordinates. * * Similar to `document.elementFromPoint`, but pierces through * shadow roots. * * @memberof Polymer.Gestures * @param {number} x Horizontal pixel coordinate * @param {number} y Vertical pixel coordinate * @return {Element} Returns the deepest shadowRoot inclusive element * found at the screen position given. */ deepTargetFind: function(x, y) { let node = document.elementFromPoint(x, y); let next = node; // this code path is only taken when native ShadowDOM is used // if there is a shadowroot, it may have a node at x/y // if there is not a shadowroot, exit the loop while (next && next.shadowRoot && !window.ShadyDOM) { // if there is a node at x/y in the shadowroot, look deeper let oldNext = next; next = next.shadowRoot.elementFromPoint(x, y); // on Safari, elementFromPoint may return the shadowRoot host if (oldNext === next) { break; } if (next) { node = next; } } return node; }, /** * a cheaper check than ev.composedPath()[0]; * * @private * @param {Event} ev Event. * @return {EventTarget} Returns the event target. */ _findOriginalTarget: function(ev) { // shadowdom if (ev.composedPath) { const targets = /** @type {!Array<!EventTarget>} */(ev.composedPath()); // It shouldn't be, but sometimes targets is empty (window on Safari). return targets.length > 0 ? targets[0] : ev.target; } // shadydom return ev.target; }, /** * @private * @param {Event} ev Event. * @return {void} */ _handleNative: function(ev) { let handled; let type = ev.type; let node = ev.currentTarget; let gobj = node[GESTURE_KEY]; if (!gobj) { return; } let gs = gobj[type]; if (!gs) { return; } if (!ev[HANDLED_OBJ]) { ev[HANDLED_OBJ] = {}; if (type.slice(0, 5) === 'touch') { ev = /** @type {TouchEvent} */(ev); // eslint-disable-line no-self-assign let t = ev.changedTouches[0]; if (type === 'touchstart') { // only handle the first finger if (ev.touches.length === 1) { POINTERSTATE.touch.id = t.identifier; } } if (POINTERSTATE.touch.id !== t.identifier) { return; } if (!HAS_NATIVE_TA) { if (type === 'touchstart' || type === 'touchmove') { Gestures._handleTouchAction(ev); } } } } handled = ev[HANDLED_OBJ]; // used to ignore synthetic mouse events if (handled.skip) { return; } // reset recognizer state for (let i = 0, r; i < Gestures.recognizers.length; i++) { r = Gestures.recognizers[i]; if (gs[r.name] && !handled[r.name]) { if (r.flow && r.flow.start.indexOf(ev.type) > -1 && r.reset) { r.reset(); } } } // enforce gesture recognizer order for (let i = 0, r; i < Gestures.recognizers.length; i++) { r = Gestures.recognizers[i]; if (gs[r.name] && !handled[r.name]) { handled[r.name] = true; r[type](ev); } } }, /** * @private * @param {TouchEvent} ev Event. * @return {void} */ _handleTouchAction: function(ev) { let t = ev.changedTouches[0]; let type = ev.type; if (type === 'touchstart') { POINTERSTATE.touch.x = t.clientX; POINTERSTATE.touch.y = t.clientY; POINTERSTATE.touch.scrollDecided = false; } else if (type === 'touchmove') { if (POINTERSTATE.touch.scrollDecided) { return; } POINTERSTATE.touch.scrollDecided = true; let ta = firstTouchAction(ev); let prevent = false; let dx = Math.abs(POINTERSTATE.touch.x - t.clientX); let dy = Math.abs(POINTERSTATE.touch.y - t.clientY); if (!ev.cancelable) { // scrolling is happening } else if (ta === 'none') { prevent = true; } else if (ta === 'pan-x') { prevent = dy > dx; } else if (ta === 'pan-y') { prevent = dx > dy; } if (prevent) { ev.preventDefault(); } else { Gestures.prevent('track'); } } }, /** * Adds an event listener to a node for the given gesture type. * * @memberof Polymer.Gestures * @param {!Node} node Node to add listener on * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap` * @param {!function(!Event):void} handler Event listener function to call * @return {boolean} Returns true if a gesture event listener was added. * @this {Gestures} */ addListener: function(node, evType, handler) { if (this.gestures[evType]) { this._add(node, evType, handler); return true; } return false; }, /** * Removes an event listener from a node for the given gesture type. * * @memberof Polymer.Gestures * @param {!Node} node Node to remove listener from * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap` * @param {!function(!Event):void} handler Event listener function previously passed to * `addListener`. * @return {boolean} Returns true if a gesture event listener was removed. * @this {Gestures} */ removeListener: function(node, evType, handler) { if (this.gestures[evType]) { this._remove(node, evType, handler); return true; } return false; }, /** * automate the event listeners for the native events * * @private * @param {!HTMLElement} node Node on which to add the event. * @param {string} evType Event type to add. * @param {function(!Event)} handler Event handler function. * @return {void} * @this {Gestures} */ _add: function(node, evType, handler) { let recognizer = this.gestures[evType]; let deps = recognizer.deps; let name = recognizer.name; let gobj = node[GESTURE_KEY]; if (!gobj) { node[GESTURE_KEY] = gobj = {}; } for (let i = 0, dep, gd; i < deps.length; i++) { dep = deps[i]; // don't add mouse handlers on iOS because they cause gray selection overlays if (IS_TOUCH_ONLY && isMouseEvent(dep) && dep !== 'click') { continue; } gd = gobj[dep]; if (!gd) { gobj[dep] = gd = {_count: 0}; } if (gd._count === 0) { node.addEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep)); } gd[name] = (gd[name] || 0) + 1; gd._count = (gd._count || 0) + 1; } node.addEventListener(evType, handler); if (recognizer.touchAction) { this.setTouchAction(node, recognizer.touchAction); } }, /** * automate event listener removal for native events * * @private * @param {!HTMLElement} node Node on which to remove the event. * @param {string} evType Event type to remove. * @param {function(Event?)} handler Event handler function. * @return {void} * @this {Gestures} */ _remove: function(node, evType, handler) { let recognizer = this.gestures[evType]; let deps = recognizer.deps; let name = recognizer.name; let gobj = node[GESTURE_KEY]; if (gobj) { for (let i = 0, dep, gd; i < deps.length; i++) { dep = deps[i]; gd = gobj[dep]; if (gd && gd[name]) { gd[name] = (gd[name] || 1) - 1; gd._count = (gd._count || 1) - 1; if (gd._count === 0) { node.removeEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep)); } } } } node.removeEventListener(evType, handler); }, /** * Registers a new gesture event recognizer for adding new custom * gesture event types. * * @memberof Polymer.Gestures * @param {!GestureRecognizer} recog Gesture recognizer descriptor * @return {void} * @this {Gestures} */ register: function(recog) { this.recognizers.push(recog); for (let i = 0; i < recog.emits.length; i++) { this.gestures[recog.emits[i]] = recog; } }, /** * @private * @param {string} evName Event name. * @return {Object} Returns the gesture for the given event name. * @this {Gestures} */ _findRecognizerByEvent: function(evName) { for (let i = 0, r; i < this.recognizers.length; i++) { r = this.recognizers[i]; for (let j = 0, n; j < r.emits.length; j++) { n = r.emits[j]; if (n === evName) { return r; } } } return null; }, /** * Sets scrolling direction on node. * * This value is checked on first move, thus it should be called prior to * adding event listeners. * * @memberof Polymer.Gestures * @param {!Element} node Node to set touch action setting on * @param {string} value Touch action value * @return {void} */ setTouchAction: function(node, value) { if (HAS_NATIVE_TA) { // NOTE: add touchAction async so that events can be added in // custom element constructors. Otherwise we run afoul of custom // elements restriction against settings attributes (style) in the // constructor. Polymer.Async.microTask.run(() => { node.style.touchAction = value; }); } node[TOUCH_ACTION] = value; }, /** * Dispatches an event on the `target` element of `type` with the given * `detail`. * @private * @param {!EventTarget} target The element on which to fire an event. * @param {string} type The type of event to fire. * @param {!Object=} detail The detail object to populate on the event. * @return {void} */ _fire: function(target, type, detail) { let ev = new Event(type, { bubbles: true, cancelable: true, composed: true }); ev.detail = detail; target.dispatchEvent(ev); // forward `preventDefault` in a clean way if (ev.defaultPrevented) { let preventer = detail.preventer || detail.sourceEvent; if (preventer && preventer.preventDefault) { preventer.preventDefault(); } } }, /** * Prevents the dispatch and default action of the given event name. * * @memberof Polymer.Gestures * @param {string} evName Event name. * @return {void} * @this {Gestures} */ prevent: function(evName) { let recognizer = this._findRecognizerByEvent(evName); if (recognizer.info) { recognizer.info.prevent = true; } }, /** * Reset the 2500ms timeout on processing mouse input after detecting touch input. * * Touch inputs create synthesized mouse inputs anywhere from 0 to 2000ms after the touch. * This method should only be called during testing with simulated touch inputs. * Calling this method in production may cause duplicate taps or other Gestures. * * @memberof Polymer.Gestures * @return {void} */ resetMouseCanceller: function() { if (POINTERSTATE.mouse.mouseIgnoreJob) { POINTERSTATE.mouse.mouseIgnoreJob.flush(); } } }; /* eslint-disable valid-jsdoc */ Gestures.register({ name: 'downup', deps: ['mousedown', 'touchstart', 'touchend'], flow: { start: ['mousedown', 'touchstart'], end: ['mouseup', 'touchend'] }, emits: ['down', 'up'], info: { movefn: null, upfn: null }, /** * @this {GestureRecognizer} * @return {void} */ reset: function() { untrackDocument(this.info); }, /** * @this {GestureRecognizer} * @param {MouseEvent} e * @return {void} */ mousedown: function(e) { if (!hasLeftMouseButton(e)) { return; } let t = Gestures._findOriginalTarget(e); let self = this; let movefn = function movefn(e) { if (!hasLeftMouseButton(e)) { self._fire('up', t, e); untrackDocument(self.info); } }; let upfn = function upfn(e) { if (hasLeftMouseButton(e)) { self._fire('up', t, e); } untrackDocument(self.info); }; trackDocument(this.info, movefn, upfn); this._fire('down', t, e); }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchstart: function(e) { this._fire('down', Gestures._findOriginalTarget(e), e.changedTouches[0], e); }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchend: function(e) { this._fire('up', Gestures._findOriginalTarget(e), e.changedTouches[0], e); }, /** * @param {string} type * @param {!EventTarget} target * @param {Event} event * @param {Function} preventer * @return {void} */ _fire: function(type, target, event, preventer) { Gestures._fire(target, type, { x: event.clientX, y: event.clientY, sourceEvent: event, preventer: preventer, prevent: function(e) { return Gestures.prevent(e); } }); } }); Gestures.register({ name: 'track', touchAction: 'none', deps: ['mousedown', 'touchstart', 'touchmove', 'touchend'], flow: { start: ['mousedown', 'touchstart'], end: ['mouseup', 'touchend'] }, emits: ['track'], info: { x: 0, y: 0, state: 'start', started: false, moves: [], /** @this {GestureRecognizer} */ addMove: function(move) { if (this.moves.length > TRACK_LENGTH) { this.moves.shift(); } this.moves.push(move); }, movefn: null, upfn: null, prevent: false }, /** * @this {GestureRecognizer} * @return {void} */ reset: function() { this.info.state = 'start'; this.info.started = false; this.info.moves = []; this.info.x = 0; this.info.y = 0; this.info.prevent = false; untrackDocument(this.info); }, /** * @this {GestureRecognizer} * @param {number} x * @param {number} y * @return {boolean} */ hasMovedEnough: function(x, y) { if (this.info.prevent) { return false; } if (this.info.started) { return true; } let dx = Math.abs(this.info.x - x); let dy = Math.abs(this.info.y - y); return (dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE); }, /** * @this {GestureRecognizer} * @param {MouseEvent} e * @return {void} */ mousedown: function(e) { if (!hasLeftMouseButton(e)) { return; } let t = Gestures._findOriginalTarget(e); let self = this; let movefn = function movefn(e) { let x = e.clientX, y = e.clientY; if (self.hasMovedEnough(x, y)) { // first move is 'start', subsequent moves are 'move', mouseup is 'end' self.info.state = self.info.started ? (e.type === 'mouseup' ? 'end' : 'track') : 'start'; if (self.info.state === 'start') { // if and only if tracking, always prevent tap Gestures.prevent('tap'); } self.info.addMove({x: x, y: y}); if (!hasLeftMouseButton(e)) { // always _fire "end" self.info.state = 'end'; untrackDocument(self.info); } self._fire(t, e); self.info.started = true; } }; let upfn = function upfn(e) { if (self.info.started) { movefn(e); } // remove the temporary listeners untrackDocument(self.info); }; // add temporary document listeners as mouse retargets trackDocument(this.info, movefn, upfn); this.info.x = e.clientX; this.info.y = e.clientY; }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchstart: function(e) { let ct = e.changedTouches[0]; this.info.x = ct.clientX; this.info.y = ct.clientY; }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchmove: function(e) { let t = Gestures._findOriginalTarget(e); let ct = e.changedTouches[0]; let x = ct.clientX, y = ct.clientY; if (this.hasMovedEnough(x, y)) { if (this.info.state === 'start') { // if and only if tracking, always prevent tap Gestures.prevent('tap'); } this.info.addMove({x: x, y: y}); this._fire(t, ct); this.info.state = 'track'; this.info.started = true; } }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchend: function(e) { let t = Gestures._findOriginalTarget(e); let ct = e.changedTouches[0]; // only trackend if track was started and not aborted if (this.info.started) { // reset started state on up this.info.state = 'end'; this.info.addMove({x: ct.clientX, y: ct.clientY}); this._fire(t, ct, e); } }, /** * @this {GestureRecognizer} * @param {!EventTarget} target * @param {Touch} touch * @return {void} */ _fire: function(target, touch) { let secondlast = this.info.moves[this.info.moves.length - 2]; let lastmove = this.info.moves[this.info.moves.length - 1]; let dx = lastmove.x - this.info.x; let dy = lastmove.y - this.info.y; let ddx, ddy = 0; if (secondlast) { ddx = lastmove.x - secondlast.x; ddy = lastmove.y - secondlast.y; } Gestures._fire(target, 'track', { state: this.info.state, x: touch.clientX, y: touch.clientY, dx: dx, dy: dy, ddx: ddx, ddy: ddy, sourceEvent: touch, hover: function() { return Gestures.deepTargetFind(touch.clientX, touch.clientY); } }); } }); Gestures.register({ name: 'tap', deps: ['mousedown', 'click', 'touchstart', 'touchend'], flow: { start: ['mousedown', 'touchstart'], end: ['click', 'touchend'] }, emits: ['tap'], info: { x: NaN, y: NaN, prevent: false }, /** * @this {GestureRecognizer} * @return {void} */ reset: function() { this.info.x = NaN; this.info.y = NaN; this.info.prevent = false; }, /** * @this {GestureRecognizer} * @param {MouseEvent} e * @return {void} */ save: function(e) { this.info.x = e.clientX; this.info.y = e.clientY; }, /** * @this {GestureRecognizer} * @param {MouseEvent} e * @return {void} */ mousedown: function(e) { if (hasLeftMouseButton(e)) { this.save(e); } }, /** * @this {GestureRecognizer} * @param {MouseEvent} e * @return {void} */ click: function(e) { if (hasLeftMouseButton(e)) { this.forward(e); } }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchstart: function(e) { this.save(e.changedTouches[0], e); }, /** * @this {GestureRecognizer} * @param {TouchEvent} e * @return {void} */ touchend: function(e) { this.forward(e.changedTouches[0], e); }, /** * @this {GestureRecognizer} * @param {Event | Touch} e * @param {Event=} preventer * @return {void} */ forward: function(e, preventer) { let dx = Math.abs(e.clientX - this.info.x); let dy = Math.abs(e.clientY - this.info.y); // find original target from `preventer` for TouchEvents, or `e` for MouseEvents let t = Gestures._findOriginalTarget(/** @type {Event} */(preventer || e)); if (!t || (canBeDisabled[/** @type {!HTMLElement} */(t).localName] && t.hasAttribute('disabled'))) { return; } // dx,dy can be NaN if `click` has been simulated and there was no `down` for `start` if (isNaN(dx) || isNaN(dy) || (dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) || isSyntheticClick(e)) { // prevent taps from being generated if an event has canceled them if (!this.info.prevent) { Gestures._fire(t, 'tap', { x: e.clientX, y: e.clientY, sourceEvent: e, preventer: preventer }); } } } }); /* eslint-enable valid-jsdoc */ /** @deprecated */ Gestures.findOriginalTarget = Gestures._findOriginalTarget; /** @deprecated */ Gestures.add = Gestures.addListener; /** @deprecated */ Gestures.remove = Gestures.removeListener; Polymer.Gestures = Gestures; })(); (function() { 'use strict'; /** * @const {Polymer.Gestures} */ const gestures = Polymer.Gestures; /** * Element class mixin that provides API for adding Polymer's cross-platform * gesture events to nodes. * * The API is designed to be compatible with override points implemented * in `Polymer.TemplateStamp` such that declarative event listeners in * templates will support gesture events when this mixin is applied along with * `Polymer.TemplateStamp`. * * @mixinFunction * @polymer * @memberof Polymer * @summary Element class mixin that provides API for adding Polymer's cross-platform * gesture events to nodes */ Polymer.GestureEventListeners = Polymer.dedupingMixin(superClass => { /** * @polymer * @mixinClass * @implements {Polymer_GestureEventListeners} */ class GestureEventListeners extends superClass { /** * Add the event listener to the node if it is a gestures event. * * @param {!Node} node Node to add event listener to * @param {string} eventName Name of event * @param {function(!Event):void} handler Listener function to add * @return {void} */ _addEventListenerToNode(node, eventName, handler) { if (!gestures.addListener(node, eventName, handler)) { super._addEventListenerToNode(node, eventName, handler); } } /** * Remove the event listener to the node if it is a gestures event. * * @param {!Node} node Node to remove event listener from * @param {string} eventName Name of event * @param {function(!Event):void} handler Listener function to remove * @return {void} */ _removeEventListenerFromNode(node, eventName, handler) { if (!gestures.removeListener(node, eventName, handler)) { super._removeEventListenerFromNode(node, eventName, handler); } } } return GestureEventListeners; }); })(); (function() { 'use strict'; const HOST_DIR = /:host\(:dir\((ltr|rtl)\)\)/g; const HOST_DIR_REPLACMENT = ':host([dir="$1"])'; const EL_DIR = /([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g; const EL_DIR_REPLACMENT = ':host([dir="$2"]) $1'; const DIR_CHECK = /:dir\((?:ltr|rtl)\)/; const SHIM_SHADOW = Boolean(window['ShadyDOM'] && window['ShadyDOM']['inUse']); /** * @type {!Array<!Polymer_DirMixin>} */ const DIR_INSTANCES = []; /** @type {MutationObserver} */ let observer = null; let DOCUMENT_DIR = ''; function getRTL() { DOCUMENT_DIR = document.documentElement.getAttribute('dir'); } /** * @param {!Polymer_DirMixin} instance Instance to set RTL status on */ function setRTL(instance) { if (!instance.__autoDirOptOut) { const el = /** @type {!HTMLElement} */(instance); el.setAttribute('dir', DOCUMENT_DIR); } } function updateDirection() { getRTL(); DOCUMENT_DIR = document.documentElement.getAttribute('dir'); for (let i = 0; i < DIR_INSTANCES.length; i++) { setRTL(DIR_INSTANCES[i]); } } function takeRecords() { if (observer && observer.takeRecords().length) { updateDirection(); } } /** * Element class mixin that allows elements to use the `:dir` CSS Selector to have * text direction specific styling. * * With this mixin, any stylesheet provided in the template will transform `:dir` into * `:host([dir])` and sync direction with the page via the element's `dir` attribute. * * Elements can opt out of the global page text direction by setting the `dir` attribute * directly in `ready()` or in HTML. * * Caveats: * - Applications must set `<html dir="ltr">` or `<html dir="rtl">` to sync direction * - Automatic left-to-right or right-to-left styling is sync'd with the `<html>` element only. * - Changing `dir` at runtime is supported. * - Opting out of the global direction styling is permanent * * @mixinFunction * @polymer * @appliesMixin Polymer.PropertyAccessors * @memberof Polymer */ Polymer.DirMixin = Polymer.dedupingMixin((base) => { if (!SHIM_SHADOW) { if (!observer) { getRTL(); observer = new MutationObserver(updateDirection); observer.observe(document.documentElement, {attributes: true, attributeFilter: ['dir']}); } } /** * @constructor * @extends {base} * @implements {Polymer_PropertyAccessors} * @private */ const elementBase = Polymer.PropertyAccessors(base); /** * @polymer * @mixinClass * @implements {Polymer_DirMixin} */ class Dir extends elementBase { /** * @override * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _processStyleText(cssText, baseURI) { cssText = super._processStyleText(cssText, baseURI); if (!SHIM_SHADOW && DIR_CHECK.test(cssText)) { cssText = this._replaceDirInCssText(cssText); this.__activateDir = true; } return cssText; } /** * Replace `:dir` in the given CSS text * * @param {string} text CSS text to replace DIR * @return {string} Modified CSS */ static _replaceDirInCssText(text) { let replacedText = text; replacedText = replacedText.replace(HOST_DIR, HOST_DIR_REPLACMENT); replacedText = replacedText.replace(EL_DIR, EL_DIR_REPLACMENT); return replacedText; } constructor() { super(); /** @type {boolean} */ this.__autoDirOptOut = false; } /** * @suppress {invalidCasts} Closure doesn't understand that `this` is an HTMLElement * @return {void} */ ready() { super.ready(); this.__autoDirOptOut = /** @type {!HTMLElement} */(this).hasAttribute('dir'); } /** * @suppress {missingProperties} If it exists on elementBase, it can be super'd * @return {void} */ connectedCallback() { if (elementBase.prototype.connectedCallback) { super.connectedCallback(); } if (this.constructor.__activateDir) { takeRecords(); DIR_INSTANCES.push(this); setRTL(this); } } /** * @suppress {missingProperties} If it exists on elementBase, it can be super'd * @return {void} */ disconnectedCallback() { if (elementBase.prototype.disconnectedCallback) { super.disconnectedCallback(); } if (this.constructor.__activateDir) { const idx = DIR_INSTANCES.indexOf(this); if (idx > -1) { DIR_INSTANCES.splice(idx, 1); } } } } Dir.__activateDir = false; return Dir; }); })(); (function() { 'use strict'; // run a callback when HTMLImports are ready or immediately if // this api is not available. function whenImportsReady(cb) { if (window.HTMLImports) { HTMLImports.whenReady(cb); } else { cb(); } } /** * Convenience method for importing an HTML document imperatively. * * This method creates a new `<link rel="import">` element with * the provided URL and appends it to the document to start loading. * In the `onload` callback, the `import` property of the `link` * element will contain the imported document contents. * * @memberof Polymer * @param {string} href URL to document to load. * @param {?function(!Event):void=} onload Callback to notify when an import successfully * loaded. * @param {?function(!ErrorEvent):void=} onerror Callback to notify when an import * unsuccessfully loaded. * @param {boolean=} optAsync True if the import should be loaded `async`. * Defaults to `false`. * @return {!HTMLLinkElement} The link element for the URL to be loaded. */ Polymer.importHref = function(href, onload, onerror, optAsync) { let link = /** @type {HTMLLinkElement} */ (document.head.querySelector('link[href="' + href + '"][import-href]')); if (!link) { link = /** @type {HTMLLinkElement} */ (document.createElement('link')); link.rel = 'import'; link.href = href; link.setAttribute('import-href', ''); } // always ensure link has `async` attribute if user specified one, // even if it was previously not async. This is considered less confusing. if (optAsync) { link.setAttribute('async', ''); } // NOTE: the link may now be in 3 states: (1) pending insertion, // (2) inflight, (3) already loaded. In each case, we need to add // event listeners to process callbacks. let cleanup = function() { link.removeEventListener('load', loadListener); link.removeEventListener('error', errorListener); }; let loadListener = function(event) { cleanup(); // In case of a successful load, cache the load event on the link so // that it can be used to short-circuit this method in the future when // it is called with the same href param. link.__dynamicImportLoaded = true; if (onload) { whenImportsReady(() => { onload(event); }); } }; let errorListener = function(event) { cleanup(); // In case of an error, remove the link from the document so that it // will be automatically created again the next time `importHref` is // called. if (link.parentNode) { link.parentNode.removeChild(link); } if (onerror) { whenImportsReady(() => { onerror(event); }); } }; link.addEventListener('load', loadListener); link.addEventListener('error', errorListener); if (link.parentNode == null) { document.head.appendChild(link); // if the link already loaded, dispatch a fake load event // so that listeners are called and get a proper event argument. } else if (link.__dynamicImportLoaded) { link.dispatchEvent(new Event('load')); } return link; }; })(); (function() { 'use strict'; let scheduled = false; let beforeRenderQueue = []; let afterRenderQueue = []; function schedule() { scheduled = true; // before next render requestAnimationFrame(function() { scheduled = false; flushQueue(beforeRenderQueue); // after the render setTimeout(function() { runQueue(afterRenderQueue); }); }); } function flushQueue(queue) { while (queue.length) { callMethod(queue.shift()); } } function runQueue(queue) { for (let i=0, l=queue.length; i < l; i++) { callMethod(queue.shift()); } } function callMethod(info) { const context = info[0]; const callback = info[1]; const args = info[2]; try { callback.apply(context, args); } catch(e) { setTimeout(() => { throw e; }); } } function flush() { while (beforeRenderQueue.length || afterRenderQueue.length) { flushQueue(beforeRenderQueue); flushQueue(afterRenderQueue); } scheduled = false; } /** * Module for scheduling flushable pre-render and post-render tasks. * * @namespace * @memberof Polymer * @summary Module for scheduling flushable pre-render and post-render tasks. */ Polymer.RenderStatus = { /** * Enqueues a callback which will be run before the next render, at * `requestAnimationFrame` timing. * * This method is useful for enqueuing work that requires DOM measurement, * since measurement may not be reliable in custom element callbacks before * the first render, as well as for batching measurement tasks in general. * * Tasks in this queue may be flushed by calling `Polymer.RenderStatus.flush()`. * * @memberof Polymer.RenderStatus * @param {*} context Context object the callback function will be bound to * @param {function(...*):void} callback Callback function * @param {!Array=} args An array of arguments to call the callback function with * @return {void} */ beforeNextRender: function(context, callback, args) { if (!scheduled) { schedule(); } beforeRenderQueue.push([context, callback, args]); }, /** * Enqueues a callback which will be run after the next render, equivalent * to one task (`setTimeout`) after the next `requestAnimationFrame`. * * This method is useful for tuning the first-render performance of an * element or application by deferring non-critical work until after the * first paint. Typical non-render-critical work may include adding UI * event listeners and aria attributes. * * @memberof Polymer.RenderStatus * @param {*} context Context object the callback function will be bound to * @param {function(...*):void} callback Callback function * @param {!Array=} args An array of arguments to call the callback function with * @return {void} */ afterNextRender: function(context, callback, args) { if (!scheduled) { schedule(); } afterRenderQueue.push([context, callback, args]); }, /** * Flushes all `beforeNextRender` tasks, followed by all `afterNextRender` * tasks. * * @memberof Polymer.RenderStatus * @return {void} */ flush: flush }; })(); (function() { 'use strict'; // unresolved function resolve() { document.body.removeAttribute('unresolved'); } if (window.WebComponents) { window.addEventListener('WebComponentsReady', resolve); } else { if (document.readyState === 'interactive' || document.readyState === 'complete') { resolve(); } else { window.addEventListener('DOMContentLoaded', resolve); } } })(); (function() { 'use strict'; function newSplice(index, removed, addedCount) { return { index: index, removed: removed, addedCount: addedCount }; } const EDIT_LEAVE = 0; const EDIT_UPDATE = 1; const EDIT_ADD = 2; const EDIT_DELETE = 3; // Note: This function is *based* on the computation of the Levenshtein // "edit" distance. The one change is that "updates" are treated as two // edits - not one. With Array splices, an update is really a delete // followed by an add. By retaining this, we optimize for "keeping" the // maximum array items in the original array. For example: // // 'xxxx123' -> '123yyyy' // // With 1-edit updates, the shortest path would be just to update all seven // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This // leaves the substring '123' intact. function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) { // "Deletion" columns let rowCount = oldEnd - oldStart + 1; let columnCount = currentEnd - currentStart + 1; let distances = new Array(rowCount); // "Addition" rows. Initialize null column. for (let i = 0; i < rowCount; i++) { distances[i] = new Array(columnCount); distances[i][0] = i; } // Initialize null row for (let j = 0; j < columnCount; j++) distances[0][j] = j; for (let i = 1; i < rowCount; i++) { for (let j = 1; j < columnCount; j++) { if (equals(current[currentStart + j - 1], old[oldStart + i - 1])) distances[i][j] = distances[i - 1][j - 1]; else { let north = distances[i - 1][j] + 1; let west = distances[i][j - 1] + 1; distances[i][j] = north < west ? north : west; } } } return distances; } // This starts at the final weight, and walks "backward" by finding // the minimum previous weight recursively until the origin of the weight // matrix. function spliceOperationsFromEditDistances(distances) { let i = distances.length - 1; let j = distances[0].length - 1; let current = distances[i][j]; let edits = []; while (i > 0 || j > 0) { if (i == 0) { edits.push(EDIT_ADD); j--; continue; } if (j == 0) { edits.push(EDIT_DELETE); i--; continue; } let northWest = distances[i - 1][j - 1]; let west = distances[i - 1][j]; let north = distances[i][j - 1]; let min; if (west < north) min = west < northWest ? west : northWest; else min = north < northWest ? north : northWest; if (min == northWest) { if (northWest == current) { edits.push(EDIT_LEAVE); } else { edits.push(EDIT_UPDATE); current = northWest; } i--; j--; } else if (min == west) { edits.push(EDIT_DELETE); i--; current = west; } else { edits.push(EDIT_ADD); j--; current = north; } } edits.reverse(); return edits; } /** * Splice Projection functions: * * A splice map is a representation of how a previous array of items * was transformed into a new array of items. Conceptually it is a list of * tuples of * * <index, removed, addedCount> * * which are kept in ascending index order of. The tuple represents that at * the |index|, |removed| sequence of items were removed, and counting forward * from |index|, |addedCount| items were added. */ /** * Lacking individual splice mutation information, the minimal set of * splices can be synthesized given the previous state and final state of an * array. The basic approach is to calculate the edit distance matrix and * choose the shortest path through it. * * Complexity: O(l * p) * l: The length of the current array * p: The length of the old array * * @param {!Array} current The current "changed" array for which to * calculate splices. * @param {number} currentStart Starting index in the `current` array for * which splices are calculated. * @param {number} currentEnd Ending index in the `current` array for * which splices are calculated. * @param {!Array} old The original "unchanged" array to compare `current` * against to determine splices. * @param {number} oldStart Starting index in the `old` array for * which splices are calculated. * @param {number} oldEnd Ending index in the `old` array for * which splices are calculated. * @return {!Array} Returns an array of splice record objects. Each of these * contains: `index` the location where the splice occurred; `removed` * the array of removed items from this location; `addedCount` the number * of items added at this location. */ function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) { let prefixCount = 0; let suffixCount = 0; let splice; let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart); if (currentStart == 0 && oldStart == 0) prefixCount = sharedPrefix(current, old, minLength); if (currentEnd == current.length && oldEnd == old.length) suffixCount = sharedSuffix(current, old, minLength - prefixCount); currentStart += prefixCount; oldStart += prefixCount; currentEnd -= suffixCount; oldEnd -= suffixCount; if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) return []; if (currentStart == currentEnd) { splice = newSplice(currentStart, [], 0); while (oldStart < oldEnd) splice.removed.push(old[oldStart++]); return [ splice ]; } else if (oldStart == oldEnd) return [ newSplice(currentStart, [], currentEnd - currentStart) ]; let ops = spliceOperationsFromEditDistances( calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd)); splice = undefined; let splices = []; let index = currentStart; let oldIndex = oldStart; for (let i = 0; i < ops.length; i++) { switch(ops[i]) { case EDIT_LEAVE: if (splice) { splices.push(splice); splice = undefined; } index++; oldIndex++; break; case EDIT_UPDATE: if (!splice) splice = newSplice(index, [], 0); splice.addedCount++; index++; splice.removed.push(old[oldIndex]); oldIndex++; break; case EDIT_ADD: if (!splice) splice = newSplice(index, [], 0); splice.addedCount++; index++; break; case EDIT_DELETE: if (!splice) splice = newSplice(index, [], 0); splice.removed.push(old[oldIndex]); oldIndex++; break; } } if (splice) { splices.push(splice); } return splices; } function sharedPrefix(current, old, searchLength) { for (let i = 0; i < searchLength; i++) if (!equals(current[i], old[i])) return i; return searchLength; } function sharedSuffix(current, old, searchLength) { let index1 = current.length; let index2 = old.length; let count = 0; while (count < searchLength && equals(current[--index1], old[--index2])) count++; return count; } function calculateSplices(current, previous) { return calcSplices(current, 0, current.length, previous, 0, previous.length); } function equals(currentValue, previousValue) { return currentValue === previousValue; } /** * @namespace * @memberof Polymer * @summary Module that provides utilities for diffing arrays. */ Polymer.ArraySplice = { /** * Returns an array of splice records indicating the minimum edits required * to transform the `previous` array into the `current` array. * * Splice records are ordered by index and contain the following fields: * - `index`: index where edit started * - `removed`: array of removed items from this index * - `addedCount`: number of items added at this index * * This function is based on the Levenshtein "minimum edit distance" * algorithm. Note that updates are treated as removal followed by addition. * * The worst-case time complexity of this algorithm is `O(l * p)` * l: The length of the current array * p: The length of the previous array * * However, the worst-case complexity is reduced by an `O(n)` optimization * to detect any shared prefix & suffix between the two arrays and only * perform the more expensive minimum edit distance calculation over the * non-shared portions of the arrays. * * @function * @memberof Polymer.ArraySplice * @param {!Array} current The "changed" array for which splices will be * calculated. * @param {!Array} previous The "unchanged" original array to compare * `current` against to determine the splices. * @return {!Array} Returns an array of splice record objects. Each of these * contains: `index` the location where the splice occurred; `removed` * the array of removed items from this location; `addedCount` the number * of items added at this location. */ calculateSplices }; })(); (function() { 'use strict'; /** * Returns true if `node` is a slot element * @param {Node} node Node to test. * @return {boolean} Returns true if the given `node` is a slot * @private */ function isSlot(node) { return (node.localName === 'slot'); } /** * Class that listens for changes (additions or removals) to * "flattened nodes" on a given `node`. The list of flattened nodes consists * of a node's children and, for any children that are `<slot>` elements, * the expanded flattened list of `assignedNodes`. * For example, if the observed node has children `<a></a><slot></slot><b></b>` * and the `<slot>` has one `<div>` assigned to it, then the flattened * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other * `<slot>` elements assigned to it, these are flattened as well. * * The provided `callback` is called whenever any change to this list * of flattened nodes occurs, where an addition or removal of a node is * considered a change. The `callback` is called with one argument, an object * containing an array of any `addedNodes` and `removedNodes`. * * Note: the callback is called asynchronous to any changes * at a microtask checkpoint. This is because observation is performed using * `MutationObserver` and the `<slot>` element's `slotchange` event which * are asynchronous. * * An example: * ```js * class TestSelfObserve extends Polymer.Element { * static get is() { return 'test-self-observe';} * connectedCallback() { * super.connectedCallback(); * this._observer = new Polymer.FlattenedNodesObserver(this, (info) => { * this.info = info; * }); * } * disconnectedCallback() { * super.disconnectedCallback(); * this._observer.disconnect(); * } * } * customElements.define(TestSelfObserve.is, TestSelfObserve); * ``` * * @memberof Polymer * @summary Class that listens for changes (additions or removals) to * "flattened nodes" on a given `node`. */ class FlattenedNodesObserver { /** * Returns the list of flattened nodes for the given `node`. * This list consists of a node's children and, for any children * that are `<slot>` elements, the expanded flattened list of `assignedNodes`. * For example, if the observed node has children `<a></a><slot></slot><b></b>` * and the `<slot>` has one `<div>` assigned to it, then the flattened * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other * `<slot>` elements assigned to it, these are flattened as well. * * @param {HTMLElement|HTMLSlotElement} node The node for which to return the list of flattened nodes. * @return {Array} The list of flattened nodes for the given `node`. */ static getFlattenedNodes(node) { if (isSlot(node)) { node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign return node.assignedNodes({flatten: true}); } else { return Array.from(node.childNodes).map((node) => { if (isSlot(node)) { node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign return node.assignedNodes({flatten: true}); } else { return [node]; } }).reduce((a, b) => a.concat(b), []); } } /** * @param {Element} target Node on which to listen for changes. * @param {?function(!Element, { target: !Element, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Function called when there are additions * or removals from the target's list of flattened nodes. */ constructor(target, callback) { /** * @type {MutationObserver} * @private */ this._shadyChildrenObserver = null; /** * @type {MutationObserver} * @private */ this._nativeChildrenObserver = null; this._connected = false; /** * @type {Element} * @private */ this._target = target; this.callback = callback; this._effectiveNodes = []; this._observer = null; this._scheduled = false; /** * @type {function()} * @private */ this._boundSchedule = () => { this._schedule(); }; this.connect(); this._schedule(); } /** * Activates an observer. This method is automatically called when * a `FlattenedNodesObserver` is created. It should only be called to * re-activate an observer that has been deactivated via the `disconnect` method. * * @return {void} */ connect() { if (isSlot(this._target)) { this._listenSlots([this._target]); } else if (this._target.children) { this._listenSlots(this._target.children); if (window.ShadyDOM) { this._shadyChildrenObserver = ShadyDOM.observeChildren(this._target, (mutations) => { this._processMutations(mutations); }); } else { this._nativeChildrenObserver = new MutationObserver((mutations) => { this._processMutations(mutations); }); this._nativeChildrenObserver.observe(this._target, {childList: true}); } } this._connected = true; } /** * Deactivates the flattened nodes observer. After calling this method * the observer callback will not be called when changes to flattened nodes * occur. The `connect` method may be subsequently called to reactivate * the observer. * * @return {void} */ disconnect() { if (isSlot(this._target)) { this._unlistenSlots([this._target]); } else if (this._target.children) { this._unlistenSlots(this._target.children); if (window.ShadyDOM && this._shadyChildrenObserver) { ShadyDOM.unobserveChildren(this._shadyChildrenObserver); this._shadyChildrenObserver = null; } else if (this._nativeChildrenObserver) { this._nativeChildrenObserver.disconnect(); this._nativeChildrenObserver = null; } } this._connected = false; } /** * @return {void} * @private */ _schedule() { if (!this._scheduled) { this._scheduled = true; Polymer.Async.microTask.run(() => this.flush()); } } /** * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer * @return {void} * @private */ _processMutations(mutations) { this._processSlotMutations(mutations); this.flush(); } /** * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer * @return {void} * @private */ _processSlotMutations(mutations) { if (mutations) { for (let i=0; i < mutations.length; i++) { let mutation = mutations[i]; if (mutation.addedNodes) { this._listenSlots(mutation.addedNodes); } if (mutation.removedNodes) { this._unlistenSlots(mutation.removedNodes); } } } } /** * Flushes the observer causing any pending changes to be immediately * delivered the observer callback. By default these changes are delivered * asynchronously at the next microtask checkpoint. * * @return {boolean} Returns true if any pending changes caused the observer * callback to run. */ flush() { if (!this._connected) { return false; } if (window.ShadyDOM) { ShadyDOM.flush(); } if (this._nativeChildrenObserver) { this._processSlotMutations(this._nativeChildrenObserver.takeRecords()); } else if (this._shadyChildrenObserver) { this._processSlotMutations(this._shadyChildrenObserver.takeRecords()); } this._scheduled = false; let info = { target: this._target, addedNodes: [], removedNodes: [] }; let newNodes = this.constructor.getFlattenedNodes(this._target); let splices = Polymer.ArraySplice.calculateSplices(newNodes, this._effectiveNodes); // process removals for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) { for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) { info.removedNodes.push(n); } } // process adds for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) { for (let j=s.index; j < s.index + s.addedCount; j++) { info.addedNodes.push(newNodes[j]); } } // update cache this._effectiveNodes = newNodes; let didFlush = false; if (info.addedNodes.length || info.removedNodes.length) { didFlush = true; this.callback.call(this._target, info); } return didFlush; } /** * @param {!Array<Element|Node>|!NodeList<Node>} nodeList Nodes that could change * @return {void} * @private */ _listenSlots(nodeList) { for (let i=0; i < nodeList.length; i++) { let n = nodeList[i]; if (isSlot(n)) { n.addEventListener('slotchange', this._boundSchedule); } } } /** * @param {!Array<Element|Node>|!NodeList<Node>} nodeList Nodes that could change * @return {void} * @private */ _unlistenSlots(nodeList) { for (let i=0; i < nodeList.length; i++) { let n = nodeList[i]; if (isSlot(n)) { n.removeEventListener('slotchange', this._boundSchedule); } } } } Polymer.FlattenedNodesObserver = FlattenedNodesObserver; })(); (function() { 'use strict'; let debouncerQueue = []; /** * Adds a `Polymer.Debouncer` to a list of globally flushable tasks. * * @memberof Polymer * @param {!Polymer.Debouncer} debouncer Debouncer to enqueue * @return {void} */ Polymer.enqueueDebouncer = function(debouncer) { debouncerQueue.push(debouncer); }; function flushDebouncers() { const didFlush = Boolean(debouncerQueue.length); while (debouncerQueue.length) { try { debouncerQueue.shift().flush(); } catch(e) { setTimeout(() => { throw e; }); } } return didFlush; } /** * Forces several classes of asynchronously queued tasks to flush: * - Debouncers added via `enqueueDebouncer` * - ShadyDOM distribution * * @memberof Polymer * @return {void} */ Polymer.flush = function() { let shadyDOM, debouncers; do { shadyDOM = window.ShadyDOM && ShadyDOM.flush(); if (window.ShadyCSS && window.ShadyCSS.ScopingShim) { window.ShadyCSS.ScopingShim.flush(); } debouncers = flushDebouncers(); } while (shadyDOM || debouncers); }; })(); (function() { 'use strict'; const p = Element.prototype; /** * @const {function(this:Node, string): boolean} */ const normalizedMatchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector; /** * Cross-platform `element.matches` shim. * * @function matchesSelector * @memberof Polymer.dom * @param {!Node} node Node to check selector against * @param {string} selector Selector to match * @return {boolean} True if node matched selector */ const matchesSelector = function(node, selector) { return normalizedMatchesSelector.call(node, selector); }; /** * Node API wrapper class returned from `Polymer.dom.(target)` when * `target` is a `Node`. * * @memberof Polymer */ class DomApi { /** * @param {Node} node Node for which to create a Polymer.dom helper object. */ constructor(node) { this.node = node; } /** * Returns an instance of `Polymer.FlattenedNodesObserver` that * listens for node changes on this element. * * @param {function(!Element, { target: !Element, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Called when direct or distributed children * of this element changes * @return {!Polymer.FlattenedNodesObserver} Observer instance */ observeNodes(callback) { return new Polymer.FlattenedNodesObserver(this.node, callback); } /** * Disconnects an observer previously created via `observeNodes` * * @param {!Polymer.FlattenedNodesObserver} observerHandle Observer instance * to disconnect. * @return {void} */ unobserveNodes(observerHandle) { observerHandle.disconnect(); } /** * Provided as a backwards-compatible API only. This method does nothing. * @return {void} */ notifyObserver() {} /** * Returns true if the provided node is contained with this element's * light-DOM children or shadow root, including any nested shadow roots * of children therein. * * @param {Node} node Node to test * @return {boolean} Returns true if the given `node` is contained within * this element's light or shadow DOM. */ deepContains(node) { if (this.node.contains(node)) { return true; } let n = node; let doc = node.ownerDocument; // walk from node to `this` or `document` while (n && n !== doc && n !== this.node) { // use logical parentnode, or native ShadowRoot host n = n.parentNode || n.host; } return n === this.node; } /** * Returns the root node of this node. Equivalent to `getRoodNode()`. * * @return {Node} Top most element in the dom tree in which the node * exists. If the node is connected to a document this is either a * shadowRoot or the document; otherwise, it may be the node * itself or a node or document fragment containing it. */ getOwnerRoot() { return this.node.getRootNode(); } /** * For slot elements, returns the nodes assigned to the slot; otherwise * an empty array. It is equivalent to `<slot>.addignedNodes({flatten:true})`. * * @return {!Array<!Node>} Array of assigned nodes */ getDistributedNodes() { return (this.node.localName === 'slot') ? this.node.assignedNodes({flatten: true}) : []; } /** * Returns an array of all slots this element was distributed to. * * @return {!Array<!HTMLSlotElement>} Description */ getDestinationInsertionPoints() { let ip$ = []; let n = this.node.assignedSlot; while (n) { ip$.push(n); n = n.assignedSlot; } return ip$; } /** * Calls `importNode` on the `ownerDocument` for this node. * * @param {!Node} node Node to import * @param {boolean} deep True if the node should be cloned deeply during * import * @return {Node} Clone of given node imported to this owner document */ importNode(node, deep) { let doc = this.node instanceof Document ? this.node : this.node.ownerDocument; return doc.importNode(node, deep); } /** * @return {!Array<!Node>} Returns a flattened list of all child nodes and * nodes assigned to child slots. */ getEffectiveChildNodes() { return Polymer.FlattenedNodesObserver.getFlattenedNodes(this.node); } /** * Returns a filtered list of flattened child elements for this element based * on the given selector. * * @param {string} selector Selector to filter nodes against * @return {!Array<!HTMLElement>} List of flattened child elements */ queryDistributedElements(selector) { let c$ = this.getEffectiveChildNodes(); let list = []; for (let i=0, l=c$.length, c; (i<l) && (c=c$[i]); i++) { if ((c.nodeType === Node.ELEMENT_NODE) && matchesSelector(c, selector)) { list.push(c); } } return list; } /** * For shadow roots, returns the currently focused element within this * shadow root. * * @return {Node|undefined} Currently focused element */ get activeElement() { let node = this.node; return node._activeElement !== undefined ? node._activeElement : node.activeElement; } } function forwardMethods(proto, methods) { for (let i=0; i < methods.length; i++) { let method = methods[i]; /* eslint-disable valid-jsdoc */ proto[method] = /** @this {DomApi} */ function() { return this.node[method].apply(this.node, arguments); }; /* eslint-enable */ } } function forwardReadOnlyProperties(proto, properties) { for (let i=0; i < properties.length; i++) { let name = properties[i]; Object.defineProperty(proto, name, { get: function() { const domApi = /** @type {DomApi} */(this); return domApi.node[name]; }, configurable: true }); } } function forwardProperties(proto, properties) { for (let i=0; i < properties.length; i++) { let name = properties[i]; Object.defineProperty(proto, name, { get: function() { const domApi = /** @type {DomApi} */(this); return domApi.node[name]; }, set: function(value) { /** @type {DomApi} */ (this).node[name] = value; }, configurable: true }); } } forwardMethods(DomApi.prototype, [ 'cloneNode', 'appendChild', 'insertBefore', 'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute', 'querySelector', 'querySelectorAll' ]); forwardReadOnlyProperties(DomApi.prototype, [ 'parentNode', 'firstChild', 'lastChild', 'nextSibling', 'previousSibling', 'firstElementChild', 'lastElementChild', 'nextElementSibling', 'previousElementSibling', 'childNodes', 'children', 'classList' ]); forwardProperties(DomApi.prototype, [ 'textContent', 'innerHTML' ]); /** * Event API wrapper class returned from `Polymer.dom.(target)` when * `target` is an `Event`. */ class EventApi { constructor(event) { this.event = event; } /** * Returns the first node on the `composedPath` of this event. * * @return {!EventTarget} The node this event was dispatched to */ get rootTarget() { return this.event.composedPath()[0]; } /** * Returns the local (re-targeted) target for this event. * * @return {!EventTarget} The local (re-targeted) target for this event. */ get localTarget() { return this.event.target; } /** * Returns the `composedPath` for this event. * @return {!Array<!EventTarget>} The nodes this event propagated through */ get path() { return this.event.composedPath(); } } Polymer.DomApi = DomApi; /** * @function * @param {boolean=} deep * @return {!Node} */ Polymer.DomApi.prototype.cloneNode; /** * @function * @param {!Node} node * @return {!Node} */ Polymer.DomApi.prototype.appendChild; /** * @function * @param {!Node} newChild * @param {Node} refChild * @return {!Node} */ Polymer.DomApi.prototype.insertBefore; /** * @function * @param {!Node} node * @return {!Node} */ Polymer.DomApi.prototype.removeChild; /** * @function * @param {!Node} oldChild * @param {!Node} newChild * @return {!Node} */ Polymer.DomApi.prototype.replaceChild; /** * @function * @param {string} name * @param {string} value * @return {void} */ Polymer.DomApi.prototype.setAttribute; /** * @function * @param {string} name * @return {void} */ Polymer.DomApi.prototype.removeAttribute; /** * @function * @param {string} selector * @return {?Element} */ Polymer.DomApi.prototype.querySelector; /** * @function * @param {string} selector * @return {!NodeList<!Element>} */ Polymer.DomApi.prototype.querySelectorAll; /** * Legacy DOM and Event manipulation API wrapper factory used to abstract * differences between native Shadow DOM and "Shady DOM" when polyfilling on * older browsers. * * Note that in Polymer 2.x use of `Polymer.dom` is no longer required and * in the majority of cases simply facades directly to the standard native * API. * * @namespace * @summary Legacy DOM and Event manipulation API wrapper factory used to * abstract differences between native Shadow DOM and "Shady DOM." * @memberof Polymer * @param {(Node|Event)=} obj Node or event to operate on * @return {!DomApi|!EventApi} Wrapper providing either node API or event API */ Polymer.dom = function(obj) { obj = obj || document; if (!obj.__domApi) { let helper; if (obj instanceof Event) { helper = new EventApi(obj); } else { helper = new DomApi(obj); } obj.__domApi = helper; } return obj.__domApi; }; Polymer.dom.matchesSelector = matchesSelector; /** * Forces several classes of asynchronously queued tasks to flush: * - Debouncers added via `Polymer.enqueueDebouncer` * - ShadyDOM distribution * * This method facades to `Polymer.flush`. * * @memberof Polymer.dom */ Polymer.dom.flush = Polymer.flush; /** * Adds a `Polymer.Debouncer` to a list of globally flushable tasks. * * This method facades to `Polymer.enqueueDebouncer`. * * @memberof Polymer.dom * @param {!Polymer.Debouncer} debouncer Debouncer to enqueue */ Polymer.dom.addDebouncer = Polymer.enqueueDebouncer; })(); (function() { 'use strict'; let styleInterface = window.ShadyCSS; /** * Element class mixin that provides Polymer's "legacy" API intended to be * backward-compatible to the greatest extent possible with the API * found on the Polymer 1.x `Polymer.Base` prototype applied to all elements * defined using the `Polymer({...})` function. * * @mixinFunction * @polymer * @appliesMixin Polymer.ElementMixin * @appliesMixin Polymer.GestureEventListeners * @property isAttached {boolean} Set to `true` in this element's * `connectedCallback` and `false` in `disconnectedCallback` * @memberof Polymer * @summary Element class mixin that provides Polymer's "legacy" API */ Polymer.LegacyElementMixin = Polymer.dedupingMixin((base) => { /** * @constructor * @extends {base} * @implements {Polymer_ElementMixin} * @implements {Polymer_GestureEventListeners} * @implements {Polymer_DirMixin} * @private */ const legacyElementBase = Polymer.DirMixin(Polymer.GestureEventListeners(Polymer.ElementMixin(base))); /** * Map of simple names to touch action names * @dict */ const DIRECTION_MAP = { 'x': 'pan-x', 'y': 'pan-y', 'none': 'none', 'all': 'auto' }; /** * @polymer * @mixinClass * @extends {legacyElementBase} * @implements {Polymer_LegacyElementMixin} * @unrestricted */ class LegacyElement extends legacyElementBase { constructor() { super(); /** @type {boolean} */ this.isAttached; /** @type {WeakMap<!Element, !Object<string, !Function>>} */ this.__boundListeners; /** @type {Object<string, Function>} */ this._debouncers; } /** * Forwards `importMeta` from the prototype (i.e. from the info object * passed to `Polymer({...})`) to the static API. * * @return {!Object} The `import.meta` object set on the prototype * @suppress {missingProperties} `this` is always in the instance in * closure for some reason even in a static method, rather than the class */ static get importMeta() { return this.prototype.importMeta; } /** * Legacy callback called during the `constructor`, for overriding * by the user. * @return {void} */ created() {} /** * Provides an implementation of `connectedCallback` * which adds Polymer legacy API's `attached` method. * @return {void} * @override */ connectedCallback() { super.connectedCallback(); this.isAttached = true; this.attached(); } /** * Legacy callback called during `connectedCallback`, for overriding * by the user. * @return {void} */ attached() {} /** * Provides an implementation of `disconnectedCallback` * which adds Polymer legacy API's `detached` method. * @return {void} * @override */ disconnectedCallback() { super.disconnectedCallback(); this.isAttached = false; this.detached(); } /** * Legacy callback called during `disconnectedCallback`, for overriding * by the user. * @return {void} */ detached() {} /** * Provides an override implementation of `attributeChangedCallback` * which adds the Polymer legacy API's `attributeChanged` method. * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. * @param {?string} namespace Attribute namespace. * @return {void} * @override */ attributeChangedCallback(name, old, value, namespace) { if (old !== value) { super.attributeChangedCallback(name, old, value, namespace); this.attributeChanged(name, old, value); } } /** * Legacy callback called during `attributeChangedChallback`, for overriding * by the user. * @param {string} name Name of attribute. * @param {?string} old Old value of attribute. * @param {?string} value Current value of attribute. * @return {void} */ attributeChanged(name, old, value) {} // eslint-disable-line no-unused-vars /** * Overrides the default `Polymer.PropertyEffects` implementation to * add support for class initialization via the `_registered` callback. * This is called only when the first instance of the element is created. * * @return {void} * @override * @suppress {invalidCasts} */ _initializeProperties() { let proto = Object.getPrototypeOf(this); if (!proto.hasOwnProperty('__hasRegisterFinished')) { this._registered(); // backstop in case the `_registered` implementation does not set this proto.__hasRegisterFinished = true; } super._initializeProperties(); this.root = /** @type {HTMLElement} */(this); this.created(); // Ensure listeners are applied immediately so that they are // added before declarative event listeners. This allows an element to // decorate itself via an event prior to any declarative listeners // seeing the event. Note, this ensures compatibility with 1.x ordering. this._applyListeners(); } /** * Called automatically when an element is initializing. * Users may override this method to perform class registration time * work. The implementation should ensure the work is performed * only once for the class. * @protected * @return {void} */ _registered() {} /** * Overrides the default `Polymer.PropertyEffects` implementation to * add support for installing `hostAttributes` and `listeners`. * * @return {void} * @override */ ready() { this._ensureAttributes(); super.ready(); } /** * Ensures an element has required attributes. Called when the element * is being readied via `ready`. Users should override to set the * element's required attributes. The implementation should be sure * to check and not override existing attributes added by * the user of the element. Typically, setting attributes should be left * to the element user and not done here; reasonable exceptions include * setting aria roles and focusability. * @protected * @return {void} */ _ensureAttributes() {} /** * Adds element event listeners. Called when the element * is being readied via `ready`. Users should override to * add any required element event listeners. * In performance critical elements, the work done here should be kept * to a minimum since it is done before the element is rendered. In * these elements, consider adding listeners asynchronously so as not to * block render. * @protected * @return {void} */ _applyListeners() {} /** * Converts a typed JavaScript value to a string. * * Note this method is provided as backward-compatible legacy API * only. It is not directly called by any Polymer features. To customize * how properties are serialized to attributes for attribute bindings and * `reflectToAttribute: true` properties as well as this method, override * the `_serializeValue` method provided by `Polymer.PropertyAccessors`. * * @param {*} value Value to deserialize * @return {string | undefined} Serialized value */ serialize(value) { return this._serializeValue(value); } /** * Converts a string to a typed JavaScript value. * * Note this method is provided as backward-compatible legacy API * only. It is not directly called by any Polymer features. To customize * how attributes are deserialized to properties for in * `attributeChangedCallback`, override `_deserializeValue` method * provided by `Polymer.PropertyAccessors`. * * @param {string} value String to deserialize * @param {*} type Type to deserialize the string to * @return {*} Returns the deserialized value in the `type` given. */ deserialize(value, type) { return this._deserializeValue(value, type); } /** * Serializes a property to its associated attribute. * * Note this method is provided as backward-compatible legacy API * only. It is not directly called by any Polymer features. * * @param {string} property Property name to reflect. * @param {string=} attribute Attribute name to reflect. * @param {*=} value Property value to reflect. * @return {void} */ reflectPropertyToAttribute(property, attribute, value) { this._propertyToAttribute(property, attribute, value); } /** * Sets a typed value to an HTML attribute on a node. * * Note this method is provided as backward-compatible legacy API * only. It is not directly called by any Polymer features. * * @param {*} value Value to serialize. * @param {string} attribute Attribute name to serialize to. * @param {Element} node Element to set attribute to. * @return {void} */ serializeValueToAttribute(value, attribute, node) { this._valueToNodeAttribute(/** @type {Element} */ (node || this), value, attribute); } /** * Copies own properties (including accessor descriptors) from a source * object to a target object. * * @param {Object} prototype Target object to copy properties to. * @param {Object} api Source object to copy properties from. * @return {Object} prototype object that was passed as first argument. */ extend(prototype, api) { if (!(prototype && api)) { return prototype || api; } let n$ = Object.getOwnPropertyNames(api); for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) { let pd = Object.getOwnPropertyDescriptor(api, n); if (pd) { Object.defineProperty(prototype, n, pd); } } return prototype; } /** * Copies props from a source object to a target object. * * Note, this method uses a simple `for...in` strategy for enumerating * properties. To ensure only `ownProperties` are copied from source * to target and that accessor implementations are copied, use `extend`. * * @param {!Object} target Target object to copy properties to. * @param {!Object} source Source object to copy properties from. * @return {!Object} Target object that was passed as first argument. */ mixin(target, source) { for (let i in source) { target[i] = source[i]; } return target; } /** * Sets the prototype of an object. * * Note this method is provided as backward-compatible legacy API * only. It is not directly called by any Polymer features. * @param {Object} object The object on which to set the prototype. * @param {Object} prototype The prototype that will be set on the given * `object`. * @return {Object} Returns the given `object` with its prototype set * to the given `prototype` object. */ chainObject(object, prototype) { if (object && prototype && object !== prototype) { object.__proto__ = prototype; } return object; } /* **** Begin Template **** */ /** * Calls `importNode` on the `content` of the `template` specified and * returns a document fragment containing the imported content. * * @param {HTMLTemplateElement} template HTML template element to instance. * @return {!DocumentFragment} Document fragment containing the imported * template content. */ instanceTemplate(template) { let content = this.constructor._contentForTemplate(template); let dom = /** @type {!DocumentFragment} */ (document.importNode(content, true)); return dom; } /* **** Begin Events **** */ /** * Dispatches a custom event with an optional detail value. * * @param {string} type Name of event type. * @param {*=} detail Detail value containing event-specific * payload. * @param {{ bubbles: (boolean|undefined), cancelable: (boolean|undefined), composed: (boolean|undefined) }=} * options Object specifying options. These may include: * `bubbles` (boolean, defaults to `true`), * `cancelable` (boolean, defaults to false), and * `node` on which to fire the event (HTMLElement, defaults to `this`). * @return {!Event} The new event that was fired. */ fire(type, detail, options) { options = options || {}; detail = (detail === null || detail === undefined) ? {} : detail; let event = new Event(type, { bubbles: options.bubbles === undefined ? true : options.bubbles, cancelable: Boolean(options.cancelable), composed: options.composed === undefined ? true: options.composed }); event.detail = detail; let node = options.node || this; node.dispatchEvent(event); return event; } /** * Convenience method to add an event listener on a given element, * late bound to a named method on this element. * * @param {Element} node Element to add event listener to. * @param {string} eventName Name of event to listen for. * @param {string} methodName Name of handler method on `this` to call. * @return {void} */ listen(node, eventName, methodName) { node = /** @type {!Element} */ (node || this); let hbl = this.__boundListeners || (this.__boundListeners = new WeakMap()); let bl = hbl.get(node); if (!bl) { bl = {}; hbl.set(node, bl); } let key = eventName + methodName; if (!bl[key]) { bl[key] = this._addMethodEventListenerToNode( node, eventName, methodName, this); } } /** * Convenience method to remove an event listener from a given element, * late bound to a named method on this element. * * @param {Element} node Element to remove event listener from. * @param {string} eventName Name of event to stop listening to. * @param {string} methodName Name of handler method on `this` to not call anymore. * @return {void} */ unlisten(node, eventName, methodName) { node = /** @type {!Element} */ (node || this); let bl = this.__boundListeners && this.__boundListeners.get(node); let key = eventName + methodName; let handler = bl && bl[key]; if (handler) { this._removeEventListenerFromNode(node, eventName, handler); bl[key] = null; } } /** * Override scrolling behavior to all direction, one direction, or none. * * Valid scroll directions: * - 'all': scroll in any direction * - 'x': scroll only in the 'x' direction * - 'y': scroll only in the 'y' direction * - 'none': disable scrolling for this node * * @param {string=} direction Direction to allow scrolling * Defaults to `all`. * @param {Element=} node Element to apply scroll direction setting. * Defaults to `this`. * @return {void} */ setScrollDirection(direction, node) { Polymer.Gestures.setTouchAction(/** @type {Element} */ (node || this), DIRECTION_MAP[direction] || 'auto'); } /* **** End Events **** */ /** * Convenience method to run `querySelector` on this local DOM scope. * * This function calls `Polymer.dom(this.root).querySelector(slctr)`. * * @param {string} slctr Selector to run on this local DOM scope * @return {Element} Element found by the selector, or null if not found. */ $$(slctr) { return this.root.querySelector(slctr); } /** * Return the element whose local dom within which this element * is contained. This is a shorthand for * `this.getRootNode().host`. * @this {Element} */ get domHost() { let root = this.getRootNode(); return (root instanceof DocumentFragment) ? /** @type {ShadowRoot} */ (root).host : root; } /** * Force this element to distribute its children to its local dom. * This should not be necessary as of Polymer 2.0.2 and is provided only * for backwards compatibility. * @return {void} */ distributeContent() { if (window.ShadyDOM && this.shadowRoot) { ShadyDOM.flush(); } } /** * Returns a list of nodes that are the effective childNodes. The effective * childNodes list is the same as the element's childNodes except that * any `<content>` elements are replaced with the list of nodes distributed * to the `<content>`, the result of its `getDistributedNodes` method. * @return {!Array<!Node>} List of effective child nodes. * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement */ getEffectiveChildNodes() { const thisEl = /** @type {Element} */ (this); const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(thisEl)); return domApi.getEffectiveChildNodes(); } /** * Returns a list of nodes distributed within this element that match * `selector`. These can be dom children or elements distributed to * children that are insertion points. * @param {string} selector Selector to run. * @return {!Array<!Node>} List of distributed elements that match selector. * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement */ queryDistributedElements(selector) { const thisEl = /** @type {Element} */ (this); const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(thisEl)); return domApi.queryDistributedElements(selector); } /** * Returns a list of elements that are the effective children. The effective * children list is the same as the element's children except that * any `<content>` elements are replaced with the list of elements * distributed to the `<content>`. * * @return {!Array<!Node>} List of effective children. */ getEffectiveChildren() { let list = this.getEffectiveChildNodes(); return list.filter(function(/** @type {!Node} */ n) { return (n.nodeType === Node.ELEMENT_NODE); }); } /** * Returns a string of text content that is the concatenation of the * text content's of the element's effective childNodes (the elements * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>. * * @return {string} List of effective children. */ getEffectiveTextContent() { let cn = this.getEffectiveChildNodes(); let tc = []; for (let i=0, c; (c = cn[i]); i++) { if (c.nodeType !== Node.COMMENT_NODE) { tc.push(c.textContent); } } return tc.join(''); } /** * Returns the first effective childNode within this element that * match `selector`. These can be dom child nodes or elements distributed * to children that are insertion points. * @param {string} selector Selector to run. * @return {Node} First effective child node that matches selector. */ queryEffectiveChildren(selector) { let e$ = this.queryDistributedElements(selector); return e$ && e$[0]; } /** * Returns a list of effective childNodes within this element that * match `selector`. These can be dom child nodes or elements distributed * to children that are insertion points. * @param {string} selector Selector to run. * @return {!Array<!Node>} List of effective child nodes that match selector. */ queryAllEffectiveChildren(selector) { return this.queryDistributedElements(selector); } /** * Returns a list of nodes distributed to this element's `<slot>`. * * If this element contains more than one `<slot>` in its local DOM, * an optional selector may be passed to choose the desired content. * * @param {string=} slctr CSS selector to choose the desired * `<slot>`. Defaults to `content`. * @return {!Array<!Node>} List of distributed nodes for the `<slot>`. */ getContentChildNodes(slctr) { let content = this.root.querySelector(slctr || 'slot'); return content ? /** @type {Polymer.DomApi} */(Polymer.dom(content)).getDistributedNodes() : []; } /** * Returns a list of element children distributed to this element's * `<slot>`. * * If this element contains more than one `<slot>` in its * local DOM, an optional selector may be passed to choose the desired * content. This method differs from `getContentChildNodes` in that only * elements are returned. * * @param {string=} slctr CSS selector to choose the desired * `<content>`. Defaults to `content`. * @return {!Array<!HTMLElement>} List of distributed nodes for the * `<slot>`. * @suppress {invalidCasts} */ getContentChildren(slctr) { let children = /** @type {!Array<!HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) { return (n.nodeType === Node.ELEMENT_NODE); })); return children; } /** * Checks whether an element is in this element's light DOM tree. * * @param {?Node} node The element to be checked. * @return {boolean} true if node is in this element's light DOM tree. * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement */ isLightDescendant(node) { const thisNode = /** @type {Node} */ (this); return thisNode !== node && thisNode.contains(node) && thisNode.getRootNode() === node.getRootNode(); } /** * Checks whether an element is in this element's local DOM tree. * * @param {!Element} node The element to be checked. * @return {boolean} true if node is in this element's local DOM tree. */ isLocalDescendant(node) { return this.root === node.getRootNode(); } /** * No-op for backwards compatibility. This should now be handled by * ShadyCss library. * @param {*} container Unused * @param {*} shouldObserve Unused * @return {void} */ scopeSubtree(container, shouldObserve) { // eslint-disable-line no-unused-vars } /** * Returns the computed style value for the given property. * @param {string} property The css property name. * @return {string} Returns the computed css property value for the given * `property`. * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement */ getComputedStyleValue(property) { return styleInterface.getComputedStyleValue(/** @type {!Element} */(this), property); } // debounce /** * Call `debounce` to collapse multiple requests for a named task into * one invocation which is made after the wait time has elapsed with * no new request. If no wait time is given, the callback will be called * at microtask timing (guaranteed before paint). * * debouncedClickAction(e) { * // will not call `processClick` more than once per 100ms * this.debounce('click', function() { * this.processClick(); * } 100); * } * * @param {string} jobName String to identify the debounce job. * @param {function():void} callback Function that is called (with `this` * context) when the wait time elapses. * @param {number} wait Optional wait time in milliseconds (ms) after the * last signal that must elapse before invoking `callback` * @return {!Object} Returns a debouncer object on which exists the * following methods: `isActive()` returns true if the debouncer is * active; `cancel()` cancels the debouncer if it is active; * `flush()` immediately invokes the debounced callback if the debouncer * is active. */ debounce(jobName, callback, wait) { this._debouncers = this._debouncers || {}; return this._debouncers[jobName] = Polymer.Debouncer.debounce( this._debouncers[jobName] , wait > 0 ? Polymer.Async.timeOut.after(wait) : Polymer.Async.microTask , callback.bind(this)); } /** * Returns whether a named debouncer is active. * * @param {string} jobName The name of the debouncer started with `debounce` * @return {boolean} Whether the debouncer is active (has not yet fired). */ isDebouncerActive(jobName) { this._debouncers = this._debouncers || {}; let debouncer = this._debouncers[jobName]; return !!(debouncer && debouncer.isActive()); } /** * Immediately calls the debouncer `callback` and inactivates it. * * @param {string} jobName The name of the debouncer started with `debounce` * @return {void} */ flushDebouncer(jobName) { this._debouncers = this._debouncers || {}; let debouncer = this._debouncers[jobName]; if (debouncer) { debouncer.flush(); } } /** * Cancels an active debouncer. The `callback` will not be called. * * @param {string} jobName The name of the debouncer started with `debounce` * @return {void} */ cancelDebouncer(jobName) { this._debouncers = this._debouncers || {}; let debouncer = this._debouncers[jobName]; if (debouncer) { debouncer.cancel(); } } /** * Runs a callback function asynchronously. * * By default (if no waitTime is specified), async callbacks are run at * microtask timing, which will occur before paint. * * @param {!Function} callback The callback function to run, bound to `this`. * @param {number=} waitTime Time to wait before calling the * `callback`. If unspecified or 0, the callback will be run at microtask * timing (before paint). * @return {number} Handle that may be used to cancel the async job. */ async(callback, waitTime) { return waitTime > 0 ? Polymer.Async.timeOut.run(callback.bind(this), waitTime) : ~Polymer.Async.microTask.run(callback.bind(this)); } /** * Cancels an async operation started with `async`. * * @param {number} handle Handle returned from original `async` call to * cancel. * @return {void} */ cancelAsync(handle) { handle < 0 ? Polymer.Async.microTask.cancel(~handle) : Polymer.Async.timeOut.cancel(handle); } // other /** * Convenience method for creating an element and configuring it. * * @param {string} tag HTML element tag to create. * @param {Object=} props Object of properties to configure on the * instance. * @return {!Element} Newly created and configured element. */ create(tag, props) { let elt = document.createElement(tag); if (props) { if (elt.setProperties) { elt.setProperties(props); } else { for (let n in props) { elt[n] = props[n]; } } } return elt; } /** * Convenience method for importing an HTML document imperatively. * * This method creates a new `<link rel="import">` element with * the provided URL and appends it to the document to start loading. * In the `onload` callback, the `import` property of the `link` * element will contain the imported document contents. * * @param {string} href URL to document to load. * @param {?function(!Event):void=} onload Callback to notify when an import successfully * loaded. * @param {?function(!ErrorEvent):void=} onerror Callback to notify when an import * unsuccessfully loaded. * @param {boolean=} optAsync True if the import should be loaded `async`. * Defaults to `false`. * @return {!HTMLLinkElement} The link element for the URL to be loaded. */ importHref(href, onload, onerror, optAsync) { // eslint-disable-line no-unused-vars let loadFn = onload ? onload.bind(this) : null; let errorFn = onerror ? onerror.bind(this) : null; return Polymer.importHref(href, loadFn, errorFn, optAsync); } /** * Polyfill for Element.prototype.matches, which is sometimes still * prefixed. * * @param {string} selector Selector to test. * @param {!Element=} node Element to test the selector against. * @return {boolean} Whether the element matches the selector. */ elementMatches(selector, node) { return Polymer.dom.matchesSelector(/** @type {!Element} */ (node || this), selector); } /** * Toggles an HTML attribute on or off. * * @param {string} name HTML attribute name * @param {boolean=} bool Boolean to force the attribute on or off. * When unspecified, the state of the attribute will be reversed. * @param {Element=} node Node to target. Defaults to `this`. * @return {void} */ toggleAttribute(name, bool, node) { node = /** @type {Element} */ (node || this); if (arguments.length == 1) { bool = !node.hasAttribute(name); } if (bool) { node.setAttribute(name, ''); } else { node.removeAttribute(name); } } /** * Toggles a CSS class on or off. * * @param {string} name CSS class name * @param {boolean=} bool Boolean to force the class on or off. * When unspecified, the state of the class will be reversed. * @param {Element=} node Node to target. Defaults to `this`. * @return {void} */ toggleClass(name, bool, node) { node = /** @type {Element} */ (node || this); if (arguments.length == 1) { bool = !node.classList.contains(name); } if (bool) { node.classList.add(name); } else { node.classList.remove(name); } } /** * Cross-platform helper for setting an element's CSS `transform` property. * * @param {string} transformText Transform setting. * @param {Element=} node Element to apply the transform to. * Defaults to `this` * @return {void} */ transform(transformText, node) { node = /** @type {Element} */ (node || this); node.style.webkitTransform = transformText; node.style.transform = transformText; } /** * Cross-platform helper for setting an element's CSS `translate3d` * property. * * @param {number} x X offset. * @param {number} y Y offset. * @param {number} z Z offset. * @param {Element=} node Element to apply the transform to. * Defaults to `this`. * @return {void} */ translate3d(x, y, z, node) { node = /** @type {Element} */ (node || this); this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node); } /** * Removes an item from an array, if it exists. * * If the array is specified by path, a change notification is * generated, so that observers, data bindings and computed * properties watching that path can update. * * If the array is passed directly, **no change * notification is generated**. * * @param {string | !Array<number|string>} arrayOrPath Path to array from which to remove the item * (or the array itself). * @param {*} item Item to remove. * @return {Array} Array containing item removed. */ arrayDelete(arrayOrPath, item) { let index; if (Array.isArray(arrayOrPath)) { index = arrayOrPath.indexOf(item); if (index >= 0) { return arrayOrPath.splice(index, 1); } } else { let arr = Polymer.Path.get(this, arrayOrPath); index = arr.indexOf(item); if (index >= 0) { return this.splice(arrayOrPath, index, 1); } } return null; } // logging /** * Facades `console.log`/`warn`/`error` as override point. * * @param {string} level One of 'log', 'warn', 'error' * @param {Array} args Array of strings or objects to log * @return {void} */ _logger(level, args) { // accept ['foo', 'bar'] and [['foo', 'bar']] if (Array.isArray(args) && args.length === 1 && Array.isArray(args[0])) { args = args[0]; } switch(level) { case 'log': case 'warn': case 'error': console[level](...args); } } /** * Facades `console.log` as an override point. * * @param {...*} args Array of strings or objects to log * @return {void} */ _log(...args) { this._logger('log', args); } /** * Facades `console.warn` as an override point. * * @param {...*} args Array of strings or objects to log * @return {void} */ _warn(...args) { this._logger('warn', args); } /** * Facades `console.error` as an override point. * * @param {...*} args Array of strings or objects to log * @return {void} */ _error(...args) { this._logger('error', args); } /** * Formats a message using the element type an a method name. * * @param {string} methodName Method name to associate with message * @param {...*} args Array of strings or objects to log * @return {Array} Array with formatting information for `console` * logging. */ _logf(methodName, ...args) { return ['[%s::%s]', this.is, methodName, ...args]; } } LegacyElement.prototype.is = ''; return LegacyElement; }); })(); (function() { 'use strict'; const lifecycleProps = { attached: true, detached: true, ready: true, created: true, beforeRegister: true, registered: true, attributeChanged: true, listeners: true, hostAttributes: true }; const excludeOnInfo = { attached: true, detached: true, ready: true, created: true, beforeRegister: true, registered: true, attributeChanged: true, behaviors: true, _noAccessors: true }; const excludeOnBehaviors = Object.assign({ listeners: true, hostAttributes: true, properties: true, observers: true, }, excludeOnInfo); function copyProperties(source, target, excludeProps) { const noAccessors = source._noAccessors; for (let p in source) { if (!(p in excludeProps)) { if (noAccessors) { target[p] = source[p]; } else { let pd = Object.getOwnPropertyDescriptor(source, p); if (pd) { // ensure property is configurable so that a later behavior can // re-configure it. pd.configurable = true; Object.defineProperty(target, p, pd); } } } } } /** * Applies a "legacy" behavior or array of behaviors to the provided class. * * Note: this method will automatically also apply the `Polymer.LegacyElementMixin` * to ensure that any legacy behaviors can rely on legacy Polymer API on * the underlying element. * * @template T * @param {!Object|!Array<!Object>} behaviors Behavior object or array of behaviors. * @param {function(new:T)} klass Element class. * @return {function(new:T)} Returns a new Element class extended by the * passed in `behaviors` and also by `Polymer.LegacyElementMixin`. * @memberof Polymer * @suppress {invalidCasts, checkTypes} */ function mixinBehaviors(behaviors, klass) { return GenerateClassFromInfo({}, Polymer.LegacyElementMixin(klass), behaviors); } // NOTE: // 1.x // Behaviors were mixed in *in reverse order* and de-duped on the fly. // The rule was that behavior properties were copied onto the element // prototype if and only if the property did not already exist. // Given: Polymer{ behaviors: [A, B, C, A, B]}, property copy order was: // (1), B, (2), A, (3) C. This means prototype properties win over // B properties win over A win over C. This mirrors what would happen // with inheritance if element extended B extended A extended C. // // Again given, Polymer{ behaviors: [A, B, C, A, B]}, the resulting // `behaviors` array was [C, A, B]. // Behavior lifecycle methods were called in behavior array order // followed by the element, e.g. (1) C.created, (2) A.created, // (3) B.created, (4) element.created. There was no support for // super, and "super-behavior" methods were callable only by name). // // 2.x // Behaviors are made into proper mixins which live in the // element's prototype chain. Behaviors are placed in the element prototype // eldest to youngest and de-duped youngest to oldest: // So, first [A, B, C, A, B] becomes [C, A, B] then, // the element prototype becomes (oldest) (1) Polymer.Element, (2) class(C), // (3) class(A), (4) class(B), (5) class(Polymer({...})). // Result: // This means element properties win over B properties win over A win // over C. (same as 1.x) // If lifecycle is called (super then me), order is // (1) C.created, (2) A.created, (3) B.created, (4) element.created // (again same as 1.x) function applyBehaviors(proto, behaviors, lifecycle) { for (let i=0; i<behaviors.length; i++) { applyInfo(proto, behaviors[i], lifecycle, excludeOnBehaviors); } } function applyInfo(proto, info, lifecycle, excludeProps) { copyProperties(info, proto, excludeProps); for (let p in lifecycleProps) { if (info[p]) { lifecycle[p] = lifecycle[p] || []; lifecycle[p].push(info[p]); } } } /** * @param {Array} behaviors List of behaviors to flatten. * @param {Array=} list Target list to flatten behaviors into. * @param {Array=} exclude List of behaviors to exclude from the list. * @return {!Array} Returns the list of flattened behaviors. */ function flattenBehaviors(behaviors, list, exclude) { list = list || []; for (let i=behaviors.length-1; i >= 0; i--) { let b = behaviors[i]; if (b) { if (Array.isArray(b)) { flattenBehaviors(b, list); } else { // dedup if (list.indexOf(b) < 0 && (!exclude || exclude.indexOf(b) < 0)) { list.unshift(b); } } } else { console.warn('behavior is null, check for missing or 404 import'); } } return list; } /* Note about construction and extension of legacy classes. [Changed in Q4 2018 to optimize performance.] When calling `Polymer` or `mixinBehaviors`, the generated class below is made. The list of behaviors was previously made into one generated class per behavior, but this is no longer the case as behaviors are now called manually. Note, there may *still* be multiple generated classes in the element's prototype chain if extension is used with `mixinBehaviors`. The generated class is directly tied to the info object and behaviors used to create it. That list of behaviors is filtered so it's only the behaviors not active on the superclass. In order to call through to the entire list of lifecycle methods, it's important to call `super`. The element's `properties` and `observers` are controlled via the finalization mechanism provided by `PropertiesMixin`. `Properties` and `observers` are collected by manually traversing the prototype chain and merging. To limit changes, the `_registered` method is called via `_initializeProperties` and not `_finalizeClass`. */ /** * @param {!PolymerInit} info Polymer info object * @param {function(new:HTMLElement)} Base base class to extend with info object * @param {Object} behaviors behaviors to copy into the element * @return {function(new:HTMLElement)} Generated class * @suppress {checkTypes} * @private */ function GenerateClassFromInfo(info, Base, behaviors) { // manages behavior and lifecycle processing (filled in after class definition) let behaviorList; const lifecycle = {}; /** @private */ class PolymerGenerated extends Base { // explicitly not calling super._finalizeClass static _finalizeClass() { // if calling via a subclass that hasn't been generated, pass through to super if (!this.hasOwnProperty(window.JSCompiler_renameProperty('generatedFrom', this))) { super._finalizeClass(); } else { // interleave properties and observers per behavior and `info` if (behaviorList) { for (let i=0, b; i < behaviorList.length; i++) { b = behaviorList[i]; if (b.properties) { this.createProperties(b.properties); } if (b.observers) { this.createObservers(b.observers, b.properties); } } } if (info.properties) { this.createProperties(info.properties); } if (info.observers) { this.createObservers(info.observers, info.properties); } // make sure to prepare the element template this._prepareTemplate(); } } static get properties() { const properties = {}; if (behaviorList) { for (let i=0; i < behaviorList.length; i++) { Object.assign(properties, behaviorList[i].properties); } } Object.assign(properties, info.properties); return properties; } static get observers() { let observers = []; if (behaviorList) { for (let i=0, b; i < behaviorList.length; i++) { b = behaviorList[i]; if (b.observers) { observers = observers.concat(b.observers); } } } if (info.observers) { observers = observers.concat(info.observers); } return observers; } /** * @return {void} */ created() { super.created(); const list = lifecycle.created; if (list) { for (let i=0; i < list.length; i++) { list[i].call(this); } } } /** * @return {void} */ _registered() { /* NOTE: `beforeRegister` is called here for bc, but the behavior is different than in 1.x. In 1.0, the method was called *after* mixing prototypes together but *before* processing of meta-objects. However, dynamic effects can still be set here and can be done either in `beforeRegister` or `registered`. It is no longer possible to set `is` in `beforeRegister` as you could in 1.x. */ // only proceed if the generated class' prototype has not been registered. const generatedProto = PolymerGenerated.prototype; if (!generatedProto.hasOwnProperty('__hasRegisterFinished')) { generatedProto.__hasRegisterFinished = true; // ensure superclass is registered first. super._registered(); // copy properties onto the generated class lazily if we're optimizing, if (Polymer.legacyOptimizations) { copyPropertiesToProto(generatedProto); } // make sure legacy lifecycle is called on the *element*'s prototype // and not the generated class prototype; if the element has been // extended, these are *not* the same. const proto = Object.getPrototypeOf(this); let list = lifecycle.beforeRegister; if (list) { for (let i=0; i < list.length; i++) { list[i].call(proto); } } list = lifecycle.registered; if (list) { for (let i=0; i < list.length; i++) { list[i].call(proto); } } } } /** * @return {void} */ _applyListeners() { super._applyListeners(); const list = lifecycle.listeners; if (list) { for (let i=0; i < list.length; i++) { const listeners = list[i]; if (listeners) { for (let l in listeners) { this._addMethodEventListenerToNode(this, l, listeners[l]); } } } } } // note: exception to "super then me" rule; // do work before calling super so that super attributes // only apply if not already set. /** * @return {void} */ _ensureAttributes() { const list = lifecycle.hostAttributes; if (list) { for (let i=list.length-1; i >= 0; i--) { const hostAttributes = list[i]; for (let a in hostAttributes) { this._ensureAttribute(a, hostAttributes[a]); } } } super._ensureAttributes(); } /** * @return {void} */ ready() { super.ready(); let list = lifecycle.ready; if (list) { for (let i=0; i < list.length; i++) { list[i].call(this); } } } /** * @return {void} */ attached() { super.attached(); let list = lifecycle.attached; if (list) { for (let i=0; i < list.length; i++) { list[i].call(this); } } } /** * @return {void} */ detached() { super.detached(); let list = lifecycle.detached; if (list) { for (let i=0; i < list.length; i++) { list[i].call(this); } } } /** * Implements native Custom Elements `attributeChangedCallback` to * set an attribute value to a property via `_attributeToProperty`. * * @param {string} name Name of attribute that changed * @param {?string} old Old attribute value * @param {?string} value New attribute value * @return {void} */ attributeChanged(name, old, value) { super.attributeChanged(); let list = lifecycle.attributeChanged; if (list) { for (let i=0; i < list.length; i++) { list[i].call(this, name, old, value); } } } } // apply behaviors, note actual copying is done lazily at first instance creation if (behaviors) { // NOTE: ensure the behavior is extending a class with // legacy element api. This is necessary since behaviors expect to be able // to access 1.x legacy api. if (!Array.isArray(behaviors)) { behaviors = [behaviors]; } let superBehaviors = Base.prototype.behaviors; // get flattened, deduped list of behaviors *not* already on super class behaviorList = flattenBehaviors(behaviors, null, superBehaviors); PolymerGenerated.prototype.behaviors = superBehaviors ? superBehaviors.concat(behaviors) : behaviorList; } const copyPropertiesToProto = (proto) => { if (behaviorList) { applyBehaviors(proto, behaviorList, lifecycle); } applyInfo(proto, info, lifecycle, excludeOnInfo); }; // copy properties if we're not optimizing if (!Polymer.legacyOptimizations) { copyPropertiesToProto(PolymerGenerated.prototype); } PolymerGenerated.generatedFrom = info; return PolymerGenerated; } /** * Generates a class that extends `Polymer.LegacyElement` based on the * provided info object. Metadata objects on the `info` object * (`properties`, `observers`, `listeners`, `behaviors`, `is`) are used * for Polymer's meta-programming systems, and any functions are copied * to the generated class. * * Valid "metadata" values are as follows: * * `is`: String providing the tag name to register the element under. In * addition, if a `dom-module` with the same id exists, the first template * in that `dom-module` will be stamped into the shadow root of this element, * with support for declarative event listeners (`on-...`), Polymer data * bindings (`[[...]]` and `{{...}}`), and id-based node finding into * `this.$`. * * `properties`: Object describing property-related metadata used by Polymer * features (key: property names, value: object containing property metadata). * Valid keys in per-property metadata include: * - `type` (String|Number|Object|Array|...): Used by * `attributeChangedCallback` to determine how string-based attributes * are deserialized to JavaScript property values. * - `notify` (boolean): Causes a change in the property to fire a * non-bubbling event called `<property>-changed`. Elements that have * enabled two-way binding to the property use this event to observe changes. * - `readOnly` (boolean): Creates a getter for the property, but no setter. * To set a read-only property, use the private setter method * `_setProperty(property, value)`. * - `observer` (string): Observer method name that will be called when * the property changes. The arguments of the method are * `(value, previousValue)`. * - `computed` (string): String describing method and dependent properties * for computing the value of this property (e.g. `'computeFoo(bar, zot)'`). * Computed properties are read-only by default and can only be changed * via the return value of the computing method. * * `observers`: Array of strings describing multi-property observer methods * and their dependent properties (e.g. `'observeABC(a, b, c)'`). * * `listeners`: Object describing event listeners to be added to each * instance of this element (key: event name, value: method name). * * `behaviors`: Array of additional `info` objects containing metadata * and callbacks in the same format as the `info` object here which are * merged into this element. * * `hostAttributes`: Object listing attributes to be applied to the host * once created (key: attribute name, value: attribute value). Values * are serialized based on the type of the value. Host attributes should * generally be limited to attributes such as `tabIndex` and `aria-...`. * Attributes in `hostAttributes` are only applied if a user-supplied * attribute is not already present (attributes in markup override * `hostAttributes`). * * In addition, the following Polymer-specific callbacks may be provided: * - `registered`: called after first instance of this element, * - `created`: called during `constructor` * - `attached`: called during `connectedCallback` * - `detached`: called during `disconnectedCallback` * - `ready`: called before first `attached`, after all properties of * this element have been propagated to its template and all observers * have run * * @param {!PolymerInit} info Object containing Polymer metadata and functions * to become class methods. * @template T * @param {function(T):T} mixin Optional mixin to apply to legacy base class * before extending with Polymer metaprogramming. * @return {function(new:HTMLElement)} Generated class * @memberof Polymer */ Polymer.Class = function(info, mixin) { if (!info) { console.warn('Polymer.Class requires `info` argument'); } let klass = mixin ? mixin(Polymer.LegacyElementMixin(HTMLElement)) : Polymer.LegacyElementMixin(HTMLElement); klass = GenerateClassFromInfo(info, klass, info.behaviors); if (info._enableDisableUpgrade) { klass = Polymer.DisableUpgradeMixin(klass); } // decorate klass with registration info klass.is = klass.prototype.is = info.is; return klass; }; Polymer.mixinBehaviors = mixinBehaviors; })(); (function() { 'use strict'; /** * Legacy class factory and registration helper for defining Polymer * elements. * * This method is equivalent to * `customElements.define(info.is, Polymer.Class(info));` * * See `Polymer.Class` for details on valid legacy metadata format for `info`. * * @global * @override * @function Polymer * @param {!PolymerInit} info Object containing Polymer metadata and functions * to become class methods. * @return {function(new: HTMLElement)} Generated class * @suppress {duplicate, invalidCasts, checkTypes} */ window.Polymer._polymerFn = function(info) { // if input is a `class` (aka a function with a prototype), use the prototype // remember that the `constructor` will never be called let klass; if (typeof info === 'function') { klass = info; } else { klass = Polymer.Class(info); } customElements.define(klass.is, /** @type {!HTMLElement} */(klass)); return klass; }; })(); (function() { 'use strict'; // Common implementation for mixin & behavior function mutablePropertyChange(inst, property, value, old, mutableData) { let isObject; if (mutableData) { isObject = (typeof value === 'object' && value !== null); // Pull `old` for Objects from temp cache, but treat `null` as a primitive if (isObject) { old = inst.__dataTemp[property]; } } // Strict equality check, but return false for NaN===NaN let shouldChange = (old !== value && (old === old || value === value)); // Objects are stored in temporary cache (cleared at end of // turn), which is used for dirty-checking if (isObject && shouldChange) { inst.__dataTemp[property] = value; } return shouldChange; } /** * Element class mixin to skip strict dirty-checking for objects and arrays * (always consider them to be "dirty"), for use on elements utilizing * `Polymer.PropertyEffects` * * By default, `Polymer.PropertyEffects` performs strict dirty checking on * objects, which means that any deep modifications to an object or array will * not be propagated unless "immutable" data patterns are used (i.e. all object * references from the root to the mutation were changed). * * Polymer also provides a proprietary data mutation and path notification API * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient * mutation and notification of deep changes in an object graph to all elements * bound to the same object graph. * * In cases where neither immutable patterns nor the data mutation API can be * used, applying this mixin will cause Polymer to skip dirty checking for * objects and arrays (always consider them to be "dirty"). This allows a * user to make a deep modification to a bound object graph, and then either * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` * (e.g. `this.notifyPath('items')`) to update the tree. Note that all * elements that wish to be updated based on deep mutations must apply this * mixin or otherwise skip strict dirty checking for objects/arrays. * Specifically, any elements in the binding tree between the source of a * mutation and the consumption of it must apply this mixin or enable the * `Polymer.OptionalMutableData` mixin. * * In order to make the dirty check strategy configurable, see * `Polymer.OptionalMutableData`. * * Note, the performance characteristics of propagating large object graphs * will be worse as opposed to using strict dirty checking with immutable * patterns or Polymer's path notification API. * * @mixinFunction * @polymer * @memberof Polymer * @summary Element class mixin to skip strict dirty-checking for objects * and arrays */ Polymer.MutableData = Polymer.dedupingMixin(superClass => { /** * @polymer * @mixinClass * @implements {Polymer_MutableData} */ class MutableData extends superClass { /** * Overrides `Polymer.PropertyEffects` to provide option for skipping * strict equality checking for Objects and Arrays. * * This method pulls the value to dirty check against from the `__dataTemp` * cache (rather than the normal `__data` cache) for Objects. Since the temp * cache is cleared at the end of a turn, this implementation allows * side-effects of deep object changes to be processed by re-setting the * same object (using the temp cache as an in-turn backstop to prevent * cycles due to 2-way notification). * * @param {string} property Property name * @param {*} value New property value * @param {*} old Previous property value * @return {boolean} Whether the property should be considered a change * @protected */ _shouldPropertyChange(property, value, old) { return mutablePropertyChange(this, property, value, old, true); } } return MutableData; }); /** * Element class mixin to add the optional ability to skip strict * dirty-checking for objects and arrays (always consider them to be * "dirty") by setting a `mutable-data` attribute on an element instance. * * By default, `Polymer.PropertyEffects` performs strict dirty checking on * objects, which means that any deep modifications to an object or array will * not be propagated unless "immutable" data patterns are used (i.e. all object * references from the root to the mutation were changed). * * Polymer also provides a proprietary data mutation and path notification API * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient * mutation and notification of deep changes in an object graph to all elements * bound to the same object graph. * * In cases where neither immutable patterns nor the data mutation API can be * used, applying this mixin will allow Polymer to skip dirty checking for * objects and arrays (always consider them to be "dirty"). This allows a * user to make a deep modification to a bound object graph, and then either * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` * (e.g. `this.notifyPath('items')`) to update the tree. Note that all * elements that wish to be updated based on deep mutations must apply this * mixin or otherwise skip strict dirty checking for objects/arrays. * Specifically, any elements in the binding tree between the source of a * mutation and the consumption of it must enable this mixin or apply the * `Polymer.MutableData` mixin. * * While this mixin adds the ability to forgo Object/Array dirty checking, * the `mutableData` flag defaults to false and must be set on the instance. * * Note, the performance characteristics of propagating large object graphs * will be worse by relying on `mutableData: true` as opposed to using * strict dirty checking with immutable patterns or Polymer's path notification * API. * * @mixinFunction * @polymer * @memberof Polymer * @summary Element class mixin to optionally skip strict dirty-checking * for objects and arrays */ Polymer.OptionalMutableData = Polymer.dedupingMixin(superClass => { /** * @mixinClass * @polymer * @implements {Polymer_OptionalMutableData} */ class OptionalMutableData extends superClass { static get properties() { return { /** * Instance-level flag for configuring the dirty-checking strategy * for this element. When true, Objects and Arrays will skip dirty * checking, otherwise strict equality checking will be used. */ mutableData: Boolean }; } /** * Overrides `Polymer.PropertyEffects` to provide option for skipping * strict equality checking for Objects and Arrays. * * When `this.mutableData` is true on this instance, this method * pulls the value to dirty check against from the `__dataTemp` cache * (rather than the normal `__data` cache) for Objects. Since the temp * cache is cleared at the end of a turn, this implementation allows * side-effects of deep object changes to be processed by re-setting the * same object (using the temp cache as an in-turn backstop to prevent * cycles due to 2-way notification). * * @param {string} property Property name * @param {*} value New property value * @param {*} old Previous property value * @return {boolean} Whether the property should be considered a change * @protected */ _shouldPropertyChange(property, value, old) { return mutablePropertyChange(this, property, value, old, this.mutableData); } } return OptionalMutableData; }); // Export for use by legacy behavior Polymer.MutableData._mutablePropertyChange = mutablePropertyChange; })(); (function() { 'use strict'; // Base class for HTMLTemplateElement extension that has property effects // machinery for propagating host properties to children. This is an ES5 // class only because Babel (incorrectly) requires super() in the class // constructor even though no `this` is used and it returns an instance. let newInstance = null; /** * @constructor * @extends {HTMLTemplateElement} * @private */ function HTMLTemplateElementExtension() { return newInstance; } HTMLTemplateElementExtension.prototype = Object.create(HTMLTemplateElement.prototype, { constructor: { value: HTMLTemplateElementExtension, writable: true } }); /** * @constructor * @implements {Polymer_PropertyEffects} * @extends {HTMLTemplateElementExtension} * @private */ const DataTemplate = Polymer.PropertyEffects(HTMLTemplateElementExtension); /** * @constructor * @implements {Polymer_MutableData} * @extends {DataTemplate} * @private */ const MutableDataTemplate = Polymer.MutableData(DataTemplate); // Applies a DataTemplate subclass to a <template> instance function upgradeTemplate(template, constructor) { newInstance = template; Object.setPrototypeOf(template, constructor.prototype); new constructor(); newInstance = null; } /** * Base class for TemplateInstance. * @constructor * @implements {Polymer_PropertyEffects} * @private */ const base = Polymer.PropertyEffects(class {}); /** * @polymer * @customElement * @appliesMixin Polymer.PropertyEffects * @unrestricted */ class TemplateInstanceBase extends base { constructor(props) { super(); this._configureProperties(props); this.root = this._stampTemplate(this.__dataHost); // Save list of stamped children let children = this.children = []; for (let n = this.root.firstChild; n; n=n.nextSibling) { children.push(n); n.__templatizeInstance = this; } if (this.__templatizeOwner && this.__templatizeOwner.__hideTemplateChildren__) { this._showHideChildren(true); } // Flush props only when props are passed if instance props exist // or when there isn't instance props. let options = this.__templatizeOptions; if ((props && options.instanceProps) || !options.instanceProps) { this._enableProperties(); } } /** * Configure the given `props` by calling `_setPendingProperty`. Also * sets any properties stored in `__hostProps`. * @private * @param {Object} props Object of property name-value pairs to set. * @return {void} */ _configureProperties(props) { let options = this.__templatizeOptions; if (options.forwardHostProp) { for (let hprop in this.__hostProps) { this._setPendingProperty(hprop, this.__dataHost['_host_' + hprop]); } } // Any instance props passed in the constructor will overwrite host props; // normally this would be a user error but we don't specifically filter them for (let iprop in props) { this._setPendingProperty(iprop, props[iprop]); } } /** * Forwards a host property to this instance. This method should be * called on instances from the `options.forwardHostProp` callback * to propagate changes of host properties to each instance. * * Note this method enqueues the change, which are flushed as a batch. * * @param {string} prop Property or path name * @param {*} value Value of the property to forward * @return {void} */ forwardHostProp(prop, value) { if (this._setPendingPropertyOrPath(prop, value, false, true)) { this.__dataHost._enqueueClient(this); } } /** * Override point for adding custom or simulated event handling. * * @param {!Node} node Node to add event listener to * @param {string} eventName Name of event * @param {function(!Event):void} handler Listener function to add * @return {void} */ _addEventListenerToNode(node, eventName, handler) { if (this._methodHost && this.__templatizeOptions.parentModel) { // If this instance should be considered a parent model, decorate // events this template instance as `model` this._methodHost._addEventListenerToNode(node, eventName, (e) => { e.model = this; handler(e); }); } else { // Otherwise delegate to the template's host (which could be) // another template instance let templateHost = this.__dataHost.__dataHost; if (templateHost) { templateHost._addEventListenerToNode(node, eventName, handler); } } } /** * Shows or hides the template instance top level child elements. For * text nodes, `textContent` is removed while "hidden" and replaced when * "shown." * @param {boolean} hide Set to true to hide the children; * set to false to show them. * @return {void} * @protected */ _showHideChildren(hide) { let c = this.children; for (let i=0; i<c.length; i++) { let n = c[i]; // Ignore non-changes if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) { if (n.nodeType === Node.TEXT_NODE) { if (hide) { n.__polymerTextContent__ = n.textContent; n.textContent = ''; } else { n.textContent = n.__polymerTextContent__; } // remove and replace slot } else if (n.localName === 'slot') { if (hide) { n.__polymerReplaced__ = document.createComment('hidden-slot'); n.parentNode.replaceChild(n.__polymerReplaced__, n); } else { const replace = n.__polymerReplaced__; if (replace) { replace.parentNode.replaceChild(n, replace); } } } else if (n.style) { if (hide) { n.__polymerDisplay__ = n.style.display; n.style.display = 'none'; } else { n.style.display = n.__polymerDisplay__; } } } n.__hideTemplateChildren__ = hide; if (n._showHideChildren) { n._showHideChildren(hide); } } } /** * Overrides default property-effects implementation to intercept * textContent bindings while children are "hidden" and cache in * private storage for later retrieval. * * @param {!Node} node The node to set a property on * @param {string} prop The property to set * @param {*} value The value to set * @return {void} * @protected */ _setUnmanagedPropertyToNode(node, prop, value) { if (node.__hideTemplateChildren__ && node.nodeType == Node.TEXT_NODE && prop == 'textContent') { node.__polymerTextContent__ = value; } else { super._setUnmanagedPropertyToNode(node, prop, value); } } /** * Find the parent model of this template instance. The parent model * is either another templatize instance that had option `parentModel: true`, * or else the host element. * * @return {!Polymer_PropertyEffects} The parent model of this instance */ get parentModel() { let model = this.__parentModel; if (!model) { let options; model = this; do { // A template instance's `__dataHost` is a <template> // `model.__dataHost.__dataHost` is the template's host model = model.__dataHost.__dataHost; } while ((options = model.__templatizeOptions) && !options.parentModel); this.__parentModel = model; } return model; } /** * Stub of HTMLElement's `dispatchEvent`, so that effects that may * dispatch events safely no-op. * * @param {Event} event Event to dispatch * @return {boolean} Always true. */ dispatchEvent(event) { // eslint-disable-line no-unused-vars return true; } } /** @type {!DataTemplate} */ TemplateInstanceBase.prototype.__dataHost; /** @type {!TemplatizeOptions} */ TemplateInstanceBase.prototype.__templatizeOptions; /** @type {!Polymer_PropertyEffects} */ TemplateInstanceBase.prototype._methodHost; /** @type {!Object} */ TemplateInstanceBase.prototype.__templatizeOwner; /** @type {!Object} */ TemplateInstanceBase.prototype.__hostProps; /** * @constructor * @extends {TemplateInstanceBase} * @implements {Polymer_MutableData} * @private */ const MutableTemplateInstanceBase = Polymer.MutableData(TemplateInstanceBase); function findMethodHost(template) { // Technically this should be the owner of the outermost template. // In shadow dom, this is always getRootNode().host, but we can // approximate this via cooperation with our dataHost always setting // `_methodHost` as long as there were bindings (or id's) on this // instance causing it to get a dataHost. let templateHost = template.__dataHost; return templateHost && templateHost._methodHost || templateHost; } /* eslint-disable valid-jsdoc */ /** * @suppress {missingProperties} class.prototype is not defined for some reason */ function createTemplatizerClass(template, templateInfo, options) { // Anonymous class created by the templatize let base = options.mutableData ? MutableTemplateInstanceBase : TemplateInstanceBase; // Affordance for global mixins onto TemplatizeInstance if (Polymer.Templatize.mixin) { base = Polymer.Templatize.mixin(base); } /** * @constructor * @extends {base} * @private */ let klass = class extends base { }; klass.prototype.__templatizeOptions = options; klass.prototype._bindTemplate(template); addNotifyEffects(klass, template, templateInfo, options); return klass; } /** * @suppress {missingProperties} class.prototype is not defined for some reason */ function addPropagateEffects(template, templateInfo, options) { let userForwardHostProp = options.forwardHostProp; if (userForwardHostProp) { // Provide data API and property effects on memoized template class let klass = templateInfo.templatizeTemplateClass; if (!klass) { let base = options.mutableData ? MutableDataTemplate : DataTemplate; /** @private */ klass = templateInfo.templatizeTemplateClass = class TemplatizedTemplate extends base {}; // Add template - >instances effects // and host <- template effects let hostProps = templateInfo.hostProps; for (let prop in hostProps) { klass.prototype._addPropertyEffect('_host_' + prop, klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE, {fn: createForwardHostPropEffect(prop, userForwardHostProp)}); klass.prototype._createNotifyingProperty('_host_' + prop); } } upgradeTemplate(template, klass); // Mix any pre-bound data into __data; no need to flush this to // instances since they pull from the template at instance-time if (template.__dataProto) { // Note, generally `__dataProto` could be chained, but it's guaranteed // to not be since this is a vanilla template we just added effects to Object.assign(template.__data, template.__dataProto); } // Clear any pending data for performance template.__dataTemp = {}; template.__dataPending = null; template.__dataOld = null; template._enableProperties(); } } /* eslint-enable valid-jsdoc */ function createForwardHostPropEffect(hostProp, userForwardHostProp) { return function forwardHostProp(template, prop, props) { userForwardHostProp.call(template.__templatizeOwner, prop.substring('_host_'.length), props[prop]); }; } function addNotifyEffects(klass, template, templateInfo, options) { let hostProps = templateInfo.hostProps || {}; for (let iprop in options.instanceProps) { delete hostProps[iprop]; let userNotifyInstanceProp = options.notifyInstanceProp; if (userNotifyInstanceProp) { klass.prototype._addPropertyEffect(iprop, klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY, {fn: createNotifyInstancePropEffect(iprop, userNotifyInstanceProp)}); } } if (options.forwardHostProp && template.__dataHost) { for (let hprop in hostProps) { klass.prototype._addPropertyEffect(hprop, klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY, {fn: createNotifyHostPropEffect()}); } } } function createNotifyInstancePropEffect(instProp, userNotifyInstanceProp) { return function notifyInstanceProp(inst, prop, props) { userNotifyInstanceProp.call(inst.__templatizeOwner, inst, prop, props[prop]); }; } function createNotifyHostPropEffect() { return function notifyHostProp(inst, prop, props) { inst.__dataHost._setPendingPropertyOrPath('_host_' + prop, props[prop], true, true); }; } /** * Module for preparing and stamping instances of templates that utilize * Polymer's data-binding and declarative event listener features. * * Example: * * // Get a template from somewhere, e.g. light DOM * let template = this.querySelector('template'); * // Prepare the template * let TemplateClass = Polymer.Templatize.templatize(template); * // Instance the template with an initial data model * let instance = new TemplateClass({myProp: 'initial'}); * // Insert the instance's DOM somewhere, e.g. element's shadow DOM * this.shadowRoot.appendChild(instance.root); * // Changing a property on the instance will propagate to bindings * // in the template * instance.myProp = 'new value'; * * The `options` dictionary passed to `templatize` allows for customizing * features of the generated template class, including how outer-scope host * properties should be forwarded into template instances, how any instance * properties added into the template's scope should be notified out to * the host, and whether the instance should be decorated as a "parent model" * of any event handlers. * * // Customize property forwarding and event model decoration * let TemplateClass = Polymer.Templatize.templatize(template, this, { * parentModel: true, * forwardHostProp(property, value) {...}, * instanceProps: {...}, * notifyInstanceProp(instance, property, value) {...}, * }); * * @namespace * @memberof Polymer * @summary Module for preparing and stamping instances of templates * utilizing Polymer templating features. */ Polymer.Templatize = { /** * Returns an anonymous `Polymer.PropertyEffects` class bound to the * `<template>` provided. Instancing the class will result in the * template being stamped into a document fragment stored as the instance's * `root` property, after which it can be appended to the DOM. * * Templates may utilize all Polymer data-binding features as well as * declarative event listeners. Event listeners and inline computing * functions in the template will be called on the host of the template. * * The constructor returned takes a single argument dictionary of initial * property values to propagate into template bindings. Additionally * host properties can be forwarded in, and instance properties can be * notified out by providing optional callbacks in the `options` dictionary. * * Valid configuration in `options` are as follows: * * - `forwardHostProp(property, value)`: Called when a property referenced * in the template changed on the template's host. As this library does * not retain references to templates instanced by the user, it is the * templatize owner's responsibility to forward host property changes into * user-stamped instances. The `instance.forwardHostProp(property, value)` * method on the generated class should be called to forward host * properties into the template to prevent unnecessary property-changed * notifications. Any properties referenced in the template that are not * defined in `instanceProps` will be notified up to the template's host * automatically. * - `instanceProps`: Dictionary of property names that will be added * to the instance by the templatize owner. These properties shadow any * host properties, and changes within the template to these properties * will result in `notifyInstanceProp` being called. * - `mutableData`: When `true`, the generated class will skip strict * dirty-checking for objects and arrays (always consider them to be * "dirty"). * - `notifyInstanceProp(instance, property, value)`: Called when * an instance property changes. Users may choose to call `notifyPath` * on e.g. the owner to notify the change. * - `parentModel`: When `true`, events handled by declarative event listeners * (`on-event="handler"`) will be decorated with a `model` property pointing * to the template instance that stamped it. It will also be returned * from `instance.parentModel` in cases where template instance nesting * causes an inner model to shadow an outer model. * * All callbacks are called bound to the `owner`. Any context * needed for the callbacks (such as references to `instances` stamped) * should be stored on the `owner` such that they can be retrieved via * `this`. * * When `options.forwardHostProp` is declared as an option, any properties * referenced in the template will be automatically forwarded from the host of * the `<template>` to instances, with the exception of any properties listed in * the `options.instanceProps` object. `instanceProps` are assumed to be * managed by the owner of the instances, either passed into the constructor * or set after the fact. Note, any properties passed into the constructor will * always be set to the instance (regardless of whether they would normally * be forwarded from the host). * * Note that `templatize()` can be run only once for a given `<template>`. * Further calls will result in an error. Also, there is a special * behavior if the template was duplicated through a mechanism such as * `<dom-repeat>` or `<test-fixture>`. In this case, all calls to * `templatize()` return the same class for all duplicates of a template. * The class returned from `templatize()` is generated only once using * the `options` from the first call. This means that any `options` * provided to subsequent calls will be ignored. Therefore, it is very * important not to close over any variables inside the callbacks. Also, * arrow functions must be avoided because they bind the outer `this`. * Inside the callbacks, any contextual information can be accessed * through `this`, which points to the `owner`. * * @memberof Polymer.Templatize * @param {!HTMLTemplateElement} template Template to templatize * @param {Polymer_PropertyEffects=} owner Owner of the template instances; * any optional callbacks will be bound to this owner. * @param {Object=} options Options dictionary (see summary for details) * @return {function(new:TemplateInstanceBase)} Generated class bound to the template * provided * @suppress {invalidCasts} */ templatize(template, owner, options) { // Under strictTemplatePolicy, the templatized element must be owned // by a (trusted) Polymer element, indicated by existence of _methodHost; // e.g. for dom-if & dom-repeat in main document, _methodHost is null if (Polymer.strictTemplatePolicy && !findMethodHost(template)) { throw new Error('strictTemplatePolicy: template owner not trusted'); } options = /** @type {!TemplatizeOptions} */(options || {}); if (template.__templatizeOwner) { throw new Error('A <template> can only be templatized once'); } template.__templatizeOwner = owner; const ctor = owner ? owner.constructor : TemplateInstanceBase; let templateInfo = ctor._parseTemplate(template); // Get memoized base class for the prototypical template, which // includes property effects for binding template & forwarding let baseClass = templateInfo.templatizeInstanceClass; if (!baseClass) { baseClass = createTemplatizerClass(template, templateInfo, options); templateInfo.templatizeInstanceClass = baseClass; } // Host property forwarding must be installed onto template instance addPropagateEffects(template, templateInfo, options); // Subclass base class and add reference for this specific template /** @private */ let klass = class TemplateInstance extends baseClass {}; klass.prototype._methodHost = findMethodHost(template); klass.prototype.__dataHost = template; klass.prototype.__templatizeOwner = owner; klass.prototype.__hostProps = templateInfo.hostProps; klass = /** @type {function(new:TemplateInstanceBase)} */(klass); //eslint-disable-line no-self-assign return klass; }, /** * Returns the template "model" associated with a given element, which * serves as the binding scope for the template instance the element is * contained in. A template model is an instance of * `TemplateInstanceBase`, and should be used to manipulate data * associated with this template instance. * * Example: * * let model = modelForElement(el); * if (model.index < 10) { * model.set('item.checked', true); * } * * @memberof Polymer.Templatize * @param {HTMLTemplateElement} template The model will be returned for * elements stamped from this template * @param {Node=} node Node for which to return a template model. * @return {TemplateInstanceBase} Template instance representing the * binding scope for the element */ modelForElement(template, node) { let model; while (node) { // An element with a __templatizeInstance marks the top boundary // of a scope; walk up until we find one, and then ensure that // its __dataHost matches `this`, meaning this dom-repeat stamped it if ((model = node.__templatizeInstance)) { // Found an element stamped by another template; keep walking up // from its __dataHost if (model.__dataHost != template) { node = model.__dataHost; } else { return model; } } else { // Still in a template scope, keep going up until // a __templatizeInstance is found node = node.parentNode; } } return null; } }; Polymer.TemplateInstanceBase = TemplateInstanceBase; })(); (function() { 'use strict'; let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line /** * @typedef {{ * _templatizerTemplate: HTMLTemplateElement, * _parentModel: boolean, * _instanceProps: Object, * _forwardHostPropV2: Function, * _notifyInstancePropV2: Function, * ctor: TemplateInstanceBase * }} */ let TemplatizerUser; // eslint-disable-line /** * The `Polymer.Templatizer` behavior adds methods to generate instances of * templates that are each managed by an anonymous `Polymer.PropertyEffects` * instance where data-bindings in the stamped template content are bound to * accessors on itself. * * This behavior is provided in Polymer 2.x as a hybrid-element convenience * only. For non-hybrid usage, the `Polymer.Templatize` library * should be used instead. * * Example: * * // Get a template from somewhere, e.g. light DOM * let template = this.querySelector('template'); * // Prepare the template * this.templatize(template); * // Instance the template with an initial data model * let instance = this.stamp({myProp: 'initial'}); * // Insert the instance's DOM somewhere, e.g. light DOM * Polymer.dom(this).appendChild(instance.root); * // Changing a property on the instance will propagate to bindings * // in the template * instance.myProp = 'new value'; * * Users of `Templatizer` may need to implement the following abstract * API's to determine how properties and paths from the host should be * forwarded into to instances: * * _forwardHostPropV2: function(prop, value) * * Likewise, users may implement these additional abstract API's to determine * how instance-specific properties that change on the instance should be * forwarded out to the host, if necessary. * * _notifyInstancePropV2: function(inst, prop, value) * * In order to determine which properties are instance-specific and require * custom notification via `_notifyInstanceProp`, define an `_instanceProps` * object containing keys for each instance prop, for example: * * _instanceProps: { * item: true, * index: true * } * * Any properties used in the template that are not defined in _instanceProp * will be forwarded out to the Templatize `owner` automatically. * * Users may also implement the following abstract function to show or * hide any DOM generated using `stamp`: * * _showHideChildren: function(shouldHide) * * Note that some callbacks are suffixed with `V2` in the Polymer 2.x behavior * as the implementations will need to differ from the callbacks required * by the 1.x Templatizer API due to changes in the `TemplateInstance` API * between versions 1.x and 2.x. * * @polymerBehavior */ Polymer.Templatizer = { /** * Generates an anonymous `TemplateInstance` class (stored as `this.ctor`) * for the provided template. This method should be called once per * template to prepare an element for stamping the template, followed * by `stamp` to create new instances of the template. * * @param {!HTMLTemplateElement} template Template to prepare * @param {boolean=} mutableData When `true`, the generated class will skip * strict dirty-checking for objects and arrays (always consider them to * be "dirty"). Defaults to false. * @return {void} * @this {TemplatizerUser} */ templatize(template, mutableData) { this._templatizerTemplate = template; this.ctor = Polymer.Templatize.templatize(template, this, { mutableData: Boolean(mutableData), parentModel: this._parentModel, instanceProps: this._instanceProps, forwardHostProp: this._forwardHostPropV2, notifyInstanceProp: this._notifyInstancePropV2 }); }, /** * Creates an instance of the template prepared by `templatize`. The object * returned is an instance of the anonymous class generated by `templatize` * whose `root` property is a document fragment containing newly cloned * template content, and which has property accessors corresponding to * properties referenced in template bindings. * * @param {Object=} model Object containing initial property values to * populate into the template bindings. * @return {TemplateInstanceBase} Returns the created instance of * the template prepared by `templatize`. * @this {TemplatizerUser} */ stamp(model) { return new this.ctor(model); }, /** * Returns the template "model" (`TemplateInstance`) associated with * a given element, which serves as the binding scope for the template * instance the element is contained in. A template model should be used * to manipulate data associated with this template instance. * * @param {HTMLElement} el Element for which to return a template model. * @return {TemplateInstanceBase} Model representing the binding scope for * the element. * @this {TemplatizerUser} */ modelForElement(el) { return Polymer.Templatize.modelForElement(this._templatizerTemplate, el); } }; })(); (function() { 'use strict'; /** * @constructor * @extends {HTMLElement} * @implements {Polymer_PropertyEffects} * @implements {Polymer_OptionalMutableData} * @implements {Polymer_GestureEventListeners} * @private */ const domBindBase = Polymer.GestureEventListeners( Polymer.OptionalMutableData( Polymer.PropertyEffects(HTMLElement))); /** * Custom element to allow using Polymer's template features (data binding, * declarative event listeners, etc.) in the main document without defining * a new custom element. * * `<template>` tags utilizing bindings may be wrapped with the `<dom-bind>` * element, which will immediately stamp the wrapped template into the main * document and bind elements to the `dom-bind` element itself as the * binding scope. * * @polymer * @customElement * @appliesMixin Polymer.PropertyEffects * @appliesMixin Polymer.OptionalMutableData * @appliesMixin Polymer.GestureEventListeners * @extends {domBindBase} * @memberof Polymer * @summary Custom element to allow using Polymer's template features (data * binding, declarative event listeners, etc.) in the main document. */ class DomBind extends domBindBase { static get observedAttributes() { return ['mutable-data']; } constructor() { super(); if (Polymer.strictTemplatePolicy) { throw new Error(`strictTemplatePolicy: dom-bind not allowed`); } this.root = null; this.$ = null; this.__children = null; } /** @return {void} */ attributeChangedCallback() { // assumes only one observed attribute this.mutableData = true; } /** @return {void} */ connectedCallback() { this.style.display = 'none'; this.render(); } /** @return {void} */ disconnectedCallback() { this.__removeChildren(); } __insertChildren() { this.parentNode.insertBefore(this.root, this); } __removeChildren() { if (this.__children) { for (let i=0; i<this.__children.length; i++) { this.root.appendChild(this.__children[i]); } } } /** * Forces the element to render its content. This is typically only * necessary to call if HTMLImports with the async attribute are used. * @return {void} */ render() { let template; if (!this.__children) { template = /** @type {HTMLTemplateElement} */(template || this.querySelector('template')); if (!template) { // Wait until childList changes and template should be there by then let observer = new MutationObserver(() => { template = /** @type {HTMLTemplateElement} */(this.querySelector('template')); if (template) { observer.disconnect(); this.render(); } else { throw new Error('dom-bind requires a <template> child'); } }); observer.observe(this, {childList: true}); return; } this.root = this._stampTemplate(template); this.$ = this.root.$; this.__children = []; for (let n=this.root.firstChild; n; n=n.nextSibling) { this.__children[this.__children.length] = n; } this._enableProperties(); } this.__insertChildren(); this.dispatchEvent(new CustomEvent('dom-change', { bubbles: true, composed: true })); } } customElements.define('dom-bind', DomBind); /** @const */ Polymer.DomBind = DomBind; })(); (function() { 'use strict'; /** * Class representing a static string value which can be used to filter * strings by asseting that they have been created via this class. The * `value` property returns the string passed to the constructor. */ class LiteralString { constructor(string) { /** @type {string} */ this.value = string.toString(); } /** * @return {string} LiteralString string value */ toString() { return this.value; } } /** * @param {*} value Object to stringify into HTML * @return {string} HTML stringified form of `obj` */ function literalValue(value) { if (value instanceof LiteralString) { return /** @type {!LiteralString} */(value).value; } else { throw new Error(`non-literal value passed to Polymer.htmlLiteral: ${value}`); } } /** * @param {*} value Object to stringify into HTML * @return {string} HTML stringified form of `obj` */ function htmlValue(value) { if (value instanceof HTMLTemplateElement) { return /** @type {!HTMLTemplateElement } */(value).innerHTML; } else if (value instanceof LiteralString) { return literalValue(value); } else { throw new Error(`non-template value passed to Polymer.html: ${value}`); } } /** * A template literal tag that creates an HTML <template> element from the * contents of the string. * * This allows you to write a Polymer Template in JavaScript. * * Templates can be composed by interpolating `HTMLTemplateElement`s in * expressions in the JavaScript template literal. The nested template's * `innerHTML` is included in the containing template. The only other * values allowed in expressions are those returned from `Polymer.htmlLiteral` * which ensures only literal values from JS source ever reach the HTML, to * guard against XSS risks. * * All other values are disallowed in expressions to help prevent XSS * attacks; however, `Polymer.htmlLiteral` can be used to compose static * string values into templates. This is useful to compose strings into * places that do not accept html, like the css text of a `style` * element. * * Example: * * static get template() { * return Polymer.html` * <style>:host{ content:"..." }</style> * <div class="shadowed">${this.partialTemplate}</div> * ${super.template} * `; * } * static get partialTemplate() { return Polymer.html`<span>Partial!</span>`; } * * @memberof Polymer * @param {!ITemplateArray} strings Constant parts of tagged template literal * @param {...*} values Variable parts of tagged template literal * @return {!HTMLTemplateElement} Constructed HTMLTemplateElement */ Polymer.html = function html(strings, ...values) { const template = /** @type {!HTMLTemplateElement} */(document.createElement('template')); template.innerHTML = values.reduce((acc, v, idx) => acc + htmlValue(v) + strings[idx + 1], strings[0]); return template; }; /** * An html literal tag that can be used with `Polymer.html` to compose. * a literal string. * * Example: * * static get template() { * return Polymer.html` * <style> * :host { display: block; } * ${styleTemplate} * </style> * <div class="shadowed">${staticValue}</div> * ${super.template} * `; * } * static get styleTemplate() { return Polymer.htmlLiteral`.shadowed { background: gray; }`; } * * @memberof Polymer * @param {!ITemplateArray} strings Constant parts of tagged template literal * @param {...*} values Variable parts of tagged template literal * @return {!LiteralString} Constructed literal string */ Polymer.htmlLiteral = function(strings, ...values) { return new LiteralString(values.reduce((acc, v, idx) => acc + literalValue(v) + strings[idx + 1], strings[0])); }; })(); (function() { 'use strict'; /** * Base class that provides the core API for Polymer's meta-programming * features including template stamping, data-binding, attribute deserialization, * and property change observation. * * @customElement * @memberof Polymer * @constructor * @implements {Polymer_ElementMixin} * @extends {HTMLElement} * @appliesMixin Polymer.ElementMixin * @summary Custom element base class that provides the core API for Polymer's * key meta-programming features including template stamping, data-binding, * attribute deserialization, and property change observation */ Polymer.Element = Polymer.ElementMixin(HTMLElement); // NOTE: this is here for modulizer to export `html` for the module version of this file Polymer.html = Polymer.html; })(); (function() { 'use strict'; let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line /** * @constructor * @implements {Polymer_OptionalMutableData} * @extends {Polymer.Element} * @private */ const domRepeatBase = Polymer.OptionalMutableData(Polymer.Element); /** * The `<dom-repeat>` element will automatically stamp and binds one instance * of template content to each object in a user-provided array. * `dom-repeat` accepts an `items` property, and one instance of the template * is stamped for each item into the DOM at the location of the `dom-repeat` * element. The `item` property will be set on each instance's binding * scope, thus templates should bind to sub-properties of `item`. * * Example: * * ```html * <dom-module id="employee-list"> * * <template> * * <div> Employee list: </div> * <dom-repeat items="{{employees}}"> * <template> * <div>First name: <span>{{item.first}}</span></div> * <div>Last name: <span>{{item.last}}</span></div> * </template> * </dom-repeat> * * </template> * * </dom-module> * ``` * * With the following custom element definition: * * ```js * class EmployeeList extends Polymer.Element { * static get is() { return 'employee-list'; } * static get properties() { * return { * employees: { * value() { * return [ * {first: 'Bob', last: 'Smith'}, * {first: 'Sally', last: 'Johnson'}, * ... * ]; * } * } * }; * } * } * ``` * * Notifications for changes to items sub-properties will be forwarded to template * instances, which will update via the normal structured data notification system. * * Mutations to the `items` array itself should be made using the Array * mutation API's on `Polymer.Base` (`push`, `pop`, `splice`, `shift`, * `unshift`), and template instances will be kept in sync with the data in the * array. * * Events caught by event handlers within the `dom-repeat` template will be * decorated with a `model` property, which represents the binding scope for * each template instance. The model is an instance of Polymer.Base, and should * be used to manipulate data on the instance, for example * `event.model.set('item.checked', true);`. * * Alternatively, the model for a template instance for an element stamped by * a `dom-repeat` can be obtained using the `modelForElement` API on the * `dom-repeat` that stamped it, for example * `this.$.domRepeat.modelForElement(event.target).set('item.checked', true);`. * This may be useful for manipulating instance data of event targets obtained * by event handlers on parents of the `dom-repeat` (event delegation). * * A view-specific filter/sort may be applied to each `dom-repeat` by supplying a * `filter` and/or `sort` property. This may be a string that names a function on * the host, or a function may be assigned to the property directly. The functions * should implemented following the standard `Array` filter/sort API. * * In order to re-run the filter or sort functions based on changes to sub-fields * of `items`, the `observe` property may be set as a space-separated list of * `item` sub-fields that should cause a re-filter/sort when modified. If * the filter or sort function depends on properties not contained in `items`, * the user should observe changes to those properties and call `render` to update * the view based on the dependency change. * * For example, for an `dom-repeat` with a filter of the following: * * ```js * isEngineer(item) { * return item.type == 'engineer' || item.manager.type == 'engineer'; * } * ``` * * Then the `observe` property should be configured as follows: * * ```html * <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type"> * ``` * * @customElement * @polymer * @memberof Polymer * @extends {domRepeatBase} * @appliesMixin Polymer.OptionalMutableData * @summary Custom element for stamping instance of a template bound to * items in an array. */ class DomRepeat extends domRepeatBase { // Not needed to find template; can be removed once the analyzer // can find the tag name from customElements.define call static get is() { return 'dom-repeat'; } static get template() { return null; } static get properties() { /** * Fired whenever DOM is added or removed by this template (by * default, rendering occurs lazily). To force immediate rendering, call * `render`. * * @event dom-change */ return { /** * An array containing items determining how many instances of the template * to stamp and that that each template instance should bind to. */ items: { type: Array }, /** * The name of the variable to add to the binding scope for the array * element associated with a given template instance. */ as: { type: String, value: 'item' }, /** * The name of the variable to add to the binding scope with the index * of the instance in the sorted and filtered list of rendered items. * Note, for the index in the `this.items` array, use the value of the * `itemsIndexAs` property. */ indexAs: { type: String, value: 'index' }, /** * The name of the variable to add to the binding scope with the index * of the instance in the `this.items` array. Note, for the index of * this instance in the sorted and filtered list of rendered items, * use the value of the `indexAs` property. */ itemsIndexAs: { type: String, value: 'itemsIndex' }, /** * A function that should determine the sort order of the items. This * property should either be provided as a string, indicating a method * name on the element's host, or else be an actual function. The * function should match the sort function passed to `Array.sort`. * Using a sort function has no effect on the underlying `items` array. */ sort: { type: Function, observer: '__sortChanged' }, /** * A function that can be used to filter items out of the view. This * property should either be provided as a string, indicating a method * name on the element's host, or else be an actual function. The * function should match the sort function passed to `Array.filter`. * Using a filter function has no effect on the underlying `items` array. */ filter: { type: Function, observer: '__filterChanged' }, /** * When using a `filter` or `sort` function, the `observe` property * should be set to a space-separated list of the names of item * sub-fields that should trigger a re-sort or re-filter when changed. * These should generally be fields of `item` that the sort or filter * function depends on. */ observe: { type: String, observer: '__observeChanged' }, /** * When using a `filter` or `sort` function, the `delay` property * determines a debounce time in ms after a change to observed item * properties that must pass before the filter or sort is re-run. * This is useful in rate-limiting shuffling of the view when * item changes may be frequent. */ delay: Number, /** * Count of currently rendered items after `filter` (if any) has been applied. * If "chunking mode" is enabled, `renderedItemCount` is updated each time a * set of template instances is rendered. * */ renderedItemCount: { type: Number, notify: true, readOnly: true }, /** * Defines an initial count of template instances to render after setting * the `items` array, before the next paint, and puts the `dom-repeat` * into "chunking mode". The remaining items will be created and rendered * incrementally at each animation frame therof until all instances have * been rendered. */ initialCount: { type: Number, observer: '__initializeChunking' }, /** * When `initialCount` is used, this property defines a frame rate (in * fps) to target by throttling the number of instances rendered each * frame to not exceed the budget for the target frame rate. The * framerate is effectively the number of `requestAnimationFrame`s that * it tries to allow to actually fire in a given second. It does this * by measuring the time between `rAF`s and continuously adjusting the * number of items created each `rAF` to maintain the target framerate. * Setting this to a higher number allows lower latency and higher * throughput for event handlers and other tasks, but results in a * longer time for the remaining items to complete rendering. */ targetFramerate: { type: Number, value: 20 }, _targetFrameTime: { type: Number, computed: '__computeFrameTime(targetFramerate)' } }; } static get observers() { return [ '__itemsChanged(items.*)' ]; } constructor() { super(); this.__instances = []; this.__limit = Infinity; this.__pool = []; this.__renderDebouncer = null; this.__itemsIdxToInstIdx = {}; this.__chunkCount = null; this.__lastChunkTime = null; this.__sortFn = null; this.__filterFn = null; this.__observePaths = null; this.__ctor = null; this.__isDetached = true; this.template = null; } /** * @return {void} */ disconnectedCallback() { super.disconnectedCallback(); this.__isDetached = true; for (let i=0; i<this.__instances.length; i++) { this.__detachInstance(i); } } /** * @return {void} */ connectedCallback() { super.connectedCallback(); this.style.display = 'none'; // only perform attachment if the element was previously detached. if (this.__isDetached) { this.__isDetached = false; let parent = this.parentNode; for (let i=0; i<this.__instances.length; i++) { this.__attachInstance(i, parent); } } } __ensureTemplatized() { // Templatizing (generating the instance constructor) needs to wait // until ready, since won't have its template content handed back to // it until then if (!this.__ctor) { let template = this.template = /** @type {HTMLTemplateElement} */(this.querySelector('template')); if (!template) { // // Wait until childList changes and template should be there by then let observer = new MutationObserver(() => { if (this.querySelector('template')) { observer.disconnect(); this.__render(); } else { throw new Error('dom-repeat requires a <template> child'); } }); observer.observe(this, {childList: true}); return false; } // Template instance props that should be excluded from forwarding let instanceProps = {}; instanceProps[this.as] = true; instanceProps[this.indexAs] = true; instanceProps[this.itemsIndexAs] = true; this.__ctor = Polymer.Templatize.templatize(template, this, { mutableData: this.mutableData, parentModel: true, instanceProps: instanceProps, /** * @this {this} * @param {string} prop Property to set * @param {*} value Value to set property to */ forwardHostProp: function(prop, value) { let i$ = this.__instances; for (let i=0, inst; (i<i$.length) && (inst=i$[i]); i++) { inst.forwardHostProp(prop, value); } }, /** * @this {this} * @param {Object} inst Instance to notify * @param {string} prop Property to notify * @param {*} value Value to notify */ notifyInstanceProp: function(inst, prop, value) { if (Polymer.Path.matches(this.as, prop)) { let idx = inst[this.itemsIndexAs]; if (prop == this.as) { this.items[idx] = value; } let path = Polymer.Path.translate(this.as, 'items.' + idx, prop); this.notifyPath(path, value); } } }); } return true; } __getMethodHost() { // Technically this should be the owner of the outermost template. // In shadow dom, this is always getRootNode().host, but we can // approximate this via cooperation with our dataHost always setting // `_methodHost` as long as there were bindings (or id's) on this // instance causing it to get a dataHost. return this.__dataHost._methodHost || this.__dataHost; } __functionFromPropertyValue(functionOrMethodName) { if (typeof functionOrMethodName === 'string') { let methodName = functionOrMethodName; let obj = this.__getMethodHost(); return function() { return obj[methodName].apply(obj, arguments); }; } return functionOrMethodName; } __sortChanged(sort) { this.__sortFn = this.__functionFromPropertyValue(sort); if (this.items) { this.__debounceRender(this.__render); } } __filterChanged(filter) { this.__filterFn = this.__functionFromPropertyValue(filter); if (this.items) { this.__debounceRender(this.__render); } } __computeFrameTime(rate) { return Math.ceil(1000/rate); } __initializeChunking() { if (this.initialCount) { this.__limit = this.initialCount; this.__chunkCount = this.initialCount; this.__lastChunkTime = performance.now(); } } __tryRenderChunk() { // Debounced so that multiple calls through `_render` between animation // frames only queue one new rAF (e.g. array mutation & chunked render) if (this.items && this.__limit < this.items.length) { this.__debounceRender(this.__requestRenderChunk); } } __requestRenderChunk() { requestAnimationFrame(()=>this.__renderChunk()); } __renderChunk() { // Simple auto chunkSize throttling algorithm based on feedback loop: // measure actual time between frames and scale chunk count by ratio // of target/actual frame time let currChunkTime = performance.now(); let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime); this.__chunkCount = Math.round(this.__chunkCount * ratio) || 1; this.__limit += this.__chunkCount; this.__lastChunkTime = currChunkTime; this.__debounceRender(this.__render); } __observeChanged() { this.__observePaths = this.observe && this.observe.replace('.*', '.').split(' '); } __itemsChanged(change) { if (this.items && !Array.isArray(this.items)) { console.warn('dom-repeat expected array for `items`, found', this.items); } // If path was to an item (e.g. 'items.3' or 'items.3.foo'), forward the // path to that instance synchronously (returns false for non-item paths) if (!this.__handleItemPath(change.path, change.value)) { // Otherwise, the array was reset ('items') or spliced ('items.splices'), // so queue a full refresh this.__initializeChunking(); this.__debounceRender(this.__render); } } __handleObservedPaths(path) { // Handle cases where path changes should cause a re-sort/filter if (this.__sortFn || this.__filterFn) { if (!path) { // Always re-render if the item itself changed this.__debounceRender(this.__render, this.delay); } else if (this.__observePaths) { // Otherwise, re-render if the path changed matches an observed path let paths = this.__observePaths; for (let i=0; i<paths.length; i++) { if (path.indexOf(paths[i]) === 0) { this.__debounceRender(this.__render, this.delay); } } } } } /** * @param {function(this:DomRepeat)} fn Function to debounce. * @param {number=} delay Delay in ms to debounce by. */ __debounceRender(fn, delay = 0) { this.__renderDebouncer = Polymer.Debouncer.debounce( this.__renderDebouncer , delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask , fn.bind(this)); Polymer.enqueueDebouncer(this.__renderDebouncer); } /** * Forces the element to render its content. Normally rendering is * asynchronous to a provoking change. This is done for efficiency so * that multiple changes trigger only a single render. The render method * should be called if, for example, template rendering is required to * validate application state. * @return {void} */ render() { // Queue this repeater, then flush all in order this.__debounceRender(this.__render); Polymer.flush(); } __render() { if (!this.__ensureTemplatized()) { // No template found yet return; } this.__applyFullRefresh(); // Reset the pool // TODO(kschaaf): Reuse pool across turns and nested templates // Now that objects/arrays are re-evaluated when set, we can safely // reuse pooled instances across turns, however we still need to decide // semantics regarding how long to hold, how many to hold, etc. this.__pool.length = 0; // Set rendered item count this._setRenderedItemCount(this.__instances.length); // Notify users this.dispatchEvent(new CustomEvent('dom-change', { bubbles: true, composed: true })); // Check to see if we need to render more items this.__tryRenderChunk(); } __applyFullRefresh() { let items = this.items || []; let isntIdxToItemsIdx = new Array(items.length); for (let i=0; i<items.length; i++) { isntIdxToItemsIdx[i] = i; } // Apply user filter if (this.__filterFn) { isntIdxToItemsIdx = isntIdxToItemsIdx.filter((i, idx, array) => this.__filterFn(items[i], idx, array)); } // Apply user sort if (this.__sortFn) { isntIdxToItemsIdx.sort((a, b) => this.__sortFn(items[a], items[b])); } // items->inst map kept for item path forwarding const itemsIdxToInstIdx = this.__itemsIdxToInstIdx = {}; let instIdx = 0; // Generate instances and assign items const limit = Math.min(isntIdxToItemsIdx.length, this.__limit); for (; instIdx<limit; instIdx++) { let inst = this.__instances[instIdx]; let itemIdx = isntIdxToItemsIdx[instIdx]; let item = items[itemIdx]; itemsIdxToInstIdx[itemIdx] = instIdx; if (inst) { inst._setPendingProperty(this.as, item); inst._setPendingProperty(this.indexAs, instIdx); inst._setPendingProperty(this.itemsIndexAs, itemIdx); inst._flushProperties(); } else { this.__insertInstance(item, instIdx, itemIdx); } } // Remove any extra instances from previous state for (let i=this.__instances.length-1; i>=instIdx; i--) { this.__detachAndRemoveInstance(i); } } __detachInstance(idx) { let inst = this.__instances[idx]; for (let i=0; i<inst.children.length; i++) { let el = inst.children[i]; inst.root.appendChild(el); } return inst; } __attachInstance(idx, parent) { let inst = this.__instances[idx]; parent.insertBefore(inst.root, this); } __detachAndRemoveInstance(idx) { let inst = this.__detachInstance(idx); if (inst) { this.__pool.push(inst); } this.__instances.splice(idx, 1); } __stampInstance(item, instIdx, itemIdx) { let model = {}; model[this.as] = item; model[this.indexAs] = instIdx; model[this.itemsIndexAs] = itemIdx; return new this.__ctor(model); } __insertInstance(item, instIdx, itemIdx) { let inst = this.__pool.pop(); if (inst) { // TODO(kschaaf): If the pool is shared across turns, hostProps // need to be re-set to reused instances in addition to item inst._setPendingProperty(this.as, item); inst._setPendingProperty(this.indexAs, instIdx); inst._setPendingProperty(this.itemsIndexAs, itemIdx); inst._flushProperties(); } else { inst = this.__stampInstance(item, instIdx, itemIdx); } let beforeRow = this.__instances[instIdx + 1]; let beforeNode = beforeRow ? beforeRow.children[0] : this; this.parentNode.insertBefore(inst.root, beforeNode); this.__instances[instIdx] = inst; return inst; } // Implements extension point from Templatize mixin /** * Shows or hides the template instance top level child elements. For * text nodes, `textContent` is removed while "hidden" and replaced when * "shown." * @param {boolean} hidden Set to true to hide the children; * set to false to show them. * @return {void} * @protected */ _showHideChildren(hidden) { for (let i=0; i<this.__instances.length; i++) { this.__instances[i]._showHideChildren(hidden); } } // Called as a side effect of a host items.<key>.<path> path change, // responsible for notifying item.<path> changes to inst for key __handleItemPath(path, value) { let itemsPath = path.slice(6); // 'items.'.length == 6 let dot = itemsPath.indexOf('.'); let itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot); // If path was index into array... if (itemsIdx == parseInt(itemsIdx, 10)) { let itemSubPath = dot < 0 ? '' : itemsPath.substring(dot+1); // If the path is observed, it will trigger a full refresh this.__handleObservedPaths(itemSubPath); // Note, even if a rull refresh is triggered, always do the path // notification because unless mutableData is used for dom-repeat // and all elements in the instance subtree, a full refresh may // not trigger the proper update. let instIdx = this.__itemsIdxToInstIdx[itemsIdx]; let inst = this.__instances[instIdx]; if (inst) { let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : ''); // This is effectively `notifyPath`, but avoids some of the overhead // of the public API inst._setPendingPropertyOrPath(itemPath, value, false, true); inst._flushProperties(); } return true; } } /** * Returns the item associated with a given element stamped by * this `dom-repeat`. * * Note, to modify sub-properties of the item, * `modelForElement(el).set('item.<sub-prop>', value)` * should be used. * * @param {!HTMLElement} el Element for which to return the item. * @return {*} Item associated with the element. */ itemForElement(el) { let instance = this.modelForElement(el); return instance && instance[this.as]; } /** * Returns the inst index for a given element stamped by this `dom-repeat`. * If `sort` is provided, the index will reflect the sorted order (rather * than the original array order). * * @param {!HTMLElement} el Element for which to return the index. * @return {?number} Row index associated with the element (note this may * not correspond to the array index if a user `sort` is applied). */ indexForElement(el) { let instance = this.modelForElement(el); return instance && instance[this.indexAs]; } /** * Returns the template "model" associated with a given element, which * serves as the binding scope for the template instance the element is * contained in. A template model is an instance of `Polymer.Base`, and * should be used to manipulate data associated with this template instance. * * Example: * * let model = modelForElement(el); * if (model.index < 10) { * model.set('item.checked', true); * } * * @param {!HTMLElement} el Element for which to return a template model. * @return {TemplateInstanceBase} Model representing the binding scope for * the element. */ modelForElement(el) { return Polymer.Templatize.modelForElement(this.template, el); } } customElements.define(DomRepeat.is, DomRepeat); /** @const */ Polymer.DomRepeat = DomRepeat; })(); (function() { 'use strict'; /** * The `<dom-if>` element will stamp a light-dom `<template>` child when * the `if` property becomes truthy, and the template can use Polymer * data-binding and declarative event features when used in the context of * a Polymer element's template. * * When `if` becomes falsy, the stamped content is hidden but not * removed from dom. When `if` subsequently becomes truthy again, the content * is simply re-shown. This approach is used due to its favorable performance * characteristics: the expense of creating template content is paid only * once and lazily. * * Set the `restamp` property to true to force the stamped content to be * created / destroyed when the `if` condition changes. * * @customElement * @polymer * @extends Polymer.Element * @memberof Polymer * @summary Custom element that conditionally stamps and hides or removes * template content based on a boolean flag. */ class DomIf extends Polymer.Element { // Not needed to find template; can be removed once the analyzer // can find the tag name from customElements.define call static get is() { return 'dom-if'; } static get template() { return null; } static get properties() { return { /** * Fired whenever DOM is added or removed/hidden by this template (by * default, rendering occurs lazily). To force immediate rendering, call * `render`. * * @event dom-change */ /** * A boolean indicating whether this template should stamp. */ if: { type: Boolean, observer: '__debounceRender' }, /** * When true, elements will be removed from DOM and discarded when `if` * becomes false and re-created and added back to the DOM when `if` * becomes true. By default, stamped elements will be hidden but left * in the DOM when `if` becomes false, which is generally results * in better performance. */ restamp: { type: Boolean, observer: '__debounceRender' } }; } constructor() { super(); this.__renderDebouncer = null; this.__invalidProps = null; this.__instance = null; this._lastIf = false; this.__ctor = null; } __debounceRender() { // Render is async for 2 reasons: // 1. To eliminate dom creation trashing if user code thrashes `if` in the // same turn. This was more common in 1.x where a compound computed // property could result in the result changing multiple times, but is // mitigated to a large extent by batched property processing in 2.x. // 2. To avoid double object propagation when a bag including values bound // to the `if` property as well as one or more hostProps could enqueue // the <dom-if> to flush before the <template>'s host property // forwarding. In that scenario creating an instance would result in // the host props being set once, and then the enqueued changes on the // template would set properties a second time, potentially causing an // object to be set to an instance more than once. Creating the // instance async from flushing data ensures this doesn't happen. If // we wanted a sync option in the future, simply having <dom-if> flush // (or clear) its template's pending host properties before creating // the instance would also avoid the problem. this.__renderDebouncer = Polymer.Debouncer.debounce( this.__renderDebouncer , Polymer.Async.microTask , () => this.__render()); Polymer.enqueueDebouncer(this.__renderDebouncer); } /** * @return {void} */ disconnectedCallback() { super.disconnectedCallback(); if (!this.parentNode || (this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE && !this.parentNode.host)) { this.__teardownInstance(); } } /** * @return {void} */ connectedCallback() { super.connectedCallback(); this.style.display = 'none'; if (this.if) { this.__debounceRender(); } } /** * Forces the element to render its content. Normally rendering is * asynchronous to a provoking change. This is done for efficiency so * that multiple changes trigger only a single render. The render method * should be called if, for example, template rendering is required to * validate application state. * @return {void} */ render() { Polymer.flush(); } __render() { if (this.if) { if (!this.__ensureInstance()) { // No template found yet return; } this._showHideChildren(); } else if (this.restamp) { this.__teardownInstance(); } if (!this.restamp && this.__instance) { this._showHideChildren(); } if (this.if != this._lastIf) { this.dispatchEvent(new CustomEvent('dom-change', { bubbles: true, composed: true })); this._lastIf = this.if; } } __ensureInstance() { let parentNode = this.parentNode; // Guard against element being detached while render was queued if (parentNode) { if (!this.__ctor) { let template = /** @type {HTMLTemplateElement} */(this.querySelector('template')); if (!template) { // Wait until childList changes and template should be there by then let observer = new MutationObserver(() => { if (this.querySelector('template')) { observer.disconnect(); this.__render(); } else { throw new Error('dom-if requires a <template> child'); } }); observer.observe(this, {childList: true}); return false; } this.__ctor = Polymer.Templatize.templatize(template, this, { // dom-if templatizer instances require `mutable: true`, as // `__syncHostProperties` relies on that behavior to sync objects mutableData: true, /** * @param {string} prop Property to forward * @param {*} value Value of property * @this {this} */ forwardHostProp: function(prop, value) { if (this.__instance) { if (this.if) { this.__instance.forwardHostProp(prop, value); } else { // If we have an instance but are squelching host property // forwarding due to if being false, note the invalidated // properties so `__syncHostProperties` can sync them the next // time `if` becomes true this.__invalidProps = this.__invalidProps || Object.create(null); this.__invalidProps[Polymer.Path.root(prop)] = true; } } } }); } if (!this.__instance) { this.__instance = new this.__ctor(); parentNode.insertBefore(this.__instance.root, this); } else { this.__syncHostProperties(); let c$ = this.__instance.children; if (c$ && c$.length) { // Detect case where dom-if was re-attached in new position let lastChild = this.previousSibling; if (lastChild !== c$[c$.length-1]) { for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) { parentNode.insertBefore(n, this); } } } } } return true; } __syncHostProperties() { let props = this.__invalidProps; if (props) { for (let prop in props) { this.__instance._setPendingProperty(prop, this.__dataHost[prop]); } this.__invalidProps = null; this.__instance._flushProperties(); } } __teardownInstance() { if (this.__instance) { let c$ = this.__instance.children; if (c$ && c$.length) { // use first child parent, for case when dom-if may have been detached let parent = c$[0].parentNode; // Instance children may be disconnected from parents when dom-if // detaches if a tree was innerHTML'ed if (parent) { for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) { parent.removeChild(n); } } } this.__instance = null; this.__invalidProps = null; } } /** * Shows or hides the template instance top level child elements. For * text nodes, `textContent` is removed while "hidden" and replaced when * "shown." * @return {void} * @protected */ _showHideChildren() { let hidden = this.__hideTemplateChildren__ || !this.if; if (this.__instance) { this.__instance._showHideChildren(hidden); } } } customElements.define(DomIf.is, DomIf); /** @const */ Polymer.DomIf = DomIf; })(); (function() { 'use strict'; /** * Element mixin for recording dynamic associations between item paths in a * master `items` array and a `selected` array such that path changes to the * master array (at the host) element or elsewhere via data-binding) are * correctly propagated to items in the selected array and vice-versa. * * The `items` property accepts an array of user data, and via the * `select(item)` and `deselect(item)` API, updates the `selected` property * which may be bound to other parts of the application, and any changes to * sub-fields of `selected` item(s) will be kept in sync with items in the * `items` array. When `multi` is false, `selected` is a property * representing the last selected item. When `multi` is true, `selected` * is an array of multiply selected items. * * @polymer * @mixinFunction * @appliesMixin Polymer.ElementMixin * @memberof Polymer * @summary Element mixin for recording dynamic associations between item paths in a * master `items` array and a `selected` array */ let ArraySelectorMixin = Polymer.dedupingMixin(superClass => { /** * @constructor * @extends {superClass} * @implements {Polymer_ElementMixin} * @private */ let elementBase = Polymer.ElementMixin(superClass); /** * @polymer * @mixinClass * @implements {Polymer_ArraySelectorMixin} * @unrestricted */ class ArraySelectorMixin extends elementBase { static get properties() { return { /** * An array containing items from which selection will be made. */ items: { type: Array, }, /** * When `true`, multiple items may be selected at once (in this case, * `selected` is an array of currently selected items). When `false`, * only one item may be selected at a time. */ multi: { type: Boolean, value: false, }, /** * When `multi` is true, this is an array that contains any selected. * When `multi` is false, this is the currently selected item, or `null` * if no item is selected. * @type {?(Object|Array<!Object>)} */ selected: { type: Object, notify: true }, /** * When `multi` is false, this is the currently selected item, or `null` * if no item is selected. * @type {?Object} */ selectedItem: { type: Object, notify: true }, /** * When `true`, calling `select` on an item that is already selected * will deselect the item. */ toggle: { type: Boolean, value: false } }; } static get observers() { return ['__updateSelection(multi, items.*)']; } constructor() { super(); this.__lastItems = null; this.__lastMulti = null; this.__selectedMap = null; } __updateSelection(multi, itemsInfo) { let path = itemsInfo.path; if (path == 'items') { // Case 1 - items array changed, so diff against previous array and // deselect any removed items and adjust selected indices let newItems = itemsInfo.base || []; let lastItems = this.__lastItems; let lastMulti = this.__lastMulti; if (multi !== lastMulti) { this.clearSelection(); } if (lastItems) { let splices = Polymer.ArraySplice.calculateSplices(newItems, lastItems); this.__applySplices(splices); } this.__lastItems = newItems; this.__lastMulti = multi; } else if (itemsInfo.path == 'items.splices') { // Case 2 - got specific splice information describing the array mutation: // deselect any removed items and adjust selected indices this.__applySplices(itemsInfo.value.indexSplices); } else { // Case 3 - an array element was changed, so deselect the previous // item for that index if it was previously selected let part = path.slice('items.'.length); let idx = parseInt(part, 10); if ((part.indexOf('.') < 0) && part == idx) { this.__deselectChangedIdx(idx); } } } __applySplices(splices) { let selected = this.__selectedMap; // Adjust selected indices and mark removals for (let i=0; i<splices.length; i++) { let s = splices[i]; selected.forEach((idx, item) => { if (idx < s.index) { // no change } else if (idx >= s.index + s.removed.length) { // adjust index selected.set(item, idx + s.addedCount - s.removed.length); } else { // remove index selected.set(item, -1); } }); for (let j=0; j<s.addedCount; j++) { let idx = s.index + j; if (selected.has(this.items[idx])) { selected.set(this.items[idx], idx); } } } // Update linked paths this.__updateLinks(); // Remove selected items that were removed from the items array let sidx = 0; selected.forEach((idx, item) => { if (idx < 0) { if (this.multi) { this.splice('selected', sidx, 1); } else { this.selected = this.selectedItem = null; } selected.delete(item); } else { sidx++; } }); } __updateLinks() { this.__dataLinkedPaths = {}; if (this.multi) { let sidx = 0; this.__selectedMap.forEach(idx => { if (idx >= 0) { this.linkPaths('items.' + idx, 'selected.' + sidx++); } }); } else { this.__selectedMap.forEach(idx => { this.linkPaths('selected', 'items.' + idx); this.linkPaths('selectedItem', 'items.' + idx); }); } } /** * Clears the selection state. * @return {void} */ clearSelection() { // Unbind previous selection this.__dataLinkedPaths = {}; // The selected map stores 3 pieces of information: // key: items array object // value: items array index // order: selected array index this.__selectedMap = new Map(); // Initialize selection this.selected = this.multi ? [] : null; this.selectedItem = null; } /** * Returns whether the item is currently selected. * * @param {*} item Item from `items` array to test * @return {boolean} Whether the item is selected */ isSelected(item) { return this.__selectedMap.has(item); } /** * Returns whether the item is currently selected. * * @param {number} idx Index from `items` array to test * @return {boolean} Whether the item is selected */ isIndexSelected(idx) { return this.isSelected(this.items[idx]); } __deselectChangedIdx(idx) { let sidx = this.__selectedIndexForItemIndex(idx); if (sidx >= 0) { let i = 0; this.__selectedMap.forEach((idx, item) => { if (sidx == i++) { this.deselect(item); } }); } } __selectedIndexForItemIndex(idx) { let selected = this.__dataLinkedPaths['items.' + idx]; if (selected) { return parseInt(selected.slice('selected.'.length), 10); } } /** * Deselects the given item if it is already selected. * * @param {*} item Item from `items` array to deselect * @return {void} */ deselect(item) { let idx = this.__selectedMap.get(item); if (idx >= 0) { this.__selectedMap.delete(item); let sidx; if (this.multi) { sidx = this.__selectedIndexForItemIndex(idx); } this.__updateLinks(); if (this.multi) { this.splice('selected', sidx, 1); } else { this.selected = this.selectedItem = null; } } } /** * Deselects the given index if it is already selected. * * @param {number} idx Index from `items` array to deselect * @return {void} */ deselectIndex(idx) { this.deselect(this.items[idx]); } /** * Selects the given item. When `toggle` is true, this will automatically * deselect the item if already selected. * * @param {*} item Item from `items` array to select * @return {void} */ select(item) { this.selectIndex(this.items.indexOf(item)); } /** * Selects the given index. When `toggle` is true, this will automatically * deselect the item if already selected. * * @param {number} idx Index from `items` array to select * @return {void} */ selectIndex(idx) { let item = this.items[idx]; if (!this.isSelected(item)) { if (!this.multi) { this.__selectedMap.clear(); } this.__selectedMap.set(item, idx); this.__updateLinks(); if (this.multi) { this.push('selected', item); } else { this.selected = this.selectedItem = item; } } else if (this.toggle) { this.deselectIndex(idx); } } } return ArraySelectorMixin; }); // export mixin Polymer.ArraySelectorMixin = ArraySelectorMixin; /** * @constructor * @extends {Polymer.Element} * @implements {Polymer_ArraySelectorMixin} * @private */ let baseArraySelector = ArraySelectorMixin(Polymer.Element); /** * Element implementing the `Polymer.ArraySelector` mixin, which records * dynamic associations between item paths in a master `items` array and a * `selected` array such that path changes to the master array (at the host) * element or elsewhere via data-binding) are correctly propagated to items * in the selected array and vice-versa. * * The `items` property accepts an array of user data, and via the * `select(item)` and `deselect(item)` API, updates the `selected` property * which may be bound to other parts of the application, and any changes to * sub-fields of `selected` item(s) will be kept in sync with items in the * `items` array. When `multi` is false, `selected` is a property * representing the last selected item. When `multi` is true, `selected` * is an array of multiply selected items. * * Example: * * ```html * <dom-module id="employee-list"> * * <template> * * <div> Employee list: </div> * <dom-repeat id="employeeList" items="{{employees}}"> * <template> * <div>First name: <span>{{item.first}}</span></div> * <div>Last name: <span>{{item.last}}</span></div> * <button on-click="toggleSelection">Select</button> * </template> * </dom-repeat> * * <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector> * * <div> Selected employees: </div> * <dom-repeat items="{{selected}}"> * <template> * <div>First name: <span>{{item.first}}</span></div> * <div>Last name: <span>{{item.last}}</span></div> * </template> * </dom-repeat> * * </template> * * </dom-module> * ``` * * ```js *class EmployeeList extends Polymer.Element { * static get is() { return 'employee-list'; } * static get properties() { * return { * employees: { * value() { * return [ * {first: 'Bob', last: 'Smith'}, * {first: 'Sally', last: 'Johnson'}, * ... * ]; * } * } * }; * } * toggleSelection(e) { * let item = this.$.employeeList.itemForElement(e.target); * this.$.selector.select(item); * } *} * ``` * * @polymer * @customElement * @extends {baseArraySelector} * @appliesMixin Polymer.ArraySelectorMixin * @memberof Polymer * @summary Custom element that links paths between an input `items` array and * an output `selected` item or array based on calls to its selection API. */ class ArraySelector extends baseArraySelector { // Not needed to find template; can be removed once the analyzer // can find the tag name from customElements.define call static get is() { return 'array-selector'; } } customElements.define(ArraySelector.is, ArraySelector); /** @const */ Polymer.ArraySelector = ArraySelector; })(); (function(){/* Copyright (c) 2017 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ 'use strict';var c=null,f=window.HTMLImports&&window.HTMLImports.whenReady||null,g;function h(a){requestAnimationFrame(function(){f?f(a):(c||(c=new Promise(function(a){g=a}),"complete"===document.readyState?g():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&g()})),c.then(function(){a&&a()}))})};var k=null,l=null;function m(){this.customStyles=[];this.enqueued=!1;h(function(){window.ShadyCSS.flushCustomStyles&&window.ShadyCSS.flushCustomStyles()})}function n(a){!a.enqueued&&l&&(a.enqueued=!0,h(l))}m.prototype.c=function(a){a.__seenByShadyCSS||(a.__seenByShadyCSS=!0,this.customStyles.push(a),n(this))};m.prototype.b=function(a){if(a.__shadyCSSCachedStyle)return a.__shadyCSSCachedStyle;var b;a.getStyle?b=a.getStyle():b=a;return b}; m.prototype.a=function(){for(var a=this.customStyles,b=0;b<a.length;b++){var d=a[b];if(!d.__shadyCSSCachedStyle){var e=this.b(d);e&&(e=e.__appliedElement||e,k&&k(e),d.__shadyCSSCachedStyle=e)}}return a};m.prototype.addCustomStyle=m.prototype.c;m.prototype.getStyleForCustomStyle=m.prototype.b;m.prototype.processStyles=m.prototype.a; Object.defineProperties(m.prototype,{transformCallback:{get:function(){return k},set:function(a){k=a}},validateCallback:{get:function(){return l},set:function(a){var b=!1;l||(b=!0);l=a;b&&n(this)}}});function p(a,b){for(var d in b)null===d?a.style.removeProperty(d):a.style.setProperty(d,b[d])};var q=!(window.ShadyDOM&&window.ShadyDOM.inUse),r;function t(a){r=a&&a.shimcssproperties?!1:q||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var u;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(u=window.ShadyCSS.cssBuild);var v=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime); window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?r=window.ShadyCSS.nativeCss:window.ShadyCSS?(t(window.ShadyCSS),window.ShadyCSS=void 0):t(window.WebComponents&&window.WebComponents.flags);var w=r,x=u;var y=new m;window.ShadyCSS||(window.ShadyCSS={prepareTemplate:function(){},prepareTemplateDom:function(){},prepareTemplateStyles:function(){},styleSubtree:function(a,b){y.a();p(a,b)},styleElement:function(){y.a()},styleDocument:function(a){y.a();p(document.body,a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){},nativeCss:w,nativeShadow:q,cssBuild:x,disableRuntime:v});window.ShadyCSS.CustomStyleInterface=y;}).call(this); (function() { 'use strict'; const attr = 'include'; const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface; /** * Custom element for defining styles in the main document that can take * advantage of [shady DOM](https://github.com/webcomponents/shadycss) shims * for style encapsulation, custom properties, and custom mixins. * * - Document styles defined in a `<custom-style>` are shimmed to ensure they * do not leak into local DOM when running on browsers without native * Shadow DOM. * - Custom properties can be defined in a `<custom-style>`. Use the `html` selector * to define custom properties that apply to all custom elements. * - Custom mixins can be defined in a `<custom-style>`, if you import the optional * [apply shim](https://github.com/webcomponents/shadycss#about-applyshim) * (`shadycss/apply-shim.html`). * * To use: * * - Import `custom-style.html`. * - Place a `<custom-style>` element in the main document, wrapping an inline `<style>` tag that * contains the CSS rules you want to shim. * * For example: * * ```html * <!-- import apply shim--only required if using mixins --> * <link rel="import" href="bower_components/shadycss/apply-shim.html"> * <!-- import custom-style element --> * <link rel="import" href="bower_components/polymer/lib/elements/custom-style.html"> * * <custom-style> * <style> * html { * --custom-color: blue; * --custom-mixin: { * font-weight: bold; * color: red; * }; * } * </style> * </custom-style> * ``` * * @customElement * @extends HTMLElement * @memberof Polymer * @summary Custom element for defining styles in the main document that can * take advantage of Polymer's style scoping and custom properties shims. */ class CustomStyle extends HTMLElement { constructor() { super(); this._style = null; CustomStyleInterface.addCustomStyle(this); } /** * Returns the light-DOM `<style>` child this element wraps. Upon first * call any style modules referenced via the `include` attribute will be * concatenated to this element's `<style>`. * * @return {HTMLStyleElement} This element's light-DOM `<style>` */ getStyle() { if (this._style) { return this._style; } const style = /** @type {HTMLStyleElement} */(this.querySelector('style')); if (!style) { return null; } this._style = style; const include = style.getAttribute(attr); if (include) { style.removeAttribute(attr); style.textContent = Polymer.StyleGather.cssFromModules(include) + style.textContent; } /* HTML Imports styling the main document are deprecated in Chrome https://crbug.com/523952 If this element is not in the main document, then it must be in an HTML Import document. In that case, move the custom style to the main document. The ordering of `<custom-style>` should stay the same as when loaded by HTML Imports, but there may be odd cases of ordering w.r.t the main document styles. */ if (this.ownerDocument !== window.document) { window.document.head.appendChild(this); } return this._style; } } window.customElements.define('custom-style', CustomStyle); /** @const */ Polymer.CustomStyle = CustomStyle; })(); (function() { 'use strict'; let mutablePropertyChange; /** @suppress {missingProperties} */ (() => { mutablePropertyChange = Polymer.MutableData._mutablePropertyChange; })(); /** * Legacy element behavior to skip strict dirty-checking for objects and arrays, * (always consider them to be "dirty") for use on legacy API Polymer elements. * * By default, `Polymer.PropertyEffects` performs strict dirty checking on * objects, which means that any deep modifications to an object or array will * not be propagated unless "immutable" data patterns are used (i.e. all object * references from the root to the mutation were changed). * * Polymer also provides a proprietary data mutation and path notification API * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient * mutation and notification of deep changes in an object graph to all elements * bound to the same object graph. * * In cases where neither immutable patterns nor the data mutation API can be * used, applying this mixin will cause Polymer to skip dirty checking for * objects and arrays (always consider them to be "dirty"). This allows a * user to make a deep modification to a bound object graph, and then either * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` * (e.g. `this.notifyPath('items')`) to update the tree. Note that all * elements that wish to be updated based on deep mutations must apply this * mixin or otherwise skip strict dirty checking for objects/arrays. * Specifically, any elements in the binding tree between the source of a * mutation and the consumption of it must apply this behavior or enable the * `Polymer.OptionalMutableDataBehavior`. * * In order to make the dirty check strategy configurable, see * `Polymer.OptionalMutableDataBehavior`. * * Note, the performance characteristics of propagating large object graphs * will be worse as opposed to using strict dirty checking with immutable * patterns or Polymer's path notification API. * * @polymerBehavior * @memberof Polymer * @summary Behavior to skip strict dirty-checking for objects and * arrays */ Polymer.MutableDataBehavior = { /** * Overrides `Polymer.PropertyEffects` to provide option for skipping * strict equality checking for Objects and Arrays. * * This method pulls the value to dirty check against from the `__dataTemp` * cache (rather than the normal `__data` cache) for Objects. Since the temp * cache is cleared at the end of a turn, this implementation allows * side-effects of deep object changes to be processed by re-setting the * same object (using the temp cache as an in-turn backstop to prevent * cycles due to 2-way notification). * * @param {string} property Property name * @param {*} value New property value * @param {*} old Previous property value * @return {boolean} Whether the property should be considered a change * @protected */ _shouldPropertyChange(property, value, old) { return mutablePropertyChange(this, property, value, old, true); } }; /** * Legacy element behavior to add the optional ability to skip strict * dirty-checking for objects and arrays (always consider them to be * "dirty") by setting a `mutable-data` attribute on an element instance. * * By default, `Polymer.PropertyEffects` performs strict dirty checking on * objects, which means that any deep modifications to an object or array will * not be propagated unless "immutable" data patterns are used (i.e. all object * references from the root to the mutation were changed). * * Polymer also provides a proprietary data mutation and path notification API * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient * mutation and notification of deep changes in an object graph to all elements * bound to the same object graph. * * In cases where neither immutable patterns nor the data mutation API can be * used, applying this mixin will allow Polymer to skip dirty checking for * objects and arrays (always consider them to be "dirty"). This allows a * user to make a deep modification to a bound object graph, and then either * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` * (e.g. `this.notifyPath('items')`) to update the tree. Note that all * elements that wish to be updated based on deep mutations must apply this * mixin or otherwise skip strict dirty checking for objects/arrays. * Specifically, any elements in the binding tree between the source of a * mutation and the consumption of it must enable this behavior or apply the * `Polymer.OptionalMutableDataBehavior`. * * While this behavior adds the ability to forgo Object/Array dirty checking, * the `mutableData` flag defaults to false and must be set on the instance. * * Note, the performance characteristics of propagating large object graphs * will be worse by relying on `mutableData: true` as opposed to using * strict dirty checking with immutable patterns or Polymer's path notification * API. * * @polymerBehavior * @memberof Polymer * @summary Behavior to optionally skip strict dirty-checking for objects and * arrays */ Polymer.OptionalMutableDataBehavior = { properties: { /** * Instance-level flag for configuring the dirty-checking strategy * for this element. When true, Objects and Arrays will skip dirty * checking, otherwise strict equality checking will be used. */ mutableData: Boolean }, /** * Overrides `Polymer.PropertyEffects` to skip strict equality checking * for Objects and Arrays. * * Pulls the value to dirty check against from the `__dataTemp` cache * (rather than the normal `__data` cache) for Objects. Since the temp * cache is cleared at the end of a turn, this implementation allows * side-effects of deep object changes to be processed by re-setting the * same object (using the temp cache as an in-turn backstop to prevent * cycles due to 2-way notification). * * @param {string} property Property name * @param {*} value New property value * @param {*} old Previous property value * @return {boolean} Whether the property should be considered a change * @this {this} * @protected */ _shouldPropertyChange(property, value, old) { return mutablePropertyChange(this, property, value, old, this.mutableData); } }; })(); // bc Polymer.Base = Polymer.LegacyElementMixin(HTMLElement).prototype; // NOTE: this is here for modulizer to export `html` for the module version of this file Polymer.html = Polymer.html; //# sourceURL=build://iron-meta/iron-meta.html.js (function(){Polymer.IronMeta=function(c){Polymer.IronMeta[" "](c);this.type=c&&c.type||"default";this.key=c&&c.key;c&&"value"in c&&(this.value=c.value)};Polymer.IronMeta[" "]=function(){};Polymer.IronMeta.types={};Polymer.IronMeta.prototype={get value(){var c=this.type,e=this.key;if(c&&e)return Polymer.IronMeta.types[c]&&Polymer.IronMeta.types[c][e]},set value(c){var e=this.type,g=this.key;e&&g&&(e=Polymer.IronMeta.types[e]=Polymer.IronMeta.types[e]||{},null==c?delete e[g]:e[g]=c)},get list(){if(this.type){var c= Polymer.IronMeta.types[this.type];return c?Object.keys(c).map(function(e){return b[this.type][e]},this):[]}},byKey:function(c){this.key=c;return this.value}};var b=Polymer.IronMeta.types;Polymer({is:"iron-meta",properties:{type:{type:String,value:"default"},key:{type:String},value:{type:String,notify:!0},self:{type:Boolean,observer:"_selfChanged"},__meta:{type:Boolean,computed:"__computeMeta(type, key, value)"}},hostAttributes:{hidden:!0},__computeMeta:function(c,e,g){c=new Polymer.IronMeta({type:c, key:e});void 0!==g&&g!==c.value?c.value=g:this.value!==c.value&&(this.value=c.value);return c},get list(){return this.__meta&&this.__meta.list},_selfChanged:function(c){c&&(this.value=this)},byKey:function(c){return(new Polymer.IronMeta({type:this.type,key:c})).value}})})(); //# sourceURL=build://iron-flex-layout/iron-flex-layout.html.js (function(){var b=document.createElement("style");b.textContent="[hidden] { display: none !important; }";document.head.appendChild(b)})(); //# sourceURL=build://iron-icon/iron-icon.html.js Polymer({is:"iron-icon",properties:{icon:{type:String},theme:{type:String},src:{type:String},_meta:{value:Polymer.Base.create("iron-meta",{type:"iconset"})}},observers:["_updateIcon(_meta, isAttached)","_updateIcon(theme, isAttached)","_srcChanged(src, isAttached)","_iconChanged(icon, isAttached)"],_DEFAULT_ICONSET:"icons",_iconChanged:function(b){b=(b||"").split(":");this._iconName=b.pop();this._iconsetName=b.pop()||this._DEFAULT_ICONSET;this._updateIcon()},_srcChanged:function(){this._updateIcon()}, _usesIconset:function(){return this.icon||!this.src},_updateIcon:function(){this._usesIconset()?(this._img&&this._img.parentNode&&Polymer.dom(this.root).removeChild(this._img),""===this._iconName?this._iconset&&this._iconset.removeIcon(this):this._iconsetName&&this._meta&&((this._iconset=this._meta.byKey(this._iconsetName))?(this._iconset.applyIcon(this,this._iconName,this.theme),this.unlisten(window,"iron-iconset-added","_updateIcon")):this.listen(window,"iron-iconset-added","_updateIcon"))):(this._iconset&& this._iconset.removeIcon(this),this._img||(this._img=document.createElement("img"),this._img.style.width="100%",this._img.style.height="100%",this._img.draggable=!1),this._img.src=this.src,Polymer.dom(this.root).appendChild(this._img))}}); //# sourceURL=build://iron-iconset-svg/iron-iconset-svg.html.js Polymer({is:"iron-iconset-svg",properties:{name:{type:String,observer:"_nameChanged"},size:{type:Number,value:24},rtlMirroring:{type:Boolean,value:!1},useGlobalRtlAttribute:{type:Boolean,value:!1}},created:function(){this._meta=new Polymer.IronMeta({type:"iconset",key:null,value:null})},attached:function(){this.style.display="none"},getIconNames:function(){this._icons=this._createIconMap();return Object.keys(this._icons).map(function(b){return this.name+":"+b},this)},applyIcon:function(b,c){this.removeIcon(b); if(c=this._cloneIcon(c,this.rtlMirroring&&this._targetIsRTL(b))){var e=Polymer.dom(b.root||b);e.insertBefore(c,e.childNodes[0]);return b._svgIcon=c}return null},removeIcon:function(b){b._svgIcon&&(Polymer.dom(b.root||b).removeChild(b._svgIcon),b._svgIcon=null)},_targetIsRTL:function(b){null==this.__targetIsRTL&&(this.useGlobalRtlAttribute?this.__targetIsRTL="rtl"===(document.body&&document.body.hasAttribute("dir")?document.body:document.documentElement).getAttribute("dir"):(b&&b.nodeType!==Node.ELEMENT_NODE&& (b=b.host),this.__targetIsRTL=b&&"rtl"===window.getComputedStyle(b).direction));return this.__targetIsRTL},_nameChanged:function(){this._meta.value=null;this._meta.key=this.name;this._meta.value=this;this.async(function(){this.fire("iron-iconset-added",this,{node:window})})},_createIconMap:function(){var b=Object.create(null);Polymer.dom(this).querySelectorAll("[id]").forEach(function(c){b[c.id]=c});return b},_cloneIcon:function(b,c){this._icons=this._icons||this._createIconMap();return this._prepareSvgClone(this._icons[b], this.size,c)},_prepareSvgClone:function(b,c,e){if(b){b=b.cloneNode(!0);var g=document.createElementNS("http://www.w3.org/2000/svg","svg");c=b.getAttribute("viewBox")||"0 0 "+c+" "+c;var k="pointer-events: none; display: block; width: 100%; height: 100%;";e&&b.hasAttribute("mirror-in-rtl")&&(k+="-webkit-transform:scale(-1,1);transform:scale(-1,1);transform-origin:center;");g.setAttribute("viewBox",c);g.setAttribute("preserveAspectRatio","xMidYMid meet");g.setAttribute("focusable","false");g.style.cssText= k;g.appendChild(b).removeAttribute("id");return g}return null}}); //# sourceURL=build://iron-resizable-behavior/iron-resizable-behavior.html.js Polymer.IronResizableBehavior={properties:{_parentResizable:{type:Object,observer:"_parentResizableChanged"},_notifyingDescendant:{type:Boolean,value:!1}},listeners:{"iron-request-resize-notifications":"_onIronRequestResizeNotifications"},created:function(){this._interestedResizables=[];this._boundNotifyResize=this.notifyResize.bind(this)},attached:function(){this._requestResizeNotifications()},detached:function(){this._parentResizable?this._parentResizable.stopResizeNotificationsFor(this):window.removeEventListener("resize", this._boundNotifyResize);this._parentResizable=null},notifyResize:function(){this.isAttached&&(this._interestedResizables.forEach(function(b){this.resizerShouldNotify(b)&&this._notifyDescendant(b)},this),this._fireResize())},assignParentResizable:function(b){this._parentResizable=b},stopResizeNotificationsFor:function(b){var c=this._interestedResizables.indexOf(b);-1<c&&(this._interestedResizables.splice(c,1),this.unlisten(b,"iron-resize","_onDescendantIronResize"))},resizerShouldNotify:function(){return!0}, _onDescendantIronResize:function(b){this._notifyingDescendant?b.stopPropagation():Polymer.Settings.useShadow||this._fireResize()},_fireResize:function(){this.fire("iron-resize",null,{node:this,bubbles:!1})},_onIronRequestResizeNotifications:function(b){var c=Polymer.dom(b).rootTarget;c!==this&&(-1===this._interestedResizables.indexOf(c)&&(this._interestedResizables.push(c),this.listen(c,"iron-resize","_onDescendantIronResize")),c.assignParentResizable(this),this._notifyDescendant(c),b.stopPropagation())}, _parentResizableChanged:function(b){b&&window.removeEventListener("resize",this._boundNotifyResize)},_notifyDescendant:function(b){this.isAttached&&(this._notifyingDescendant=!0,b.notifyResize(),this._notifyingDescendant=!1)},_requestResizeNotifications:function(){if(this.isAttached)if("loading"===document.readyState){var b=this._requestResizeNotifications.bind(this);document.addEventListener("readystatechange",function e(){document.removeEventListener("readystatechange",e);b()})}else this.fire("iron-request-resize-notifications", null,{node:this,bubbles:!0,cancelable:!0}),this._parentResizable||(window.addEventListener("resize",this._boundNotifyResize),this.notifyResize())}}; //# sourceURL=build://iron-collapse/iron-collapse.html.js Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties:{horizontal:{type:Boolean,value:!1,observer:"_horizontalChanged"},opened:{type:Boolean,value:!1,notify:!0,observer:"_openedChanged"},transitioning:{type:Boolean,notify:!0,readOnly:!0},noAnimation:{type:Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizontal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"maxHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width": "max-height"},hostAttributes:{role:"group","aria-hidden":"true"},listeners:{transitionend:"_onTransitionEnd"},toggle:function(){this.opened=!this.opened},show:function(){this.opened=!0},hide:function(){this.opened=!1},updateSize:function(b,c){b="auto"===b?"":b;c=c&&!this.noAnimation&&this.isAttached&&this._desiredSize!==b;this._desiredSize=b;this._updateTransition(!1);c&&(c=this._calcSize(),""===b&&(this.style[this._dimensionMax]="",b=this._calcSize()),this.style[this._dimensionMax]=c,this.scrollTop= this.scrollTop,this._updateTransition(!0),c=b!==c);this.style[this._dimensionMax]=b;c||this._transitionEnd()},enableTransition:function(b){Polymer.Base._warn("`enableTransition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!b},_updateTransition:function(b){this.style.transitionDuration=b&&!this.noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionProperty=this._dimensionMaxCss;this.style["maxWidth"===this._dimensionMax?"maxHeight":"maxWidth"]="";this.updateSize(this.opened? "auto":"0px",!1)},_openedChanged:function(){this.setAttribute("aria-hidden",!this.opened);this._setTransitioning(!0);this.toggleClass("iron-collapse-closed",!1);this.toggleClass("iron-collapse-opened",!1);this.updateSize(this.opened?"auto":"0px",!0);this.opened&&this.focus()},_transitionEnd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass("iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",this.opened);this._updateTransition(!1);this.notifyResize(); this._setTransitioning(!1)},_onTransitionEnd:function(b){Polymer.dom(b).rootTarget===this&&this._transitionEnd()},_calcSize:function(){return this.getBoundingClientRect()[this.dimension]+"px"}}); //# sourceURL=build://iron-selector/iron-selection.html.js Polymer.IronSelection=function(b){this.selection=[];this.selectCallback=b}; Polymer.IronSelection.prototype={get:function(){return this.multi?this.selection.slice():this.selection[0]},clear:function(b){this.selection.slice().forEach(function(c){(!b||0>b.indexOf(c))&&this.setItemSelected(c,!1)},this)},isSelected:function(b){return 0<=this.selection.indexOf(b)},setItemSelected:function(b,c){if(null!=b&&c!==this.isSelected(b)){if(c)this.selection.push(b);else{var e=this.selection.indexOf(b);0<=e&&this.selection.splice(e,1)}this.selectCallback&&this.selectCallback(b,c)}},select:function(b){this.multi? this.toggle(b):this.get()!==b&&(this.setItemSelected(this.get(),!1),this.setItemSelected(b,!0))},toggle:function(b){this.setItemSelected(b,!this.isSelected(b))}}; //# sourceURL=build://iron-selector/iron-selectable.html.js Polymer.IronSelectableBehavior={properties:{attrForSelected:{type:String,value:null},selected:{type:String,notify:!0},selectedItem:{type:Object,readOnly:!0,notify:!0},activateEvent:{type:String,value:"tap",observer:"_activateEventChanged"},selectable:String,selectedClass:{type:String,value:"iron-selected"},selectedAttribute:{type:String,value:null},fallbackSelection:{type:String,value:null},items:{type:Array,readOnly:!0,notify:!0,value:function(){return[]}},_excludedLocalNames:{type:Object,value:function(){return{template:1, "dom-bind":1,"dom-if":1,"dom-repeat":1}}}},observers:["_updateAttrForSelected(attrForSelected)","_updateSelected(selected)","_checkFallback(fallbackSelection)"],created:function(){this._bindFilterItem=this._filterItem.bind(this);this._selection=new Polymer.IronSelection(this._applySelection.bind(this))},attached:function(){this._observer=this._observeItems(this);this._addListener(this.activateEvent)},detached:function(){this._observer&&Polymer.dom(this).unobserveNodes(this._observer);this._removeListener(this.activateEvent)}, indexOf:function(b){return this.items?this.items.indexOf(b):-1},select:function(b){this.selected=b},selectPrevious:function(){var b=this.items.length;b=(Number(this._valueToIndex(this.selected))-1+b)%b;this.selected=this._indexToValue(b)},selectNext:function(){var b=(Number(this._valueToIndex(this.selected))+1)%this.items.length;this.selected=this._indexToValue(b)},selectIndex:function(b){this.select(this._indexToValue(b))},forceSynchronousItemUpdate:function(){this._observer&&"function"===typeof this._observer.flush? this._observer.flush():this._updateItems()},get _shouldUpdateSelection(){return null!=this.selected},_checkFallback:function(){this._updateSelected()},_addListener:function(b){this.listen(this,b,"_activateHandler")},_removeListener:function(b){this.unlisten(this,b,"_activateHandler")},_activateEventChanged:function(b,c){this._removeListener(c);this._addListener(b)},_updateItems:function(){var b=Polymer.dom(this).queryDistributedElements(this.selectable||"*");b=Array.prototype.filter.call(b,this._bindFilterItem); this._setItems(b)},_updateAttrForSelected:function(){this.selectedItem&&(this.selected=this._valueForItem(this.selectedItem))},_updateSelected:function(){this._selectSelected(this.selected)},_selectSelected:function(){if(this.items){var b=this._valueToItem(this.selected);b?this._selection.select(b):this._selection.clear();this.fallbackSelection&&this.items.length&&void 0===this._selection.get()&&(this.selected=this.fallbackSelection)}},_filterItem:function(b){return!this._excludedLocalNames[b.localName]}, _valueToItem:function(b){return null==b?null:this.items[this._valueToIndex(b)]},_valueToIndex:function(b){if(this.attrForSelected)for(var c=0,e;e=this.items[c];c++){if(this._valueForItem(e)==b)return c}else return Number(b)},_indexToValue:function(b){if(this.attrForSelected){if(b=this.items[b])return this._valueForItem(b)}else return b},_valueForItem:function(b){if(!b)return null;if(!this.attrForSelected)return b=this.indexOf(b),-1===b?null:b;var c=b[Polymer.CaseMap.dashToCamelCase(this.attrForSelected)]; return void 0!=c?c:b.getAttribute(this.attrForSelected)},_applySelection:function(b,c){this.selectedClass&&this.toggleClass(this.selectedClass,c,b);this.selectedAttribute&&this.toggleAttribute(this.selectedAttribute,c,b);this._selectionChange();this.fire("iron-"+(c?"select":"deselect"),{item:b})},_selectionChange:function(){this._setSelectedItem(this._selection.get())},_observeItems:function(b){return Polymer.dom(b).observeNodes(function(c){this._updateItems();this._updateSelected();this.fire("iron-items-changed", c,{bubbles:!1,cancelable:!1})})},_activateHandler:function(b){b=b.target;for(var c=this.items;b&&b!=this;){var e=c.indexOf(b);if(0<=e){c=this._indexToValue(e);this._itemActivate(c,b);break}b=b.parentNode}},_itemActivate:function(b,c){this.fire("iron-activate",{selected:b,item:c},{cancelable:!0}).defaultPrevented||this.select(b)}}; //# sourceURL=build://iron-pages/iron-pages.html.js Polymer({is:"iron-pages",behaviors:[Polymer.IronResizableBehavior,Polymer.IronSelectableBehavior],properties:{activateEvent:{type:String,value:null}},observers:["_selectedPageChanged(selected)"],_selectedPageChanged:function(){this.async(this.notifyResize)}}); //# sourceURL=build://iron-a11y-keys-behavior/iron-a11y-keys-behavior.html.js (function(){function b(A,D){var H="";if(A)if(A=A.toLowerCase()," "===A||y.test(A))H="space";else if(z.test(A))H="esc";else if(1==A.length){if(!D||t.test(A))H=A}else H=x.test(A)?A.replace("arrow",""):"multiply"==A?"*":A;return H}function c(A){var D="";A&&(A in m?D=m[A]:v.test(A)?(A=parseInt(A.replace("U+","0x"),16),D=String.fromCharCode(A).toLowerCase()):D=A.toLowerCase());return D}function e(A){var D="";Number(A)&&(D=65<=A&&90>=A?String.fromCharCode(32+A):112<=A&&123>=A?"f"+(A-112+1):48<=A&&57>=A? String(A-48):96<=A&&105>=A?String(A-96):p[A]);return D}function g(A,D){return A.key?b(A.key,D):A.detail&&A.detail.key?b(A.detail.key,D):c(A.keyIdentifier)||e(A.keyCode)||""}function k(A,D){return g(D,A.hasModifiers)===A.key&&(!A.hasModifiers||!!D.shiftKey===!!A.shiftKey&&!!D.ctrlKey===!!A.ctrlKey&&!!D.altKey===!!A.altKey&&!!D.metaKey===!!A.metaKey)}function q(A){return 1===A.length?{combo:A,key:A,event:"keydown"}:A.split("+").reduce(function(D,H){var E=H.split(":");H=E[0];E=E[1];H in n?(D[n[H]]=!0, D.hasModifiers=!0):(D.key=H,D.event=E||"keydown");return D},{combo:A.split(":").shift()})}function l(A){return A.trim().split(" ").map(function(D){return q(D)})}var m={"U+0008":"backspace","U+0009":"tab","U+001B":"esc","U+0020":"space","U+007F":"del"},p={8:"backspace",9:"tab",13:"enter",27:"esc",33:"pageup",34:"pagedown",35:"end",36:"home",32:"space",37:"left",38:"up",39:"right",40:"down",46:"del",106:"*"},n={shift:"shiftKey",ctrl:"ctrlKey",alt:"altKey",meta:"metaKey"},t=/[a-z0-9*]/,v=/U\+/,x=/^arrow/, y=/^space(bar)?/,z=/^escape$/;Polymer.IronA11yKeysBehavior={properties:{keyEventTarget:{type:Object,value:function(){return this}},stopKeyboardEventPropagation:{type:Boolean,value:!1},_boundKeyHandlers:{type:Array,value:function(){return[]}},_imperativeKeyBindings:{type:Object,value:function(){return{}}}},observers:["_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)"],keyBindings:{},registered:function(){this._prepKeyBindings()},attached:function(){this._listenKeyEventListeners()},detached:function(){this._unlistenKeyEventListeners()}, addOwnKeyBinding:function(A,D){this._imperativeKeyBindings[A]=D;this._prepKeyBindings();this._resetKeyEventListeners()},removeOwnKeyBindings:function(){this._imperativeKeyBindings={};this._prepKeyBindings();this._resetKeyEventListeners()},keyboardEventMatchesKeys:function(A,D){D=l(D);for(var H=0;H<D.length;++H)if(k(D[H],A))return!0;return!1},_collectKeyBindings:function(){var A=this.behaviors.map(function(D){return D.keyBindings});-1===A.indexOf(this.keyBindings)&&A.push(this.keyBindings);return A}, _prepKeyBindings:function(){this._keyBindings={};this._collectKeyBindings().forEach(function(H){for(var E in H)this._addKeyBinding(E,H[E])},this);for(var A in this._imperativeKeyBindings)this._addKeyBinding(A,this._imperativeKeyBindings[A]);for(var D in this._keyBindings)this._keyBindings[D].sort(function(H,E){H=H[0].hasModifiers;return H===E[0].hasModifiers?0:H?-1:1})},_addKeyBinding:function(A,D){l(A).forEach(function(H){this._keyBindings[H.event]=this._keyBindings[H.event]||[];this._keyBindings[H.event].push([H, D])},this)},_resetKeyEventListeners:function(){this._unlistenKeyEventListeners();this.isAttached&&this._listenKeyEventListeners()},_listenKeyEventListeners:function(){this.keyEventTarget&&Object.keys(this._keyBindings).forEach(function(A){var D=this._onKeyBindingEvent.bind(this,this._keyBindings[A]);this._boundKeyHandlers.push([this.keyEventTarget,A,D]);this.keyEventTarget.addEventListener(A,D)},this)},_unlistenKeyEventListeners:function(){for(var A,D,H;this._boundKeyHandlers.length;)A=this._boundKeyHandlers.pop(), D=A[0],H=A[1],A=A[2],D.removeEventListener(H,A)},_onKeyBindingEvent:function(A,D){this.stopKeyboardEventPropagation&&D.stopPropagation();if(!D.defaultPrevented)for(var H=0;H<A.length;H++){var E=A[H][0],F=A[H][1];if(k(E,D)&&(this._triggerKeyHandler(E,F,D),D.defaultPrevented))break}},_triggerKeyHandler:function(A,D,H){var E=Object.create(A);E.keyboardEvent=H;A=new CustomEvent(A.event,{detail:E,cancelable:!0});this[D].call(this,A);A.defaultPrevented&&H.preventDefault()}}})(); //# sourceURL=build://iron-behaviors/iron-control-state.html.js Polymer.IronControlState={properties:{focused:{type:Boolean,value:!1,notify:!0,readOnly:!0,reflectToAttribute:!0},disabled:{type:Boolean,value:!1,notify:!0,observer:"_disabledChanged",reflectToAttribute:!0},_oldTabIndex:{type:String},_boundFocusBlurHandler:{type:Function,value:function(){return this._focusBlurHandler.bind(this)}},__handleEventRetargeting:{type:Boolean,value:function(){return!this.shadowRoot&&!Polymer.Element}}},observers:["_changedControlState(focused, disabled)"],ready:function(){this.addEventListener("focus", this._boundFocusBlurHandler,!0);this.addEventListener("blur",this._boundFocusBlurHandler,!0)},_focusBlurHandler:function(b){if(Polymer.Element)this._setFocused("focus"===b.type);else if(b.target===this)this._setFocused("focus"===b.type);else if(this.__handleEventRetargeting){var c=Polymer.dom(b).localTarget;this.isLightDescendant(c)||this.fire(b.type,{sourceEvent:b},{node:this,bubbles:b.bubbles,cancelable:b.cancelable})}},_disabledChanged:function(b){this.setAttribute("aria-disabled",b?"true":"false"); this.style.pointerEvents=b?"none":"";b?(this._oldTabIndex=this.getAttribute("tabindex"),this._setFocused(!1),this.tabIndex=-1,this.blur()):void 0!==this._oldTabIndex&&(null===this._oldTabIndex?this.removeAttribute("tabindex"):this.setAttribute("tabindex",this._oldTabIndex))},_changedControlState:function(){this._controlStateChanged&&this._controlStateChanged()}}; //# sourceURL=build://iron-behaviors/iron-button-state.html.js Polymer.IronButtonStateImpl={properties:{pressed:{type:Boolean,readOnly:!0,value:!1,reflectToAttribute:!0,observer:"_pressedChanged"},toggles:{type:Boolean,value:!1,reflectToAttribute:!0},active:{type:Boolean,value:!1,notify:!0,reflectToAttribute:!0},pointerDown:{type:Boolean,readOnly:!0,value:!1},receivedFocusFromKeyboard:{type:Boolean,readOnly:!0},ariaActiveAttribute:{type:String,value:"aria-pressed",observer:"_ariaActiveAttributeChanged"}},listeners:{down:"_downHandler",up:"_upHandler",tap:"_tapHandler"}, observers:["_focusChanged(focused)","_activeChanged(active, ariaActiveAttribute)"],keyBindings:{"enter:keydown":"_asyncClick","space:keydown":"_spaceKeyDownHandler","space:keyup":"_spaceKeyUpHandler"},_mouseEventRe:/^mouse/,_tapHandler:function(){this.toggles?this._userActivate(!this.active):this.active=!1},_focusChanged:function(b){this._detectKeyboardFocus(b);b||this._setPressed(!1)},_detectKeyboardFocus:function(b){this._setReceivedFocusFromKeyboard(!this.pointerDown&&b)},_userActivate:function(b){this.active!== b&&(this.active=b,this.fire("change"))},_downHandler:function(){this._setPointerDown(!0);this._setPressed(!0);this._setReceivedFocusFromKeyboard(!1)},_upHandler:function(){this._setPointerDown(!1);this._setPressed(!1)},_spaceKeyDownHandler:function(b){b=b.detail.keyboardEvent;var c=Polymer.dom(b).localTarget;this.isLightDescendant(c)||(b.preventDefault(),b.stopImmediatePropagation(),this._setPressed(!0))},_spaceKeyUpHandler:function(b){b=Polymer.dom(b.detail.keyboardEvent).localTarget;this.isLightDescendant(b)|| (this.pressed&&this._asyncClick(),this._setPressed(!1))},_asyncClick:function(){this.async(function(){this.click()},1)},_pressedChanged:function(){this._changedButtonState()},_ariaActiveAttributeChanged:function(b,c){c&&c!=b&&this.hasAttribute(c)&&this.removeAttribute(c)},_activeChanged:function(b){this.toggles?this.setAttribute(this.ariaActiveAttribute,b?"true":"false"):this.removeAttribute(this.ariaActiveAttribute);this._changedButtonState()},_controlStateChanged:function(){this.disabled?this._setPressed(!1): this._changedButtonState()},_changedButtonState:function(){this._buttonStateChanged&&this._buttonStateChanged()}};Polymer.IronButtonState=[Polymer.IronA11yKeysBehavior,Polymer.IronButtonStateImpl]; //# sourceURL=build://paper-ripple/paper-ripple.html.js (function(){function b(g){this.element=g;this.width=this.boundingRect.width;this.height=this.boundingRect.height;this.size=Math.max(this.width,this.height)}function c(g){this.element=g;this.color=window.getComputedStyle(g).color;this.wave=document.createElement("div");this.waveContainer=document.createElement("div");this.wave.style.backgroundColor=this.color;this.wave.classList.add("wave");this.waveContainer.classList.add("wave-container");Polymer.dom(this.waveContainer).appendChild(this.wave);this.resetInteractionState()} var e={distance:function(g,k,q,l){g-=q;k-=l;return Math.sqrt(g*g+k*k)},now:window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now};b.prototype={get boundingRect(){return this.element.getBoundingClientRect()},furthestCornerDistanceFrom:function(g,k){var q=e.distance(g,k,0,0),l=e.distance(g,k,this.width,0),m=e.distance(g,k,0,this.height);g=e.distance(g,k,this.width,this.height);return Math.max(q,l,m,g)}};c.MAX_RADIUS=300;c.prototype={get recenters(){return this.element.recenters}, get center(){return this.element.center},get mouseDownElapsed(){if(!this.mouseDownStart)return 0;var g=e.now()-this.mouseDownStart;this.mouseUpStart&&(g-=this.mouseUpElapsed);return g},get mouseUpElapsed(){return this.mouseUpStart?e.now()-this.mouseUpStart:0},get mouseDownElapsedSeconds(){return this.mouseDownElapsed/1E3},get mouseUpElapsedSeconds(){return this.mouseUpElapsed/1E3},get mouseInteractionSeconds(){return this.mouseDownElapsedSeconds+this.mouseUpElapsedSeconds},get initialOpacity(){return this.element.initialOpacity}, get opacityDecayVelocity(){return this.element.opacityDecayVelocity},get radius(){var g=1.1*Math.min(Math.sqrt(this.containerMetrics.width*this.containerMetrics.width+this.containerMetrics.height*this.containerMetrics.height),c.MAX_RADIUS)+5;return Math.abs(g*(1-Math.pow(80,-(this.mouseInteractionSeconds/(1.1-g/c.MAX_RADIUS*.2)))))},get opacity(){return this.mouseUpStart?Math.max(0,this.initialOpacity-this.mouseUpElapsedSeconds*this.opacityDecayVelocity):this.initialOpacity},get outerOpacity(){return Math.max(0, Math.min(.3*this.mouseUpElapsedSeconds,this.opacity))},get isOpacityFullyDecayed(){return.01>this.opacity&&this.radius>=Math.min(this.maxRadius,c.MAX_RADIUS)},get isRestingAtMaxRadius(){return this.opacity>=this.initialOpacity&&this.radius>=Math.min(this.maxRadius,c.MAX_RADIUS)},get isAnimationComplete(){return this.mouseUpStart?this.isOpacityFullyDecayed:this.isRestingAtMaxRadius},get translationFraction(){return Math.min(1,this.radius/this.containerMetrics.size*2/Math.sqrt(2))},get xNow(){return this.xEnd? this.xStart+this.translationFraction*(this.xEnd-this.xStart):this.xStart},get yNow(){return this.yEnd?this.yStart+this.translationFraction*(this.yEnd-this.yStart):this.yStart},get isMouseDown(){return this.mouseDownStart&&!this.mouseUpStart},resetInteractionState:function(){this.slideDistance=this.yEnd=this.xEnd=this.yStart=this.xStart=this.mouseUpStart=this.mouseDownStart=this.maxRadius=0;this.containerMetrics=new b(this.element)},draw:function(){this.wave.style.opacity=this.opacity;var g=this.radius/ (this.containerMetrics.size/2);var k=this.xNow-this.containerMetrics.width/2;var q=this.yNow-this.containerMetrics.height/2;this.waveContainer.style.webkitTransform="translate("+k+"px, "+q+"px)";this.waveContainer.style.transform="translate3d("+k+"px, "+q+"px, 0)";this.wave.style.webkitTransform="scale("+g+","+g+")";this.wave.style.transform="scale3d("+g+","+g+",1)"},downAction:function(g){var k=this.containerMetrics.width/2,q=this.containerMetrics.height/2;this.resetInteractionState();this.mouseDownStart= e.now();this.center?(this.xStart=k,this.yStart=q,this.slideDistance=e.distance(this.xStart,this.yStart,this.xEnd,this.yEnd)):(this.xStart=g?g.detail.x-this.containerMetrics.boundingRect.left:this.containerMetrics.width/2,this.yStart=g?g.detail.y-this.containerMetrics.boundingRect.top:this.containerMetrics.height/2);this.recenters&&(this.xEnd=k,this.yEnd=q,this.slideDistance=e.distance(this.xStart,this.yStart,this.xEnd,this.yEnd));this.maxRadius=this.containerMetrics.furthestCornerDistanceFrom(this.xStart, this.yStart);this.waveContainer.style.top=(this.containerMetrics.height-this.containerMetrics.size)/2+"px";this.waveContainer.style.left=(this.containerMetrics.width-this.containerMetrics.size)/2+"px";this.waveContainer.style.width=this.containerMetrics.size+"px";this.waveContainer.style.height=this.containerMetrics.size+"px"},upAction:function(){this.isMouseDown&&(this.mouseUpStart=e.now())},remove:function(){Polymer.dom(this.waveContainer.parentNode).removeChild(this.waveContainer)}};Polymer({is:"paper-ripple", behaviors:[Polymer.IronA11yKeysBehavior],properties:{initialOpacity:{type:Number,value:.25},opacityDecayVelocity:{type:Number,value:.8},recenters:{type:Boolean,value:!1},center:{type:Boolean,value:!1},ripples:{type:Array,value:function(){return[]}},animating:{type:Boolean,readOnly:!0,reflectToAttribute:!0,value:!1},holdDown:{type:Boolean,value:!1,observer:"_holdDownChanged"},noink:{type:Boolean,value:!1},_animating:{type:Boolean},_boundAnimate:{type:Function,value:function(){return this.animate.bind(this)}}}, get target(){return this.keyEventTarget},keyBindings:{"enter:keydown":"_onEnterKeydown","space:keydown":"_onSpaceKeydown","space:keyup":"_onSpaceKeyup"},attached:function(){var g=this.keyEventTarget=11==this.parentNode.nodeType?Polymer.dom(this).getOwnerRoot().host:this.parentNode;this.listen(g,"up","uiUpAction");this.listen(g,"down","uiDownAction")},detached:function(){this.unlisten(this.keyEventTarget,"up","uiUpAction");this.unlisten(this.keyEventTarget,"down","uiDownAction");this.keyEventTarget= null},get shouldKeepAnimating(){for(var g=0;g<this.ripples.length;++g)if(!this.ripples[g].isAnimationComplete)return!0;return!1},simulatedRipple:function(){this.downAction(null);this.async(function(){this.upAction()},1)},uiDownAction:function(g){this.noink||this.downAction(g)},downAction:function(g){this.holdDown&&0<this.ripples.length||(this.addRipple().downAction(g),this._animating||(this._animating=!0,this.animate()))},uiUpAction:function(g){this.noink||this.upAction(g)},upAction:function(g){this.holdDown|| (this.ripples.forEach(function(k){k.upAction(g)}),this._animating=!0,this.animate())},onAnimationComplete:function(){this._animating=!1;this.$.background.style.backgroundColor=null;this.fire("transitionend")},addRipple:function(){var g=new c(this);Polymer.dom(this.$.waves).appendChild(g.waveContainer);this.$.background.style.backgroundColor=g.color;this.ripples.push(g);this._setAnimating(!0);return g},removeRipple:function(g){var k=this.ripples.indexOf(g);0>k||(this.ripples.splice(k,1),g.remove(), this.ripples.length||this._setAnimating(!1))},animate:function(){if(this._animating){var g;for(g=0;g<this.ripples.length;++g){var k=this.ripples[g];k.draw();this.$.background.style.opacity=k.outerOpacity;k.isOpacityFullyDecayed&&!k.isRestingAtMaxRadius&&this.removeRipple(k)}if(this.shouldKeepAnimating||0!==this.ripples.length)window.requestAnimationFrame(this._boundAnimate);else this.onAnimationComplete()}},_onEnterKeydown:function(){this.uiDownAction();this.async(this.uiUpAction,1)},_onSpaceKeydown:function(){this.uiDownAction()}, _onSpaceKeyup:function(){this.uiUpAction()},_holdDownChanged:function(g,k){void 0!==k&&(g?this.downAction():this.upAction())}})})(); //# sourceURL=build://paper-behaviors/paper-ripple-behavior.html.js Polymer.PaperRippleBehavior={properties:{noink:{type:Boolean,observer:"_noinkChanged"},_rippleContainer:{type:Object}},_buttonStateChanged:function(){this.focused&&this.ensureRipple()},_downHandler:function(b){Polymer.IronButtonStateImpl._downHandler.call(this,b);this.pressed&&this.ensureRipple(b)},ensureRipple:function(b){if(!this.hasRipple()){this._ripple=this._createRipple();this._ripple.noink=this.noink;var c=this._rippleContainer||this.root;c&&Polymer.dom(c).appendChild(this._ripple);if(b){c= Polymer.dom(this._rippleContainer||this);var e=Polymer.dom(b).rootTarget;c.deepContains(e)&&this._ripple.uiDownAction(b)}}},getRipple:function(){this.ensureRipple();return this._ripple},hasRipple:function(){return!!this._ripple},_createRipple:function(){return document.createElement("paper-ripple")},_noinkChanged:function(b){this.hasRipple()&&(this._ripple.noink=b)}}; //# sourceURL=build://paper-behaviors/paper-button-behavior.html.js Polymer.PaperButtonBehaviorImpl={properties:{elevation:{type:Number,reflectToAttribute:!0,readOnly:!0}},observers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated:!0},_calculateElevation:function(){var b=1;this.disabled?b=0:this.active||this.pressed?b=4:this.receivedFocusFromKeyboard&&(b=3);this._setElevation(b)},_computeKeyboardClass:function(b){this.toggleClass("keyboard-focus", b)},_spaceKeyDownHandler:function(b){Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this,b);this.hasRipple()&&1>this.getRipple().ripples.length&&this._ripple.uiDownAction()},_spaceKeyUpHandler:function(b){Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this,b);this.hasRipple()&&this._ripple.uiUpAction()}};Polymer.PaperButtonBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperButtonBehaviorImpl]; //# sourceURL=build://paper-button/paper-button.html.js Polymer({is:"paper-button",behaviors:[Polymer.PaperButtonBehavior],properties:{raised:{type:Boolean,reflectToAttribute:!0,value:!1,observer:"_calculateElevation"}},_calculateElevation:function(){this.raised?Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this):this._setElevation(0)}}); //# sourceURL=build://neon-animation/neon-animatable-behavior.html.js Polymer.NeonAnimatableBehavior={properties:{animationConfig:{type:Object},entryAnimation:{observer:"_entryAnimationChanged",type:String},exitAnimation:{observer:"_exitAnimationChanged",type:String}},_entryAnimationChanged:function(){this.animationConfig=this.animationConfig||{};this.animationConfig.entry=[{name:this.entryAnimation,node:this}]},_exitAnimationChanged:function(){this.animationConfig=this.animationConfig||{};this.animationConfig.exit=[{name:this.exitAnimation,node:this}]},_copyProperties:function(b, c){for(var e in c)b[e]=c[e]},_cloneConfig:function(b){var c={isClone:!0};this._copyProperties(c,b);return c},_getAnimationConfigRecursive:function(b,c,e){if(this.animationConfig)if(this.animationConfig.value&&"function"===typeof this.animationConfig.value)this._warn(this._logf("playAnimation","Please put 'animationConfig' inside of your components 'properties' object instead of outside of it."));else{var g=b?this.animationConfig[b]:this.animationConfig;Array.isArray(g)||(g=[g]);if(g)for(var k,q=0;k= g[q];q++)if(k.animatable)k.animatable._getAnimationConfigRecursive(k.type||b,c,e);else if(k.id){var l=c[k.id];l?(l.isClone||(c[k.id]=this._cloneConfig(l),l=c[k.id]),this._copyProperties(l,k)):c[k.id]=k}else e.push(k)}},getAnimationConfig:function(b){var c={},e=[];this._getAnimationConfigRecursive(b,c,e);for(var g in c)e.push(c[g]);return e}}; //# sourceURL=build://neon-animation/neon-animation-runner-behavior.html.js Polymer.NeonAnimationRunnerBehaviorImpl={_configureAnimations:function(b){var c=[],e=[];if(0<b.length)for(var g,k=0;g=b[k];k++){var q=document.createElement(g.name);if(q.isNeonAnimation){var l=null;q.configure||(q.configure=function(){return null});l=q.configure(g);e.push({result:l,config:g})}else console.warn(this.is+":",g.name,"not found!")}for(b=0;b<e.length;b++){l=e[b].result;g=e[b].config;try{"function"!=typeof l.cancel&&(l=document.timeline.play(l))}catch(m){l=null,console.warn("Couldnt play", "(",g.name,").",m)}l&&c.push({neonAnimation:q,config:g,animation:l})}return c},_shouldComplete:function(b){for(var c=!0,e=0;e<b.length;e++)if("finished"!=b[e].animation.playState){c=!1;break}return c},_complete:function(b){for(var c=0;c<b.length;c++)b[c].neonAnimation.complete(b[c].config);for(c=0;c<b.length;c++)b[c].animation.cancel()},playAnimation:function(b,c){var e=this.getAnimationConfig(b);if(e){this._active=this._active||{};this._active[b]&&(this._complete(this._active[b]),delete this._active[b]); var g=this._configureAnimations(e);if(0==g.length)this.fire("neon-animation-finish",c,{bubbles:!1});else for(this._active[b]=g,e=0;e<g.length;e++)g[e].animation.onfinish=function(){this._shouldComplete(g)&&(this._complete(g),delete this._active[b],this.fire("neon-animation-finish",c,{bubbles:!1}))}.bind(this)}},cancelAnimation:function(){for(var b in this._active){var c=this._active[b],e;for(e in c)c[e].animation.cancel()}this._active={}}}; Polymer.NeonAnimationRunnerBehavior=[Polymer.NeonAnimatableBehavior,Polymer.NeonAnimationRunnerBehaviorImpl]; //# sourceURL=build://iron-fit-behavior/iron-fit-behavior.html.js Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,value:function(){return this}},fitInto:{type:Object,value:window},noOverlap:{type:Boolean},positionTarget:{type:Element},horizontalAlign:{type:String},verticalAlign:{type:String},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:!0},verticalOffset:{type:Number,value:0,notify:!0},autoFitOnAttach:{type:Boolean,value:!1},_fitInfo:{type:Object}},get _fitWidth(){return this.fitInto===window?this.fitInto.innerWidth:this.fitInto.getBoundingClientRect().width}, get _fitHeight(){return this.fitInto===window?this.fitInto.innerHeight:this.fitInto.getBoundingClientRect().height},get _fitLeft(){return this.fitInto===window?0:this.fitInto.getBoundingClientRect().left},get _fitTop(){return this.fitInto===window?0:this.fitInto.getBoundingClientRect().top},get _defaultPositionTarget(){var b=Polymer.dom(this).parentNode;b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(b=b.host);return b},get _localeHorizontalAlign(){if(this._isRTL){if("right"===this.horizontalAlign)return"left"; if("left"===this.horizontalAlign)return"right"}return this.horizontalAlign},get __shouldPosition(){return(this.horizontalAlign||this.verticalAlign)&&this.positionTarget},attached:function(){"undefined"===typeof this._isRTL&&(this._isRTL="rtl"==window.getComputedStyle(this).direction);this.positionTarget=this.positionTarget||this._defaultPositionTarget;this.autoFitOnAttach&&("none"===window.getComputedStyle(this).display?setTimeout(function(){this.fit()}.bind(this)):(window.ShadyDOM&&ShadyDOM.flush(), this.fit()))},detached:function(){this.__deferredFit&&(clearTimeout(this.__deferredFit),this.__deferredFit=null)},fit:function(){this.position();this.constrain();this.center()},_discoverInfo:function(){if(!this._fitInfo){var b=window.getComputedStyle(this),c=window.getComputedStyle(this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top||"",left:this.style.left||"",position:this.style.position||""},sizerInlineStyle:{maxWidth:this.sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHeight|| "",boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{vertically:"auto"!==b.top?"top":"auto"!==b.bottom?"bottom":null,horizontally:"auto"!==b.left?"left":"auto"!==b.right?"right":null},sizedBy:{height:"none"!==c.maxHeight,width:"none"!==c.maxWidth,minWidth:parseInt(c.minWidth,10)||0,minHeight:parseInt(c.minHeight,10)||0},margin:{top:parseInt(b.marginTop,10)||0,right:parseInt(b.marginRight,10)||0,bottom:parseInt(b.marginBottom,10)||0,left:parseInt(b.marginLeft,10)||0}}}},resetFit:function(){var b= this._fitInfo||{},c;for(c in b.sizerInlineStyle)this.sizingTarget.style[c]=b.sizerInlineStyle[c];for(c in b.inlineStyle)this.style[c]=b.inlineStyle[c];this._fitInfo=null},refit:function(){var b=this.sizingTarget.scrollLeft,c=this.sizingTarget.scrollTop;this.resetFit();this.fit();this.sizingTarget.scrollLeft=b;this.sizingTarget.scrollTop=c},position:function(){if(this.__shouldPosition){this._discoverInfo();this.style.position="fixed";this.sizingTarget.style.boxSizing="border-box";this.style.left="0px"; this.style.top="0px";var b=this.getBoundingClientRect(),c=this.__getNormalizedRect(this.positionTarget),e=this.__getNormalizedRect(this.fitInto),g=this._fitInfo.margin,k=this.__getPosition(this._localeHorizontalAlign,this.verticalAlign,{width:b.width+g.left+g.right,height:b.height+g.top+g.bottom},b,c,e);c=k.left+g.left;k=k.top+g.top;var q=Math.min(e.right-g.right,c+b.width),l=Math.min(e.bottom-g.bottom,k+b.height);c=Math.max(e.left+g.left,Math.min(c,q-this._fitInfo.sizedBy.minWidth));k=Math.max(e.top+ g.top,Math.min(k,l-this._fitInfo.sizedBy.minHeight));this.sizingTarget.style.maxWidth=Math.max(q-c,this._fitInfo.sizedBy.minWidth)+"px";this.sizingTarget.style.maxHeight=Math.max(l-k,this._fitInfo.sizedBy.minHeight)+"px";this.style.left=c-b.left+"px";this.style.top=k-b.top+"px"}},constrain:function(){if(!this.__shouldPosition){this._discoverInfo();var b=this._fitInfo;b.positionedBy.vertically||(this.style.position="fixed",this.style.top="0px");b.positionedBy.horizontally||(this.style.position="fixed", this.style.left="0px");this.sizingTarget.style.boxSizing="border-box";var c=this.getBoundingClientRect();b.sizedBy.height||this.__sizeDimension(c,b.positionedBy.vertically,"top","bottom","Height");b.sizedBy.width||this.__sizeDimension(c,b.positionedBy.horizontally,"left","right","Width")}},_sizeDimension:function(b,c,e,g,k){this.__sizeDimension(b,c,e,g,k)},__sizeDimension:function(b,c,e,g,k){var q=this._fitInfo,l=this.__getNormalizedRect(this.fitInto);l="Width"===k?l.width:l.height;c=c===g;var m= "offset"+k;this.sizingTarget.style["max"+k]=l-q.margin[c?e:g]-(c?l-b[g]:b[e])-(this[m]-this.sizingTarget[m])+"px"},center:function(){if(!this.__shouldPosition){this._discoverInfo();var b=this._fitInfo.positionedBy;if(!b.vertically||!b.horizontally){this.style.position="fixed";b.vertically||(this.style.top="0px");b.horizontally||(this.style.left="0px");var c=this.getBoundingClientRect(),e=this.__getNormalizedRect(this.fitInto);b.vertically||(this.style.top=e.top-c.top+(e.height-c.height)/2+"px");b.horizontally|| (this.style.left=e.left-c.left+(e.width-c.width)/2+"px")}}},__getNormalizedRect:function(b){return b===document.documentElement||b===window?{top:0,left:0,width:window.innerWidth,height:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}:b.getBoundingClientRect()},__getOffscreenArea:function(b,c,e){return Math.abs(Math.min(0,b.top)+Math.min(0,e.bottom-(b.top+c.height)))*c.width+Math.abs(Math.min(0,b.left)+Math.min(0,e.right-(b.left+c.width)))*c.height},__getPosition:function(b,c, e,g,k,q){var l=[{verticalAlign:"top",horizontalAlign:"left",top:k.top+this.verticalOffset,left:k.left+this.horizontalOffset},{verticalAlign:"top",horizontalAlign:"right",top:k.top+this.verticalOffset,left:k.right-e.width-this.horizontalOffset},{verticalAlign:"bottom",horizontalAlign:"left",top:k.bottom-e.height-this.verticalOffset,left:k.left+this.horizontalOffset},{verticalAlign:"bottom",horizontalAlign:"right",top:k.bottom-e.height-this.verticalOffset,left:k.right-e.width-this.horizontalOffset}]; if(this.noOverlap){for(var m=0,p=l.length;m<p;m++){var n={},t;for(t in l[m])n[t]=l[m][t];l.push(n)}l[0].top=l[1].top+=k.height;l[2].top=l[3].top-=k.height;l[4].left=l[6].left+=k.width;l[5].left=l[7].left-=k.width}c="auto"===c?null:c;b="auto"===b?null:b;b&&"center"!==b||(l.push({verticalAlign:"top",horizontalAlign:"center",top:k.top+this.verticalOffset+(this.noOverlap?k.height:0),left:k.left-g.width/2+k.width/2+this.horizontalOffset}),l.push({verticalAlign:"bottom",horizontalAlign:"center",top:k.bottom- e.height-this.verticalOffset-(this.noOverlap?k.height:0),left:k.left-g.width/2+k.width/2+this.horizontalOffset}));c&&"middle"!==c||(l.push({verticalAlign:"middle",horizontalAlign:"left",top:k.top-g.height/2+k.height/2+this.verticalOffset,left:k.left+this.horizontalOffset+(this.noOverlap?k.width:0)}),l.push({verticalAlign:"middle",horizontalAlign:"right",top:k.top-g.height/2+k.height/2+this.verticalOffset,left:k.right-e.width-this.horizontalOffset-(this.noOverlap?k.width:0)}));"middle"===c&&"center"=== b&&l.push({verticalAlign:"middle",horizontalAlign:"center",top:k.top-g.height/2+k.height/2+this.verticalOffset,left:k.left-g.width/2+k.width/2+this.horizontalOffset});for(m=0;m<l.length;m++){g=l[m];k=g.verticalAlign===c;p=g.horizontalAlign===b;if(!this.dynamicAlign&&!this.noOverlap&&k&&p){var v=g;break}n=(!c||k)&&(!b||p);if(this.dynamicAlign||n){g.offscreenArea=this.__getOffscreenArea(g,e,q);if(0===g.offscreenArea&&n){v=g;break}v=v||g;n=g.offscreenArea-v.offscreenArea;if(0>n||0===n&&(k||p))v=g}}return v}}; //# sourceURL=build://iron-overlay-behavior/iron-overlay-backdrop.html.js (function(){Polymer({is:"iron-overlay-backdrop",properties:{opened:{reflectToAttribute:!0,type:Boolean,value:!1,observer:"_openedChanged"}},listeners:{transitionend:"_onTransitionend"},created:function(){this.__openedRaf=null},attached:function(){this.opened&&this._openedChanged(this.opened)},prepare:function(){this.opened&&!this.parentNode&&Polymer.dom(document.body).appendChild(this)},open:function(){this.opened=!0},close:function(){this.opened=!1},complete:function(){this.opened||this.parentNode!== document.body||Polymer.dom(this.parentNode).removeChild(this)},_onTransitionend:function(b){b&&b.target===this&&this.complete()},_openedChanged:function(b){b?this.prepare():(b=window.getComputedStyle(this),"0s"!==b.transitionDuration&&0!=b.opacity||this.complete());this.isAttached&&(this.__openedRaf&&(window.cancelAnimationFrame(this.__openedRaf),this.__openedRaf=null),this.scrollTop=this.scrollTop,this.__openedRaf=window.requestAnimationFrame(function(){this.__openedRaf=null;this.toggleClass("opened", this.opened)}.bind(this)))}})})(); //# sourceURL=build://iron-overlay-behavior/iron-overlay-manager.html.js Polymer.IronOverlayManagerClass=function(){this._overlays=[];this._minimumZ=101;this._backdropElement=null;Polymer.Gestures.add(document.documentElement,"tap",function(){});document.addEventListener("tap",this._onCaptureClick.bind(this),!0);document.addEventListener("focus",this._onCaptureFocus.bind(this),!0);document.addEventListener("keydown",this._onCaptureKeyDown.bind(this),!0)}; Polymer.IronOverlayManagerClass.prototype={constructor:Polymer.IronOverlayManagerClass,get backdropElement(){this._backdropElement||(this._backdropElement=document.createElement("iron-overlay-backdrop"));return this._backdropElement},get deepActiveElement(){var b=document.activeElement;b&&!1!==b instanceof Element||(b=document.body);for(;b.root&&Polymer.dom(b.root).activeElement;)b=Polymer.dom(b.root).activeElement;return b},_bringOverlayAtIndexToFront:function(b){var c=this._overlays[b];if(c){var e= this._overlays.length-1,g=this._overlays[e];g&&this._shouldBeBehindOverlay(c,g)&&e--;if(!(b>=e)){g=Math.max(this.currentOverlayZ(),this._minimumZ);for(this._getZ(c)<=g&&this._applyOverlayZ(c,g);b<e;)this._overlays[b]=this._overlays[b+1],b++;this._overlays[e]=c}}},addOrRemoveOverlay:function(b){b.opened?this.addOverlay(b):this.removeOverlay(b)},addOverlay:function(b){var c=this._overlays.indexOf(b);if(0<=c)this._bringOverlayAtIndexToFront(c);else{c=this._overlays.length;var e=this._overlays[c-1],g= Math.max(this._getZ(e),this._minimumZ),k=this._getZ(b);e&&this._shouldBeBehindOverlay(b,e)&&(this._applyOverlayZ(e,g),c--,g=Math.max(this._getZ(this._overlays[c-1]),this._minimumZ));k<=g&&this._applyOverlayZ(b,g);this._overlays.splice(c,0,b)}this.trackBackdrop()},removeOverlay:function(b){b=this._overlays.indexOf(b);-1!==b&&(this._overlays.splice(b,1),this.trackBackdrop())},currentOverlay:function(){return this._overlays[this._overlays.length-1]},currentOverlayZ:function(){return this._getZ(this.currentOverlay())}, ensureMinimumZ:function(b){this._minimumZ=Math.max(this._minimumZ,b)},focusOverlay:function(){var b=this.currentOverlay();b&&b._applyFocus()},trackBackdrop:function(){var b=this._overlayWithBackdrop();if(b||this._backdropElement)this.backdropElement.style.zIndex=this._getZ(b)-1,this.backdropElement.opened=!!b,this.backdropElement.prepare()},getBackdrops:function(){for(var b=[],c=0;c<this._overlays.length;c++)this._overlays[c].withBackdrop&&b.push(this._overlays[c]);return b},backdropZ:function(){return this._getZ(this._overlayWithBackdrop())- 1},_overlayWithBackdrop:function(){for(var b=this._overlays.length-1;0<=b;b--)if(this._overlays[b].withBackdrop)return this._overlays[b]},_getZ:function(b){var c=this._minimumZ;b&&(b=Number(b.style.zIndex||window.getComputedStyle(b).zIndex),b===b&&(c=b));return c},_setZ:function(b,c){b.style.zIndex=c},_applyOverlayZ:function(b,c){this._setZ(b,c+2)},_overlayInPath:function(b){b=b||[];for(var c=0;c<b.length;c++)if(b[c]._manager===this)return b[c]},_onCaptureClick:function(b){var c=this._overlays.length- 1;if(-1!==c)for(var e=Polymer.dom(b).path,g;(g=this._overlays[c])&&this._overlayInPath(e)!==g;)if(g._onCaptureClick(b),g.allowClickThrough)c--;else break},_onCaptureFocus:function(b){var c=this.currentOverlay();c&&c._onCaptureFocus(b)},_onCaptureKeyDown:function(b){var c=this.currentOverlay();c&&(Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(b,"esc")?c._onCaptureEsc(b):Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(b,"tab")&&c._onCaptureTab(b))},_shouldBeBehindOverlay:function(b,c){return!b.alwaysOnTop&& c.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOverlayManagerClass; //# sourceURL=build://iron-overlay-behavior/iron-scroll-manager.html.js (function(){var b=0,c=0,e=null,g=[],k=["wheel","mousewheel","DOMMouseScroll","touchstart","touchmove"];Polymer.IronScrollManager={get currentLockingElement(){return this._lockingElements[this._lockingElements.length-1]},elementIsScrollLocked:function(q){var l=this.currentLockingElement;if(void 0===l)return!1;if(this._hasCachedLockedElement(q))return!0;if(this._hasCachedUnlockedElement(q))return!1;(l=!!l&&l!==q&&!this._composedTreeContains(l,q))?this._lockedElementCache.push(q):this._unlockedElementCache.push(q); return l},pushScrollLock:function(q){0<=this._lockingElements.indexOf(q)||(0===this._lockingElements.length&&this._lockScrollInteractions(),this._lockingElements.push(q),this._lockedElementCache=[],this._unlockedElementCache=[])},removeScrollLock:function(q){q=this._lockingElements.indexOf(q);-1!==q&&(this._lockingElements.splice(q,1),this._lockedElementCache=[],this._unlockedElementCache=[],0===this._lockingElements.length&&this._unlockScrollInteractions())},_lockingElements:[],_lockedElementCache:null, _unlockedElementCache:null,_hasCachedLockedElement:function(q){return-1<this._lockedElementCache.indexOf(q)},_hasCachedUnlockedElement:function(q){return-1<this._unlockedElementCache.indexOf(q)},_composedTreeContains:function(q,l){var m,p;if(q.contains(l))return!0;q=Polymer.dom(q).querySelectorAll("content,slot");for(m=0;m<q.length;++m){var n=Polymer.dom(q[m]).getDistributedNodes();for(p=0;p<n.length;++p)if(n[p].nodeType===Node.ELEMENT_NODE&&this._composedTreeContains(n[p],l))return!0}return!1},_scrollInteractionHandler:function(q){q.cancelable&& this._shouldPreventScrolling(q)&&q.preventDefault();q.targetTouches&&(q=q.targetTouches[0],b=q.pageX,c=q.pageY)},_lockScrollInteractions:function(){this._boundScrollHandler=this._boundScrollHandler||this._scrollInteractionHandler.bind(this);for(var q=0,l=k.length;q<l;q++)document.addEventListener(k[q],this._boundScrollHandler,{capture:!0,passive:!1})},_unlockScrollInteractions:function(){for(var q=0,l=k.length;q<l;q++)document.removeEventListener(k[q],this._boundScrollHandler,{capture:!0,passive:!1})}, _shouldPreventScrolling:function(q){var l=Polymer.dom(q).rootTarget;"touchmove"!==q.type&&e!==l&&(e=l,g=this._getScrollableNodes(Polymer.dom(q).path));if(!g.length)return!0;if("touchstart"===q.type)return!1;q=this._getScrollInfo(q);return!this._getScrollingNode(g,q.deltaX,q.deltaY)},_getScrollableNodes:function(q){for(var l=[],m=q.indexOf(this.currentLockingElement),p=0;p<=m;p++)if(q[p].nodeType===Node.ELEMENT_NODE){var n=q[p],t=n.style;"scroll"!==t.overflow&&"auto"!==t.overflow&&(t=window.getComputedStyle(n)); "scroll"!==t.overflow&&"auto"!==t.overflow||l.push(n)}return l},_getScrollingNode:function(q,l,m){if(l||m)for(var p=Math.abs(m)>=Math.abs(l),n=0;n<q.length;n++){var t=q[n];if(p?0>m?0<t.scrollTop:t.scrollTop<t.scrollHeight-t.clientHeight:0>l?0<t.scrollLeft:t.scrollLeft<t.scrollWidth-t.clientWidth)return t}},_getScrollInfo:function(q){var l={deltaX:q.deltaX,deltaY:q.deltaY};"deltaX"in q||("wheelDeltaX"in q&&"wheelDeltaY"in q?(l.deltaX=-q.wheelDeltaX,l.deltaY=-q.wheelDeltaY):"wheelDelta"in q?(l.deltaX= 0,l.deltaY=-q.wheelDelta):"axis"in q?(l.deltaX=1===q.axis?q.detail:0,l.deltaY=2===q.axis?q.detail:0):q.targetTouches&&(q=q.targetTouches[0],l.deltaX=b-q.pageX,l.deltaY=c-q.pageY));return l}}})(); //# sourceURL=build://iron-overlay-behavior/iron-focusables-helper.html.js (function(){var b=Element.prototype,c=b.matches||b.matchesSelector||b.mozMatchesSelector||b.msMatchesSelector||b.oMatchesSelector||b.webkitMatchesSelector;Polymer.IronFocusablesHelper={getTabbableNodes:function(e){var g=[];return this._collectTabbableNodes(e,g)?this._sortByTabIndex(g):g},isFocusable:function(e){return c.call(e,"input, select, textarea, button, object")?c.call(e,":not([disabled])"):c.call(e,"a[href], area[href], iframe, [tabindex], [contentEditable]")},isTabbable:function(e){return this.isFocusable(e)&& c.call(e,':not([tabindex\x3d"-1"])')&&this._isVisible(e)},_normalizedTabIndex:function(e){return this.isFocusable(e)?(e=e.getAttribute("tabindex")||0,Number(e)):-1},_collectTabbableNodes:function(e,g){if(e.nodeType!==Node.ELEMENT_NODE||!this._isVisible(e))return!1;var k=this._normalizedTabIndex(e),q=0<k;0<=k&&g.push(e);e="content"===e.localName||"slot"===e.localName?Polymer.dom(e).getDistributedNodes():Polymer.dom(e.root||e).children;for(k=0;k<e.length;k++)q=this._collectTabbableNodes(e[k],g)||q; return q},_isVisible:function(e){var g=e.style;return"hidden"!==g.visibility&&"none"!==g.display?(g=window.getComputedStyle(e),"hidden"!==g.visibility&&"none"!==g.display):!1},_sortByTabIndex:function(e){var g=e.length;if(2>g)return e;var k=Math.ceil(g/2);g=this._sortByTabIndex(e.slice(0,k));e=this._sortByTabIndex(e.slice(k));return this._mergeSortByTabIndex(g,e)},_mergeSortByTabIndex:function(e,g){for(var k=[];0<e.length&&0<g.length;)this._hasLowerTabOrder(e[0],g[0])?k.push(g.shift()):k.push(e.shift()); return k.concat(e,g)},_hasLowerTabOrder:function(e,g){e=Math.max(e.tabIndex,0);g=Math.max(g.tabIndex,0);return 0===e||0===g?g>e:e>g}}})(); //# sourceURL=build://iron-overlay-behavior/iron-overlay-behavior.html.js (function(){Polymer.IronOverlayBehaviorImpl={properties:{opened:{observer:"_openedChanged",type:Boolean,value:!1,notify:!0},canceled:{observer:"_canceledChanged",readOnly:!0,type:Boolean,value:!1},withBackdrop:{observer:"_withBackdropChanged",type:Boolean},noAutoFocus:{type:Boolean,value:!1},noCancelOnEscKey:{type:Boolean,value:!1},noCancelOnOutsideClick:{type:Boolean,value:!1},closingReason:{type:Object},restoreFocusOnClose:{type:Boolean,value:!1},allowClickThrough:{type:Boolean},alwaysOnTop:{type:Boolean}, scrollAction:{type:String},_manager:{type:Object,value:Polymer.IronOverlayManager},_focusedChild:{type:Object}},listeners:{"iron-resize":"_onIronResize"},observers:["__updateScrollObservers(isAttached, opened, scrollAction)"],get backdropElement(){return this._manager.backdropElement},get _focusNode(){return this._focusedChild||Polymer.dom(this).querySelector("[autofocus]")||this},get _focusableNodes(){return Polymer.IronFocusablesHelper.getTabbableNodes(this)},ready:function(){this.__shouldRemoveTabIndex= this.__isAnimating=!1;this.__firstFocusableNode=this.__lastFocusableNode=null;this.__rafs={};this.__scrollTop=this.__scrollLeft=this.__restoreFocusNode=null;this.__onCaptureScroll=this.__onCaptureScroll.bind(this);this.__rootNodes=null;this._ensureSetup()},attached:function(){this.opened&&this._openedChanged(this.opened);this._observer=Polymer.dom(this).observeNodes(this._onNodesChange)},detached:function(){Polymer.dom(this).unobserveNodes(this._observer);this._observer=null;for(var b in this.__rafs)null!== this.__rafs[b]&&cancelAnimationFrame(this.__rafs[b]);this.__rafs={};this._manager.removeOverlay(this);this.__isAnimating&&(this.opened?this._finishRenderOpened():(this._applyFocus(),this._finishRenderClosed()))},toggle:function(){this._setCanceled(!1);this.opened=!this.opened},open:function(){this._setCanceled(!1);this.opened=!0},close:function(){this._setCanceled(!1);this.opened=!1},cancel:function(b){this.fire("iron-overlay-canceled",b,{cancelable:!0}).defaultPrevented||(this._setCanceled(!0),this.opened= !1)},invalidateTabbables:function(){this.__firstFocusableNode=this.__lastFocusableNode=null},_ensureSetup:function(){this._overlaySetup||(this._overlaySetup=!0,this.style.outline="none",this.style.display="none")},_openedChanged:function(b){b?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true");this.isAttached&&(this.__isAnimating=!0,this.__deraf("__openedChanged",this.__openedChanged))},_canceledChanged:function(){this.closingReason=this.closingReason||{};this.closingReason.canceled= this.canceled},_withBackdropChanged:function(){this.withBackdrop&&!this.hasAttribute("tabindex")?(this.setAttribute("tabindex","-1"),this.__shouldRemoveTabIndex=!0):this.__shouldRemoveTabIndex&&(this.removeAttribute("tabindex"),this.__shouldRemoveTabIndex=!1);this.opened&&this.isAttached&&this._manager.trackBackdrop()},_prepareRenderOpened:function(){this.__restoreFocusNode=this._manager.deepActiveElement;this._preparePositioning();this.refit();this._finishPositioning();this.noAutoFocus&&document.activeElement=== this._focusNode&&(this._focusNode.blur(),this.__restoreFocusNode.focus())},_renderOpened:function(){this._finishRenderOpened()},_renderClosed:function(){this._finishRenderClosed()},_finishRenderOpened:function(){this.notifyResize();this.__isAnimating=!1;this.fire("iron-overlay-opened")},_finishRenderClosed:function(){this.style.display="none";this.style.zIndex="";this.notifyResize();this.__isAnimating=!1;this.fire("iron-overlay-closed",this.closingReason)},_preparePositioning:function(){this.style.transition= this.style.webkitTransition="none";this.style.transform=this.style.webkitTransform="none";this.style.display=""},_finishPositioning:function(){this.style.display="none";this.scrollTop=this.scrollTop;this.style.transition=this.style.webkitTransition="";this.style.transform=this.style.webkitTransform="";this.style.display="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(this.opened)this.noAutoFocus||this._focusNode.focus();else{this._focusNode.blur();this._focusedChild=null;if(this.restoreFocusOnClose&& this.__restoreFocusNode){var b=this._manager.deepActiveElement;(b===document.body||Polymer.dom(this).deepContains(b))&&this.__restoreFocusNode.focus()}this.__restoreFocusNode=null;(b=this._manager.currentOverlay())&&this!==b&&b._applyFocus()}},_onCaptureClick:function(b){this.noCancelOnOutsideClick||this.cancel(b)},_onCaptureFocus:function(b){if(this.withBackdrop){var c=Polymer.dom(b).path;-1===c.indexOf(this)?(b.stopPropagation(),this._applyFocus()):this._focusedChild=c[0]}},_onCaptureEsc:function(b){this.noCancelOnEscKey|| this.cancel(b)},_onCaptureTab:function(b){if(this.withBackdrop){this.__ensureFirstLastFocusables();var c=b.shiftKey,e=c?this.__firstFocusableNode:this.__lastFocusableNode;c=c?this.__lastFocusableNode:this.__firstFocusableNode;if(e===c)e=!0;else{var g=this._manager.deepActiveElement;e=g===e||g===this}e&&(b.preventDefault(),this._focusedChild=c,this._applyFocus())}},_onIronResize:function(){this.opened&&!this.__isAnimating&&this.__deraf("refit",this.refit)},_onNodesChange:function(){this.opened&&!this.__isAnimating&& (this.invalidateTabbables(),this.notifyResize())},__ensureFirstLastFocusables:function(){if(!this.__firstFocusableNode||!this.__lastFocusableNode){var b=this._focusableNodes;this.__firstFocusableNode=b[0];this.__lastFocusableNode=b[b.length-1]}},__openedChanged:function(){this.opened?(this._prepareRenderOpened(),this._manager.addOverlay(this),this._applyFocus(),this._renderOpened()):(this._manager.removeOverlay(this),this._applyFocus(),this._renderClosed())},__deraf:function(b,c){var e=this.__rafs; null!==e[b]&&cancelAnimationFrame(e[b]);e[b]=requestAnimationFrame(function(){e[b]=null;c.call(this)}.bind(this))},__updateScrollObservers:function(b,c,e){b&&c&&this.__isValidScrollAction(e)?("lock"===e&&(this.__saveScrollPosition(),Polymer.IronScrollManager.pushScrollLock(this)),this.__addScrollListeners()):(Polymer.IronScrollManager.removeScrollLock(this),this.__removeScrollListeners())},__addScrollListeners:function(){if(!this.__rootNodes){this.__rootNodes=[];if(Polymer.Settings.useShadow)for(var b= this;b;)b.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&b.host&&this.__rootNodes.push(b),b=b.host||b.assignedSlot||b.parentNode;this.__rootNodes.push(document)}this.__rootNodes.forEach(function(c){c.addEventListener("scroll",this.__onCaptureScroll,{capture:!0,passive:!0})},this)},__removeScrollListeners:function(){this.__rootNodes&&this.__rootNodes.forEach(function(b){b.removeEventListener("scroll",this.__onCaptureScroll,{capture:!0,passive:!0})},this);this.isAttached||(this.__rootNodes=null)},__isValidScrollAction:function(b){return"lock"=== b||"refit"===b||"cancel"===b},__onCaptureScroll:function(b){if(!(this.__isAnimating||0<=Polymer.dom(b).path.indexOf(this)))switch(this.scrollAction){case "lock":this.__restoreScrollPosition();break;case "refit":this.__deraf("refit",this.refit);break;case "cancel":this.cancel(b)}},__saveScrollPosition:function(){document.scrollingElement?(this.__scrollTop=document.scrollingElement.scrollTop,this.__scrollLeft=document.scrollingElement.scrollLeft):(this.__scrollTop=Math.max(document.documentElement.scrollTop, document.body.scrollTop),this.__scrollLeft=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft))},__restoreScrollPosition:function(){document.scrollingElement?(document.scrollingElement.scrollTop=this.__scrollTop,document.scrollingElement.scrollLeft=this.__scrollLeft):(document.documentElement.scrollTop=document.body.scrollTop=this.__scrollTop,document.documentElement.scrollLeft=document.body.scrollLeft=this.__scrollLeft)}};Polymer.IronOverlayBehavior=[Polymer.IronFitBehavior,Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl]})(); //# sourceURL=build://paper-dialog-behavior/paper-dialog-behavior.html.js (function(){Polymer.PaperDialogBehaviorImpl={hostAttributes:{role:"dialog",tabindex:"-1"},properties:{modal:{type:Boolean,value:!1},__readied:{type:Boolean,value:!1}},observers:["_modalChanged(modal, __readied)"],listeners:{tap:"_onDialogClick"},ready:function(){this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick;this.__prevNoCancelOnEscKey=this.noCancelOnEscKey;this.__prevWithBackdrop=this.withBackdrop;this.__readied=!0},_modalChanged:function(b,c){c&&(b?(this.__prevNoCancelOnOutsideClick= this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.withBackdrop=this.noCancelOnEscKey=this.noCancelOnOutsideClick=!0):(this.noCancelOnOutsideClick=this.noCancelOnOutsideClick&&this.__prevNoCancelOnOutsideClick,this.noCancelOnEscKey=this.noCancelOnEscKey&&this.__prevNoCancelOnEscKey,this.withBackdrop=this.withBackdrop&&this.__prevWithBackdrop))},_updateClosingReasonConfirmed:function(b){this.closingReason=this.closingReason|| {};this.closingReason.confirmed=b},_onDialogClick:function(b){for(var c=Polymer.dom(b).path,e=0,g=c.indexOf(this);e<g;e++){var k=c[e];if(k.hasAttribute&&(k.hasAttribute("dialog-dismiss")||k.hasAttribute("dialog-confirm"))){this._updateClosingReasonConfirmed(k.hasAttribute("dialog-confirm"));this.close();b.stopPropagation();break}}}};Polymer.PaperDialogBehavior=[Polymer.IronOverlayBehavior,Polymer.PaperDialogBehaviorImpl]})(); //# sourceURL=build://paper-dialog/paper-dialog.html.js Polymer({is:"paper-dialog",behaviors:[Polymer.PaperDialogBehavior,Polymer.NeonAnimationRunnerBehavior],listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},_renderOpened:function(){this.cancelAnimation();this.playAnimation("entry")},_renderClosed:function(){this.cancelAnimation();this.playAnimation("exit")},_onNeonAnimationFinish:function(){this.opened?this._finishRenderOpened():this._finishRenderClosed()}}); //# sourceURL=build://iron-validatable-behavior/iron-validatable-behavior.html.js Polymer.IronValidatableBehaviorMeta=null; Polymer.IronValidatableBehavior={properties:{validator:{type:String},invalid:{notify:!0,reflectToAttribute:!0,type:Boolean,value:!1,observer:"_invalidChanged"}},registered:function(){Polymer.IronValidatableBehaviorMeta=new Polymer.IronMeta({type:"validator"})},_invalidChanged:function(){this.invalid?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid")},get _validator(){return Polymer.IronValidatableBehaviorMeta&&Polymer.IronValidatableBehaviorMeta.byKey(this.validator)},hasValidator:function(){return null!= this._validator},validate:function(b){this.invalid=void 0===b&&void 0!==this.value?!this._getValidity(this.value):!this._getValidity(b);return!this.invalid},_getValidity:function(b){return this.hasValidator()?this._validator.validate(b):!0}}; //# sourceURL=build://iron-form-element-behavior/iron-form-element-behavior.html.js Polymer.IronFormElementBehavior={properties:{name:{type:String},value:{notify:!0,type:String},required:{type:Boolean,value:!1},_parentForm:{type:Object}},attached:function(){Polymer.Element||this.fire("iron-form-element-register")},detached:function(){!Polymer.Element&&this._parentForm&&this._parentForm.fire("iron-form-element-unregister",{target:this})}}; //# sourceURL=build://iron-checked-element-behavior/iron-checked-element-behavior.html.js Polymer.IronCheckedElementBehaviorImpl={properties:{checked:{type:Boolean,value:!1,reflectToAttribute:!0,notify:!0,observer:"_checkedChanged"},toggles:{type:Boolean,value:!0,reflectToAttribute:!0},value:{type:String,value:"on",observer:"_valueChanged"}},observers:["_requiredChanged(required)"],created:function(){this._hasIronCheckedElementBehavior=!0},_getValidity:function(){return this.disabled||!this.required||this.checked},_requiredChanged:function(){this.required?this.setAttribute("aria-required", "true"):this.removeAttribute("aria-required")},_checkedChanged:function(){this.active=this.checked;this.fire("iron-change")},_valueChanged:function(){if(void 0===this.value||null===this.value)this.value="on"}};Polymer.IronCheckedElementBehavior=[Polymer.IronFormElementBehavior,Polymer.IronValidatableBehavior,Polymer.IronCheckedElementBehaviorImpl]; //# sourceURL=build://paper-behaviors/paper-inky-focus-behavior.html.js Polymer.PaperInkyFocusBehaviorImpl={observers:["_focusedChanged(receivedFocusFromKeyboard)"],_focusedChanged:function(b){b&&this.ensureRipple();this.hasRipple()&&(this._ripple.holdDown=b)},_createRipple:function(){var b=Polymer.PaperRippleBehavior._createRipple();b.id="ink";b.setAttribute("center","");b.classList.add("circle");return b}};Polymer.PaperInkyFocusBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperInkyFocusBehaviorImpl]; //# sourceURL=build://paper-behaviors/paper-checked-element-behavior.html.js Polymer.PaperCheckedElementBehaviorImpl={_checkedChanged:function(){Polymer.IronCheckedElementBehaviorImpl._checkedChanged.call(this);this.hasRipple()&&(this.checked?this._ripple.setAttribute("checked",""):this._ripple.removeAttribute("checked"))},_buttonStateChanged:function(){Polymer.PaperRippleBehavior._buttonStateChanged.call(this);!this.disabled&&this.isAttached&&(this.checked=this.active)}}; Polymer.PaperCheckedElementBehavior=[Polymer.PaperInkyFocusBehavior,Polymer.IronCheckedElementBehavior,Polymer.PaperCheckedElementBehaviorImpl]; //# sourceURL=build://paper-toggle-button/paper-toggle-button.html.js Polymer({is:"paper-toggle-button",behaviors:[Polymer.PaperCheckedElementBehavior],hostAttributes:{role:"button","aria-pressed":"false",tabindex:0},properties:{},listeners:{track:"_ontrack"},attached:function(){Polymer.RenderStatus.afterNextRender(this,function(){Polymer.Gestures.setTouchAction(this,"pan-y")})},_ontrack:function(b){b=b.detail;"start"===b.state?this._trackStart(b):"track"===b.state?this._trackMove(b):"end"===b.state&&this._trackEnd(b)},_trackStart:function(){this._width=this.$.toggleBar.offsetWidth/ 2;this._trackChecked=this.checked;this.$.toggleButton.classList.add("dragging")},_trackMove:function(b){b=b.dx;this._x=Math.min(this._width,Math.max(0,this._trackChecked?this._width+b:b));this.translate3d(this._x+"px",0,0,this.$.toggleButton);this._userActivate(this._x>this._width/2)},_trackEnd:function(){this.$.toggleButton.classList.remove("dragging");this.transform("",this.$.toggleButton)},_createRipple:function(){this._rippleContainer=this.$.toggleButton;var b=Polymer.PaperRippleBehavior._createRipple(); b.id="ink";b.setAttribute("recenters","");b.classList.add("circle","toggle-ink");return b}}); //# sourceURL=build://iron-a11y-announcer/iron-a11y-announcer.html.js (function(){Polymer.IronA11yAnnouncer=function(){};Polymer.IronA11yAnnouncer=Polymer({is:"iron-a11y-announcer",properties:{mode:{type:String,value:"polite"},_text:{type:String,value:""}},created:function(){Polymer.IronA11yAnnouncer.instance||(Polymer.IronA11yAnnouncer.instance=this);document.body.addEventListener("iron-announce",this._onIronAnnounce.bind(this))},announce:function(b){this._text="";this.async(function(){this._text=b},100)},_onIronAnnounce:function(b){b.detail&&b.detail.text&&this.announce(b.detail.text)}}); Polymer.IronA11yAnnouncer.instance=null;Polymer.IronA11yAnnouncer.requestAvailability=function(){Polymer.IronA11yAnnouncer.instance||(Polymer.IronA11yAnnouncer.instance=document.createElement("iron-a11y-announcer"));document.body.appendChild(Polymer.IronA11yAnnouncer.instance)}})(); //# sourceURL=build://iron-input/iron-input.html.js Polymer({is:"iron-input",behaviors:[Polymer.IronValidatableBehavior],properties:{bindValue:{type:String,value:""},value:{type:String,computed:"_computeValue(bindValue)"},allowedPattern:{type:String},autoValidate:{type:Boolean,value:!1},_inputElement:Object},observers:["_bindValueChanged(bindValue, _inputElement)"],listeners:{input:"_onInput",keypress:"_onKeypress"},created:function(){Polymer.IronA11yAnnouncer.requestAvailability();this._previousValidInput="";this._patternAlreadyChecked=!1},attached:function(){this._observer= Polymer.dom(this).observeNodes(function(){this._initSlottedInput()}.bind(this))},detached:function(){this._observer&&(Polymer.dom(this).unobserveNodes(this._observer),this._observer=null)},get inputElement(){return this._inputElement},_initSlottedInput:function(){this._inputElement=this.getEffectiveChildren()[0];this.inputElement&&this.inputElement.value&&(this.bindValue=this.inputElement.value);this.fire("iron-input-ready")},get _patternRegExp(){if(this.allowedPattern)var b=new RegExp(this.allowedPattern); else switch(this.inputElement.type){case "number":b=/[0-9.,e-]/}return b},_bindValueChanged:function(b,c){c&&(void 0===b?c.value=null:b!==c.value&&(this.inputElement.value=b),this.autoValidate&&this.validate(),this.fire("bind-value-changed",{value:b}))},_onInput:function(){!this.allowedPattern||this._patternAlreadyChecked||this._checkPatternValidity()||(this._announceInvalidCharacter("Invalid string of characters not entered."),this.inputElement.value=this._previousValidInput);this.bindValue=this._previousValidInput= this.inputElement.value;this._patternAlreadyChecked=!1},_isPrintable:function(b){var c=19==b.keyCode||20==b.keyCode||45==b.keyCode||46==b.keyCode||144==b.keyCode||145==b.keyCode||32<b.keyCode&&41>b.keyCode||111<b.keyCode&&124>b.keyCode;return!(8==b.keyCode||9==b.keyCode||13==b.keyCode||27==b.keyCode)&&!(0==b.charCode&&c)},_onKeypress:function(b){if(this.allowedPattern||"number"===this.inputElement.type){var c=this._patternRegExp;if(c&&!(b.metaKey||b.ctrlKey||b.altKey)){this._patternAlreadyChecked= !0;var e=String.fromCharCode(b.charCode);this._isPrintable(b)&&!c.test(e)&&(b.preventDefault(),this._announceInvalidCharacter("Invalid character "+e+" not entered."))}}},_checkPatternValidity:function(){var b=this._patternRegExp;if(!b)return!0;for(var c=0;c<this.inputElement.value.length;c++)if(!b.test(this.inputElement.value[c]))return!1;return!0},validate:function(){if(!this.inputElement)return this.invalid=!1,!0;var b=this.inputElement.checkValidity();b&&(this.required&&""===this.bindValue?b=!1: this.hasValidator()&&(b=Polymer.IronValidatableBehavior.validate.call(this,this.bindValue)));this.invalid=!b;this.fire("iron-input-validate");return b},_announceInvalidCharacter:function(b){this.fire("iron-announce",{text:b})},_computeValue:function(b){return b}}); //# sourceURL=build://paper-input/paper-input-behavior.html.js Polymer.PaperInputHelper={};Polymer.PaperInputHelper.NextLabelID=1;Polymer.PaperInputHelper.NextAddonID=1;Polymer.PaperInputHelper.NextInputID=1; Polymer.PaperInputBehaviorImpl={properties:{label:{type:String},value:{notify:!0,type:String},disabled:{type:Boolean,value:!1},invalid:{type:Boolean,value:!1,notify:!0},allowedPattern:{type:String},type:{type:String},list:{type:String},pattern:{type:String},required:{type:Boolean,value:!1},errorMessage:{type:String},charCounter:{type:Boolean,value:!1},noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},autoValidate:{type:Boolean,value:!1},validator:{type:String},autocomplete:{type:String, value:"off"},autofocus:{type:Boolean,observer:"_autofocusChanged"},inputmode:{type:String},minlength:{type:Number},maxlength:{type:Number},min:{type:String},max:{type:String},step:{type:String},name:{type:String},placeholder:{type:String,value:""},readonly:{type:Boolean,value:!1},size:{type:Number},autocapitalize:{type:String,value:"none"},autocorrect:{type:String,value:"off"},autosave:{type:String},results:{type:Number},accept:{type:String},multiple:{type:Boolean},_ariaDescribedBy:{type:String,value:""}, _ariaLabelledBy:{type:String,value:""},_inputId:{type:String,value:""}},listeners:{"addon-attached":"_onAddonAttached"},keyBindings:{"shift+tab:keydown":"_onShiftTabDown"},hostAttributes:{tabindex:0},get inputElement(){this.$||(this.$={});this.$.input||(this._generateInputId(),this.$.input=this.$$("#"+this._inputId));return this.$.input},get _focusableElement(){return this.inputElement},created:function(){this._typesThatHaveText="date datetime datetime-local month time week file".split(" ")},attached:function(){this._updateAriaLabelledBy(); !Polymer.Element&&this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.inputElement.type)&&(this.alwaysFloatLabel=!0)},_appendStringWithSpace:function(b,c){return b?b+" "+c:c},_onAddonAttached:function(b){b=Polymer.dom(b).rootTarget;if(b.id)this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,b.id);else{var c="paper-input-add-on-"+Polymer.PaperInputHelper.NextAddonID++;b.id=c;this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,c)}},validate:function(){return this.inputElement.validate()}, _focusBlurHandler:function(b){Polymer.IronControlState._focusBlurHandler.call(this,b);this.focused&&!this._shiftTabPressed&&this._focusableElement&&this._focusableElement.focus()},_onShiftTabDown:function(){var b=this.getAttribute("tabindex");this._shiftTabPressed=!0;this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute("tabindex",b);this._shiftTabPressed=!1},1)},_handleAutoValidate:function(){this.autoValidate&&this.validate()},updateValueAndPreserveCaret:function(b){try{var c= this.inputElement.selectionStart;this.value=b;this.inputElement.selectionStart=c;this.inputElement.selectionEnd=c}catch(e){this.value=b}},_computeAlwaysFloatLabel:function(b,c){return c||b},_updateAriaLabelledBy:function(){var b=Polymer.dom(this.root).querySelector("label");if(b){if(b.id)var c=b.id;else c="paper-input-label-"+Polymer.PaperInputHelper.NextLabelID++,b.id=c;this._ariaLabelledBy=c}else this._ariaLabelledBy=""},_generateInputId:function(){this._inputId&&""!==this._inputId||(this._inputId= "input-"+Polymer.PaperInputHelper.NextInputID++)},_onChange:function(b){this.shadowRoot&&this.fire(b.type,{sourceEvent:b},{node:this,bubbles:b.bubbles,cancelable:b.cancelable})},_autofocusChanged:function(){if(this.autofocus&&this._focusableElement){var b=document.activeElement;b instanceof HTMLElement&&b!==document.body&&b!==document.documentElement||this._focusableElement.focus()}}};Polymer.PaperInputBehavior=[Polymer.IronControlState,Polymer.IronA11yKeysBehavior,Polymer.PaperInputBehaviorImpl]; //# sourceURL=build://paper-input/paper-input-addon-behavior.html.js Polymer.PaperInputAddonBehavior={attached:function(){this.fire("addon-attached")},update:function(){}}; //# sourceURL=build://paper-input/paper-input-char-counter.html.js Polymer({is:"paper-input-char-counter",behaviors:[Polymer.PaperInputAddonBehavior],properties:{_charCounterStr:{type:String,value:"0"}},update:function(b){if(b.inputElement){b.value=b.value||"";var c=b.value.toString().length.toString();b.inputElement.hasAttribute("maxlength")&&(c+="/"+b.inputElement.getAttribute("maxlength"));this._charCounterStr=c}}}); //# sourceURL=build://paper-input/paper-input-container.html.js Polymer({is:"paper-input-container",properties:{noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},attrForValue:{type:String,value:"bind-value"},autoValidate:{type:Boolean,value:!1},invalid:{observer:"_invalidChanged",type:Boolean,value:!1},focused:{readOnly:!0,type:Boolean,value:!1,notify:!0},_addons:{type:Array},_inputHasContent:{type:Boolean,value:!1},_inputSelector:{type:String,value:"input,iron-input,textarea,.paper-input-input"},_boundOnFocus:{type:Function,value:function(){return this._onFocus.bind(this)}}, _boundOnBlur:{type:Function,value:function(){return this._onBlur.bind(this)}},_boundOnInput:{type:Function,value:function(){return this._onInput.bind(this)}},_boundValueChanged:{type:Function,value:function(){return this._onValueChanged.bind(this)}}},listeners:{"addon-attached":"_onAddonAttached","iron-input-validate":"_onIronInputValidate"},get _valueChangedEvent(){return this.attrForValue+"-changed"},get _propertyForValue(){return Polymer.CaseMap.dashToCamelCase(this.attrForValue)},get _inputElement(){return Polymer.dom(this).querySelector(this._inputSelector)}, get _inputElementValue(){return this._inputElement[this._propertyForValue]||this._inputElement.value},ready:function(){this.__isFirstValueUpdate=!0;this._addons||(this._addons=[]);this.addEventListener("focus",this._boundOnFocus,!0);this.addEventListener("blur",this._boundOnBlur,!0)},attached:function(){this.attrForValue?this._inputElement.addEventListener(this._valueChangedEvent,this._boundValueChanged):this.addEventListener("input",this._onInput);this._inputElementValue&&""!=this._inputElementValue? this._handleValueAndAutoValidate(this._inputElement):this._handleValue(this._inputElement)},_onAddonAttached:function(b){this._addons||(this._addons=[]);b=b.target;-1===this._addons.indexOf(b)&&(this._addons.push(b),this.isAttached&&this._handleValue(this._inputElement))},_onFocus:function(){this._setFocused(!0)},_onBlur:function(){this._setFocused(!1);this._handleValueAndAutoValidate(this._inputElement)},_onInput:function(b){this._handleValueAndAutoValidate(b.target)},_onValueChanged:function(b){var c= b.target;if(this.__isFirstValueUpdate&&(this.__isFirstValueUpdate=!1,void 0===c.value||""===c.value))return;this._handleValueAndAutoValidate(b.target)},_handleValue:function(b){var c=this._inputElementValue;c||0===c||"number"===b.type&&!b.checkValidity()?this._inputHasContent=!0:this._inputHasContent=!1;this.updateAddons({inputElement:b,value:c,invalid:this.invalid})},_handleValueAndAutoValidate:function(b){this.autoValidate&&b&&(this.invalid=!(b.validate?b.validate(this._inputElementValue):b.checkValidity())); this._handleValue(b)},_onIronInputValidate:function(){this.invalid=this._inputElement.invalid},_invalidChanged:function(){this._addons&&this.updateAddons({invalid:this.invalid})},updateAddons:function(b){for(var c,e=0;c=this._addons[e];e++)c.update(b)},_computeInputContentClass:function(b,c,e,g,k){var q="input-content";b?(k&&(q+=" label-is-hidden"),g&&(q+=" is-invalid")):(b=this.querySelector("label"),c||k?(q+=" label-is-floating",this.$.labelAndInputContainer.style.position="static",g?q+=" is-invalid": e&&(q+=" label-is-highlighted")):(b&&(this.$.labelAndInputContainer.style.position="relative"),g&&(q+=" is-invalid")));e&&(q+=" focused");return q},_computeUnderlineClass:function(b,c){var e="underline";c?e+=" is-invalid":b&&(e+=" is-highlighted");return e},_computeAddOnContentClass:function(b,c){var e="add-on-content";c?e+=" is-invalid":b&&(e+=" is-highlighted");return e}}); //# sourceURL=build://paper-input/paper-input-error.html.js Polymer({is:"paper-input-error",behaviors:[Polymer.PaperInputAddonBehavior],properties:{invalid:{readOnly:!0,reflectToAttribute:!0,type:Boolean}},update:function(b){this._setInvalid(b.invalid)}}); //# sourceURL=build://paper-input/paper-input.html.js Polymer({is:"paper-input",behaviors:[Polymer.PaperInputBehavior,Polymer.IronFormElementBehavior],properties:{value:{type:String}},beforeRegister:function(){var b="function"==typeof document.createElement("iron-input")._initSlottedInput?"v1":"v0",c=Polymer.DomModule.import("paper-input","template");b=Polymer.DomModule.import("paper-input","template#"+b);(c=c.content.querySelector("#template-placeholder"))&&c.parentNode.replaceChild(b.content,c)},get _focusableElement(){return Polymer.Element?this.inputElement._inputElement: this.inputElement},listeners:{"iron-input-ready":"_onIronInputReady"},_onIronInputReady:function(){this.$.nativeInput||(this.$.nativeInput=this.$$("input"));this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.$.nativeInput.type)&&(this.alwaysFloatLabel=!0);this.inputElement.bindValue&&this.$.container._handleValueAndAutoValidate(this.inputElement)}}); //# sourceURL=build://iron-dropdown/iron-dropdown-scroll-manager.html.js (function(){Polymer.IronDropdownScrollManager=Polymer.IronScrollManager})(); //# sourceURL=build://iron-dropdown/iron-dropdown.html.js (function(){Polymer({is:"iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKeysBehavior,Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],properties:{horizontalAlign:{type:String,value:"left",reflectToAttribute:!0},verticalAlign:{type:String,value:"top",reflectToAttribute:!0},openAnimationConfig:{type:Object},closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnimations:{type:Boolean,value:!1},allowOutsideScroll:{type:Boolean,value:!1,observer:"_allowOutsideScrollChanged"}}, listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},observers:["_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)"],get containedElement(){for(var b=Polymer.dom(this.$.content).getDistributedNodes(),c=0,e=b.length;c<e;c++)if(b[c].nodeType===Node.ELEMENT_NODE)return b[c]},ready:function(){this.scrollAction||(this.scrollAction=this.allowOutsideScroll?"refit":"lock");this._readied=!0},attached:function(){this.sizingTarget&&this.sizingTarget!== this||(this.sizingTarget=this.containedElement||this)},detached:function(){this.cancelAnimation()},_openedChanged:function(){this.opened&&this.disabled?this.cancel():(this.cancelAnimation(),this._updateAnimationConfig(),Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this,arguments))},_renderOpened:function(){!this.noAnimations&&this.animationConfig.open?(this.$.contentWrapper.classList.add("animating"),this.playAnimation("open")):Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,arguments)}, _renderClosed:function(){!this.noAnimations&&this.animationConfig.close?(this.$.contentWrapper.classList.add("animating"),this.playAnimation("close")):Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)},_onNeonAnimationFinish:function(){this.$.contentWrapper.classList.remove("animating");this.opened?this._finishRenderOpened():this._finishRenderClosed()},_updateAnimationConfig:function(){for(var b=this.containedElement,c=[].concat(this.openAnimationConfig||[]).concat(this.closeAnimationConfig|| []),e=0;e<c.length;e++)c[e].node=b;this.animationConfig={open:this.openAnimationConfig,close:this.closeAnimationConfig}},_updateOverlayPosition:function(){this.isAttached&&this.notifyResize()},_allowOutsideScrollChanged:function(b){this._readied&&(b?this.scrollAction&&"lock"!==this.scrollAction||(this.scrollAction="refit"):this.scrollAction="lock")},_applyFocus:function(){var b=this.focusTarget||this.containedElement;b&&this.opened&&!this.noAutoFocus?b.focus():Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this, arguments)}})})(); //# sourceURL=build://neon-animation/neon-animation-behavior.html.js Polymer.NeonAnimationBehavior={properties:{animationTiming:{type:Object,value:function(){return{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeonAnimation:!0,created:function(){document.body.animate||console.warn("No web animations detected. This element will not function without a web animations polyfill.")},timingFromConfig:function(b){if(b.timing)for(var c in b.timing)this.animationTiming[c]=b.timing[c];return this.animationTiming},setPrefixedProperty:function(b,c,e){for(var g= {transform:["webkitTransform"],transformOrigin:["mozTransformOrigin","webkitTransformOrigin"]}[c],k,q=0;k=g[q];q++)b.style[k]=e;b.style[c]=e},complete:function(){}}; //# sourceURL=build://neon-animation/animations/fade-in-animation.html.js Polymer({is:"fade-in-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(b){return this._effect=new KeyframeEffect(b.node,[{opacity:"0"},{opacity:"1"}],this.timingFromConfig(b))}}); //# sourceURL=build://neon-animation/animations/fade-out-animation.html.js Polymer({is:"fade-out-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(b){return this._effect=new KeyframeEffect(b.node,[{opacity:"1"},{opacity:"0"}],this.timingFromConfig(b))}}); //# sourceURL=build://paper-menu-button/paper-menu-button-animations.html.js Polymer({is:"paper-menu-grow-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(b){var c=b.node,e=c.getBoundingClientRect().height;return this._effect=new KeyframeEffect(c,[{height:e/2+"px"},{height:e+"px"}],this.timingFromConfig(b))}});Polymer({is:"paper-menu-grow-width-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(b){var c=b.node,e=c.getBoundingClientRect().width;return this._effect=new KeyframeEffect(c,[{width:e/2+"px"},{width:e+"px"}],this.timingFromConfig(b))}}); Polymer({is:"paper-menu-shrink-width-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(b){var c=b.node,e=c.getBoundingClientRect().width;return this._effect=new KeyframeEffect(c,[{width:e+"px"},{width:e-e/20+"px"}],this.timingFromConfig(b))}}); Polymer({is:"paper-menu-shrink-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(b){var c=b.node,e=c.getBoundingClientRect().height;this.setPrefixedProperty(c,"transformOrigin","0 0");return this._effect=new KeyframeEffect(c,[{height:e+"px",transform:"translateY(0)"},{height:e/2+"px",transform:"translateY(-20px)"}],this.timingFromConfig(b))}}); //# sourceURL=build://paper-menu-button/paper-menu-button.html.js (function(){var b={ANIMATION_CUBIC_BEZIER:"cubic-bezier(.3,.95,.5,1)",MAX_ANIMATION_TIME_MS:400};Polymer.PaperMenuButton=function(){};Polymer.PaperMenuButton.prototype.registered=function(){};Polymer.PaperMenuButton.prototype.addOwnKeyBinding=function(){};Polymer.PaperMenuButton.prototype.removeOwnKeyBindings=function(){};Polymer.PaperMenuButton.prototype.keyboardEventMatchesKeys=function(){};Polymer.PaperMenuButton.prototype._collectKeyBindings=function(){};Polymer.PaperMenuButton.prototype._prepKeyBindings= function(){};Polymer.PaperMenuButton.prototype._addKeyBinding=function(){};Polymer.PaperMenuButton.prototype._resetKeyEventListeners=function(){};Polymer.PaperMenuButton.prototype._listenKeyEventListeners=function(){};Polymer.PaperMenuButton.prototype._unlistenKeyEventListeners=function(){};Polymer.PaperMenuButton.prototype._onKeyBindingEvent=function(){};Polymer.PaperMenuButton.prototype._triggerKeyHandler=function(){};Polymer.PaperMenuButton.prototype._focusBlurHandler=function(c){if(Polymer.Element)this._setFocused("focus"=== c.type);else if(c.target===this)this._setFocused("focus"===c.type);else if(this.__handleEventRetargeting){var e=Polymer.dom(c).localTarget;this.isLightDescendant(e)||this.fire(c.type,{sourceEvent:c},{node:this,bubbles:c.bubbles,cancelable:c.cancelable})}};Polymer.PaperMenuButton.prototype._changedControlState=function(){this._controlStateChanged&&this._controlStateChanged()};Polymer.PaperMenuButton.prototype._setFocused=function(){};Polymer.PaperMenuButton=Polymer({is:"paper-menu-button",behaviors:[Polymer.IronA11yKeysBehavior, Polymer.IronControlState],properties:{opened:{type:Boolean,value:!1,notify:!0,observer:"_openedChanged"},horizontalAlign:{type:String,value:"left",reflectToAttribute:!0},verticalAlign:{type:String,value:"top",reflectToAttribute:!0},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:!0},verticalOffset:{type:Number,value:0,notify:!0},noOverlap:{type:Boolean},noAnimations:{type:Boolean,value:!1},ignoreSelect:{type:Boolean,value:!1},closeOnActivate:{type:Boolean,value:!1},openAnimationConfig:{type:Object, value:function(){return[{name:"fade-in-animation",timing:{delay:100,duration:200}},{name:"paper-menu-grow-width-animation",timing:{delay:100,duration:150,easing:b.ANIMATION_CUBIC_BEZIER}},{name:"paper-menu-grow-height-animation",timing:{delay:100,duration:275,easing:b.ANIMATION_CUBIC_BEZIER}}]}},closeAnimationConfig:{type:Object,value:function(){return[{name:"fade-out-animation",timing:{duration:150}},{name:"paper-menu-shrink-width-animation",timing:{delay:100,duration:50,easing:b.ANIMATION_CUBIC_BEZIER}}, {name:"paper-menu-shrink-height-animation",timing:{duration:200,easing:"ease-in"}}]}},allowOutsideScroll:{type:Boolean,value:!1},restoreFocusOnClose:{type:Boolean,value:!0},_dropdownContent:{type:Object}},hostAttributes:{role:"group","aria-haspopup":"true"},listeners:{"iron-activate":"_onIronActivate","iron-select":"_onIronSelect"},get contentElement(){for(var c=Polymer.dom(this.$.content).getDistributedNodes(),e=0,g=c.length;e<g;e++)if(c[e].nodeType===Node.ELEMENT_NODE)return c[e]},toggle:function(){this.opened? this.close():this.open()},open:function(){this.disabled||this.$.dropdown.open()},close:function(){this.$.dropdown.close()},_onIronSelect:function(){this.ignoreSelect||this.close()},_onIronActivate:function(){this.closeOnActivate&&this.close()},_openedChanged:function(c,e){c?(this._dropdownContent=this.contentElement,this.fire("paper-dropdown-open")):null!=e&&this.fire("paper-dropdown-close")},_disabledChanged:function(c){Polymer.IronControlState._disabledChanged.apply(this,arguments);c&&this.opened&& this.close()},__onIronOverlayCanceled:function(c){var e=this.$.trigger;-1<Polymer.dom(c.detail).path.indexOf(e)&&c.preventDefault()}});Object.keys(b).forEach(function(c){Polymer.PaperMenuButton[c]=b[c]})})(); //# sourceURL=build://paper-dropdown-menu/paper-dropdown-menu.html.js (function(){Polymer({is:"paper-dropdown-menu",behaviors:[Polymer.IronButtonState,Polymer.IronControlState,Polymer.IronFormElementBehavior,Polymer.IronValidatableBehavior],properties:{selectedItemLabel:{type:String,notify:!0,readOnly:!0},selectedItem:{type:Object,notify:!0,readOnly:!0},value:{type:String,notify:!0},label:{type:String},placeholder:{type:String},errorMessage:{type:String},opened:{type:Boolean,notify:!0,value:!1,observer:"_openedChanged"},allowOutsideScroll:{type:Boolean,value:!1},noLabelFloat:{type:Boolean, value:!1,reflectToAttribute:!0},alwaysFloatLabel:{type:Boolean,value:!1},noAnimations:{type:Boolean,value:!1},horizontalAlign:{type:String,value:"right"},verticalAlign:{type:String,value:"top"},verticalOffset:Number,dynamicAlign:{type:Boolean},restoreFocusOnClose:{type:Boolean,value:!0}},listeners:{tap:"_onTap"},keyBindings:{"up down":"open",esc:"close"},hostAttributes:{role:"combobox","aria-autocomplete":"none","aria-haspopup":"true"},observers:["_selectedItemChanged(selectedItem)"],attached:function(){var b= this.contentElement;b&&b.selectedItem&&this._setSelectedItem(b.selectedItem)},get contentElement(){for(var b=Polymer.dom(this.$.content).getDistributedNodes(),c=0,e=b.length;c<e;c++)if(b[c].nodeType===Node.ELEMENT_NODE)return b[c]},open:function(){this.$.menuButton.open()},close:function(){this.$.menuButton.close()},_onIronSelect:function(b){this._setSelectedItem(b.detail.item)},_onIronDeselect:function(){this._setSelectedItem(null)},_onTap:function(b){Polymer.Gestures.findOriginalTarget(b)===this&& this.open()},_selectedItemChanged:function(b){this.value=b=b?b.label||b.getAttribute("label")||b.textContent.trim():"";this._setSelectedItemLabel(b)},_computeMenuVerticalOffset:function(b,c){return c?c:b?-4:8},_getValidity:function(){return this.disabled||!this.required||this.required&&!!this.value},_openedChanged:function(){var b=this.opened?"true":"false",c=this.contentElement;c&&c.setAttribute("aria-expanded",b)}})})(); //# sourceURL=build://paper-icon-button/paper-icon-button.html.js Polymer({is:"paper-icon-button",hostAttributes:{role:"button",tabindex:"0"},behaviors:[Polymer.PaperInkyFocusBehavior],properties:{src:{type:String},icon:{type:String},alt:{type:String,observer:"_altChanged"}},_altChanged:function(b,c){var e=this.getAttribute("aria-label");e&&c!=e||this.setAttribute("aria-label",b)}}); //# sourceURL=build://paper-item/paper-item-behavior.html.js Polymer.PaperItemBehaviorImpl={hostAttributes:{role:"option",tabindex:"0"}};Polymer.PaperItemBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.PaperItemBehaviorImpl]; //# sourceURL=build://paper-item/paper-item.html.js Polymer({is:"paper-item",behaviors:[Polymer.PaperItemBehavior]}); //# sourceURL=build://iron-selector/iron-multi-selectable.html.js Polymer.IronMultiSelectableBehaviorImpl={properties:{multi:{type:Boolean,value:!1,observer:"multiChanged"},selectedValues:{type:Array,notify:!0,value:function(){return[]}},selectedItems:{type:Array,readOnly:!0,notify:!0,value:function(){return[]}}},observers:["_updateSelected(selectedValues.splices)"],select:function(b){this.multi?this._toggleSelected(b):this.selected=b},multiChanged:function(b){this._selection.multi=b;this._updateSelected()},get _shouldUpdateSelection(){return null!=this.selected|| null!=this.selectedValues&&this.selectedValues.length},_updateAttrForSelected:function(){this.multi?this.selectedItems&&0<this.selectedItems.length&&(this.selectedValues=this.selectedItems.map(function(b){return this._indexToValue(this.indexOf(b))},this).filter(function(b){return null!=b},this)):Polymer.IronSelectableBehavior._updateAttrForSelected.apply(this)},_updateSelected:function(){this.multi?this._selectMulti(this.selectedValues):this._selectSelected(this.selected)},_selectMulti:function(b){b= b||[];b=(this._valuesToItems(b)||[]).filter(function(e){return null!==e&&void 0!==e});this._selection.clear(b);for(var c=0;c<b.length;c++)this._selection.setItemSelected(b[c],!0);this.fallbackSelection&&!this._selection.get().length&&this._valueToItem(this.fallbackSelection)&&this.select(this.fallbackSelection)},_selectionChange:function(){var b=this._selection.get();this.multi?(this._setSelectedItems(b),this._setSelectedItem(b.length?b[0]:null)):null!==b&&void 0!==b?(this._setSelectedItems([b]), this._setSelectedItem(b)):(this._setSelectedItems([]),this._setSelectedItem(null))},_toggleSelected:function(b){var c=this.selectedValues.indexOf(b);0>c?this.push("selectedValues",b):this.splice("selectedValues",c,1)},_valuesToItems:function(b){return null==b?null:b.map(function(c){return this._valueToItem(c)},this)}};Polymer.IronMultiSelectableBehavior=[Polymer.IronSelectableBehavior,Polymer.IronMultiSelectableBehaviorImpl]; //# sourceURL=build://iron-menu-behavior/iron-menu-behavior.html.js Polymer.IronMenuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOnly:!0,type:Object},attrForItemTitle:{type:String},disabled:{type:Boolean,value:!1,observer:"_disabledChanged"}},_MODIFIER_KEYS:"Alt AltGraph CapsLock Control Fn FnLock Hyper Meta NumLock OS ScrollLock Shift Super Symbol SymbolLock".split(" "),_SEARCH_RESET_TIMEOUT_MS:1E3,_previousTabIndex:0,hostAttributes:{role:"menu"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_onFocus",keydown:"_onKeydown", "iron-items-changed":"_onIronItemsChanged"},keyBindings:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShiftTabDown"},attached:function(){this._resetTabindices()},select:function(b){this._defaultFocusAsync&&(this.cancelAsync(this._defaultFocusAsync),this._defaultFocusAsync=null);var c=this._valueToItem(b);c&&c.hasAttribute("disabled")||(this._setFocusedItem(c),Polymer.IronMultiSelectableBehaviorImpl.select.apply(this,arguments))},_resetTabindices:function(){var b=this.multi? this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.items.forEach(function(c){c.setAttribute("tabindex",c===b?"0":"-1")},this)},_updateMultiselectable:function(b){b?this.setAttribute("aria-multiselectable","true"):this.removeAttribute("aria-multiselectable")},_focusWithKeyboardEvent:function(b){if(-1===this._MODIFIER_KEYS.indexOf(b.key)){this.cancelDebouncer("_clearSearchText");var c=this._searchText||"";c+=(b.key&&1==b.key.length?b.key:String.fromCharCode(b.keyCode)).toLocaleLowerCase(); b=c.length;for(var e=0,g;g=this.items[e];e++)if(!g.hasAttribute("disabled")){var k=this.attrForItemTitle||"textContent";k=(g[k]||g.getAttribute(k)||"").trim();if(!(k.length<b)&&k.slice(0,b).toLocaleLowerCase()==c){this._setFocusedItem(g);break}}this._searchText=c;this.debounce("_clearSearchText",this._clearSearchText,this._SEARCH_RESET_TIMEOUT_MS)}},_clearSearchText:function(){this._searchText=""},_focusPrevious:function(){for(var b=this.items.length,c=Number(this.indexOf(this.focusedItem)),e=1;e< b+1;e++){var g=this.items[(c-e+b)%b];if(!g.hasAttribute("disabled")){var k=Polymer.dom(g).getOwnerRoot()||document;this._setFocusedItem(g);if(Polymer.dom(k).activeElement==g)break}}},_focusNext:function(){for(var b=this.items.length,c=Number(this.indexOf(this.focusedItem)),e=1;e<b+1;e++){var g=this.items[(c+e)%b];if(!g.hasAttribute("disabled")){var k=Polymer.dom(g).getOwnerRoot()||document;this._setFocusedItem(g);if(Polymer.dom(k).activeElement==g)break}}},_applySelection:function(b,c){c?b.setAttribute("aria-selected", "true"):b.removeAttribute("aria-selected");Polymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItemChanged:function(b,c){c&&c.setAttribute("tabindex","-1");!b||b.hasAttribute("disabled")||this.disabled||(b.setAttribute("tabindex","0"),b.focus())},_onIronItemsChanged:function(b){b.detail.addedNodes.length&&this._resetTabindices()},_onShiftTabDown:function(){var b=this.getAttribute("tabindex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=!0;this._setFocusedItem(null);this.setAttribute("tabindex", "-1");this.async(function(){this.setAttribute("tabindex",b);Polymer.IronMenuBehaviorImpl._shiftTabPressed=!1},1)},_onFocus:function(b){!Polymer.IronMenuBehaviorImpl._shiftTabPressed&&(b=Polymer.dom(b).rootTarget,b===this||"undefined"===typeof b.tabIndex||this.isLightDescendant(b))&&(this._defaultFocusAsync=this.async(function(){var c=this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);c?this._setFocusedItem(c):this.items[0]&&this._focusNext()}))},_onUpKey:function(b){this._focusPrevious(); b.detail.keyboardEvent.preventDefault()},_onDownKey:function(b){this._focusNext();b.detail.keyboardEvent.preventDefault()},_onEscKey:function(){var b=this.focusedItem;b&&b.blur()},_onKeydown:function(b){this.keyboardEventMatchesKeys(b,"up down esc")||this._focusWithKeyboardEvent(b);b.stopPropagation()},_activateHandler:function(b){Polymer.IronSelectableBehavior._activateHandler.call(this,b);b.stopPropagation()},_disabledChanged:function(b){b?(this._previousTabIndex=this.hasAttribute("tabindex")?this.tabIndex: 0,this.removeAttribute("tabindex")):this.hasAttribute("tabindex")||this.setAttribute("tabindex",this._previousTabIndex)}};Polymer.IronMenuBehaviorImpl._shiftTabPressed=!1;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.IronA11yKeysBehavior,Polymer.IronMenuBehaviorImpl]; //# sourceURL=build://paper-listbox/paper-listbox.html.js (function(){Polymer({is:"paper-listbox",behaviors:[Polymer.IronMenuBehavior],hostAttributes:{role:"listbox"}})})(); //# sourceURL=build://iron-range-behavior/iron-range-behavior.html.js Polymer.IronRangeBehavior={properties:{value:{type:Number,value:0,notify:!0,reflectToAttribute:!0},min:{type:Number,value:0,notify:!0},max:{type:Number,value:100,notify:!0},step:{type:Number,value:1,notify:!0},ratio:{type:Number,value:0,readOnly:!0,notify:!0}},observers:["_update(value, min, max, step)"],_calcRatio:function(b){return(this._clampValue(b)-this.min)/(this.max-this.min)},_clampValue:function(b){return Math.min(this.max,Math.max(this.min,this._calcStep(b)))},_calcStep:function(b){b=parseFloat(b); if(!this.step)return b;b=Math.round((b-this.min)/this.step);return 1>this.step?b/(1/this.step)+this.min:b*this.step+this.min},_validateValue:function(){var b=this._clampValue(this.value);this.value=this.oldValue=isNaN(b)?this.oldValue:b;return this.value!==b},_update:function(){this._validateValue();this._setRatio(100*this._calcRatio(this.value))}}; //# sourceURL=build://paper-progress/paper-progress.html.js Polymer({is:"paper-progress",behaviors:[Polymer.IronRangeBehavior],properties:{secondaryProgress:{type:Number,value:0},secondaryRatio:{type:Number,value:0,readOnly:!0},indeterminate:{type:Boolean,value:!1,observer:"_toggleIndeterminate"},disabled:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_disabledChanged"}},observers:["_progressChanged(secondaryProgress, value, min, max, indeterminate)"],hostAttributes:{role:"progressbar"},_toggleIndeterminate:function(b){this.toggleClass("indeterminate", b,this.$.primaryProgress)},_transformProgress:function(b,c){b.style.transform=b.style.webkitTransform="scaleX("+c/100+")"},_mainRatioChanged:function(b){this._transformProgress(this.$.primaryProgress,b)},_progressChanged:function(b,c,e,g,k){b=this._clampValue(b);c=this._clampValue(c);var q=100*this._calcRatio(b),l=100*this._calcRatio(c);this._setSecondaryRatio(q);this._transformProgress(this.$.secondaryProgress,q);this._transformProgress(this.$.primaryProgress,l);this.secondaryProgress=b;k?this.removeAttribute("aria-valuenow"): this.setAttribute("aria-valuenow",c);this.setAttribute("aria-valuemin",e);this.setAttribute("aria-valuemax",g)},_disabledChanged:function(b){this.setAttribute("aria-disabled",b?"true":"false")},_hideSecondaryProgress:function(b){return 0===b}}); //# sourceURL=build://paper-radio-button/paper-radio-button.html.js Polymer({is:"paper-radio-button",behaviors:[Polymer.PaperCheckedElementBehavior],hostAttributes:{role:"radio","aria-checked":!1,tabindex:0},properties:{ariaActiveAttribute:{type:String,value:"aria-checked"}},ready:function(){this._rippleContainer=this.$.radioContainer},attached:function(){Polymer.RenderStatus.afterNextRender(this,function(){if("-1px"===this.getComputedStyleValue("--calculated-paper-radio-button-ink-size").trim()){var b=parseFloat(this.getComputedStyleValue("--calculated-paper-radio-button-size").trim()), c=Math.floor(3*b);c%2!==b%2&&c++;this.updateStyles({"--paper-radio-button-ink-size":c+"px"})}})}}); //# sourceURL=build://iron-menu-behavior/iron-menubar-behavior.html.js Polymer.IronMenubarBehaviorImpl={hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightKey"},_onUpKey:function(b){this.focusedItem.click();b.detail.keyboardEvent.preventDefault()},_onDownKey:function(b){this.focusedItem.click();b.detail.keyboardEvent.preventDefault()},get _isRTL(){return"rtl"===window.getComputedStyle(this).direction},_onLeftKey:function(b){this._isRTL?this._focusNext():this._focusPrevious();b.detail.keyboardEvent.preventDefault()},_onRightKey:function(b){this._isRTL? this._focusPrevious():this._focusNext();b.detail.keyboardEvent.preventDefault()},_onKeydown:function(b){this.keyboardEventMatchesKeys(b,"up down left right esc")||this._focusWithKeyboardEvent(b)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuBehavior,Polymer.IronMenubarBehaviorImpl]; //# sourceURL=build://paper-radio-group/paper-radio-group.html.js Polymer({is:"paper-radio-group",behaviors:[Polymer.IronMenubarBehavior],hostAttributes:{role:"radiogroup"},properties:{attrForSelected:{type:String,value:"name"},selectedAttribute:{type:String,value:"checked"},selectable:{type:String,value:"paper-radio-button"},allowEmptySelection:{type:Boolean,value:!1}},select:function(b){var c=this._valueToItem(b);if(!c||!c.hasAttribute("disabled")){if(this.selected){c=this._valueToItem(this.selected);if(this.selected==b)if(this.allowEmptySelection)b="";else{c&& (c.checked=!0);return}c&&(c.checked=!1)}Polymer.IronSelectableBehavior.select.apply(this,[b]);this.fire("paper-radio-group-changed")}},_activateFocusedItem:function(){this._itemActivate(this._valueForItem(this.focusedItem),this.focusedItem)},_onUpKey:function(b){this._focusPrevious();b.preventDefault();this._activateFocusedItem()},_onDownKey:function(b){this._focusNext();b.preventDefault();this._activateFocusedItem()},_onLeftKey:function(b){Polymer.IronMenubarBehaviorImpl._onLeftKey.apply(this,arguments); this._activateFocusedItem()},_onRightKey:function(b){Polymer.IronMenubarBehaviorImpl._onRightKey.apply(this,arguments);this._activateFocusedItem()}}); //# sourceURL=build://paper-slider/paper-slider.html.js Polymer({is:"paper-slider",behaviors:[Polymer.IronA11yKeysBehavior,Polymer.IronFormElementBehavior,Polymer.PaperInkyFocusBehavior,Polymer.IronRangeBehavior],properties:{snaps:{type:Boolean,value:!1,notify:!0},pin:{type:Boolean,value:!1,notify:!0},secondaryProgress:{type:Number,value:0,notify:!0,observer:"_secondaryProgressChanged"},editable:{type:Boolean,value:!1},immediateValue:{type:Number,value:0,readOnly:!0,notify:!0},maxMarkers:{type:Number,value:0,notify:!0},expand:{type:Boolean,value:!1,readOnly:!0}, ignoreBarTouch:{type:Boolean,value:!1},dragging:{type:Boolean,value:!1,readOnly:!0,notify:!0},transiting:{type:Boolean,value:!1,readOnly:!0},markers:{type:Array,readOnly:!0,value:function(){return[]}}},observers:["_updateKnob(value, min, max, snaps, step)","_valueChanged(value)","_immediateValueChanged(immediateValue)","_updateMarkers(maxMarkers, min, max, snaps)"],hostAttributes:{role:"slider",tabindex:0},keyBindings:{left:"_leftKey",right:"_rightKey","down pagedown home":"_decrementKey","up pageup end":"_incrementKey"}, ready:function(){this.ignoreBarTouch&&Polymer.Gestures.setTouchAction(this.$.sliderBar,"auto")},increment:function(){this.value=this._clampValue(this.value+this.step)},decrement:function(){this.value=this._clampValue(this.value-this.step)},_updateKnob:function(b,c,e){this.setAttribute("aria-valuemin",c);this.setAttribute("aria-valuemax",e);this.setAttribute("aria-valuenow",b);this._positionKnob(100*this._calcRatio(b))},_valueChanged:function(){this.fire("value-change",{composed:!0})},_immediateValueChanged:function(){this.dragging? this.fire("immediate-value-change",{composed:!0}):this.value=this.immediateValue},_secondaryProgressChanged:function(){this.secondaryProgress=this._clampValue(this.secondaryProgress)},_expandKnob:function(){this._setExpand(!0)},_resetKnob:function(){this.cancelDebouncer("expandKnob");this._setExpand(!1)},_positionKnob:function(b){this._setImmediateValue(this._calcStep(this._calcKnobPosition(b)));this._setRatio(100*this._calcRatio(this.immediateValue));this.$.sliderKnob.style.left=this.ratio+"%";this.dragging&& (this._knobstartx=this.ratio*this._w/100,this.translate3d(0,0,0,this.$.sliderKnob))},_calcKnobPosition:function(b){return(this.max-this.min)*b/100+this.min},_onTrack:function(b){b.stopPropagation();switch(b.detail.state){case "start":this._trackStart(b);break;case "track":this._trackX(b);break;case "end":this._trackEnd()}},_trackStart:function(){this._setTransiting(!1);this._w=this.$.sliderBar.offsetWidth;this._knobstartx=this._startx=this._x=this.ratio*this._w/100;this._minx=-this._startx;this._maxx= this._w-this._startx;this.$.sliderKnob.classList.add("dragging");this._setDragging(!0)},_trackX:function(b){this.dragging||this._trackStart(b);this._x=this._startx+Math.min(this._maxx,Math.max(this._minx,b.detail.dx*(this._isRTL?-1:1)));this._setImmediateValue(this._calcStep(this._calcKnobPosition(this._x/this._w*100)));this.translate3d(this._calcRatio(this.immediateValue)*this._w-this._knobstartx+"px",0,0,this.$.sliderKnob)},_trackEnd:function(){var b=this.$.sliderKnob.style;this.$.sliderKnob.classList.remove("dragging"); this._setDragging(!1);this._resetKnob();this.value=this.immediateValue;b.transform=b.webkitTransform="";this.fire("change",{composed:!0})},_knobdown:function(b){this._expandKnob();b.preventDefault();this.focus()},_bartrack:function(b){this._allowBarEvent(b)&&this._onTrack(b)},_barclick:function(b){this._w=this.$.sliderBar.offsetWidth;var c=this.$.sliderBar.getBoundingClientRect();c=(b.detail.x-c.left)/this._w*100;this._isRTL&&(c=100-c);var e=this.ratio;this._setTransiting(!0);this._positionKnob(c); e===this.ratio&&this._setTransiting(!1);this.async(function(){this.fire("change",{composed:!0})});b.preventDefault();this.focus()},_bardown:function(b){this._allowBarEvent(b)&&(this.debounce("expandKnob",this._expandKnob,60),this._barclick(b))},_knobTransitionEnd:function(b){b.target===this.$.sliderKnob&&this._setTransiting(!1)},_updateMarkers:function(b,c,e,g){g||this._setMarkers([]);c=Math.round((e-c)/this.step);c>b&&(c=b);if(0>c||!isFinite(c))c=0;this._setMarkers(Array(c))},_mergeClasses:function(b){return Object.keys(b).filter(function(c){return b[c]}).join(" ")}, _getClassNames:function(){return this._mergeClasses({disabled:this.disabled,pin:this.pin,snaps:this.snaps,ring:this.immediateValue<=this.min,expand:this.expand,dragging:this.dragging,transiting:this.transiting,editable:this.editable})},_allowBarEvent:function(b){return!this.ignoreBarTouch||b.detail.sourceEvent instanceof MouseEvent},get _isRTL(){void 0===this.__isRTL&&(this.__isRTL="rtl"===window.getComputedStyle(this).direction);return this.__isRTL},_leftKey:function(b){this._isRTL?this._incrementKey(b): this._decrementKey(b)},_rightKey:function(b){this._isRTL?this._decrementKey(b):this._incrementKey(b)},_incrementKey:function(b){this.disabled||("end"===b.detail.key?this.value=this.max:this.increment(),this.fire("change"),b.preventDefault())},_decrementKey:function(b){this.disabled||("home"===b.detail.key?this.value=this.min:this.decrement(),this.fire("change"),b.preventDefault())},_changeValue:function(b){this.value=b.target.value;this.fire("change",{composed:!0})},_inputKeyDown:function(b){b.stopPropagation()}, _createRipple:function(){this._rippleContainer=this.$.sliderKnob;return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this)},_focusedChanged:function(b){b&&this.ensureRipple();this.hasRipple()&&(this._ripple.style.display=b?"":"none",this._ripple.holdDown=b)}}); //# sourceURL=build://paper-tabs/paper-tab.html.js Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,Polymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boolean,value:!1,reflectToAttribute:!0}},hostAttributes:{role:"tab"},listeners:{down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _parentNoink(){var b=Polymer.dom(this).parentNode;return!!b&&!!b.noink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onTap:function(b){if(this.link){var c=this.queryEffectiveChildren("a"); c&&b.target!==c&&c.click()}}}); //# sourceURL=build://paper-tabs/paper-tabs.html.js Polymer({is:"paper-tabs",behaviors:[Polymer.IronResizableBehavior,Polymer.IronMenubarBehavior],properties:{noink:{type:Boolean,value:!1,observer:"_noinkChanged"},noBar:{type:Boolean,value:!1},noSlide:{type:Boolean,value:!1},scrollable:{type:Boolean,value:!1},fitContainer:{type:Boolean,value:!1},disableDrag:{type:Boolean,value:!1},hideScrollButtons:{type:Boolean,value:!1},alignBottom:{type:Boolean,value:!1},selectable:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:!1},autoselectDelay:{type:Number, value:0},_step:{type:Number,value:10},_holdDelay:{type:Number,value:1},_leftHidden:{type:Boolean,value:!1},_rightHidden:{type:Boolean,value:!1},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},listeners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChanged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBindings:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=null;this._pendingActivationTimeout=this._pendingActivationItem= void 0;this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this);this.addEventListener("blur",this._onBlurCapture.bind(this),!0)},ready:function(){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._cancelPendingActivation()},_noinkChanged:function(b){Polymer.dom(this).querySelectorAll("paper-tab").forEach(b?this._setNoinkAttribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(b){b.setAttribute("noink","")},_removeNoinkAttribute:function(b){b.removeAttribute("noink")}, _computeScrollButtonClass:function(b,c,e){return!c||e?"hidden":b?"not-visible":""},_computeTabsContentClass:function(b,c){return b?"scrollable"+(c?" fit-container":""):" fit-container"},_computeSelectionBarClass:function(b,c){return b?"hidden":c?"align-bottom":""},_onTabSizingChanged:function(){this.debounce("_onTabSizingChanged",function(){this._scroll();this._tabChanged(this.selectedItem)},10)},_onIronSelect:function(b){this._tabChanged(b.detail.item,this._previousTab);this._previousTab=b.detail.item; this.cancelDebouncer("tab-changed")},_onIronDeselect:function(){this.debounce("tab-changed",function(){this._tabChanged(null,this._previousTab);this._previousTab=null},1)},_activateHandler:function(){this._cancelPendingActivation();Polymer.IronMenuBehaviorImpl._activateHandler.apply(this,arguments)},_scheduleActivation:function(b,c){this._pendingActivationItem=b;this._pendingActivationTimeout=this.async(this._bindDelayedActivationHandler,c)},_delayedActivationHandler:function(){var b=this._pendingActivationItem; this._pendingActivationTimeout=this._pendingActivationItem=void 0;b.fire(this.activateEvent,null,{bubbles:!0,cancelable:!0})},_cancelPendingActivation:function(){void 0!==this._pendingActivationTimeout&&(this.cancelAsync(this._pendingActivationTimeout),this._pendingActivationTimeout=this._pendingActivationItem=void 0)},_onArrowKeyup:function(){this.autoselect&&this._scheduleActivation(this.focusedItem,this.autoselectDelay)},_onBlurCapture:function(b){b.target===this._pendingActivationItem&&this._cancelPendingActivation()}, get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContainer.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(b,c){this.scrollable&&this._affectScroll(c&&-c.ddx||0)},_down:function(){this.async(function(){this._defaultFocusAsync&&(this.cancelAsync(this._defaultFocusAsync),this._defaultFocusAsync=null)},1)},_affectScroll:function(b){this.$.tabsContainer.scrollLeft+=b;b=this.$.tabsContainer.scrollLeft;this._leftHidden=0===b;this._rightHidden=b===this._tabContainerScrollSize}, _onLeftScrollButtonDown:function(){this._scrollToLeft();this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},_onRightScrollButtonDown:function(){this._scrollToRight();this._holdJob=setInterval(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function(){clearInterval(this._holdJob);this._holdJob=null},_scrollToLeft:function(){this._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._step)},_tabChanged:function(b,c){if(b){var e=this.$.tabsContent.getBoundingClientRect(), g=e.width,k=b.getBoundingClientRect();e=k.left-e.left;this._pos={width:this._calcPercent(k.width,g),left:this._calcPercent(e,g)};if(this.noSlide||null==c)this.$.selectionBar.classList.remove("expand"),this.$.selectionBar.classList.remove("contract"),this._positionBar(this._pos.width,this._pos.left);else{var q=c.getBoundingClientRect();c=this.items.indexOf(c);b=this.items.indexOf(b);this.$.selectionBar.classList.add("expand");b=c<b;this._isRTL&&(b=!b);b?this._positionBar(this._calcPercent(k.left+k.width- q.left,g)-5,this._left):this._positionBar(this._calcPercent(q.left+q.width-k.left,g)-5,this._calcPercent(e,g)+5);this.scrollable&&this._scrollToSelectedIfNeeded(k.width,e)}}else this.$.selectionBar.classList.remove("expand"),this.$.selectionBar.classList.remove("contract"),this._positionBar(0,0)},_scrollToSelectedIfNeeded:function(b,c){c-=this.$.tabsContainer.scrollLeft;0>c?this.$.tabsContainer.scrollLeft+=c:(c+=b-this.$.tabsContainer.offsetWidth,0<c&&(this.$.tabsContainer.scrollLeft+=c))},_calcPercent:function(b, c){return 100*b/c},_positionBar:function(b,c){b=b||0;c=c||0;this._width=b;this._left=c;this.transform("translateX("+c+"%) scaleX("+b/100+")",this.$.selectionBar)},_onBarTransitionEnd:function(){var b=this.$.selectionBar.classList;b.contains("expand")?(b.remove("expand"),b.add("contract"),this._positionBar(this._pos.width,this._pos.left)):b.contains("contract")&&b.remove("contract")}}); //# sourceURL=build://paper-toast/paper-toast.html.js (function(){var b=null;Polymer({is:"paper-toast",behaviors:[Polymer.IronOverlayBehavior],properties:{fitInto:{type:Object,value:window,observer:"_onFitIntoChanged"},horizontalAlign:{type:String,value:"left"},verticalAlign:{type:String,value:"bottom"},duration:{type:Number,value:3E3},text:{type:String,value:""},noCancelOnOutsideClick:{type:Boolean,value:!0},noAutoFocus:{type:Boolean,value:!0}},listeners:{transitionend:"__onTransitionEnd"},get visible(){Polymer.Base._warn("`visible` is deprecated, use `opened` instead"); return this.opened},get _canAutoClose(){return 0<this.duration&&Infinity!==this.duration},created:function(){this._autoClose=null;Polymer.IronA11yAnnouncer.requestAvailability()},show:function(c){"string"==typeof c&&(c={text:c});for(var e in c)0===e.indexOf("_")?Polymer.Base._warn('The property "'+e+'" is private and was not set.'):e in this?this[e]=c[e]:Polymer.Base._warn('The property "'+e+'" is not valid.');this.open()},hide:function(){this.close()},__onTransitionEnd:function(c){c&&c.target=== this&&"opacity"===c.propertyName&&(this.opened?this._finishRenderOpened():this._finishRenderClosed())},_openedChanged:function(){null!==this._autoClose&&(this.cancelAsync(this._autoClose),this._autoClose=null);this.opened?(b&&b!==this&&b.close(),b=this,this.fire("iron-announce",{text:this.text}),this._canAutoClose&&(this._autoClose=this.async(this.close,this.duration))):b===this&&(b=null);Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this,arguments)},_renderOpened:function(){this.classList.add("paper-toast-open")}, _renderClosed:function(){this.classList.remove("paper-toast-open")},_onFitIntoChanged:function(c){this.positionTarget=c}})})(); /* Lodash <https://lodash.com/> Copyright JS Foundation and other contributors <https://js.foundation/> Released under MIT license <https://lodash.com/license> Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ (function(){var undefined;var VERSION="4.17.5";var LARGE_ARRAY_SIZE=200;var CORE_ERROR_TEXT="Unsupported core-js use. Try https://npms.io/search?q\x3dponyfill.",FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var MAX_MEMOIZE_SIZE=500;var PLACEHOLDER="__lodash_placeholder__";var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;var WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG= 8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,WRAP_FLIP_FLAG=512;var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION="...";var HOT_COUNT=800,HOT_SPAN=16;var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157E308,NAN=0/0;var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;var wrapFlags=[["ary", WRAP_ARY_FLAG],["bind",WRAP_BIND_FLAG],["bindKey",WRAP_BIND_KEY_FLAG],["curry",WRAP_CURRY_FLAG],["curryRight",WRAP_CURRY_RIGHT_FLAG],["flip",WRAP_FLIP_FLAG],["partial",WRAP_PARTIAL_FLAG],["partialRight",WRAP_PARTIAL_RIGHT_FLAG],["rearg",WRAP_REARG_FLAG]];var argsTag="[object Arguments]",arrayTag="[object Array]",asyncTag="[object AsyncFunction]",boolTag="[object Boolean]",dateTag="[object Date]",domExcTag="[object DOMException]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]", mapTag="[object Map]",numberTag="[object Number]",nullTag="[object Null]",objectTag="[object Object]",promiseTag="[object Promise]",proxyTag="[object Proxy]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",undefinedTag="[object Undefined]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]", int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml= RegExp(reUnescapedHtml.source);var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);var reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/;var reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var reEscapeChar=/\\(\\)?/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsHostCtor=/^\[object .+?Constructor\]$/;var reIsOctal=/^0o[0-7]+$/i;var reIsUint=/^(?:0|[1-9]\d*)$/;var reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var reNoMatch=/($^)/;var reUnescapedString= /['\n\r\u2028\u2029\\]/g;var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;var rsApos="['\u2019]",rsAstral="["+rsAstralRange+"]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral= "[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d";var rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+ ")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?\x3d\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?\x3d\\b|[a-z_])",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")";var reApos=RegExp(rsApos,"g");var reComboMark=RegExp(rsCombo,"g");var reUnicode=RegExp(rsFitz+"(?\x3d"+rsFitz+")|"+rsSymbol+rsSeq,"g");var reUnicodeWord=RegExp([rsUpper+"?"+ rsLower+"+"+rsOptContrLower+"(?\x3d"+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?\x3d"+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");var reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboRange+rsVarRange+"]");var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var contextProps=["Array","Buffer","DataView", "Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var templateCounter=-1;var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]= typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]= cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true; cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;var deburredLetters={"\u00c0":"A","\u00c1":"A","\u00c2":"A","\u00c3":"A","\u00c4":"A","\u00c5":"A","\u00e0":"a","\u00e1":"a","\u00e2":"a","\u00e3":"a","\u00e4":"a","\u00e5":"a","\u00c7":"C","\u00e7":"c","\u00d0":"D","\u00f0":"d","\u00c8":"E","\u00c9":"E","\u00ca":"E","\u00cb":"E","\u00e8":"e","\u00e9":"e","\u00ea":"e","\u00eb":"e","\u00cc":"I","\u00cd":"I","\u00ce":"I","\u00cf":"I","\u00ec":"i","\u00ed":"i","\u00ee":"i", "\u00ef":"i","\u00d1":"N","\u00f1":"n","\u00d2":"O","\u00d3":"O","\u00d4":"O","\u00d5":"O","\u00d6":"O","\u00d8":"O","\u00f2":"o","\u00f3":"o","\u00f4":"o","\u00f5":"o","\u00f6":"o","\u00f8":"o","\u00d9":"U","\u00da":"U","\u00db":"U","\u00dc":"U","\u00f9":"u","\u00fa":"u","\u00fb":"u","\u00fc":"u","\u00dd":"Y","\u00fd":"y","\u00ff":"y","\u00c6":"Ae","\u00e6":"ae","\u00de":"Th","\u00fe":"th","\u00df":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C", "\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i", "\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S", "\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe", "\u0153":"oe","\u0149":"'n","\u017f":"s"};var htmlEscapes={"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26quot;","'":"\x26#39;"};var htmlUnescapes={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26quot;":'"',"\x26#39;":"'"};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var freeParseFloat=parseFloat,freeParseInt=parseInt;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&& self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var freeProcess=moduleExports&&freeGlobal.process;var nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();var nodeIsArrayBuffer=nodeUtil&& nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array, setter,iteratee,accumulator){var index=-1,length=array==null?0:array.length;while(++index<length){var value=array[index];setter(accumulator,value,iteratee(value),array)}return accumulator}function arrayEach(array,iteratee){var index=-1,length=array==null?0:array.length;while(++index<length)if(iteratee(array[index],index,array)===false)break;return array}function arrayEachRight(array,iteratee){var length=array==null?0:array.length;while(length--)if(iteratee(array[length],length,array)===false)break; return array}function arrayEvery(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length)if(!predicate(array[index],index,array))return false;return true}function arrayFilter(array,predicate){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array))result[resIndex++]=value}return result}function arrayIncludes(array,value){var length=array==null?0:array.length;return!!length&&baseIndexOf(array, value,0)>-1}function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index<length)if(comparator(value,array[index]))return true;return false}function arrayMap(array,iteratee){var index=-1,length=array==null?0:array.length,result=Array(length);while(++index<length)result[index]=iteratee(array[index],index,array);return result}function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length)array[offset+index]= values[index];return array}function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array==null?0:array.length;if(initAccum&&length)accumulator=array[++index];while(++index<length)accumulator=iteratee(accumulator,array[index],index,array);return accumulator}function arrayReduceRight(array,iteratee,accumulator,initAccum){var length=array==null?0:array.length;if(initAccum&&length)accumulator=array[--length];while(length--)accumulator=iteratee(accumulator,array[length],length,array); return accumulator}function arraySome(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length)if(predicate(array[index],index,array))return true;return false}var asciiSize=baseProperty("length");function asciiToArray(string){return string.split("")}function asciiWords(string){return string.match(reAsciiWord)||[]}function baseFindKey(collection,predicate,eachFunc){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=key; return false}});return result}function baseFindIndex(array,predicate,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?1:-1);while(fromRight?index--:++index<length)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(array,baseIsNaN,fromIndex)}function baseIndexOfWith(array,value,fromIndex,comparator){var index=fromIndex-1,length=array.length;while(++index< length)if(comparator(array[index],value))return index;return-1}function baseIsNaN(value){return value!==value}function baseMean(array,iteratee){var length=array==null?0:array.length;return length?baseSum(array,iteratee)/length:NAN}function baseProperty(key){return function(object){return object==null?undefined:object[key]}}function basePropertyOf(object){return function(key){return object==null?undefined:object[key]}}function baseReduce(collection,iteratee,accumulator,initAccum,eachFunc){eachFunc(collection, function(value,index,collection){accumulator=initAccum?(initAccum=false,value):iteratee(accumulator,value,index,collection)});return accumulator}function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--)array[length]=array[length].value;return array}function baseSum(array,iteratee){var result,index=-1,length=array.length;while(++index<length){var current=iteratee(array[index]);if(current!==undefined)result=result===undefined?current:result+current}return result} function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n)result[index]=iteratee(index);return result}function baseToPairs(object,props){return arrayMap(props,function(key){return[key,object[key]]})}function baseUnary(func){return function(value){return func(value)}}function baseValues(object,props){return arrayMap(props,function(key){return object[key]})}function cacheHas(cache,key){return cache.has(key)}function charsStartIndex(strSymbols,chrSymbols){var index=-1,length=strSymbols.length; while(++index<length&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1);return index}function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1);return index}function countHolders(array,placeholder){var length=array.length,result=0;while(length--)if(array[length]===placeholder)++result;return result}var deburrLetter=basePropertyOf(deburredLetters);var escapeHtmlChar=basePropertyOf(htmlEscapes);function escapeStringChar(chr){return"\\"+ stringEscapes[chr]}function getValue(object,key){return object==null?undefined:object[key]}function hasUnicode(string){return reHasUnicode.test(string)}function hasUnicodeWord(string){return reHasUnicodeWord.test(string)}function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done)result.push(data.value);return result}function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}function overArg(func, transform){return function(arg){return func(transform(arg))}}function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value===placeholder||value===PLACEHOLDER){array[index]=PLACEHOLDER;result[resIndex++]=index}}return result}function safeGet(object,key){return key=="__proto__"?undefined:object[key]}function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value}); return result}function setToPairs(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=[value,value]});return result}function strictIndexOf(array,value,fromIndex){var index=fromIndex-1,length=array.length;while(++index<length)if(array[index]===value)return index;return-1}function strictLastIndexOf(array,value,fromIndex){var index=fromIndex+1;while(index--)if(array[index]===value)return index;return index}function stringSize(string){return hasUnicode(string)?unicodeSize(string): asciiSize(string)}function stringToArray(string){return hasUnicode(string)?unicodeToArray(string):asciiToArray(string)}var unescapeHtmlChar=basePropertyOf(htmlUnescapes);function unicodeSize(string){var result=reUnicode.lastIndex=0;while(reUnicode.test(string))++result;return result}function unicodeToArray(string){return string.match(reUnicode)||[]}function unicodeWords(string){return string.match(reUnicodeWord)||[]}var runInContext=function runInContext(context){context=context==null?root:_.defaults(root.Object(), context,_.pick(root,contextProps));var Array=context.Array,Date=context.Date,Error=context.Error,Function=context.Function,Math=context.Math,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=context["__core-js_shared__"];var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var idCounter=0;var maskSrcKey=function(){var uid= /[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var nativeObjectToString=objectProto.toString;var objectCtorString=funcToString.call(Object);var oldDash=root._;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$\x26").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Buffer=moduleExports?context.Buffer:undefined,Symbol=context.Symbol,Uint8Array=context.Uint8Array,allocUnsafe= Buffer?Buffer.allocUnsafe:undefined,getPrototype=overArg(Object.getPrototypeOf,Object),objectCreate=Object.create,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:undefined,symIterator=Symbol?Symbol.iterator:undefined,symToStringTag=Symbol?Symbol.toStringTag:undefined;var defineProperty=function(){try{var func=getNative(Object,"defineProperty");func({},"",{});return func}catch(e){}}();var ctxClearTimeout=context.clearTimeout!== root.clearTimeout&&context.clearTimeout,ctxNow=Date&&Date.now!==root.Date.now&&Date.now,ctxSetTimeout=context.setTimeout!==root.setTimeout&&context.setTimeout;var nativeCeil=Math.ceil,nativeFloor=Math.floor,nativeGetSymbols=Object.getOwnPropertySymbols,nativeIsBuffer=Buffer?Buffer.isBuffer:undefined,nativeIsFinite=context.isFinite,nativeJoin=arrayProto.join,nativeKeys=overArg(Object.keys,Object),nativeMax=Math.max,nativeMin=Math.min,nativeNow=Date.now,nativeParseInt=context.parseInt,nativeRandom= Math.random,nativeReverse=arrayProto.reverse;var DataView=getNative(context,"DataView"),Map=getNative(context,"Map"),Promise=getNative(context,"Promise"),Set=getNative(context,"Set"),WeakMap=getNative(context,"WeakMap"),nativeCreate=getNative(Object,"create");var metaMap=WeakMap&&new WeakMap;var realNames={};var dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap);var symbolProto=Symbol? Symbol.prototype:undefined,symbolValueOf=symbolProto?symbolProto.valueOf:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper)return value;if(hasOwnProperty.call(value,"__wrapped__"))return wrapperClone(value)}return new LodashWrapper(value)}var baseCreate=function(){function object(){}return function(proto){if(!isObject(proto))return{};if(objectCreate)return objectCreate(proto); object.prototype=proto;var result=new object;object.prototype=undefined;return result}}();function baseLodash(){}function LodashWrapper(value,chainAll){this.__wrapped__=value;this.__actions__=[];this.__chain__=!!chainAll;this.__index__=0;this.__values__=undefined}lodash.templateSettings={"escape":reEscape,"evaluate":reEvaluate,"interpolate":reInterpolate,"variable":"","imports":{"_":lodash}};lodash.prototype=baseLodash.prototype;lodash.prototype.constructor=lodash;LodashWrapper.prototype=baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor=LodashWrapper;function LazyWrapper(value){this.__wrapped__=value;this.__actions__=[];this.__dir__=1;this.__filtered__=false;this.__iteratees__=[];this.__takeCount__=MAX_ARRAY_LENGTH;this.__views__=[]}function lazyClone(){var result=new LazyWrapper(this.__wrapped__);result.__actions__=copyArray(this.__actions__);result.__dir__=this.__dir__;result.__filtered__=this.__filtered__;result.__iteratees__=copyArray(this.__iteratees__);result.__takeCount__=this.__takeCount__; result.__views__=copyArray(this.__views__);return result}function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1;result.__filtered__=true}else{result=this.clone();result.__dir__*=-1}return result}function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__, iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||!isRight&&arrLength==length&&takeCount==length)return baseWrapperValue(array,this.__actions__);var result=[];outer:while(length--&&resIndex<takeCount){index+=dir;var iterIndex=-1,value=array[index];while(++iterIndex<iterLength){var data=iteratees[iterIndex],iteratee=data.iteratee,type=data.type,computed=iteratee(value);if(type==LAZY_MAP_FLAG)value=computed;else if(!computed)if(type==LAZY_FILTER_FLAG)continue outer; else break outer}result[resIndex++]=value}return result}LazyWrapper.prototype=baseCreate(baseLodash.prototype);LazyWrapper.prototype.constructor=LazyWrapper;function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{};this.size=0}function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];this.size-=result?1:0; return result}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;this.size+=this.has(key)?0:1;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear; Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[];this.size=0}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0)return false;var lastIndex=data.length-1;if(index==lastIndex)data.pop(); else splice.call(data,index,1);--this.size;return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else data[index][1]=value;return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get= listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.size=0;this.__data__={"hash":new Hash,"map":new (Map||ListCache),"string":new Hash}}function mapCacheDelete(key){var result=getMapData(this,key)["delete"](key);this.size-=result?1:0;return result}function mapCacheGet(key){return getMapData(this, key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function SetCache(values){var index=-1,length=values==null?0:values.length;this.__data__=new MapCache; while(++index<length)this.add(values[index])}function setCacheAdd(value){this.__data__.set(value,HASH_UNDEFINED);return this}function setCacheHas(value){return this.__data__.has(value)}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size}function stackClear(){this.__data__=new ListCache;this.size=0}function stackDelete(key){var data=this.__data__,result=data["delete"](key); this.size=data.size;return result}function stackGet(key){return this.__data__.get(key)}function stackHas(key){return this.__data__.has(key)}function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1){pairs.push([key,value]);this.size=++data.size;return this}data=this.__data__=new MapCache(pairs)}data.set(key,value);this.size=data.size;return this}Stack.prototype.clear=stackClear;Stack.prototype["delete"]=stackDelete; Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?baseTimes(value.length,String):[],length=result.length;for(var key in value)if((inherited||hasOwnProperty.call(value,key))&&!(skipIndexes&&(key=="length"||isBuff&&(key== "offset"||key=="parent")||isType&&(key=="buffer"||key=="byteLength"||key=="byteOffset")||isIndex(key,length))))result.push(key);return result}function arraySample(array){var length=array.length;return length?array[baseRandom(0,length-1)]:undefined}function arraySampleSize(array,n){return shuffleSelf(copyArray(array),baseClamp(n,0,array.length))}function arrayShuffle(array){return shuffleSelf(copyArray(array))}function assignMergeValue(object,key,value){if(value!==undefined&&!eq(object[key],value)|| value===undefined&&!(key in object))baseAssignValue(object,key,value)}function assignValue(object,key,value){var objValue=object[key];if(!(hasOwnProperty.call(object,key)&&eq(objValue,value))||value===undefined&&!(key in object))baseAssignValue(object,key,value)}function assocIndexOf(array,key){var length=array.length;while(length--)if(eq(array[length][0],key))return length;return-1}function baseAggregator(collection,setter,iteratee,accumulator){baseEach(collection,function(value,key,collection){setter(accumulator, value,iteratee(value),collection)});return accumulator}function baseAssign(object,source){return object&©Object(source,keys(source),object)}function baseAssignIn(object,source){return object&©Object(source,keysIn(source),object)}function baseAssignValue(object,key,value){if(key=="__proto__"&&defineProperty)defineProperty(object,key,{"configurable":true,"enumerable":true,"value":value,"writable":true});else object[key]=value}function baseAt(object,paths){var index=-1,length=paths.length,result= Array(length),skip=object==null;while(++index<length)result[index]=skip?undefined:get(object,paths[index]);return result}function baseClamp(number,lower,upper){if(number===number){if(upper!==undefined)number=number<=upper?number:upper;if(lower!==undefined)number=number>=lower?number:lower}return number}function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer)result=object? customizer(value,key,object,stack):customizer(value);if(result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep)return copyArray(value,result)}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value))return cloneBuffer(value,isDeep);if(tag==objectTag||tag==argsTag||isFunc&&!object){result=isFlat||isFunc?{}:initCloneObject(value);if(!isDeep)return isFlat?copySymbolsIn(value,baseAssignIn(result, value)):copySymbols(value,baseAssign(result,value))}else{if(!cloneableTags[tag])return object?value:{};result=initCloneByTag(value,tag,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked)return stacked;stack.set(value,result);if(isSet(value)){value.forEach(function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack))});return result}if(isMap(value)){value.forEach(function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value, stack))});return result}var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys;var props=isArr?undefined:keysFunc(value);arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key]}assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props)}}function baseConformsTo(object,source,props){var length=props.length; if(object==null)return!length;object=Object(object);while(length--){var key=props[length],predicate=source[key],value=object[key];if(value===undefined&&!(key in object)||!predicate(value))return false}return true}function baseDelay(func,wait,args){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);return setTimeout(function(){func.apply(undefined,args)},wait)}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=true,length=array.length, result=[],valuesLength=values.length;if(!length)return result;if(iteratee)values=arrayMap(values,baseUnary(iteratee));if(comparator){includes=arrayIncludesWith;isCommon=false}else if(values.length>=LARGE_ARRAY_SIZE){includes=cacheHas;isCommon=false;values=new SetCache(values)}outer:while(++index<length){var value=array[index],computed=iteratee==null?value:iteratee(value);value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var valuesIndex=valuesLength;while(valuesIndex--)if(values[valuesIndex]=== computed)continue outer;result.push(value)}else if(!includes(values,computed,comparator))result.push(value)}return result}var baseEach=createBaseEach(baseForOwn);var baseEachRight=createBaseEach(baseForOwnRight,true);function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result});return result}function baseExtremum(array,iteratee,comparator){var index=-1,length=array.length;while(++index<length){var value= array[index],current=iteratee(value);if(current!=null&&(computed===undefined?current===current&&!isSymbol(current):comparator(current,computed)))var computed=current,result=value}return result}function baseFill(array,value,start,end){var length=array.length;start=toInteger(start);if(start<0)start=-start>length?0:length+start;end=end===undefined||end>length?length:toInteger(end);if(end<0)end+=length;end=start>end?0:toLength(end);while(start<end)array[start++]=value;return array}function baseFilter(collection, predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection))result.push(value)});return result}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;predicate||(predicate=isFlattenable);result||(result=[]);while(++index<length){var value=array[index];if(depth>0&&predicate(value))if(depth>1)baseFlatten(value,depth-1,predicate,isStrict,result);else arrayPush(result,value);else if(!isStrict)result[result.length]= value}return result}var baseFor=createBaseFor();var baseForRight=createBaseFor(true);function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&index<length)object=object[toKey(path[index++])]; return index&&index==length?object:undefined}function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object))}function baseGetTag(value){if(value==null)return value===undefined?undefinedTag:nullTag;return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}function baseGt(value,other){return value>other}function baseHas(object,key){return object!=null&&hasOwnProperty.call(object, key)}function baseHasIn(object,key){return object!=null&&key in Object(object)}function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number<nativeMax(start,end)}function baseIntersection(arrays,iteratee,comparator){var includes=comparator?arrayIncludesWith:arrayIncludes,length=arrays[0].length,othLength=arrays.length,othIndex=othLength,caches=Array(othLength),maxLength=Infinity,result=[];while(othIndex--){var array=arrays[othIndex];if(othIndex&&iteratee)array=arrayMap(array, baseUnary(iteratee));maxLength=nativeMin(array.length,maxLength);caches[othIndex]=!comparator&&(iteratee||length>=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:while(++index<length&&result.length<maxLength){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(!(seen?cacheHas(seen,computed):includes(result,computed,comparator))){othIndex=othLength;while(--othIndex){var cache=caches[othIndex]; if(!(cache?cacheHas(cache,computed):includes(arrays[othIndex],computed,comparator)))continue outer}if(seen)seen.push(computed);result.push(value)}}return result}function baseInverter(object,setter,iteratee,accumulator){baseForOwn(object,function(value,key,object){setter(accumulator,iteratee(value),key,object)});return accumulator}function baseInvoke(object,path,args){path=castPath(path,object);object=parent(object,path);var func=object==null?object:object[toKey(last(path))];return func==null?undefined: apply(func,object,args)}function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag}function baseIsArrayBuffer(value){return isObjectLike(value)&&baseGetTag(value)==arrayBufferTag}function baseIsDate(value){return isObjectLike(value)&&baseGetTag(value)==dateTag}function baseIsEqual(value,other,bitmask,customizer,stack){if(value===other)return true;if(value==null||other==null||!isObjectLike(value)&&!isObjectLike(other))return value!==value&&other!==other;return baseIsEqualDeep(value, other,bitmask,customizer,baseIsEqual,stack)}function baseIsEqualDeep(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=objIsArr?arrayTag:getTag(object),othTag=othIsArr?arrayTag:getTag(other);objTag=objTag==argsTag?objectTag:objTag;othTag=othTag==argsTag?objectTag:othTag;var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&isBuffer(object)){if(!isBuffer(other))return false;objIsArr=true;objIsObj= false}if(isSameTag&&!objIsObj){stack||(stack=new Stack);return objIsArr||isTypedArray(object)?equalArrays(object,other,bitmask,customizer,equalFunc,stack):equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack)}if(!(bitmask&COMPARE_PARTIAL_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value(): other;stack||(stack=new Stack);return equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack)}}if(!isSameTag)return false;stack||(stack=new Stack);return equalObjects(object,other,bitmask,customizer,equalFunc,stack)}function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag}function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(object==null)return!length;object=Object(object);while(index--){var data=matchData[index]; if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return false}while(++index<length){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(objValue===undefined&&!(key in object))return false}else{var stack=new Stack;if(customizer)var result=customizer(objValue,srcValue,key,object,source,stack);if(!(result===undefined?baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG,customizer,stack):result))return false}}return true} function baseIsNative(value){if(!isObject(value)||isMasked(value))return false;var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseIsRegExp(value){return isObjectLike(value)&&baseGetTag(value)==regexpTag}function baseIsSet(value){return isObjectLike(value)&&getTag(value)==setTag}function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]}function baseIteratee(value){if(typeof value=="function")return value; if(value==null)return identity;if(typeof value=="object")return isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value);return property(value)}function baseKeys(object){if(!isPrototype(object))return nativeKeys(object);var result=[];for(var key in Object(object))if(hasOwnProperty.call(object,key)&&key!="constructor")result.push(key);return result}function baseKeysIn(object){if(!isObject(object))return nativeKeysIn(object);var isProto=isPrototype(object),result=[];for(var key in object)if(!(key== "constructor"&&(isProto||!hasOwnProperty.call(object,key))))result.push(key);return result}function baseLt(value,other){return value<other}function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)});return result}function baseMatches(source){var matchData=getMatchData(source);if(matchData.length==1&&matchData[0][2])return matchesStrictComparable(matchData[0][0], matchData[0][1]);return function(object){return object===source||baseIsMatch(object,source,matchData)}}function baseMatchesProperty(path,srcValue){if(isKey(path)&&isStrictComparable(srcValue))return matchesStrictComparable(toKey(path),srcValue);return function(object){var objValue=get(object,path);return objValue===undefined&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseMerge(object,source,srcIndex,customizer,stack){if(object=== source)return;baseFor(source,function(srcValue,key){if(isObject(srcValue)){stack||(stack=new Stack);baseMergeDeep(object,source,key,srcIndex,baseMerge,customizer,stack)}else{var newValue=customizer?customizer(safeGet(object,key),srcValue,key+"",object,source,stack):undefined;if(newValue===undefined)newValue=srcValue;assignMergeValue(object,key,newValue)}},keysIn)}function baseMergeDeep(object,source,key,srcIndex,mergeFunc,customizer,stack){var objValue=safeGet(object,key),srcValue=safeGet(source, key),stacked=stack.get(srcValue);if(stacked){assignMergeValue(object,key,stacked);return}var newValue=customizer?customizer(objValue,srcValue,key+"",object,source,stack):undefined;var isCommon=newValue===undefined;if(isCommon){var isArr=isArray(srcValue),isBuff=!isArr&&isBuffer(srcValue),isTyped=!isArr&&!isBuff&&isTypedArray(srcValue);newValue=srcValue;if(isArr||isBuff||isTyped)if(isArray(objValue))newValue=objValue;else if(isArrayLikeObject(objValue))newValue=copyArray(objValue);else if(isBuff){isCommon= false;newValue=cloneBuffer(srcValue,true)}else if(isTyped){isCommon=false;newValue=cloneTypedArray(srcValue,true)}else newValue=[];else if(isPlainObject(srcValue)||isArguments(srcValue)){newValue=objValue;if(isArguments(objValue))newValue=toPlainObject(objValue);else if(!isObject(objValue)||srcIndex&&isFunction(objValue))newValue=initCloneObject(srcValue)}else isCommon=false}if(isCommon){stack.set(srcValue,newValue);mergeFunc(newValue,srcValue,srcIndex,customizer,stack);stack["delete"](srcValue)}assignMergeValue(object, key,newValue)}function baseNth(array,n){var length=array.length;if(!length)return;n+=n<0?length:0;return isIndex(n,length)?array[n]:undefined}function baseOrderBy(collection,iteratees,orders){var index=-1;iteratees=arrayMap(iteratees.length?iteratees:[identity],baseUnary(getIteratee()));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value)});return{"criteria":criteria,"index":++index,"value":value}});return baseSortBy(result, function(object,other){return compareMultiple(object,other,orders)})}function basePick(object,paths){return basePickBy(object,paths,function(value,path){return hasIn(object,path)})}function basePickBy(object,paths,predicate){var index=-1,length=paths.length,result={};while(++index<length){var path=paths[index],value=baseGet(object,path);if(predicate(value,path))baseSet(result,castPath(path,object),value)}return result}function basePropertyDeep(path){return function(object){return baseGet(object,path)}} function basePullAll(array,values,iteratee,comparator){var indexOf=comparator?baseIndexOfWith:baseIndexOf,index=-1,length=values.length,seen=array;if(array===values)values=copyArray(values);if(iteratee)seen=arrayMap(array,baseUnary(iteratee));while(++index<length){var fromIndex=0,value=values[index],computed=iteratee?iteratee(value):value;while((fromIndex=indexOf(seen,computed,fromIndex,comparator))>-1){if(seen!==array)splice.call(seen,fromIndex,1);splice.call(array,fromIndex,1)}}return array}function basePullAt(array, indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index))splice.call(array,index,1);else baseUnset(array,index)}}return array}function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight? length:++index]=start;start+=step}return result}function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER)return result;do{if(n%2)result+=string;n=nativeFloor(n/2);if(n)string+=string}while(n);return result}function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}function baseSample(collection){return arraySample(values(collection))}function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length))} function baseSet(object,path,value,customizer){if(!isObject(object))return object;path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]),newValue=value;if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined;if(newValue===undefined)newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{}}assignValue(nested,key,newValue);nested=nested[key]}return object} var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func};var baseSetToString=!defineProperty?identity:function(func,string){return defineProperty(func,"toString",{"configurable":true,"enumerable":false,"value":constant(string),"writable":true})};function baseShuffle(collection){return shuffleSelf(values(collection))}function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0)start=-start>length?0:length+start;end=end>length?length:end;if(end<0)end+= length;length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return!result});return!!result}function baseSortedIndex(array,value,retHighest){var low=0,high=array==null?low:array.length;if(typeof value=="number"&&value===value&&high<=HALF_MAX_ARRAY_LENGTH){while(low<high){var mid= low+high>>>1,computed=array[mid];if(computed!==null&&!isSymbol(computed)&&(retHighest?computed<=value:computed<value))low=mid+1;else high=mid}return high}return baseSortedIndexBy(array,value,identity,retHighest)}function baseSortedIndexBy(array,value,iteratee,retHighest){value=iteratee(value);var low=0,high=array==null?0:array.length,valIsNaN=value!==value,valIsNull=value===null,valIsSymbol=isSymbol(value),valIsUndefined=value===undefined;while(low<high){var mid=nativeFloor((low+high)/2),computed= iteratee(array[mid]),othIsDefined=computed!==undefined,othIsNull=computed===null,othIsReflexive=computed===computed,othIsSymbol=isSymbol(computed);if(valIsNaN)var setLow=retHighest||othIsReflexive;else if(valIsUndefined)setLow=othIsReflexive&&(retHighest||othIsDefined);else if(valIsNull)setLow=othIsReflexive&&othIsDefined&&(retHighest||!othIsNull);else if(valIsSymbol)setLow=othIsReflexive&&othIsDefined&&!othIsNull&&(retHighest||!othIsSymbol);else if(othIsNull||othIsSymbol)setLow=false;else setLow= retHighest?computed<=value:computed<value;if(setLow)low=mid+1;else high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function baseSortedUniq(array,iteratee){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;if(!index||!eq(computed,seen)){var seen=computed;result[resIndex++]=value===0?0:value}}return result}function baseToNumber(value){if(typeof value=="number")return value;if(isSymbol(value))return NAN;return+value} function baseToString(value){if(typeof value=="string")return value;if(isArray(value))return arrayMap(value,baseToString)+"";if(isSymbol(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function baseUniq(array,iteratee,comparator){var index=-1,includes=arrayIncludes,length=array.length,isCommon=true,result=[],seen=result;if(comparator){isCommon=false;includes=arrayIncludesWith}else if(length>=LARGE_ARRAY_SIZE){var set= iteratee?null:createSet(array);if(set)return setToArray(set);isCommon=false;includes=cacheHas;seen=new SetCache}else seen=iteratee?[]:result;outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var seenIndex=seen.length;while(seenIndex--)if(seen[seenIndex]===computed)continue outer;if(iteratee)seen.push(computed);result.push(value)}else if(!includes(seen,computed,comparator)){if(seen!==result)seen.push(computed); result.push(value)}}return result}function baseUnset(object,path){path=castPath(path,object);object=parent(object,path);return object==null||delete object[toKey(last(path))]}function baseUpdate(object,path,updater,customizer){return baseSet(object,path,updater(baseGet(object,path)),customizer)}function baseWhile(array,predicate,isDrop,fromRight){var length=array.length,index=fromRight?length:-1;while((fromRight?index--:++index<length)&&predicate(array[index],index,array));return isDrop?baseSlice(array, fromRight?0:index,fromRight?index+1:length):baseSlice(array,fromRight?index+1:0,fromRight?length:index)}function baseWrapperValue(value,actions){var result=value;if(result instanceof LazyWrapper)result=result.value();return arrayReduce(actions,function(result,action){return action.func.apply(action.thisArg,arrayPush([result],action.args))},result)}function baseXor(arrays,iteratee,comparator){var length=arrays.length;if(length<2)return length?baseUniq(arrays[0]):[];var index=-1,result=Array(length); while(++index<length){var array=arrays[index],othIndex=-1;while(++othIndex<length)if(othIndex!=index)result[index]=baseDifference(result[index]||array,arrays[othIndex],iteratee,comparator)}return baseUniq(baseFlatten(result,1),iteratee,comparator)}function baseZipObject(props,values,assignFunc){var index=-1,length=props.length,valsLength=values.length,result={};while(++index<length){var value=index<valsLength?values[index]:undefined;assignFunc(result,props[index],value)}return result}function castArrayLikeObject(value){return isArrayLikeObject(value)? value:[]}function castFunction(value){return typeof value=="function"?value:identity}function castPath(value,object){if(isArray(value))return value;return isKey(value,object)?[value]:stringToPath(toString(value))}var castRest=baseRest;function castSlice(array,start,end){var length=array.length;end=end===undefined?length:end;return!start&&end>=length?array:baseSlice(array,start,end)}var clearTimeout=ctxClearTimeout||function(id){return root.clearTimeout(id)};function cloneBuffer(buffer,isDeep){if(isDeep)return buffer.slice(); var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);buffer.copy(result);return result}function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);(new Uint8Array(result)).set(new Uint8Array(arrayBuffer));return result}function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}function cloneRegExp(regexp){var result= new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result}function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=value=== null,valIsReflexive=value===value,valIsSymbol=isSymbol(value);var othIsDefined=other!==undefined,othIsNull=other===null,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive)return 1;if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value<other||othIsSymbol&&valIsDefined&&valIsReflexive&&!valIsNull&& !valIsSymbol||othIsNull&&valIsDefined&&valIsReflexive||!othIsDefined&&valIsReflexive||!othIsReflexive)return-1}return 0}function compareMultiple(object,other,orders){var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length,ordersLength=orders.length;while(++index<length){var result=compareAscending(objCriteria[index],othCriteria[index]);if(result){if(index>=ordersLength)return result;var order=orders[index];return result*(order=="desc"?-1:1)}}return object.index- other.index}function composeArgs(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;while(++leftIndex<leftLength)result[leftIndex]=partials[leftIndex];while(++argsIndex<holdersLength)if(isUncurried||argsIndex<argsLength)result[holders[argsIndex]]=args[argsIndex];while(rangeLength--)result[leftIndex++]= args[argsIndex++];return result}function composeArgsRight(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersIndex=-1,holdersLength=holders.length,rightIndex=-1,rightLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(rangeLength+rightLength),isUncurried=!isCurried;while(++argsIndex<rangeLength)result[argsIndex]=args[argsIndex];var offset=argsIndex;while(++rightIndex<rightLength)result[offset+rightIndex]=partials[rightIndex];while(++holdersIndex< holdersLength)if(isUncurried||argsIndex<argsLength)result[offset+holders[holdersIndex]]=args[argsIndex++];return result}function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length)array[index]=source[index];return array}function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});var index=-1,length=props.length;while(++index<length){var key=props[index];var newValue=customizer?customizer(object[key],source[key], key,object,source):undefined;if(newValue===undefined)newValue=source[key];if(isNew)baseAssignValue(object,key,newValue);else assignValue(object,key,newValue)}return object}function copySymbols(source,object){return copyObject(source,getSymbols(source),object)}function copySymbolsIn(source,object){return copyObject(source,getSymbolsIn(source),object)}function createAggregator(setter,initializer){return function(collection,iteratee){var func=isArray(collection)?arrayAggregator:baseAggregator,accumulator= initializer?initializer():{};return func(collection,setter,getIteratee(iteratee,2),accumulator)}}function createAssigner(assigner){return baseRest(function(object,sources){var index=-1,length=sources.length,customizer=length>1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object); while(++index<length){var source=sources[index];if(source)assigner(object,source,index,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){if(collection==null)return collection;if(!isArrayLike(collection))return eachFunc(collection,iteratee);var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);while(fromRight?index--:++index<length)if(iteratee(iterable[index],index,iterable)===false)break;return collection}}function createBaseFor(fromRight){return function(object, iteratee,keysFunc){var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;while(length--){var key=props[fromRight?length:++index];if(iteratee(iterable[key],key,iterable)===false)break}return object}}function createBind(func,bitmask,thisArg){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return fn.apply(isBind?thisArg:this,arguments)}return wrapper}function createCaseFirst(methodName){return function(string){string= toString(string);var strSymbols=hasUnicode(string)?stringToArray(string):undefined;var chr=strSymbols?strSymbols[0]:string.charAt(0);var trailing=strSymbols?castSlice(strSymbols,1).join(""):string.slice(1);return chr[methodName]()+trailing}}function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,"")),callback,"")}}function createCtor(Ctor){return function(){var args=arguments;switch(args.length){case 0:return new Ctor;case 1:return new Ctor(args[0]); case 2:return new Ctor(args[0],args[1]);case 3:return new Ctor(args[0],args[1],args[2]);case 4:return new Ctor(args[0],args[1],args[2],args[3]);case 5:return new Ctor(args[0],args[1],args[2],args[3],args[4]);case 6:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5]);case 7:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5],args[6])}var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,args);return isObject(result)?result:thisBinding}}function createCurry(func, bitmask,arity){var Ctor=createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length,placeholder=getHolder(wrapper);while(index--)args[index]=arguments[index];var holders=length<3&&args[0]!==placeholder&&args[length-1]!==placeholder?[]:replaceHolders(args,placeholder);length-=holders.length;if(length<arity)return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,undefined,args,holders,undefined,undefined,arity-length);var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return apply(fn,this,args)}return wrapper}function createFind(findIndexFunc){return function(collection,predicate,fromIndex){var iterable=Object(collection);if(!isArrayLike(collection)){var iteratee=getIteratee(predicate,3);collection=keys(collection);predicate=function(key){return iteratee(iterable[key],key,iterable)}}var index=findIndexFunc(collection,predicate,fromIndex);return index>-1?iterable[iteratee?collection[index]:index]:undefined}}function createFlow(fromRight){return flatRest(function(funcs){var length= funcs.length,index=length,prereq=LodashWrapper.prototype.thru;if(fromRight)funcs.reverse();while(index--){var func=funcs[index];if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);if(prereq&&!wrapper&&getFuncName(func)=="wrapper")var wrapper=new LodashWrapper([],true)}index=wrapper?index:length;while(++index<length){func=funcs[index];var funcName=getFuncName(func),data=funcName=="wrapper"?getData(func):undefined;if(data&&isLaziable(data[0])&&data[1]==(WRAP_ARY_FLAG|WRAP_CURRY_FLAG|WRAP_PARTIAL_FLAG| WRAP_REARG_FLAG)&&!data[4].length&&data[9]==1)wrapper=wrapper[getFuncName(data[0])].apply(wrapper,data[3]);else wrapper=func.length==1&&isLaziable(func)?wrapper[funcName]():wrapper.thru(func)}return function(){var args=arguments,value=args[0];if(wrapper&&args.length==1&&isArray(value))return wrapper.plant(value).value();var index=0,result=length?funcs[index].apply(this,args):value;while(++index<length)result=funcs[index].call(this,result);return result}})}function createHybrid(func,bitmask,thisArg, partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&WRAP_ARY_FLAG,isBind=bitmask&WRAP_BIND_FLAG,isBindKey=bitmask&WRAP_BIND_KEY_FLAG,isCurried=bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG),isFlip=bitmask&WRAP_FLIP_FLAG,Ctor=isBindKey?undefined:createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length;while(index--)args[index]=arguments[index];if(isCurried)var placeholder=getHolder(wrapper),holdersCount=countHolders(args,placeholder); if(partials)args=composeArgs(args,partials,holders,isCurried);if(partialsRight)args=composeArgsRight(args,partialsRight,holdersRight,isCurried);length-=holdersCount;if(isCurried&&length<arity){var newHolders=replaceHolders(args,placeholder);return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,thisArg,args,newHolders,argPos,ary,arity-length)}var thisBinding=isBind?thisArg:this,fn=isBindKey?thisBinding[func]:func;length=args.length;if(argPos)args=reorder(args,argPos);else if(isFlip&&length> 1)args.reverse();if(isAry&&ary<length)args.length=ary;if(this&&this!==root&&this instanceof wrapper)fn=Ctor||createCtor(fn);return fn.apply(thisBinding,args)}return wrapper}function createInverter(setter,toIteratee){return function(object,iteratee){return baseInverter(object,setter,toIteratee(iteratee),{})}}function createMathOperation(operator,defaultValue){return function(value,other){var result;if(value===undefined&&other===undefined)return defaultValue;if(value!==undefined)result=value;if(other!== undefined){if(result===undefined)return other;if(typeof value=="string"||typeof other=="string"){value=baseToString(value);other=baseToString(other)}else{value=baseToNumber(value);other=baseToNumber(other)}result=operator(value,other)}return result}}function createOver(arrayFunc){return flatRest(function(iteratees){iteratees=arrayMap(iteratees,baseUnary(getIteratee()));return baseRest(function(args){var thisArg=this;return arrayFunc(iteratees,function(iteratee){return apply(iteratee,thisArg,args)})})})} function createPadding(length,chars){chars=chars===undefined?" ":baseToString(chars);var charsLength=chars.length;if(charsLength<2)return charsLength?baseRepeat(chars,length):chars;var result=baseRepeat(chars,nativeCeil(length/stringSize(chars)));return hasUnicode(chars)?castSlice(stringToArray(result),0,length).join(""):result.slice(0,length)}function createPartial(func,bitmask,thisArg,partials){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var argsIndex=-1,argsLength= arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(leftLength+argsLength),fn=this&&this!==root&&this instanceof wrapper?Ctor:func;while(++leftIndex<leftLength)args[leftIndex]=partials[leftIndex];while(argsLength--)args[leftIndex++]=arguments[++argsIndex];return apply(fn,isBind?thisArg:this,args)}return wrapper}function createRange(fromRight){return function(start,end,step){if(step&&typeof step!="number"&&isIterateeCall(start,end,step))end=step=undefined;start=toFinite(start);if(end=== undefined){end=start;start=0}else end=toFinite(end);step=step===undefined?start<end?1:-1:toFinite(step);return baseRange(start,end,step,fromRight)}}function createRelationalOperation(operator){return function(value,other){if(!(typeof value=="string"&&typeof other=="string")){value=toNumber(value);other=toNumber(other)}return operator(value,other)}}function createRecurry(func,bitmask,wrapFunc,placeholder,thisArg,partials,holders,argPos,ary,arity){var isCurry=bitmask&WRAP_CURRY_FLAG,newHolders=isCurry? holders:undefined,newHoldersRight=isCurry?undefined:holders,newPartials=isCurry?partials:undefined,newPartialsRight=isCurry?undefined:partials;bitmask|=isCurry?WRAP_PARTIAL_FLAG:WRAP_PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?WRAP_PARTIAL_RIGHT_FLAG:WRAP_PARTIAL_FLAG);if(!(bitmask&WRAP_CURRY_BOUND_FLAG))bitmask&=~(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG);var newData=[func,bitmask,thisArg,newPartials,newHolders,newPartialsRight,newHoldersRight,argPos,ary,arity];var result=wrapFunc.apply(undefined,newData);if(isLaziable(func))setData(result, newData);result.placeholder=placeholder;return setWrapToString(result,func,bitmask)}function createRound(methodName){var func=Math[methodName];return function(number,precision){number=toNumber(number);precision=precision==null?0:nativeMin(toInteger(precision),292);if(precision){var pair=(toString(number)+"e").split("e"),value=func(pair[0]+"e"+(+pair[1]+precision));pair=(toString(value)+"e").split("e");return+(pair[0]+"e"+(+pair[1]-precision))}return func(number)}}var createSet=!(Set&&1/setToArray(new Set([, -0]))[1]==INFINITY)?noop:function(values){return new Set(values)};function createToPairs(keysFunc){return function(object){var tag=getTag(object);if(tag==mapTag)return mapToArray(object);if(tag==setTag)return setToPairs(object);return baseToPairs(object,keysFunc(object))}}function createWrap(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&WRAP_BIND_KEY_FLAG;if(!isBindKey&&typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);var length=partials?partials.length: 0;if(!length){bitmask&=~(WRAP_PARTIAL_FLAG|WRAP_PARTIAL_RIGHT_FLAG);partials=holders=undefined}ary=ary===undefined?ary:nativeMax(toInteger(ary),0);arity=arity===undefined?arity:toInteger(arity);length-=holders?holders.length:0;if(bitmask&WRAP_PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=undefined}var data=isBindKey?undefined:getData(func);var newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];if(data)mergeData(newData, data);func=newData[0];bitmask=newData[1];thisArg=newData[2];partials=newData[3];holders=newData[4];arity=newData[9]=newData[9]===undefined?isBindKey?0:func.length:nativeMax(newData[9]-length,0);if(!arity&&bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG))bitmask&=~(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG);if(!bitmask||bitmask==WRAP_BIND_FLAG)var result=createBind(func,bitmask,thisArg);else if(bitmask==WRAP_CURRY_FLAG||bitmask==WRAP_CURRY_RIGHT_FLAG)result=createCurry(func,bitmask,arity);else if((bitmask== WRAP_PARTIAL_FLAG||bitmask==(WRAP_BIND_FLAG|WRAP_PARTIAL_FLAG))&&!holders.length)result=createPartial(func,bitmask,thisArg,partials);else result=createHybrid.apply(undefined,newData);var setter=data?baseSetData:setData;return setWrapToString(setter(result,newData),func,bitmask)}function customDefaultsAssignIn(objValue,srcValue,key,object){if(objValue===undefined||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key))return srcValue;return objValue}function customDefaultsMerge(objValue,srcValue, key,object,source,stack){if(isObject(objValue)&&isObject(srcValue)){stack.set(srcValue,objValue);baseMerge(objValue,srcValue,undefined,customDefaultsMerge,stack);stack["delete"](srcValue)}return objValue}function customOmitClone(value){return isPlainObject(value)?undefined:value}function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength))return false; var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;stack.set(array,other);stack.set(other,array);while(++index<arrLength){var arrValue=array[index],othValue=other[index];if(customizer)var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);if(compared!==undefined){if(compared)continue;result=false;break}if(seen){if(!arraySome(other, function(othValue,othIndex){if(!cacheHas(seen,othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack)))return seen.push(othIndex)})){result=false;break}}else if(!(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){result=false;break}}stack["delete"](array);stack["delete"](other);return result}function equalByTag(object,other,tag,bitmask,customizer,equalFunc,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!= other.byteOffset)return false;object=object.buffer;other=other.buffer;case arrayBufferTag:if(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other)))return false;return true;case boolTag:case dateTag:case numberTag:return eq(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:return object==other+"";case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&COMPARE_PARTIAL_FLAG;convert|| (convert=setToArray);if(object.size!=other.size&&!isPartial)return false;var stacked=stack.get(object);if(stacked)return stacked==other;bitmask|=COMPARE_UNORDERED_FLAG;stack.set(object,other);var result=equalArrays(convert(object),convert(other),bitmask,customizer,equalFunc,stack);stack["delete"](object);return result;case symbolTag:if(symbolValueOf)return symbolValueOf.call(object)==symbolValueOf.call(other)}return false}function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial= bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial)return false;var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key)))return false}var stacked=stack.get(object);if(stacked&&stack.get(other))return stacked==other;var result=true;stack.set(object,other);stack.set(other,object);var skipCtor=isPartial;while(++index<objLength){key= objProps[index];var objValue=object[key],othValue=other[key];if(customizer)var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);if(!(compared===undefined?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=false;break}skipCtor||(skipCtor=key=="constructor")}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&("constructor"in object&&"constructor"in other)&&!(typeof objCtor=="function"&&objCtor instanceof objCtor&&typeof othCtor=="function"&&othCtor instanceof othCtor))result=false}stack["delete"](object);stack["delete"](other);return result}function flatRest(func){return setToString(overRest(func,undefined,flatten),func+"")}function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols)}function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}var getData=!metaMap?noop:function(func){return metaMap.get(func)}; function getFuncName(func){var result=func.name+"",array=realNames[result],length=hasOwnProperty.call(realNames,result)?array.length:0;while(length--){var data=array[length],otherFunc=data.func;if(otherFunc==null||otherFunc==func)return data.name}return result}function getHolder(func){var object=hasOwnProperty.call(lodash,"placeholder")?lodash:func;return object.placeholder}function getIteratee(){var result=lodash.iteratee||iteratee;result=result===iteratee?baseIteratee:result;return arguments.length? result(arguments[0],arguments[1]):result}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getMatchData(object){var result=keys(object),length=result.length;while(length--){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function getRawTag(value){var isOwn= hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=undefined;var unmasked=true}catch(e){}var result=nativeObjectToString.call(value);if(unmasked)if(isOwn)value[symToStringTag]=tag;else delete value[symToStringTag];return result}var getSymbols=!nativeGetSymbols?stubArray:function(object){if(object==null)return[];object=Object(object);return arrayFilter(nativeGetSymbols(object),function(symbol){return propertyIsEnumerable.call(object,symbol)})};var getSymbolsIn= !nativeGetSymbols?stubArray:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object)}return result};var getTag=baseGetTag;if(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)getTag=function(value){var result=baseGetTag(value),Ctor=result==objectTag?value.constructor:undefined,ctorString= Ctor?toSource(Ctor):"";if(ctorString)switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return result};function getView(start,end,transforms){var index=-1,length=transforms.length;while(++index<length){var data=transforms[index],size=data.size;switch(data.type){case "drop":start+=size;break;case "dropRight":end-=size;break;case "take":end=nativeMin(end, start+size);break;case "takeRight":start=nativeMax(start,end-size);break}}return{"start":start,"end":end}}function getWrapDetails(source){var match=source.match(reWrapDetails);return match?match[1].split(reSplitDetails):[]}function hasPath(object,path,hasFunc){path=castPath(path,object);var index=-1,length=path.length,result=false;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key)))break;object=object[key]}if(result||++index!=length)return result;length= object==null?0:object.length;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object))}function initCloneArray(array){var length=array.length,result=new array.constructor(length);if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}function initCloneByTag(object, tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return cloneArrayBuffer(object);case boolTag:case dateTag:return new Ctor(+object);case dataViewTag:return cloneDataView(object,isDeep);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:return cloneTypedArray(object,isDeep);case mapTag:return new Ctor;case numberTag:case stringTag:return new Ctor(object);case regexpTag:return cloneRegExp(object); case setTag:return new Ctor;case symbolTag:return cloneSymbol(object)}}function insertWrapDetails(source,details){var length=details.length;if(!length)return source;var lastIndex=length-1;details[lastIndex]=(length>1?"\x26 ":"")+details[lastIndex];details=details.join(length>2?", ":" ");return source.replace(reWrapComment,"{\n/* [wrapped with "+details+"] */\n")}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isIndex(value, length){var type=typeof value;length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(type=="number"||type!="symbol"&&reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}function isIterateeCall(value,index,object){if(!isObject(object))return false;var type=typeof index;if(type=="number"?isArrayLike(object)&&isIndex(index,object.length):type=="string"&&index in object)return eq(object[index],value);return false}function isKey(value,object){if(isArray(value))return false;var type=typeof value; if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value))return true;return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isLaziable(func){var funcName=getFuncName(func),other=lodash[funcName];if(typeof other!="function"||!(funcName in LazyWrapper.prototype))return false; if(func===other)return true;var data=getData(other);return!!data&&func===data[0]}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var isMaskable=coreJsData?isFunction:stubFalse;function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto;return value===proto}function isStrictComparable(value){return value===value&&!isObject(value)}function matchesStrictComparable(key,srcValue){return function(object){if(object==null)return false; return object[key]===srcValue&&(srcValue!==undefined||key in Object(object))}}function memoizeCapped(func){var result=memoize(func,function(key){if(cache.size===MAX_MEMOIZE_SIZE)cache.clear();return key});var cache=result.cache;return result}function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask<(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG|WRAP_ARY_FLAG);var isCombo=srcBitmask==WRAP_ARY_FLAG&&bitmask==WRAP_CURRY_FLAG||srcBitmask==WRAP_ARY_FLAG&& bitmask==WRAP_REARG_FLAG&&data[7].length<=source[8]||srcBitmask==(WRAP_ARY_FLAG|WRAP_REARG_FLAG)&&source[7].length<=source[8]&&bitmask==WRAP_CURRY_FLAG;if(!(isCommon||isCombo))return data;if(srcBitmask&WRAP_BIND_FLAG){data[2]=source[2];newBitmask|=bitmask&WRAP_BIND_FLAG?0:WRAP_CURRY_BOUND_FLAG}var value=source[3];if(value){var partials=data[3];data[3]=partials?composeArgs(partials,value,source[4]):value;data[4]=partials?replaceHolders(data[3],PLACEHOLDER):source[4]}value=source[5];if(value){partials= data[5];data[5]=partials?composeArgsRight(partials,value,source[6]):value;data[6]=partials?replaceHolders(data[5],PLACEHOLDER):source[6]}value=source[7];if(value)data[7]=value;if(srcBitmask&WRAP_ARY_FLAG)data[8]=data[8]==null?source[8]:nativeMin(data[8],source[8]);if(data[9]==null)data[9]=source[9];data[0]=source[0];data[1]=newBitmask;return data}function nativeKeysIn(object){var result=[];if(object!=null)for(var key in Object(object))result.push(key);return result}function objectToString(value){return nativeObjectToString.call(value)} function overRest(func,start,transform){start=nativeMax(start===undefined?func.length-1:start,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index<length)array[index]=args[start+index];index=-1;var otherArgs=Array(start+1);while(++index<start)otherArgs[index]=args[index];otherArgs[start]=transform(array);return apply(func,this,otherArgs)}}function parent(object,path){return path.length<2?object:baseGet(object,baseSlice(path,0,-1))} function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=copyArray(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined}return array}var setData=shortOut(baseSetData);var setTimeout=ctxSetTimeout||function(func,wait){return root.setTimeout(func,wait)};var setToString=shortOut(baseSetToString);function setWrapToString(wrapper,reference,bitmask){var source=reference+"";return setToString(wrapper, insertWrapDetails(source,updateWrapDetails(getWrapDetails(source),bitmask)))}function shortOut(func){var count=0,lastCalled=0;return function(){var stamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT)return arguments[0]}else count=0;return func.apply(undefined,arguments)}}function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;size=size===undefined?length:size;while(++index<size){var rand=baseRandom(index,lastIndex), value=array[rand];array[rand]=array[index];array[index]=value}array.length=size;return array}var stringToPath=memoizeCapped(function(string){var result=[];if(string.charCodeAt(0)===46)result.push("");string.replace(rePropName,function(match,number,quote,subString){result.push(quote?subString.replace(reEscapeChar,"$1"):number||match)});return result});function toKey(value){if(typeof value=="string"||isSymbol(value))return value;var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result} function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e$0){}}return""}function updateWrapDetails(details,bitmask){arrayEach(wrapFlags,function(pair){var value="_."+pair[0];if(bitmask&pair[1]&&!arrayIncludes(details,value))details.push(value)});return details.sort()}function wrapperClone(wrapper){if(wrapper instanceof LazyWrapper)return wrapper.clone();var result=new LodashWrapper(wrapper.__wrapped__,wrapper.__chain__);result.__actions__=copyArray(wrapper.__actions__); result.__index__=wrapper.__index__;result.__values__=wrapper.__values__;return result}function chunk(array,size,guard){if(guard?isIterateeCall(array,size,guard):size===undefined)size=1;else size=nativeMax(toInteger(size),0);var length=array==null?0:array.length;if(!length||size<1)return[];var index=0,resIndex=0,result=Array(nativeCeil(length/size));while(index<length)result[resIndex++]=baseSlice(array,index,index+=size);return result}function compact(array){var index=-1,length=array==null?0:array.length, resIndex=0,result=[];while(++index<length){var value=array[index];if(value)result[resIndex++]=value}return result}function concat(){var length=arguments.length;if(!length)return[];var args=Array(length-1),array=arguments[0],index=length;while(index--)args[index-1]=arguments[index];return arrayPush(isArray(array)?copyArray(array):[array],baseFlatten(args,1))}var difference=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true)): []});var differenceBy=baseRest(function(array,values){var iteratee=last(values);if(isArrayLikeObject(iteratee))iteratee=undefined;return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),getIteratee(iteratee,2)):[]});var differenceWith=baseRest(function(array,values){var comparator=last(values);if(isArrayLikeObject(comparator))comparator=undefined;return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),undefined,comparator): []});function drop(array,n,guard){var length=array==null?0:array.length;if(!length)return[];n=guard||n===undefined?1:toInteger(n);return baseSlice(array,n<0?0:n,length)}function dropRight(array,n,guard){var length=array==null?0:array.length;if(!length)return[];n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,0,n<0?0:n)}function dropRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true,true):[]}function dropWhile(array,predicate){return array&& array.length?baseWhile(array,getIteratee(predicate,3),true):[]}function fill(array,value,start,end){var length=array==null?0:array.length;if(!length)return[];if(start&&typeof start!="number"&&isIterateeCall(array,value,start)){start=0;end=length}return baseFill(array,value,start,end)}function findIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length)return-1;var index=fromIndex==null?0:toInteger(fromIndex);if(index<0)index=nativeMax(length+index,0);return baseFindIndex(array, getIteratee(predicate,3),index)}function findLastIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length)return-1;var index=length-1;if(fromIndex!==undefined){index=toInteger(fromIndex);index=fromIndex<0?nativeMax(length+index,0):nativeMin(index,length-1)}return baseFindIndex(array,getIteratee(predicate,3),index,true)}function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[]}function flattenDeep(array){var length=array==null?0:array.length; return length?baseFlatten(array,INFINITY):[]}function flattenDepth(array,depth){var length=array==null?0:array.length;if(!length)return[];depth=depth===undefined?1:toInteger(depth);return baseFlatten(array,depth)}function fromPairs(pairs){var index=-1,length=pairs==null?0:pairs.length,result={};while(++index<length){var pair=pairs[index];result[pair[0]]=pair[1]}return result}function head(array){return array&&array.length?array[0]:undefined}function indexOf(array,value,fromIndex){var length=array== null?0:array.length;if(!length)return-1;var index=fromIndex==null?0:toInteger(fromIndex);if(index<0)index=nativeMax(length+index,0);return baseIndexOf(array,value,index)}function initial(array){var length=array==null?0:array.length;return length?baseSlice(array,0,-1):[]}var intersection=baseRest(function(arrays){var mapped=arrayMap(arrays,castArrayLikeObject);return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped):[]});var intersectionBy=baseRest(function(arrays){var iteratee=last(arrays), mapped=arrayMap(arrays,castArrayLikeObject);if(iteratee===last(mapped))iteratee=undefined;else mapped.pop();return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,getIteratee(iteratee,2)):[]});var intersectionWith=baseRest(function(arrays){var comparator=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);comparator=typeof comparator=="function"?comparator:undefined;if(comparator)mapped.pop();return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,undefined,comparator): []});function join(array,separator){return array==null?"":nativeJoin.call(array,separator)}function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined}function lastIndexOf(array,value,fromIndex){var length=array==null?0:array.length;if(!length)return-1;var index=length;if(fromIndex!==undefined){index=toInteger(fromIndex);index=index<0?nativeMax(length+index,0):nativeMin(index,length-1)}return value===value?strictLastIndexOf(array,value,index):baseFindIndex(array, baseIsNaN,index,true)}function nth(array,n){return array&&array.length?baseNth(array,toInteger(n)):undefined}var pull=baseRest(pullAll);function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array}function pullAllBy(array,values,iteratee){return array&&array.length&&values&&values.length?basePullAll(array,values,getIteratee(iteratee,2)):array}function pullAllWith(array,values,comparator){return array&&array.length&&values&&values.length?basePullAll(array, values,undefined,comparator):array}var pullAt=flatRest(function(array,indexes){var length=array==null?0:array.length,result=baseAt(array,indexes);basePullAt(array,arrayMap(indexes,function(index){return isIndex(index,length)?+index:index}).sort(compareAscending));return result});function remove(array,predicate){var result=[];if(!(array&&array.length))return result;var index=-1,indexes=[],length=array.length;predicate=getIteratee(predicate,3);while(++index<length){var value=array[index];if(predicate(value, index,array)){result.push(value);indexes.push(index)}}basePullAt(array,indexes);return result}function reverse(array){return array==null?array:nativeReverse.call(array)}function slice(array,start,end){var length=array==null?0:array.length;if(!length)return[];if(end&&typeof end!="number"&&isIterateeCall(array,start,end)){start=0;end=length}else{start=start==null?0:toInteger(start);end=end===undefined?length:toInteger(end)}return baseSlice(array,start,end)}function sortedIndex(array,value){return baseSortedIndex(array, value)}function sortedIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2))}function sortedIndexOf(array,value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value);if(index<length&&eq(array[index],value))return index}return-1}function sortedLastIndex(array,value){return baseSortedIndex(array,value,true)}function sortedLastIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2),true)}function sortedLastIndexOf(array, value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value,true)-1;if(eq(array[index],value))return index}return-1}function sortedUniq(array){return array&&array.length?baseSortedUniq(array):[]}function sortedUniqBy(array,iteratee){return array&&array.length?baseSortedUniq(array,getIteratee(iteratee,2)):[]}function tail(array){var length=array==null?0:array.length;return length?baseSlice(array,1,length):[]}function take(array,n,guard){if(!(array&&array.length))return[]; n=guard||n===undefined?1:toInteger(n);return baseSlice(array,0,n<0?0:n)}function takeRight(array,n,guard){var length=array==null?0:array.length;if(!length)return[];n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,n<0?0:n,length)}function takeRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),false,true):[]}function takeWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3)):[]}var union=baseRest(function(arrays){return baseUniq(baseFlatten(arrays, 1,isArrayLikeObject,true))});var unionBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee))iteratee=undefined;return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),getIteratee(iteratee,2))});var unionWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=="function"?comparator:undefined;return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),undefined,comparator)});function uniq(array){return array&&array.length?baseUniq(array): []}function uniqBy(array,iteratee){return array&&array.length?baseUniq(array,getIteratee(iteratee,2)):[]}function uniqWith(array,comparator){comparator=typeof comparator=="function"?comparator:undefined;return array&&array.length?baseUniq(array,undefined,comparator):[]}function unzip(array){if(!(array&&array.length))return[];var length=0;array=arrayFilter(array,function(group){if(isArrayLikeObject(group)){length=nativeMax(group.length,length);return true}});return baseTimes(length,function(index){return arrayMap(array, baseProperty(index))})}function unzipWith(array,iteratee){if(!(array&&array.length))return[];var result=unzip(array);if(iteratee==null)return result;return arrayMap(result,function(group){return apply(iteratee,undefined,group)})}var without=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,values):[]});var xor=baseRest(function(arrays){return baseXor(arrayFilter(arrays,isArrayLikeObject))});var xorBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee))iteratee= undefined;return baseXor(arrayFilter(arrays,isArrayLikeObject),getIteratee(iteratee,2))});var xorWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=="function"?comparator:undefined;return baseXor(arrayFilter(arrays,isArrayLikeObject),undefined,comparator)});var zip=baseRest(unzip);function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue)}function zipObjectDeep(props,values){return baseZipObject(props||[],values||[],baseSet)}var zipWith= baseRest(function(arrays){var length=arrays.length,iteratee=length>1?arrays[length-1]:undefined;iteratee=typeof iteratee=="function"?(arrays.pop(),iteratee):undefined;return unzipWith(arrays,iteratee)});function chain(value){var result=lodash(value);result.__chain__=true;return result}function tap(value,interceptor){interceptor(value);return value}function thru(value,interceptor){return interceptor(value)}var wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value= this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};if(length>1||this.__actions__.length||!(value instanceof LazyWrapper)||!isIndex(start))return this.thru(interceptor);value=value.slice(start,+start+(length?1:0));value.__actions__.push({"func":thru,"args":[interceptor],"thisArg":undefined});return(new LodashWrapper(value,this.__chain__)).thru(function(array){if(length&&!array.length)array.push(undefined);return array})});function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(), this.__chain__)}function wrapperNext(){if(this.__values__===undefined)this.__values__=toArray(this.value());var done=this.__index__>=this.__values__.length,value=done?undefined:this.__values__[this.__index__++];return{"done":done,"value":value}}function wrapperToIterator(){return this}function wrapperPlant(value){var result,parent=this;while(parent instanceof baseLodash){var clone=wrapperClone(parent);clone.__index__=0;clone.__values__=undefined;if(result)previous.__wrapped__=clone;else result=clone; var previous=clone;parent=parent.__wrapped__}previous.__wrapped__=value;return result}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;if(this.__actions__.length)wrapped=new LazyWrapper(this);wrapped=wrapped.reverse();wrapped.__actions__.push({"func":thru,"args":[reverse],"thisArg":undefined});return new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)} var countBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key))++result[key];else baseAssignValue(result,key,1)});function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;if(guard&&isIterateeCall(collection,predicate,guard))predicate=undefined;return func(collection,getIteratee(predicate,3))}function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3))}var find= createFind(findIndex);var findLast=createFind(findLastIndex);function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}function flatMapDepth(collection,iteratee,depth){depth=depth===undefined?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth)}function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee, 3))}function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3))}var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key))result[key].push(value);else baseAssignValue(result,key,[value])});function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection);fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length; if(fromIndex<0)fromIndex=nativeMax(length+fromIndex,0);return isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}var invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc=typeof path=="function",result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args)});return result});var keyBy=createAggregator(function(result, value,key){baseAssignValue(result,key,value)});function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3))}function orderBy(collection,iteratees,orders,guard){if(collection==null)return[];if(!isArray(iteratees))iteratees=iteratees==null?[]:[iteratees];orders=guard?undefined:orders;if(!isArray(orders))orders=orders==null?[]:[orders];return baseOrderBy(collection,iteratees,orders)}var partition=createAggregator(function(result,value, key){result[key?0:1].push(value)},function(){return[[],[]]});function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}function reject(collection, predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,negate(getIteratee(predicate,3)))}function sample(collection){var func=isArray(collection)?arraySample:baseSample;return func(collection)}function sampleSize(collection,n,guard){if(guard?isIterateeCall(collection,n,guard):n===undefined)n=1;else n=toInteger(n);var func=isArray(collection)?arraySampleSize:baseSampleSize;return func(collection,n)}function shuffle(collection){var func=isArray(collection)?arrayShuffle: baseShuffle;return func(collection)}function size(collection){if(collection==null)return 0;if(isArrayLike(collection))return isString(collection)?stringSize(collection):collection.length;var tag=getTag(collection);if(tag==mapTag||tag==setTag)return collection.size;return baseKeys(collection).length}function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;if(guard&&isIterateeCall(collection,predicate,guard))predicate=undefined;return func(collection,getIteratee(predicate, 3))}var sortBy=baseRest(function(collection,iteratees){if(collection==null)return[];var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1]))iteratees=[];else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2]))iteratees=[iteratees[0]];return baseOrderBy(collection,baseFlatten(iteratees,1),[])});var now=ctxNow||function(){return root.Date.now()};function after(n,func){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);n=toInteger(n); return function(){if(--n<1)return func.apply(this,arguments)}}function ary(func,n,guard){n=guard?undefined:n;n=func&&n==null?func.length:n;return createWrap(func,WRAP_ARY_FLAG,undefined,undefined,undefined,undefined,n)}function before(n,func){var result;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);n=toInteger(n);return function(){if(--n>0)result=func.apply(this,arguments);if(n<=1)func=undefined;return result}}var bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG; if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(func,bitmask,thisArg,partials,holders)});var bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(key,bitmask,object,partials,holders)});function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func, WRAP_CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curry.placeholder;return result}function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curryRight.placeholder;return result}function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=false,maxing=false,trailing=true; if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);wait=toNumber(wait)||0;if(isObject(options)){leading=!!options.leading;maxing="maxWait"in options;maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait;trailing="trailing"in options?!!options.trailing:trailing}function invokeFunc(time){var args=lastArgs,thisArg=lastThis;lastArgs=lastThis=undefined;lastInvokeTime=time;result=func.apply(thisArg,args);return result}function leadingEdge(time){lastInvokeTime=time;timerId=setTimeout(timerExpired, wait);return leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time= now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){timerId=undefined;if(trailing&&lastArgs)return invokeFunc(time);lastArgs=lastThis=undefined;return result}function cancel(){if(timerId!==undefined)clearTimeout(timerId);lastInvokeTime=0;lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time); lastArgs=arguments;lastThis=this;lastCallTime=time;if(isInvoking){if(timerId===undefined)return leadingEdge(lastCallTime);if(maxing){timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime)}}if(timerId===undefined)timerId=setTimeout(timerExpired,wait);return result}debounced.cancel=cancel;debounced.flush=flush;return debounced}var defer=baseRest(function(func,args){return baseDelay(func,1,args)});var delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)}); function flip(func){return createWrap(func,WRAP_FLIP_FLAG)}function memoize(func,resolver){if(typeof func!="function"||resolver!=null&&typeof resolver!="function")throw new TypeError(FUNC_ERROR_TEXT);var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result};memoized.cache=new (memoize.Cache||MapCache);return memoized} memoize.Cache=MapCache;function negate(predicate){if(typeof predicate!="function")throw new TypeError(FUNC_ERROR_TEXT);return function(){var args=arguments;switch(args.length){case 0:return!predicate.call(this);case 1:return!predicate.call(this,args[0]);case 2:return!predicate.call(this,args[0],args[1]);case 3:return!predicate.call(this,args[0],args[1],args[2])}return!predicate.apply(this,args)}}function once(func){return before(2,func)}var overArgs=castRest(function(func,transforms){transforms=transforms.length== 1&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){var index=-1,length=nativeMin(args.length,funcsLength);while(++index<length)args[index]=transforms[index].call(this,args[index]);return apply(func,this,args)})});var partial=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partial));return createWrap(func,WRAP_PARTIAL_FLAG, undefined,partials,holders)});var partialRight=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partialRight));return createWrap(func,WRAP_PARTIAL_RIGHT_FLAG,undefined,partials,holders)});var rearg=flatRest(function(func,indexes){return createWrap(func,WRAP_REARG_FLAG,undefined,undefined,undefined,indexes)});function rest(func,start){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);start=start===undefined?start:toInteger(start);return baseRest(func,start)} function spread(func,start){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);start=start==null?0:nativeMax(toInteger(start),0);return baseRest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);if(array)arrayPush(otherArgs,array);return apply(func,this,otherArgs)})}function throttle(func,wait,options){var leading=true,trailing=true;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);if(isObject(options)){leading="leading"in options?!!options.leading: leading;trailing="trailing"in options?!!options.trailing:trailing}return debounce(func,wait,{"leading":leading,"maxWait":wait,"trailing":trailing})}function unary(func){return ary(func,1)}function wrap(value,wrapper){return partial(castFunction(wrapper),value)}function castArray(){if(!arguments.length)return[];var value=arguments[0];return isArray(value)?value:[value]}function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG)}function cloneWith(value,customizer){customizer=typeof customizer== "function"?customizer:undefined;return baseClone(value,CLONE_SYMBOLS_FLAG,customizer)}function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}function cloneDeepWith(value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer)}function conformsTo(object,source){return source==null||baseConformsTo(object,source,keys(source))}function eq(value,other){return value===other||value!==value&& other!==other}var gt=createRelationalOperation(baseGt);var gte=createRelationalOperation(function(value,other){return value>=other});var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};var isArray=Array.isArray;var isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer;function isArrayLike(value){return value!=null&&isLength(value.length)&& !isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isBoolean(value){return value===true||value===false||isObjectLike(value)&&baseGetTag(value)==boolTag}var isBuffer=nativeIsBuffer||stubFalse;var isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate;function isElement(value){return isObjectLike(value)&&value.nodeType===1&&!isPlainObject(value)}function isEmpty(value){if(value==null)return true;if(isArrayLike(value)&&(isArray(value)||typeof value== "string"||typeof value.splice=="function"||isBuffer(value)||isTypedArray(value)||isArguments(value)))return!value.length;var tag=getTag(value);if(tag==mapTag||tag==setTag)return!value.size;if(isPrototype(value))return!baseKeys(value).length;for(var key in value)if(hasOwnProperty.call(value,key))return false;return true}function isEqual(value,other){return baseIsEqual(value,other)}function isEqualWith(value,other,customizer){customizer=typeof customizer=="function"?customizer:undefined;var result= customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,undefined,customizer):!!result}function isError(value){if(!isObjectLike(value))return false;var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||typeof value.message=="string"&&typeof value.name=="string"&&!isPlainObject(value)}function isFinite(value){return typeof value=="number"&&nativeIsFinite(value)}function isFunction(value){if(!isObject(value))return false;var tag=baseGetTag(value);return tag== funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}function isInteger(value){return typeof value=="number"&&value==toInteger(value)}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}function isObjectLike(value){return value!=null&&typeof value=="object"}var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;function isMatch(object,source){return object=== source||baseIsMatch(object,source,getMatchData(source))}function isMatchWith(object,source,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseIsMatch(object,source,getMatchData(source),customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(isMaskable(value))throw new Error(CORE_ERROR_TEXT);return baseIsNative(value)}function isNull(value){return value===null}function isNil(value){return value==null}function isNumber(value){return typeof value== "number"||isObjectLike(value)&&baseGetTag(value)==numberTag}function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag)return false;var proto=getPrototype(value);if(proto===null)return true;var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}var isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp;function isSafeInteger(value){return isInteger(value)&&value>= -MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;function isString(value){return typeof value=="string"||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;function isUndefined(value){return value===undefined}function isWeakMap(value){return isObjectLike(value)&& getTag(value)==weakMapTag}function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag}var lt=createRelationalOperation(baseLt);var lte=createRelationalOperation(function(value,other){return value<=other});function toArray(value){if(!value)return[];if(isArrayLike(value))return isString(value)?stringToArray(value):copyArray(value);if(symIterator&&value[symIterator])return iteratorToArray(value[symIterator]());var tag=getTag(value),func=tag==mapTag?mapToArray:tag==setTag?setToArray: values;return func(value)}function toFinite(value){if(!value)return value===0?value:0;value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}function toNumber(value){if(typeof value=="number")return value; if(isSymbol(value))return NAN;if(isObject(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string")return value===0?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return value? baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):value===0?value:0}function toString(value){return value==null?"":baseToString(value)}var assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return}for(var key in source)if(hasOwnProperty.call(source,key))assignValue(object,key,source[key])});var assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object)});var assignInWith=createAssigner(function(object, source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)});var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)});var at=flatRest(baseAt);function create(prototype,properties){var result=baseCreate(prototype);return properties==null?result:baseAssign(result,properties)}var defaults=baseRest(function(object,sources){object=Object(object);var index=-1;var length=sources.length;var guard=length>2?sources[2]: undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard))length=1;while(++index<length){var source=sources[index];var props=keysIn(source);var propsIndex=-1;var propsLength=props.length;while(++propsIndex<propsLength){var key=props[propsIndex];var value=object[key];if(value===undefined||eq(value,objectProto[key])&&!hasOwnProperty.call(object,key))object[key]=source[key]}}return object});var defaultsDeep=baseRest(function(args){args.push(undefined,customDefaultsMerge);return apply(mergeWith, undefined,args)});function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}function forIn(object,iteratee){return object==null?object:baseFor(object,getIteratee(iteratee,3),keysIn)}function forInRight(object,iteratee){return object==null?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}function forOwn(object,iteratee){return object&&baseForOwn(object, getIteratee(iteratee,3))}function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}function functions(object){return object==null?[]:baseFunctions(object,keys(object))}function functionsIn(object){return object==null?[]:baseFunctions(object,keysIn(object))}function get(object,path,defaultValue){var result=object==null?undefined:baseGet(object,path);return result===undefined?defaultValue:result}function has(object,path){return object!=null&&hasPath(object, path,baseHas)}function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn)}var invert=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!="function")value=nativeObjectToString.call(value);result[value]=key},constant(identity));var invertBy=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!="function")value=nativeObjectToString.call(value);if(hasOwnProperty.call(result,value))result[value].push(key);else result[value]=[key]}, getIteratee);var invoke=baseRest(baseInvoke);function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object)}function mapKeys(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value)});return result}function mapValues(object,iteratee){var result={};iteratee=getIteratee(iteratee, 3);baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))});return result}var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)});var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)});var omit=flatRest(function(object,paths){var result={};if(object==null)return result;var isDeep=false;paths=arrayMap(paths,function(path){path=castPath(path,object);isDeep|| (isDeep=path.length>1);return path});copyObject(object,getAllKeysIn(object),result);if(isDeep)result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone);var length=paths.length;while(length--)baseUnset(result,paths[length]);return result});function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths)});function pickBy(object,predicate){if(object==null)return{}; var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});predicate=getIteratee(predicate);return basePickBy(object,props,function(value,path){return predicate(value,path[0])})}function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;if(!length){length=1;object=undefined}while(++index<length){var value=object==null?undefined:object[toKey(path[index])];if(value===undefined){index=length;value=defaultValue}object=isFunction(value)?value.call(object): value}return object}function set(object,path,value){return object==null?object:baseSet(object,path,value)}function setWith(object,path,value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseSet(object,path,value,customizer)}var toPairs=createToPairs(keys);var toPairsIn=createToPairs(keysIn);function transform(object,iteratee,accumulator){var isArr=isArray(object),isArrLike=isArr||isBuffer(object)||isTypedArray(object);iteratee=getIteratee(iteratee, 4);if(accumulator==null){var Ctor=object&&object.constructor;if(isArrLike)accumulator=isArr?new Ctor:[];else if(isObject(object))accumulator=isFunction(Ctor)?baseCreate(getPrototype(object)):{};else accumulator={}}(isArrLike?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)});return accumulator}function unset(object,path){return object==null?true:baseUnset(object,path)}function update(object,path,updater){return object==null?object:baseUpdate(object, path,castFunction(updater))}function updateWith(object,path,updater,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseUpdate(object,path,castFunction(updater),customizer)}function values(object){return object==null?[]:baseValues(object,keys(object))}function valuesIn(object){return object==null?[]:baseValues(object,keysIn(object))}function clamp(number,lower,upper){if(upper===undefined){upper=lower;lower=undefined}if(upper!==undefined){upper= toNumber(upper);upper=upper===upper?upper:0}if(lower!==undefined){lower=toNumber(lower);lower=lower===lower?lower:0}return baseClamp(toNumber(number),lower,upper)}function inRange(number,start,end){start=toFinite(start);if(end===undefined){end=start;start=0}else end=toFinite(end);number=toNumber(number);return baseInRange(number,start,end)}function random(lower,upper,floating){if(floating&&typeof floating!="boolean"&&isIterateeCall(lower,upper,floating))upper=floating=undefined;if(floating===undefined)if(typeof upper== "boolean"){floating=upper;upper=undefined}else if(typeof lower=="boolean"){floating=lower;lower=undefined}if(lower===undefined&&upper===undefined){lower=0;upper=1}else{lower=toFinite(lower);if(upper===undefined){upper=lower;lower=0}else upper=toFinite(upper)}if(lower>upper){var temp=lower;lower=upper;upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}var camelCase= createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word)});function capitalize(string){return upperFirst(toString(string).toLowerCase())}function deburr(string){string=toString(string);return string&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}function endsWith(string,target,position){string=toString(string);target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position), 0,length);var end=position;position-=target.length;return position>=0&&string.slice(position,end)==target}function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$\x26"):string}var kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()}); var lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()});var lowerFirst=createCaseFirst("toLowerCase");function pad(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length)return string;var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}function padEnd(string,length,chars){string=toString(string); length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?string+createPadding(length-strLength,chars):string}function padStart(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?createPadding(length-strLength,chars)+string:string}function parseInt(string,radix,guard){if(guard||radix==null)radix=0;else if(radix)radix=+radix;return nativeParseInt(toString(string).replace(reTrimStart, ""),radix||0)}function repeat(string,n,guard){if(guard?isIterateeCall(string,n,guard):n===undefined)n=1;else n=toInteger(n);return baseRepeat(toString(string),n)}function replace(){var args=arguments,string=toString(args[0]);return args.length<3?string:string.replace(args[1],args[2])}var snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()});function split(string,separator,limit){if(limit&&typeof limit!="number"&&isIterateeCall(string,separator,limit))separator= limit=undefined;limit=limit===undefined?MAX_ARRAY_LENGTH:limit>>>0;if(!limit)return[];string=toString(string);if(string&&(typeof separator=="string"||separator!=null&&!isRegExp(separator))){separator=baseToString(separator);if(!separator&&hasUnicode(string))return castSlice(stringToArray(string),0,limit)}return string.split(separator,limit)}var startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word)});function startsWith(string,target,position){string= toString(string);position=position==null?0:baseClamp(toInteger(position),0,string.length);target=baseToString(target);return string.slice(position,position+target.length)==target}function template(string,options,guard){var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard))options=undefined;string=toString(string);options=assignInWith({},options,settings,customDefaultsAssignIn);var imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys= keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p +\x3d '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");var sourceURL="//# sourceURL\x3d"+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters, function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p +\x3d '"}if(interpolateValue)source+="' +\n((__t \x3d ("+interpolateValue+")) \x3d\x3d null ? '' : __t) +\n'";index=offset+match.length;return match}); source+="';\n";var variable=options.variable;if(!variable)source="with (obj) {\n"+source+"\n}\n";source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj \x3d {});\n")+"var __t, __p \x3d ''"+(isEscaping?", __e \x3d _.escape":"")+(isEvaluating?", __j \x3d Array.prototype.join;\n"+"function print() { __p +\x3d __j.call(arguments, '') }\n":";\n")+source+ "return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});result.source=source;if(isError(result))throw result;return result}function toLower(value){return toString(value).toLowerCase()}function toUpper(value){return toString(value).toUpperCase()}function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined))return string.replace(reTrim,"");if(!string||!(chars=baseToString(chars)))return string; var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join("")}function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined))return string.replace(reTrimEnd,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols, 0,end).join("")}function trimStart(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined))return string.replace(reTrimStart,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string),start=charsStartIndex(strSymbols,stringToArray(chars));return castSlice(strSymbols,start).join("")}function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options? options.separator:separator;length="length"in options?toInteger(options.length):length;omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength)return string;var end=length-stringSize(omission);if(end<1)return omission;var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined)return result+ omission;if(strSymbols)end+=result.length-end;if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;if(!separator.global)separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g");separator.lastIndex=0;while(match=separator.exec(substring))var newEnd=match.index;result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);if(index>-1)result=result.slice(0,index)}return result+ omission}function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}var upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()});var upperFirst=createCaseFirst("toUpperCase");function words(string,pattern,guard){string=toString(string);pattern=guard?undefined:pattern;if(pattern===undefined)return hasUnicodeWord(string)?unicodeWords(string):asciiWords(string);return string.match(pattern)|| []}var attempt=baseRest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}});var bindAll=flatRest(function(object,methodNames){arrayEach(methodNames,function(key){key=toKey(key);baseAssignValue(object,key,bind(object[key],object))});return object});function cond(pairs){var length=pairs==null?0:pairs.length,toIteratee=getIteratee();pairs=!length?[]:arrayMap(pairs,function(pair){if(typeof pair[1]!="function")throw new TypeError(FUNC_ERROR_TEXT);return[toIteratee(pair[0]), pair[1]]});return baseRest(function(args){var index=-1;while(++index<length){var pair=pairs[index];if(apply(pair[0],this,args))return apply(pair[1],this,args)}})}function conforms(source){return baseConforms(baseClone(source,CLONE_DEEP_FLAG))}function constant(value){return function(){return value}}function defaultTo(value,defaultValue){return value==null||value!==value?defaultValue:value}var flow=createFlow();var flowRight=createFlow(true);function identity(value){return value}function iteratee(func){return baseIteratee(typeof func== "function"?func:baseClone(func,CLONE_DEEP_FLAG))}function matches(source){return baseMatches(baseClone(source,CLONE_DEEP_FLAG))}function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,CLONE_DEEP_FLAG))}var method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args)}});var methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args)}});function mixin(object,source,options){var props=keys(source), methodNames=baseFunctions(source,props);if(options==null&&!(isObject(source)&&(methodNames.length||!props.length))){options=source;source=object;object=this;methodNames=baseFunctions(source,keys(source))}var chain=!(isObject(options)&&"chain"in options)||!!options.chain,isFunc=isFunction(object);arrayEach(methodNames,function(methodName){var func=source[methodName];object[methodName]=func;if(isFunc)object.prototype[methodName]=function(){var chainAll=this.__chain__;if(chain||chainAll){var result= object(this.__wrapped__),actions=result.__actions__=copyArray(this.__actions__);actions.push({"func":func,"args":arguments,"thisArg":object});result.__chain__=chainAll;return result}return func.apply(object,arrayPush([this.value()],arguments))}});return object}function noConflict(){if(root._===this)root._=oldDash;return this}function noop(){}function nthArg(n){n=toInteger(n);return baseRest(function(args){return baseNth(args,n)})}var over=createOver(arrayMap);var overEvery=createOver(arrayEvery); var overSome=createOver(arraySome);function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}function propertyOf(object){return function(path){return object==null?undefined:baseGet(object,path)}}var range=createRange();var rangeRight=createRange(true);function stubArray(){return[]}function stubFalse(){return false}function stubObject(){return{}}function stubString(){return""}function stubTrue(){return true}function times(n,iteratee){n=toInteger(n);if(n<1||n>MAX_SAFE_INTEGER)return[]; var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee);n-=MAX_ARRAY_LENGTH;var result=baseTimes(length,iteratee);while(++index<n)iteratee(index);return result}function toPath(value){if(isArray(value))return arrayMap(value,toKey);return isSymbol(value)?[value]:copyArray(stringToPath(toString(value)))}function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}var add=createMathOperation(function(augend,addend){return augend+addend},0);var ceil=createRound("ceil"); var divide=createMathOperation(function(dividend,divisor){return dividend/divisor},1);var floor=createRound("floor");function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined}function maxBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseGt):undefined}function mean(array){return baseMean(array,identity)}function meanBy(array,iteratee){return baseMean(array,getIteratee(iteratee,2))}function min(array){return array&&array.length? baseExtremum(array,identity,baseLt):undefined}function minBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseLt):undefined}var multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand},1);var round=createRound("round");var subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend},0);function sum(array){return array&&array.length?baseSum(array,identity):0}function sumBy(array,iteratee){return array&& array.length?baseSum(array,getIteratee(iteratee,2)):0}lodash.after=after;lodash.ary=ary;lodash.assign=assign;lodash.assignIn=assignIn;lodash.assignInWith=assignInWith;lodash.assignWith=assignWith;lodash.at=at;lodash.before=before;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.castArray=castArray;lodash.chain=chain;lodash.chunk=chunk;lodash.compact=compact;lodash.concat=concat;lodash.cond=cond;lodash.conforms=conforms;lodash.constant=constant;lodash.countBy=countBy;lodash.create= create;lodash.curry=curry;lodash.curryRight=curryRight;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defaultsDeep=defaultsDeep;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.differenceBy=differenceBy;lodash.differenceWith=differenceWith;lodash.drop=drop;lodash.dropRight=dropRight;lodash.dropRightWhile=dropRightWhile;lodash.dropWhile=dropWhile;lodash.fill=fill;lodash.filter=filter;lodash.flatMap=flatMap;lodash.flatMapDeep=flatMapDeep;lodash.flatMapDepth=flatMapDepth; lodash.flatten=flatten;lodash.flattenDeep=flattenDeep;lodash.flattenDepth=flattenDepth;lodash.flip=flip;lodash.flow=flow;lodash.flowRight=flowRight;lodash.fromPairs=fromPairs;lodash.functions=functions;lodash.functionsIn=functionsIn;lodash.groupBy=groupBy;lodash.initial=initial;lodash.intersection=intersection;lodash.intersectionBy=intersectionBy;lodash.intersectionWith=intersectionWith;lodash.invert=invert;lodash.invertBy=invertBy;lodash.invokeMap=invokeMap;lodash.iteratee=iteratee;lodash.keyBy= keyBy;lodash.keys=keys;lodash.keysIn=keysIn;lodash.map=map;lodash.mapKeys=mapKeys;lodash.mapValues=mapValues;lodash.matches=matches;lodash.matchesProperty=matchesProperty;lodash.memoize=memoize;lodash.merge=merge;lodash.mergeWith=mergeWith;lodash.method=method;lodash.methodOf=methodOf;lodash.mixin=mixin;lodash.negate=negate;lodash.nthArg=nthArg;lodash.omit=omit;lodash.omitBy=omitBy;lodash.once=once;lodash.orderBy=orderBy;lodash.over=over;lodash.overArgs=overArgs;lodash.overEvery=overEvery;lodash.overSome= overSome;lodash.partial=partial;lodash.partialRight=partialRight;lodash.partition=partition;lodash.pick=pick;lodash.pickBy=pickBy;lodash.property=property;lodash.propertyOf=propertyOf;lodash.pull=pull;lodash.pullAll=pullAll;lodash.pullAllBy=pullAllBy;lodash.pullAllWith=pullAllWith;lodash.pullAt=pullAt;lodash.range=range;lodash.rangeRight=rangeRight;lodash.rearg=rearg;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.reverse=reverse;lodash.sampleSize=sampleSize;lodash.set=set;lodash.setWith= setWith;lodash.shuffle=shuffle;lodash.slice=slice;lodash.sortBy=sortBy;lodash.sortedUniq=sortedUniq;lodash.sortedUniqBy=sortedUniqBy;lodash.split=split;lodash.spread=spread;lodash.tail=tail;lodash.take=take;lodash.takeRight=takeRight;lodash.takeRightWhile=takeRightWhile;lodash.takeWhile=takeWhile;lodash.tap=tap;lodash.throttle=throttle;lodash.thru=thru;lodash.toArray=toArray;lodash.toPairs=toPairs;lodash.toPairsIn=toPairsIn;lodash.toPath=toPath;lodash.toPlainObject=toPlainObject;lodash.transform= transform;lodash.unary=unary;lodash.union=union;lodash.unionBy=unionBy;lodash.unionWith=unionWith;lodash.uniq=uniq;lodash.uniqBy=uniqBy;lodash.uniqWith=uniqWith;lodash.unset=unset;lodash.unzip=unzip;lodash.unzipWith=unzipWith;lodash.update=update;lodash.updateWith=updateWith;lodash.values=values;lodash.valuesIn=valuesIn;lodash.without=without;lodash.words=words;lodash.wrap=wrap;lodash.xor=xor;lodash.xorBy=xorBy;lodash.xorWith=xorWith;lodash.zip=zip;lodash.zipObject=zipObject;lodash.zipObjectDeep= zipObjectDeep;lodash.zipWith=zipWith;lodash.entries=toPairs;lodash.entriesIn=toPairsIn;lodash.extend=assignIn;lodash.extendWith=assignInWith;mixin(lodash,lodash);lodash.add=add;lodash.attempt=attempt;lodash.camelCase=camelCase;lodash.capitalize=capitalize;lodash.ceil=ceil;lodash.clamp=clamp;lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.cloneDeepWith=cloneDeepWith;lodash.cloneWith=cloneWith;lodash.conformsTo=conformsTo;lodash.deburr=deburr;lodash.defaultTo=defaultTo;lodash.divide=divide;lodash.endsWith= endsWith;lodash.eq=eq;lodash.escape=escape;lodash.escapeRegExp=escapeRegExp;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.floor=floor;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.get=get;lodash.gt=gt;lodash.gte=gte;lodash.has=has;lodash.hasIn=hasIn; lodash.head=head;lodash.identity=identity;lodash.includes=includes;lodash.indexOf=indexOf;lodash.inRange=inRange;lodash.invoke=invoke;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isArrayBuffer=isArrayBuffer;lodash.isArrayLike=isArrayLike;lodash.isArrayLikeObject=isArrayLikeObject;lodash.isBoolean=isBoolean;lodash.isBuffer=isBuffer;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isEqualWith=isEqualWith;lodash.isError=isError;lodash.isFinite= isFinite;lodash.isFunction=isFunction;lodash.isInteger=isInteger;lodash.isLength=isLength;lodash.isMap=isMap;lodash.isMatch=isMatch;lodash.isMatchWith=isMatchWith;lodash.isNaN=isNaN;lodash.isNative=isNative;lodash.isNil=isNil;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isObjectLike=isObjectLike;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isSafeInteger=isSafeInteger;lodash.isSet=isSet;lodash.isString=isString;lodash.isSymbol=isSymbol;lodash.isTypedArray= isTypedArray;lodash.isUndefined=isUndefined;lodash.isWeakMap=isWeakMap;lodash.isWeakSet=isWeakSet;lodash.join=join;lodash.kebabCase=kebabCase;lodash.last=last;lodash.lastIndexOf=lastIndexOf;lodash.lowerCase=lowerCase;lodash.lowerFirst=lowerFirst;lodash.lt=lt;lodash.lte=lte;lodash.max=max;lodash.maxBy=maxBy;lodash.mean=mean;lodash.meanBy=meanBy;lodash.min=min;lodash.minBy=minBy;lodash.stubArray=stubArray;lodash.stubFalse=stubFalse;lodash.stubObject=stubObject;lodash.stubString=stubString;lodash.stubTrue= stubTrue;lodash.multiply=multiply;lodash.nth=nth;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.pad=pad;lodash.padEnd=padEnd;lodash.padStart=padStart;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.repeat=repeat;lodash.replace=replace;lodash.result=result;lodash.round=round;lodash.runInContext=runInContext;lodash.sample=sample;lodash.size=size;lodash.snakeCase=snakeCase;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.sortedIndexBy= sortedIndexBy;lodash.sortedIndexOf=sortedIndexOf;lodash.sortedLastIndex=sortedLastIndex;lodash.sortedLastIndexBy=sortedLastIndexBy;lodash.sortedLastIndexOf=sortedLastIndexOf;lodash.startCase=startCase;lodash.startsWith=startsWith;lodash.subtract=subtract;lodash.sum=sum;lodash.sumBy=sumBy;lodash.template=template;lodash.times=times;lodash.toFinite=toFinite;lodash.toInteger=toInteger;lodash.toLength=toLength;lodash.toLower=toLower;lodash.toNumber=toNumber;lodash.toSafeInteger=toSafeInteger;lodash.toString= toString;lodash.toUpper=toUpper;lodash.trim=trim;lodash.trimEnd=trimEnd;lodash.trimStart=trimStart;lodash.truncate=truncate;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.upperCase=upperCase;lodash.upperFirst=upperFirst;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.first=head;mixin(lodash,function(){var source={};baseForOwn(lodash,function(func,methodName){if(!hasOwnProperty.call(lodash.prototype,methodName))source[methodName]=func});return source}(),{"chain":false});lodash.VERSION= VERSION;arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash});arrayEach(["drop","take"],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){n=n===undefined?1:nativeMax(toInteger(n),0);var result=this.__filtered__&&!index?new LazyWrapper(this):this.clone();if(result.__filtered__)result.__takeCount__=nativeMin(n,result.__takeCount__);else result.__views__.push({"size":nativeMin(n,MAX_ARRAY_LENGTH), "type":methodName+(result.__dir__<0?"Right":"")});return result};LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()}});arrayEach(["filter","map","takeWhile"],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||type==LAZY_WHILE_FLAG;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();result.__iteratees__.push({"iteratee":getIteratee(iteratee,3),"type":type});result.__filtered__=result.__filtered__|| isFilter;return result}});arrayEach(["head","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}});arrayEach(["initial","tail"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1)}});LazyWrapper.prototype.compact=function(){return this.filter(identity)};LazyWrapper.prototype.find= function(predicate){return this.filter(predicate).head()};LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate)};LazyWrapper.prototype.invokeMap=baseRest(function(path,args){if(typeof path=="function")return new LazyWrapper(this);return this.map(function(value){return baseInvoke(value,path,args)})});LazyWrapper.prototype.reject=function(predicate){return this.filter(negate(getIteratee(predicate)))};LazyWrapper.prototype.slice=function(start,end){start=toInteger(start); var result=this;if(result.__filtered__&&(start>0||end<0))return new LazyWrapper(result);if(start<0)result=result.takeRight(-start);else if(start)result=result.drop(start);if(end!==undefined){end=toInteger(end);result=end<0?result.dropRight(-end):result.take(end-start)}return result};LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)};baseForOwn(LazyWrapper.prototype, function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+(methodName=="last"?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);if(!lodashFunc)return;lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value);var interceptor=function(value){var result= lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};if(useLazy&&checkIteratee&&typeof iteratee=="function"&&iteratee.length!=1)isLazy=useLazy=false;var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);result.__actions__.push({"func":thru,"args":[interceptor],"thisArg":undefined});return new LodashWrapper(result, chainAll)}if(isUnwrapped&&onlyLazy)return func.apply(this,args);result=this.thru(interceptor);return isUnwrapped?isTaker?result.value()[0]:result.value():result}});arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value(); return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}});baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"",names=realNames[key]||(realNames[key]=[]);names.push({"name":methodName,"func":lodashFunc})}});realNames[createHybrid(undefined,WRAP_BIND_KEY_FLAG).name]=[{"name":"wrapper","func":undefined}];LazyWrapper.prototype.clone=lazyClone; LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=wrapperAt;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(symIterator)lodash.prototype[symIterator]=wrapperToIterator;return lodash}; var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeModule){(freeModule.exports=_)._=_;freeExports._=_}else root._=_}).call(this); //# sourceURL=build://vz-sorting/sorting.js var Po; (function(b){function c(k,q){let l;(function(p){p[p.NATURAL=0]="NATURAL";p[p.REAL=1]="REAL";p[p.EXPONENT_SIGN=2]="EXPONENT_SIGN";p[p.EXPONENT=3]="EXPONENT"})(l||(l={}));let m=l.NATURAL;for(;q<k.length;q++)if(m===l.NATURAL)if("."===k[q])m=l.REAL;else if("e"===k[q]||"E"===k[q])m=l.EXPONENT_SIGN;else{if(!e(k[q]))break}else if(m===l.REAL)if("e"===k[q]||"E"===k[q])m=l.EXPONENT_SIGN;else{if(!e(k[q]))break}else if(m===l.EXPONENT_SIGN)if(e(k[q])||"+"===k[q]||"-"===k[q])m=l.EXPONENT;else break;else if(m===l.EXPONENT&& !e(k[q]))break;return q}function e(k){return"0"<=k&&"9">=k}function g(k){return"/"===k||"_"===k||e(k)}b.compareTagNames=function(k,q){let l=0,m=0;for(;;){if(l===k.length)return m===q.length?0:-1;if(m===q.length)return 1;if(e(k[l])&&e(q[m])){var p=l,n=m;l=c(k,l+1);m=c(q,m+1);p=parseFloat(k.slice(p,l));n=parseFloat(q.slice(n,m));if(p<n)return-1;if(p>n)return 1}else{if(g(k[l])){if(!g(q[m]))return-1}else{if(g(q[m]))return 1;if(k[l]<q[m])return-1;if(k[l]>q[m])return 1}l++;m++}}}})(Po||(Po={})); //# sourceURL=build://tf-backend/requestManager.js var Qo; (function(b){function c(t,v,x,y){const z=new XMLHttpRequest;z.open(t,v);x&&(z.withCredentials=x);y&&z.setRequestHeader("Content-Type",y);return z}function e(t){const v=new p;if(!t)return v.methodType=m.GET,v;v.methodType=m.POST;v.body=g(t);return v}function g(t){const v=new FormData;for(let x in t)x&&v.append(x,t[x]);return v}class k extends Error{constructor(){super(...arguments);this.name="RequestCancellationError"}}b.RequestCancellationError=k;class q extends Error{constructor(t){super(t);this.name= "InvalidRequestOptionsError";Object.setPrototypeOf(this,q.prototype)}}b.InvalidRequestOptionsError=q;class l extends Error{constructor(t,v){super();this.message=`RequestNetworkError: ${t.status} at ${v}`;this.name="RequestNetworkError";this.req=t;this.url=v}}b.RequestNetworkError=l;let m;(function(t){t.GET="GET";t.POST="POST"})(m=b.HttpMethodType||(b.HttpMethodType={}));class p{validate(){if(this.methodType===m.GET&&this.body)throw new q("body must be missing for a GET request.");}}b.RequestOptions= p;class n{constructor(t=1E3,v=3){this._queue=[];this._nActiveRequests=0;this._nSimultaneousRequests=t;this._maxRetries=v}request(t,v){v=e(v);return this.requestWithOptions(t,v)}requestWithOptions(t,v){v.validate();return(new Promise((x,y)=>{this._queue.push({resolve:x,reject:y});this.launchRequests()})).then(()=>this.promiseWithRetries(t,this._maxRetries,v)).then(x=>{this._nActiveRequests--;this.launchRequests();return x},x=>{"RequestNetworkError"===x.name&&(this._nActiveRequests--,this.launchRequests()); return Promise.reject(x)})}fetch(t,v){return(new Promise((x,y)=>{this._queue.push({resolve:x,reject:y});this.launchRequests()})).then(()=>{let x=1;return new Promise(y=>{const z=()=>{fetch(t,v).then(A=>{!A.ok&&this._maxRetries>x?(x++,z()):(y(A),this._nActiveRequests--,this.launchRequests())})};z()})})}clearQueue(){for(;0<this._queue.length;)this._queue.pop().reject(new k("Request cancelled by clearQueue"))}activeRequests(){return this._nActiveRequests}outstandingRequests(){return this._nActiveRequests+ this._queue.length}launchRequests(){for(;this._nActiveRequests<this._nSimultaneousRequests&&0<this._queue.length;)this._nActiveRequests++,this._queue.pop().resolve()}promiseWithRetries(t,v,x){return this._promiseFromUrl(t,x).then(y=>y,y=>0<v?this.promiseWithRetries(t,v-1,x):Promise.reject(y))}_promiseFromUrl(t,v){return new Promise((x,y)=>{const z=c(v.methodType,t,v.withCredentials,v.contentType);z.onload=function(){200===z.status?x(JSON.parse(z.responseText)):y(new l(z,t))};z.onerror=function(){y(new l(z, t))};v.body?z.send(v.body):z.send()})}}b.RequestManager=n})(Qo||(Qo={})); //# sourceURL=build://tf-backend/urlPathHelpers.js (function(b){function c(e){return encodeURIComponent(e).replace(/\(/g,"%28").replace(/\)/g,"%29")}b.addParams=function(e,g){var k=Object.keys(g).sort().filter(l=>void 0!==g[l]);if(!k.length)return e;const q=-1!==e.indexOf("?")?"\x26":"?";k=[].concat(...k.map(l=>{const m=g[l];return(Array.isArray(m)?m:[m]).map(p=>`${l}=${c(p)}`)})).join("\x26");return e+q+k}})(Qo||(Qo={})); //# sourceURL=build://tf-backend/router.js (function(b){function c(q="data"){"/"===q[q.length-1]&&(q=q.slice(0,q.length-1));return{environment:()=>e(q,"/environment"),experiments:()=>e(q,"/experiments"),pluginRoute:(l,m,p)=>e(q+"/plugin",`/${l}${m}`,p),pluginsListing:()=>e(q,"/plugins_listing"),runs:()=>e(q,"/runs"),runsForExperiment:l=>e(q,"/experiment_runs",g({experiment:String(l)}))}}function e(q,l,m=new URLSearchParams){q+=l;String(m)&&(l=l.includes("?")?"\x26":"?",q+=l+String(m));return q}function g(q={}){const l=Object.keys(q).sort().filter(p=> q[p]),m=new URLSearchParams;l.forEach(p=>{const n=q[p];(Array.isArray(n)?n:[n]).forEach(t=>m.append(p,t))});return m}let k=c();b.createRouter=c;b.getRouter=function(){return k};b.setRouter=function(q){if(null==q)throw Error("Router required, but got: "+q);k=q};b.createSearchParam=g})(Qo||(Qo={})); //# sourceURL=build://tf-backend/baseStore.js (function(b){class c{constructor(g){this.listener=g}}b.ListenKey=c;class e{constructor(){this.requestManager=new b.RequestManager(1);this._listeners=new Set;this.initialized=!1}refresh(){return this.load().then(()=>{this.initialized=!0})}addListener(g){g=new c(g);this._listeners.add(g);return g}removeListenerByKey(g){this._listeners.delete(g)}emitChange(){this._listeners.forEach(g=>{try{g.listener()}catch(k){}})}}b.BaseStore=e})(Qo||(Qo={})); //# sourceURL=build://tf-backend/environmentStore.js (function(b){class c extends b.BaseStore{load(){const e=b.getRouter().environment();return this.requestManager.request(e).then(g=>{g={dataLocation:g.data_location,windowTitle:g.window_title};_.isEqual(this.environment,g)||(this.environment=g,this.emitChange())})}getDataLocation(){return this.environment?this.environment.dataLocation:""}getWindowTitle(){return this.environment?this.environment.windowTitle:""}}b.EnvironmentStore=c;b.environmentStore=new c})(Qo||(Qo={})); //# sourceURL=build://tf-backend/experimentsStore.js (function(b){class c extends b.BaseStore{constructor(){super(...arguments);this._experiments=[]}load(){const e=b.getRouter().experiments();return this.requestManager.request(e).then(g=>{_.isEqual(this._experiments,g)||(this._experiments=g,this.emitChange())})}getExperiments(){return this._experiments.slice()}}b.ExperimentsStore=c;b.experimentsStore=new c})(Qo||(Qo={})); //# sourceURL=build://tf-backend/runsStore.js (function(b){class c extends b.BaseStore{constructor(){super(...arguments);this._runs=[]}load(){const e=b.getRouter().runs();return this.requestManager.request(e).then(g=>{_.isEqual(this._runs,g)||(this._runs=g,this.emitChange())})}getRuns(){return this._runs.slice()}}b.RunsStore=c;b.runsStore=new c})(Qo||(Qo={})); //# sourceURL=build://tf-backend/backend.js (function(b){b.TYPES=[];b.getRunsNamed=function(c){return _.keys(c).sort(Po.compareTagNames)};b.getTags=function(c){return _.union.apply(null,_.values(c)).sort(Po.compareTagNames)};b.filterTags=function(c,e){let g=[];e.forEach(k=>g=g.concat(c[k]));return _.uniq(g).sort(Po.compareTagNames)}})(Qo||(Qo={})); //# sourceURL=build://tf-backend/canceller.js (function(b){class c{constructor(){this.cancellationCount=0}cancellable(e){const g=this.cancellationCount;return k=>e({value:k,cancelled:this.cancellationCount!==g})}cancelAll(){this.cancellationCount++}}b.Canceller=c})(Qo||(Qo={})); //# sourceURL=build://tf-backend/tf-backend-polymer.js (function(b){Polymer({is:"tf-backend",_template:null,tf_backend:b})})(Qo||(Qo={})); //# sourceURL=build://tf-dashboard-common/tf-dashboard-layout.html.js Polymer({is:"tf-dashboard-layout"}); //# sourceURL=build://tf-dashboard-common/tf-option-selector.html.js Polymer({is:"tf-option-selector",properties:{name:String,selectedId:{type:String,notify:!0,observer:"_selectedIdChanged"}},attached:function(){this.async(function(){this.getEffectiveChildren().forEach(function(b){this.listen(b,"tap","_selectTarget")}.bind(this))})},_selectTarget:function(b){this.selectedId=b.currentTarget.id},_selectedIdChanged:function(){var b=this.queryEffectiveChildren("#"+this.selectedId);b&&(this.getEffectiveChildren().forEach(function(c){c.classList.remove("selected")}),b.classList.add("selected"))}}); //# sourceURL=build://tf-plugin-lib/plugin_lib_polymer_interop_binary.js var Ro=this&&this.__generator||function(b,c){function e(n){return function(t){return g([n,t])}}function g(n){if(q)throw new TypeError("Generator is already executing.");for(;k;)try{if(q=1,l&&(m=n[0]&2?l["return"]:n[0]?l["throw"]||((m=l["return"])&&m.call(l),0):l.next)&&!(m=m.call(l,n[1])).done)return m;if(l=0,m)n=[n[0]&2,m.value];switch(n[0]){case 0:case 1:m=n;break;case 4:return k.label++,{value:n[1],done:!1};case 5:k.label++;l=n[1];n=[0];continue;case 7:n=k.ops.pop();k.trys.pop();continue;default:if(!(m= k.trys,m=0<m.length&&m[m.length-1])&&(6===n[0]||2===n[0])){k=0;continue}if(3===n[0]&&(!m||n[1]>m[0]&&n[1]<m[3]))k.label=n[1];else if(6===n[0]&&k.label<m[1])k.label=m[1],m=n;else if(m&&k.label<m[2])k.label=m[2],k.ops.push(n);else{m[2]&&k.ops.pop();k.trys.pop();continue}}n=c.call(b,k)}catch(t){n=[6,t],l=0}finally{q=m=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var k={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},q,l,m,p;return p={next:e(0),"throw":e(1), "return":e(2)},"function"===typeof Symbol&&(p[Symbol.iterator]=function(){return this}),p}; (function(){function b(n,t,v,x){return new (v||(v=Promise))(function(y,z){function A(E){try{H(x.next(E))}catch(F){z(F)}}function D(E){try{H(x["throw"](E))}catch(F){z(F)}}function H(E){E.done?y(E.value):(new v(function(F){F(E.value)})).then(A,D)}H((x=x.apply(n,t||[])).next())})}function c(n,t,v,x){return new (v||(v=Promise))(function(y,z){function A(E){try{H(x.next(E))}catch(F){z(F)}}function D(E){try{H(x["throw"](E))}catch(F){z(F)}}function H(E){E.done?y(E.value):(new v(function(F){F(E.value)})).then(A, D)}H((x=x.apply(n,t||[])).next())})}function e(n,t,v,x){return new (v||(v=Promise))(function(y,z){function A(E){try{H(x.next(E))}catch(F){z(F)}}function D(E){try{H(x["throw"](E))}catch(F){z(F)}}function H(E){E.done?y(E.value):(new v(function(F){F(E.value)})).then(A,D)}H((x=x.apply(n,t||[])).next())})}var g=function(){function n(t){var v=this;this.port=t;this.id=0;this.responseWaits=new Map;this.listeners=new Map;this.port.addEventListener("message",function(x){return v.onMessage(x)})}n.prototype.listen= function(t,v){this.listeners.set(t,v)};n.prototype.unlisten=function(t){this.listeners.delete(t)};n.prototype.onMessage=function(t){return e(this,void 0,void 0,function(){var v,x,y,z,A,D,H,E,F,J,O,N,P,V,T,aa;return Ro(this,function(da){switch(da.label){case 0:x=JSON.parse(t.data);y=x.type;z=x.id;A=x.payload;D=x.error;if(H=x.isReply){if(!this.responseWaits.has(z))return[2];E=this.responseWaits.get(z);F=E.resolve;J=E.reject;this.responseWaits.delete(z);D?J(Error(D)):F(A);return[2]}N=O=null;if(!this.listeners.has(y))return[3, 4];P=this.listeners.get(y);da.label=1;case 1:return da.trys.push([1,3,,4]),[4,P(A)];case 2:return O=V=da.sent(),[3,4];case 3:return N=T=da.sent(),[3,4];case 4:return aa=(v={},v.type=y,v.id=z,v.payload=O,v.error=N,v.isReply=!0,v),this.postMessage(aa),[2]}})})};n.prototype.postMessage=function(t){this.port.postMessage(JSON.stringify(t))};n.prototype.sendMessage=function(t,v){var x=this,y=this.id++;this.postMessage({type:t,id:y,payload:v,error:null,isReply:!1});return new Promise(function(z,A){x.responseWaits.set(y, {resolve:z,reject:A})})};return n}();window.parent||setTimeout(function(){throw Error("The library must run within a TensorBoard iframe-based plugin.");});var k=new MessageChannel;g=new g(k.port1);k.port1.start();window.parent.postMessage("experimental.bootstrap","*",[k.port2]);var q=g.sendMessage.bind(g),l=g.listen.bind(g);g.unlisten.bind(g);k=Object.freeze({getRuns:function(){return c(this,void 0,void 0,function(){return Ro(this,function(){return[2,q("experimental.GetRuns")]})})},setOnRunsChanged:function(n){return l("experimental.RunsChanged", n)}});g=Object.freeze({getURLPluginData:function(){return b(this,void 0,void 0,function(){return Ro(this,function(){return[2,q("experimental.GetURLPluginData")]})})}});var m=Object.freeze({core:g,runs:k}),p;(function(n){n.experimental=m})(p||(p={}));window.tb_plugin_lib=p})(); //# sourceURL=build://wit-dashboard/wit-inference-panel.html.js Polymer({is:"wit-inference-panel",properties:{examplesPath:{type:String,value:"",notify:!0},hideModelPane2:{type:Boolean,value:!0},modelName:{type:String,value:"",notify:!0},modelName1:{type:String,value:"",notify:!0},modelName2:{type:String,value:"",notify:!0},inferenceAddress:{type:String,value:"",notify:!0},inferenceAddress1:{type:String,value:"",notify:!0},inferenceAddress2:{type:String,value:"",notify:!0},modelType:{type:String,value:"classification",notify:!0},modelVersion:{type:String,value:"", notify:!0},modelVersion1:{type:String,value:"",notify:!0},modelVersion2:{type:String,value:"",notify:!0},modelSignature:{type:String,value:"",notify:!0},modelSignature1:{type:String,value:"",notify:!0},modelSignature2:{type:String,value:"",notify:!0},maxExamples:{type:Number,value:"1000",notify:!0},labelVocabPath:{type:String,value:"",notify:!0},multiClass:{type:Boolean,notify:!0,value:!1},sequenceExamples:{type:Boolean,notify:!0,value:!1},maxClassesToDisplay:{type:Number,value:"5",notify:!0},samplingOdds:{type:Number, value:"1",notify:!0},usePredictApi:{type:Boolean,notify:!0,value:!1},predictInputTensor:{type:String,value:"examples",notify:!0},predictOutputTensor:{type:String,value:"probabilities",notify:!0}},observers:["updateModelName(modelName1, modelName2)","updateInferenceAddress(inferenceAddress1, inferenceAddress2)","updateModelVersion(modelVersion1, modelVersion2)","updateModelSignature(modelSignature1, modelSignature2)"],ready(){const b=this;return yb(function*(){if(tb_plugin_lib){var c=yield tb_plugin_lib.experimental.core.getURLPluginData(), e=Object.keys(c);for(let g=0;g<e.length;g++){const k=e[g];b.set(k,c[k])}}})},updateModelName:function(b,c){this.modelName=b+","+c;this.modelName=this.modelName.replace(/(^,)|(,$)/g,"")},updateInferenceAddress:function(b,c){this.inferenceAddress=b+","+c;this.inferenceAddress=this.inferenceAddress.replace(/(^,)|(,$)/g,"")},updateModelVersion:function(b,c){this.modelVersion=b+","+c},updateModelSignature:function(b,c){this.modelSignature=b+","+c},addModelClicked_:function(){this.hideModelPane2=!this.hideModelPane2}, shouldDisableClassificationControls_:function(b){return"regression"==b},shouldDisableMultiClassControls_:function(b){return!b},shouldDisablePredictTensorControls_:function(b){return!b}}); //# sourceURL=build://tf-tensorboard/plugin-dialog.html.js Polymer({is:"tf-plugin-dialog",properties:{_title:{type:String,value:null},_customMessage:{type:String,value:null},_open:{type:Boolean},_hidden:{type:Boolean,computed:"_computeHidden(_open)",reflectToAttribute:!0},_useNativeBackdrop:{type:Boolean,value:!1,readOnly:!0}},openNoTensorFlowDialog(){this.openDialog("This plugin is disabled without TensorFlow",'To enable this plugin in TensorBoard, install TensorFlow with "pip install tensorflow" or equivalent.')},openOldTensorFlowDialog(b){this.openDialog("This plugin is disabled without TensorFlow "+ b,"To enable this plugin in TensorBoard, install TensorFlow "+b+' or greater with "pip install tensorflow" or equivalent.')},openDialog(b,c){this.set("_title",b);this.set("_customMessage",c);this.$.dialog.open()},closeDialog(){this.$.dialog.close()},_computeHidden(b){return!b}}); //# sourceURL=build://tf-tensorboard/registry.js var So; (function(b){(function(c){c.NOT_LOADED="NOT_LOADED";c.LOADED="LOADED";c.FAILED="FAILED"})(b.ActiveDashboardsLoadState||(b.ActiveDashboardsLoadState={}));b.dashboardRegistry={};b.registerDashboard=function(){var c={plugin:"whatif",elementName:"wit-dashboard",tabName:"What-If Tool"};if(!c.plugin)throw Error("Dashboard.plugin must be present");if(!c.elementName)throw Error("Dashboard.elementName must be present");if(c.plugin in b.dashboardRegistry)throw Error(`Plugin already registered: ${c.plugin}`);c.tabName|| (c.tabName=c.plugin);b.dashboardRegistry[c.plugin]=c}})(So||(So={})); // https://d3js.org v5.7.0 Copyright 2018 Mike Bostock !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function e(t){var e;return 1===t.length&&(e=t,t=function(t,r){return n(e(t),r)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}var r=e(n),i=r.right,o=r.left;function a(t,n){return[t,n]}function u(t){return null===t?NaN:+t}function f(t,n){var e,r,i=t.length,o=0,a=-1,f=0,c=0;if(null==n)for(;++a<i;)isNaN(e=u(t[a]))||(c+=(r=e-f)*(e-(f+=r/++o)));else for(;++a<i;)isNaN(e=u(n(t[a],a,t)))||(c+=(r=e-f)*(e-(f+=r/++o)));if(o>1)return c/(o-1)}function c(t,n){var e=f(t,n);return e?Math.sqrt(e):e}function s(t,n){var e,r,i,o=t.length,a=-1;if(null==n){for(;++a<o;)if(null!=(e=t[a])&&e>=e)for(r=i=e;++a<o;)null!=(e=t[a])&&(r>e&&(r=e),i<e&&(i=e))}else for(;++a<o;)if(null!=(e=n(t[a],a,t))&&e>=e)for(r=i=e;++a<o;)null!=(e=n(t[a],a,t))&&(r>e&&(r=e),i<e&&(i=e));return[r,i]}var l=Array.prototype,h=l.slice,d=l.map;function p(t){return function(){return t}}function v(t){return t}function g(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}var y=Math.sqrt(50),_=Math.sqrt(10),b=Math.sqrt(2);function m(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(a=x(t,n,e))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)*a;else for(t=Math.floor(t*a),n=Math.ceil(n*a),o=new Array(i=Math.ceil(t-n+1));++u<i;)o[u]=(t-u)/a;return r&&o.reverse(),o}function x(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=y?10:o>=_?5:o>=b?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=y?10:o>=_?5:o>=b?2:1)}function w(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=y?i*=10:o>=_?i*=5:o>=b&&(i*=2),n<t?-i:i}function M(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}function A(t,n,e){if(null==e&&(e=u),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function T(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&e>r&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&e>r&&(r=e);return r}function N(t){for(var n,e,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(e=new Array(a);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e}function S(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&r>e&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&r>e&&(r=e);return r}function E(t){if(!(i=t.length))return[];for(var n=-1,e=S(t,k),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r}function k(t){return t.length}var C=Array.prototype.slice;function P(t){return t}var z=1,R=2,L=3,D=4,U=1e-6;function q(t){return"translate("+(t+.5)+",0)"}function O(t){return"translate(0,"+(t+.5)+")"}function Y(){return!this.__axis}function B(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,f=t===z||t===D?-1:1,c=t===D||t===R?"x":"y",s=t===z||t===L?q:O;function l(l){var h=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,d=null==i?n.tickFormat?n.tickFormat.apply(n,e):P:i,p=Math.max(o,0)+u,v=n.range(),g=+v[0]+.5,y=+v[v.length-1]+.5,_=(n.bandwidth?function(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}:function(t){return function(n){return+t(n)}})(n.copy()),b=l.selection?l.selection():l,m=b.selectAll(".domain").data([null]),x=b.selectAll(".tick").data(h,n).order(),w=x.exit(),M=x.enter().append("g").attr("class","tick"),A=x.select("line"),T=x.select("text");m=m.merge(m.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(M),A=A.merge(M.append("line").attr("stroke","currentColor").attr(c+"2",f*o)),T=T.merge(M.append("text").attr("fill","currentColor").attr(c,f*p).attr("dy",t===z?"0em":t===L?"0.71em":"0.32em")),l!==b&&(m=m.transition(l),x=x.transition(l),A=A.transition(l),T=T.transition(l),w=w.transition(l).attr("opacity",U).attr("transform",function(t){return isFinite(t=_(t))?s(t):this.getAttribute("transform")}),M.attr("opacity",U).attr("transform",function(t){var n=this.parentNode.__axis;return s(n&&isFinite(n=n(t))?n:_(t))})),w.remove(),m.attr("d",t===D||t==R?a?"M"+f*a+","+g+"H0.5V"+y+"H"+f*a:"M0.5,"+g+"V"+y:a?"M"+g+","+f*a+"V0.5H"+y+"V"+f*a:"M"+g+",0.5H"+y),x.attr("opacity",1).attr("transform",function(t){return s(_(t))}),A.attr(c+"2",f*o),T.attr(c,f*p).text(d),b.filter(Y).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===R?"start":t===D?"end":"middle"),b.each(function(){this.__axis=_})}return l.scale=function(t){return arguments.length?(n=t,l):n},l.ticks=function(){return e=C.call(arguments),l},l.tickArguments=function(t){return arguments.length?(e=null==t?[]:C.call(t),l):e.slice()},l.tickValues=function(t){return arguments.length?(r=null==t?null:C.call(t),l):r&&r.slice()},l.tickFormat=function(t){return arguments.length?(i=t,l):i},l.tickSize=function(t){return arguments.length?(o=a=+t,l):o},l.tickSizeInner=function(t){return arguments.length?(o=+t,l):o},l.tickSizeOuter=function(t){return arguments.length?(a=+t,l):a},l.tickPadding=function(t){return arguments.length?(u=+t,l):u},l}var F={value:function(){}};function I(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new H(r)}function H(t){this._=t}function j(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function X(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=F,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}H.prototype=I.prototype={constructor:H,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=X(i[e],t.name,n);else if(null==n)for(e in i)i[e]=X(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=j(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new H(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var G="http://www.w3.org/1999/xhtml",V={svg:"http://www.w3.org/2000/svg",xhtml:G,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),V.hasOwnProperty(n)?{space:V[n],local:t}:t}function W(t){var n=$(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===G&&n.documentElement.namespaceURI===G?n.createElement(t):n.createElementNS(e,t)}})(n)}function Z(){}function Q(t){return null==t?Z:function(){return this.querySelector(t)}}function J(){return[]}function K(t){return null==t?J:function(){return this.querySelectorAll(t)}}var tt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var nt=document.documentElement;if(!nt.matches){var et=nt.webkitMatchesSelector||nt.msMatchesSelector||nt.mozMatchesSelector||nt.oMatchesSelector;tt=function(t){return function(){return et.call(this,t)}}}}var rt=tt;function it(t){return new Array(t.length)}function ot(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}ot.prototype={constructor:ot,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var at="$";function ut(t,n,e,r,i,o){for(var a,u=0,f=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new ot(t,o[u]);for(;u<f;++u)(a=n[u])&&(i[u]=a)}function ft(t,n,e,r,i,o,a){var u,f,c,s={},l=n.length,h=o.length,d=new Array(l);for(u=0;u<l;++u)(f=n[u])&&(d[u]=c=at+a.call(f,f.__data__,u,n),c in s?i[u]=f:s[c]=f);for(u=0;u<h;++u)(f=s[c=at+a.call(t,o[u],u,o)])?(r[u]=f,f.__data__=o[u],s[c]=null):e[u]=new ot(t,o[u]);for(u=0;u<l;++u)(f=n[u])&&s[d[u]]===f&&(i[u]=f)}function ct(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function st(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function lt(t,n){return t.style.getPropertyValue(n)||st(t).getComputedStyle(t,null).getPropertyValue(n)}function ht(t){return t.trim().split(/^|\s+/)}function dt(t){return t.classList||new pt(t)}function pt(t){this._node=t,this._names=ht(t.getAttribute("class")||"")}function vt(t,n){for(var e=dt(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function gt(t,n){for(var e=dt(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function yt(){this.textContent=""}function _t(){this.innerHTML=""}function bt(){this.nextSibling&&this.parentNode.appendChild(this)}function mt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xt(){return null}function wt(){var t=this.parentNode;t&&t.removeChild(this)}function Mt(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function At(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}pt.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Tt={};(t.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(Tt={mouseenter:"mouseover",mouseleave:"mouseout"}));function Nt(t,n,e){return t=St(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function St(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function Et(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function kt(t,n,e){var r=Tt.hasOwnProperty(t.type)?Nt:St;return function(i,o,a){var u,f=this.__on,c=r(n,o,a);if(f)for(var s=0,l=f.length;s<l;++s)if((u=f[s]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=c,u.capture=e),void(u.value=n);this.addEventListener(t.type,c,e),u={type:t.type,name:t.name,value:n,listener:c,capture:e},f?f.push(u):this.__on=[u]}}function Ct(n,e,r,i){var o=t.event;n.sourceEvent=t.event,t.event=n;try{return e.apply(r,i)}finally{t.event=o}}function Pt(t,n,e){var r=st(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}var zt=[null];function Rt(t,n){this._groups=t,this._parents=n}function Lt(){return new Rt([[document.documentElement]],zt)}function Dt(t){return"string"==typeof t?new Rt([[document.querySelector(t)]],[document.documentElement]):new Rt([[t]],zt)}Rt.prototype=Lt.prototype={constructor:Rt,select:function(t){"function"!=typeof t&&(t=Q(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],f=u.length,c=r[i]=new Array(f),s=0;s<f;++s)(o=u[s])&&(a=t.call(o,o.__data__,s,u))&&("__data__"in o&&(a.__data__=o.__data__),c[s]=a);return new Rt(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=K(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],f=u.length,c=0;c<f;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new Rt(r,i)},filter:function(t){"function"!=typeof t&&(t=rt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,f=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&f.push(o);return new Rt(r,this._parents)},data:function(t,n){if(!t)return p=new Array(this.size()),s=-1,this.each(function(t){p[++s]=t}),p;var e,r=n?ft:ut,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,u=new Array(a),f=new Array(a),c=new Array(a),s=0;s<a;++s){var l=i[s],h=o[s],d=h.length,p=t.call(l,l&&l.__data__,s,i),v=p.length,g=f[s]=new Array(v),y=u[s]=new Array(v);r(l,h,g,y,c[s]=new Array(d),p,n);for(var _,b,m=0,x=0;m<v;++m)if(_=g[m]){for(m>=x&&(x=m+1);!(b=y[x])&&++x<v;);_._next=b||null}}return(u=new Rt(u,i))._enter=f,u._exit=c,u},enter:function(){return new Rt(this._enter||this._groups.map(it),this._parents)},exit:function(){return new Rt(this._exit||this._groups.map(it),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var f,c=n[u],s=e[u],l=c.length,h=a[u]=new Array(l),d=0;d<l;++d)(f=c[d]||s[d])&&(h[d]=f);for(;u<r;++u)a[u]=n[u];return new Rt(a,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=ct);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],f=u.length,c=i[o]=new Array(f),s=0;s<f;++s)(a=u[s])&&(c[s]=a);c.sort(n)}return new Rt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=$(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):lt(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=ht(t+"");if(arguments.length<2){for(var r=dt(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?vt:gt)(this,t)}}:n?function(t){return function(){vt(this,t)}}:function(t){return function(){gt(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?yt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?_t:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(bt)},lower:function(){return this.each(mt)},append:function(t){var n="function"==typeof t?t:W(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:W(t),r=null==n?xt:"function"==typeof n?n:Q(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(wt)},clone:function(t){return this.select(t?At:Mt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?kt:Et,null==e&&(e=!1),r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var f,c=0,s=u.length;c<s;++c)for(r=0,f=u[c];r<a;++r)if((i=o[r]).type===f.type&&i.name===f.name)return f.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return Pt(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return Pt(this,t,n)}})(t,n))}};var Ut=0;function qt(){return new Ot}function Ot(){this._="@"+(++Ut).toString(36)}function Yt(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function Bt(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]}function Ft(t){var n=Yt();return n.changedTouches&&(n=n.changedTouches[0]),Bt(t,n)}function It(t,n,e){arguments.length<3&&(e=n,n=Yt().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return Bt(t,r);return null}function Ht(){t.event.stopImmediatePropagation()}function jt(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function Xt(t){var n=t.document.documentElement,e=Dt(t).on("dragstart.drag",jt,!0);"onselectstart"in n?e.on("selectstart.drag",jt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Gt(t,n){var e=t.document.documentElement,r=Dt(t).on("dragstart.drag",null);n&&(r.on("click.drag",jt,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}function Vt(t){return function(){return t}}function $t(t,n,e,r,i,o,a,u,f,c){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=a,this.dx=u,this.dy=f,this._=c}function Wt(){return!t.event.button}function Zt(){return this.parentNode}function Qt(n){return null==n?{x:t.event.x,y:t.event.y}:n}function Jt(){return"ontouchstart"in this}function Kt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function tn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function nn(){}Ot.prototype=qt.prototype={constructor:Ot,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}},$t.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var en="\\s*([+-]?\\d+)\\s*",rn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",on="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",an=/^#([0-9a-f]{3})$/,un=/^#([0-9a-f]{6})$/,fn=new RegExp("^rgb\\("+[en,en,en]+"\\)$"),cn=new RegExp("^rgb\\("+[on,on,on]+"\\)$"),sn=new RegExp("^rgba\\("+[en,en,en,rn]+"\\)$"),ln=new RegExp("^rgba\\("+[on,on,on,rn]+"\\)$"),hn=new RegExp("^hsl\\("+[rn,on,on]+"\\)$"),dn=new RegExp("^hsla\\("+[rn,on,on,rn]+"\\)$"),pn={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 vn(t){var n;return t=(t+"").trim().toLowerCase(),(n=an.exec(t))?new mn((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=un.exec(t))?gn(parseInt(n[1],16)):(n=fn.exec(t))?new mn(n[1],n[2],n[3],1):(n=cn.exec(t))?new mn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=sn.exec(t))?yn(n[1],n[2],n[3],n[4]):(n=ln.exec(t))?yn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=hn.exec(t))?wn(n[1],n[2]/100,n[3]/100,1):(n=dn.exec(t))?wn(n[1],n[2]/100,n[3]/100,n[4]):pn.hasOwnProperty(t)?gn(pn[t]):"transparent"===t?new mn(NaN,NaN,NaN,0):null}function gn(t){return new mn(t>>16&255,t>>8&255,255&t,1)}function yn(t,n,e,r){return r<=0&&(t=n=e=NaN),new mn(t,n,e,r)}function _n(t){return t instanceof nn||(t=vn(t)),t?new mn((t=t.rgb()).r,t.g,t.b,t.opacity):new mn}function bn(t,n,e,r){return 1===arguments.length?_n(t):new mn(t,n,e,null==r?1:r)}function mn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function xn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function wn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new An(t,n,e,r)}function Mn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);if(t instanceof nn||(t=vn(t)),!t)return new An;if(t instanceof An)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,f=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=f<.5?o+i:2-o-i,a*=60):u=f>0&&f<1?0:a,new An(a,u,f,t.opacity)}(t):new An(t,n,e,null==r?1:r)}function An(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Tn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Kt(nn,vn,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Kt(mn,bn,tn(nn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new mn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new mn(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"#"+xn(this.r)+xn(this.g)+xn(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+")")}})),Kt(An,Mn,tn(nn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new An(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new mn(Tn(t>=240?t-240:t+120,i,r),Tn(t,i,r),Tn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Nn=Math.PI/180,Sn=180/Math.PI,En=.96422,kn=1,Cn=.82521,Pn=4/29,zn=6/29,Rn=3*zn*zn,Ln=zn*zn*zn;function Dn(t){if(t instanceof qn)return new qn(t.l,t.a,t.b,t.opacity);if(t instanceof jn){if(isNaN(t.h))return new qn(t.l,0,0,t.opacity);var n=t.h*Nn;return new qn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof mn||(t=_n(t));var e,r,i=Fn(t.r),o=Fn(t.g),a=Fn(t.b),u=On((.2225045*i+.7168786*o+.0606169*a)/kn);return i===o&&o===a?e=r=u:(e=On((.4360747*i+.3850649*o+.1430804*a)/En),r=On((.0139322*i+.0971045*o+.7141733*a)/Cn)),new qn(116*u-16,500*(e-u),200*(u-r),t.opacity)}function Un(t,n,e,r){return 1===arguments.length?Dn(t):new qn(t,n,e,null==r?1:r)}function qn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function On(t){return t>Ln?Math.pow(t,1/3):t/Rn+Pn}function Yn(t){return t>zn?t*t*t:Rn*(t-Pn)}function Bn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Fn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function In(t){if(t instanceof jn)return new jn(t.h,t.c,t.l,t.opacity);if(t instanceof qn||(t=Dn(t)),0===t.a&&0===t.b)return new jn(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Sn;return new jn(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Hn(t,n,e,r){return 1===arguments.length?In(t):new jn(t,n,e,null==r?1:r)}function jn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}Kt(qn,Un,tn(nn,{brighter:function(t){return new qn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new qn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new mn(Bn(3.1338561*(n=En*Yn(n))-1.6168667*(t=kn*Yn(t))-.4906146*(e=Cn*Yn(e))),Bn(-.9787684*n+1.9161415*t+.033454*e),Bn(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Kt(jn,Hn,tn(nn,{brighter:function(t){return new jn(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new jn(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Dn(this).rgb()}}));var Xn=-.14861,Gn=1.78277,Vn=-.29227,$n=-.90649,Wn=1.97294,Zn=Wn*$n,Qn=Wn*Gn,Jn=Gn*Vn-$n*Xn;function Kn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof te)return new te(t.h,t.s,t.l,t.opacity);t instanceof mn||(t=_n(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Jn*r+Zn*n-Qn*e)/(Jn+Zn-Qn),o=r-i,a=(Wn*(e-i)-Vn*o)/$n,u=Math.sqrt(a*a+o*o)/(Wn*i*(1-i)),f=u?Math.atan2(a,o)*Sn-120:NaN;return new te(f<0?f+360:f,u,i,t.opacity)}(t):new te(t,n,e,null==r?1:r)}function te(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function ne(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function ee(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return ne((e-r/n)*n,a,i,o,u)}}function re(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return ne((e-r/n)*n,i,o,a,u)}}function ie(t){return function(){return t}}function oe(t,n){return function(e){return t+e*n}}function ae(t,n){var e=n-t;return e?oe(t,e>180||e<-180?e-360*Math.round(e/360):e):ie(isNaN(t)?n:t)}function ue(t){return 1==(t=+t)?fe:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):ie(isNaN(n)?e:n)}}function fe(t,n){var e=n-t;return e?oe(t,e):ie(isNaN(t)?n:t)}Kt(te,Kn,tn(nn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new te(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new te(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Nn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new mn(255*(n+e*(Xn*r+Gn*i)),255*(n+e*(Vn*r+$n*i)),255*(n+e*(Wn*r)),this.opacity)}}));var ce=function t(n){var e=ue(n);function r(t,n){var r=e((t=bn(t)).r,(n=bn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=fe(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function se(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=bn(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var le=se(ee),he=se(re);function de(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=me(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function pe(t,n){var e=new Date;return n-=t=+t,function(r){return e.setTime(t+n*r),e}}function ve(t,n){return n-=t=+t,function(e){return t+n*e}}function ge(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=me(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var ye=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_e=new RegExp(ye.source,"g");function be(t,n){var e,r,i,o=ye.lastIndex=_e.lastIndex=0,a=-1,u=[],f=[];for(t+="",n+="";(e=ye.exec(t))&&(r=_e.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,f.push({i:a,x:ve(e,r)})),o=_e.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?f[0]?function(t){return function(n){return t(n)+""}}(f[0].x):function(t){return function(){return t}}(n):(n=f.length,function(t){for(var e,r=0;r<n;++r)u[(e=f[r]).i]=e.x(t);return u.join("")})}function me(t,n){var e,r=typeof n;return null==n||"boolean"===r?ie(n):("number"===r?ve:"string"===r?(e=vn(n))?(n=e,ce):be:n instanceof vn?ce:n instanceof Date?pe:Array.isArray(n)?de:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?ge:ve)(t,n)}function xe(t,n){return n-=t=+t,function(e){return Math.round(t+n*e)}}var we,Me,Ae,Te,Ne=180/Math.PI,Se={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ee(t,n,e,r,i,o){var a,u,f;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(f=t*e+n*r)&&(e-=t*f,r-=n*f),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,f/=u),t*r<n*e&&(t=-t,n=-n,f=-f,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Ne,skewX:Math.atan(f)*Ne,scaleX:a,scaleY:u}}function ke(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],f=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var f=a.push("translate(",null,n,null,e);u.push({i:f-4,x:ve(t,i)},{i:f-2,x:ve(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,f),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:ve(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,f),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:ve(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,f),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:ve(t,e)},{i:u-2,x:ve(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,f),o=a=null,function(t){for(var n,e=-1,r=f.length;++e<r;)u[(n=f[e]).i]=n.x(t);return u.join("")}}}var Ce=ke(function(t){return"none"===t?Se:(we||(we=document.createElement("DIV"),Me=document.documentElement,Ae=document.defaultView),we.style.transform=t,t=Ae.getComputedStyle(Me.appendChild(we),null).getPropertyValue("transform"),Me.removeChild(we),Ee(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Pe=ke(function(t){return null==t?Se:(Te||(Te=document.createElementNS("http://www.w3.org/2000/svg","g")),Te.setAttribute("transform",t),(t=Te.transform.baseVal.consolidate())?Ee((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Se)},", ",")",")"),ze=Math.SQRT2,Re=2,Le=4,De=1e-12;function Ue(t){return((t=Math.exp(t))+1/t)/2}function qe(t,n){var e,r,i=t[0],o=t[1],a=t[2],u=n[0],f=n[1],c=n[2],s=u-i,l=f-o,h=s*s+l*l;if(h<De)r=Math.log(c/a)/ze,e=function(t){return[i+t*s,o+t*l,a*Math.exp(ze*t*r)]};else{var d=Math.sqrt(h),p=(c*c-a*a+Le*h)/(2*a*Re*d),v=(c*c-a*a-Le*h)/(2*c*Re*d),g=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(v*v+1)-v);r=(y-g)/ze,e=function(t){var n,e=t*r,u=Ue(g),f=a/(Re*d)*(u*(n=ze*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+f*s,o+f*l,a*u/Ue(ze*e+g)]}}return e.duration=1e3*r,e}function Oe(t){return function(n,e){var r=t((n=Mn(n)).h,(e=Mn(e)).h),i=fe(n.s,e.s),o=fe(n.l,e.l),a=fe(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ye=Oe(ae),Be=Oe(fe);function Fe(t){return function(n,e){var r=t((n=Hn(n)).h,(e=Hn(e)).h),i=fe(n.c,e.c),o=fe(n.l,e.l),a=fe(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ie=Fe(ae),He=Fe(fe);function je(t){return function n(e){function r(n,r){var i=t((n=Kn(n)).h,(r=Kn(r)).h),o=fe(n.s,r.s),a=fe(n.l,r.l),u=fe(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var Xe=je(ae),Ge=je(fe);var Ve,$e,We=0,Ze=0,Qe=0,Je=1e3,Ke=0,tr=0,nr=0,er="object"==typeof performance&&performance.now?performance:Date,rr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ir(){return tr||(rr(or),tr=er.now()+nr)}function or(){tr=0}function ar(){this._call=this._time=this._next=null}function ur(t,n,e){var r=new ar;return r.restart(t,n,e),r}function fr(){ir(),++We;for(var t,n=Ve;n;)(t=tr-n._time)>=0&&n._call.call(null,t),n=n._next;--We}function cr(){tr=(Ke=er.now())+nr,We=Ze=0;try{fr()}finally{We=0,function(){var t,n,e=Ve,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ve=n);$e=t,lr(r)}(),tr=0}}function sr(){var t=er.now(),n=t-Ke;n>Je&&(nr-=n,Ke=t)}function lr(t){We||(Ze&&(Ze=clearTimeout(Ze)),t-tr>24?(t<1/0&&(Ze=setTimeout(cr,t-er.now()-nr)),Qe&&(Qe=clearInterval(Qe))):(Qe||(Ke=er.now(),Qe=setInterval(sr,Je)),We=1,rr(cr)))}function hr(t,n,e){var r=new ar;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}ar.prototype=ur.prototype={constructor:ar,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?ir():+e)+(null==n?0:+n),this._next||$e===this||($e?$e._next=this:Ve=this,$e=this),this._call=t,this._time=e,lr()},stop:function(){this._call&&(this._call=null,this._time=1/0,lr())}};var dr=I("start","end","interrupt"),pr=[],vr=0,gr=1,yr=2,_r=3,br=4,mr=5,xr=6;function wr(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(f){var c,s,l,h;if(e.state!==gr)return u();for(c in i)if((h=i[c]).name===e.name){if(h.state===_r)return hr(o);h.state===br?(h.state=xr,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<n&&(h.state=xr,h.timer.stop(),delete i[c])}if(hr(function(){e.state===_r&&(e.state=br,e.timer.restart(a,e.delay,e.time),a(f))}),e.state=yr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===yr){for(e.state=_r,r=new Array(l=e.tween.length),c=0,s=-1;c<l;++c)(h=e.tween[c].value.call(t,t.__data__,e.index,e.group))&&(r[++s]=h);r.length=s+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(u),e.state=mr,1),o=-1,a=r.length;++o<a;)r[o].call(null,i);e.state===mr&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){for(var r in e.state=xr,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=ur(function(t){e.state=gr,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:dr,tween:pr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:vr})}function Mr(t,n){var e=Tr(t,n);if(e.state>vr)throw new Error("too late; already scheduled");return e}function Ar(t,n){var e=Tr(t,n);if(e.state>yr)throw new Error("too late; already started");return e}function Tr(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Nr(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>yr&&e.state<mr,e.state=xr,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Sr(t,n,e){var r=t._id;return t.each(function(){var t=Ar(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Tr(t,r).value[n]}}function Er(t,n){var e;return("number"==typeof n?ve:n instanceof vn?ce:(e=vn(n))?(n=e,ce):be)(t,n)}var kr=Lt.prototype.constructor;var Cr=0;function Pr(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function zr(t){return Lt().transition(t)}function Rr(){return++Cr}var Lr=Lt.prototype;function Dr(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function Ur(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}Pr.prototype=zr.prototype={constructor:Pr,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Q(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,f,c=r[a],s=c.length,l=o[a]=new Array(s),h=0;h<s;++h)(u=c[h])&&(f=t.call(u,u.__data__,h,c))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,wr(l[h],n,e,h,l,Tr(u,e)));return new Pr(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=K(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var f,c=r[u],s=c.length,l=0;l<s;++l)if(f=c[l]){for(var h,d=t.call(f,f.__data__,l,c),p=Tr(f,e),v=0,g=d.length;v<g;++v)(h=d[v])&&wr(h,n,e,v,d,p);o.push(d),a.push(f)}return new Pr(o,a,n,e)},filter:function(t){"function"!=typeof t&&(t=rt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,f=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&f.push(o);return new Pr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var f,c=n[u],s=e[u],l=c.length,h=a[u]=new Array(l),d=0;d<l;++d)(f=c[d]||s[d])&&(h[d]=f);for(;u<r;++u)a[u]=n[u];return new Pr(a,this._parents,this._name,this._id)},selection:function(){return new kr(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Rr(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],f=u.length,c=0;c<f;++c)if(a=u[c]){var s=Tr(a,n);wr(a,t,e,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Pr(r,this._parents,t,e)},call:Lr.call,nodes:Lr.nodes,node:Lr.node,size:Lr.size,empty:Lr.empty,each:Lr.each,on:function(t,n){var e=this._id;return arguments.length<2?Tr(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?Mr:Ar;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=$(t),r="transform"===e?Pe:Er;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,u=e(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===u?null:a===r&&u===i?o:o=n(r=a,i=u);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var a,u=e(this);if(null!=u)return(a=this.getAttribute(t))===u?null:a===r&&u===i?o:o=n(r=a,i=u);this.removeAttribute(t)}})(e,r,Sr(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}:function(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=$(t);return this.tween(e,(r.local?function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}:function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Ce:Er;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=lt(this,t),a=(this.style.removeProperty(t),lt(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof n?function(t,n,e){var r,i,o;return function(){var a=lt(this,t),u=e(this);return null==u&&(this.style.removeProperty(t),u=lt(this,t)),a===u?null:a===r&&u===i?o:o=n(r=a,i=u)}}(t,r,Sr(this,"style."+t,n)):function(t,n,e){var r,i;return function(){var o=lt(this,t);return o===e?null:o===r?i:i=n(r=o,e)}}(t,r,n+""),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Sr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Tr(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(t,n){var e,r;return function(){var i=Ar(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}:function(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Ar(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},f=0,c=i.length;f<c;++f)if(i[f].name===n){i[f]=u;break}f===c&&i.push(u)}o.tween=i}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Mr(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Mr(this,t).delay=n}})(n,t)):Tr(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Ar(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Ar(this,t).duration=n}})(n,t)):Tr(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){Ar(this,t).ease=n}}(n,t)):Tr(this.node(),n).ease}};var qr=function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),Or=function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),Yr=function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),Br=Math.PI,Fr=Br/2;function Ir(t){return(1-Math.cos(Br*t))/2}function Hr(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function jr(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var Xr=4/11,Gr=6/11,Vr=8/11,$r=.75,Wr=9/11,Zr=10/11,Qr=.9375,Jr=21/22,Kr=63/64,ti=1/Xr/Xr;function ni(t){return(t=+t)<Xr?ti*t*t:t<Vr?ti*(t-=Gr)*t+$r:t<Zr?ti*(t-=Wr)*t+Qr:ti*(t-=Jr)*t+Kr}var ei=function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(1.70158),ri=function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(1.70158),ii=function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(1.70158),oi=2*Math.PI,ai=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=oi);function i(t){return n*Math.pow(2,10*--t)*Math.sin((r-t)/e)}return i.amplitude=function(n){return t(n,e*oi)},i.period=function(e){return t(n,e)},i}(1,.3),ui=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=oi);function i(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/e)}return i.amplitude=function(n){return t(n,e*oi)},i.period=function(e){return t(n,e)},i}(1,.3),fi=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=oi);function i(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((r-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((r+t)/e))/2}return i.amplitude=function(n){return t(n,e*oi)},i.period=function(e){return t(n,e)},i}(1,.3),ci={time:null,delay:0,duration:250,ease:Ur};function si(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return ci.time=ir(),ci;return e}Lt.prototype.interrupt=function(t){return this.each(function(){Nr(this,t)})},Lt.prototype.transition=function(t){var n,e;t instanceof Pr?(n=t._id,t=t._name):(n=Rr(),(e=ci).time=ir(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],f=u.length,c=0;c<f;++c)(a=u[c])&&wr(a,t,n,c,u,e||si(a,n));return new Pr(r,this._parents,t,n)};var li=[null];function hi(t){return function(){return t}}function di(t,n,e){this.target=t,this.type=n,this.selection=e}function pi(){t.event.stopImmediatePropagation()}function vi(){t.event.preventDefault(),t.event.stopImmediatePropagation()}var gi={name:"drag"},yi={name:"space"},_i={name:"handle"},bi={name:"center"},mi={name:"x",handles:["e","w"].map(Ei),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},xi={name:"y",handles:["n","s"].map(Ei),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},wi={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(Ei),input:function(t){return t},output:function(t){return t}},Mi={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ai={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Ti={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Ni={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Si={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ei(t){return{type:t}}function ki(){return!t.event.button}function Ci(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Pi(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function zi(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Ri(n){var e,r=Ci,i=ki,o=I(u,"start","brush","end"),a=6;function u(t){var e=t.property("__brush",h).selectAll(".overlay").data([Ei("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Mi.overlay).merge(e).each(function(){var t=Pi(this).extent;Dt(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([Ei("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Mi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(n.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Mi[t.type]}),t.each(f).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",l)}function f(){var t=Dt(this),n=Pi(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-a/2:n[0][0]-a/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-a/2:n[0][1]-a/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+a:a}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+a:a})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function c(t,n){return t.__brush.emitter||new s(t,n)}function s(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function l(){if(t.event.touches){if(t.event.changedTouches.length<t.event.touches.length)return vi()}else if(e)return;if(i.apply(this,arguments)){var r,o,a,u,s,l,h,d,p,v,g,y,_,b=this,m=t.event.target.__data__.type,x="selection"===(t.event.metaKey?m="overlay":m)?gi:t.event.altKey?bi:_i,w=n===xi?null:Ni[m],M=n===mi?null:Si[m],A=Pi(b),T=A.extent,N=A.selection,S=T[0][0],E=T[0][1],k=T[1][0],C=T[1][1],P=w&&M&&t.event.shiftKey,z=Ft(b),R=z,L=c(b,arguments).beforestart();"overlay"===m?A.selection=N=[[r=n===xi?S:z[0],a=n===mi?E:z[1]],[s=n===xi?k:r,h=n===mi?C:a]]:(r=N[0][0],a=N[0][1],s=N[1][0],h=N[1][1]),o=r,u=a,l=s,d=h;var D=Dt(b).attr("pointer-events","none"),U=D.selectAll(".overlay").attr("cursor",Mi[m]);if(t.event.touches)D.on("touchmove.brush",O,!0).on("touchend.brush touchcancel.brush",B,!0);else{var q=Dt(t.event.view).on("keydown.brush",function(){switch(t.event.keyCode){case 16:P=w&&M;break;case 18:x===_i&&(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=bi,Y());break;case 32:x!==_i&&x!==bi||(w<0?s=l-p:w>0&&(r=o-p),M<0?h=d-v:M>0&&(a=u-v),x=yi,U.attr("cursor",Mi.selection),Y());break;default:return}vi()},!0).on("keyup.brush",function(){switch(t.event.keyCode){case 16:P&&(y=_=P=!1,Y());break;case 18:x===bi&&(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=_i,Y());break;case 32:x===yi&&(t.event.altKey?(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=bi):(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=_i),U.attr("cursor",Mi[m]),Y());break;default:return}vi()},!0).on("mousemove.brush",O,!0).on("mouseup.brush",B,!0);Xt(t.event.view)}pi(),Nr(b),f.call(b),L.start()}function O(){var t=Ft(b);!P||y||_||(Math.abs(t[0]-R[0])>Math.abs(t[1]-R[1])?_=!0:y=!0),R=t,g=!0,vi(),Y()}function Y(){var t;switch(p=R[0]-z[0],v=R[1]-z[1],x){case yi:case gi:w&&(p=Math.max(S-r,Math.min(k-s,p)),o=r+p,l=s+p),M&&(v=Math.max(E-a,Math.min(C-h,v)),u=a+v,d=h+v);break;case _i:w<0?(p=Math.max(S-r,Math.min(k-r,p)),o=r+p,l=s):w>0&&(p=Math.max(S-s,Math.min(k-s,p)),o=r,l=s+p),M<0?(v=Math.max(E-a,Math.min(C-a,v)),u=a+v,d=h):M>0&&(v=Math.max(E-h,Math.min(C-h,v)),u=a,d=h+v);break;case bi:w&&(o=Math.max(S,Math.min(k,r-p*w)),l=Math.max(S,Math.min(k,s+p*w))),M&&(u=Math.max(E,Math.min(C,a-v*M)),d=Math.max(E,Math.min(C,h+v*M)))}l<o&&(w*=-1,t=r,r=s,s=t,t=o,o=l,l=t,m in Ai&&U.attr("cursor",Mi[m=Ai[m]])),d<u&&(M*=-1,t=a,a=h,h=t,t=u,u=d,d=t,m in Ti&&U.attr("cursor",Mi[m=Ti[m]])),A.selection&&(N=A.selection),y&&(o=N[0][0],l=N[1][0]),_&&(u=N[0][1],d=N[1][1]),N[0][0]===o&&N[0][1]===u&&N[1][0]===l&&N[1][1]===d||(A.selection=[[o,u],[l,d]],f.call(b),L.brush())}function B(){if(pi(),t.event.touches){if(t.event.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500),D.on("touchmove.brush touchend.brush touchcancel.brush",null)}else Gt(t.event.view,g),q.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);D.attr("pointer-events","all"),U.attr("cursor",Mi.overlay),A.selection&&(N=A.selection),zi(N)&&(A.selection=null,f.call(b)),L.end()}}function h(){var t=this.__brush||{selection:null};return t.extent=r.apply(this,arguments),t.dim=n,t}return u.move=function(t,e){t.selection?t.on("start.brush",function(){c(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){c(this,arguments).end()}).tween("brush",function(){var t=this,r=t.__brush,i=c(t,arguments),o=r.selection,a=n.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=me(o,a);function s(n){r.selection=1===n&&zi(a)?null:u(n),f.call(t),i.brush()}return o&&a?s:s(1)}):t.each(function(){var t=arguments,r=this.__brush,i=n.input("function"==typeof e?e.apply(this,t):e,r.extent),o=c(this,t).beforestart();Nr(this),r.selection=null==i||zi(i)?null:i,f.call(this),o.start().brush().end()})},s.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){Ct(new di(u,t,n.output(this.state.selection)),o.apply,o,[t,this.that,this.args])}},u.extent=function(t){return arguments.length?(r="function"==typeof t?t:hi([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),u):r},u.filter=function(t){return arguments.length?(i="function"==typeof t?t:hi(!!t),u):i},u.handleSize=function(t){return arguments.length?(a=+t,u):a},u.on=function(){var t=o.on.apply(o,arguments);return t===o?u:t},u}var Li=Math.cos,Di=Math.sin,Ui=Math.PI,qi=Ui/2,Oi=2*Ui,Yi=Math.max;var Bi=Array.prototype.slice;function Fi(t){return function(){return t}}var Ii=Math.PI,Hi=2*Ii,ji=Hi-1e-6;function Xi(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Gi(){return new Xi}function Vi(t){return t.source}function $i(t){return t.target}function Wi(t){return t.radius}function Zi(t){return t.startAngle}function Qi(t){return t.endAngle}Xi.prototype=Gi.prototype={constructor:Xi,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,a=this._y1,u=e-t,f=r-n,c=o-t,s=a-n,l=c*c+s*s;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(l>1e-6)if(Math.abs(s*u-f*c)>1e-6&&i){var h=e-o,d=r-a,p=u*u+f*f,v=h*h+d*d,g=Math.sqrt(p),y=Math.sqrt(l),_=i*Math.tan((Ii-Math.acos((p+l-v)/(2*g*y)))/2),b=_/y,m=_/g;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*c)+","+(n+b*s)),this._+="A"+i+","+i+",0,0,"+ +(s*h>c*d)+","+(this._x1=t+m*u)+","+(this._y1=n+m*f)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n;var a=(e=+e)*Math.cos(r),u=e*Math.sin(r),f=t+a,c=n+u,s=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+f+","+c:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+f+","+c),e&&(l<0&&(l=l%Hi+Hi),l>ji?this._+="A"+e+","+e+",0,1,"+s+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+s+","+(this._x1=f)+","+(this._y1=c):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Ii)+","+s+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};function Ji(){}function Ki(t,n){var e=new Ji;if(t instanceof Ji)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}function to(){return{}}function no(t,n,e){t[n]=e}function eo(){return Ki()}function ro(t,n,e){t.set(n,e)}function io(){}Ji.prototype=Ki.prototype={constructor:Ji,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var oo=Ki.prototype;function ao(t,n){var e=new io;if(t instanceof io)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}io.prototype=ao.prototype={constructor:io,has:oo.has,add:function(t){return this["$"+(t+="")]=t,this},remove:oo.remove,clear:oo.clear,values:oo.keys,size:oo.size,empty:oo.empty,each:oo.each};var uo=Array.prototype.slice;function fo(t,n){return t-n}function co(t){return function(){return t}}function so(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=lo(t,n[r]))return e;return 0}function lo(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var f=t[o],c=f[0],s=f[1],l=t[u],h=l[0],d=l[1];if(ho(f,l,n))return 0;s>r!=d>r&&e<(h-c)*(r-s)/(d-s)+c&&(i=-i)}return i}function ho(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function po(){}var vo=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function go(){var t=1,n=1,e=M,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(fo);else{var r=s(t),i=r[0],a=r[1];n=w(i,a,n),n=g(Math.floor(i/n)*n,Math.floor(a/n)*n,n)}return n.map(function(n){return o(t,n)})}function o(e,i){var o=[],u=[];return function(e,r,i){var o,u,f,c,s,l,h=new Array,d=new Array;o=u=-1,c=e[0]>=r,vo[c<<1].forEach(p);for(;++o<t-1;)f=c,c=e[o+1]>=r,vo[f|c<<1].forEach(p);vo[c<<0].forEach(p);for(;++u<n-1;){for(o=-1,c=e[u*t+t]>=r,s=e[u*t]>=r,vo[c<<1|s<<2].forEach(p);++o<t-1;)f=c,c=e[u*t+t+o+1]>=r,l=s,s=e[u*t+o+1]>=r,vo[f|c<<1|s<<2|l<<3].forEach(p);vo[c|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,vo[s<<2].forEach(p);for(;++o<t-1;)l=s,s=e[u*t+o+1]>=r,vo[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],f=[t[1][0]+o,t[1][1]+u],c=a(r),s=a(f);(n=d[c])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(f),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(f),d[n.end=s]=n):(n=h[s])?(e=d[c])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(f),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=c]=n):h[c]=d[s]={start:c,end:s,ring:[r,f]}}vo[s<<3].forEach(p)}(e,i,function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?o.push([t]):u.push(t)}),u.forEach(function(t){for(var n,e=0,r=o.length;e<r;++e)if(-1!==so((n=o[e])[0],t))return void n.push(t)}),{type:"MultiPolygon",value:i,coordinates:o}}function a(n){return 2*n[0]+n[1]*(t+1)*4}function u(e,r,i){e.forEach(function(e){var o,a=e[0],u=e[1],f=0|a,c=0|u,s=r[c*t+f];a>0&&a<t&&f===a&&(o=r[c*t+f-1],e[0]=a+(i-o)/(s-o)-.5),u>0&&u<n&&c===u&&(o=r[(c-1)*t+f],e[1]=u+(i-o)/(s-o)-.5)})}return i.contour=o,i.size=function(e){if(!arguments.length)return[t,n];var r=Math.ceil(e[0]),o=Math.ceil(e[1]);if(!(r>0&&o>0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?co(uo.call(t)):co(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:po,i):r===u},i}function yo(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a<i;++a)for(var u=0,f=0;u<r+e;++u)u<r&&(f+=t.data[u+a*r]),u>=e&&(u>=o&&(f-=t.data[u-o+a*r]),n.data[u-e+a*r]=f/Math.min(u+1,r-1+o-u,o))}function _o(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a<r;++a)for(var u=0,f=0;u<i+e;++u)u<i&&(f+=t.data[a+u*r]),u>=e&&(u>=o&&(f-=t.data[a+(u-o)*r]),n.data[a+(u-e)*r]=f/Math.min(u+1,i-1+o-u,o))}function bo(t){return t[0]}function mo(t){return t[1]}function xo(){return 1}var wo={},Mo={},Ao=34,To=10,No=13;function So(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function Eo(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,f=o<=0,c=!1;function s(){if(f)return Mo;if(c)return c=!1,wo;var n,r,i=a;if(t.charCodeAt(i)===Ao){for(;a++<o&&t.charCodeAt(a)!==Ao||t.charCodeAt(++a)===Ao;);return(n=a)>=o?f=!0:(r=t.charCodeAt(a++))===To?c=!0:r===No&&(c=!0,t.charCodeAt(a)===To&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if((r=t.charCodeAt(n=a++))===To)c=!0;else if(r===No)c=!0,t.charCodeAt(a)===To&&++a;else if(r!==e)continue;return t.slice(i,n)}return f=!0,t.slice(i,o)}for(t.charCodeAt(o-1)===To&&--o,t.charCodeAt(o-1)===No&&--o;(r=s())!==Mo;){for(var l=[];r!==wo&&r!==Mo;)l.push(r),r=s();n&&null==(l=n(l,u++))||i.push(l)}return i}function i(n){return n.map(o).join(t)}function o(t){return null==t?"":n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=So(t);return function(r,i){return n(e(r),i,t)}}(t,n):So(t)});return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=function(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}(n)),[e.map(o).join(t)].concat(n.map(function(n){return e.map(function(t){return o(n[t])}).join(t)})).join("\n")},formatRows:function(t){return t.map(i).join("\n")}}}var ko=Eo(","),Co=ko.parse,Po=ko.parseRows,zo=ko.format,Ro=ko.formatRows,Lo=Eo("\t"),Do=Lo.parse,Uo=Lo.parseRows,qo=Lo.format,Oo=Lo.formatRows;function Yo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function Bo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function Fo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Io(t,n){return fetch(t,n).then(Fo)}function Ho(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),Io(n,e).then(function(n){return t(n,r)})}}var jo=Ho(Co),Xo=Ho(Do);function Go(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.json()}function Vo(t){return function(n,e){return Io(n,e).then(function(n){return(new DOMParser).parseFromString(n,t)})}}var $o=Vo("application/xml"),Wo=Vo("text/html"),Zo=Vo("image/svg+xml");function Qo(t){return function(){return t}}function Jo(){return 1e-6*(Math.random()-.5)}function Ko(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,f,c,s,l,h,d=t._root,p={data:r},v=t._x0,g=t._y0,y=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a,i=d,!(d=d[l=s<<1|c]))return i[l]=p,t;if(u=+t._x.call(null,d.data),f=+t._y.call(null,d.data),n===u&&e===f)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a}while((l=s<<1|c)==(h=(f>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function ta(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function na(t){return t[0]}function ea(t){return t[1]}function ra(t,n,e){var r=new ia(null==n?na:n,null==e?ea:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function ia(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function oa(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var aa=ra.prototype=ia.prototype;function ua(t){return t.x+t.vx}function fa(t){return t.y+t.vy}function ca(t){return t.index}function sa(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function la(t){return t.x}function ha(t){return t.y}aa.copy=function(){var t,n,e=new ia(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=oa(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=oa(n));return e},aa.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return Ko(this.cover(n,e),n,e,t)},aa.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),f=1/0,c=1/0,s=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<f&&(f=r),r>s&&(s=r),i<c&&(c=i),i>l&&(l=i));for(s<f&&(f=this._x0,s=this._x1),l<c&&(c=this._y0,l=this._y1),this.cover(f,c).cover(s,l),e=0;e<o;++e)Ko(this,a[e],u[e],t[e]);return this},aa.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{if(!(e>t||t>i||r>n||n>o))return this;var a,u,f=i-e,c=this._root;switch(u=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{(a=new Array(4))[u]=c,c=a}while(o=r+(f*=2),t>(i=e+f)||n>o);break;case 1:do{(a=new Array(4))[u]=c,c=a}while(o=r+(f*=2),(e=i-f)>t||n>o);break;case 2:do{(a=new Array(4))[u]=c,c=a}while(r=o-(f*=2),t>(i=e+f)||r>n);break;case 3:do{(a=new Array(4))[u]=c,c=a}while(r=o-(f*=2),(e=i-f)>t||r>n)}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},aa.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},aa.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},aa.find=function(t,n,e){var r,i,o,a,u,f,c,s=this._x0,l=this._y0,h=this._x1,d=this._y1,p=[],v=this._root;for(v&&p.push(new ta(v,s,l,h,d)),null==e?e=1/0:(s=t-e,l=n-e,h=t+e,d=n+e,e*=e);f=p.pop();)if(!(!(v=f.node)||(i=f.x0)>h||(o=f.y0)>d||(a=f.x1)<s||(u=f.y1)<l))if(v.length){var g=(i+a)/2,y=(o+u)/2;p.push(new ta(v[3],g,y,a,u),new ta(v[2],i,y,g,u),new ta(v[1],g,o,a,y),new ta(v[0],i,o,g,y)),(c=(n>=y)<<1|t>=g)&&(f=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=f)}else{var _=t-+this._x.call(null,v.data),b=n-+this._y.call(null,v.data),m=_*_+b*b;if(m<e){var x=Math.sqrt(e=m);s=t-x,l=n-x,h=t+x,d=n+x,r=v.data}}return r},aa.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,f,c,s,l,h,d=this._root,p=this._x0,v=this._y0,g=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(u=(p+g)/2))?p=u:g=u,(s=a>=(f=(v+y)/2))?v=f:y=f,n=d,!(d=d[l=s<<1|c]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},aa.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},aa.root=function(){return this._root},aa.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},aa.visit=function(t){var n,e,r,i,o,a,u=[],f=this._root;for(f&&u.push(new ta(f,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(f=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&f.length){var c=(r+o)/2,s=(i+a)/2;(e=f[3])&&u.push(new ta(e,c,s,o,a)),(e=f[2])&&u.push(new ta(e,r,s,c,a)),(e=f[1])&&u.push(new ta(e,c,i,o,s)),(e=f[0])&&u.push(new ta(e,r,i,c,s))}return this},aa.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new ta(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,f=n.x1,c=n.y1,s=(a+f)/2,l=(u+c)/2;(o=i[0])&&e.push(new ta(o,a,u,s,l)),(o=i[1])&&e.push(new ta(o,s,u,f,l)),(o=i[2])&&e.push(new ta(o,a,l,s,c)),(o=i[3])&&e.push(new ta(o,s,l,f,c))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},aa.x=function(t){return arguments.length?(this._x=t,this):this._x},aa.y=function(t){return arguments.length?(this._y=t,this):this._y};var da=10,pa=Math.PI*(3-Math.sqrt(5));function va(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function ga(t){return(t=va(Math.abs(t)))?t[1]:NaN}var ya,_a=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ba(t){return new ma(t)}function ma(t){if(!(n=_a.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}function xa(t,n){var e=va(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ba.prototype=ma.prototype,ma.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 wa={"%":function(t,n){return(100*t).toFixed(n)},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,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return xa(100*t,n)},r:xa,s:function(t,n){var e=va(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(ya=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+va(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Ma(t){return t}var Aa,Ta=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Na(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var i=t.length,o=[],a=0,u=n[0],f=0;i>0&&u>0&&(f+u+1>r&&(u=Math.max(1,r-f)),o.push(t.substring(i-=u,i+u)),!((f+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}):Ma,i=t.currency,o=t.decimal,a=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):Ma,u=t.percent||"%";function f(t){var n=(t=ba(t)).fill,e=t.align,f=t.sign,c=t.symbol,s=t.zero,l=t.width,h=t.comma,d=t.precision,p=t.trim,v=t.type;"n"===v?(h=!0,v="g"):wa[v]||(null==d&&(d=12),p=!0,v="g"),(s||"0"===n&&"="===e)&&(s=!0,n="0",e="=");var g="$"===c?i[0]:"#"===c&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===c?i[1]:/[%p]/.test(v)?u:"",_=wa[v],b=/[defgprs%]/.test(v);function m(t){var i,u,c,m=g,x=y;if("c"===v)x=_(t)+x,t="";else{var w=(t=+t)<0;if(t=_(Math.abs(t),d),p&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),w&&0==+t&&(w=!1),m=(w?"("===f?f:"-":"-"===f||"("===f?"":f)+m,x=("s"===v?Ta[8+ya/3]:"")+x+(w&&"("===f?")":""),b)for(i=-1,u=t.length;++i<u;)if(48>(c=t.charCodeAt(i))||c>57){x=(46===c?o+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}h&&!s&&(t=r(t,1/0));var M=m.length+t.length+x.length,A=M<l?new Array(l-M+1).join(n):"";switch(h&&s&&(t=r(A+t,A.length?l-x.length:1/0),A=""),e){case"<":t=m+t+x+A;break;case"=":t=m+A+t+x;break;case"^":t=A.slice(0,M=A.length>>1)+m+t+x+A.slice(M);break;default:t=A+m+t+x}return a(t)}return d=null==d?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),m.toString=function(){return t+""},m}return{format:f,formatPrefix:function(t,n){var e=f(((t=ba(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ga(n)/3))),i=Math.pow(10,-r),o=Ta[8+r/3];return function(t){return e(i*t)+o}}}}function Sa(n){return Aa=Na(n),t.format=Aa.format,t.formatPrefix=Aa.formatPrefix,Aa}function Ea(t){return Math.max(0,-ga(Math.abs(t)))}function ka(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ga(n)/3)))-ga(Math.abs(t)))}function Ca(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ga(n)-ga(t))+1}function Pa(){return new za}function za(){this.reset()}Sa({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),za.prototype={constructor:za,reset:function(){this.s=this.t=0},add:function(t){La(Ra,t,this.t),La(this,Ra.s,this.s),this.s?this.t+=Ra.t:this.s=Ra.t},valueOf:function(){return this.s}};var Ra=new za;function La(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var Da=1e-6,Ua=1e-12,qa=Math.PI,Oa=qa/2,Ya=qa/4,Ba=2*qa,Fa=180/qa,Ia=qa/180,Ha=Math.abs,ja=Math.atan,Xa=Math.atan2,Ga=Math.cos,Va=Math.ceil,$a=Math.exp,Wa=Math.log,Za=Math.pow,Qa=Math.sin,Ja=Math.sign||function(t){return t>0?1:t<0?-1:0},Ka=Math.sqrt,tu=Math.tan;function nu(t){return t>1?0:t<-1?qa:Math.acos(t)}function eu(t){return t>1?Oa:t<-1?-Oa:Math.asin(t)}function ru(t){return(t=Qa(t/2))*t}function iu(){}function ou(t,n){t&&uu.hasOwnProperty(t.type)&&uu[t.type](t,n)}var au={Feature:function(t,n){ou(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)ou(e[r].geometry,n)}},uu={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){fu(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)fu(e[r],n,0)},Polygon:function(t,n){cu(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)cu(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)ou(e[r],n)}};function fu(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function cu(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)fu(t[e],n,1);n.polygonEnd()}function su(t,n){t&&au.hasOwnProperty(t.type)?au[t.type](t,n):ou(t,n)}var lu,hu,du,pu,vu,gu=Pa(),yu=Pa(),_u={point:iu,lineStart:iu,lineEnd:iu,polygonStart:function(){gu.reset(),_u.lineStart=bu,_u.lineEnd=mu},polygonEnd:function(){var t=+gu;yu.add(t<0?Ba+t:t),this.lineStart=this.lineEnd=this.point=iu},sphere:function(){yu.add(Ba)}};function bu(){_u.point=xu}function mu(){wu(lu,hu)}function xu(t,n){_u.point=wu,lu=t,hu=n,du=t*=Ia,pu=Ga(n=(n*=Ia)/2+Ya),vu=Qa(n)}function wu(t,n){var e=(t*=Ia)-du,r=e>=0?1:-1,i=r*e,o=Ga(n=(n*=Ia)/2+Ya),a=Qa(n),u=vu*a,f=pu*o+u*Ga(i),c=u*r*Qa(i);gu.add(Xa(c,f)),du=t,pu=o,vu=a}function Mu(t){return[Xa(t[1],t[0]),eu(t[2])]}function Au(t){var n=t[0],e=t[1],r=Ga(e);return[r*Ga(n),r*Qa(n),Qa(e)]}function Tu(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Nu(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Su(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Eu(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function ku(t){var n=Ka(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Cu,Pu,zu,Ru,Lu,Du,Uu,qu,Ou,Yu,Bu,Fu,Iu,Hu,ju,Xu,Gu,Vu,$u,Wu,Zu,Qu,Ju,Ku,tf,nf,ef=Pa(),rf={point:of,lineStart:uf,lineEnd:ff,polygonStart:function(){rf.point=cf,rf.lineStart=sf,rf.lineEnd=lf,ef.reset(),_u.polygonStart()},polygonEnd:function(){_u.polygonEnd(),rf.point=of,rf.lineStart=uf,rf.lineEnd=ff,gu<0?(Cu=-(zu=180),Pu=-(Ru=90)):ef>Da?Ru=90:ef<-Da&&(Pu=-90),Yu[0]=Cu,Yu[1]=zu}};function of(t,n){Ou.push(Yu=[Cu=t,zu=t]),n<Pu&&(Pu=n),n>Ru&&(Ru=n)}function af(t,n){var e=Au([t*Ia,n*Ia]);if(qu){var r=Nu(qu,e),i=Nu([r[1],-r[0],0],r);ku(i),i=Mu(i);var o,a=t-Lu,u=a>0?1:-1,f=i[0]*Fa*u,c=Ha(a)>180;c^(u*Lu<f&&f<u*t)?(o=i[1]*Fa)>Ru&&(Ru=o):c^(u*Lu<(f=(f+360)%360-180)&&f<u*t)?(o=-i[1]*Fa)<Pu&&(Pu=o):(n<Pu&&(Pu=n),n>Ru&&(Ru=n)),c?t<Lu?hf(Cu,t)>hf(Cu,zu)&&(zu=t):hf(t,zu)>hf(Cu,zu)&&(Cu=t):zu>=Cu?(t<Cu&&(Cu=t),t>zu&&(zu=t)):t>Lu?hf(Cu,t)>hf(Cu,zu)&&(zu=t):hf(t,zu)>hf(Cu,zu)&&(Cu=t)}else Ou.push(Yu=[Cu=t,zu=t]);n<Pu&&(Pu=n),n>Ru&&(Ru=n),qu=e,Lu=t}function uf(){rf.point=af}function ff(){Yu[0]=Cu,Yu[1]=zu,rf.point=of,qu=null}function cf(t,n){if(qu){var e=t-Lu;ef.add(Ha(e)>180?e+(e>0?360:-360):e)}else Du=t,Uu=n;_u.point(t,n),af(t,n)}function sf(){_u.lineStart()}function lf(){cf(Du,Uu),_u.lineEnd(),Ha(ef)>Da&&(Cu=-(zu=180)),Yu[0]=Cu,Yu[1]=zu,qu=null}function hf(t,n){return(n-=t)<0?n+360:n}function df(t,n){return t[0]-n[0]}function pf(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var vf={sphere:iu,point:gf,lineStart:_f,lineEnd:xf,polygonStart:function(){vf.lineStart=wf,vf.lineEnd=Mf},polygonEnd:function(){vf.lineStart=_f,vf.lineEnd=xf}};function gf(t,n){t*=Ia;var e=Ga(n*=Ia);yf(e*Ga(t),e*Qa(t),Qa(n))}function yf(t,n,e){Iu+=(t-Iu)/++Bu,Hu+=(n-Hu)/Bu,ju+=(e-ju)/Bu}function _f(){vf.point=bf}function bf(t,n){t*=Ia;var e=Ga(n*=Ia);Ku=e*Ga(t),tf=e*Qa(t),nf=Qa(n),vf.point=mf,yf(Ku,tf,nf)}function mf(t,n){t*=Ia;var e=Ga(n*=Ia),r=e*Ga(t),i=e*Qa(t),o=Qa(n),a=Xa(Ka((a=tf*o-nf*i)*a+(a=nf*r-Ku*o)*a+(a=Ku*i-tf*r)*a),Ku*r+tf*i+nf*o);Fu+=a,Xu+=a*(Ku+(Ku=r)),Gu+=a*(tf+(tf=i)),Vu+=a*(nf+(nf=o)),yf(Ku,tf,nf)}function xf(){vf.point=gf}function wf(){vf.point=Af}function Mf(){Tf(Qu,Ju),vf.point=gf}function Af(t,n){Qu=t,Ju=n,t*=Ia,n*=Ia,vf.point=Tf;var e=Ga(n);Ku=e*Ga(t),tf=e*Qa(t),nf=Qa(n),yf(Ku,tf,nf)}function Tf(t,n){t*=Ia;var e=Ga(n*=Ia),r=e*Ga(t),i=e*Qa(t),o=Qa(n),a=tf*o-nf*i,u=nf*r-Ku*o,f=Ku*i-tf*r,c=Ka(a*a+u*u+f*f),s=eu(c),l=c&&-s/c;$u+=l*a,Wu+=l*u,Zu+=l*f,Fu+=s,Xu+=s*(Ku+(Ku=r)),Gu+=s*(tf+(tf=i)),Vu+=s*(nf+(nf=o)),yf(Ku,tf,nf)}function Nf(t){return function(){return t}}function Sf(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function Ef(t,n){return[t>qa?t-Ba:t<-qa?t+Ba:t,n]}function kf(t,n,e){return(t%=Ba)?n||e?Sf(Pf(t),zf(n,e)):Pf(t):n||e?zf(n,e):Ef}function Cf(t){return function(n,e){return[(n+=t)>qa?n-Ba:n<-qa?n+Ba:n,e]}}function Pf(t){var n=Cf(t);return n.invert=Cf(-t),n}function zf(t,n){var e=Ga(t),r=Qa(t),i=Ga(n),o=Qa(n);function a(t,n){var a=Ga(n),u=Ga(t)*a,f=Qa(t)*a,c=Qa(n),s=c*e+u*r;return[Xa(f*i-s*o,u*e-c*r),eu(s*i+f*o)]}return a.invert=function(t,n){var a=Ga(n),u=Ga(t)*a,f=Qa(t)*a,c=Qa(n),s=c*i-f*o;return[Xa(f*i+c*o,u*e+s*r),eu(s*e-u*r)]},a}function Rf(t){function n(n){return(n=t(n[0]*Ia,n[1]*Ia))[0]*=Fa,n[1]*=Fa,n}return t=kf(t[0]*Ia,t[1]*Ia,t.length>2?t[2]*Ia:0),n.invert=function(n){return(n=t.invert(n[0]*Ia,n[1]*Ia))[0]*=Fa,n[1]*=Fa,n},n}function Lf(t,n,e,r,i,o){if(e){var a=Ga(n),u=Qa(n),f=r*e;null==i?(i=n+r*Ba,o=n-f/2):(i=Df(a,i),o=Df(a,o),(r>0?i<o:i>o)&&(i+=r*Ba));for(var c,s=i;r>0?s>o:s<o;s-=f)c=Mu([a,-u*Ga(s),-u*Qa(s)]),t.point(c[0],c[1])}}function Df(t,n){(n=Au(n))[0]-=t,ku(n);var e=nu(-n[1]);return((-n[2]<0?-e:e)+Ba-Da)%Ba}function Uf(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:iu,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function qf(t,n){return Ha(t[0]-n[0])<Da&&Ha(t[1]-n[1])<Da}function Of(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Yf(t,n,e,r,i){var o,a,u=[],f=[];if(t.forEach(function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(qf(r,a)){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else u.push(e=new Of(r,t,null,!0)),f.push(e.o=new Of(r,null,e,!1)),u.push(e=new Of(a,t,null,!1)),f.push(e.o=new Of(a,null,e,!0))}}),u.length){for(f.sort(n),Bf(u),Bf(f),o=0,a=f.length;o<a;++o)f[o].e=e=!e;for(var c,s,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((s=c[o])[0],s[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(c=h.p.z,o=c.length-1;o>=0;--o)i.point((s=c[o])[0],s[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Bf(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}Ef.invert=Ef;var Ff=Pa();function If(t,n){var e=n[0],r=n[1],i=Qa(r),o=[Qa(e),-Ga(e),0],a=0,u=0;Ff.reset(),1===i?r=Oa+Da:-1===i&&(r=-Oa-Da);for(var f=0,c=t.length;f<c;++f)if(l=(s=t[f]).length)for(var s,l,h=s[l-1],d=h[0],p=h[1]/2+Ya,v=Qa(p),g=Ga(p),y=0;y<l;++y,d=b,v=x,g=w,h=_){var _=s[y],b=_[0],m=_[1]/2+Ya,x=Qa(m),w=Ga(m),M=b-d,A=M>=0?1:-1,T=A*M,N=T>qa,S=v*x;if(Ff.add(Xa(S*A*Qa(T),g*w+S*Ga(T))),a+=N?M+A*Ba:M,N^d>=e^b>=e){var E=Nu(Au(h),Au(_));ku(E);var k=Nu(o,E);ku(k);var C=(N^M>=0?-1:1)*eu(k[2]);(r>C||r===C&&(E[0]||E[1]))&&(u+=N^M>=0?1:-1)}}return(a<-Da||a<Da&&Ff<-Da)^1&u}function Hf(t,n,e,r){return function(i){var o,a,u,f=n(i),c=Uf(),s=n(c),l=!1,h={point:d,lineStart:v,lineEnd:g,polygonStart:function(){h.point=y,h.lineStart=_,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=v,h.lineEnd=g,a=N(a);var t=If(o,r);a.length?(l||(i.polygonStart(),l=!0),Yf(a,Xf,t,e,i)):t&&(l||(i.polygonStart(),l=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){f.point(t,n)}function v(){h.point=p,f.lineStart()}function g(){h.point=d,f.lineEnd()}function y(t,n){u.push([t,n]),s.point(t,n)}function _(){s.lineStart(),u=[]}function b(){y(u[0][0],u[0][1]),s.lineEnd();var t,n,e,r,f=s.clean(),h=c.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&f){if((n=(e=h[0]).length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&f&&h.push(h.pop().concat(h.shift())),a.push(h.filter(jf))}return h}}function jf(t){return t.length>1}function Xf(t,n){return((t=t.x)[0]<0?t[1]-Oa-Da:Oa-t[1])-((n=n.x)[0]<0?n[1]-Oa-Da:Oa-n[1])}var Gf=Hf(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?qa:-qa,f=Ha(o-e);Ha(f-qa)<Da?(t.point(e,r=(r+a)/2>0?Oa:-Oa),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&f>=qa&&(Ha(e-i)<Da&&(e-=i*Da),Ha(o-u)<Da&&(o-=u*Da),r=function(t,n,e,r){var i,o,a=Qa(t-e);return Ha(a)>Da?ja((Qa(n)*(o=Ga(r))*Qa(e)-Qa(r)*(i=Ga(n))*Qa(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(null==t)i=e*Oa,r.point(-qa,i),r.point(0,i),r.point(qa,i),r.point(qa,0),r.point(qa,-i),r.point(0,-i),r.point(-qa,-i),r.point(-qa,0),r.point(-qa,i);else if(Ha(t[0]-n[0])>Da){var o=t[0]<n[0]?qa:-qa;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])},[-qa,-Oa]);function Vf(t){var n=Ga(t),e=6*Ia,r=n>0,i=Ha(n)>Da;function o(t,e){return Ga(t)*Ga(e)>n}function a(t,e,r){var i=[1,0,0],o=Nu(Au(t),Au(e)),a=Tu(o,o),u=o[0],f=a-u*u;if(!f)return!r&&t;var c=n*a/f,s=-n*u/f,l=Nu(i,o),h=Eu(i,c);Su(h,Eu(o,s));var d=l,p=Tu(h,d),v=Tu(d,d),g=p*p-v*(Tu(h,h)-1);if(!(g<0)){var y=Ka(g),_=Eu(d,(-p-y)/v);if(Su(_,h),_=Mu(_),!r)return _;var b,m=t[0],x=e[0],w=t[1],M=e[1];x<m&&(b=m,m=x,x=b);var A=x-m,T=Ha(A-qa)<Da;if(!T&&M<w&&(b=w,w=M,M=b),T||A<Da?T?w+M>0^_[1]<(Ha(_[0]-m)<Da?w:M):w<=_[1]&&_[1]<=M:A>qa^(m<=_[0]&&_[0]<=x)){var N=Eu(d,(-p+y)/v);return Su(N,h),[_,Mu(N)]}}}function u(n,e){var i=r?t:qa-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return Hf(o,function(t){var n,e,f,c,s;return{lineStart:function(){c=f=!1,s=1},point:function(l,h){var d,p=[l,h],v=o(l,h),g=r?v?0:u(l,h):v?u(l+(l<0?qa:-qa),h):0;if(!n&&(c=f=v)&&t.lineStart(),v!==f&&(!(d=a(n,p))||qf(n,d)||qf(p,d))&&(p[0]+=Da,p[1]+=Da,v=o(p[0],p[1])),v!==f)s=0,v?(t.lineStart(),d=a(p,n),t.point(d[0],d[1])):(d=a(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(i&&n&&r^v){var y;g&e||!(y=a(p,n,!0))||(s=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!v||n&&qf(n,p)||t.point(p[0],p[1]),n=p,f=v,e=g},lineEnd:function(){f&&t.lineEnd(),n=null},clean:function(){return s|(c&&f)<<1}}},function(n,r,i,o){Lf(o,t,e,i,n,r)},r?[0,-t]:[-qa,t-qa])}var $f=1e9,Wf=-$f;function Zf(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,c){var s=0,l=0;if(null==i||(s=a(i,u))!==(l=a(o,u))||f(i,o)<0^u>0)do{c.point(0===s||3===s?t:e,s>1?r:n)}while((s=(s+u+4)%4)!==l);else c.point(o[0],o[1])}function a(r,i){return Ha(r[0]-t)<Da?i>0?0:3:Ha(r[0]-e)<Da?i>0?2:1:Ha(r[1]-n)<Da?i>0?1:0:i>0?3:2}function u(t,n){return f(t.x,n.x)}function f(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var f,c,s,l,h,d,p,v,g,y,_,b=a,m=Uf(),x={point:w,lineStart:function(){x.point=M,c&&c.push(s=[]);y=!0,g=!1,p=v=NaN},lineEnd:function(){f&&(M(l,h),d&&g&&m.rejoin(),f.push(m.result()));x.point=w,g&&b.lineEnd()},polygonStart:function(){b=m,f=[],c=[],_=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=c.length;e<i;++e)for(var o,a,u=c[e],f=1,s=u.length,l=u[0],h=l[0],d=l[1];f<s;++f)o=h,a=d,l=u[f],h=l[0],d=l[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=_&&n,i=(f=N(f)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Yf(f,u,n,o,a),a.polygonEnd());b=a,f=c=s=null}};function w(t,n){i(t,n)&&b.point(t,n)}function M(o,a){var u=i(o,a);if(c&&s.push([o,a]),y)l=o,h=a,d=u,y=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var f=[p=Math.max(Wf,Math.min($f,p)),v=Math.max(Wf,Math.min($f,v))],m=[o=Math.max(Wf,Math.min($f,o)),a=Math.max(Wf,Math.min($f,a))];!function(t,n,e,r,i,o){var a,u=t[0],f=t[1],c=0,s=1,l=n[0]-u,h=n[1]-f;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a<c)return;a<s&&(s=a)}else if(l>0){if(a>s)return;a>c&&(c=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>c&&(c=a)}else if(l>0){if(a<c)return;a<s&&(s=a)}if(a=r-f,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<s&&(s=a)}else if(h>0){if(a>s)return;a>c&&(c=a)}if(a=o-f,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<s&&(s=a)}return c>0&&(t[0]=u+c*l,t[1]=f+c*h),s<1&&(n[0]=u+s*l,n[1]=f+s*h),!0}}}}}(f,m,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),_=!1):(g||(b.lineStart(),b.point(f[0],f[1])),b.point(m[0],m[1]),u||b.lineEnd(),_=!1)}p=o,v=a,g=u}return x}}var Qf,Jf,Kf,tc=Pa(),nc={sphere:iu,point:iu,lineStart:function(){nc.point=rc,nc.lineEnd=ec},lineEnd:iu,polygonStart:iu,polygonEnd:iu};function ec(){nc.point=nc.lineEnd=iu}function rc(t,n){Qf=t*=Ia,Jf=Qa(n*=Ia),Kf=Ga(n),nc.point=ic}function ic(t,n){t*=Ia;var e=Qa(n*=Ia),r=Ga(n),i=Ha(t-Qf),o=Ga(i),a=r*Qa(i),u=Kf*e-Jf*r*o,f=Jf*e+Kf*r*o;tc.add(Xa(Ka(a*a+u*u),f)),Qf=t,Jf=e,Kf=r}function oc(t){return tc.reset(),su(t,nc),+tc}var ac=[null,null],uc={type:"LineString",coordinates:ac};function fc(t,n){return ac[0]=t,ac[1]=n,oc(uc)}var cc={Feature:function(t,n){return lc(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)if(lc(e[r].geometry,n))return!0;return!1}},sc={Sphere:function(){return!0},Point:function(t,n){return hc(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(hc(e[r],n))return!0;return!1},LineString:function(t,n){return dc(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(dc(e[r],n))return!0;return!1},Polygon:function(t,n){return pc(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(pc(e[r],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)if(lc(e[r],n))return!0;return!1}};function lc(t,n){return!(!t||!sc.hasOwnProperty(t.type))&&sc[t.type](t,n)}function hc(t,n){return 0===fc(t,n)}function dc(t,n){var e=fc(t[0],t[1]);return fc(t[0],n)+fc(n,t[1])<=e+Da}function pc(t,n){return!!If(t.map(vc),gc(n))}function vc(t){return(t=t.map(gc)).pop(),t}function gc(t){return[t[0]*Ia,t[1]*Ia]}function yc(t,n,e){var r=g(t,n-Da,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function _c(t,n,e){var r=g(t,n-Da,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function bc(){var t,n,e,r,i,o,a,u,f,c,s,l,h=10,d=h,p=90,v=360,y=2.5;function _(){return{type:"MultiLineString",coordinates:b()}}function b(){return g(Va(r/p)*p,e,p).map(s).concat(g(Va(u/v)*v,a,v).map(l)).concat(g(Va(n/h)*h,t,h).filter(function(t){return Ha(t%p)>Da}).map(f)).concat(g(Va(o/d)*d,i,d).filter(function(t){return Ha(t%v)>Da}).map(c))}return _.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},_.outline=function(){return{type:"Polygon",coordinates:[s(r).concat(l(a).slice(1),s(e).reverse().slice(1),l(u).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.extentMajor(t).extentMinor(t):_.extentMinor()},_.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),_.precision(y)):[[r,u],[e,a]]},_.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),_.precision(y)):[[n,o],[t,i]]},_.step=function(t){return arguments.length?_.stepMajor(t).stepMinor(t):_.stepMinor()},_.stepMajor=function(t){return arguments.length?(p=+t[0],v=+t[1],_):[p,v]},_.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],_):[h,d]},_.precision=function(h){return arguments.length?(y=+h,f=yc(o,i,90),c=_c(n,t,y),s=yc(u,a,90),l=_c(r,e,y),_):y},_.extentMajor([[-180,-90+Da],[180,90-Da]]).extentMinor([[-180,-80-Da],[180,80+Da]])}function mc(t){return t}var xc,wc,Mc,Ac,Tc=Pa(),Nc=Pa(),Sc={point:iu,lineStart:iu,lineEnd:iu,polygonStart:function(){Sc.lineStart=Ec,Sc.lineEnd=Pc},polygonEnd:function(){Sc.lineStart=Sc.lineEnd=Sc.point=iu,Tc.add(Ha(Nc)),Nc.reset()},result:function(){var t=Tc/2;return Tc.reset(),t}};function Ec(){Sc.point=kc}function kc(t,n){Sc.point=Cc,xc=Mc=t,wc=Ac=n}function Cc(t,n){Nc.add(Ac*t-Mc*n),Mc=t,Ac=n}function Pc(){Cc(xc,wc)}var zc=1/0,Rc=zc,Lc=-zc,Dc=Lc,Uc={point:function(t,n){t<zc&&(zc=t);t>Lc&&(Lc=t);n<Rc&&(Rc=n);n>Dc&&(Dc=n)},lineStart:iu,lineEnd:iu,polygonStart:iu,polygonEnd:iu,result:function(){var t=[[zc,Rc],[Lc,Dc]];return Lc=Dc=-(Rc=zc=1/0),t}};var qc,Oc,Yc,Bc,Fc=0,Ic=0,Hc=0,jc=0,Xc=0,Gc=0,Vc=0,$c=0,Wc=0,Zc={point:Qc,lineStart:Jc,lineEnd:ns,polygonStart:function(){Zc.lineStart=es,Zc.lineEnd=rs},polygonEnd:function(){Zc.point=Qc,Zc.lineStart=Jc,Zc.lineEnd=ns},result:function(){var t=Wc?[Vc/Wc,$c/Wc]:Gc?[jc/Gc,Xc/Gc]:Hc?[Fc/Hc,Ic/Hc]:[NaN,NaN];return Fc=Ic=Hc=jc=Xc=Gc=Vc=$c=Wc=0,t}};function Qc(t,n){Fc+=t,Ic+=n,++Hc}function Jc(){Zc.point=Kc}function Kc(t,n){Zc.point=ts,Qc(Yc=t,Bc=n)}function ts(t,n){var e=t-Yc,r=n-Bc,i=Ka(e*e+r*r);jc+=i*(Yc+t)/2,Xc+=i*(Bc+n)/2,Gc+=i,Qc(Yc=t,Bc=n)}function ns(){Zc.point=Qc}function es(){Zc.point=is}function rs(){os(qc,Oc)}function is(t,n){Zc.point=os,Qc(qc=Yc=t,Oc=Bc=n)}function os(t,n){var e=t-Yc,r=n-Bc,i=Ka(e*e+r*r);jc+=i*(Yc+t)/2,Xc+=i*(Bc+n)/2,Gc+=i,Vc+=(i=Bc*t-Yc*n)*(Yc+t),$c+=i*(Bc+n),Wc+=3*i,Qc(Yc=t,Bc=n)}function as(t){this._context=t}as.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,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Ba)}},result:iu};var us,fs,cs,ss,ls,hs=Pa(),ds={point:iu,lineStart:function(){ds.point=ps},lineEnd:function(){us&&vs(fs,cs),ds.point=iu},polygonStart:function(){us=!0},polygonEnd:function(){us=null},result:function(){var t=+hs;return hs.reset(),t}};function ps(t,n){ds.point=vs,fs=ss=t,cs=ls=n}function vs(t,n){ss-=t,ls-=n,hs.add(Ka(ss*ss+ls*ls)),ss=t,ls=n}function gs(){this._string=[]}function ys(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function _s(t){return function(n){var e=new bs;for(var r in t)e[r]=t[r];return e.stream=n,e}}function bs(){}function ms(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),su(e,t.stream(Uc)),n(Uc.result()),null!=r&&t.clipExtent(r),t}function xs(t,n,e){return ms(t,function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])},e)}function ws(t,n,e){return xs(t,[[0,0],n],e)}function Ms(t,n,e){return ms(t,function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])},e)}function As(t,n,e){return ms(t,function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])},e)}gs.prototype={_radius:4.5,_circle:ys(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,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=ys(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},bs.prototype={constructor:bs,point:function(t,n){this.stream.point(t,n)},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 Ts=16,Ns=Ga(30*Ia);function Ss(t,n){return+n?function(t,n){function e(r,i,o,a,u,f,c,s,l,h,d,p,v,g){var y=c-r,_=s-i,b=y*y+_*_;if(b>4*n&&v--){var m=a+h,x=u+d,w=f+p,M=Ka(m*m+x*x+w*w),A=eu(w/=M),T=Ha(Ha(w)-1)<Da||Ha(o-l)<Da?(o+l)/2:Xa(x,m),N=t(T,A),S=N[0],E=N[1],k=S-r,C=E-i,P=_*k-y*C;(P*P/b>n||Ha((y*k+_*C)/b-.5)>.3||a*h+u*d+f*p<Ns)&&(e(r,i,o,a,u,f,S,E,T,m/=M,x/=M,w,v,g),g.point(S,E),e(S,E,T,m,x,w,c,s,l,h,d,p,v,g))}}return function(n){var r,i,o,a,u,f,c,s,l,h,d,p,v={point:g,lineStart:y,lineEnd:b,polygonStart:function(){n.polygonStart(),v.lineStart=m},polygonEnd:function(){n.polygonEnd(),v.lineStart=y}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){s=NaN,v.point=_,n.lineStart()}function _(r,i){var o=Au([r,i]),a=t(r,i);e(s,l,c,h,d,p,s=a[0],l=a[1],c=r,h=o[0],d=o[1],p=o[2],Ts,n),n.point(s,l)}function b(){v.point=g,n.lineEnd()}function m(){y(),v.point=x,v.lineEnd=w}function x(t,n){_(r=t,n),i=s,o=l,a=h,u=d,f=p,v.point=_}function w(){e(s,l,c,h,d,p,i,o,r,a,u,f,Ts,n),v.lineEnd=b,b()}return v}}(t,n):function(t){return _s({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var Es=_s({point:function(t,n){this.stream.point(t*Ia,n*Ia)}});function ks(t,n,e,r){var i=Ga(r),o=Qa(r),a=i*t,u=o*t,f=i/t,c=o/t,s=(o*e-i*n)/t,l=(o*n+i*e)/t;function h(t,r){return[a*t-u*r+n,e-u*t-a*r]}return h.invert=function(t,n){return[f*t-c*n+s,l-c*t-f*n]},h}function Cs(t){return Ps(function(){return t})()}function Ps(t){var n,e,r,i,o,a,u,f,c,s,l=150,h=480,d=250,p=0,v=0,g=0,y=0,_=0,b=0,m=null,x=Gf,w=null,M=mc,A=.5;function T(t){return f(t[0]*Ia,t[1]*Ia)}function N(t){return(t=f.invert(t[0],t[1]))&&[t[0]*Fa,t[1]*Fa]}function S(){var t=ks(l,0,0,b).apply(null,n(p,v)),r=(b?ks:function(t,n,e){function r(r,i){return[n+t*r,e-t*i]}return r.invert=function(r,i){return[(r-n)/t,(e-i)/t]},r})(l,h-t[0],d-t[1],b);return e=kf(g,y,_),u=Sf(n,r),f=Sf(e,u),a=Ss(u,A),E()}function E(){return c=s=null,T}return T.stream=function(t){return c&&s===t?c:c=Es(function(t){return _s({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(x(a(M(s=t)))))},T.preclip=function(t){return arguments.length?(x=t,m=void 0,E()):x},T.postclip=function(t){return arguments.length?(M=t,w=r=i=o=null,E()):M},T.clipAngle=function(t){return arguments.length?(x=+t?Vf(m=t*Ia):(m=null,Gf),E()):m*Fa},T.clipExtent=function(t){return arguments.length?(M=null==t?(w=r=i=o=null,mc):Zf(w=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),E()):null==w?null:[[w,r],[i,o]]},T.scale=function(t){return arguments.length?(l=+t,S()):l},T.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],S()):[h,d]},T.center=function(t){return arguments.length?(p=t[0]%360*Ia,v=t[1]%360*Ia,S()):[p*Fa,v*Fa]},T.rotate=function(t){return arguments.length?(g=t[0]%360*Ia,y=t[1]%360*Ia,_=t.length>2?t[2]%360*Ia:0,S()):[g*Fa,y*Fa,_*Fa]},T.angle=function(t){return arguments.length?(b=t%360*Ia,S()):b*Fa},T.precision=function(t){return arguments.length?(a=Ss(u,A=t*t),E()):Ka(A)},T.fitExtent=function(t,n){return xs(T,t,n)},T.fitSize=function(t,n){return ws(T,t,n)},T.fitWidth=function(t,n){return Ms(T,t,n)},T.fitHeight=function(t,n){return As(T,t,n)},function(){return n=t.apply(this,arguments),T.invert=n.invert&&N,S()}}function zs(t){var n=0,e=qa/3,r=Ps(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Ia,e=t[1]*Ia):[n*Fa,e*Fa]},i}function Rs(t,n){var e=Qa(t),r=(e+Qa(n))/2;if(Ha(r)<Da)return function(t){var n=Ga(t);function e(t,e){return[t*n,Qa(e)/n]}return e.invert=function(t,e){return[t/n,eu(e*n)]},e}(t);var i=1+e*(2*r-e),o=Ka(i)/r;function a(t,n){var e=Ka(i-2*r*Qa(n))/r;return[e*Qa(t*=r),o-e*Ga(t)]}return a.invert=function(t,n){var e=o-n;return[Xa(t,Ha(e))/r*Ja(e),eu((i-(t*t+e*e)*r*r)/(2*r))]},a}function Ls(){return zs(Rs).scale(155.424).center([0,33.6442])}function Ds(){return Ls().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Us(t){return function(n,e){var r=Ga(n),i=Ga(e),o=t(r*i);return[o*i*Qa(n),o*Qa(e)]}}function qs(t){return function(n,e){var r=Ka(n*n+e*e),i=t(r),o=Qa(i),a=Ga(i);return[Xa(n*o,r*a),eu(r&&e*o/r)]}}var Os=Us(function(t){return Ka(2/(1+t))});Os.invert=qs(function(t){return 2*eu(t/2)});var Ys=Us(function(t){return(t=nu(t))&&t/Qa(t)});function Bs(t,n){return[t,Wa(tu((Oa+n)/2))]}function Fs(t){var n,e,r,i=Cs(t),o=i.center,a=i.scale,u=i.translate,f=i.clipExtent,c=null;function s(){var o=qa*a(),u=i(Rf(i.rotate()).invert([0,0]));return f(null==c?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===Bs?[[Math.max(u[0]-o,c),n],[Math.min(u[0]+o,e),r]]:[[c,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),s()):a()},i.translate=function(t){return arguments.length?(u(t),s()):u()},i.center=function(t){return arguments.length?(o(t),s()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=n=e=r=null:(c=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),s()):null==c?null:[[c,n],[e,r]]},s()}function Is(t){return tu((Oa+t)/2)}function Hs(t,n){var e=Ga(t),r=t===n?Qa(t):Wa(e/Ga(n))/Wa(Is(n)/Is(t)),i=e*Za(Is(t),r)/r;if(!r)return Bs;function o(t,n){i>0?n<-Oa+Da&&(n=-Oa+Da):n>Oa-Da&&(n=Oa-Da);var e=i/Za(Is(n),r);return[e*Qa(r*t),i-e*Ga(r*t)]}return o.invert=function(t,n){var e=i-n,o=Ja(r)*Ka(t*t+e*e);return[Xa(t,Ha(e))/r*Ja(e),2*ja(Za(i/o,1/r))-Oa]},o}function js(t,n){return[t,n]}function Xs(t,n){var e=Ga(t),r=t===n?Qa(t):(e-Ga(n))/(n-t),i=e/r+t;if(Ha(r)<Da)return js;function o(t,n){var e=i-n,o=r*t;return[e*Qa(o),i-e*Ga(o)]}return o.invert=function(t,n){var e=i-n;return[Xa(t,Ha(e))/r*Ja(e),i-Ja(r)*Ka(t*t+e*e)]},o}Ys.invert=qs(function(t){return t}),Bs.invert=function(t,n){return[t,2*ja($a(n))-Oa]},js.invert=js;var Gs=1.340264,Vs=-.081106,$s=893e-6,Ws=.003796,Zs=Ka(3)/2;function Qs(t,n){var e=eu(Zs*Qa(n)),r=e*e,i=r*r*r;return[t*Ga(e)/(Zs*(Gs+3*Vs*r+i*(7*$s+9*Ws*r))),e*(Gs+Vs*r+i*($s+Ws*r))]}function Js(t,n){var e=Ga(n),r=Ga(t)*e;return[e*Qa(t)/r,Qa(n)/r]}function Ks(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?mc:_s({point:function(i,o){this.stream.point(i*t+e,o*n+r)}})}function tl(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function nl(t,n){return[Ga(n)*Qa(t),Qa(n)]}function el(t,n){var e=Ga(n),r=1+Ga(t)*e;return[e*Qa(t)/r,Qa(n)/r]}function rl(t,n){return[Wa(tu((Oa+n)/2)),-t]}function il(t,n){return t.parent===n.parent?1:2}function ol(t,n){return t+n.x}function al(t,n){return Math.max(t,n.y)}function ul(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function fl(t,n){var e,r,i,o,a,u=new hl(t),f=+t.value&&(u.value=t.value),c=[u];for(null==n&&(n=cl);e=c.pop();)if(f&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)c.push(r=e.children[o]=new hl(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(ll)}function cl(t){return t.children}function sl(t){t.data=t.data.data}function ll(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function hl(t){this.data=t,this.depth=this.height=0,this.parent=null}Qs.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(Gs+Vs*i+o*($s+Ws*i))-n)/(Gs+3*Vs*i+o*(7*$s+9*Ws*i)))*r)*i*i,!(Ha(e)<Ua));++a);return[Zs*t*(Gs+3*Vs*i+o*(7*$s+9*Ws*i))/Ga(r),eu(Qa(r)/Zs)]},Js.invert=qs(ja),tl.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Ha(e)>Da&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},nl.invert=qs(eu),el.invert=qs(function(t){return 2*ja(t)}),rl.invert=function(t,n){return[-n,2*ja($a(t))-Oa]},hl.prototype=fl.prototype={constructor:hl,count:function(){return this.eachAfter(ul)},each:function(t){var n,e,r,i,o=this,a=[o];do{for(n=a.reverse(),a=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r])}while(a.length);return this},eachAfter:function(t){for(var n,e,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e]);for(;i=a.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return fl(this).eachBefore(sl)}};var dl=Array.prototype.slice;function pl(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(dl.call(t))).length,o=[];r<i;)n=t[r],e&&yl(e,n)?++r:(e=bl(o=vl(o,n)),r=0);return e}function vl(t,n){var e,r;if(_l(n,t))return[n];for(e=0;e<t.length;++e)if(gl(n,t[e])&&_l(ml(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(gl(ml(t[e],t[r]),n)&&gl(ml(t[e],n),t[r])&&gl(ml(t[r],n),t[e])&&_l(xl(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function gl(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function yl(t,n){var e=t.r-n.r+1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function _l(t,n){for(var e=0;e<n.length;++e)if(!yl(t,n[e]))return!1;return!0}function bl(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return ml(t[0],t[1]);case 3:return xl(t[0],t[1],t[2])}var n}function ml(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,f=o-e,c=a-r,s=u-i,l=Math.sqrt(f*f+c*c);return{x:(e+o+f/l*s)/2,y:(r+a+c/l*s)/2,r:(l+i+u)/2}}function xl(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,f=n.r,c=e.x,s=e.y,l=e.r,h=r-a,d=r-c,p=i-u,v=i-s,g=f-o,y=l-o,_=r*r+i*i-o*o,b=_-a*a-u*u+f*f,m=_-c*c-s*s+l*l,x=d*p-h*v,w=(p*m-v*b)/(2*x)-r,M=(v*g-p*y)/x,A=(d*b-h*m)/(2*x)-i,T=(h*y-d*g)/x,N=M*M+T*T-1,S=2*(o+w*M+A*T),E=w*w+A*A-o*o,k=-(N?(S+Math.sqrt(S*S-4*N*E))/(2*N):E/S);return{x:r+w+M*k,y:i+A+T*k,r:k}}function wl(t,n,e){var r,i,o,a,u=t.x-n.x,f=t.y-n.y,c=u*u+f*f;c?(i=n.r+e.r,i*=i,a=t.r+e.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),e.x=t.x-r*u-o*f,e.y=t.y-r*f+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),e.x=n.x+r*u-o*f,e.y=n.y+r*f+o*u)):(e.x=n.x+e.r,e.y=n.y)}function Ml(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function Al(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function Tl(t){this._=t,this.next=null,this.previous=null}function Nl(t){if(!(i=t.length))return 0;var n,e,r,i,o,a,u,f,c,s,l;if((n=t[0]).x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;wl(e,n,r=t[2]),n=new Tl(n),e=new Tl(e),r=new Tl(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(u=3;u<i;++u){wl(n._,e._,r=t[u]),r=new Tl(r),f=e.next,c=n.previous,s=e._.r,l=n._.r;do{if(s<=l){if(Ml(f._,r._)){e=f,n.next=e,e.previous=n,--u;continue t}s+=f._.r,f=f.next}else{if(Ml(c._,r._)){(n=c).next=e,e.previous=n,--u;continue t}l+=c._.r,c=c.previous}}while(f!==c.next);for(r.previous=n,r.next=e,n.next=e.previous=e=r,o=Al(n);(r=r.next)!==e;)(a=Al(r))<o&&(n=r,o=a);e=n.next}for(n=[e._],r=e;(r=r.next)!==e;)n.push(r._);for(r=pl(n),u=0;u<i;++u)(n=t[u]).x-=r.x,n.y-=r.y;return r.r}function Sl(t){if("function"!=typeof t)throw new Error;return t}function El(){return 0}function kl(t){return function(){return t}}function Cl(t){return Math.sqrt(t.value)}function Pl(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function zl(t,n){return function(e){if(r=e.children){var r,i,o,a=r.length,u=t(e)*n||0;if(u)for(i=0;i<a;++i)r[i].r+=u;if(o=Nl(r),u)for(i=0;i<a;++i)r[i].r-=u;e.r=o+u}}}function Rl(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function Ll(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Dl(t,n,e,r,i){for(var o,a=t.children,u=-1,f=a.length,c=t.value&&(r-n)/t.value;++u<f;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c}var Ul="$",ql={depth:-1},Ol={};function Yl(t){return t.id}function Bl(t){return t.parentId}function Fl(t,n){return t.parent===n.parent?1:2}function Il(t){var n=t.children;return n?n[0]:t.t}function Hl(t){var n=t.children;return n?n[n.length-1]:t.t}function jl(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Xl(t,n,e){return t.a.parent===n.parent?t.a:e}function Gl(t,n){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=n}function Vl(t,n,e,r,i){for(var o,a=t.children,u=-1,f=a.length,c=t.value&&(i-e)/t.value;++u<f;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*c}Gl.prototype=Object.create(hl.prototype);var $l=(1+Math.sqrt(5))/2;function Wl(t,n,e,r,i,o){for(var a,u,f,c,s,l,h,d,p,v,g,y=[],_=n.children,b=0,m=0,x=_.length,w=n.value;b<x;){f=i-e,c=o-r;do{s=_[m++].value}while(!s&&m<x);for(l=h=s,g=s*s*(v=Math.max(c/f,f/c)/(w*t)),p=Math.max(h/g,g/l);m<x;++m){if(s+=u=_[m].value,u<l&&(l=u),u>h&&(h=u),g=s*s*v,(d=Math.max(h/g,g/l))>p){s-=u;break}p=d}y.push(a={value:s,dice:f<c,children:_.slice(b,m)}),a.dice?Dl(a,e,r,i,w?r+=c*s/w:o):Vl(a,e,r,w?e+=f*s/w:i,o),w-=s,b=m}return y}var Zl=function t(n){function e(t,e,r,i,o){Wl(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}($l);var Ql=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,f,c,s,l=-1,h=a.length,d=t.value;++l<h;){for(f=(u=a[l]).children,c=u.value=0,s=f.length;c<s;++c)u.value+=f[c].value;u.dice?Dl(u,e,r,i,r+=(o-r)*u.value/d):Vl(u,e,r,e+=(i-e)*u.value/d,o),d-=u.value}else t._squarify=a=Wl(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}($l);function Jl(t,n){return t[0]-n[0]||t[1]-n[1]}function Kl(t){for(var n,e,r,i=t.length,o=[0,1],a=2,u=2;u<i;++u){for(;a>1&&(n=t[o[a-2]],e=t[o[a-1]],r=t[u],(e[0]-n[0])*(r[1]-n[1])-(e[1]-n[1])*(r[0]-n[0])<=0);)--a;o[a++]=u}return o.slice(0,a)}function th(){return Math.random()}var nh=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(th),eh=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(th),rh=function t(n){function e(){var t=eh.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(th),ih=function t(n){function e(t){return function(){for(var e=0,r=0;r<t;++r)e+=n();return e}}return e.source=t,e}(th),oh=function t(n){function e(t){var e=ih.source(n)(t);return function(){return e()/t}}return e.source=t,e}(th),ah=function t(n){function e(t){return function(){return-Math.log(1-n())/t}}return e.source=t,e}(th),uh=Array.prototype,fh=uh.map,ch=uh.slice,sh={name:"implicit"};function lh(t){var n=Ki(),e=[],r=sh;function i(i){var o=i+"",a=n.get(o);if(!a){if(r!==sh)return r;n.set(o,a=e.push(i))}return t[(a-1)%t.length]}return t=null==t?[]:ch.call(t),i.domain=function(t){if(!arguments.length)return e.slice();e=[],n=Ki();for(var r,o,a=-1,u=t.length;++a<u;)n.has(o=(r=t[a])+"")||n.set(o,e.push(r));return i},i.range=function(n){return arguments.length?(t=ch.call(n),i):t.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return lh().domain(e).range(t).unknown(r)},i}function hh(){var t,n,e=lh().unknown(void 0),r=e.domain,i=e.range,o=[0,1],a=!1,u=0,f=0,c=.5;function s(){var e=r().length,s=o[1]<o[0],l=o[s-0],h=o[1-s];t=(h-l)/Math.max(1,e-u+2*f),a&&(t=Math.floor(t)),l+=(h-l-t*(e-u))*c,n=t*(1-u),a&&(l=Math.round(l),n=Math.round(n));var d=g(e).map(function(n){return l+t*n});return i(s?d.reverse():d)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),s()):r()},e.range=function(t){return arguments.length?(o=[+t[0],+t[1]],s()):o.slice()},e.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,s()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(a=!!t,s()):a},e.padding=function(t){return arguments.length?(u=f=Math.max(0,Math.min(1,t)),s()):u},e.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),s()):u},e.paddingOuter=function(t){return arguments.length?(f=Math.max(0,Math.min(1,t)),s()):f},e.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),s()):c},e.copy=function(){return hh().domain(r()).range(o).round(a).paddingInner(u).paddingOuter(f).align(c)},s()}function dh(t){return function(){return t}}function ph(t){return+t}var vh=[0,1];function gh(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:dh(n)}function yh(t,n,e,r){var i=t[0],o=t[1],a=n[0],u=n[1];return o<i?(i=e(o,i),a=r(u,a)):(i=e(i,o),a=r(a,u)),function(t){return a(i(t))}}function _h(t,n,e,r){var o=Math.min(t.length,n.length)-1,a=new Array(o),u=new Array(o),f=-1;for(t[o]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++f<o;)a[f]=e(t[f],t[f+1]),u[f]=r(n[f],n[f+1]);return function(n){var e=i(t,n,1,o)-1;return u[e](a[e](n))}}function bh(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function mh(t,n){var e,r,i,o=vh,a=vh,u=me,f=!1;function c(){return e=Math.min(o.length,a.length)>2?_h:yh,r=i=null,s}function s(n){return(r||(r=e(o,a,f?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}(t):t,u)))(+n)}return s.invert=function(t){return(i||(i=e(a,o,gh,f?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}(n):n)))(+t)},s.domain=function(t){return arguments.length?(o=fh.call(t,ph),c()):o.slice()},s.range=function(t){return arguments.length?(a=ch.call(t),c()):a.slice()},s.rangeRound=function(t){return a=ch.call(t),u=xe,c()},s.clamp=function(t){return arguments.length?(f=!!t,c()):f},s.interpolate=function(t){return arguments.length?(u=t,c()):u},c()}function xh(n){var e=n.domain;return n.ticks=function(t){var n=e();return m(n[0],n[n.length-1],null==t?10:t)},n.tickFormat=function(n,r){return function(n,e,r){var i,o=n[0],a=n[n.length-1],u=w(o,a,null==e?10:e);switch((r=ba(null==r?",f":r)).type){case"s":var f=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(i=ka(u,f))||(r.precision=i),t.formatPrefix(r,f);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Ca(u,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Ea(u))||(r.precision=i-2*("%"===r.type))}return t.format(r)}(e(),n,r)},n.nice=function(t){null==t&&(t=10);var r,i=e(),o=0,a=i.length-1,u=i[o],f=i[a];return f<u&&(r=u,u=f,f=r,r=o,o=a,a=r),(r=x(u,f,t))>0?r=x(u=Math.floor(u/r)*r,f=Math.ceil(f/r)*r,t):r<0&&(r=x(u=Math.ceil(u*r)/r,f=Math.floor(f*r)/r,t)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(f/r)*r,e(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(f*r)/r,e(i)),n},n}function wh(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Mh(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:dh(n)}function Ah(t,n){return t<0?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function Th(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Nh(t){return 10===t?Th:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function Sh(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function Eh(t){return function(n){return-t(-n)}}function kh(t,n){return t<0?-Math.pow(-t,n):Math.pow(t,n)}function Ch(){var t=1,n=mh(function(n,e){return(e=kh(e,t)-(n=kh(n,t)))?function(r){return(kh(r,t)-n)/e}:dh(e)},function(n,e){return e=kh(e,t)-(n=kh(n,t)),function(r){return kh(n+e*r,1/t)}}),e=n.domain;return n.exponent=function(n){return arguments.length?(t=+n,e(e())):t},n.copy=function(){return bh(n,Ch().exponent(t))},xh(n)}var Ph=new Date,zh=new Date;function Rh(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return Rh(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return Ph.setTime(+n),zh.setTime(+r),t(Ph),t(zh),Math.floor(e(Ph,zh))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Lh=Rh(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Lh.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Rh(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Lh:null};var Dh=Lh.range,Uh=6e4,qh=6048e5,Oh=Rh(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Yh=Oh.range,Bh=Rh(function(t){t.setTime(Math.floor(t/Uh)*Uh)},function(t,n){t.setTime(+t+n*Uh)},function(t,n){return(n-t)/Uh},function(t){return t.getMinutes()}),Fh=Bh.range,Ih=Rh(function(t){var n=t.getTimezoneOffset()*Uh%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),Hh=Ih.range,jh=Rh(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Uh)/864e5},function(t){return t.getDate()-1}),Xh=jh.range;function Gh(t){return Rh(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Uh)/qh})}var Vh=Gh(0),$h=Gh(1),Wh=Gh(2),Zh=Gh(3),Qh=Gh(4),Jh=Gh(5),Kh=Gh(6),td=Vh.range,nd=$h.range,ed=Wh.range,rd=Zh.range,id=Qh.range,od=Jh.range,ad=Kh.range,ud=Rh(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),fd=ud.range,cd=Rh(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});cd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Rh(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var sd=cd.range,ld=Rh(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Uh)},function(t,n){return(n-t)/Uh},function(t){return t.getUTCMinutes()}),hd=ld.range,dd=Rh(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),pd=dd.range,vd=Rh(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),gd=vd.range;function yd(t){return Rh(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/qh})}var _d=yd(0),bd=yd(1),md=yd(2),xd=yd(3),wd=yd(4),Md=yd(5),Ad=yd(6),Td=_d.range,Nd=bd.range,Sd=md.range,Ed=xd.range,kd=wd.range,Cd=Md.range,Pd=Ad.range,zd=Rh(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),Rd=zd.range,Ld=Rh(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});Ld.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Rh(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Dd=Ld.range;function Ud(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function qd(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Od(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function Yd(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,f=t.shortMonths,c=Vd(i),s=$d(i),l=Vd(o),h=$d(o),d=Vd(a),p=$d(a),v=Vd(u),g=$d(u),y=Vd(f),_=$d(f),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return f[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:pp,e:pp,f:bp,H:vp,I:gp,j:yp,L:_p,m:mp,M:xp,p:function(t){return i[+(t.getHours()>=12)]},Q:Wp,s:Zp,S:wp,u:Mp,U:Ap,V:Tp,w:Np,W:Sp,x:null,X:null,y:Ep,Y:kp,Z:Cp,"%":$p},m={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return f[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Pp,e:Pp,f:Up,H:zp,I:Rp,j:Lp,L:Dp,m:qp,M:Op,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:Wp,s:Zp,S:Yp,u:Bp,U:Fp,V:Ip,w:Hp,W:jp,x:null,X:null,y:Xp,Y:Gp,Z:Vp,"%":$p},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=_[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return A(t,n,e,r)},d:ip,e:ip,f:sp,H:ap,I:ap,j:op,L:cp,m:rp,M:up,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=s[r[0].toLowerCase()],e+r[0].length):-1},Q:hp,s:dp,S:fp,u:Zd,U:Qd,V:Jd,w:Wd,W:Kd,x:function(t,n,r){return A(t,e,n,r)},X:function(t,n,e){return A(t,r,n,e)},y:np,Y:tp,Z:ep,"%":lp};function w(t,n){return function(e){var r,i,o,a=[],u=-1,f=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(f,u)),null!=(i=Fd[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),f=u+1);return a.push(t.slice(f,u)),a.join("")}}function M(t,n){return function(e){var r,i,o=Od(1900);if(A(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("p"in o&&(o.H=o.H%12+12*o.p),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=qd(Od(o.y))).getUTCDay(),r=i>4||0===i?bd.ceil(r):bd(r),r=vd.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=n(Od(o.y))).getDay(),r=i>4||0===i?$h.ceil(r):$h(r),r=jh.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?qd(Od(o.y)).getUTCDay():n(Od(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,qd(o)):n(o)}}function A(t,n,e,r){for(var i,o,a=0,u=n.length,f=e.length;a<u;){if(r>=f)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Fd?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=w(e,b),b.X=w(r,b),b.c=w(n,b),m.x=w(e,m),m.X=w(r,m),m.c=w(n,m),{format:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",Ud);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",m);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,qd);return n.toString=function(){return t},n}}}var Bd,Fd={"-":"",_:" ",0:"0"},Id=/^\s*\d+/,Hd=/^%/,jd=/[\\^$*+?|[\]().{}]/g;function Xd(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Gd(t){return t.replace(jd,"\\$&")}function Vd(t){return new RegExp("^(?:"+t.map(Gd).join("|")+")","i")}function $d(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Wd(t,n,e){var r=Id.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Zd(t,n,e){var r=Id.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Qd(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Jd(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Kd(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function tp(t,n,e){var r=Id.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function np(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function ep(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function rp(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function ip(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function op(t,n,e){var r=Id.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function ap(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function up(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function fp(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function cp(t,n,e){var r=Id.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function sp(t,n,e){var r=Id.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function lp(t,n,e){var r=Hd.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function hp(t,n,e){var r=Id.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function dp(t,n,e){var r=Id.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function pp(t,n){return Xd(t.getDate(),n,2)}function vp(t,n){return Xd(t.getHours(),n,2)}function gp(t,n){return Xd(t.getHours()%12||12,n,2)}function yp(t,n){return Xd(1+jh.count(cd(t),t),n,3)}function _p(t,n){return Xd(t.getMilliseconds(),n,3)}function bp(t,n){return _p(t,n)+"000"}function mp(t,n){return Xd(t.getMonth()+1,n,2)}function xp(t,n){return Xd(t.getMinutes(),n,2)}function wp(t,n){return Xd(t.getSeconds(),n,2)}function Mp(t){var n=t.getDay();return 0===n?7:n}function Ap(t,n){return Xd(Vh.count(cd(t),t),n,2)}function Tp(t,n){var e=t.getDay();return t=e>=4||0===e?Qh(t):Qh.ceil(t),Xd(Qh.count(cd(t),t)+(4===cd(t).getDay()),n,2)}function Np(t){return t.getDay()}function Sp(t,n){return Xd($h.count(cd(t),t),n,2)}function Ep(t,n){return Xd(t.getFullYear()%100,n,2)}function kp(t,n){return Xd(t.getFullYear()%1e4,n,4)}function Cp(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Xd(n/60|0,"0",2)+Xd(n%60,"0",2)}function Pp(t,n){return Xd(t.getUTCDate(),n,2)}function zp(t,n){return Xd(t.getUTCHours(),n,2)}function Rp(t,n){return Xd(t.getUTCHours()%12||12,n,2)}function Lp(t,n){return Xd(1+vd.count(Ld(t),t),n,3)}function Dp(t,n){return Xd(t.getUTCMilliseconds(),n,3)}function Up(t,n){return Dp(t,n)+"000"}function qp(t,n){return Xd(t.getUTCMonth()+1,n,2)}function Op(t,n){return Xd(t.getUTCMinutes(),n,2)}function Yp(t,n){return Xd(t.getUTCSeconds(),n,2)}function Bp(t){var n=t.getUTCDay();return 0===n?7:n}function Fp(t,n){return Xd(_d.count(Ld(t),t),n,2)}function Ip(t,n){var e=t.getUTCDay();return t=e>=4||0===e?wd(t):wd.ceil(t),Xd(wd.count(Ld(t),t)+(4===Ld(t).getUTCDay()),n,2)}function Hp(t){return t.getUTCDay()}function jp(t,n){return Xd(bd.count(Ld(t),t),n,2)}function Xp(t,n){return Xd(t.getUTCFullYear()%100,n,2)}function Gp(t,n){return Xd(t.getUTCFullYear()%1e4,n,4)}function Vp(){return"+0000"}function $p(){return"%"}function Wp(t){return+t}function Zp(t){return Math.floor(+t/1e3)}function Qp(n){return Bd=Yd(n),t.timeFormat=Bd.format,t.timeParse=Bd.parse,t.utcFormat=Bd.utcFormat,t.utcParse=Bd.utcParse,Bd}Qp({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 Jp=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var Kp=+new Date("2000-01-01T00:00:00.000Z")?function(t){var n=new Date(t);return isNaN(n)?null:n}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),tv=1e3,nv=60*tv,ev=60*nv,rv=24*ev,iv=7*rv,ov=30*rv,av=365*rv;function uv(t){return new Date(t)}function fv(t){return t instanceof Date?+t:+new Date(+t)}function cv(t,n,r,i,o,a,u,f,c){var s=mh(gh,ve),l=s.invert,h=s.domain,d=c(".%L"),p=c(":%S"),v=c("%I:%M"),g=c("%I %p"),y=c("%a %d"),_=c("%b %d"),b=c("%B"),m=c("%Y"),x=[[u,1,tv],[u,5,5*tv],[u,15,15*tv],[u,30,30*tv],[a,1,nv],[a,5,5*nv],[a,15,15*nv],[a,30,30*nv],[o,1,ev],[o,3,3*ev],[o,6,6*ev],[o,12,12*ev],[i,1,rv],[i,2,2*rv],[r,1,iv],[n,1,ov],[n,3,3*ov],[t,1,av]];function M(e){return(u(e)<e?d:a(e)<e?p:o(e)<e?v:i(e)<e?g:n(e)<e?r(e)<e?y:_:t(e)<e?b:m)(e)}function A(n,r,i,o){if(null==n&&(n=10),"number"==typeof n){var a=Math.abs(i-r)/n,u=e(function(t){return t[2]}).right(x,a);u===x.length?(o=w(r/av,i/av,n),n=t):u?(o=(u=x[a/x[u-1][2]<x[u][2]/a?u-1:u])[1],n=u[0]):(o=Math.max(w(r,i,n),1),n=f)}return null==o?n:n.every(o)}return s.invert=function(t){return new Date(l(t))},s.domain=function(t){return arguments.length?h(fh.call(t,fv)):h().map(uv)},s.ticks=function(t,n){var e,r=h(),i=r[0],o=r[r.length-1],a=o<i;return a&&(e=i,i=o,o=e),e=(e=A(t,i,o,n))?e.range(i,o+1):[],a?e.reverse():e},s.tickFormat=function(t,n){return null==n?M:c(n)},s.nice=function(t,n){var e=h();return(t=A(t,e[0],e[e.length-1],n))?h(wh(e,t)):s},s.copy=function(){return bh(s,cv(t,n,r,i,o,a,u,f,c))},s}function sv(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}var lv=sv("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),hv=sv("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),dv=sv("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),pv=sv("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),vv=sv("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),gv=sv("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),yv=sv("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),_v=sv("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),bv=sv("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function mv(t){return le(t[t.length-1])}var xv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(sv),wv=mv(xv),Mv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(sv),Av=mv(Mv),Tv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(sv),Nv=mv(Tv),Sv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(sv),Ev=mv(Sv),kv=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(sv),Cv=mv(kv),Pv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(sv),zv=mv(Pv),Rv=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(sv),Lv=mv(Rv),Dv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(sv),Uv=mv(Dv),qv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(sv),Ov=mv(qv),Yv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(sv),Bv=mv(Yv),Fv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(sv),Iv=mv(Fv),Hv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(sv),jv=mv(Hv),Xv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(sv),Gv=mv(Xv),Vv=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(sv),$v=mv(Vv),Wv=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(sv),Zv=mv(Wv),Qv=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(sv),Jv=mv(Qv),Kv=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(sv),tg=mv(Kv),ng=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(sv),eg=mv(ng),rg=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(sv),ig=mv(rg),og=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(sv),ag=mv(og),ug=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(sv),fg=mv(ug),cg=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(sv),sg=mv(cg),lg=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(sv),hg=mv(lg),dg=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(sv),pg=mv(dg),vg=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(sv),gg=mv(vg),yg=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(sv),_g=mv(yg),bg=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(sv),mg=mv(bg),xg=Ge(Kn(300,.5,0),Kn(-240,.5,1)),wg=Ge(Kn(-100,.75,.35),Kn(80,1.5,.8)),Mg=Ge(Kn(260,.75,.35),Kn(80,1.5,.8)),Ag=Kn();var Tg=bn(),Ng=Math.PI/3,Sg=2*Math.PI/3;function Eg(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var kg=Eg(sv("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Cg=Eg(sv("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Pg=Eg(sv("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),zg=Eg(sv("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Rg(t){return function(){return t}}var Lg=Math.abs,Dg=Math.atan2,Ug=Math.cos,qg=Math.max,Og=Math.min,Yg=Math.sin,Bg=Math.sqrt,Fg=1e-12,Ig=Math.PI,Hg=Ig/2,jg=2*Ig;function Xg(t){return t>=1?Hg:t<=-1?-Hg:Math.asin(t)}function Gg(t){return t.innerRadius}function Vg(t){return t.outerRadius}function $g(t){return t.startAngle}function Wg(t){return t.endAngle}function Zg(t){return t&&t.padAngle}function Qg(t,n,e,r,i,o,a){var u=t-e,f=n-r,c=(a?o:-o)/Bg(u*u+f*f),s=c*f,l=-c*u,h=t+s,d=n+l,p=e+s,v=r+l,g=(h+p)/2,y=(d+v)/2,_=p-h,b=v-d,m=_*_+b*b,x=i-o,w=h*v-p*d,M=(b<0?-1:1)*Bg(qg(0,x*x*m-w*w)),A=(w*b-_*M)/m,T=(-w*_-b*M)/m,N=(w*b+_*M)/m,S=(-w*_+b*M)/m,E=A-g,k=T-y,C=N-g,P=S-y;return E*E+k*k>C*C+P*P&&(A=N,T=S),{cx:A,cy:T,x01:-s,y01:-l,x11:A*(i/x-1),y11:T*(i/x-1)}}function Jg(t){this._context=t}function Kg(t){return new Jg(t)}function ty(t){return t[0]}function ny(t){return t[1]}function ey(){var t=ty,n=ny,e=Rg(!0),r=null,i=Kg,o=null;function a(a){var u,f,c,s=a.length,l=!1;for(null==r&&(o=i(c=Gi())),u=0;u<=s;++u)!(u<s&&e(f=a[u],u,a))===l&&((l=!l)?o.lineStart():o.lineEnd()),l&&o.point(+t(f,u,a),+n(f,u,a));if(c)return o=null,c+""||null}return a.x=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),a):t},a.y=function(t){return arguments.length?(n="function"==typeof t?t:Rg(+t),a):n},a.defined=function(t){return arguments.length?(e="function"==typeof t?t:Rg(!!t),a):e},a.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),a):i},a.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),a):r},a}function ry(){var t=ty,n=null,e=Rg(0),r=ny,i=Rg(!0),o=null,a=Kg,u=null;function f(f){var c,s,l,h,d,p=f.length,v=!1,g=new Array(p),y=new Array(p);for(null==o&&(u=a(d=Gi())),c=0;c<=p;++c){if(!(c<p&&i(h=f[c],c,f))===v)if(v=!v)s=c,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),l=c-1;l>=s;--l)u.point(g[l],y[l]);u.lineEnd(),u.areaEnd()}v&&(g[c]=+t(h,c,f),y[c]=+e(h,c,f),u.point(n?+n(h,c,f):g[c],r?+r(h,c,f):y[c]))}if(d)return u=null,d+""||null}function c(){return ey().defined(i).curve(a).context(o)}return f.x=function(e){return arguments.length?(t="function"==typeof e?e:Rg(+e),n=null,f):t},f.x0=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),f):t},f.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Rg(+t),f):n},f.y=function(t){return arguments.length?(e="function"==typeof t?t:Rg(+t),r=null,f):e},f.y0=function(t){return arguments.length?(e="function"==typeof t?t:Rg(+t),f):e},f.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Rg(+t),f):r},f.lineX0=f.lineY0=function(){return c().x(t).y(e)},f.lineY1=function(){return c().x(t).y(r)},f.lineX1=function(){return c().x(n).y(e)},f.defined=function(t){return arguments.length?(i="function"==typeof t?t:Rg(!!t),f):i},f.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),f):a},f.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),f):o},f}function iy(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function oy(t){return t}Jg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var ay=fy(Kg);function uy(t){this._curve=t}function fy(t){function n(n){return new uy(t(n))}return n._curve=t,n}function cy(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(fy(t)):n()._curve},t}function sy(){return cy(ey().curve(ay))}function ly(){var t=ry().curve(ay),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return cy(e())},delete t.lineX0,t.lineEndAngle=function(){return cy(r())},delete t.lineX1,t.lineInnerRadius=function(){return cy(i())},delete t.lineY0,t.lineOuterRadius=function(){return cy(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(fy(t)):n()._curve},t}function hy(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}uy.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var dy=Array.prototype.slice;function py(t){return t.source}function vy(t){return t.target}function gy(t){var n=py,e=vy,r=ty,i=ny,o=null;function a(){var a,u=dy.call(arguments),f=n.apply(this,u),c=e.apply(this,u);if(o||(o=a=Gi()),t(o,+r.apply(this,(u[0]=f,u)),+i.apply(this,u),+r.apply(this,(u[0]=c,u)),+i.apply(this,u)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"==typeof t?t:Rg(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:Rg(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function yy(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function _y(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function by(t,n,e,r,i){var o=hy(n,e),a=hy(n,e=(e+i)/2),u=hy(r,e),f=hy(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],f[0],f[1])}var my={draw:function(t,n){var e=Math.sqrt(n/Ig);t.moveTo(e,0),t.arc(0,0,e,0,jg)}},xy={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},wy=Math.sqrt(1/3),My=2*wy,Ay={draw:function(t,n){var e=Math.sqrt(n/My),r=e*wy;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Ty=Math.sin(Ig/10)/Math.sin(7*Ig/10),Ny=Math.sin(jg/10)*Ty,Sy=-Math.cos(jg/10)*Ty,Ey={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=Ny*e,i=Sy*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var a=jg*o/5,u=Math.cos(a),f=Math.sin(a);t.lineTo(f*e,-u*e),t.lineTo(u*r-f*i,f*r+u*i)}t.closePath()}},ky={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},Cy=Math.sqrt(3),Py={draw:function(t,n){var e=-Math.sqrt(n/(3*Cy));t.moveTo(0,2*e),t.lineTo(-Cy*e,-e),t.lineTo(Cy*e,-e),t.closePath()}},zy=Math.sqrt(3)/2,Ry=1/Math.sqrt(12),Ly=3*(Ry/2+1),Dy={draw:function(t,n){var e=Math.sqrt(n/Ly),r=e/2,i=e*Ry,o=r,a=e*Ry+e,u=-o,f=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,f),t.lineTo(-.5*r-zy*i,zy*r+-.5*i),t.lineTo(-.5*o-zy*a,zy*o+-.5*a),t.lineTo(-.5*u-zy*f,zy*u+-.5*f),t.lineTo(-.5*r+zy*i,-.5*i-zy*r),t.lineTo(-.5*o+zy*a,-.5*a-zy*o),t.lineTo(-.5*u+zy*f,-.5*f-zy*u),t.closePath()}},Uy=[my,xy,Ay,ky,Ey,Py,Dy];function qy(){}function Oy(t,n,e){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+n)/6,(t._y0+4*t._y1+e)/6)}function Yy(t){this._context=t}function By(t){this._context=t}function Fy(t){this._context=t}function Iy(t,n){this._basis=new Yy(t),this._beta=n}Yy.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:Oy(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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);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:Oy(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},By.prototype={areaStart:qy,areaEnd:qy,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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Oy(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Fy.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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Oy(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Iy.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,f=-1;++f<=e;)r=f/e,this._basis.point(this._beta*t[f]+(1-this._beta)*(i+r*a),this._beta*n[f]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Hy=function t(n){function e(t){return 1===n?new Yy(t):new Iy(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function jy(t,n,e){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-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Xy(t,n){this._context=t,this._k=(1-n)/6}Xy.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:jy(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:jy(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Gy=function t(n){function e(t){return new Xy(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Vy(t,n){this._context=t,this._k=(1-n)/6}Vy.prototype={areaStart:qy,areaEnd:qy,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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:jy(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var $y=function t(n){function e(t){return new Vy(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Wy(t,n){this._context=t,this._k=(1-n)/6}Wy.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,n){switch(t=+t,n=+n,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:jy(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Zy=function t(n){function e(t){return new Wy(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Qy(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Fg){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,f=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/f,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/f}if(t._l23_a>Fg){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/s,a=(a*c+t._y1*t._l23_2a-e*t._l12_2a)/s}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Jy(t,n){this._context=t,this._alpha=n}Jy.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,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Qy(this,t,n)}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=n}};var Ky=function t(n){function e(t){return n?new Jy(t,n):new Xy(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function t_(t,n){this._context=t,this._alpha=n}t_.prototype={areaStart:qy,areaEnd:qy,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,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Qy(this,t,n)}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=n}};var n_=function t(n){function e(t){return n?new t_(t,n):new Vy(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function e_(t,n){this._context=t,this._alpha=n}e_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._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,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Qy(this,t,n)}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=n}};var r_=function t(n){function e(t){return n?new e_(t,n):new Wy(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function i_(t){this._context=t}function o_(t){return t<0?-1:1}function a_(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(o_(o)+o_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function u_(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function f_(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function c_(t){this._context=t}function s_(t){this._context=new l_(t)}function l_(t){this._context=t}function h_(t){this._context=t}function d_(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/o[n-1],o[n]-=e,a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function p_(t,n){this._context=t,this._t=n}function v_(t,n){if((i=t.length)>1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o<i;++o)for(r=a,a=t[n[o]],e=0;e<u;++e)a[e][1]+=a[e][0]=isNaN(r[e][1])?r[e][0]:r[e][1]}function g_(t){for(var n=t.length,e=new Array(n);--n>=0;)e[n]=n;return e}function y_(t,n){return t[n]}function __(t){var n=t.map(b_);return g_(t).sort(function(t,e){return n[t]-n[e]})}function b_(t){for(var n,e=0,r=-1,i=t.length;++r<i;)(n=+t[r][1])&&(e+=n);return e}function m_(t){return function(){return t}}function x_(t){return t[0]}function w_(t){return t[1]}function M_(){this._=null}function A_(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function T_(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function N_(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function S_(t){for(;t.L;)t=t.L;return t}function E_(t,n,e,r){var i=[null,null],o=J_.push(i)-1;return i.left=t,i.right=n,e&&C_(i,t,n,e),r&&C_(i,n,t,r),Z_[t.index].halfedges.push(o),Z_[n.index].halfedges.push(o),i}function k_(t,n,e){var r=[n,e];return r.left=t,r}function C_(t,n,e,r){t[0]||t[1]?t.left===e?t[1]=r:t[0]=r:(t[0]=r,t.left=n,t.right=e)}function P_(t,n,e,r,i){var o,a=t[0],u=t[1],f=a[0],c=a[1],s=0,l=1,h=u[0]-f,d=u[1]-c;if(o=n-f,h||!(o>0)){if(o/=h,h<0){if(o<s)return;o<l&&(l=o)}else if(h>0){if(o>l)return;o>s&&(s=o)}if(o=r-f,h||!(o<0)){if(o/=h,h<0){if(o>l)return;o>s&&(s=o)}else if(h>0){if(o<s)return;o<l&&(l=o)}if(o=e-c,d||!(o>0)){if(o/=d,d<0){if(o<s)return;o<l&&(l=o)}else if(d>0){if(o>l)return;o>s&&(s=o)}if(o=i-c,d||!(o<0)){if(o/=d,d<0){if(o>l)return;o>s&&(s=o)}else if(d>0){if(o<s)return;o<l&&(l=o)}return!(s>0||l<1)||(s>0&&(t[0]=[f+s*h,c+s*d]),l<1&&(t[1]=[f+l*h,c+l*d]),!0)}}}}}function z_(t,n,e,r,i){var o=t[1];if(o)return!0;var a,u,f=t[0],c=t.left,s=t.right,l=c[0],h=c[1],d=s[0],p=s[1],v=(l+d)/2,g=(h+p)/2;if(p===h){if(v<n||v>=r)return;if(l>d){if(f){if(f[1]>=i)return}else f=[v,e];o=[v,i]}else{if(f){if(f[1]<e)return}else f=[v,i];o=[v,e]}}else if(u=g-(a=(l-d)/(p-h))*v,a<-1||a>1)if(l>d){if(f){if(f[1]>=i)return}else f=[(e-u)/a,e];o=[(i-u)/a,i]}else{if(f){if(f[1]<e)return}else f=[(i-u)/a,i];o=[(e-u)/a,e]}else if(h<p){if(f){if(f[0]>=r)return}else f=[n,a*n+u];o=[r,a*r+u]}else{if(f){if(f[0]<n)return}else f=[r,a*r+u];o=[n,a*n+u]}return t[0]=f,t[1]=o,!0}function R_(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function L_(t,n){return n[+(n.left!==t.site)]}function D_(t,n){return n[+(n.left===t.site)]}i_.prototype={areaStart:qy,areaEnd:qy,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},c_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:f_(this,this._t0,u_(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,f_(this,u_(this,e=a_(this,t,n)),e);break;default:f_(this,this._t0,e=a_(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(s_.prototype=Object.create(c_.prototype)).point=function(t,n){c_.prototype.point.call(this,n,t)},l_.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},h_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=d_(t),i=d_(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},p_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}},M_.prototype={constructor:M_,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=S_(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(i=r.R)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(T_(this,e),e=(t=e).U),e.C=!1,r.C=!0,N_(this,r)):(i=r.L)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(N_(this,e),e=(t=e).U),e.C=!1,r.C=!0,T_(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,a=t.R;if(e=o?a?S_(a):o:a,i?i.L===t?i.L=e:i.R=e:this._=e,o&&a?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==a?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=a,a.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((n=i.R).C&&(n.C=!1,i.C=!0,T_(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,N_(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,T_(this,i),t=this._;break}}else if((n=i.L).C&&(n.C=!1,i.C=!0,N_(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,T_(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,N_(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var U_,q_=[];function O_(){A_(this),this.x=this.y=this.arc=this.site=this.cy=null}function Y_(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i[0],u=i[1],f=r[0]-a,c=r[1]-u,s=o[0]-a,l=o[1]-u,h=2*(f*l-c*s);if(!(h>=-tb)){var d=f*f+c*c,p=s*s+l*l,v=(l*d-c*p)/h,g=(f*p-s*d)/h,y=q_.pop()||new O_;y.arc=t,y.site=i,y.x=v+a,y.y=(y.cy=g+u)+Math.sqrt(v*v+g*g),t.circle=y;for(var _=null,b=Q_._;b;)if(y.y<b.y||y.y===b.y&&y.x<=b.x){if(!b.L){_=b.P;break}b=b.L}else{if(!b.R){_=b;break}b=b.R}Q_.insert(_,y),_||(U_=y)}}}}function B_(t){var n=t.circle;n&&(n.P||(U_=n.N),Q_.remove(n),q_.push(n),A_(n),t.circle=null)}var F_=[];function I_(){A_(this),this.edge=this.site=this.circle=null}function H_(t){var n=F_.pop()||new I_;return n.site=t,n}function j_(t){B_(t),W_.remove(t),F_.push(t),A_(t)}function X_(t){var n=t.circle,e=n.x,r=n.cy,i=[e,r],o=t.P,a=t.N,u=[t];j_(t);for(var f=o;f.circle&&Math.abs(e-f.circle.x)<K_&&Math.abs(r-f.circle.cy)<K_;)o=f.P,u.unshift(f),j_(f),f=o;u.unshift(f),B_(f);for(var c=a;c.circle&&Math.abs(e-c.circle.x)<K_&&Math.abs(r-c.circle.cy)<K_;)a=c.N,u.push(c),j_(c),c=a;u.push(c),B_(c);var s,l=u.length;for(s=1;s<l;++s)c=u[s],f=u[s-1],C_(c.edge,f.site,c.site,i);f=u[0],(c=u[l-1]).edge=E_(f.site,c.site,null,i),Y_(f),Y_(c)}function G_(t){for(var n,e,r,i,o=t[0],a=t[1],u=W_._;u;)if((r=V_(u,a)-o)>K_)u=u.L;else{if(!((i=o-$_(u,a))>K_)){r>-K_?(n=u.P,e=u):i>-K_?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}!function(t){Z_[t.index]={site:t,halfedges:[]}}(t);var f=H_(t);if(W_.insert(n,f),n||e){if(n===e)return B_(n),e=H_(n.site),W_.insert(f,e),f.edge=e.edge=E_(n.site,f.site),Y_(n),void Y_(e);if(e){B_(n),B_(e);var c=n.site,s=c[0],l=c[1],h=t[0]-s,d=t[1]-l,p=e.site,v=p[0]-s,g=p[1]-l,y=2*(h*g-d*v),_=h*h+d*d,b=v*v+g*g,m=[(g*_-d*b)/y+s,(h*b-v*_)/y+l];C_(e.edge,c,p,m),f.edge=E_(c,t,null,m),e.edge=E_(t,p,null,m),Y_(n),Y_(e)}else f.edge=E_(n.site,f.site)}}function V_(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;var u=(e=a.site)[0],f=e[1],c=f-n;if(!c)return u;var s=u-r,l=1/o-1/c,h=s/c;return l?(-h+Math.sqrt(h*h-2*l*(s*s/(-2*c)-f+c/2+i-o/2)))/l+r:(r+u)/2}function $_(t,n){var e=t.N;if(e)return V_(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var W_,Z_,Q_,J_,K_=1e-6,tb=1e-12;function nb(t,n){return n[1]-t[1]||n[0]-t[0]}function eb(t,n){var e,r,i,o=t.sort(nb).pop();for(J_=[],Z_=new Array(t.length),W_=new M_,Q_=new M_;;)if(i=U_,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===e&&o[1]===r||(G_(o),e=o[0],r=o[1]),o=t.pop();else{if(!i)break;X_(i.arc)}if(function(){for(var t,n,e,r,i=0,o=Z_.length;i<o;++i)if((t=Z_[i])&&(r=(n=t.halfedges).length)){var a=new Array(r),u=new Array(r);for(e=0;e<r;++e)a[e]=e,u[e]=R_(t,J_[n[e]]);for(a.sort(function(t,n){return u[n]-u[t]}),e=0;e<r;++e)u[e]=n[a[e]];for(e=0;e<r;++e)n[e]=u[e]}}(),n){var a=+n[0][0],u=+n[0][1],f=+n[1][0],c=+n[1][1];!function(t,n,e,r){for(var i,o=J_.length;o--;)z_(i=J_[o],t,n,e,r)&&P_(i,t,n,e,r)&&(Math.abs(i[0][0]-i[1][0])>K_||Math.abs(i[0][1]-i[1][1])>K_)||delete J_[o]}(a,u,f,c),function(t,n,e,r){var i,o,a,u,f,c,s,l,h,d,p,v,g=Z_.length,y=!0;for(i=0;i<g;++i)if(o=Z_[i]){for(a=o.site,u=(f=o.halfedges).length;u--;)J_[f[u]]||f.splice(u,1);for(u=0,c=f.length;u<c;)p=(d=D_(o,J_[f[u]]))[0],v=d[1],l=(s=L_(o,J_[f[++u%c]]))[0],h=s[1],(Math.abs(p-l)>K_||Math.abs(v-h)>K_)&&(f.splice(u,0,J_.push(k_(a,d,Math.abs(p-t)<K_&&r-v>K_?[t,Math.abs(l-t)<K_?h:r]:Math.abs(v-r)<K_&&e-p>K_?[Math.abs(h-r)<K_?l:e,r]:Math.abs(p-e)<K_&&v-n>K_?[e,Math.abs(l-e)<K_?h:n]:Math.abs(v-n)<K_&&p-t>K_?[Math.abs(h-n)<K_?l:t,n]:null))-1),++c);c&&(y=!1)}if(y){var _,b,m,x=1/0;for(i=0,y=null;i<g;++i)(o=Z_[i])&&(m=(_=(a=o.site)[0]-t)*_+(b=a[1]-n)*b)<x&&(x=m,y=o);if(y){var w=[t,n],M=[t,r],A=[e,r],T=[e,n];y.halfedges.push(J_.push(k_(a=y.site,w,M))-1,J_.push(k_(a,M,A))-1,J_.push(k_(a,A,T))-1,J_.push(k_(a,T,w))-1)}}for(i=0;i<g;++i)(o=Z_[i])&&(o.halfedges.length||delete Z_[i])}(a,u,f,c)}this.edges=J_,this.cells=Z_,W_=Q_=J_=Z_=null}function rb(t){return function(){return t}}function ib(t,n,e){this.target=t,this.type=n,this.transform=e}function ob(t,n,e){this.k=t,this.x=n,this.y=e}eb.prototype={constructor:eb,polygons:function(){var t=this.edges;return this.cells.map(function(n){var e=n.halfedges.map(function(e){return L_(n,t[e])});return e.data=n.site.data,e})},triangles:function(){var t=[],n=this.edges;return this.cells.forEach(function(e,r){if(o=(i=e.halfedges).length)for(var i,o,a,u,f,c,s=e.site,l=-1,h=n[i[o-1]],d=h.left===s?h.right:h.left;++l<o;)a=d,d=(h=n[i[l]]).left===s?h.right:h.left,a&&d&&r<a.index&&r<d.index&&(f=a,c=d,((u=s)[0]-c[0])*(f[1]-u[1])-(u[0]-f[0])*(c[1]-u[1])<0)&&t.push([s.data,a.data,d.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,n,e){for(var r,i,o=this,a=o._found||0,u=o.cells.length;!(i=o.cells[a]);)if(++a>=u)return null;var f=t-i.site[0],c=n-i.site[1],s=f*f+c*c;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(e){var r=o.edges[e],u=r.left;if(u!==i.site&&u||(u=r.right)){var f=t-u[0],c=n-u[1],l=f*f+c*c;l<s&&(s=l,a=u.index)}})}while(null!==a);return o._found=r,null==e||s<=e*e?i.site:null}},ob.prototype={constructor:ob,scale:function(t){return 1===t?this:new ob(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new ob(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ab=new ob(1,0,0);function ub(t){return t.__zoom||ab}function fb(){t.event.stopImmediatePropagation()}function cb(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function sb(){return!t.event.button}function lb(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function hb(){return this.__zoom||ab}function db(){return-t.event.deltaY*(t.event.deltaMode?120:1)/500}function pb(){return"ontouchstart"in this}function vb(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}ub.prototype=ob.prototype,t.version="5.7.0",t.bisect=i,t.bisectRight=i,t.bisectLeft=o,t.ascending=n,t.bisector=e,t.cross=function(t,n,e){var r,i,o,u,f=t.length,c=n.length,s=new Array(f*c);for(null==e&&(e=a),r=o=0;r<f;++r)for(u=t[r],i=0;i<c;++i,++o)s[o]=e(u,n[i]);return s},t.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},t.deviation=c,t.extent=s,t.histogram=function(){var t=v,n=s,e=M;function r(r){var o,a,u=r.length,f=new Array(u);for(o=0;o<u;++o)f[o]=t(r[o],o,r);var c=n(f),s=c[0],l=c[1],h=e(f,s,l);Array.isArray(h)||(h=w(s,l,h),h=g(Math.ceil(s/h)*h,l,h));for(var d=h.length;h[0]<=s;)h.shift(),--d;for(;h[d-1]>l;)h.pop(),--d;var p,v=new Array(d+1);for(o=0;o<=d;++o)(p=v[o]=[]).x0=o>0?h[o-1]:s,p.x1=o<d?h[o]:l;for(o=0;o<u;++o)s<=(a=f[o])&&a<=l&&v[i(h,a,0,d)].push(r[o]);return v}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:p(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:p([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?p(h.call(t)):p(t),r):e},r},t.thresholdFreedmanDiaconis=function(t,e,r){return t=d.call(t,u).sort(n),Math.ceil((r-e)/(2*(A(t,.75)-A(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,n,e){return Math.ceil((e-n)/(3.5*c(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=M,t.max=T,t.mean=function(t,n){var e,r=t.length,i=r,o=-1,a=0;if(null==n)for(;++o<r;)isNaN(e=u(t[o]))?--i:a+=e;else for(;++o<r;)isNaN(e=u(n(t[o],o,t)))?--i:a+=e;if(i)return a/i},t.median=function(t,e){var r,i=t.length,o=-1,a=[];if(null==e)for(;++o<i;)isNaN(r=u(t[o]))||a.push(r);else for(;++o<i;)isNaN(r=u(e(t[o],o,t)))||a.push(r);return A(a.sort(n),.5)},t.merge=N,t.min=S,t.pairs=function(t,n){null==n&&(n=a);for(var e=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);e<r;)o[e]=n(i,i=t[++e]);return o},t.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},t.quantile=A,t.range=g,t.scan=function(t,e){if(r=t.length){var r,i,o=0,a=0,u=t[a];for(null==e&&(e=n);++o<r;)(e(i=t[o],u)<0||0!==e(u,u))&&(u=i,a=o);return 0===e(u,u)?a:void 0}},t.shuffle=function(t,n,e){for(var r,i,o=(null==e?t.length:e)-(n=null==n?0:+n);o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},t.sum=function(t,n){var e,r=t.length,i=-1,o=0;if(null==n)for(;++i<r;)(e=+t[i])&&(o+=e);else for(;++i<r;)(e=+n(t[i],i,t))&&(o+=e);return o},t.ticks=m,t.tickIncrement=x,t.tickStep=w,t.transpose=E,t.variance=f,t.zip=function(){return E(arguments)},t.axisTop=function(t){return B(z,t)},t.axisRight=function(t){return B(R,t)},t.axisBottom=function(t){return B(L,t)},t.axisLeft=function(t){return B(D,t)},t.brush=function(){return Ri(wi)},t.brushX=function(){return Ri(mi)},t.brushY=function(){return Ri(xi)},t.brushSelection=function(t){var n=t.__brush;return n?n.dim.output(n.selection):null},t.chord=function(){var t=0,n=null,e=null,r=null;function i(i){var o,a,u,f,c,s,l=i.length,h=[],d=g(l),p=[],v=[],y=v.groups=new Array(l),_=new Array(l*l);for(o=0,c=-1;++c<l;){for(a=0,s=-1;++s<l;)a+=i[c][s];h.push(a),p.push(g(l)),o+=a}for(n&&d.sort(function(t,e){return n(h[t],h[e])}),e&&p.forEach(function(t,n){t.sort(function(t,r){return e(i[n][t],i[n][r])})}),f=(o=Yi(0,Oi-t*l)/o)?t:Oi/l,a=0,c=-1;++c<l;){for(u=a,s=-1;++s<l;){var b=d[c],m=p[b][s],x=i[b][m],w=a,M=a+=x*o;_[m*l+b]={index:b,subindex:m,startAngle:w,endAngle:M,value:x}}y[b]={index:b,startAngle:u,endAngle:a,value:h[b]},a+=f}for(c=-1;++c<l;)for(s=c-1;++s<l;){var A=_[s*l+c],T=_[c*l+s];(A.value||T.value)&&v.push(A.value<T.value?{source:T,target:A}:{source:A,target:T})}return r?v.sort(r):v}return i.padAngle=function(n){return arguments.length?(t=Yi(0,n),i):t},i.sortGroups=function(t){return arguments.length?(n=t,i):n},i.sortSubgroups=function(t){return arguments.length?(e=t,i):e},i.sortChords=function(t){return arguments.length?(null==t?r=null:(n=t,r=function(t,e){return n(t.source.value+t.target.value,e.source.value+e.target.value)})._=t,i):r&&r._;var n},i},t.ribbon=function(){var t=Vi,n=$i,e=Wi,r=Zi,i=Qi,o=null;function a(){var a,u=Bi.call(arguments),f=t.apply(this,u),c=n.apply(this,u),s=+e.apply(this,(u[0]=f,u)),l=r.apply(this,u)-qi,h=i.apply(this,u)-qi,d=s*Li(l),p=s*Di(l),v=+e.apply(this,(u[0]=c,u)),g=r.apply(this,u)-qi,y=i.apply(this,u)-qi;if(o||(o=a=Gi()),o.moveTo(d,p),o.arc(0,0,s,l,h),l===g&&h===y||(o.quadraticCurveTo(0,0,v*Li(g),v*Di(g)),o.arc(0,0,v,g,y)),o.quadraticCurveTo(0,0,d,p),o.closePath(),a)return o=null,a+""||null}return a.radius=function(t){return arguments.length?(e="function"==typeof t?t:Fi(+t),a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Fi(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Fi(+t),a):i},a.source=function(n){return arguments.length?(t=n,a):t},a.target=function(t){return arguments.length?(n=t,a):n},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},t.nest=function(){var t,n,e,r=[],i=[];function o(e,i,a,u){if(i>=r.length)return null!=t&&e.sort(t),null!=n?n(e):e;for(var f,c,s,l=-1,h=e.length,d=r[i++],p=Ki(),v=a();++l<h;)(s=p.get(f=d(c=e[l])+""))?s.push(c):p.set(f,[c]);return p.each(function(t,n){u(v,n,o(t,i,a,u))}),v}return e={object:function(t){return o(t,0,to,no)},map:function(t){return o(t,0,eo,ro)},entries:function(t){return function t(e,o){if(++o>r.length)return e;var a,u=i[o-1];return null!=n&&o>=r.length?a=e.entries():(a=[],e.each(function(n,e){a.push({key:e,values:t(n,o)})})),null!=u?a.sort(function(t,n){return u(t.key,n.key)}):a}(o(t,0,eo,ro),0)},key:function(t){return r.push(t),e},sortKeys:function(t){return i[r.length-1]=t,e},sortValues:function(n){return t=n,e},rollup:function(t){return n=t,e}}},t.set=ao,t.map=Ki,t.keys=function(t){var n=[];for(var e in t)n.push(e);return n},t.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},t.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},t.color=vn,t.rgb=bn,t.hsl=Mn,t.lab=Un,t.hcl=Hn,t.lch=function(t,n,e,r){return 1===arguments.length?In(t):new jn(e,n,t,null==r?1:r)},t.gray=function(t,n){return new qn(t,0,0,null==n?1:n)},t.cubehelix=Kn,t.contours=go,t.contourDensity=function(){var t=bo,n=mo,e=xo,r=960,i=500,o=20,a=2,u=3*o,f=r+2*u>>a,c=i+2*u>>a,s=co(20);function l(r){var i=new Float32Array(f*c),l=new Float32Array(f*c);r.forEach(function(r,o,s){var l=+t(r,o,s)+u>>a,h=+n(r,o,s)+u>>a,d=+e(r,o,s);l>=0&&l<f&&h>=0&&h<c&&(i[l+h*f]+=d)}),yo({width:f,height:c,data:i},{width:f,height:c,data:l},o>>a),_o({width:f,height:c,data:l},{width:f,height:c,data:i},o>>a),yo({width:f,height:c,data:i},{width:f,height:c,data:l},o>>a),_o({width:f,height:c,data:l},{width:f,height:c,data:i},o>>a),yo({width:f,height:c,data:i},{width:f,height:c,data:l},o>>a),_o({width:f,height:c,data:l},{width:f,height:c,data:i},o>>a);var d=s(i);if(!Array.isArray(d)){var p=T(i);d=w(0,p,d),(d=g(0,Math.floor(p/d)*d,d)).shift()}return go().thresholds(d).size([f,c])(i).map(h)}function h(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(d),t}function d(t){t.forEach(p)}function p(t){t.forEach(v)}function v(t){t[0]=t[0]*Math.pow(2,a)-u,t[1]=t[1]*Math.pow(2,a)-u}function y(){return f=r+2*(u=3*o)>>a,c=i+2*u>>a,l}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:co(+n),l):t},l.y=function(t){return arguments.length?(n="function"==typeof t?t:co(+t),l):n},l.weight=function(t){return arguments.length?(e="function"==typeof t?t:co(+t),l):e},l.size=function(t){if(!arguments.length)return[r,i];var n=Math.ceil(t[0]),e=Math.ceil(t[1]);if(!(n>=0||n>=0))throw new Error("invalid size");return r=n,i=e,y()},l.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),y()},l.thresholds=function(t){return arguments.length?(s="function"==typeof t?t:Array.isArray(t)?co(uo.call(t)):co(t),l):s},l.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),y()},l},t.dispatch=I,t.drag=function(){var n,e,r,i,o=Wt,a=Zt,u=Qt,f=Jt,c={},s=I("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",p).filter(f).on("touchstart.drag",y).on("touchmove.drag",_).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!i&&o.apply(this,arguments)){var u=m("mouse",a.apply(this,arguments),Ft,this,arguments);u&&(Dt(t.event.view).on("mousemove.drag",v,!0).on("mouseup.drag",g,!0),Xt(t.event.view),Ht(),r=!1,n=t.event.clientX,e=t.event.clientY,u("start"))}}function v(){if(jt(),!r){var i=t.event.clientX-n,o=t.event.clientY-e;r=i*i+o*o>h}c.mouse("drag")}function g(){Dt(t.event.view).on("mousemove.drag mouseup.drag",null),Gt(t.event.view,r),jt(),c.mouse("end")}function y(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=a.apply(this,arguments),u=r.length;for(n=0;n<u;++n)(e=m(r[n].identifier,i,It,this,arguments))&&(Ht(),e("start"))}}function _(){var n,e,r=t.event.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(jt(),e("drag"))}function b(){var n,e,r=t.event.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout(function(){i=null},500),n=0;n<o;++n)(e=c[r[n].identifier])&&(Ht(),e("end"))}function m(n,e,r,i,o){var a,f,h,p=r(e,n),v=s.copy();if(Ct(new $t(d,"beforestart",a,n,l,p[0],p[1],0,0,v),function(){return null!=(t.event.subject=a=u.apply(i,o))&&(f=a.x-p[0]||0,h=a.y-p[1]||0,!0)}))return function t(u){var s,g=p;switch(u){case"start":c[n]=t,s=l++;break;case"end":delete c[n],--l;case"drag":p=r(e,n),s=l}Ct(new $t(d,u,a,n,s,p[0]+f,p[1]+h,p[0]-g[0],p[1]-g[1],v),v.apply,v,[u,i,o])}}return d.filter=function(t){return arguments.length?(o="function"==typeof t?t:Vt(!!t),d):o},d.container=function(t){return arguments.length?(a="function"==typeof t?t:Vt(t),d):a},d.subject=function(t){return arguments.length?(u="function"==typeof t?t:Vt(t),d):u},d.touchable=function(t){return arguments.length?(f="function"==typeof t?t:Vt(!!t),d):f},d.on=function(){var t=s.on.apply(s,arguments);return t===s?d:t},d.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,d):Math.sqrt(h)},d},t.dragDisable=Xt,t.dragEnable=Gt,t.dsvFormat=Eo,t.csvParse=Co,t.csvParseRows=Po,t.csvFormat=zo,t.csvFormatRows=Ro,t.tsvParse=Do,t.tsvParseRows=Uo,t.tsvFormat=qo,t.tsvFormatRows=Oo,t.easeLinear=function(t){return+t},t.easeQuad=Dr,t.easeQuadIn=function(t){return t*t},t.easeQuadOut=function(t){return t*(2-t)},t.easeQuadInOut=Dr,t.easeCubic=Ur,t.easeCubicIn=function(t){return t*t*t},t.easeCubicOut=function(t){return--t*t*t+1},t.easeCubicInOut=Ur,t.easePoly=Yr,t.easePolyIn=qr,t.easePolyOut=Or,t.easePolyInOut=Yr,t.easeSin=Ir,t.easeSinIn=function(t){return 1-Math.cos(t*Fr)},t.easeSinOut=function(t){return Math.sin(t*Fr)},t.easeSinInOut=Ir,t.easeExp=Hr,t.easeExpIn=function(t){return Math.pow(2,10*t-10)},t.easeExpOut=function(t){return 1-Math.pow(2,-10*t)},t.easeExpInOut=Hr,t.easeCircle=jr,t.easeCircleIn=function(t){return 1-Math.sqrt(1-t*t)},t.easeCircleOut=function(t){return Math.sqrt(1- --t*t)},t.easeCircleInOut=jr,t.easeBounce=ni,t.easeBounceIn=function(t){return 1-ni(1-t)},t.easeBounceOut=ni,t.easeBounceInOut=function(t){return((t*=2)<=1?1-ni(1-t):ni(t-1)+1)/2},t.easeBack=ii,t.easeBackIn=ei,t.easeBackOut=ri,t.easeBackInOut=ii,t.easeElastic=ui,t.easeElasticIn=ai,t.easeElasticOut=ui,t.easeElasticInOut=fi,t.blob=function(t,n){return fetch(t,n).then(Yo)},t.buffer=function(t,n){return fetch(t,n).then(Bo)},t.dsv=function(t,n,e,r){3===arguments.length&&"function"==typeof e&&(r=e,e=void 0);var i=Eo(t);return Io(n,e).then(function(t){return i.parse(t,r)})},t.csv=jo,t.tsv=Xo,t.image=function(t,n){return new Promise(function(e,r){var i=new Image;for(var o in n)i[o]=n[o];i.onerror=r,i.onload=function(){e(i)},i.src=t})},t.json=function(t,n){return fetch(t,n).then(Go)},t.text=Io,t.xml=$o,t.html=Wo,t.svg=Zo,t.forceCenter=function(t,n){var e;function r(){var r,i,o=e.length,a=0,u=0;for(r=0;r<o;++r)a+=(i=e[r]).x,u+=i.y;for(a=a/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=a,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r},t.forceCollide=function(t){var n,e,r=1,i=1;function o(){for(var t,o,u,f,c,s,l,h=n.length,d=0;d<i;++d)for(o=ra(n,ua,fa).visitAfter(a),t=0;t<h;++t)u=n[t],s=e[u.index],l=s*s,f=u.x+u.vx,c=u.y+u.vy,o.visit(p);function p(t,n,e,i,o){var a=t.data,h=t.r,d=s+h;if(!a)return n>f+d||i<f-d||e>c+d||o<c-d;if(a.index>u.index){var p=f-a.x-a.vx,v=c-a.y-a.vy,g=p*p+v*v;g<d*d&&(0===p&&(g+=(p=Jo())*p),0===v&&(g+=(v=Jo())*v),g=(d-(g=Math.sqrt(g)))/g*r,u.vx+=(p*=g)*(d=(h*=h)/(l+h)),u.vy+=(v*=g)*d,a.vx-=p*(d=1-d),a.vy-=v*d)}}}function a(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function u(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=Qo(null==t?1:+t)),o.initialize=function(t){n=t,u()},o.iterations=function(t){return arguments.length?(i=+t,o):i},o.strength=function(t){return arguments.length?(r=+t,o):r},o.radius=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),u(),o):t},o},t.forceLink=function(t){var n,e,r,i,o,a=ca,u=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},f=Qo(30),c=1;function s(r){for(var i=0,a=t.length;i<c;++i)for(var u,f,s,l,h,d,p,v=0;v<a;++v)f=(u=t[v]).source,l=(s=u.target).x+s.vx-f.x-f.vx||Jo(),h=s.y+s.vy-f.y-f.vy||Jo(),l*=d=((d=Math.sqrt(l*l+h*h))-e[v])/d*r*n[v],h*=d,s.vx-=l*(p=o[v]),s.vy-=h*p,f.vx+=l*(p=1-p),f.vy+=h*p}function l(){if(r){var u,f,c=r.length,s=t.length,l=Ki(r,a);for(u=0,i=new Array(c);u<s;++u)(f=t[u]).index=u,"object"!=typeof f.source&&(f.source=sa(l,f.source)),"object"!=typeof f.target&&(f.target=sa(l,f.target)),i[f.source.index]=(i[f.source.index]||0)+1,i[f.target.index]=(i[f.target.index]||0)+1;for(u=0,o=new Array(s);u<s;++u)f=t[u],o[u]=i[f.source.index]/(i[f.source.index]+i[f.target.index]);n=new Array(s),h(),e=new Array(s),d()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+u(t[e],e,t)}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+f(t[n],n,t)}return null==t&&(t=[]),s.initialize=function(t){r=t,l()},s.links=function(n){return arguments.length?(t=n,l(),s):t},s.id=function(t){return arguments.length?(a=t,s):a},s.iterations=function(t){return arguments.length?(c=+t,s):c},s.strength=function(t){return arguments.length?(u="function"==typeof t?t:Qo(+t),h(),s):u},s.distance=function(t){return arguments.length?(f="function"==typeof t?t:Qo(+t),d(),s):f},s},t.forceManyBody=function(){var t,n,e,r,i=Qo(-30),o=1,a=1/0,u=.81;function f(r){var i,o=t.length,a=ra(t,la,ha).visitAfter(s);for(e=r,i=0;i<o;++i)n=t[i],a.visit(l)}function c(){if(t){var n,e,o=t.length;for(r=new Array(o),n=0;n<o;++n)e=t[n],r[e.index]=+i(e,n,t)}}function s(t){var n,e,i,o,a,u=0,f=0;if(t.length){for(i=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,f+=e,i+=e*n.x,o+=e*n.y);t.x=i/f,t.y=o/f}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=r[n.data.index]}while(n=n.next)}t.value=u}function l(t,i,f,c){if(!t.value)return!0;var s=t.x-n.x,l=t.y-n.y,h=c-i,d=s*s+l*l;if(h*h/u<d)return d<a&&(0===s&&(d+=(s=Jo())*s),0===l&&(d+=(l=Jo())*l),d<o&&(d=Math.sqrt(o*d)),n.vx+=s*t.value*e/d,n.vy+=l*t.value*e/d),!0;if(!(t.length||d>=a)){(t.data!==n||t.next)&&(0===s&&(d+=(s=Jo())*s),0===l&&(d+=(l=Jo())*l),d<o&&(d=Math.sqrt(o*d)));do{t.data!==n&&(h=r[t.data.index]*e/d,n.vx+=s*h,n.vy+=l*h)}while(t=t.next)}}return f.initialize=function(n){t=n,c()},f.strength=function(t){return arguments.length?(i="function"==typeof t?t:Qo(+t),c(),f):i},f.distanceMin=function(t){return arguments.length?(o=t*t,f):Math.sqrt(o)},f.distanceMax=function(t){return arguments.length?(a=t*t,f):Math.sqrt(a)},f.theta=function(t){return arguments.length?(u=t*t,f):Math.sqrt(u)},f},t.forceRadial=function(t,n,e){var r,i,o,a=Qo(.1);function u(t){for(var a=0,u=r.length;a<u;++a){var f=r[a],c=f.x-n||1e-6,s=f.y-e||1e-6,l=Math.sqrt(c*c+s*s),h=(o[a]-l)*i[a]*t/l;f.vx+=c*h,f.vy+=s*h}}function f(){if(r){var n,e=r.length;for(i=new Array(e),o=new Array(e),n=0;n<e;++n)o[n]=+t(r[n],n,r),i[n]=isNaN(o[n])?0:+a(r[n],n,r)}}return"function"!=typeof t&&(t=Qo(+t)),null==n&&(n=0),null==e&&(e=0),u.initialize=function(t){r=t,f()},u.strength=function(t){return arguments.length?(a="function"==typeof t?t:Qo(+t),f(),u):a},u.radius=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),f(),u):t},u.x=function(t){return arguments.length?(n=+t,u):n},u.y=function(t){return arguments.length?(e=+t,u):e},u},t.forceSimulation=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=Ki(),f=ur(s),c=I("tick","end");function s(){l(),c.call("tick",n),e<r&&(f.stop(),c.call("end",n))}function l(){var n,r,f=t.length;for(e+=(o-e)*i,u.each(function(t){t(e)}),n=0;n<f;++n)null==(r=t[n]).fx?r.x+=r.vx*=a:(r.x=r.fx,r.vx=0),null==r.fy?r.y+=r.vy*=a:(r.y=r.fy,r.vy=0)}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,isNaN(n.x)||isNaN(n.y)){var i=da*Math.sqrt(e),o=e*pa;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function d(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:l,restart:function(){return f.restart(s),n},stop:function(){return f.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(d),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,d(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,f,c=0,s=t.length;for(null==r?r=1/0:r*=r,c=0;c<s;++c)(a=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(f=u,r=a);return f},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}},t.forceX=function(t){var n,e,r,i=Qo(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=Qo(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Qo(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),a(),o):t},o},t.forceY=function(t){var n,e,r,i=Qo(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=Qo(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Qo(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),a(),o):t},o},t.formatDefaultLocale=Sa,t.formatLocale=Na,t.formatSpecifier=ba,t.precisionFixed=Ea,t.precisionPrefix=ka,t.precisionRound=Ca,t.geoArea=function(t){return yu.reset(),su(t,_u),2*yu},t.geoBounds=function(t){var n,e,r,i,o,a,u;if(Ru=zu=-(Cu=Pu=1/0),Ou=[],su(t,rf),e=Ou.length){for(Ou.sort(df),n=1,o=[r=Ou[0]];n<e;++n)pf(r,(i=Ou[n])[0])||pf(r,i[1])?(hf(r[0],i[1])>hf(r[0],r[1])&&(r[1]=i[1]),hf(i[0],r[1])>hf(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(u=hf(r[1],i[0]))>a&&(a=u,Cu=i[0],zu=r[1])}return Ou=Yu=null,Cu===1/0||Pu===1/0?[[NaN,NaN],[NaN,NaN]]:[[Cu,Pu],[zu,Ru]]},t.geoCentroid=function(t){Bu=Fu=Iu=Hu=ju=Xu=Gu=Vu=$u=Wu=Zu=0,su(t,vf);var n=$u,e=Wu,r=Zu,i=n*n+e*e+r*r;return i<Ua&&(n=Xu,e=Gu,r=Vu,Fu<Da&&(n=Iu,e=Hu,r=ju),(i=n*n+e*e+r*r)<Ua)?[NaN,NaN]:[Xa(e,n)*Fa,eu(r/Ka(i))*Fa]},t.geoCircle=function(){var t,n,e=Nf([0,0]),r=Nf(90),i=Nf(6),o={point:function(e,r){t.push(e=n(e,r)),e[0]*=Fa,e[1]*=Fa}};function a(){var a=e.apply(this,arguments),u=r.apply(this,arguments)*Ia,f=i.apply(this,arguments)*Ia;return t=[],n=kf(-a[0]*Ia,-a[1]*Ia,0).invert,Lf(o,u,f,1),a={type:"Polygon",coordinates:[t]},t=n=null,a}return a.center=function(t){return arguments.length?(e="function"==typeof t?t:Nf([+t[0],+t[1]]),a):e},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:Nf(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:Nf(+t),a):i},a},t.geoClipAntimeridian=Gf,t.geoClipCircle=Vf,t.geoClipExtent=function(){var t,n,e,r=0,i=0,o=960,a=500;return e={stream:function(e){return t&&n===e?t:t=Zf(r,i,o,a)(n=e)},extent:function(u){return arguments.length?(r=+u[0][0],i=+u[0][1],o=+u[1][0],a=+u[1][1],t=n=null,e):[[r,i],[o,a]]}}},t.geoClipRectangle=Zf,t.geoContains=function(t,n){return(t&&cc.hasOwnProperty(t.type)?cc[t.type]:lc)(t,n)},t.geoDistance=fc,t.geoGraticule=bc,t.geoGraticule10=function(){return bc()()},t.geoInterpolate=function(t,n){var e=t[0]*Ia,r=t[1]*Ia,i=n[0]*Ia,o=n[1]*Ia,a=Ga(r),u=Qa(r),f=Ga(o),c=Qa(o),s=a*Ga(e),l=a*Qa(e),h=f*Ga(i),d=f*Qa(i),p=2*eu(Ka(ru(o-r)+a*f*ru(i-e))),v=Qa(p),g=p?function(t){var n=Qa(t*=p)/v,e=Qa(p-t)/v,r=e*s+n*h,i=e*l+n*d,o=e*u+n*c;return[Xa(i,r)*Fa,Xa(o,Ka(r*r+i*i))*Fa]}:function(){return[e*Fa,r*Fa]};return g.distance=p,g},t.geoLength=oc,t.geoPath=function(t,n){var e,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),su(t,e(r))),r.result()}return o.area=function(t){return su(t,e(Sc)),Sc.result()},o.measure=function(t){return su(t,e(ds)),ds.result()},o.bounds=function(t){return su(t,e(Uc)),Uc.result()},o.centroid=function(t){return su(t,e(Zc)),Zc.result()},o.projection=function(n){return arguments.length?(e=null==n?(t=null,mc):(t=n).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(n=null,new gs):new as(n=t),"function"!=typeof i&&r.pointRadius(i),o):n},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(n)},t.geoAlbers=Ds,t.geoAlbersUsa=function(){var t,n,e,r,i,o,a=Ds(),u=Ls().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=Ls().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){o=[t,n]}};function s(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function l(){return t=n=null,s}return s.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?f:a).invert(t)},s.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),f.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},s.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),f.precision(t),l()):a.precision()},s.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),f.scale(t),s.translate(a.translate())):a.scale()},s.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],s=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,s-.238*n],[o+.455*n,s+.238*n]]).stream(c),r=u.translate([o-.307*n,s+.201*n]).clipExtent([[o-.425*n+Da,s+.12*n+Da],[o-.214*n-Da,s+.234*n-Da]]).stream(c),i=f.translate([o-.205*n,s+.212*n]).clipExtent([[o-.214*n+Da,s+.166*n+Da],[o-.115*n-Da,s+.234*n-Da]]).stream(c),l()},s.fitExtent=function(t,n){return xs(s,t,n)},s.fitSize=function(t,n){return ws(s,t,n)},s.fitWidth=function(t,n){return Ms(s,t,n)},s.fitHeight=function(t,n){return As(s,t,n)},s.scale(1070)},t.geoAzimuthalEqualArea=function(){return Cs(Os).scale(124.75).clipAngle(179.999)},t.geoAzimuthalEqualAreaRaw=Os,t.geoAzimuthalEquidistant=function(){return Cs(Ys).scale(79.4188).clipAngle(179.999)},t.geoAzimuthalEquidistantRaw=Ys,t.geoConicConformal=function(){return zs(Hs).scale(109.5).parallels([30,30])},t.geoConicConformalRaw=Hs,t.geoConicEqualArea=Ls,t.geoConicEqualAreaRaw=Rs,t.geoConicEquidistant=function(){return zs(Xs).scale(131.154).center([0,13.9389])},t.geoConicEquidistantRaw=Xs,t.geoEqualEarth=function(){return Cs(Qs).scale(177.158)},t.geoEqualEarthRaw=Qs,t.geoEquirectangular=function(){return Cs(js).scale(152.63)},t.geoEquirectangularRaw=js,t.geoGnomonic=function(){return Cs(Js).scale(144.049).clipAngle(60)},t.geoGnomonicRaw=Js,t.geoIdentity=function(){var t,n,e,r,i,o,a=1,u=0,f=0,c=1,s=1,l=mc,h=null,d=mc;function p(){return r=i=null,o}return o={stream:function(t){return r&&i===t?r:r=l(d(i=t))},postclip:function(r){return arguments.length?(d=r,h=t=n=e=null,p()):d},clipExtent:function(r){return arguments.length?(d=null==r?(h=t=n=e=null,mc):Zf(h=+r[0][0],t=+r[0][1],n=+r[1][0],e=+r[1][1]),p()):null==h?null:[[h,t],[n,e]]},scale:function(t){return arguments.length?(l=Ks((a=+t)*c,a*s,u,f),p()):a},translate:function(t){return arguments.length?(l=Ks(a*c,a*s,u=+t[0],f=+t[1]),p()):[u,f]},reflectX:function(t){return arguments.length?(l=Ks(a*(c=t?-1:1),a*s,u,f),p()):c<0},reflectY:function(t){return arguments.length?(l=Ks(a*c,a*(s=t?-1:1),u,f),p()):s<0},fitExtent:function(t,n){return xs(o,t,n)},fitSize:function(t,n){return ws(o,t,n)},fitWidth:function(t,n){return Ms(o,t,n)},fitHeight:function(t,n){return As(o,t,n)}}},t.geoProjection=Cs,t.geoProjectionMutator=Ps,t.geoMercator=function(){return Fs(Bs).scale(961/Ba)},t.geoMercatorRaw=Bs,t.geoNaturalEarth1=function(){return Cs(tl).scale(175.295)},t.geoNaturalEarth1Raw=tl,t.geoOrthographic=function(){return Cs(nl).scale(249.5).clipAngle(90+Da)},t.geoOrthographicRaw=nl,t.geoStereographic=function(){return Cs(el).scale(250).clipAngle(142)},t.geoStereographicRaw=el,t.geoTransverseMercator=function(){var t=Fs(rl),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=rl,t.geoRotation=Rf,t.geoStream=su,t.geoTransform=function(t){return{stream:_s(t)}},t.cluster=function(){var t=il,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(n){var e=n.children;e?(n.x=function(t){return t.reduce(ol,0)/t.length}(e),n.y=function(t){return 1+t.reduce(al,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)});var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),f=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),c=u.x-t(u,f)/2,s=f.x+t(f,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-c)/(s-c)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.hierarchy=fl,t.pack=function(){var t=null,n=1,e=1,r=El;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(Pl(t)).eachAfter(zl(r,.5)).eachBefore(Rl(1)):i.eachBefore(Pl(Cl)).eachAfter(zl(El,1)).eachAfter(zl(r,i.r/Math.min(n,e))).eachBefore(Rl(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=null==(e=n)?null:Sl(e),i):t;var e},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:kl(+t),i):r},i},t.packSiblings=function(t){return Nl(t),t},t.packEnclose=pl,t.partition=function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&Dl(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(Ll),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},t.stratify=function(){var t=Yl,n=Bl;function e(e){var r,i,o,a,u,f,c,s=e.length,l=new Array(s),h={};for(i=0;i<s;++i)r=e[i],u=l[i]=new hl(r),null!=(f=t(r,i,e))&&(f+="")&&(h[c=Ul+(u.id=f)]=c in h?Ol:u);for(i=0;i<s;++i)if(u=l[i],null!=(f=n(e[i],i,e))&&(f+="")){if(!(a=h[Ul+f]))throw new Error("missing: "+f);if(a===Ol)throw new Error("ambiguous: "+f);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(o)throw new Error("multiple roots");o=u}if(!o)throw new Error("no root");if(o.parent=ql,o.eachBefore(function(t){t.depth=t.parent.depth+1,--s}).eachBefore(ll),o.parent=null,s>0)throw new Error("cycle");return o}return e.id=function(n){return arguments.length?(t=Sl(n),e):t},e.parentId=function(t){return arguments.length?(n=Sl(t),e):n},e},t.tree=function(){var t=Fl,n=1,e=1,r=null;function i(i){var f=function(t){for(var n,e,r,i,o,a=new Gl(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Gl(r[i],i)),e.parent=n;return(a.parent=new Gl(null,0)).children=[a],a}(i);if(f.eachAfter(o),f.parent.m=-f.z,f.eachBefore(a),r)i.eachBefore(u);else{var c=i,s=i,l=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>s.x&&(s=t),t.depth>l.depth&&(l=t)});var h=c===s?1:t(c,s)/2,d=h-c.x,p=n/(s.x+h+d),v=e/(l.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*v})}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,f=o.parent.children[0],c=o.m,s=a.m,l=u.m,h=f.m;u=Hl(u),o=Il(o),u&&o;)f=Il(f),(a=Hl(a)).a=n,(i=u.z+l-o.z-c+t(u._,o._))>0&&(jl(Xl(u,n,r),n,i),c+=i,s+=i),l+=u.m,c+=o.m,h+=f.m,s+=a.m;u&&!Hl(a)&&(a.t=u,a.m+=l-s),o&&!Il(f)&&(f.t=o,f.m+=c-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.treemap=function(){var t=Zl,n=!1,e=1,r=1,i=[0],o=El,a=El,u=El,f=El,c=El;function s(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(Ll),t}function l(n){var e=i[n.depth],r=n.x0+e,s=n.y0+e,l=n.x1-e,h=n.y1-e;l<r&&(r=l=(r+l)/2),h<s&&(s=h=(s+h)/2),n.x0=r,n.y0=s,n.x1=l,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=c(n)-e,s+=a(n)-e,(l-=u(n)-e)<r&&(r=l=(r+l)/2),(h-=f(n)-e)<s&&(s=h=(s+h)/2),t(n,r,s,l,h))}return s.round=function(t){return arguments.length?(n=!!t,s):n},s.size=function(t){return arguments.length?(e=+t[0],r=+t[1],s):[e,r]},s.tile=function(n){return arguments.length?(t=Sl(n),s):t},s.padding=function(t){return arguments.length?s.paddingInner(t).paddingOuter(t):s.paddingInner()},s.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:kl(+t),s):o},s.paddingOuter=function(t){return arguments.length?s.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):s.paddingTop()},s.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:kl(+t),s):a},s.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:kl(+t),s):u},s.paddingBottom=function(t){return arguments.length?(f="function"==typeof t?t:kl(+t),s):f},s.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:kl(+t),s):c},s},t.treemapBinary=function(t,n,e,r,i){var o,a,u=t.children,f=u.length,c=new Array(f+1);for(c[0]=a=o=0;o<f;++o)c[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,f){if(n>=e-1){var s=u[n];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=f)}for(var l=c[n],h=r/2+l,d=n+1,p=e-1;d<p;){var v=d+p>>>1;c[v]<h?d=v+1:p=v}h-c[d-1]<c[d]-h&&n+1<d&&--d;var g=c[d]-l,y=r-g;if(a-i>f-o){var _=(i*y+a*g)/r;t(n,d,g,i,o,_,f),t(d,e,y,_,o,a,f)}else{var b=(o*y+f*g)/r;t(n,d,g,i,o,a,b),t(d,e,y,i,b,a,f)}}(0,f,t.value,n,e,r,i)},t.treemapDice=Dl,t.treemapSlice=Vl,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?Vl:Dl)(t,n,e,r,i)},t.treemapSquarify=Zl,t.treemapResquarify=Ql,t.interpolate=me,t.interpolateArray=de,t.interpolateBasis=ee,t.interpolateBasisClosed=re,t.interpolateDate=pe,t.interpolateDiscrete=function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},t.interpolateHue=function(t,n){var e=ae(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},t.interpolateNumber=ve,t.interpolateObject=ge,t.interpolateRound=xe,t.interpolateString=be,t.interpolateTransformCss=Ce,t.interpolateTransformSvg=Pe,t.interpolateZoom=qe,t.interpolateRgb=ce,t.interpolateRgbBasis=le,t.interpolateRgbBasisClosed=he,t.interpolateHsl=Ye,t.interpolateHslLong=Be,t.interpolateLab=function(t,n){var e=fe((t=Un(t)).l,(n=Un(n)).l),r=fe(t.a,n.a),i=fe(t.b,n.b),o=fe(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},t.interpolateHcl=Ie,t.interpolateHclLong=He,t.interpolateCubehelix=Xe,t.interpolateCubehelixLong=Ge,t.piecewise=function(t,n){for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}},t.quantize=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},t.path=Gi,t.polygonArea=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e<r;)n=i,i=t[e],o+=n[1]*i[0]-n[0]*i[1];return o/2},t.polygonCentroid=function(t){for(var n,e,r=-1,i=t.length,o=0,a=0,u=t[i-1],f=0;++r<i;)n=u,u=t[r],f+=e=n[0]*u[1]-u[0]*n[1],o+=(n[0]+u[0])*e,a+=(n[1]+u[1])*e;return[o/(f*=3),a/f]},t.polygonHull=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n<e;++n)r[n]=[+t[n][0],+t[n][1],n];for(r.sort(Jl),n=0;n<e;++n)i[n]=[r[n][0],-r[n][1]];var o=Kl(r),a=Kl(i),u=a[0]===o[0],f=a[a.length-1]===o[o.length-1],c=[];for(n=o.length-1;n>=0;--n)c.push(t[r[o[n]][2]]);for(n=+u;n<a.length-f;++n)c.push(t[r[a[n]][2]]);return c},t.polygonContains=function(t,n){for(var e,r,i=t.length,o=t[i-1],a=n[0],u=n[1],f=o[0],c=o[1],s=!1,l=0;l<i;++l)e=(o=t[l])[0],(r=o[1])>u!=c>u&&a<(f-e)*(u-r)/(c-r)+e&&(s=!s),f=e,c=r;return s},t.polygonLength=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],f=0;++r<i;)n=a,e=u,n-=a=(o=t[r])[0],e-=u=o[1],f+=Math.sqrt(n*n+e*e);return f},t.quadtree=ra,t.randomUniform=nh,t.randomNormal=eh,t.randomLogNormal=rh,t.randomBates=oh,t.randomIrwinHall=ih,t.randomExponential=ah,t.scaleBand=hh,t.scalePoint=function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return t(e())},n}(hh().paddingInner(1))},t.scaleIdentity=function t(){var n=[0,1];function e(t){return+t}return e.invert=e,e.domain=e.range=function(t){return arguments.length?(n=fh.call(t,ph),e):n.slice()},e.copy=function(){return t().domain(n)},xh(e)},t.scaleLinear=function t(){var n=mh(gh,ve);return n.copy=function(){return bh(n,t())},xh(n)},t.scaleLog=function n(){var e=mh(Mh,Ah).domain([1,10]),r=e.domain,i=10,o=Sh(10),a=Nh(10);function u(){return o=Sh(i),a=Nh(i),r()[0]<0&&(o=Eh(o),a=Eh(a)),e}return e.base=function(t){return arguments.length?(i=+t,u()):i},e.domain=function(t){return arguments.length?(r(t),u()):r()},e.ticks=function(t){var n,e=r(),u=e[0],f=e[e.length-1];(n=f<u)&&(h=u,u=f,f=h);var c,s,l,h=o(u),d=o(f),p=null==t?10:+t,v=[];if(!(i%1)&&d-h<p){if(h=Math.round(h)-1,d=Math.round(d)+1,u>0){for(;h<d;++h)for(s=1,c=a(h);s<i;++s)if(!((l=c*s)<u)){if(l>f)break;v.push(l)}}else for(;h<d;++h)for(s=i-1,c=a(h);s>=1;--s)if(!((l=c*s)<u)){if(l>f)break;v.push(l)}}else v=m(h,d,Math.min(d-h,p)).map(a);return n?v.reverse():v},e.tickFormat=function(n,r){if(null==r&&(r=10===i?".0e":","),"function"!=typeof r&&(r=t.format(r)),n===1/0)return r;null==n&&(n=10);var u=Math.max(1,i*n/e.ticks().length);return function(t){var n=t/a(Math.round(o(t)));return n*i<i-.5&&(n*=i),n<=u?r(t):""}},e.nice=function(){return r(wh(r(),{floor:function(t){return a(Math.floor(o(t)))},ceil:function(t){return a(Math.ceil(o(t)))}}))},e.copy=function(){return bh(e,n().base(i))},e},t.scaleOrdinal=lh,t.scaleImplicit=sh,t.scalePow=Ch,t.scaleSqrt=function(){return Ch().exponent(.5)},t.scaleQuantile=function t(){var e=[],r=[],o=[];function a(){var t=0,n=Math.max(1,r.length);for(o=new Array(n-1);++t<n;)o[t-1]=A(e,t/n);return u}function u(t){if(!isNaN(t=+t))return r[i(o,t)]}return u.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?o[n-1]:e[0],n<o.length?o[n]:e[e.length-1]]},u.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var r,i=0,o=t.length;i<o;++i)null==(r=t[i])||isNaN(r=+r)||e.push(r);return e.sort(n),a()},u.range=function(t){return arguments.length?(r=ch.call(t),a()):r.slice()},u.quantiles=function(){return o.slice()},u.copy=function(){return t().domain(e).range(r)},u},t.scaleQuantize=function t(){var n=0,e=1,r=1,o=[.5],a=[0,1];function u(t){if(t<=t)return a[i(o,t,0,r)]}function f(){var t=-1;for(o=new Array(r);++t<r;)o[t]=((t+1)*e-(t-r)*n)/(r+1);return u}return u.domain=function(t){return arguments.length?(n=+t[0],e=+t[1],f()):[n,e]},u.range=function(t){return arguments.length?(r=(a=ch.call(t)).length-1,f()):a.slice()},u.invertExtent=function(t){var i=a.indexOf(t);return i<0?[NaN,NaN]:i<1?[n,o[0]]:i>=r?[o[r-1],e]:[o[i-1],o[i]]},u.copy=function(){return t().domain([n,e]).range(a)},xh(u)},t.scaleThreshold=function t(){var n=[.5],e=[0,1],r=1;function o(t){if(t<=t)return e[i(n,t,0,r)]}return o.domain=function(t){return arguments.length?(n=ch.call(t),r=Math.min(n.length,e.length-1),o):n.slice()},o.range=function(t){return arguments.length?(e=ch.call(t),r=Math.min(n.length,e.length-1),o):e.slice()},o.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},o.copy=function(){return t().domain(n).range(e)},o},t.scaleTime=function(){return cv(cd,ud,Vh,jh,Ih,Bh,Oh,Lh,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},t.scaleUtc=function(){return cv(Ld,zd,_d,vd,dd,ld,Oh,Lh,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},t.scaleSequential=function t(n){var e=0,r=1,i=1,o=!1;function a(t){var r=(t-e)*i;return n(o?Math.max(0,Math.min(1,r)):r)}return a.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],i=e===r?0:1/(r-e),a):[e,r]},a.clamp=function(t){return arguments.length?(o=!!t,a):o},a.interpolator=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t(n).domain([e,r]).clamp(o)},xh(a)},t.scaleDiverging=function t(n){var e=0,r=.5,i=1,o=1,a=1,u=!1;function f(t){var e=.5+((t=+t)-r)*(t<r?o:a);return n(u?Math.max(0,Math.min(1,e)):e)}return f.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],i=+t[2],o=e===r?0:.5/(r-e),a=r===i?0:.5/(i-r),f):[e,r,i]},f.clamp=function(t){return arguments.length?(u=!!t,f):u},f.interpolator=function(t){return arguments.length?(n=t,f):n},f.copy=function(){return t(n).domain([e,r,i]).clamp(u)},xh(f)},t.schemeCategory10=lv,t.schemeAccent=hv,t.schemeDark2=dv,t.schemePaired=pv,t.schemePastel1=vv,t.schemePastel2=gv,t.schemeSet1=yv,t.schemeSet2=_v,t.schemeSet3=bv,t.interpolateBrBG=wv,t.schemeBrBG=xv,t.interpolatePRGn=Av,t.schemePRGn=Mv,t.interpolatePiYG=Nv,t.schemePiYG=Tv,t.interpolatePuOr=Ev,t.schemePuOr=Sv,t.interpolateRdBu=Cv,t.schemeRdBu=kv,t.interpolateRdGy=zv,t.schemeRdGy=Pv,t.interpolateRdYlBu=Lv,t.schemeRdYlBu=Rv,t.interpolateRdYlGn=Uv,t.schemeRdYlGn=Dv,t.interpolateSpectral=Ov,t.schemeSpectral=qv,t.interpolateBuGn=Bv,t.schemeBuGn=Yv,t.interpolateBuPu=Iv,t.schemeBuPu=Fv,t.interpolateGnBu=jv,t.schemeGnBu=Hv,t.interpolateOrRd=Gv,t.schemeOrRd=Xv,t.interpolatePuBuGn=$v,t.schemePuBuGn=Vv,t.interpolatePuBu=Zv,t.schemePuBu=Wv,t.interpolatePuRd=Jv,t.schemePuRd=Qv,t.interpolateRdPu=tg,t.schemeRdPu=Kv,t.interpolateYlGnBu=eg,t.schemeYlGnBu=ng,t.interpolateYlGn=ig,t.schemeYlGn=rg,t.interpolateYlOrBr=ag,t.schemeYlOrBr=og,t.interpolateYlOrRd=fg,t.schemeYlOrRd=ug,t.interpolateBlues=sg,t.schemeBlues=cg,t.interpolateGreens=hg,t.schemeGreens=lg,t.interpolateGreys=pg,t.schemeGreys=dg,t.interpolatePurples=gg,t.schemePurples=vg,t.interpolateReds=_g,t.schemeReds=yg,t.interpolateOranges=mg,t.schemeOranges=bg,t.interpolateCubehelixDefault=xg,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Ag.h=360*t-100,Ag.s=1.5-1.5*n,Ag.l=.8-.9*n,Ag+""},t.interpolateWarm=wg,t.interpolateCool=Mg,t.interpolateSinebow=function(t){var n;return t=(.5-t)*Math.PI,Tg.r=255*(n=Math.sin(t))*n,Tg.g=255*(n=Math.sin(t+Ng))*n,Tg.b=255*(n=Math.sin(t+Sg))*n,Tg+""},t.interpolateViridis=kg,t.interpolateMagma=Cg,t.interpolateInferno=Pg,t.interpolatePlasma=zg,t.create=function(t){return Dt(W(t).call(document.documentElement))},t.creator=W,t.local=qt,t.matcher=rt,t.mouse=Ft,t.namespace=$,t.namespaces=V,t.clientPoint=Bt,t.select=Dt,t.selectAll=function(t){return"string"==typeof t?new Rt([document.querySelectorAll(t)],[document.documentElement]):new Rt([null==t?[]:t],zt)},t.selection=Lt,t.selector=Q,t.selectorAll=K,t.style=lt,t.touch=It,t.touches=function(t,n){null==n&&(n=Yt().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=Bt(t,n[e]);return i},t.window=st,t.customEvent=Ct,t.arc=function(){var t=Gg,n=Vg,e=Rg(0),r=null,i=$g,o=Wg,a=Zg,u=null;function f(){var f,c,s,l=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-Hg,p=o.apply(this,arguments)-Hg,v=Lg(p-d),g=p>d;if(u||(u=f=Gi()),h<l&&(c=h,h=l,l=c),h>Fg)if(v>jg-Fg)u.moveTo(h*Ug(d),h*Yg(d)),u.arc(0,0,h,d,p,!g),l>Fg&&(u.moveTo(l*Ug(p),l*Yg(p)),u.arc(0,0,l,p,d,g));else{var y,_,b=d,m=p,x=d,w=p,M=v,A=v,T=a.apply(this,arguments)/2,N=T>Fg&&(r?+r.apply(this,arguments):Bg(l*l+h*h)),S=Og(Lg(h-l)/2,+e.apply(this,arguments)),E=S,k=S;if(N>Fg){var C=Xg(N/l*Yg(T)),P=Xg(N/h*Yg(T));(M-=2*C)>Fg?(x+=C*=g?1:-1,w-=C):(M=0,x=w=(d+p)/2),(A-=2*P)>Fg?(b+=P*=g?1:-1,m-=P):(A=0,b=m=(d+p)/2)}var z=h*Ug(b),R=h*Yg(b),L=l*Ug(w),D=l*Yg(w);if(S>Fg){var U=h*Ug(m),q=h*Yg(m),O=l*Ug(x),Y=l*Yg(x);if(v<Ig){var B=M>Fg?function(t,n,e,r,i,o,a,u){var f=e-t,c=r-n,s=a-i,l=u-o,h=(s*(n-o)-l*(t-i))/(l*f-s*c);return[t+h*f,n+h*c]}(z,R,O,Y,U,q,L,D):[L,D],F=z-B[0],I=R-B[1],H=U-B[0],j=q-B[1],X=1/Yg(((s=(F*H+I*j)/(Bg(F*F+I*I)*Bg(H*H+j*j)))>1?0:s<-1?Ig:Math.acos(s))/2),G=Bg(B[0]*B[0]+B[1]*B[1]);E=Og(S,(l-G)/(X-1)),k=Og(S,(h-G)/(X+1))}}A>Fg?k>Fg?(y=Qg(O,Y,z,R,h,k,g),_=Qg(U,q,L,D,h,k,g),u.moveTo(y.cx+y.x01,y.cy+y.y01),k<S?u.arc(y.cx,y.cy,k,Dg(y.y01,y.x01),Dg(_.y01,_.x01),!g):(u.arc(y.cx,y.cy,k,Dg(y.y01,y.x01),Dg(y.y11,y.x11),!g),u.arc(0,0,h,Dg(y.cy+y.y11,y.cx+y.x11),Dg(_.cy+_.y11,_.cx+_.x11),!g),u.arc(_.cx,_.cy,k,Dg(_.y11,_.x11),Dg(_.y01,_.x01),!g))):(u.moveTo(z,R),u.arc(0,0,h,b,m,!g)):u.moveTo(z,R),l>Fg&&M>Fg?E>Fg?(y=Qg(L,D,U,q,l,-E,g),_=Qg(z,R,O,Y,l,-E,g),u.lineTo(y.cx+y.x01,y.cy+y.y01),E<S?u.arc(y.cx,y.cy,E,Dg(y.y01,y.x01),Dg(_.y01,_.x01),!g):(u.arc(y.cx,y.cy,E,Dg(y.y01,y.x01),Dg(y.y11,y.x11),!g),u.arc(0,0,l,Dg(y.cy+y.y11,y.cx+y.x11),Dg(_.cy+_.y11,_.cx+_.x11),g),u.arc(_.cx,_.cy,E,Dg(_.y11,_.x11),Dg(_.y01,_.x01),!g))):u.arc(0,0,l,w,x,g):u.lineTo(L,D)}else u.moveTo(0,0);if(u.closePath(),f)return u=null,f+""||null}return f.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-Ig/2;return[Ug(r)*e,Yg(r)*e]},f.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),f):t},f.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Rg(+t),f):n},f.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Rg(+t),f):e},f.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Rg(+t),f):r},f.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Rg(+t),f):i},f.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:Rg(+t),f):o},f.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Rg(+t),f):a},f.context=function(t){return arguments.length?(u=null==t?null:t,f):u},f},t.area=ry,t.line=ey,t.pie=function(){var t=oy,n=iy,e=null,r=Rg(0),i=Rg(jg),o=Rg(0);function a(a){var u,f,c,s,l,h=a.length,d=0,p=new Array(h),v=new Array(h),g=+r.apply(this,arguments),y=Math.min(jg,Math.max(-jg,i.apply(this,arguments)-g)),_=Math.min(Math.abs(y)/h,o.apply(this,arguments)),b=_*(y<0?-1:1);for(u=0;u<h;++u)(l=v[p[u]=u]=+t(a[u],u,a))>0&&(d+=l);for(null!=n?p.sort(function(t,e){return n(v[t],v[e])}):null!=e&&p.sort(function(t,n){return e(a[t],a[n])}),u=0,c=d?(y-h*b)/d:0;u<h;++u,g=s)f=p[u],s=g+((l=v[f])>0?l*c:0)+b,v[f]={data:a[f],index:u,value:l,startAngle:g,endAngle:s,padAngle:_};return v}return a.value=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Rg(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Rg(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:Rg(+t),a):o},a},t.areaRadial=ly,t.radialArea=ly,t.lineRadial=sy,t.radialLine=sy,t.pointRadial=hy,t.linkHorizontal=function(){return gy(yy)},t.linkVertical=function(){return gy(_y)},t.linkRadial=function(){var t=gy(by);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.symbol=function(){var t=Rg(my),n=Rg(64),e=null;function r(){var r;if(e||(e=r=Gi()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"==typeof n?n:Rg(n),r):t},r.size=function(t){return arguments.length?(n="function"==typeof t?t:Rg(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r},t.symbols=Uy,t.symbolCircle=my,t.symbolCross=xy,t.symbolDiamond=Ay,t.symbolSquare=ky,t.symbolStar=Ey,t.symbolTriangle=Py,t.symbolWye=Dy,t.curveBasisClosed=function(t){return new By(t)},t.curveBasisOpen=function(t){return new Fy(t)},t.curveBasis=function(t){return new Yy(t)},t.curveBundle=Hy,t.curveCardinalClosed=$y,t.curveCardinalOpen=Zy,t.curveCardinal=Gy,t.curveCatmullRomClosed=n_,t.curveCatmullRomOpen=r_,t.curveCatmullRom=Ky,t.curveLinearClosed=function(t){return new i_(t)},t.curveLinear=Kg,t.curveMonotoneX=function(t){return new c_(t)},t.curveMonotoneY=function(t){return new s_(t)},t.curveNatural=function(t){return new h_(t)},t.curveStep=function(t){return new p_(t,.5)},t.curveStepAfter=function(t){return new p_(t,1)},t.curveStepBefore=function(t){return new p_(t,0)},t.stack=function(){var t=Rg([]),n=g_,e=v_,r=y_;function i(i){var o,a,u=t.apply(this,arguments),f=i.length,c=u.length,s=new Array(c);for(o=0;o<c;++o){for(var l,h=u[o],d=s[o]=new Array(f),p=0;p<f;++p)d[p]=l=[0,+r(i[p],h,p,i)],l.data=i[p];d.key=h}for(o=0,a=n(s);o<c;++o)s[a[o]].index=o;return e(s,a),s}return i.keys=function(n){return arguments.length?(t="function"==typeof n?n:Rg(dy.call(n)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:Rg(+t),i):r},i.order=function(t){return arguments.length?(n=null==t?g_:"function"==typeof t?t:Rg(dy.call(t)),i):n},i.offset=function(t){return arguments.length?(e=null==t?v_:t,i):e},i},t.stackOffsetExpand=function(t,n){if((r=t.length)>0){for(var e,r,i,o=0,a=t[0].length;o<a;++o){for(i=e=0;e<r;++e)i+=t[e][o][1]||0;if(i)for(e=0;e<r;++e)t[e][o][1]/=i}v_(t,n)}},t.stackOffsetDiverging=function(t,n){if((u=t.length)>1)for(var e,r,i,o,a,u,f=0,c=t[n[0]].length;f<c;++f)for(o=a=0,e=0;e<u;++e)(i=(r=t[n[e]][f])[1]-r[0])>=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},t.stackOffsetNone=v_,t.stackOffsetSilhouette=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r<o;++r){for(var a=0,u=0;a<e;++a)u+=t[a][r][1]||0;i[r][1]+=i[r][0]=-u/2}v_(t,n)}},t.stackOffsetWiggle=function(t,n){if((i=t.length)>0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;a<r;++a){for(var u=0,f=0,c=0;u<i;++u){for(var s=t[n[u]],l=s[a][1]||0,h=(l-(s[a-1][1]||0))/2,d=0;d<u;++d){var p=t[n[d]];h+=(p[a][1]||0)-(p[a-1][1]||0)}f+=l,c+=h*l}e[a-1][1]+=e[a-1][0]=o,f&&(o-=c/f)}e[a-1][1]+=e[a-1][0]=o,v_(t,n)}},t.stackOrderAscending=__,t.stackOrderDescending=function(t){return __(t).reverse()},t.stackOrderInsideOut=function(t){var n,e,r=t.length,i=t.map(b_),o=g_(t).sort(function(t,n){return i[n]-i[t]}),a=0,u=0,f=[],c=[];for(n=0;n<r;++n)e=o[n],a<u?(a+=i[e],f.push(e)):(u+=i[e],c.push(e));return c.reverse().concat(f)},t.stackOrderNone=g_,t.stackOrderReverse=function(t){return g_(t).reverse()},t.timeInterval=Rh,t.timeMillisecond=Lh,t.timeMilliseconds=Dh,t.utcMillisecond=Lh,t.utcMilliseconds=Dh,t.timeSecond=Oh,t.timeSeconds=Yh,t.utcSecond=Oh,t.utcSeconds=Yh,t.timeMinute=Bh,t.timeMinutes=Fh,t.timeHour=Ih,t.timeHours=Hh,t.timeDay=jh,t.timeDays=Xh,t.timeWeek=Vh,t.timeWeeks=td,t.timeSunday=Vh,t.timeSundays=td,t.timeMonday=$h,t.timeMondays=nd,t.timeTuesday=Wh,t.timeTuesdays=ed,t.timeWednesday=Zh,t.timeWednesdays=rd,t.timeThursday=Qh,t.timeThursdays=id,t.timeFriday=Jh,t.timeFridays=od,t.timeSaturday=Kh,t.timeSaturdays=ad,t.timeMonth=ud,t.timeMonths=fd,t.timeYear=cd,t.timeYears=sd,t.utcMinute=ld,t.utcMinutes=hd,t.utcHour=dd,t.utcHours=pd,t.utcDay=vd,t.utcDays=gd,t.utcWeek=_d,t.utcWeeks=Td,t.utcSunday=_d,t.utcSundays=Td,t.utcMonday=bd,t.utcMondays=Nd,t.utcTuesday=md,t.utcTuesdays=Sd,t.utcWednesday=xd,t.utcWednesdays=Ed,t.utcThursday=wd,t.utcThursdays=kd,t.utcFriday=Md,t.utcFridays=Cd,t.utcSaturday=Ad,t.utcSaturdays=Pd,t.utcMonth=zd,t.utcMonths=Rd,t.utcYear=Ld,t.utcYears=Dd,t.timeFormatDefaultLocale=Qp,t.timeFormatLocale=Yd,t.isoFormat=Jp,t.isoParse=Kp,t.now=ir,t.timer=ur,t.timerFlush=fr,t.timeout=hr,t.interval=function(t,n,e){var r=new ar,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?ir():+e,r.restart(function o(a){a+=i,r.restart(o,i+=n,e),t(a)},n,e),r)},t.transition=zr,t.active=function(t,n){var e,r,i=t.__transition;if(i)for(r in n=null==n?null:n+"",i)if((e=i[r]).state>gr&&e.name===n)return new Pr([[t]],li,n,+r);return null},t.interrupt=Nr,t.voronoi=function(){var t=x_,n=w_,e=null;function r(r){return new eb(r.map(function(e,i){var o=[Math.round(t(e,i,r)/K_)*K_,Math.round(n(e,i,r)/K_)*K_];return o.index=i,o.data=e,o}),e)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(n){return arguments.length?(t="function"==typeof n?n:m_(+n),r):t},r.y=function(t){return arguments.length?(n="function"==typeof t?t:m_(+t),r):n},r.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},r.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],r):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},r},t.zoom=function(){var n,e,r=sb,i=lb,o=vb,a=db,u=pb,f=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,l=qe,h=[],d=I("start","zoom","end"),p=500,v=150,g=0;function y(t){t.property("__zoom",hb).on("wheel.zoom",A).on("mousedown.zoom",T).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",S).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,n){return(n=Math.max(f[0],Math.min(f[1],n)))===t.k?t:new ob(n,t.x,t.y)}function b(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new ob(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function x(t,n,e){t.on("start.zoom",function(){w(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=w(this,t),o=i.apply(this,t),a=e||m(o),u=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),f=this.__zoom,c="function"==typeof n?n.apply(this,t):n,s=l(f.invert(a).concat(u/f.k),c.invert(a).concat(u/c.k));return function(t){if(1===t)t=c;else{var n=s(t),e=u/n[2];t=new ob(e,a[0]-n[0]*e,a[1]-n[1]*e)}r.zoom(null,t)}})}function w(t,n){for(var e,r=0,i=h.length;r<i;++r)if((e=h[r]).that===t)return e;return new M(t,n)}function M(t,n){this.that=t,this.args=n,this.index=-1,this.active=0,this.extent=i.apply(t,n)}function A(){if(r.apply(this,arguments)){var t=w(this,arguments),n=this.__zoom,e=Math.max(f[0],Math.min(f[1],n.k*Math.pow(2,a.apply(this,arguments)))),i=Ft(this);if(t.wheel)t.mouse[0][0]===i[0]&&t.mouse[0][1]===i[1]||(t.mouse[1]=n.invert(t.mouse[0]=i)),clearTimeout(t.wheel);else{if(n.k===e)return;t.mouse=[i,n.invert(i)],Nr(this),t.start()}cb(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},v),t.zoom("mouse",o(b(_(n,e),t.mouse[0],t.mouse[1]),t.extent,c))}}function T(){if(!e&&r.apply(this,arguments)){var n=w(this,arguments),i=Dt(t.event.view).on("mousemove.zoom",function(){if(cb(),!n.moved){var e=t.event.clientX-u,r=t.event.clientY-f;n.moved=e*e+r*r>g}n.zoom("mouse",o(b(n.that.__zoom,n.mouse[0]=Ft(n.that),n.mouse[1]),n.extent,c))},!0).on("mouseup.zoom",function(){i.on("mousemove.zoom mouseup.zoom",null),Gt(t.event.view,n.moved),cb(),n.end()},!0),a=Ft(this),u=t.event.clientX,f=t.event.clientY;Xt(t.event.view),fb(),n.mouse=[a,this.__zoom.invert(a)],Nr(this),n.start()}}function N(){if(r.apply(this,arguments)){var n=this.__zoom,e=Ft(this),a=n.invert(e),u=n.k*(t.event.shiftKey?.5:2),f=o(b(_(n,u),e,a),i.apply(this,arguments),c);cb(),s>0?Dt(this).transition().duration(s).call(x,f,e):Dt(this).call(y.transform,f)}}function S(){if(r.apply(this,arguments)){var e,i,o,a,u=w(this,arguments),f=t.event.changedTouches,c=f.length;for(fb(),i=0;i<c;++i)a=[a=It(this,f,(o=f[i]).identifier),this.__zoom.invert(a),o.identifier],u.touch0?u.touch1||(u.touch1=a):(u.touch0=a,e=!0);if(n&&(n=clearTimeout(n),!u.touch1))return u.end(),void((a=Dt(this).on("dblclick.zoom"))&&a.apply(this,arguments));e&&(n=setTimeout(function(){n=null},p),Nr(this),u.start())}}function E(){var e,r,i,a,u=w(this,arguments),f=t.event.changedTouches,s=f.length;for(cb(),n&&(n=clearTimeout(n)),e=0;e<s;++e)i=It(this,f,(r=f[e]).identifier),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=i:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=i);if(r=u.that.__zoom,u.touch1){var l=u.touch0[0],h=u.touch0[1],d=u.touch1[0],p=u.touch1[1],v=(v=d[0]-l[0])*v+(v=d[1]-l[1])*v,g=(g=p[0]-h[0])*g+(g=p[1]-h[1])*g;r=_(r,Math.sqrt(v/g)),i=[(l[0]+d[0])/2,(l[1]+d[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;i=u.touch0[0],a=u.touch0[1]}u.zoom("touch",o(b(r,i,a),u.extent,c))}function k(){var n,r,i=w(this,arguments),o=t.event.changedTouches,a=o.length;for(fb(),e&&clearTimeout(e),e=setTimeout(function(){e=null},p),n=0;n<a;++n)r=o[n],i.touch0&&i.touch0[2]===r.identifier?delete i.touch0:i.touch1&&i.touch1[2]===r.identifier&&delete i.touch1;i.touch1&&!i.touch0&&(i.touch0=i.touch1,delete i.touch1),i.touch0?i.touch0[1]=this.__zoom.invert(i.touch0[0]):i.end()}return y.transform=function(t,n){var e=t.selection?t.selection():t;e.property("__zoom",hb),t!==e?x(t,n):e.interrupt().each(function(){w(this,arguments).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},y.scaleBy=function(t,n){y.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)})},y.scaleTo=function(t,n){y.transform(t,function(){var t=i.apply(this,arguments),e=this.__zoom,r=m(t),a=e.invert(r),u="function"==typeof n?n.apply(this,arguments):n;return o(b(_(e,u),r,a),t,c)})},y.translateBy=function(t,n,e){y.transform(t,function(){return o(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),i.apply(this,arguments),c)})},y.translateTo=function(t,n,e){y.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=m(t);return o(ab.translate(a[0],a[1]).scale(r.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,c)})},M.prototype={start:function(){return 1==++this.active&&(this.index=h.push(this)-1,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(h.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){Ct(new ib(y,t,this.that.__zoom),d.apply,d,[t,this.that,this.args])}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:rb(+t),y):a},y.filter=function(t){return arguments.length?(r="function"==typeof t?t:rb(!!t),y):r},y.touchable=function(t){return arguments.length?(u="function"==typeof t?t:rb(!!t),y):u},y.extent=function(t){return arguments.length?(i="function"==typeof t?t:rb([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):i},y.scaleExtent=function(t){return arguments.length?(f[0]=+t[0],f[1]=+t[1],y):[f[0],f[1]]},y.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],y):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},y.constrain=function(t){return arguments.length?(o=t,y):o},y.duration=function(t){return arguments.length?(s=+t,y):s},y.interpolate=function(t){return arguments.length?(l=t,y):l},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,y):Math.sqrt(g)},y},t.zoomTransform=ub,t.zoomIdentity=ab,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceURL=build://tf-imports/plottable.js /* MIT MIT @fileoverview Implements the Signature API to help in comparing when two Plottable objects have "changed". Memoization in Plottable is complicated by mutable scales and datasets. We cannot simply reference compare two e.g. scales since it may have internally mutated. To resolve this, we write a recursive Signature interface that holds an immutable snapshot of whatever state the scale/data was in at the time. Then on memoized function invocation we sign the new inputs and compare the signatures to decide if we should recompute. We must hand-write a signature for each custom class we wish to support. MIT @fileoverview manually add d3-selection-multi to d3 default bundle. Most of this code is copied from d3-selection-multi@1.0.0. See https://github.com/d3/d3-selection-multi/issues/11 for why we have to do this MIT @fileoverview Implements a convenient thunk function to handle the common case of creating a memoized function that takes its inputs from mutable class properties. MIT @fileoverview Implements a function memoizer using the Signature API. Plottable 3.7.0 (https://github.com/palantir/plottable) Copyright 2014-2017 Palantir Technologies Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE) is-plain-object <https://github.com/jonschlinkert/is-plain-object> Copyright (c) 2014-2017, Jon Schlinkert. Released under the MIT License. isobject <https://github.com/jonschlinkert/isobject> Copyright (c) 2014-2017, Jon Schlinkert. Released under the MIT License. */ (function(b,c){"object"===typeof exports&&"object"===typeof module?module.exports=c(require("d3")):"function"===typeof define&&define.amd?define(["d3"],c):"object"===typeof exports?exports.Plottable=c(require("d3")):b.Plottable=c(b.d3)})(this,function(b){return function(c){function e(k){if(g[k])return g[k].exports;var q=g[k]={i:k,l:!1,exports:{}};c[k].call(q.exports,q,q.exports,e);q.l=!0;return q.exports}var g={};e.m=c;e.c=g;e.i=function(k){return k};e.d=function(k,q,l){e.o(k,q)||Object.defineProperty(k, q,{configurable:!1,enumerable:!0,get:l})};e.n=function(k){var q=k&&k.__esModule?function(){return k["default"]}:function(){return k};e.d(q,"a",q);return q};e.o=function(k,q){return Object.prototype.hasOwnProperty.call(k,q)};e.p="";return e(e.s=140)}([function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}c=g(107);e.Array=c;c=g(110);e.Color=c;c=g(55);e.DOM=c;c=g(56);e.Math=c;c=g(113);e.Object=c;c=g(57);e.RTree=c;c=g(115);e.Stacking=c;c=g(35);e.Window=c;k(g(108));k(g(109));k(g(12)); k(g(111));k(g(112));k(g(58));k(g(116))},function(c){c.exports=b},function(c,e,g){function k(H,E,F){var J=E.accessor;E=E.scale;if(null==E)return[];var O=H.data();null!=F&&(O=O.filter(function(N,P){return F(N,P,H)}));O=O.map(function(N,P){return J(N,P,H)});return E.extentOfValues(O)}var q=this&&this.__extends||function(H,E){function F(){this.constructor=H}for(var J in E)E.hasOwnProperty(J)&&(H[J]=E[J]);H.prototype=null===E?Object.create(E):(F.prototype=E.prototype,new F)},l=g(1),m=g(7);c=g(4);var p= g(18),n=g(6),t=g(9),v=g(20),x=g(0),y=g(12),z=g(10),A=g(51),D=g(52);e.Renderer=z.makeEnum(["svg","canvas"]);g=function(H){function E(){var F=H.call(this)||this;F._dataChanged=!1;F._attrExtents={};F._animate=!1;F._animators={};F._propertyExtents={};F._resetEntityStore=function(){F._cachedEntityStore=void 0};F._overflowHidden=!0;F.addClass("plot");F._datasetToDrawer=new x.Map;F._attrBindings=l.map();F._includedValuesProvider=function(O,N){return F._includedValuesForScale(O,N)};F._renderCallback=function(){return F.render()}; F._onDatasetUpdateCallback=function(){return F._onDatasetUpdate()};F._propertyBindings=l.map();var J=(new m.Easing).maxTotalDuration(E._ANIMATION_MAX_DURATION);F.animator(A.Animator.MAIN,J);F.animator(A.Animator.RESET,new m.Null);F._deferredResetEntityStore=x.Window.debounce(D.DeferredRenderer.DEFERRED_RENDERING_DELAY,F._resetEntityStore);return F}q(E,H);E.getTotalDrawTime=function(F,J){return J.reduce(function(O,N){return O+N.animator.totalTime(F.length)},0)};E.applyDrawSteps=function(F,J){return F.map(function(O){var N= O.attrToProjector,P={};Object.keys(N).forEach(function(V){P[V]=function(T,aa){return N[V](T,aa,J)}});return{attrToAppliedProjector:P,animator:O.animator}})};E.prototype.anchor=function(F){F=y.coerceExternalD3(F);H.prototype.anchor.call(this,F);this._dataChanged=!0;this._resetEntityStore();this._updateExtents();return this};E.prototype._setup=function(){var F=this;this._isSetup||(H.prototype._setup.call(this),null!=this._canvas&&this._appendCanvasNode(),this._renderArea=this.content().append("g").classed("render-area", !0),this.datasets().forEach(function(J){return F._createNodesForDataset(J)}))};E.prototype._appendCanvasNode=function(){var F=this.element().select(".plot-canvas-container");F.empty()&&(F=this.element().append("div").classed("plot-canvas-container",!0),F.node().appendChild(this._canvas.node()))};E.prototype.setBounds=function(F,J,O,N){H.prototype.setBounds.call(this,F,J,O,N);this._resetEntityStore();null!=this._canvas&&(this._bufferCanvas&&!this._bufferCanvasValid&&(this._bufferCanvas.attr("width", this._canvas.attr("width")),this._bufferCanvas.attr("height",this._canvas.attr("height")),(O=this._bufferCanvas.node().getContext("2d"))&&O.drawImage(this._canvas.node(),0,0),this._bufferCanvasValid=!0),O=null!=window.devicePixelRatio?window.devicePixelRatio:1,this._canvas.attr("width",F*O),this._canvas.attr("height",J*O),N=this._canvas.node().getContext("2d"))&&(N.setTransform(O,0,0,O,0,0),this._bufferCanvas&&N.drawImage(this._bufferCanvas.node(),0,0,F,J))};E.prototype.destroy=function(){var F=this; H.prototype.destroy.call(this);this._scales().forEach(function(J){return J.offUpdate(F._renderCallback)});this.datasets([])};E.prototype._createNodesForDataset=function(F){F=this._datasetToDrawer.get(F);"svg"===this.renderer()?F.useSVG(this._renderArea):F.useCanvas(this._canvas);return F};E.prototype._createDrawer=function(){return new n.ProxyDrawer(function(){return new t.SVGDrawer("path","")},function(F){return new p.CanvasDrawer(F,function(){})})};E.prototype._getAnimator=function(F){return this._animateOnNextRender()? this._animators[F]||new m.Null:new m.Null};E.prototype._onDatasetUpdate=function(){this._updateExtents();this._dataChanged=!0;this._resetEntityStore();this.renderLowPriority()};E.prototype.attr=function(F,J,O){if(null==J)return this._attrBindings.get(F);this._bindAttr(F,J,O);this.render();return this};E.prototype._bindProperty=function(F,J,O,N){var P=this._propertyBindings.get(F);P=null!=P?P.scale:null;this._propertyBindings.set(F,{accessor:"function"===typeof J?J:function(){return J},scale:O,postScale:N}); null!=P&&this._uninstallScaleForKey(P,F);null!=O&&this._installScaleForKey(O,F);this._clearAttrToProjectorCache()};E.prototype._bindAttr=function(F,J,O){var N=this._attrBindings.get(F);N=null!=N?N.scale:null;this._attrBindings.set(F,{accessor:"function"===typeof J?J:function(){return J},scale:O});null!=N&&this._uninstallScaleForKey(N,F);null!=O&&this._installScaleForKey(O,F);this._clearAttrToProjectorCache()};E.prototype._clearAttrToProjectorCache=function(){delete this._cachedAttrToProjector};E.prototype._getAttrToProjector= function(){null==this._cachedAttrToProjector&&(this._cachedAttrToProjector=this._generateAttrToProjector());return x.Object.assign({},this._cachedAttrToProjector)};E.prototype._generateAttrToProjector=function(){var F={};this._attrBindings.each(function(O,N){F[N]=E._scaledAccessor(O)});var J=this._propertyProjectors();Object.keys(J).forEach(function(O){null==F[O]&&(F[O]=J[O])});return F};E.prototype.renderImmediately=function(){H.prototype.renderImmediately.call(this);this._isAnchored&&(this._paint(), this._dataChanged=!1);return this};E.prototype.renderLowPriority=function(){this._renderCallback()};E.prototype.animated=function(F){if(null==F)return this._animate;this._animate=F;return this};E.prototype.detach=function(){H.prototype.detach.call(this);this._updateExtents();return this};E.prototype._scales=function(){var F=[];this._attrBindings.each(function(J){J=J.scale;null!=J&&-1===F.indexOf(J)&&F.push(J)});this._propertyBindings.each(function(J){J=J.scale;null!=J&&-1===F.indexOf(J)&&F.push(J)}); return F};E.prototype._updateExtents=function(){var F=this;this._resetEntityStore();this._scales().forEach(function(J){return J.addIncludedValuesProvider(F._includedValuesProvider)})};E.prototype._filterForProperty=function(){return null};E.prototype.getExtentsForAttr=function(F){var J=this;null==this._attrExtents[F]&&(this._attrExtents[F]=v.memThunk(function(){return J.datasets()},function(){return J._attrBindings.get(F)},function(O,N){return null==N||null==N.accessor?null:O.map(function(P){return k(P, N,null)})}));return this._attrExtents[F]()};E.prototype.getExtentsForProperty=function(F){var J=this;null==this._propertyExtents[F]&&(this._propertyExtents[F]=v.memThunk(function(){return J.datasets()},function(){return J._propertyBindings.get(F)},function(){return J._filterForProperty(F)},function(O,N,P){return null==N||null==N.accessor?null:O.map(function(V){return k(V,N,P)})}));return this._propertyExtents[F]()};E.prototype._includedValuesForScale=function(F,J){var O=this;if(!this._isAnchored&& !J)return[];var N=[];this._attrBindings.each(function(P,V){P.scale===F&&(P=O.getExtentsForAttr(V),null!=P&&(N=N.concat(l.merge(P))))});this._propertyBindings.each(function(P,V){P.scale===F&&(P=O.getExtentsForProperty(V),null!=P&&(N=N.concat(l.merge(P))))});return N};E.prototype.animator=function(F,J){if(void 0===J)return this._animators[F];this._animators[F]=J;return this};E.prototype.renderer=function(F){var J=this;if(void 0===F)return null==this._canvas?"svg":"canvas";null==this._canvas&&"canvas"=== F?(this._canvas=l.select(document.createElement("canvas")).classed("plot-canvas",!0),this._bufferCanvas=l.select(document.createElement("canvas")),null!=this.element()&&this._appendCanvasNode(),this._datasetToDrawer.forEach(function(O){O.useCanvas(J._canvas)}),this.render()):null!=this._canvas&&"svg"==F&&(this._canvas.remove(),this._bufferCanvas=this._canvas=null,this._datasetToDrawer.forEach(function(O){O.useSVG(J._renderArea)}),this.render());return this};E.prototype.addDataset=function(F){this._addDataset(F); this._onDatasetUpdate();return this};E.prototype._addDataset=function(F){this._removeDataset(F);var J=this._createDrawer(F);this._datasetToDrawer.set(F,J);this._isSetup&&this._createNodesForDataset(F);F.onUpdate(this._onDatasetUpdateCallback);return this};E.prototype.removeDataset=function(F){this._removeDataset(F);this._onDatasetUpdate()};E.prototype._removeDataset=function(F){if(-1===this.datasets().indexOf(F))return this;this._removeDatasetNodes(F);F.offUpdate(this._onDatasetUpdateCallback);this._datasetToDrawer.delete(F); return this};E.prototype._removeDatasetNodes=function(F){this._datasetToDrawer.get(F).remove()};E.prototype.datasets=function(F){var J=this,O=[];this._datasetToDrawer.forEach(function(N,P){return O.push(P)});if(null==F)return O;O.forEach(function(N){return J._removeDataset(N)});F.forEach(function(N){return J._addDataset(N)});this._onDatasetUpdate();return this};E.prototype._generateDrawSteps=function(){return[{attrToProjector:this._getAttrToProjector(),animator:new m.Null}]};E.prototype._additionalPaint= function(){};E.prototype._buildLightweightPlotEntities=function(F){var J=this,O=[];F.forEach(function(N,P){var V=J._datasetToDrawer.get(N),T=0;N.data().forEach(function(aa,da){var va=J._pixelPoint(aa,da,N);x.Math.isNaN(va.x)||x.Math.isNaN(va.y)||(O.push({datum:aa,get position(){return J._pixelPoint.call(J,aa,da,N)},index:da,dataset:N,datasetIndex:P,component:J,drawer:V,validDatumIndex:T}),T++)})});return O};E.prototype._getDataToDraw=function(){var F=new x.Map;this.datasets().forEach(function(J){return F.set(J, J.data())});return F};E.prototype._paint=function(){var F=this;delete this._cachedAttrToProjector;var J=this._generateDrawSteps(),O=this._getDataToDraw(),N=this.datasets().map(function(V){return F._datasetToDrawer.get(V)});if("canvas"===this.renderer()){var P=this._canvas.node();P.getContext("2d").clearRect(0,0,P.clientWidth,P.clientHeight);this._bufferCanvasValid=!1}this.datasets().forEach(function(V,T){var aa=E.applyDrawSteps(J,V);N[T].draw(O.get(V),aa)});P=this.datasets().map(function(V){return E.getTotalDrawTime(O.get(V), J)});P=x.Math.max(P,0);this._additionalPaint(P)};E.prototype.selections=function(F){var J=this;void 0===F&&(F=this.datasets());if("canvas"===this.renderer())return l.selectAll();var O=[];F.forEach(function(N){N=J._datasetToDrawer.get(N);null!=N&&(N=N.getVisualPrimitives(),O.push.apply(O,N))});return l.selectAll(O)};E.prototype.entities=function(F){var J=this;return this._getEntityStore(F).entities().map(function(O){return J._lightweightPlotEntityToPlotEntity(O)})};E.prototype._getEntityStore=function(F){function J(P){return O._entityBounds(P)} var O=this;if(void 0!==F){var N=new x.EntityStore;N.addAll(this._buildLightweightPlotEntities(F),J,this._localOriginBounds());return N}void 0===this._cachedEntityStore&&(N=new x.EntityStore,N.addAll(this._buildLightweightPlotEntities(this.datasets()),J,this._localOriginBounds()),this._cachedEntityStore=N);return this._cachedEntityStore};E.prototype._localOriginBounds=function(){return{topLeft:{x:0,y:0},bottomRight:{x:this.width(),y:this.height()}}};E.prototype._entityBounds=function(F){F=this._pixelPoint(F.datum, F.index,F.dataset);return{x:F.x,y:F.y,width:0,height:0}};E.prototype._lightweightPlotEntityToPlotEntity=function(F){return{bounds:this._entityBounds(F),component:F.component,dataset:F.dataset,datasetIndex:F.datasetIndex,datum:F.datum,index:F.index,position:F.position,selection:l.select(F.drawer.getVisualPrimitives()[F.validDatumIndex])}};E.prototype.entitiesAt=function(){throw Error("plots must implement entitiesAt");};E.prototype.entityNearest=function(F){F=this._getEntityStore().entityNearest(F); return void 0===F?void 0:this._lightweightPlotEntityToPlotEntity(F)};E.prototype.entitiesIn=function(F,J){return this.entitiesInBounds(null==J?{x:F.topLeft.x,y:F.topLeft.y,width:F.bottomRight.x-F.topLeft.x,height:F.bottomRight.y-F.topLeft.y}:{x:F.min,y:J.min,width:F.max-F.min,height:J.max-J.min})};E.prototype.entitiesInBounds=function(F){var J=this;if(F=this._getEntityStore().entitiesInBounds(F))return F.map(function(O){return J._lightweightPlotEntityToPlotEntity(O)})};E.prototype.entitiesInXBounds= function(F){var J=this;if(F=this._getEntityStore().entitiesInXBounds(F))return F.map(function(O){return J._lightweightPlotEntityToPlotEntity(O)})};E.prototype.entitiesInYBounds=function(F){var J=this;if(F=this._getEntityStore().entitiesInYBounds(F))return F.map(function(O){return J._lightweightPlotEntityToPlotEntity(O)})};E.prototype._uninstallScaleForKey=function(F){F.offUpdate(this._renderCallback);F.offUpdate(this._deferredResetEntityStore);F.removeIncludedValuesProvider(this._includedValuesProvider)}; E.prototype._installScaleForKey=function(F){F.onUpdate(this._renderCallback);F.onUpdate(this._deferredResetEntityStore);F.addIncludedValuesProvider(this._includedValuesProvider)};E.prototype._propertyProjectors=function(){return{}};E._scaledAccessor=function(F){var J=F.scale,O=F.accessor,N=F.postScale,P=null==J?O:function(V,T,aa){return J.scale(O(V,T,aa))};return null==N?P:function(V,T,aa){return N(P(V,T,aa),V,T,aa)}};E.prototype._pixelPoint=function(){return{x:0,y:0}};E.prototype._animateOnNextRender= function(){return this._animate&&this._dataChanged};return E}(c.Component);g._ANIMATION_MAX_DURATION=600;e.Plot=g},function(c,e,g){function k(m){for(var p in m)e.hasOwnProperty(p)||(e[p]=m[p])}c=g(105);e.TickGenerators=c;k(g(54));k(g(101));k(g(102));k(g(103));k(g(104));k(g(106));var q=g(54),l=g(11);e.isTransformable=function(m){return m instanceof l.QuantitativeScale||m instanceof q.Category}},function(c,e,g){var k=g(1),q=g(30),l=g(0),m=g(12);c=g(10);e.XAlignment=c.makeEnum(["left","center","right"]); e.YAlignment=c.makeEnum(["top","center","bottom"]);c=function(){function p(){this._overflowHidden=!1;this._origin={x:0,y:0};this._xAlignment="left";this._yAlignment="top";this._isAnchored=this._isSetup=!1;this._cssClasses=new l.Set;this._destroyed=!1;this._onAnchorCallbacks=new l.CallbackSet;this._onDetachCallbacks=new l.CallbackSet;this._cssClasses.add("component")}p.prototype.anchor=function(n){n=m.coerceExternalD3(n);if(this._destroyed)throw Error("Can't reuse destroy()-ed Components!");this.isRoot()&& (this._rootElement=n,this._rootElement.classed("plottable",!0));null!=this._element?n.node().appendChild(this._element.node()):(this._element=n.append("div"),this._setup());this._isAnchored=!0;this._onAnchorCallbacks.callCallbacks(this);return this};p.prototype.onAnchor=function(n){this._isAnchored&&n(this);this._onAnchorCallbacks.add(n)};p.prototype.offAnchor=function(n){this._onAnchorCallbacks.delete(n)};p.prototype._setup=function(){var n=this;this._isSetup||(this._cssClasses.forEach(function(t){n._element.classed(t, !0)}),this._cssClasses=new l.Set,this._backgroundContainer=this._element.append("svg").classed("background-container",!0),this._content=this._element.append("svg").classed("content",!0),this._foregroundContainer=this._element.append("svg").classed("foreground-container",!0),this._overflowHidden?this._content.classed("component-overflow-hidden",!0):this._content.classed("component-overflow-visible",!0),this._isSetup=!0)};p.prototype.requestedSpace=function(){return{minWidth:0,minHeight:0}};p.prototype.computeLayout= function(n,t,v){if(null==n||null==t||null==v){if(null==this._element)throw Error("anchor() must be called before computeLayout()");if(null!=this._rootElement)n={x:0,y:0},v=this._rootElement.node(),t=l.DOM.elementWidth(v),v=l.DOM.elementHeight(v);else throw Error("null arguments cannot be passed to computeLayout() on a non-root, unanchored node");}var x=this._sizeFromOffer(t,v),y=x.height;x=x.width;this.setBounds(x,y,n.x+(t-x)*p._xAlignToProportion[this._xAlignment],n.y+(v-y)*p._yAlignToProportion[this._yAlignment]); return this};p.prototype.setBounds=function(n,t,v,x){void 0===v&&(v=0);void 0===x&&(x=0);this._width=n;this._height=t;this._origin={x:v,y:x};null!=this._element&&this._element.styles({left:v+"px",height:t+"px",top:x+"px",width:n+"px"});null!=this._resizeHandler&&this._resizeHandler({width:n,height:t})};p.prototype._sizeFromOffer=function(n,t){var v=this.requestedSpace(n,t);return{width:this.fixedWidth()?Math.min(n,v.minWidth):n,height:this.fixedHeight()?Math.min(t,v.minHeight):t}};p.prototype.render= function(){this._isAnchored&&this._isSetup&&0<=this.width()&&0<=this.height()&&q.registerToRender(this);return this};p.prototype.renderLowPriority=function(){this.render()};p.prototype._scheduleComputeLayout=function(){this._isAnchored&&this._isSetup&&q.registerToComputeLayoutAndRender(this)};p.prototype.onResize=function(n){this._resizeHandler=n;return this};p.prototype.renderImmediately=function(){return this};p.prototype.redraw=function(){this._isAnchored&&this._isSetup&&(this.isRoot()?this._scheduleComputeLayout(): this.parent().redraw());return this};p.prototype.invalidateCache=function(){};p.prototype.renderTo=function(n){this.detach();if(null!=n){n="string"===typeof n?k.select(n):n instanceof Element?k.select(n):m.coerceExternalD3(n);if(!n.node()||null==n.node().nodeName)throw Error("Plottable requires a valid Element to renderTo");if("svg"===n.node().nodeName)throw Error("Plottable 3.x and later can only renderTo an HTML component; pass a div instead!");this.anchor(n)}if(null==this._element)throw Error("If a Component has never been rendered before, then renderTo must be given a node to render to, or a d3.Selection, or a selector string"); q.registerToComputeLayoutAndRender(this);q.flush()};p.prototype.xAlignment=function(n){if(null==n)return this._xAlignment;n=n.toLowerCase();if(null==p._xAlignToProportion[n])throw Error("Unsupported alignment: "+n);this._xAlignment=n;this.redraw();return this};p.prototype.yAlignment=function(n){if(null==n)return this._yAlignment;n=n.toLowerCase();if(null==p._yAlignToProportion[n])throw Error("Unsupported alignment: "+n);this._yAlignment=n;this.redraw();return this};p.prototype.hasClass=function(n){return null== n?!1:null==this._element?this._cssClasses.has(n):this._element.classed(n)};p.prototype.addClass=function(n){null!=n&&(null==this._element?this._cssClasses.add(n):this._element.classed(n,!0))};p.prototype.removeClass=function(n){null!=n&&(null==this._element?this._cssClasses.delete(n):this._element.classed(n,!1))};p.prototype.fixedWidth=function(){return!1};p.prototype.fixedHeight=function(){return!1};p.prototype.detach=function(){this.parent(null);this._isAnchored&&this._element.remove();this._isAnchored= !1;this._onDetachCallbacks.callCallbacks(this);return this};p.prototype.onDetach=function(n){this._onDetachCallbacks.add(n)};p.prototype.offDetach=function(n){this._onDetachCallbacks.delete(n)};p.prototype.parent=function(n){if(void 0===n)return this._parent;if(null!==n&&!n.has(this))throw Error("Passed invalid parent");this._parent=n;return this};p.prototype.bounds=function(){var n=this.origin();return{topLeft:n,bottomRight:{x:n.x+this.width(),y:n.y+this.height()}}};p.prototype.destroy=function(){this._destroyed= !0;this.detach()};p.prototype.width=function(){return this._width};p.prototype.height=function(){return this._height};p.prototype.origin=function(){return{x:this._origin.x,y:this._origin.y}};p.prototype.originToRoot=function(){for(var n=this.origin(),t=this.parent();null!=t;){var v=t.origin();n.x+=v.x;n.y+=v.y;t=t.parent()}return n};p.prototype.root=function(){for(var n=this;!n.isRoot();)n=n.parent();return n};p.prototype.isRoot=function(){return null==this.parent()};p.prototype.foreground=function(){return this._foregroundContainer}; p.prototype.content=function(){return this._content};p.prototype.element=function(){return this._element};p.prototype.rootElement=function(){return this.root()._rootElement};p.prototype.background=function(){return this._backgroundContainer};return p}();c._xAlignToProportion={left:0,center:.5,right:1};c._yAlignToProportion={top:0,center:.5,bottom:1};e.Component=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(59));k(g(62));k(g(133));k(g(21));k(g(64));k(g(66))}, function(c,e){c=function(){function g(k,q){this._svgDrawerFactory=k;this._canvasDrawerFactory=q}g.prototype.useSVG=function(k){null!=this._currentDrawer&&this._currentDrawer.remove();var q=this._svgDrawerFactory();q.attachTo(k);this._currentDrawer=q};g.prototype.useCanvas=function(k){null!=this._currentDrawer&&this._currentDrawer.remove();this._currentDrawer=this._canvasDrawerFactory(k.node().getContext("2d"))};g.prototype.getDrawer=function(){return this._currentDrawer};g.prototype.remove=function(){null!= this._currentDrawer&&this._currentDrawer.remove()};g.prototype.draw=function(k,q){this._currentDrawer.draw(k,q)};g.prototype.getVisualPrimitives=function(){return this._currentDrawer.getVisualPrimitives()};g.prototype.getVisualPrimitiveAtIndex=function(k){return this._currentDrawer.getVisualPrimitiveAtIndex(k)};return g}();e.ProxyDrawer=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(70));k(g(71))},function(c,e,g){function k(m){void 0===m&&(m=3);q(m);return function(p){return p.toFixed(m)}} function q(m){if(0>m||20<m)throw new RangeError("Formatter precision must be between 0 and 20");if(m!==Math.floor(m))throw new RangeError("Formatter precision must be an integer");}var l=g(1);e.currency=function(m,p,n){void 0===m&&(m=2);void 0===p&&(p="$");void 0===n&&(n=!0);var t=k(m);return function(v){var x=t(Math.abs(v));""!==x&&(x=n?p+x:x+p,0>v&&(x="-"+x));return x}};e.fixed=k;e.general=function(m){void 0===m&&(m=3);q(m);return function(p){if("number"===typeof p){var n=Math.pow(10,m);return String(Math.round(p* n)/n)}return String(p)}};e.identity=function(){return function(m){return String(m)}};e.percentage=function(m){void 0===m&&(m=0);var p=k(m);return function(n){var t=n.toString();t=Math.pow(10,t.length-(t.indexOf(".")+1));return p(parseInt((100*n*t).toString(),10)/t)+"%"}};e.siSuffix=function(m){void 0===m&&(m=3);q(m);return function(p){return l.format("."+m+"s")(p)}};e.shortScale=function(){var m=0;void 0===m&&(m=3);q(m);var p=l.format("."+m+"e"),n=l.format("."+m+"f"),t=Math.pow(10,18),v=Math.pow(10, -m);return function(x){var y=Math.abs(x);if((y<v||y>=t)&&0!==y)return p(x);for(var z=-1;y>=Math.pow(1E3,z+2)&&4>z;)z++;y=-1===z?n(x):n(x/Math.pow(1E3,z+1))+"KMBTQ"[z];if(0<x&&"1000"===y.substr(0,4)||0>x&&"-1000"===y.substr(0,5))4>z?(z++,y=n(x/Math.pow(1E3,z+1))+"KMBTQ"[z]):y=p(x);return y}};e.multiTime=function(){var m=[{specifier:".%L",predicate:function(p){return 0!==p.getMilliseconds()}},{specifier:":%S",predicate:function(p){return 0!==p.getSeconds()}},{specifier:"%I:%M",predicate:function(p){return 0!== p.getMinutes()}},{specifier:"%I %p",predicate:function(p){return 0!==p.getHours()}},{specifier:"%a %d",predicate:function(p){return 0!==p.getDay()&&1!==p.getDate()}},{specifier:"%b %d",predicate:function(p){return 1!==p.getDate()}},{specifier:"%b",predicate:function(p){return 0!==p.getMonth()}}];return function(p){var n=m.filter(function(t){return t.predicate(p)});return l.timeFormat(0<n.length?n[0].specifier:"%Y")(p)}};e.time=function(m){return l.timeFormat(m)}},function(c,e,g){var k=g(1),q=g(0); c=function(){function l(m,p){this._root=k.select(document.createElementNS("http://www.w3.org/2000/svg","g"));this._className=p;this._svgElementName=m}l.prototype.draw=function(m,p){var n=this;this._createAndDestroyDOMElements(m);var t=0;p.forEach(function(v){q.Window.setTimeout(function(){return n._drawStep(v)},t);t+=v.animator.totalTime(m.length)})};l.prototype.getVisualPrimitives=function(){null==this._cachedVisualPrimitivesNodes&&(this._cachedVisualPrimitivesNodes=this._selection.nodes());return this._cachedVisualPrimitivesNodes}; l.prototype.getVisualPrimitiveAtIndex=function(m){return this.getVisualPrimitives()[m]};l.prototype.remove=function(){this._root.remove()};l.prototype.attachTo=function(m){m.node().appendChild(this._root.node())};l.prototype.getRoot=function(){return this._root};l.prototype.selector=function(){return this._svgElementName};l.prototype._applyDefaultAttributes=function(){};l.prototype._createAndDestroyDOMElements=function(m){m=m.filter(function(p){return null!=p});m=this._root.selectAll(this.selector()).data(m); this._selection=m.enter().append(this._svgElementName).merge(m);m.exit().remove();this._cachedVisualPrimitivesNodes=null;null!=this._className&&this._selection.classed(this._className,!0);this._applyDefaultAttributes(this._selection)};l.prototype._drawStep=function(m){var p=this;["fill","stroke"].forEach(function(n){null!=m.attrToAppliedProjector[n]&&p._selection.attr(n,m.attrToAppliedProjector[n])});m.animator.animate(this._selection,m.attrToAppliedProjector);null!=this._className&&this._selection.classed(this._className, !0)};return l}();e.SVGDrawer=c},function(c,e){e.makeEnum=function(g){return g.reduce(function(k,q){k[q]=q;return k},{})}},function(c,e,g){var k=this&&this.__extends||function(p,n){function t(){this.constructor=p}for(var v in n)n.hasOwnProperty(v)&&(p[v]=n[v]);p.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)},q=g(1),l=g(26),m=g(0);c=function(p){function n(){var t=p.call(this)||this;t._tickGenerator=function(v){return v.defaultTicks()};t._padProportion=.05;t._snappingDomainEnabled= !0;t._paddingExceptionsProviders=new m.Set;return t}k(n,p);n.prototype.autoDomain=function(){this._domainMax=this._domainMin=null;p.prototype.autoDomain.call(this)};n.prototype._autoDomainIfAutomaticMode=function(){if(null!=this._domainMin&&null!=this._domainMax)this._setDomain([this._domainMin,this._domainMax]);else{var t=this._getExtent();null!=this._domainMin?(t=t[1],this._domainMin>=t&&(t=this._expandSingleValueDomain([this._domainMin,this._domainMin])[1]),this._setDomain([this._domainMin,t])): null!=this._domainMax?(t=t[0],this._domainMax<=t&&(t=this._expandSingleValueDomain([this._domainMax,this._domainMax])[0]),this._setDomain([t,this._domainMax])):p.prototype._autoDomainIfAutomaticMode.call(this)}};n.prototype._getUnboundedExtent=function(t){void 0===t&&(t=!1);t=this._getAllIncludedValues(t);var v=this._defaultExtent();0!==t.length&&(t=[m.Math.min(t,v[0]),m.Math.max(t,v[1])],v=this._padDomain(t));return v};n.prototype._getExtent=function(){var t=this._getUnboundedExtent();null!=this._domainMin&& (t[0]=this._domainMin);null!=this._domainMax&&(t[1]=this._domainMax);return t};n.prototype.addPaddingExceptionsProvider=function(t){this._paddingExceptionsProviders.add(t);this._autoDomainIfAutomaticMode()};n.prototype.removePaddingExceptionsProvider=function(t){this._paddingExceptionsProviders.delete(t);this._autoDomainIfAutomaticMode()};n.prototype.padProportion=function(t){if(null==t)return this._padProportion;if(0>t)throw Error("padProportion must be non-negative");this._padProportion=t;this._autoDomainIfAutomaticMode(); return this};n.prototype._padDomain=function(t){var v=this;if(t[0].valueOf()===t[1].valueOf())return this._expandSingleValueDomain(t);if(0===this._padProportion)return t;var x=this._padProportion/2,y=t[0],z=t[1],A=!1,D=!1;this._paddingExceptionsProviders.forEach(function(E){E(v).forEach(function(F){F.valueOf()===y.valueOf()&&(A=!0);F.valueOf()===z.valueOf()&&(D=!0)})});var H=this._backingScaleDomain();this._backingScaleDomain(t);t=A?y:this.invert(this.scale(y)-(this.scale(z)-this.scale(y))*x);x=D? z:this.invert(this.scale(z)+(this.scale(z)-this.scale(y))*x);this._backingScaleDomain(H);return this._snappingDomainEnabled?this._niceDomain([t,x]):[t,x]};n.prototype.snappingDomainEnabled=function(t){null!=t&&(this._snappingDomainEnabled=t,this._autoDomainIfAutomaticMode())};n.prototype._expandSingleValueDomain=function(t){return t};n.prototype.invert=function(){throw Error("Subclasses should override invert");};n.prototype.domain=function(t){null!=t&&(this._domainMin=t[0],this._domainMax=t[1]); return p.prototype.domain.call(this,t)};n.prototype.domainMin=function(t){if(null==t)return this.domain()[0];this._domainMin=t;this._autoDomainIfAutomaticMode();return this};n.prototype.domainMax=function(t){if(null==t)return this.domain()[1];this._domainMax=t;this._autoDomainIfAutomaticMode();return this};n.prototype.extentOfValues=function(t){t=q.extent(t.filter(function(v){return m.Math.isValidNumber(+v)}));return null==t[0]||null==t[1]?[]:t};n.prototype.zoom=function(t,v){var x=this;this.domain(this.range().map(function(y){return x.invert(l.zoomOut(y, t,v))}))};n.prototype.pan=function(t){var v=this;this.domain(this.range().map(function(x){return v.invert(x+t)}))};n.prototype.scaleTransformation=function(){throw Error("Subclasses should override scaleTransformation");};n.prototype.invertedTransformation=function(){throw Error("Subclasses should override invertedTransformation");};n.prototype.getTransformationExtent=function(){throw Error("Subclasses should override getTransformationExtent");};n.prototype.getTransformationDomain=function(){throw Error("Subclasses should override getTransformationDomain"); };n.prototype.setTransformationDomain=function(){throw Error("Subclasses should override setTransformationDomain");};n.prototype._setDomain=function(t){function v(x){return m.Math.isNaN(x)||Infinity===x||-Infinity===x}v(t[0])||v(t[1])?m.Window.warn("Warning: QuantitativeScales cannot take NaN or Infinity as a domain value. Ignoring."):p.prototype._setDomain.call(this,t)};n.prototype.defaultTicks=function(){throw Error("Subclasses should override _getDefaultTicks");};n.prototype.ticks=function(){return this._tickGenerator(this)}; n.prototype._niceDomain=function(){throw Error("Subclasses should override _niceDomain");};n.prototype._defaultExtent=function(){throw Error("Subclasses should override _defaultExtent");};n.prototype.tickGenerator=function(){var t=Plottable.Scales.TickGenerators.integerTickGenerator();null!=t&&(this._tickGenerator=t)};return n}(g(17).Scale);c._DEFAULT_NUM_TICKS=10;e.QuantitativeScale=c},function(c,e,g){var k=g(1);e.coerceExternalD3=function(q){if(null==q.attrs){if(null==q.nodes){var l=[];q.each(function(){l.push(this)}); return k.selectAll(l)}return k.selectAll(q.nodes())}return q}},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(83));k(g(84));k(g(85))},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(44));k(g(45));k(g(46));k(g(18));k(g(6));k(g(33));k(g(34));k(g(47));k(g(9));k(g(48))},function(c,e){c=function(){function g(){var k=this;this._anchorCallback=function(q){return k._anchor(q)};this._enabled=!0}g.prototype.attachTo=function(k){this._disconnect(); this._componentAttachedTo=k;this._connect();return this};g.prototype.detachFrom=function(){this.detach()};g.prototype.detach=function(){this._disconnect();this._componentAttachedTo=null;return this};g.prototype.enabled=function(k){if(null==k)return this._enabled;(this._enabled=k)?this._connect():this._disconnect();return this};g.prototype._anchor=function(){this._isAnchored=!0};g.prototype._unanchor=function(){this._isAnchored=!1};g.prototype._translateToComponentSpace=function(k){var q=this._componentAttachedTo.originToRoot(); return{x:k.x-q.x,y:k.y-q.y}};g.prototype._isInsideComponent=function(k){return 0<=k.x&&0<=k.y&&k.x<=this._componentAttachedTo.width()&&k.y<=this._componentAttachedTo.height()};g.prototype._connect=function(){if(this.enabled()&&null!=this._componentAttachedTo&&!this._isAnchored)this._componentAttachedTo.onAnchor(this._anchorCallback)};g.prototype._disconnect=function(){this._isAnchored&&this._unanchor();null!=this._componentAttachedTo&&this._componentAttachedTo.offAnchor(this._anchorCallback)};return g}(); e.Interaction=c},function(c,e,g){var k=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&&(n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},q=g(3),l=g(0),m=g(52),p=g(2);c=function(n){function t(){var v=n.call(this)||this;v._autoAdjustXScaleDomain=!1;v._autoAdjustYScaleDomain=!1;v._deferredRendering=!1;v._applyDeferredRenderingTransform=function(x,y,z,A){v._isAnchored&&(null!=v._renderArea&&v._renderArea.attr("transform", "translate("+x+", "+y+") scale("+z+", "+A+")"),null!=v._canvas&&v._canvas.style("transform","translate("+x+"px, "+y+"px) scale("+z+", "+A+")"))};v.addClass("xy-plot");v._adjustYDomainOnChangeFromXCallback=function(){return v._adjustYDomainOnChangeFromX()};v._adjustXDomainOnChangeFromYCallback=function(){return v._adjustXDomainOnChangeFromY()};v._renderCallback=function(){if(v.deferredRendering()){var x=v.x()&&v.x().scale,y=v.y()&&v.y().scale;v._deferredRenderer.updateDomains(x,y)}else v.render()}; v._deferredRenderer=new m.DeferredRenderer(function(){return v.render()},v._applyDeferredRenderingTransform);return v}k(t,n);t.prototype.render=function(){this.deferredRendering()&&this._deferredRenderer.resetTransforms();return n.prototype.render.call(this)};t.prototype.deferredRendering=function(){return this._deferredRendering};t.prototype.x=function(v,x,y){if(null==v)return this._propertyBindings.get(t._X_KEY);this._bindProperty(t._X_KEY,v,x,y);v=this.width();null!=x&&null!=v&&x.range([0,v]); this._autoAdjustYScaleDomain&&this._updateYExtentsAndAutodomain();this.render();return this};t.prototype.y=function(v,x,y){if(null==v)return this._propertyBindings.get(t._Y_KEY);this._bindProperty(t._Y_KEY,v,x,y);v=this.height();null!=x&&null!=v&&(x instanceof q.Category?x.range([0,v]):x.range([v,0]));this._autoAdjustXScaleDomain&&this._updateXExtentsAndAutodomain();this.render();return this};t.prototype._filterForProperty=function(v){return"x"===v&&this._autoAdjustXScaleDomain?this._makeFilterByProperty("y"): "y"===v&&this._autoAdjustYScaleDomain?this._makeFilterByProperty("x"):null};t.prototype._makeFilterByProperty=function(v){v=this._propertyBindings.get(v);if(null!=v){var x=v.accessor,y=v.scale;if(null!=y)return function(z,A,D){var H=y.range();return l.Math.inRange(y.scale(x(z,A,D)),H[0],H[1])}}return null};t.prototype._uninstallScaleForKey=function(v,x){n.prototype._uninstallScaleForKey.call(this,v,x);v.offUpdate(x===t._X_KEY?this._adjustYDomainOnChangeFromXCallback:this._adjustXDomainOnChangeFromYCallback)}; t.prototype._installScaleForKey=function(v,x){n.prototype._installScaleForKey.call(this,v,x);v.onUpdate(x===t._X_KEY?this._adjustYDomainOnChangeFromXCallback:this._adjustXDomainOnChangeFromYCallback)};t.prototype.destroy=function(){n.prototype.destroy.call(this);this.x().scale&&this.x().scale.offUpdate(this._adjustYDomainOnChangeFromXCallback);this.y().scale&&this.y().scale.offUpdate(this._adjustXDomainOnChangeFromYCallback);return this};t.prototype.autorangeMode=function(v){if(null==v)return this._autoAdjustXScaleDomain? "x":this._autoAdjustYScaleDomain?"y":"none";switch(v){case "x":this._autoAdjustXScaleDomain=!0;this._autoAdjustYScaleDomain=!1;this._adjustXDomainOnChangeFromY();break;case "y":this._autoAdjustXScaleDomain=!1;this._autoAdjustYScaleDomain=!0;this._adjustYDomainOnChangeFromX();break;case "none":this._autoAdjustYScaleDomain=this._autoAdjustXScaleDomain=!1;break;default:throw Error("Invalid scale name '"+v+"', must be 'x', 'y' or 'none'");}return this};t.prototype.computeLayout=function(v,x,y){n.prototype.computeLayout.call(this, v,x,y);v=(v=this.x())&&v.scale;null!=v&&v.range([0,this.width()]);v=(v=this.y())&&v.scale;null!=v&&(v instanceof q.Category?v.range([0,this.height()]):v.range([this.height(),0]));return this};t.prototype._updateXExtentsAndAutodomain=function(){var v=this.x().scale;null!=v&&v.autoDomain()};t.prototype._updateYExtentsAndAutodomain=function(){var v=this.y().scale;null!=v&&v.autoDomain()};t.prototype.showAllData=function(){this._updateXExtentsAndAutodomain();this._updateYExtentsAndAutodomain();return this}; t.prototype._adjustYDomainOnChangeFromX=function(){this._projectorsReady()&&this._autoAdjustYScaleDomain&&this._updateYExtentsAndAutodomain()};t.prototype._adjustXDomainOnChangeFromY=function(){this._projectorsReady()&&this._autoAdjustXScaleDomain&&this._updateXExtentsAndAutodomain()};t.prototype._projectorsReady=function(){var v=this.x(),x=this.y();return null!=v&&null!=v.accessor&&null!=x&&null!=x.accessor};t.prototype._pixelPoint=function(v,x,y){var z=p.Plot._scaledAccessor(this.x()),A=p.Plot._scaledAccessor(this.y()); return{x:z(v,x,y),y:A(v,x,y)}};t.prototype._getDataToDraw=function(){function v(z,A,D){var H=p.Plot._scaledAccessor(x.x())(z,A,D);z=p.Plot._scaledAccessor(x.y())(z,A,D);return l.Math.isValidNumber(H)&&l.Math.isValidNumber(z)}var x=this,y=n.prototype._getDataToDraw.call(this);this.datasets().forEach(function(z){y.set(z,y.get(z).filter(function(A,D){return v(A,D,z)}))});return y};return t}(p.Plot);c._X_KEY="x";c._Y_KEY="y";e.XYPlot=c},function(c,e,g){var k=g(0);c=function(){function q(){this._autoDomainAutomatically= !0;this._domainModificationInProgress=!1;this._updateId=0;this._callbacks=new k.CallbackSet;this._includedValuesProviders=new k.Set}q.prototype.extentOfValues=function(){return[]};q.prototype._getAllIncludedValues=function(l){var m=this;void 0===l&&(l=!1);var p=[];this._includedValuesProviders.forEach(function(n){n=n(m,l);p=p.concat(n)});return p};q.prototype._getExtent=function(){return[]};q.prototype.onUpdate=function(l){this._callbacks.add(l);return this};q.prototype.offUpdate=function(l){this._callbacks.delete(l); return this};q.prototype._dispatchUpdate=function(){this._updateId++;this._callbacks.callCallbacks(this)};q.prototype.autoDomain=function(){this._autoDomainAutomatically=!0;this._setDomain(this._getExtent())};q.prototype._autoDomainIfAutomaticMode=function(){this._autoDomainAutomatically&&this.autoDomain()};q.prototype.scale=function(){throw Error("Subclasses should override scale");};q.prototype.ticks=function(){return this.domain()};q.prototype.domain=function(l){if(null==l)return this._getDomain(); this._autoDomainAutomatically=!1;this._setDomain(l);return this};q.prototype._getDomain=function(){throw Error("Subclasses should override _getDomain");};q.prototype._setDomain=function(l){this._domainModificationInProgress||(this._domainModificationInProgress=!0,this._backingScaleDomain(l),this._dispatchUpdate(),this._domainModificationInProgress=!1)};q.prototype._backingScaleDomain=function(){throw Error("Subclasses should override _backingDomain");};q.prototype.range=function(l){if(null==l)return this._getRange(); this._setRange(l);return this};q.prototype._getRange=function(){throw Error("Subclasses should override _getRange");};q.prototype._setRange=function(){throw Error("Subclasses should override _setRange");};q.prototype.addIncludedValuesProvider=function(l){this._includedValuesProviders.add(l);this._autoDomainIfAutomaticMode();return this};q.prototype.removeIncludedValuesProvider=function(l){this._includedValuesProviders.delete(l);this._autoDomainIfAutomaticMode()};q.prototype.updateId=function(){return this._updateId}; return q}();e.Scale=c},function(c,e,g){function k(t,v,x,y){for(var z={},A=0;A<v.length;A++){var D=v[A];t.hasOwnProperty(D)&&(z[D]=t[D](x,y))}return z}function q(t){return(null!=t["stroke-opacity"]?parseFloat(t["stroke-opacity"]):1)*(null!=t.opacity?parseFloat(t.opacity):1)}function l(t){return(null!=t["fill-opacity"]?parseFloat(t["fill-opacity"]):1)*(null!=t.opacity?parseFloat(t.opacity):1)}function m(t){return null!=t["stroke-width"]?parseFloat(t["stroke-width"]):1}function p(t,v){if(v.stroke){t.lineWidth= m(v);var x=n.color(v.stroke);x.opacity*=q(v);t.strokeStyle=x.toString();t.stroke()}v.fill&&(x=n.color(v.fill),x.opacity*=l(v),t.fillStyle=x.toString(),t.fill())}var n=g(1);c=function(){function t(v,x){this._context=v;this._drawStep=x}t.prototype.getDrawStep=function(){return this._drawStep};t.prototype.draw=function(v,x){x=x[x.length-1].attrToAppliedProjector;this._context.save();this._drawStep(this._context,v,x);this._context.restore()};t.prototype.getVisualPrimitives=function(){return[]};t.prototype.getVisualPrimitiveAtIndex= function(){return null};t.prototype.remove=function(){};return t}();e.CanvasDrawer=c;e.ContextStyleAttrs="fill-opacity fill opacity stroke-opacity stroke-width stroke".split(" ");e.resolveAttributesSubsetWithStyles=function(t,v,x,y){return k(t,e.ContextStyleAttrs.concat(v),x,y)};e.resolveAttributes=k;e.getStrokeWidth=m;e.renderArea=function(t,v,x,y){t.save();t.beginPath();v.context(t);v(x);t.lineJoin="round";p(t,y);t.restore()};e.renderLine=function(t,v,x,y){t.save();t.beginPath();v.context(t);v(x); t.lineJoin="round";p(t,y);t.restore()};e.renderPathWithStyle=p},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(50));k(g(27));k(g(51));k(g(93));k(g(53));k(g(94));k(g(95));k(g(96));k(g(97));k(g(98));k(g(99));k(g(100))},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(92));k(g(91));c=g(49);e.sign=c.sign},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(134));k(g(135));k(g(136));k(g(137))},function(c, e,g){var k=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&&(n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},q=g(1),l=g(5);c=g(4);var m=g(8),p=g(0);g=g(10);e.AxisOrientation=g.makeEnum(["bottom","left","right","top"]);g=function(n){function t(v,x){var y=n.call(this)||this;y._endTickLength=5;y._innerTickLength=5;y._tickLabelPadding=10;y._margin=15;y._showEndTickLabels=!1;y._annotationsEnabled=!1;y._annotationTierCount= 1;if(null==v||null==x)throw Error("Axis requires a scale and orientation");y._scale=v;y.orientation(x);y._setDefaultAlignment();y.addClass("axis");y.isHorizontal()?y.addClass("x-axis"):y.addClass("y-axis");y.formatter(m.identity());y._rescaleCallback=function(){return y._rescale()};y._scale.onUpdate(y._rescaleCallback);y._annotatedTicks=[];y._annotationFormatter=m.identity();return y}k(t,n);t.prototype.destroy=function(){n.prototype.destroy.call(this);this._scale.offUpdate(this._rescaleCallback)}; t.prototype.tickLabelDataOnElement=function(v){if(null!=v){for(var x;null!=v&&v.classList&&void 0===x;)v.classList.contains(t.TICK_LABEL_CLASS)?x=v:v=v.parentNode;return void 0===v?void 0:q.select(v).datum()}};t.prototype._computeWidth=function(){return this._maxLabelTickLength()};t.prototype._computeHeight=function(){return this._maxLabelTickLength()};t.prototype.requestedSpace=function(){var v=0,x=0;if(this.isHorizontal()){if(x=this._computeHeight()+this._margin,this.annotationsEnabled()){var y= this._annotationMeasurer.measure().height+2*t._ANNOTATION_LABEL_PADDING;x+=y*this.annotationTierCount()}}else v=this._computeWidth()+this._margin,this.annotationsEnabled()&&(y=this._annotationMeasurer.measure().height+2*t._ANNOTATION_LABEL_PADDING,v+=y*this.annotationTierCount());return{minWidth:v,minHeight:x}};t.prototype.fixedHeight=function(){return this.isHorizontal()};t.prototype.fixedWidth=function(){return!this.isHorizontal()};t.prototype._rescale=function(){this.render()};t.prototype.computeLayout= function(v,x,y){n.prototype.computeLayout.call(this,v,x,y);this.isHorizontal()?this._scale.range([0,this.width()]):this._scale.range([this.height(),0]);return this};t.prototype._sizeFromOffer=function(v,x){var y=this.requestedSpace(v,x);return this.isHorizontal()?{width:v,height:y.minHeight}:{height:x,width:y.minWidth}};t.prototype._setup=function(){n.prototype._setup.call(this);this._tickMarkContainer=this.content().append("g").classed(t.TICK_MARK_CLASS+"-container",!0);this._tickLabelContainer= this.content().append("g").classed(t.TICK_LABEL_CLASS+"-container",!0);this._baseline=this.content().append("line").classed("baseline",!0);this._annotationContainer=this.content().append("g").classed("annotation-container",!0);this._annotationContainer.append("g").classed("annotation-line-container",!0);this._annotationContainer.append("g").classed("annotation-circle-container",!0);this._annotationContainer.append("g").classed("annotation-rect-container",!0);var v=this._annotationContainer.append("g").classed("annotation-label-container", !0);v=new l.SvgContext(v.node());this._annotationMeasurer=new l.CacheMeasurer(v);this._annotationWriter=new l.Writer(this._annotationMeasurer,v)};t.prototype._getTickValues=function(){return[]};t.prototype.renderImmediately=function(){var v=this._getTickValues(),x=this._tickMarkContainer.selectAll("."+t.TICK_MARK_CLASS).data(v),y=x.enter().append("line").classed(t.TICK_MARK_CLASS,!0).merge(x);y.attrs(this._generateTickMarkAttrHash());q.select(y.nodes()[0]).classed(t.END_TICK_MARK_CLASS,!0).attrs(this._generateTickMarkAttrHash(!0)); q.select(y.nodes()[v.length-1]).classed(t.END_TICK_MARK_CLASS,!0).attrs(this._generateTickMarkAttrHash(!0));x.exit().remove();this._baseline.attrs(this._generateBaselineAttrHash());this.annotationsEnabled()?this._drawAnnotations():this._removeAnnotations();return this};t.prototype.annotatedTicks=function(){return this._annotatedTicks};t.prototype.annotationFormatter=function(v){if(null==v)return this._annotationFormatter;this._annotationFormatter=v;this.render();return this};t.prototype.annotationsEnabled= function(){return this._annotationsEnabled};t.prototype.annotationTierCount=function(){return this._annotationTierCount};t.prototype._drawAnnotations=function(){function v(na){switch(D.orientation()){case "bottom":case "right":return z(na);case "top":case "left":return z(na)-E.get(na).height}}function x(na){return N.has(na)?"hidden":"visible"}function y(na){return D._scale.scale(na)}function z(na){switch(D.orientation()){case "bottom":case "right":return O.get(na)*J+V;case "top":case "left":return P- V-O.get(na)*J}}function A(na,ya,Pa){na=na.selectAll("."+Pa).data(F);ya=na.enter().append(ya).classed(Pa,!0).merge(na);na.exit().remove();return ya}var D=this,H=t._ANNOTATION_LABEL_PADDING,E=new p.Map,F=this._annotatedTicksToRender();F.forEach(function(na){var ya=D._annotationMeasurer.measure(D.annotationFormatter()(na));E.set(na,{width:ya.width+2*H,height:ya.height+2*H})});var J=this._annotationMeasurer.measure().height+2*H,O=this._annotationToTier(E),N=new p.Set,P=this.isHorizontal()?this.height(): this.width(),V=this._coreSize(),T=Math.min(this.annotationTierCount(),Math.floor((P-V)/J));O.forEach(function(na,ya){(-1===na||na>=T)&&N.add(ya)});switch(this.orientation()){case "bottom":case "right":var aa=0;break;case "top":aa=this.height();break;case "left":aa=this.width()}var da=this.isHorizontal();A(this._annotationContainer.select(".annotation-line-container"),"line",t.ANNOTATION_LINE_CLASS).attrs({x1:da?y:aa,x2:da?y:z,y1:da?aa:y,y2:da?z:y,visibility:x});A(this._annotationContainer.select(".annotation-circle-container"), "circle",t.ANNOTATION_CIRCLE_CLASS).attrs({cx:da?y:aa,cy:da?aa:y,r:3});A(this._annotationContainer.select(".annotation-rect-container"),"rect",t.ANNOTATION_RECT_CLASS).attrs({x:da?y:v,y:da?v:y,width:da?function(na){return E.get(na).width}:function(na){return E.get(na).height},height:da?function(na){return E.get(na).height}:function(na){return E.get(na).width},visibility:x});var va=this._annotationWriter,Da=this.annotationFormatter();aa=A(this._annotationContainer.select(".annotation-label-container"), "g",t.ANNOTATION_LABEL_CLASS);aa.selectAll(".text-container").remove();aa.attrs({transform:function(na){var ya=da?y(na):v(na);na=da?v(na):y(na);return"translate("+ya+","+na+")"},visibility:x}).each(function(na){va.write(Da(na),da?E.get(na).width:E.get(na).height,da?E.get(na).height:E.get(na).width,{xAlign:"center",yAlign:"center",textRotation:da?0:90},q.select(this).node())})};t.prototype._annotatedTicksToRender=function(){var v=this,x=this._scale.range();return p.Array.uniq(this.annotatedTicks().filter(function(y){return null== y?!1:p.Math.inRange(v._scale.scale(y),x[0],x[1])}))};t.prototype._coreSize=function(){var v=this.isHorizontal()?this.height():this.width(),x=this.isHorizontal()?this._computeHeight():this._computeWidth();return Math.min(x,v)};t.prototype._annotationTierHeight=function(){return this._annotationMeasurer.measure().height+2*t._ANNOTATION_LABEL_PADDING};t.prototype._annotationToTier=function(v){var x=this,y=[[]],z=new p.Map,A=this.isHorizontal()?this.width():this.height();this._annotatedTicksToRender().forEach(function(D){var H= x._scale.scale(D),E=v.get(D).width;if(0>H||H+E>A)z.set(D,-1);else{for(var F=function(O){return y[O].some(function(N){var P=x._scale.scale(N);N=v.get(N).width;return H+E>=P&&H<=P+N})},J=0;F(J);)J++,y.length===J&&y.push([]);y[J].push(D);z.set(D,J)}});return z};t.prototype._removeAnnotations=function(){this._annotationContainer.selectAll(".annotation-line").remove();this._annotationContainer.selectAll(".annotation-circle").remove();this._annotationContainer.selectAll(".annotation-rect").remove();this._annotationContainer.selectAll(".annotation-label").remove()}; t.prototype._generateBaselineAttrHash=function(){var v={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case "bottom":v.x2=this.width();break;case "top":v.x2=this.width();v.y1=this.height();v.y2=this.height();break;case "left":v.x1=this.width();v.x2=this.width();v.y2=this.height();break;case "right":v.y2=this.height()}return v};t.prototype._generateTickMarkAttrHash=function(v){function x(A){return y._scale.scale(A)}var y=this;void 0===v&&(v=!1);var z={x1:0,y1:0,x2:0,y2:0};this.isHorizontal()?(z.x1= x,z.x2=x):(z.y1=x,z.y2=x);v=v?this._endTickLength:this._innerTickLength;switch(this._orientation){case "bottom":z.y2=v;break;case "top":z.y1=this.height();z.y2=this.height()-v;break;case "left":z.x1=this.width();z.x2=this.width()-v;break;case "right":z.x2=v}return z};t.prototype._setDefaultAlignment=function(){switch(this._orientation){case "bottom":this.yAlignment("top");break;case "top":this.yAlignment("bottom");break;case "left":this.xAlignment("right");break;case "right":this.xAlignment("left")}}; t.prototype.isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation};t.prototype.getScale=function(){return this._scale};t.prototype.formatter=function(v){if(null==v)return this._formatter;this._formatter=v;this.redraw();return this};t.prototype.innerTickLength=function(){return this._innerTickLength};t.prototype.endTickLength=function(){return this._endTickLength};t.prototype._maxLabelTickLength=function(){return this.showEndTickLabels()?Math.max(this.innerTickLength(), this.endTickLength()):this.innerTickLength()};t.prototype.tickLabelPadding=function(v){if(null==v)return this._tickLabelPadding;if(0>v)throw Error("tick label padding must be positive");this._tickLabelPadding=v;this.redraw();return this};t.prototype.margin=function(v){if(null==v)return this._margin;if(0>v)throw Error("margin size must be positive");this._margin=v;this.redraw();return this};t.prototype.orientation=function(v){if(null==v)return this._orientation;v=v.toLowerCase();if("top"!==v&&"bottom"!== v&&"left"!==v&&"right"!==v)throw Error("unsupported orientation");this._orientation=v;this.redraw();return this};t.prototype.showEndTickLabels=function(){return this._showEndTickLabels};t.prototype._showAllTickMarks=function(){this._tickMarkContainer.selectAll("."+t.TICK_MARK_CLASS).each(function(){q.select(this).style("visibility","inherit")})};t.prototype._showAllTickLabels=function(){this._tickLabelContainer.selectAll("."+t.TICK_LABEL_CLASS).each(function(){q.select(this).style("visibility","inherit")})}; t.prototype._hideOverflowingTickLabels=function(){var v=this.element().node().getBoundingClientRect(),x=this._tickLabelContainer.selectAll("."+t.TICK_LABEL_CLASS);x.empty()||x.each(function(){p.DOM.clientRectInside(this.getBoundingClientRect(),v)||q.select(this).style("visibility","hidden")})};t.prototype._hideTickMarksWithoutLabel=function(){var v=this._tickMarkContainer.selectAll("."+t.TICK_MARK_CLASS),x=this._tickLabelContainer.selectAll("."+t.TICK_LABEL_CLASS).filter(function(){var y=q.select(this).style("visibility"); return"inherit"===y||"visible"===y}).data();v.each(function(y){-1===x.indexOf(y)&&q.select(this).style("visibility","hidden")})};t.prototype.invalidateCache=function(){n.prototype.invalidateCache.call(this);this._annotationMeasurer.reset()};return t}(c.Component);g.END_TICK_MARK_CLASS="end-tick-mark";g.TICK_MARK_CLASS="tick-mark";g.TICK_LABEL_CLASS="tick-label";g.ANNOTATION_LINE_CLASS="annotation-line";g.ANNOTATION_RECT_CLASS="annotation-rect";g.ANNOTATION_CIRCLE_CLASS="annotation-circle";g.ANNOTATION_LABEL_CLASS= "annotation-label";g._ANNOTATION_LABEL_PADDING=4;e.Axis=g},function(c,e){e.SHOW_WARNINGS=!0;e.ADD_TITLE_ELEMENTS=!0},function(c,e,g){var k=g(0);c=function(){function q(){this._eventToProcessingFunction={};this._eventTarget=document;this._eventNameToCallbackSet={};this._connected=!1}q.prototype._hasNoCallbacks=function(){for(var l=Object.keys(this._eventNameToCallbackSet),m=0;m<l.length;m++)if(0!==this._eventNameToCallbackSet[l[m]].size)return!1;return!0};q.prototype._connect=function(){var l=this; this._connected||(Object.keys(this._eventToProcessingFunction).forEach(function(m){l._eventTarget.addEventListener(m,l._eventToProcessingFunction[m])}),this._connected=!0)};q.prototype._disconnect=function(){var l=this;this._connected&&this._hasNoCallbacks()&&(Object.keys(this._eventToProcessingFunction).forEach(function(m){l._eventTarget.removeEventListener(m,l._eventToProcessingFunction[m])}),this._connected=!1)};q.prototype._addCallbackForEvent=function(l,m){null==this._eventNameToCallbackSet[l]&& (this._eventNameToCallbackSet[l]=new k.CallbackSet);this._eventNameToCallbackSet[l].add(m);this._connect()};q.prototype._removeCallbackForEvent=function(l,m){null!=this._eventNameToCallbackSet[l]&&this._eventNameToCallbackSet[l].delete(m);this._disconnect()};q.prototype._callCallbacksForEvent=function(l){for(var m=[],p=1;p<arguments.length;p++)m[p-1]=arguments[p];p=this._eventNameToCallbackSet[l];null!=p&&p.callCallbacks.apply(p,m)};return q}();e.Dispatcher=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)|| (e[l]=q[l])}k(g(87));k(g(88));k(g(40));k(g(89));k(g(90));c=g(26);e.zoomOut=c.zoomOut},function(c,e){function g(n,t,v){return v-(v-n)*t}function k(n,t,v){return(n*t-v)/(t-1)}function q(n,t,v,x){var y=1<t;v=y?x:v;if(null==v)return t;n=n.getTransformationDomain();return(y?Math.min:Math.max)(t,v/Math.abs(n[1]-n[0]))}function l(n,t,v,x,y){if(1>=t)return{centerPoint:v,zoomAmount:t};if(null==x&&null==y)return{centerPoint:v,zoomAmount:t};var z=m(n),A=p(n),D=A?Infinity:-Infinity;A=A?-Infinity:Infinity;x=null== x?D:x;y=null==y?A:y;A=n.getTransformationDomain();D=A[0];A=A[1];y=n.scaleTransformation(y);A=n.scaleTransformation(A);var H=g(A,t,v);x=n.scaleTransformation(x);n=n.scaleTransformation(D);D=g(n,t,v);return Math.abs(H-D)>Math.abs(y-x)?(t=(y-x)/(A-n),1!==t?{centerPoint:k(A,t,y),zoomAmount:t}:{centerPoint:v,zoomAmount:t}):H>y!=z?{centerPoint:k(A,t,y),zoomAmount:t}:D<x!=z?{centerPoint:k(n,t,x),zoomAmount:t}:{centerPoint:v,zoomAmount:t}}function m(n){n=n.range();return n[1]<n[0]}function p(n){n=n.getTransformationDomain(); return n[1]<n[0]}e.zoomOut=g;e.constrainedZoom=function(n,t,v,x,y,z,A){t=q(n,t,x,y);return l(n,t,v,z,A)};e.constrainZoomExtents=q;e.constrainZoomValues=l;e.constrainedTranslation=function(n,t,v,x){var y=n.getTransformationDomain(),z=y[0],A=y[1];y=m(n);0<t!==y?(v=x,null!=v&&(z=n.scaleTransformation(A),n=n.scaleTransformation(v),t=(y?Math.max:Math.min)(z+t,n)-z)):null!=v&&(z=n.scaleTransformation(z),n=n.scaleTransformation(v),t=(y?Math.min:Math.max)(z+t,n)-z);return t}},function(c,e,g){function k(J, O,N){var P=J.scale;if(P instanceof z.Category)N=P.rangeBand();else{var V=J.accessor;J=l.set(D.Array.flatten(O.map(function(T){return T.data().map(function(aa,da){return V(aa,da,T)}).filter(function(aa){return null!=aa}).map(function(aa){return aa.valueOf()})}))).values().map(function(T){return+T});J.sort(function(T,aa){return T-aa});J=J.map(function(T){return P.scale(T)});J=l.pairs(J);N=D.Math.min(J,function(T){return Math.abs(T[1]-T[0])},N*F._SINGLE_BAR_DIMENSION_RATIO);N*=F._BAR_THICKNESS_RATIO}return N} var q=this&&this.__extends||function(J,O){function N(){this.constructor=J}for(var P in O)O.hasOwnProperty(P)&&(J[P]=O[P]);J.prototype=null===O?Object.create(O):(N.prototype=O.prototype,new N)},l=g(1),m=g(5),p=g(7),n=g(8),t=g(14),v=g(6),x=g(34),y=g(20),z=g(3),A=g(11),D=g(0);c=g(10);var H=g(19),E=g(2);g=g(16);e.BarOrientation=c.makeEnum(["vertical","horizontal"]);e.LabelsPosition=c.makeEnum(["start","middle","end","outside"]);e.BarAlignment=c.makeEnum(["start","middle","end"]);var F=function(J){function O(N){void 0=== N&&(N="vertical");var P=J.call(this)||this;P._labelFormatter=n.identity();P._labelsEnabled=!1;P._labelsPosition=e.LabelsPosition.end;P._hideBarsIfAnyAreTooWide=!0;P._barAlignment="middle";P._computeBarPixelThickness=y.memoize(k);P._fixedBarPixelThickness=!0;P.addClass("bar-plot");if("vertical"!==N&&"horizontal"!==N)throw Error(N+" is not a valid orientation for Plots.Bar");P._isVertical="vertical"===N;P.animator("baseline",new p.Null);P.attr("fill",(new z.Color).range()[0]);P.attr(O._BAR_THICKNESS_KEY, function(){return P._barPixelThickness()});P._labelConfig=new D.Map;P._baselineValueProvider=function(){return[P.baselineValue()]};return P}q(O,J);O.prototype.computeLayout=function(N,P,V){J.prototype.computeLayout.call(this,N,P,V);this._updateExtents();return this};O.prototype.x=function(N,P){if(null==N)return J.prototype.x.call(this);null==P?J.prototype.x.call(this,N):J.prototype.x.call(this,N,P);this._updateThicknessAttr();this._updateLengthScale();return this};O.prototype.y=function(N,P){if(null== N)return J.prototype.y.call(this);null==P?J.prototype.y.call(this,N):J.prototype.y.call(this,N,P);this._updateLengthScale();return this};O.prototype.length=function(){return this._isVertical?this.y():this.x()};O.prototype.position=function(){return this._isVertical?this.x():this.y()};O.prototype.barEnd=function(){return this._propertyBindings.get(O._BAR_END_KEY)};O.prototype.barAlignment=function(N){if(null==N)return this._barAlignment;this._barAlignment=N;this._clearAttrToProjectorCache();this.render(); return this};O.prototype.orientation=function(){return this._isVertical?"vertical":"horizontal"};O.prototype._createDrawer=function(){return new v.ProxyDrawer(function(){return new x.RectangleSVGDrawer(O._BAR_AREA_CLASS)},function(N){return new t.RectangleCanvasDrawer(N)})};O.prototype._setup=function(){J.prototype._setup.call(this);this._baseline=this._renderArea.append("line").classed("baseline",!0)};O.prototype.baselineValue=function(){if(null!=this._baselineValue)return this._baselineValue;if(!this._projectorsReady())return 0; var N=this.length().scale;return N?N instanceof z.Time?new Date(0):0:0};O.prototype.addDataset=function(N){J.prototype.addDataset.call(this,N);return this};O.prototype._addDataset=function(N){J.prototype._addDataset.call(this,N);return this};O.prototype.removeDataset=function(N){J.prototype.removeDataset.call(this,N)};O.prototype._removeDataset=function(N){J.prototype._removeDataset.call(this,N);return this};O.prototype.datasets=function(N){if(null==N)return J.prototype.datasets.call(this);J.prototype.datasets.call(this, N);return this};O.prototype.labelsEnabled=function(N,P){if(null==N)return this._labelsEnabled;this._labelsEnabled=N;null!=P&&(this._labelsPosition=P);this._clearAttrToProjectorCache();this.render();return this};O.prototype.labelFormatter=function(N){if(null==N)return this._labelFormatter;this._labelFormatter=N;this._clearAttrToProjectorCache();this.render();return this};O.prototype._createNodesForDataset=function(N){var P=J.prototype._createNodesForDataset.call(this,N),V=this._renderArea.append("g").classed(O._LABEL_AREA_CLASS, !0),T=new m.SvgContext(V.node()),aa=new m.CacheMeasurer(T);T=new m.Writer(aa,T);this._labelConfig.set(N,{labelArea:V,measurer:aa,writer:T});return P};O.prototype._removeDatasetNodes=function(N){J.prototype._removeDatasetNodes.call(this,N);var P=this._labelConfig.get(N);null!=P&&(P.labelArea.remove(),this._labelConfig.delete(N))};O.prototype.entityNearest=function(N){var P=this;return this._computeBarPixelThickness.doLocked(function(){function V(pa,tb,ea,Xb){return P._pixelPointBar(na(pa,tb,ea),ya, Xb)}var T=P._isVertical?N.x:N.y,aa=P._isVertical?N.y:N.x,da=P.bounds(),va={min:0,max:da.bottomRight.x-da.topLeft.x},Da={min:0,max:da.bottomRight.y-da.topLeft.y},na=E.Plot._scaledAccessor(P.length()),ya=P.length().scale.scale(P.baselineValue()),Pa=Infinity,Ja=Infinity,Oa;P._getEntityStore().entities().forEach(function(pa){var tb=P._entityBounds(pa);if(D.DOM.intersectsBBox(va,Da,tb)){var ea=0,Xb=0;if(!D.DOM.intersectsBBox(N.x,N.y,tb,.5)){Xb=V(pa.datum,pa.index,pa.dataset,tb);ea=Math.abs(T-(P._isVertical? Xb.x:Xb.y));var Ba=P._isVertical?tb.y:tb.x;tb=Ba+(P._isVertical?tb.height:tb.width);Xb=aa>=Ba-.5&&aa<=tb+.5?0:Math.abs(aa-(P._isVertical?Xb.y:Xb.x))}if(ea<Pa||ea===Pa&&Xb<Ja)Oa=pa,Pa=ea,Ja=Xb}});if(void 0!==Oa)return P._lightweightPlotEntityToPlotEntity(Oa)})};O.prototype.entitiesAt=function(N){return this._entitiesIntersecting(N.x,N.y)};O.prototype._entitiesIntersecting=function(N,P){var V=this,T=[];this._getEntityStore().entities().forEach(function(aa){D.DOM.intersectsBBox(N,P,V._entityBounds(aa))&& T.push(V._lightweightPlotEntityToPlotEntity(aa))});return T};O.prototype._updateLengthScale=function(){if(this._projectorsReady()){var N=this.length().scale;N instanceof A.QuantitativeScale&&(N.addPaddingExceptionsProvider(this._baselineValueProvider),N.addIncludedValuesProvider(this._baselineValueProvider))}};O.prototype.renderImmediately=function(){var N=this;this._barPixelThickness();return this._computeBarPixelThickness.doLocked(function(){return J.prototype.renderImmediately.call(N)})};O.prototype._additionalPaint= function(N){var P=this,V=this.length().scale.scale(this.baselineValue());V={x1:this._isVertical?0:V,y1:this._isVertical?V:0,x2:this._isVertical?this.width():V,y2:this._isVertical?V:this.height()};this._getAnimator("baseline").animate(this._baseline,V);this.datasets().forEach(function(T){return P._labelConfig.get(T).labelArea.selectAll("g").remove()});this._labelsEnabled&&D.Window.setTimeout(function(){return P._drawLabels()},N)};O.prototype.getExtentsForProperty=function(N){var P=this,V=J.prototype.getExtentsForProperty.call(this, N);if("x"===N&&this._isVertical)N=this.x();else{if("y"!==N||this._isVertical)return V;N=this.y()}if(!(N&&N.scale&&N.scale instanceof A.QuantitativeScale))return V;var T=N.scale,aa=this._barPixelThickness();return V=V.map(function(da){return l.extent([T.invert(P._getPositionAttr(T.scale(da[0]),aa)),T.invert(P._getPositionAttr(T.scale(da[0]),aa)+aa),T.invert(P._getPositionAttr(T.scale(da[1]),aa)),T.invert(P._getPositionAttr(T.scale(da[1]),aa)+aa)])})};O.prototype._getPositionAttr=function(N,P){this._isVertical|| (N-=P,P*=-1);switch(this._barAlignment){case "start":return N;case "end":return N-P;default:return N-P/2}};O.prototype._drawLabels=function(){var N=this,P=this._getDataToDraw(),V=this._getAttrToProjector(),T=this.datasets().some(function(aa){return P.get(aa).some(function(da,va){return null==da?!1:N._drawLabel(da,va,aa,V)})});this._hideBarsIfAnyAreTooWide&&T&&this.datasets().forEach(function(aa){return N._labelConfig.get(aa).labelArea.selectAll("g").remove()})};O.prototype._drawLabel=function(N,P, V,T){var aa=this._labelConfig.get(V),da=aa.labelArea,va=aa.measurer;aa=aa.writer;var Da=this.length().accessor,na=Da(N,P,V);Da=this.length().scale;var ya=null!=Da?Da.scale(na):na,Pa=null!=Da?Da.scale(this.baselineValue()):this.baselineValue(),Ja={x:T.x(N,P,V),y:T.y(N,P,V)};Da={width:T.width(N,P,V),height:T.height(N,P,V)};na=this._labelFormatter(na,N,P,V);va=va.measure(na);var Oa=this._shouldShowLabelOnBar(Ja,Da,va);Ja=this._calculateLabelProperties(Ja,Da,va,Oa,this._isVertical?ya<=Pa:ya<Pa);ya=Ja.containerDimensions; Pa=Ja.labelContainerOrigin;Ja=Ja.alignment;N=T.fill(N,P,V);da=this._createLabelContainer(da,Pa,Oa,N);aa.write(na,ya.width,ya.height,{xAlign:Ja.x,yAlign:Ja.y},da.node());return this._isVertical?Da.width<va.width:Da.height<va.height};O.prototype._shouldShowLabelOnBar=function(N,P,V){if(this._labelsPosition===e.LabelsPosition.outside)return!1;N=this._isVertical?N.y:N.x;var T=this._isVertical?P.height:P.width;P=this._isVertical?this.height():this.width();V=this._isVertical?V.height:V.width;var aa=N+T; aa>P?T=P-N:0>N&&(T=aa);return V+O._LABEL_MARGIN_INSIDE_BAR<=T};O.prototype._calculateLabelProperties=function(N,P,V,T,aa){function da(tb){switch(tb){case "topLeft":Pa=va._isVertical?"top":"left";Oa+=O._LABEL_MARGIN_INSIDE_BAR;pa+=O._LABEL_MARGIN_INSIDE_BAR;break;case "center":pa+=(na+ya)/2;break;case "bottomRight":Pa=va._isVertical?"bottom":"right",Oa-=O._LABEL_MARGIN_INSIDE_BAR,pa+=Ja-O._LABEL_MARGIN_INSIDE_BAR-ya}}var va=this,Da=this._isVertical?N.y:N.x,na=this._isVertical?P.height:P.width,ya=this._isVertical? V.height:V.width,Pa="center",Ja=na,Oa=Da,pa=Da;if(T)switch(this._labelsPosition){case e.LabelsPosition.start:aa?da("bottomRight"):da("topLeft");break;case e.LabelsPosition.middle:da("center");break;case e.LabelsPosition.end:aa?da("topLeft"):da("bottomRight")}else aa?(Pa=this._isVertical?"top":"left",Ja=na+O._LABEL_MARGIN_INSIDE_BAR+ya,Oa-=O._LABEL_MARGIN_INSIDE_BAR+ya,pa-=O._LABEL_MARGIN_INSIDE_BAR+ya):(Pa=this._isVertical?"bottom":"right",Ja=na+O._LABEL_MARGIN_INSIDE_BAR+ya,pa+=na+O._LABEL_MARGIN_INSIDE_BAR); return{containerDimensions:{width:this._isVertical?P.width:Ja,height:this._isVertical?Ja:P.height},labelContainerOrigin:{x:this._isVertical?N.x:Oa,y:this._isVertical?Oa:N.y},labelOrigin:{x:this._isVertical?N.x+P.width/2-V.width/2:pa,y:this._isVertical?pa:N.y+P.height/2-V.height/2},alignment:{x:this._isVertical?"center":Pa,y:this._isVertical?Pa:"center"}}};O.prototype._createLabelContainer=function(N,P,V,T){N=N.append("g").attr("transform","translate("+P.x+", "+P.y+")");V?(N.classed("on-bar-label", !0),V=1.6*D.Color.contrast("white",T)<D.Color.contrast("black",T),N.classed(V?"dark-label":"light-label",!0)):N.classed("off-bar-label",!0);return N};O.prototype._generateDrawSteps=function(){var N=[];if(this._animateOnNextRender()){var P=this._getAttrToProjector(),V=this.length().scale.scale(this.baselineValue()),T=this._isVertical?"height":"width";P[this._isVertical?"y":"x"]=function(){return V};P[T]=function(){return 0};N.push({attrToProjector:P,animator:this._getAnimator(H.Animator.RESET)})}N.push({attrToProjector:this._getAttrToProjector(), animator:this._getAnimator(H.Animator.MAIN)});return N};O.prototype._generateAttrToProjector=function(){function N(Ja,Oa,pa){return Math.abs(T-Da(Ja,Oa,pa))}var P=this,V=J.prototype._generateAttrToProjector.call(this),T=this.length().scale.scale(this.baselineValue()),aa=this._isVertical?"y":"x",da=this._isVertical?"x":"y",va=E.Plot._scaledAccessor(this.position()),Da=E.Plot._scaledAccessor(this.length()),na=V[O._BAR_THICKNESS_KEY],ya=V.gap,Pa=null==ya?na:function(Ja,Oa,pa){return na(Ja,Oa,pa)-ya(Ja, Oa,pa)};V.width=this._isVertical?Pa:N;V.height=this._isVertical?N:Pa;V[aa]=function(Ja,Oa,pa){Ja=Da(Ja,Oa,pa);return Ja>T?T:Ja};V[da]=function(Ja,Oa,pa){return P._getPositionAttr(va(Ja,Oa,pa),na(Ja,Oa,pa))};return V};O.prototype._updateThicknessAttr=function(){var N=this,P=this.position(),V=this.barEnd();null!=P&&null!=V?(this._fixedBarPixelThickness=!1,this.attr(O._BAR_THICKNESS_KEY,function(T,aa,da){var va=P.accessor(T,aa,da);T=V.accessor(T,aa,da);va=P.scale?P.scale.scale(va):va;T=V.scale?V.scale.scale(T): T;return Math.abs(T-va)})):(this._fixedBarPixelThickness=!0,this.attr(O._BAR_THICKNESS_KEY,function(){return N._barPixelThickness()}))};O.prototype._barPixelThickness=function(){return this._fixedBarPixelThickness?this._projectorsReady()?this._computeBarPixelThickness(this.position(),this.datasets(),this._isVertical?this.width():this.height()):0:0};O.prototype.entities=function(N){void 0===N&&(N=this.datasets());return this._projectorsReady()?J.prototype.entities.call(this,N):[]};O.prototype._entityBounds= function(N){return this._pixelBounds(N.datum,N.index,N.dataset)};O.prototype._pixelBounds=function(N,P,V){var T=this._getAttrToProjector();return{x:T.x(N,P,V),y:T.y(N,P,V),width:T.width(N,P,V),height:T.height(N,P,V)}};O.prototype._pixelPoint=function(N,P,V){var T=this._pixelBounds(N,P,V);N=(this._isVertical?E.Plot._scaledAccessor(this.y()):E.Plot._scaledAccessor(this.x()))(N,P,V);P=(this._isVertical?this.y().scale:this.x().scale).scale(this.baselineValue());return this._pixelPointBar(N,P,T)};O.prototype._pixelPointBar= function(N,P,V){if(this._isVertical){var T=V.x+V.width/2;N=N<=P?V.y:V.y+V.height}else T=N>=P?V.x+V.width:V.x,N=V.y+V.height/2;return{x:T,y:N}};O.prototype._uninstallScaleForKey=function(N,P){J.prototype._uninstallScaleForKey.call(this,N,P)};O.prototype._getDataToDraw=function(){var N=this,P=new D.Map,V=this._getAttrToProjector(),T=this.width(),aa=this.height();this.datasets().forEach(function(da){var va=da.data().map(function(Da,na){return N._isDatumOnScreen(V,T,aa,Da,na,da)?Da:null});P.set(da,va)}); return P};O.prototype._isDatumOnScreen=function(N,P,V,T,aa,da){var va=N.x(T,aa,da),Da=N.y(T,aa,da),na=N.width(T,aa,da);N=N.height(T,aa,da);return D.Math.isValidNumber(va)&&D.Math.isValidNumber(Da)&&D.Math.isValidNumber(na)&&D.Math.isValidNumber(N)?D.Math.boundsIntersects(va,Da,na,N,P,V):!1};return O}(g.XYPlot);F._BAR_THICKNESS_RATIO=.95;F._SINGLE_BAR_DIMENSION_RATIO=.4;F._BAR_AREA_CLASS="bar-area";F._BAR_END_KEY="barEnd";F._BAR_THICKNESS_KEY="width";F._LABEL_AREA_CLASS="bar-label-text-area";F._LABEL_MARGIN_INSIDE_BAR= 10;e.Bar=F},function(c,e,g){var k=this&&this.__extends||function(x,y){function z(){this.constructor=x}for(var A in y)y.hasOwnProperty(A)&&(x[A]=y[A]);x.prototype=null===y?Object.create(y):(z.prototype=y.prototype,new z)},q=g(1),l=g(5),m=g(8),p=g(3),n=g(0);c=g(10);var t=g(22);e.TimeInterval=c.makeEnum("second minute hour day week month year".split(" "));e.TimeAxisOrientation=c.makeEnum(["top","bottom"]);e.TierLabelPosition=c.makeEnum(["between","center"]);g=function(x){function y(z,A){z=x.call(this, z,A)||this;z._maxTimeIntervalPrecision=null;z._tierLabelPositions=[];z.addClass("time-axis");z.tickLabelPadding(5);z.axisConfigurations(y._DEFAULT_TIME_AXIS_CONFIGURATIONS);z.annotationFormatter(m.time("%a %b %d, %Y"));return z}k(y,x);y.prototype.tierLabelPositions=function(z){if(null==z)return this._tierLabelPositions;if(!z.every(function(A){return"between"===A.toLowerCase()||"center"===A.toLowerCase()}))throw Error("Unsupported position for tier labels");this._tierLabelPositions=z;this.redraw(); return this};y.prototype.maxTimeIntervalPrecision=function(z){if(null==z)return this._maxTimeIntervalPrecision;this._maxTimeIntervalPrecision=z;this.redraw();return this};y.prototype.currentAxisConfiguration=function(){return this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex]};y.prototype.axisConfigurations=function(z){if(null!=z){this._possibleTimeAxisConfigurations=z;this._numTiers=n.Math.max(this._possibleTimeAxisConfigurations.map(function(H){return H.length}),0);this._isAnchored&& this._setupDomElements();z=this.tierLabelPositions();for(var A=[],D=0;D<this._numTiers;D++)A.push(z[D]||"between");this.tierLabelPositions(A);this.redraw()}};y.prototype._getMostPreciseConfigurationIndex=function(){var z=this,A=this._possibleTimeAxisConfigurations.length;this._possibleTimeAxisConfigurations.forEach(function(D,H){H<A&&D.every(function(E){return z._checkTimeAxisTierConfiguration(E)})&&(A=H)});A===this._possibleTimeAxisConfigurations.length&&(n.Window.warn("zoomed out too far: could not find suitable interval to display labels"), --A);return A};y.prototype.orientation=function(z){if(z&&("right"===z.toLowerCase()||"left"===z.toLowerCase()))throw Error(z+" is not a supported orientation for TimeAxis - only horizontal orientations are supported");return x.prototype.orientation.call(this,z)};y.prototype._computeHeight=function(){var z=this._measurer.measure().height;this._tierHeights=[];for(var A=0;A<this._numTiers;A++)this._tierHeights.push(z+this.tickLabelPadding()+("between"===this._tierLabelPositions[A]?0:this._maxLabelTickLength())); return q.sum(this._tierHeights)};y.prototype._getIntervalLength=function(z){var A=this._scale.domain()[0];z=p.Time.timeIntervalToD3Time(z.interval).offset(A,z.step);return z>this._scale.domain()[1]?this.width():Math.abs(this._scale.scale(z)-this._scale.scale(A))};y.prototype._maxWidthForInterval=function(z){return this._measurer.measure(z.formatter(y._LONG_DATE)).width};y.prototype._checkTimeAxisTierConfiguration=function(z){if(null!=this._maxTimeIntervalPrecision){var A=y._SORTED_TIME_INTERVAL_INDEX[this._maxTimeIntervalPrecision], D=y._SORTED_TIME_INTERVAL_INDEX[z.interval];if(null!=A&&null!=D&&D<A)return!1}A=this._maxWidthForInterval(z)+2*this.tickLabelPadding();return Math.min(this._getIntervalLength(z),this.width())>=A};y.prototype._sizeFromOffer=function(z,A){var D=x.prototype._sizeFromOffer.call(this,z,A);z=this._tierHeights.reduce(function(H,E){return H+E>D.height?H:H+E});A=this.margin()+(this.annotationsEnabled()?this.annotationTierCount()*this._annotationTierHeight():0);D.height=Math.min(D.height,z+A);return D};y.prototype._setup= function(){x.prototype._setup.call(this);this._setupDomElements()};y.prototype._setupDomElements=function(){this.content().selectAll("."+y.TIME_AXIS_TIER_CLASS).remove();this._tierLabelContainers=[];this._tierMarkContainers=[];this._tierBaselines=[];this._tickLabelContainer.remove();this._baseline.remove();for(var z=0;z<this._numTiers;++z){var A=this.content().append("g").classed(y.TIME_AXIS_TIER_CLASS,!0);this._tierLabelContainers.push(A.append("g").classed(t.Axis.TICK_LABEL_CLASS+"-container",!0)); this._tierMarkContainers.push(A.append("g").classed(t.Axis.TICK_MARK_CLASS+"-container",!0));this._tierBaselines.push(A.append("line").classed("baseline",!0))}z=new l.SvgContext(this._tierLabelContainers[0].node());this._measurer=new l.CacheMeasurer(z)};y.prototype._getTickIntervalValues=function(z){return this._scale.tickInterval(z.interval,z.step)};y.prototype._getTickValues=function(){var z=this;return this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex].reduce(function(A,D){return A.concat(z._getTickIntervalValues(D))}, [])};y.prototype._cleanTiers=function(){for(var z=0;z<this._tierLabelContainers.length;z++)this._tierLabelContainers[z].selectAll("."+t.Axis.TICK_LABEL_CLASS).remove(),this._tierMarkContainers[z].selectAll("."+t.Axis.TICK_MARK_CLASS).remove(),this._tierBaselines[z].style("visibility","hidden")};y.prototype._getTickValuesForConfiguration=function(z){z=this._scale.tickInterval(z.interval,z.step);var A=this._scale.domain(),D=z.map(function(H){return H.valueOf()});-1===D.indexOf(A[0].valueOf())&&z.unshift(A[0]); -1===D.indexOf(A[1].valueOf())&&z.push(A[1]);return z};y.prototype._renderTierLabels=function(z,A,D){var H=this,E=this._getTickValuesForConfiguration(A),F=[];"between"===this._tierLabelPositions[D]&&1===A.step?E.map(function(V,T){T+1>=E.length||F.push(new Date((E[T+1].valueOf()-E[T].valueOf())/2+E[T].valueOf()))}):F=E;z=z.selectAll("."+t.Axis.TICK_LABEL_CLASS).data(F,function(V){return String(V.valueOf())});var J=z.enter().append("g").classed(t.Axis.TICK_LABEL_CLASS,!0);J.append("text");var O="center"=== this._tierLabelPositions[D]||1===A.step?0:this.tickLabelPadding();var N="bottom"===this.orientation()?q.sum(this._tierHeights.slice(0,D+1))-this.tickLabelPadding():"center"===this._tierLabelPositions[D]?this.height()-q.sum(this._tierHeights.slice(0,D))-this.tickLabelPadding()-this._maxLabelTickLength():this.height()-q.sum(this._tierHeights.slice(0,D))-this.tickLabelPadding();J=z.merge(J);var P=J.selectAll("text");0<P.size()&&P.attr("transform","translate("+O+","+N+")");z.exit().remove();J.attr("transform", function(V){return"translate("+H._scale.scale(V)+",0)"});D="center"===this._tierLabelPositions[D]||1===A.step?"middle":"start";J.selectAll("text").text(A.formatter).style("text-anchor",D)};y.prototype._renderTickMarks=function(z,A){z=this._tierMarkContainers[A].selectAll("."+t.Axis.TICK_MARK_CLASS).data(z);var D=z.enter().append("line").classed(t.Axis.TICK_MARK_CLASS,!0).merge(z),H=this._generateTickMarkAttrHash(),E=this._tierHeights.slice(0,A).reduce(function(F,J){return F+J},0);"bottom"===this.orientation()? (H.y1=E,H.y2=E+("center"===this._tierLabelPositions[A]?this.innerTickLength():this._tierHeights[A])):(H.y1=this.height()-E,H.y2=this.height()-(E+("center"===this._tierLabelPositions[A]?this.innerTickLength():this._tierHeights[A])));D.attrs(H);"bottom"===this.orientation()?(H.y1=E,H.y2=E+("center"===this._tierLabelPositions[A]?this.endTickLength():this._tierHeights[A])):(H.y1=this.height()-E,H.y2=this.height()-(E+("center"===this._tierLabelPositions[A]?this.endTickLength():this._tierHeights[A]))); q.select(D.nodes()[0]).attrs(H);q.select(D.nodes()[D.size()-1]).attrs(H);q.select(D.nodes()[0]).classed(t.Axis.END_TICK_MARK_CLASS,!0);q.select(D.nodes()[D.size()-1]).classed(t.Axis.END_TICK_MARK_CLASS,!0);z.exit().remove()};y.prototype._renderLabellessTickMarks=function(z){z=this._tickMarkContainer.selectAll("."+t.Axis.TICK_MARK_CLASS).data(z);var A=z.enter().append("line").classed(t.Axis.TICK_MARK_CLASS,!0).merge(z),D=this._generateTickMarkAttrHash();D.y2="bottom"===this.orientation()?this.tickLabelPadding(): this.height()-this.tickLabelPadding();A.attrs(D);z.exit().remove()};y.prototype._generateLabellessTicks=function(){return 1>this._mostPreciseConfigIndex?[]:this._getTickIntervalValues(this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex-1][0])};y.prototype.renderImmediately=function(){var z=this;this._mostPreciseConfigIndex=this._getMostPreciseConfigurationIndex();var A=this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex];this._cleanTiers();A.forEach(function(J,O){return z._renderTierLabels(z._tierLabelContainers[O], J,O)});for(var D=A.map(function(J){return z._getTickValuesForConfiguration(J)}),H=0,E=0;E<Math.max(A.length,1);++E){var F=this._generateBaselineAttrHash();F.y1+="bottom"===this.orientation()?H:-H;F.y2=F.y1;this._tierBaselines[E].attrs(F).style("visibility","inherit");H+=this._tierHeights[E]}H=[];E=this._scale.domain();E=this._scale.scale(E[1])-this._scale.scale(E[0]);1.5*this._getIntervalLength(A[0])>=E&&(H=this._generateLabellessTicks());this._renderLabellessTickMarks(H);this._hideOverflowingTiers(); for(E=0;E<A.length;++E)this._renderTickMarks(D[E],E),this._hideOverlappingAndCutOffLabels(E);this.annotationsEnabled()?this._drawAnnotations():this._removeAnnotations();return this};y.prototype._hideOverflowingTiers=function(){var z=this,A=this.height(),D=0;this.content().selectAll("."+y.TIME_AXIS_TIER_CLASS).attr("visibility",function(H,E){D+=z._tierHeights[E];return D<=A?"inherit":"hidden"})};y.prototype._hideOverlappingAndCutOffLabels=function(z){function A(J){return Math.floor(H.left)<=Math.ceil(J.left)&& Math.floor(H.top)<=Math.ceil(J.top)&&Math.floor(J.right)<=Math.ceil(H.left+D.width())&&Math.floor(J.bottom)<=Math.ceil(H.top+D.height())}var D=this,H=this.element().node().getBoundingClientRect(),E=this._tierMarkContainers[z].selectAll("."+t.Axis.TICK_MARK_CLASS).filter(function(){var J=q.select(this).style("visibility");return"visible"===J||"inherit"===J}).nodes().map(function(J){return J.getBoundingClientRect()}),F;this._tierLabelContainers[z].selectAll("."+t.Axis.TICK_LABEL_CLASS).filter(function(){var J= q.select(this).style("visibility");return"visible"===J||"inherit"===J}).each(function(J,O){J=this.getBoundingClientRect();var N=q.select(this),P=E[O],V=E[O+1];O=null!=F&&n.DOM.clientRectsOverlap(J,F);P=null!=P&&n.DOM.clientRectsOverlap(J,P);V=null!=V&&n.DOM.clientRectsOverlap(J,V);!A(J)||O||P||V?N.style("visibility","hidden"):(F=J,N.style("visibility","inherit"))})};y.prototype.invalidateCache=function(){x.prototype.invalidateCache.call(this);this._measurer.reset()};return y}(t.Axis);g.TIME_AXIS_TIER_CLASS= "time-axis-tier";g._SORTED_TIME_INTERVAL_INDEX=(v={},v[e.TimeInterval.second]=0,v[e.TimeInterval.minute]=1,v[e.TimeInterval.hour]=2,v[e.TimeInterval.day]=3,v[e.TimeInterval.week]=4,v[e.TimeInterval.month]=5,v[e.TimeInterval.year]=6,v);g._DEFAULT_TIME_AXIS_CONFIGURATIONS=[[{interval:e.TimeInterval.second,step:1,formatter:m.time("%I:%M:%S %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.second,step:5,formatter:m.time("%I:%M:%S %p")},{interval:e.TimeInterval.day, step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.second,step:10,formatter:m.time("%I:%M:%S %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.second,step:15,formatter:m.time("%I:%M:%S %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.second,step:30,formatter:m.time("%I:%M:%S %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.minute,step:1, formatter:m.time("%I:%M %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.minute,step:5,formatter:m.time("%I:%M %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.minute,step:10,formatter:m.time("%I:%M %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.minute,step:15,formatter:m.time("%I:%M %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}], [{interval:e.TimeInterval.minute,step:30,formatter:m.time("%I:%M %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.hour,step:1,formatter:m.time("%I %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.hour,step:3,formatter:m.time("%I %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.hour,step:6,formatter:m.time("%I %p")},{interval:e.TimeInterval.day,step:1, formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.hour,step:12,formatter:m.time("%I %p")},{interval:e.TimeInterval.day,step:1,formatter:m.time("%B %e, %Y")}],[{interval:e.TimeInterval.day,step:1,formatter:m.time("%a %e")},{interval:e.TimeInterval.month,step:1,formatter:m.time("%B %Y")}],[{interval:e.TimeInterval.day,step:1,formatter:m.time("%e")},{interval:e.TimeInterval.month,step:1,formatter:m.time("%B %Y")}],[{interval:e.TimeInterval.month,step:1,formatter:m.time("%B")},{interval:e.TimeInterval.year, step:1,formatter:m.time("%Y")}],[{interval:e.TimeInterval.month,step:1,formatter:m.time("%b")},{interval:e.TimeInterval.year,step:1,formatter:m.time("%Y")}],[{interval:e.TimeInterval.month,step:3,formatter:m.time("%b")},{interval:e.TimeInterval.year,step:1,formatter:m.time("%Y")}],[{interval:e.TimeInterval.month,step:6,formatter:m.time("%b")},{interval:e.TimeInterval.year,step:1,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:1,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year, step:1,formatter:m.time("%y")}],[{interval:e.TimeInterval.year,step:5,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:25,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:50,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:100,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:200,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:500,formatter:m.time("%Y")}],[{interval:e.TimeInterval.year,step:1E3,formatter:m.time("%Y")}]];g._LONG_DATE=new Date(9999, 8,29,12,59,9999);e.Time=g;var v},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(12);c=function(l){function m(){var p=l.call(this)||this;p._detachCallback=function(n){return p.remove(n)};return p}k(m,l);m.prototype.anchor=function(p){var n=this;p=q.coerceExternalD3(p);l.prototype.anchor.call(this,p);this._forEach(function(t){return t.anchor(n.element())}); return this};m.prototype.render=function(){this._forEach(function(p){return p.render()});return this};m.prototype.has=function(){throw Error("has() is not implemented on ComponentContainer");};m.prototype._adoptAndAnchor=function(p){p.parent(this);p.onDetach(this._detachCallback);this._isAnchored&&p.anchor(this.element())};m.prototype.remove=function(p){this.has(p)&&(p.offDetach(this._detachCallback),this._remove(p),p.detach(),this.redraw());return this};m.prototype._remove=function(){};m.prototype._forEach= function(){throw Error("_forEach() is not implemented on ComponentContainer");};m.prototype.destroy=function(){l.prototype.destroy.call(this);this._forEach(function(p){return p.destroy()})};m.prototype.invalidateCache=function(){this._forEach(function(p){return p.invalidateCache()})};return m}(g(4).Component);e.ComponentContainer=c},function(c,e,g){function k(y){n.add(y);p.add(y);q()}function q(){t||(t=!0,x.render())}var l=g(0);c=g(10);var m=g(39),p=new l.Set,n=new l.Set,t=!1,v=!1;e.Policy=c.makeEnum(["immediate", "animationFrame","timeout"]);var x=new m.AnimationFrame;e.renderPolicy=function(){var y=Plottable.RenderController.Policy.immediate;if(null!=y)switch(y){case e.Policy.immediate:x=new m.Immediate;break;case e.Policy.animationFrame:x=new m.AnimationFrame;break;case e.Policy.timeout:x=new m.Timeout;break;default:l.Window.warn("Unrecognized renderPolicy: "+y)}};e.registerToRender=function(y){v&&l.Window.warn("Registered to render while other components are flushing: request may be ignored");p.add(y); q()};e.registerToComputeLayoutAndRender=k;e.registerToComputeLayout=function(y){k(y)};e.flush=function(){if(t){n.forEach(function(z){return z.computeLayout()});p.forEach(function(z){return z.render()});v=!0;var y=new l.Set;p.forEach(function(z){try{z.renderImmediately()}catch(A){window.setTimeout(function(){throw A;},0),y.add(z)}});n=new l.Set;p=y;v=t=!1}}},function(c,e,g){var k=g(1);e.circle=function(){return function(l){return k.symbol().type(k.symbolCircle).size(Math.PI*Math.pow(l/2,2))}};e.square= function(){return function(l){return k.symbol().type(k.symbolSquare).size(Math.pow(l,2))}};e.cross=function(){return function(l){return k.symbol().type(k.symbolCross).size(5/9*Math.pow(l,2))}};e.diamond=function(){return function(l){return k.symbol().type(k.symbolDiamond).size(Math.tan(Math.PI/6)*Math.pow(l,2)/2)}};e.triangle=function(){return function(l){return k.symbol().type(k.symbolTriangle).size(Math.sqrt(3)*Math.pow(l/2,2))}};e.star=function(){return function(l){return k.symbol().type(k.symbolStar).size(.8908130915292852* Math.pow(l/2,2))}};var q=3*(1/Math.sqrt(12)/2+1);e.wye=function(){return function(l){return k.symbol().type(k.symbolWye).size(q*Math.pow(l/2.4,2))}}},function(c,e,g){var k=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&&(n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},q=g(25),l=g(0),m=g(12),p=g(37);c=function(n){function t(){var v=n.call(this)||this;v._detectionRadius=3;v._resizable=!1;v._movable=!1;v._hasCorners= !0;v.addClass("drag-box-layer");v._dragInteraction=new q.Drag;v._setUpCallbacks();v._dragInteraction.attachTo(v);v._dragStartCallbacks=new l.CallbackSet;v._dragCallbacks=new l.CallbackSet;v._dragEndCallbacks=new l.CallbackSet;return v}k(t,n);t.prototype._setUpCallbacks=function(){function v(J,O){0===F&&J.x===O.x&&J.y===O.y&&z.boxVisible(!1);z._dragEndCallbacks.callCallbacks(z.bounds())}function x(J,O){switch(F){case 0:H.x=O.x;H.y=O.y;break;case 1:A.bottom?H.y=O.y:A.top&&(D.y=O.y);A.right?H.x=O.x: A.left&&(D.x=O.x);break;case 2:J=O.x-E.x;var N=O.y-E.y;D.x+=J;D.y+=N;H.x+=J;H.y+=N;E=O}z._setBounds({topLeft:D,bottomRight:H});z._xBoundsMode===p.PropertyMode.VALUE&&null!=z.xScale()&&z._setXExtent([z.xScale().invert(D.x),z.xScale().invert(H.x)]);z._yBoundsMode===p.PropertyMode.VALUE&&null!=z.yScale()&&z._setYExtent([z.yScale().invert(D.y),z.yScale().invert(H.y)]);z.render();z._dragCallbacks.callCallbacks(z.bounds())}function y(J){A=z._getResizingEdges(J);var O=z.bounds();O=O.topLeft.x<=J.x&&J.x<= O.bottomRight.x&&O.topLeft.y<=J.y&&J.y<=O.bottomRight.y;z.boxVisible()&&(A.top||A.bottom||A.left||A.right)?F=1:z.boxVisible()&&z.movable()&&O?F=2:(F=0,z._setBounds({topLeft:J,bottomRight:J}),z._xBoundsMode===p.PropertyMode.VALUE&&null!=z.xScale()&&z._setXExtent([z.xScale().invert(J.x),z.xScale().invert(J.x)]),z._yBoundsMode===p.PropertyMode.VALUE&&null!=z.yScale()&&z._setYExtent([z.yScale().invert(J.y),z.yScale().invert(J.y)]),z.render());z.boxVisible(!0);O=z.bounds();D={x:O.topLeft.x,y:O.topLeft.y}; H={x:O.bottomRight.x,y:O.bottomRight.y};E=J;z._dragStartCallbacks.callCallbacks(O)}var z=this,A,D,H,E,F=0;this._dragInteraction.onDragStart(y);this._dragInteraction.onDrag(x);this._dragInteraction.onDragEnd(v);this._disconnectInteraction=function(){z._dragInteraction.offDragStart(y);z._dragInteraction.offDrag(x);z._dragInteraction.offDragEnd(v);z._dragInteraction.detach()}};t.prototype._setup=function(){function v(){return x._box.append("line").styles({opacity:0,stroke:"pink","pointer-events":"visibleStroke"})} var x=this;n.prototype._setup.call(this);this._detectionEdgeT=v().classed("drag-edge-tb",!0);this._detectionEdgeB=v().classed("drag-edge-tb",!0);this._detectionEdgeL=v().classed("drag-edge-lr",!0);this._detectionEdgeR=v().classed("drag-edge-lr",!0);if(this._hasCorners){var y=function(){return x._box.append("circle").styles({opacity:0,fill:"pink","pointer-events":"visibleFill"})};this._detectionCornerTL=y().classed("drag-corner-tl",!0);this._detectionCornerTR=y().classed("drag-corner-tr",!0);this._detectionCornerBL= y().classed("drag-corner-bl",!0);this._detectionCornerBR=y().classed("drag-corner-br",!0)}};t.prototype._getResizingEdges=function(v){var x={top:!1,bottom:!1,left:!1,right:!1};if(!this.resizable())return x;var y=this.bounds(),z=y.topLeft.y,A=y.bottomRight.y,D=y.topLeft.x;y=y.bottomRight.x;var H=this._detectionRadius;D-H<=v.x&&v.x<=y+H&&(x.top=z-H<=v.y&&v.y<=z+H,x.bottom=A-H<=v.y&&v.y<=A+H);z-H<=v.y&&v.y<=A+H&&(x.left=D-H<=v.x&&v.x<=D+H,x.right=y-H<=v.x&&v.x<=y+H);return x};t.prototype.renderImmediately= function(){n.prototype.renderImmediately.call(this);if(this.boxVisible()){var v=this.bounds(),x=v.topLeft.y,y=v.bottomRight.y,z=v.topLeft.x;v=v.bottomRight.x;this._detectionEdgeT.attrs({x1:z,y1:x,x2:v,y2:x,"stroke-width":2*this._detectionRadius});this._detectionEdgeB.attrs({x1:z,y1:y,x2:v,y2:y,"stroke-width":2*this._detectionRadius});this._detectionEdgeL.attrs({x1:z,y1:x,x2:z,y2:y,"stroke-width":2*this._detectionRadius});this._detectionEdgeR.attrs({x1:v,y1:x,x2:v,y2:y,"stroke-width":2*this._detectionRadius}); this._hasCorners&&(this._detectionCornerTL.attrs({cx:z,cy:x,r:this._detectionRadius}),this._detectionCornerTR.attrs({cx:v,cy:x,r:this._detectionRadius}),this._detectionCornerBL.attrs({cx:z,cy:y,r:this._detectionRadius}),this._detectionCornerBR.attrs({cx:v,cy:y,r:this._detectionRadius}))}return this};t.prototype.detectionRadius=function(){return this._detectionRadius};t.prototype.resizable=function(){return this._resizable};t.prototype._setResizableClasses=function(v){v&&this.enabled()?(this.addClass("x-resizable"), this.addClass("y-resizable")):(this.removeClass("x-resizable"),this.removeClass("y-resizable"))};t.prototype.movable=function(){return this._movable};t.prototype._setMovableClass=function(){this.movable()&&this.enabled()?this.addClass("movable"):this.removeClass("movable")};t.prototype.onDragStart=function(v){this._dragStartCallbacks.add(v)};t.prototype.offDragStart=function(v){this._dragStartCallbacks.delete(v)};t.prototype.onDrag=function(v){this._dragCallbacks.add(v)};t.prototype.offDrag=function(v){this._dragCallbacks.delete(v)}; t.prototype.onDragEnd=function(v){this._dragEndCallbacks.add(v)};t.prototype.offDragEnd=function(v){this._dragEndCallbacks.delete(v)};t.prototype.dragInteraction=function(){return this._dragInteraction};t.prototype.enabled=function(v){if(null==v)return this._dragInteraction.enabled();this._dragInteraction.enabled(v);this._setResizableClasses(this.resizable());this._setMovableClass();return this};t.prototype.destroy=function(){var v=this;n.prototype.destroy.call(this);this._dragStartCallbacks.forEach(function(x){return v._dragCallbacks.delete(x)}); this._dragCallbacks.forEach(function(x){return v._dragCallbacks.delete(x)});this._dragEndCallbacks.forEach(function(x){return v._dragEndCallbacks.delete(x)});this._disconnectInteraction()};t.prototype.detach=function(){this._resetState();this._dragInteraction.detach();n.prototype.detach.call(this);return this};t.prototype.anchor=function(v){v=m.coerceExternalD3(v);this._dragInteraction.attachTo(this);n.prototype.anchor.call(this,v);return this};t.prototype._resetState=function(){this.bounds({topLeft:{x:0, y:0},bottomRight:{x:0,y:0}})};return t}(g(43).SelectionBoxLayer);e.DragBoxLayer=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(18);c=function(m){function p(){return m.call(this,"path","line")||this}k(p,m);p.prototype._applyDefaultAttributes=function(n){n.style("fill","none")};p.prototype.getVisualPrimitiveAtIndex=function(){return m.prototype.getVisualPrimitiveAtIndex.call(this, 0)};return p}(g(9).SVGDrawer);e.LineSVGDrawer=c;var l=["opacity","stroke-opacity","stroke-width","stroke"];e.makeLineCanvasDrawStep=function(m){return function(p,n,t){t=q.resolveAttributes(t,l,n[0],0);q.renderLine(p,m(),n[0],t)}}},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(18);c=function(m){function p(n){void 0===n&&(n="");var t= m.call(this,"rect","")||this;t._rootClassName=n;t._root.classed(t._rootClassName,!0);return t}k(p,m);return p}(g(9).SVGDrawer);e.RectangleSVGDrawer=c;var l=["x","y","width","height"];e.RectangleCanvasDrawStep=function(m,p,n){m.save();p.forEach(function(t,v){null!=t&&(t=q.resolveAttributesSubsetWithStyles(n,l,t,v),m.beginPath(),m.rect(t.x,t.y,t.width,t.height),q.renderPathWithStyle(m,t))});m.restore()};c=function(m){function p(n){return m.call(this,n,e.RectangleCanvasDrawStep)||this}k(p,m);return p}(q.CanvasDrawer); e.RectangleCanvasDrawer=c},function(c,e,g){function k(m){l.SHOW_WARNINGS&&console.warn(m)}function q(m,p){for(var n=[],t=2;t<arguments.length;t++)n[t-2]=arguments[t];return 0===p?(m(n),-1):window.setTimeout(m,p,n)}var l=g(23);e.warn=k;e.setTimeout=q;e.debounce=function(m,p,n){function t(){p.apply(n,x)}var v=null,x=[];return function(){x=Array.prototype.slice.call(arguments);clearTimeout(v);v=q(t,m)}};e.deprecated=function(m,p,n){void 0===n&&(n="");k("Method "+m+" has been deprecated in version "+ p+". Please refer to the release notes. "+n)}},function(c,e){c=function(){function g(k){this.ruler=null!=k.createRuler?k.createRuler():k}g.prototype.measure=function(k){void 0===k&&(k=g.HEIGHT_TEXT);return this.ruler(k)};return g}();c.HEIGHT_TEXT="bdpql";e.AbstractMeasurer=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(32));k(g(74));k(g(75));k(g(41));k(g(42));k(g(76));k(g(77));k(g(78));k(g(79));k(g(43));k(g(80));k(g(81));k(g(82))},function(c,e,g){var k=g(0);c= function(){function q(l,m){void 0===l&&(l=[]);void 0===m&&(m={});this._updateId=0;this._data=l;this._metadata=m;this._callbacks=new k.CallbackSet}q.prototype.onUpdate=function(l){this._callbacks.add(l);return this};q.prototype.offUpdate=function(l){this._callbacks.delete(l);return this};q.prototype.data=function(l){if(null==l)return this._data;this._data=l;this._dispatchUpdate();return this};q.prototype.metadata=function(l){if(null==l)return this._metadata;this._metadata=l;this._dispatchUpdate(); return this};q.prototype.updateId=function(){return this._updateId};q.prototype._dispatchUpdate=function(){this._updateId++;this._callbacks.callCallbacks(this)};return q}();e.Dataset=c},function(c,e,g){var k=g(0),q=g(30);c=function(){function l(){}l.prototype.render=function(){q.flush()};return l}();e.Immediate=c;c=function(){function l(){}l.prototype.render=function(){k.DOM.requestAnimationFramePolyfill(q.flush)};return l}();e.AnimationFrame=c;c=function(){function l(){this._timeoutMsec=k.DOM.SCREEN_REFRESH_RATE_MILLISECONDS} l.prototype.render=function(){setTimeout(q.flush,this._timeoutMsec)};return l}();e.Timeout=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(13),l=g(0);c=function(m){function p(){var n=null!==m&&m.apply(this,arguments)||this;n._keyPressCallbacks={};n._keyReleaseCallbacks={};n._mouseMoveCallback=function(){return!1};n._downedKeys=new l.Set; n._keyDownCallback=function(t,v){return n._handleKeyDownEvent(t,v)};n._keyUpCallback=function(t){return n._handleKeyUpEvent(t)};return n}k(p,m);p.prototype._anchor=function(n){m.prototype._anchor.call(this,n);this._positionDispatcher=q.Mouse.getDispatcher(this._componentAttachedTo);this._positionDispatcher.onMouseMove(this._mouseMoveCallback);this._keyDispatcher=q.Key.getDispatcher();this._keyDispatcher.onKeyDown(this._keyDownCallback);this._keyDispatcher.onKeyUp(this._keyUpCallback)};p.prototype._unanchor= function(){m.prototype._unanchor.call(this);this._positionDispatcher.offMouseMove(this._mouseMoveCallback);this._positionDispatcher=null;this._keyDispatcher.offKeyDown(this._keyDownCallback);this._keyDispatcher.offKeyUp(this._keyUpCallback);this._keyDispatcher=null};p.prototype._handleKeyDownEvent=function(n,t){var v=this._translateToComponentSpace(this._positionDispatcher.lastMousePosition());this._isInsideComponent(v)&&!t.repeat&&(this._keyPressCallbacks[n]&&this._keyPressCallbacks[n].callCallbacks(n), this._downedKeys.add(n))};p.prototype._handleKeyUpEvent=function(n){this._downedKeys.has(n)&&this._keyReleaseCallbacks[n]&&this._keyReleaseCallbacks[n].callCallbacks(n);this._downedKeys.delete(n)};p.prototype.onKeyPress=function(n,t){this._keyPressCallbacks[n]||(this._keyPressCallbacks[n]=new l.CallbackSet);this._keyPressCallbacks[n].add(t);return this};p.prototype.offKeyPress=function(n,t){this._keyPressCallbacks[n].delete(t);0===this._keyPressCallbacks[n].size&&delete this._keyPressCallbacks[n]; return this};p.prototype.onKeyRelease=function(n,t){this._keyReleaseCallbacks[n]||(this._keyReleaseCallbacks[n]=new l.CallbackSet);this._keyReleaseCallbacks[n].add(t);return this};p.prototype.offKeyRelease=function(n,t){this._keyReleaseCallbacks[n].delete(t);0===this._keyReleaseCallbacks[n].size&&delete this._keyReleaseCallbacks[n];return this};return p}(g(15).Interaction);e.Key=c},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&& (l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(0);c=function(l){function m(p){void 0===p&&(p=[]);var n=l.call(this)||this;n._components=[];n.addClass("component-group");p.forEach(function(t){return n.append(t)});return n}k(m,l);m.prototype._forEach=function(p){this.components().forEach(p)};m.prototype.has=function(p){return 0<=this._components.indexOf(p)};m.prototype.requestedSpace=function(p,n){var t=this._components.map(function(v){return v.requestedSpace(p, n)});return{minWidth:q.Math.max(t,function(v){return v.minWidth},0),minHeight:q.Math.max(t,function(v){return v.minHeight},0)}};m.prototype.computeLayout=function(p,n,t){var v=this;l.prototype.computeLayout.call(this,p,n,t);this._forEach(function(x){x.computeLayout({x:0,y:0},v.width(),v.height())});return this};m.prototype._sizeFromOffer=function(p,n){return{width:p,height:n}};m.prototype.fixedWidth=function(){return this._components.every(function(p){return p.fixedWidth()})};m.prototype.fixedHeight= function(){return this._components.every(function(p){return p.fixedHeight()})};m.prototype.components=function(){return this._components.slice()};m.prototype.append=function(p){null==p||this.has(p)||(p.detach(),this._components.push(p),this._adoptAndAnchor(p),this.redraw());return this};m.prototype._remove=function(p){p=this._components.indexOf(p);0<=p&&this._components.splice(p,1)};return m}(g(29).ComponentContainer);e.Group=c},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor= l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)};g(0);c=g(4);var q;(function(l){l[l.VALUE=0]="VALUE";l[l.PIXEL=1]="PIXEL"})(q||(q={}));c=function(l){function m(p){var n=l.call(this)||this;n._mode=q.VALUE;if(p!==m.ORIENTATION_VERTICAL&&p!==m.ORIENTATION_HORIZONTAL)throw Error(p+" is not a valid orientation for GuideLineLayer");n._orientation=p;n._overflowHidden=!0;n.addClass("guide-line-layer");n._isVertical()?n.addClass("vertical"): n.addClass("horizontal");n._scaleUpdateCallback=function(){n._syncPixelPositionAndValue();n.render()};return n}k(m,l);m.prototype._setup=function(){l.prototype._setup.call(this);this._guideLine=this.content().append("line").classed("guide-line",!0)};m.prototype._sizeFromOffer=function(p,n){return{width:p,height:n}};m.prototype._isVertical=function(){return this._orientation===m.ORIENTATION_VERTICAL};m.prototype.fixedWidth=function(){return!0};m.prototype.fixedHeight=function(){return!0};m.prototype.computeLayout= function(p,n,t){l.prototype.computeLayout.call(this,p,n,t);null!=this.scale()&&(this._isVertical()?this.scale().range([0,this.width()]):this.scale().range([this.height(),0]));return this};m.prototype.renderImmediately=function(){l.prototype.renderImmediately.call(this);this._syncPixelPositionAndValue();this._guideLine.attrs({x1:this._isVertical()?this.pixelPosition():0,y1:this._isVertical()?0:this.pixelPosition(),x2:this._isVertical()?this.pixelPosition():this.width(),y2:this._isVertical()?this.height(): this.pixelPosition()});return this};m.prototype._syncPixelPositionAndValue=function(){null!=this.scale()&&(this._mode===q.VALUE&&null!=this.value()?this._pixelPosition=this.scale().scale(this.value()):this._mode===q.PIXEL&&null!=this.pixelPosition()&&(this._value=this.scale().invert(this.pixelPosition())))};m.prototype._setPixelPositionWithoutChangingMode=function(p){this._pixelPosition=p;null!=this.scale()&&(this._value=this.scale().invert(this.pixelPosition()));this.render()};m.prototype.scale= function(p){if(null==p)return this._scale;var n=this._scale;null!=n&&n.offUpdate(this._scaleUpdateCallback);this._scale=p;this._scale.onUpdate(this._scaleUpdateCallback);this._syncPixelPositionAndValue();this.redraw();return this};m.prototype.value=function(p){if(null==p)return this._value;this._value=p;this._mode=q.VALUE;this._syncPixelPositionAndValue();this.render();return this};m.prototype.pixelPosition=function(){return this._pixelPosition};m.prototype.destroy=function(){l.prototype.destroy.call(this); null!=this.scale()&&this.scale().offUpdate(this._scaleUpdateCallback)};return m}(c.Component);c.ORIENTATION_VERTICAL="vertical";c.ORIENTATION_HORIZONTAL="horizontal";e.GuideLineLayer=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(0);c=g(4);var l;(function(m){m[m.VALUE=0]="VALUE";m[m.PIXEL=1]="PIXEL"})(l=e.PropertyMode||(e.PropertyMode= {}));c=function(m){function p(){var n=m.call(this)||this;n._boxVisible=!1;n._boxBounds={topLeft:{x:0,y:0},bottomRight:{x:0,y:0}};n._xBoundsMode=l.PIXEL;n._yBoundsMode=l.PIXEL;n.addClass("selection-box-layer");n._adjustBoundsCallback=function(){n.render()};n._overflowHidden=!0;n._xExtent=[void 0,void 0];n._yExtent=[void 0,void 0];return n}k(p,m);p.prototype._setup=function(){m.prototype._setup.call(this);this._box=this.content().append("g").classed("selection-box",!0).remove();this._boxArea=this._box.append("rect").classed("selection-area", !0)};p.prototype._sizeFromOffer=function(n,t){return{width:n,height:t}};p.prototype.bounds=function(n){if(null==n)return this._getBounds();this._setBounds(n);this._yBoundsMode=this._xBoundsMode=l.PIXEL;this.render();return this};p.prototype._setBounds=function(n){this._boxBounds={topLeft:{x:Math.min(n.topLeft.x,n.bottomRight.x),y:Math.min(n.topLeft.y,n.bottomRight.y)},bottomRight:{x:Math.max(n.topLeft.x,n.bottomRight.x),y:Math.max(n.topLeft.y,n.bottomRight.y)}}};p.prototype._getBounds=function(){return{topLeft:{x:this._xBoundsMode=== l.PIXEL?this._boxBounds.topLeft.x:null==this._xScale?0:Math.min(this.xScale().scale(this.xExtent()[0]),this.xScale().scale(this.xExtent()[1])),y:this._yBoundsMode===l.PIXEL?this._boxBounds.topLeft.y:null==this._yScale?0:Math.min(this.yScale().scale(this.yExtent()[0]),this.yScale().scale(this.yExtent()[1]))},bottomRight:{x:this._xBoundsMode===l.PIXEL?this._boxBounds.bottomRight.x:null==this._xScale?0:Math.max(this.xScale().scale(this.xExtent()[0]),this.xScale().scale(this.xExtent()[1])),y:this._yBoundsMode=== l.PIXEL?this._boxBounds.bottomRight.y:null==this._yScale?0:Math.max(this.yScale().scale(this.yExtent()[0]),this.yScale().scale(this.yExtent()[1]))}}};p.prototype.renderImmediately=function(){m.prototype.renderImmediately.call(this);if(this._boxVisible){var n=this.bounds(),t=n.topLeft.y,v=n.bottomRight.y,x=n.topLeft.x;n=n.bottomRight.x;if(!(q.Math.isValidNumber(t)&&q.Math.isValidNumber(v)&&q.Math.isValidNumber(x)&&q.Math.isValidNumber(n)))throw Error("bounds have not been properly set");this._boxArea.attrs({x, y:t,width:n-x,height:v-t});this.content().node().appendChild(this._box.node())}else this._box.remove();return this};p.prototype.boxVisible=function(n){if(null==n)return this._boxVisible;this._boxVisible=n;this.render();return this};p.prototype.fixedWidth=function(){return!0};p.prototype.fixedHeight=function(){return!0};p.prototype.xScale=function(n){if(null==n)return this._xScale;null!=this._xScale&&this._xScale.offUpdate(this._adjustBoundsCallback);this._xScale=n;this._xBoundsMode=l.VALUE;this._xScale.onUpdate(this._adjustBoundsCallback); this.render();return this};p.prototype.yScale=function(n){if(null==n)return this._yScale;null!=this._yScale&&this._yScale.offUpdate(this._adjustBoundsCallback);this._yScale=n;this._yBoundsMode=l.VALUE;this._yScale.onUpdate(this._adjustBoundsCallback);this.render();return this};p.prototype.xExtent=function(){return this._getXExtent()};p.prototype._getXExtent=function(){return this._xBoundsMode===l.VALUE?this._xExtent:null==this._xScale?[void 0,void 0]:[this._xScale.invert(this._boxBounds.topLeft.x), this._xScale.invert(this._boxBounds.bottomRight.x)]};p.prototype._setXExtent=function(n){this._xExtent=n};p.prototype.yExtent=function(){return this._getYExtent()};p.prototype._getYExtent=function(){return this._yBoundsMode===l.VALUE?this._yExtent:null==this._yScale?[void 0,void 0]:[this._yScale.invert(this._boxBounds.topLeft.y),this._yScale.invert(this._boxBounds.bottomRight.y)]};p.prototype._setYExtent=function(n){this._yExtent=n};p.prototype.destroy=function(){m.prototype.destroy.call(this);null!= this._xScale&&this.xScale().offUpdate(this._adjustBoundsCallback);null!=this._yScale&&this.yScale().offUpdate(this._adjustBoundsCallback)};return p}(c.Component);e.SelectionBoxLayer=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){return q.call(this,"path","arc fill")||this}k(l,q);l.prototype._applyDefaultAttributes= function(m){m.style("stroke","none")};return l}(g(9).SVGDrawer);e.ArcSVGDrawer=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){return q.call(this,"path","arc outline")||this}k(l,q);l.prototype._applyDefaultAttributes=function(m){m.style("fill","none")};return l}(g(9).SVGDrawer);e.ArcOutlineSVGDrawer=c},function(c, e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(18);c=function(m){function p(){return m.call(this,"path","area")||this}k(p,m);p.prototype._applyDefaultAttributes=function(n){n.style("stroke","none")};p.prototype.getVisualPrimitiveAtIndex=function(){return m.prototype.getVisualPrimitiveAtIndex.call(this,0)};return p}(g(9).SVGDrawer);e.AreaSVGDrawer= c;var l=["fill","opacity","fill-opacity"];e.makeAreaCanvasDrawStep=function(m){return function(p,n,t){t=q.resolveAttributes(t,l,n[0],0);q.renderArea(p,m(),n[0],t)}}},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){return q.call(this,"line","")||this}k(l,q);return l}(g(9).SVGDrawer);e.SegmentSVGDrawer=c},function(c, e,g){function k(n,t,v,x,y){return 0<=v+y&&v-y<=n&&0<=x+y&&x-y<=t}function q(n,t,v){if(null==n)return!1;for(var x=0;x<v.length;x++){var y=v[x];if(n[y]!=t[y])return!1}return!0}var l=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&&(n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},m=g(86),p=g(18);c=function(n){function t(){return n.call(this,"path","symbol")||this}l(t,n);return t}(g(9).SVGDrawer);e.SymbolSVGDrawer= c;e.makeSymbolCanvasDrawStep=function(n,t,v){var x=this;return function(y,z,A){var D=y.canvas,H=D.clientWidth;D=D.clientHeight;for(var E=new m.CanvasBuffer(0,0),F=t(),J=v(),O=null,N=null,P=null,V=0;V<z.length;V++){var T=z[V];if(null!=T){var aa=p.resolveAttributesSubsetWithStyles(A,["x","y"],T,V),da=J(T,V,n);if(k(H,D,aa.x,aa.y,da)){var va=q(O,aa,p.ContextStyleAttrs);T=F(T,V,x._dataset);va&&P==da&&N==T||(O=p.getStrokeWidth(aa),O=da+O+1,(O>E.screenWidth||O>E.screenHeight)&&E.resize(O,O,!0),E.clear(), O=E.ctx,O.beginPath(),T(da).context(O)(null),O.closePath(),p.renderPathWithStyle(O,aa),N=T,P=da,O=aa);E.blitCenter(y,aa.x,aa.y)}}}}}},function(c,e,g){function k(E){return E instanceof z?E:E instanceof Date?m(E.valueOf()):E instanceof y.Scale?q(E):E instanceof x.Dataset?l(E):v(E)?n(E):Array.isArray(E)?p(E):m(E)}function q(E){E={domain:E.domain(),range:E.range(),updateId:E.updateId(),ref:m(E)};return n(E)}function l(E){E={ref:m(E),updateId:E.updateId()};return n(E)}function m(E){return new D(E)}function p(E){return new A(E.map(function(F){return k(F)}))} function n(E){var F={},J;for(J in E)E.hasOwnProperty(J)&&(F[J]=k(E[J]));return new H(F)}var t=this&&this.__extends||function(E,F){function J(){this.constructor=E}for(var O in F)F.hasOwnProperty(O)&&(E[O]=F[O]);E.prototype=null===F?Object.create(F):(J.prototype=F.prototype,new J)},v=g(128),x=g(38),y=g(17);e.sign=k;e.signScale=q;e.signDataset=l;e.signRef=m;e.signArray=p;e.signObj=n;var z=function(){function E(){}E.prototype.isDifferent=function(F){return F instanceof this.constructor?this.isSignatureDifferent(F): !0};return E}();e.Signature=z;var A=function(E){function F(J){var O=E.call(this)||this;O.array=J;return O}t(F,E);F.prototype.isSignatureDifferent=function(J){if(J.array.length!==this.array.length)return!0;for(var O=0;O<this.array.length;O++)if(this.array[O].isDifferent(J.array[O]))return!0;return!1};return F}(z);e.ArraySignature=A;var D=function(E){function F(J){var O=E.call(this)||this;O.ref=J;return O}t(F,E);F.prototype.isSignatureDifferent=function(J){return this.ref!==J.ref};return F}(z);e.ReferenceSignature= D;var H=function(E){function F(J){var O=E.call(this)||this;O.obj=J;return O}t(F,E);F.prototype.isSignatureDifferent=function(J){var O=Object.keys(this.obj),N=Object.keys(J.obj);if(O.length!==N.length)return!0;for(N=0;N<O.length;N++){var P=O[N];if(!J.obj.hasOwnProperty(P)||this.obj[P].isDifferent(J.obj[P]))return!0}return!1};return F}(z);e.ObjectSignature=H},function(c,e,g){var k=this&&this.__extends||function(z,A){function D(){this.constructor=z}for(var H in A)A.hasOwnProperty(H)&&(z[H]=A[H]);z.prototype= null===A?Object.create(A):(D.prototype=A.prototype,new D)},q=g(1),l=g(3),m=g(0),p=g(14),n=g(46),t=g(6),v=g(33),x=g(19);c=g(53);var y=g(2);g=function(z){function A(){var D=z.call(this)||this;D.addClass("area-plot");D.y0(0);D.attr("fill-opacity",.25);D.attr("fill",(new l.Color).range()[0]);D._lineDrawers=new m.Map;return D}k(A,z);A.prototype.y=function(D,H){if(null==D)return z.prototype.y.call(this);null==H?z.prototype.y.call(this,D):z.prototype.y.call(this,D,H);null!=H&&(D=this.y0().accessor,null!= D&&this._bindProperty(A._Y0_KEY,D,H),this._updateYScale());return this};A.prototype.y0=function(D){if(null==D)return this._propertyBindings.get(A._Y0_KEY);var H=this.y();this._bindProperty(A._Y0_KEY,D,H&&H.scale);this._updateYScale();this.render();return this};A.prototype._onDatasetUpdate=function(){z.prototype._onDatasetUpdate.call(this);this._updateYScale()};A.prototype._addDataset=function(D){var H=this;this._lineDrawers.set(D,new p.ProxyDrawer(function(){return new v.LineSVGDrawer},function(E){return new p.CanvasDrawer(E, v.makeLineCanvasDrawStep(function(){var F=y.Plot._scaledAccessor(H.x()),J=y.Plot._scaledAccessor(H.y());return H._d3LineFactory(D,F,J)}))}));z.prototype._addDataset.call(this,D);return this};A.prototype._createNodesForDataset=function(D){z.prototype._createNodesForDataset.call(this,D);D=this._lineDrawers.get(D);"svg"===this.renderer()?D.useSVG(this._renderArea):D.useCanvas(this._canvas);return D};A.prototype._removeDatasetNodes=function(D){z.prototype._removeDatasetNodes.call(this,D);this._lineDrawers.get(D).remove()}; A.prototype._additionalPaint=function(){var D=this,H=this._generateLineDrawSteps(),E=this._getDataToDraw();this.datasets().forEach(function(F){var J=y.Plot.applyDrawSteps(H,F);D._lineDrawers.get(F).draw(E.get(F),J)})};A.prototype._generateLineDrawSteps=function(){var D=[];if(this._animateOnNextRender()){var H=this._generateLineAttrToProjector();H.d=this._constructLineProjector(y.Plot._scaledAccessor(this.x()),this._getResetYFunction());D.push({attrToProjector:H,animator:this._getAnimator(x.Animator.RESET)})}D.push({attrToProjector:this._generateLineAttrToProjector(), animator:this._getAnimator(x.Animator.MAIN)});return D};A.prototype._generateLineAttrToProjector=function(){var D=this._getAttrToProjector();D.d=this._constructLineProjector(y.Plot._scaledAccessor(this.x()),y.Plot._scaledAccessor(this.y()));return D};A.prototype._createDrawer=function(D){var H=this;return new t.ProxyDrawer(function(){return new n.AreaSVGDrawer},function(E){return new p.CanvasDrawer(E,n.makeAreaCanvasDrawStep(function(){var F=y.Plot._scaledAccessor(H.x()),J=y.Plot._scaledAccessor(H.y()), O=y.Plot._scaledAccessor(H.y0());return H._createAreaGenerator(F,J,O,H._createDefinedProjector(F,J),D)}))})};A.prototype._generateDrawSteps=function(){var D=[];if(this._animateOnNextRender()){var H=this._getAttrToProjector();H.d=this._constructAreaProjector(y.Plot._scaledAccessor(this.x()),this._getResetYFunction(),y.Plot._scaledAccessor(this.y0()));D.push({attrToProjector:H,animator:this._getAnimator(x.Animator.RESET)})}D.push({attrToProjector:this._getAttrToProjector(),animator:this._getAnimator(x.Animator.MAIN)}); return D};A.prototype._updateYScale=function(){var D=this.getExtentsForProperty("y0");D=m.Array.uniq(m.Array.flatten(D));var H=1===D.length?D[0]:null;D=(D=this.y())&&D.scale;null!=D&&(null!=this._constantBaselineValueProvider&&(D.removePaddingExceptionsProvider(this._constantBaselineValueProvider),this._constantBaselineValueProvider=null),null!=H&&(this._constantBaselineValueProvider=function(){return[H]},D.addPaddingExceptionsProvider(this._constantBaselineValueProvider)))};A.prototype._getResetYFunction= function(){return y.Plot._scaledAccessor(this.y0())};A.prototype._propertyProjectors=function(){var D=z.prototype._propertyProjectors.call(this);D.d=this._constructAreaProjector(y.Plot._scaledAccessor(this.x()),y.Plot._scaledAccessor(this.y()),y.Plot._scaledAccessor(this.y0()));return D};A.prototype.selections=function(D){var H=this;void 0===D&&(D=this.datasets());if("canvas"===this.renderer())return q.selectAll();var E=z.prototype.selections.call(this,D).nodes();D.map(function(F){return H._lineDrawers.get(F)}).filter(function(F){return null!= F}).forEach(function(F){return E.push.apply(E,F.getVisualPrimitives())});return q.selectAll(E)};A.prototype._constructAreaProjector=function(D,H,E){var F=this,J=this._createDefinedProjector(y.Plot._scaledAccessor(this.x()),y.Plot._scaledAccessor(this.y()));return function(O,N,P){return F._createAreaGenerator(D,H,E,J,P)(O)}};A.prototype._createDefinedProjector=function(D,H){return function(E,F,J){var O=D(E,F,J);E=H(E,F,J);return m.Math.isValidNumber(O)&&m.Math.isValidNumber(E)}};A.prototype._createAreaGenerator= function(D,H,E,F,J){var O=this._getCurveFactory();return q.area().x(function(N,P){return D(N,P,J)}).y1(function(N,P){return H(N,P,J)}).y0(function(N,P){return E(N,P,J)}).curve(O).defined(function(N,P){return F(N,P,J)})};return A}(c.Line);g._Y0_KEY="y0";e.Area=g},function(c,e){(function(g){g.MAIN="main";g.RESET="reset"})(e.Animator||(e.Animator={}))},function(c,e){var g=function(){function k(){var q=this;this.translate=this.scale=0;this.cachedDomain=[null,null];this.lastSeenDomain=[null,null];this.updateDomain= function(l){q.lastSeenDomain=l.getTransformationDomain();var m=l.scaleTransformation(q.cachedDomain[1])-l.scaleTransformation(q.cachedDomain[0]),p=l.scaleTransformation(q.lastSeenDomain[1])-l.scaleTransformation(q.lastSeenDomain[0]);q.scale=m/p||1;q.translate=l.scaleTransformation(q.cachedDomain[0])-l.scaleTransformation(q.lastSeenDomain[0])*q.scale||0}}k.prototype.reset=function(){this.scale=1;this.translate=0;this.cachedDomain=this.lastSeenDomain};k.prototype.setDomain=function(q){this.cachedDomain= q.getTransformationDomain()};return k}();c=function(){function k(q,l){var m=this;this.renderCallback=q;this.applyTransformCallback=l;this.domainTransformX=new g;this.domainTransformY=new g;this.renderDeferred=function(){m.applyTransform();clearTimeout(m.timeoutToken);m.timeoutToken=setTimeout(function(){m.renderCallback()},k.DEFERRED_RENDERING_DELAY)}}k.prototype.setDomains=function(q,l){q&&this.domainTransformX.setDomain(q);l&&this.domainTransformY.setDomain(l);this.renderDeferred()};k.prototype.updateDomains= function(q,l){q&&this.domainTransformX.updateDomain(q);l&&this.domainTransformY.updateDomain(l);this.renderDeferred()};k.prototype.resetTransforms=function(){this.domainTransformX.reset();this.domainTransformY.reset();this.applyTransform()};k.prototype.applyTransform=function(){this.applyTransformCallback(this.domainTransformX.translate,this.domainTransformY.translate,this.domainTransformX.scale,this.domainTransformY.scale)};return k}();c.DEFERRED_RENDERING_DELAY=200;e.DeferredRenderer=c},function(c, e,g){var k=this&&this.__extends||function(D,H){function E(){this.constructor=D}for(var F in H)H.hasOwnProperty(F)&&(D[F]=H[F]);D.prototype=null===H?Object.create(H):(E.prototype=H.prototype,new E)},q=g(1),l=g(7),m=g(14),p=g(6),n=g(33),t=g(3),v=g(11),x=g(0);c=g(10);var y=g(19),z=g(2);g=g(16);var A={linear:q.curveLinear,linearClosed:q.curveLinearClosed,step:q.curveStep,stepBefore:q.curveStepBefore,stepAfter:q.curveStepAfter,basis:q.curveBasis,basisOpen:q.curveBasisOpen,basisClosed:q.curveBasisClosed, bundle:q.curveBundle,cardinal:q.curveCardinal,cardinalOpen:q.curveCardinalOpen,cardinalClosed:q.curveCardinalClosed,monotone:q.curveMonotoneX};e.CurveName=c.makeEnum("linear linearClosed step stepBefore stepAfter basis basisOpen basisClosed bundle cardinal cardinalOpen cardinalClosed monotone".split(" "));g=function(D){function H(){var E=D.call(this)||this;E._curve="linear";E._autorangeSmooth=!1;E._croppedRenderingEnabled=!0;E._collapseDenseVerticalLinesEnabled=!1;E._downsamplingEnabled=!1;E.addClass("line-plot"); var F=new l.Easing;F.stepDuration(z.Plot._ANIMATION_MAX_DURATION);F.easingMode("expInOut");F.maxTotalDuration(z.Plot._ANIMATION_MAX_DURATION);E.animator(y.Animator.MAIN,F);E.attr("stroke",(new t.Color).range()[0]);E.attr("stroke-width","2px");return E}k(H,D);H.prototype.x=function(E,F,J){if(null==E)return D.prototype.x.call(this);D.prototype.x.call(this,E,F,J);this._setScaleSnapping();return this};H.prototype.y=function(E,F,J){if(null==E)return D.prototype.y.call(this);D.prototype.y.call(this,E,F, J);this._setScaleSnapping();return this};H.prototype.autorangeMode=function(E){if(null==E)return D.prototype.autorangeMode.call(this);D.prototype.autorangeMode.call(this,E);this._setScaleSnapping();return this};H.prototype.autorangeSmooth=function(){return this._autorangeSmooth};H.prototype._setScaleSnapping=function(){"x"===this.autorangeMode()&&this.x()&&this.x().scale&&this.x().scale instanceof v.QuantitativeScale&&this.x().scale.snappingDomainEnabled(!this.autorangeSmooth());"y"===this.autorangeMode()&& this.y()&&this.y().scale&&this.y().scale instanceof v.QuantitativeScale&&this.y().scale.snappingDomainEnabled(!this.autorangeSmooth())};H.prototype.curve=function(E){if(null==E)return this._curve;this._curve=E;this.render();return this};H.prototype.downsamplingEnabled=function(){return this._downsamplingEnabled};H.prototype.croppedRenderingEnabled=function(E){if(null==E)return this._croppedRenderingEnabled;this._croppedRenderingEnabled=E;this.render();return this};H.prototype.collapseDenseLinesEnabled= function(E){if(null==E)return this._collapseDenseVerticalLinesEnabled;this._collapseDenseVerticalLinesEnabled=E;this.render();return this};H.prototype._createDrawer=function(E){var F=this;return new p.ProxyDrawer(function(){return new n.LineSVGDrawer},function(J){return new m.CanvasDrawer(J,n.makeLineCanvasDrawStep(function(){return F._d3LineFactory(E)}))})};H.prototype.getExtentsForProperty=function(E){var F=D.prototype.getExtentsForProperty.call(this,E);if(!this._autorangeSmooth||this.autorangeMode()!== E||"x"!==this.autorangeMode()&&"y"!==this.autorangeMode())return F;E=this._getEdgeIntersectionPoints();var J="y"===this.autorangeMode()?E.left.concat(E.right).map(function(O){return O.y}):E.top.concat(E.bottom).map(function(O){return O.x});return F.map(function(O){return q.extent(q.merge([O,J]))})};H.prototype._getEdgeIntersectionPoints=function(){var E=this;if(!(this.y().scale instanceof v.QuantitativeScale&&this.x().scale instanceof v.QuantitativeScale))return{left:[],right:[],top:[],bottom:[]}; var F=this.y().scale,J=this.x().scale,O={left:[],right:[],top:[],bottom:[]},N=J.scale(J.domain()[0]),P=J.scale(J.domain()[1]),V=F.scale(F.domain()[0]),T=F.scale(F.domain()[1]);this.datasets().forEach(function(aa){for(var da=aa.data(),va,Da,na,ya,Pa,Ja,Oa,pa=1;pa<da.length;pa++)ya=Ja||J.scale(E.x().accessor(da[pa-1],pa-1,aa)),Pa=Oa||F.scale(E.y().accessor(da[pa-1],pa-1,aa)),Ja=J.scale(E.x().accessor(da[pa],pa,aa)),Oa=F.scale(E.y().accessor(da[pa],pa,aa)),ya<N===N<=Ja&&(va=N-ya,Da=Ja-ya,na=Oa-Pa,va= va*na/Da,O.left.push({x:N,y:F.invert(Pa+va)})),ya<P===P<=Ja&&(va=P-ya,Da=Ja-ya,na=Oa-Pa,va=va*na/Da,O.right.push({x:P,y:F.invert(Pa+va)})),Pa<T===T<=Oa&&(Da=Ja-ya,va=T-Pa,na=Oa-Pa,va=va*Da/na,O.top.push({x:J.invert(ya+va),y:T})),Pa<V===V<=Oa&&(Da=Ja-ya,va=V-Pa,na=Oa-Pa,va=va*Da/na,O.bottom.push({x:J.invert(ya+va),y:V}))});return O};H.prototype._getResetYFunction=function(){var E=this.y().scale.domain(),F=Math.max(E[0],E[1]);E=Math.min(E[0],E[1]);F=0>F&&F||0<E&&E||0;var J=this.y().scale.scale(F);return function(){return J}}; H.prototype._generateDrawSteps=function(){var E=[];if(this._animateOnNextRender()){var F=this._getAttrToProjector();F.d=this._constructLineProjector(z.Plot._scaledAccessor(this.x()),this._getResetYFunction());E.push({attrToProjector:F,animator:this._getAnimator(y.Animator.RESET)})}E.push({attrToProjector:this._getAttrToProjector(),animator:this._getAnimator(y.Animator.MAIN)});return E};H.prototype._generateAttrToProjector=function(){var E=D.prototype._generateAttrToProjector.call(this);Object.keys(E).forEach(function(F){if("d"!== F){var J=E[F];E[F]=function(O,N,P){return 0<O.length?J(O[0],N,P):null}}});return E};H.prototype.entitiesAt=function(E){E=this.entityNearestByXThenY(E);return null!=E?[E]:[]};H.prototype.entityNearestByXThenY=function(E){var F=Infinity,J=Infinity,O,N=this.bounds();this.entities().forEach(function(P){if(x.Math.within(P.position,N)){var V=Math.abs(E.x-P.position.x),T=Math.abs(E.y-P.position.y);if(V<F||V===F&&T<J)O=P,F=V,J=T}});return O};H.prototype._propertyProjectors=function(){var E=D.prototype._propertyProjectors.call(this); E.d=this._constructLineProjector(z.Plot._scaledAccessor(this.x()),z.Plot._scaledAccessor(this.y()));return E};H.prototype._constructLineProjector=function(E,F){var J=this;return function(O,N,P){return J._d3LineFactory(P,E,F)(O)}};H.prototype._d3LineFactory=function(E,F,J){function O(N,P,V){var T=F(N,P,V);N=J(N,P,V);return x.Math.isValidNumber(T)&&x.Math.isValidNumber(N)}void 0===F&&(F=z.Plot._scaledAccessor(this.x()));void 0===J&&(J=z.Plot._scaledAccessor(this.y()));return q.line().x(function(N,P){return F(N, P,E)}).y(function(N,P){return J(N,P,E)}).curve(this._getCurveFactory()).defined(function(N,P){return O(N,P,E)})};H.prototype._getCurveFactory=function(){var E=this.curve();return"string"===typeof E?(E=A[E],null==E?A.linear:E):E};H.prototype._getDataToDraw=function(){var E=this,F=new x.Map;this.datasets().forEach(function(J){var O=J.data();if(E._croppedRenderingEnabled||E._downsamplingEnabled){var N=O.map(function(P,V){return V});E._croppedRenderingEnabled&&(N=E._filterCroppedRendering(J,N));E._downsamplingEnabled&& (N=E._filterDownsampling(J,N));E._collapseDenseVerticalLinesEnabled&&(N=E._filterDenseLines(J,N));F.set(J,[N.map(function(P){return O[P]})])}else F.set(J,[O])});return F};H.prototype._filterCroppedRendering=function(E,F){function J(na,ya){return x.Math.inRange(na,0,O.width())&&x.Math.inRange(ya,0,O.height())}for(var O=this,N=z.Plot._scaledAccessor(this.x()),P=z.Plot._scaledAccessor(this.y()),V=E.data(),T=[],aa=0;aa<F.length;aa++){var da=N(V[F[aa]],F[aa],E),va=P(V[F[aa]],F[aa],E);da=J(da,va);if(!da&& null!=F[aa-1]&&null!=V[F[aa-1]]){va=N(V[F[aa-1]],F[aa-1],E);var Da=P(V[F[aa-1]],F[aa-1],E);da=da||J(va,Da)}da||null==F[aa+1]||null==V[F[aa+1]]||(va=N(V[F[aa+1]],F[aa+1],E),Da=P(V[F[aa+1]],F[aa+1],E),da=da||J(va,Da));da&&T.push(F[aa])}return T};H.prototype._filterDownsampling=function(E,F){function J(Oa,pa){var tb=N(O[F[Oa]],F[Oa],E),ea=P(O[F[Oa]],F[Oa],E),Xb=N(O[F[Oa+1]],F[Oa+1],E);Oa=P(O[F[Oa+1]],F[Oa+1],E);return Infinity===pa?Math.floor(tb)===Math.floor(Xb):Math.floor(Oa)===Math.floor(ea+(Xb-tb)* pa)}if(0===F.length)return[];for(var O=E.data(),N=z.Plot._scaledAccessor(this.x()),P=z.Plot._scaledAccessor(this.y()),V=[F[0]],T=0;T<F.length-1;){var aa=F[T],da=N(O[F[T]],F[T],E),va=P(O[F[T]],F[T],E),Da=N(O[F[T+1]],F[T+1],E),na=P(O[F[T+1]],F[T+1],E);na=Math.floor(da)===Math.floor(Da)?Infinity:(na-va)/(Da-da);Da=F[T];va=Infinity===na?va:da;da=Da;for(var ya=va,Pa=!0;T<F.length-1&&(Pa||J(T,na));){T++;Pa=!1;var Ja=Infinity===na?P(O[F[T]],F[T],E):N(O[F[T]],F[T],E);Ja>ya&&(ya=Ja,da=F[T]);Ja<va&&(va=Ja, Da=F[T])}na=F[T];Da!==aa&&V.push(Da);da!==Da&&da!==aa&&V.push(da);na!==aa&&na!==Da&&na!==da&&V.push(na)}return V};H.prototype._filterDenseLines=function(E,F){if(0===F.length)return[];var J=E.data(),O=z.Plot._scaledAccessor(this.x()),N=z.Plot._scaledAccessor(this.y());return this._bucketByX(E,F,function(P){return O(J[P],P,E)},function(P){return N(J[P],P,E)})};H.prototype._bucketByX=function(E,F,J,O){var N=[];E=E.data();for(var P=null,V=0;V<=F.length;++V){var T=F[V];if(null!=E[T]){var aa=Math.floor(J(T)), da=O(T);null==P?P=new x.Bucket(T,aa,da):P.isInBucket(aa)?P.addToBucket(da,T):(N.push.apply(N,P.getUniqueIndices()),P=new x.Bucket(T,aa,da))}}null!=P&&N.push.apply(N,P.getUniqueIndices());return N};return H}(g.XYPlot);e.Line=g},function(c,e,g){var k=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&&(n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},q=g(1),l=g(26),m=g(0),p=[0,1];c=function(n){function t(){var v=n.call(this)|| this;v._range=[0,1];v._d3Scale=q.scaleBand();v._d3Scale.range(p);v._d3TransformationScale=q.scaleLinear();v._d3TransformationScale.domain(p);v._innerPadding=t._convertToPlottableInnerPadding();v._outerPadding=t._convertToPlottableOuterPadding();return v}k(t,n);t.prototype.cloneWithoutProviders=function(){var v=(new t).domain(this.domain()).range(this.range()).innerPadding(this.innerPadding()).outerPadding(this.outerPadding());v._d3TransformationScale.domain(this._d3TransformationScale.domain());return v}; t.prototype.extentOfValues=function(v){return m.Array.uniq(v)};t.prototype._getExtent=function(){return m.Array.uniq(this._getAllIncludedValues())};t.prototype.domain=function(v){return n.prototype.domain.call(this,v)};t.prototype.invertRange=function(){var v,x=this;void 0===v&&(v=this.range());var y=this._d3Scale.bandwidth(),z=this.invertedTransformation(v[0]),A=this.invertedTransformation(v[1]);v=this._d3Scale.domain();var D=v.map(function(H){return x._d3Scale(H)+y/2});z=q.bisect(D,z);A=q.bisect(D, A);return v.slice(z,A)};t.prototype.range=function(v){return n.prototype.range.call(this,v)};t._convertToPlottableInnerPadding=function(){return 1/.7-1};t._convertToPlottableOuterPadding=function(){return.5/.7};t.prototype._setBands=function(){var v=1-1/(1+this.innerPadding()),x=this.outerPadding()/(1+this.innerPadding());this._d3Scale.paddingInner(v);this._d3Scale.paddingOuter(x)};t.prototype.rangeBand=function(){return this._rescaleBand(this._d3Scale.bandwidth())};t.prototype.stepWidth=function(){return this._rescaleBand(this._d3Scale.bandwidth()* (1+this.innerPadding()))};t.prototype.ticks=function(){return this.domain()};t.prototype.innerPadding=function(v){if(null==v)return this._innerPadding;this._innerPadding=v;this.range(this.range());this._dispatchUpdate();return this};t.prototype.outerPadding=function(v){if(null==v)return this._outerPadding;this._outerPadding=v;this.range(this.range());this._dispatchUpdate();return this};t.prototype.scale=function(v){v=this._d3Scale(v)+this._d3Scale.bandwidth()/2;return this._d3TransformationScale(v)}; t.prototype.zoom=function(v,x){var y=this;this._d3TransformationScale.domain(this._d3TransformationScale.range().map(function(z){return y._d3TransformationScale.invert(l.zoomOut(z,v,x))}));this._dispatchUpdate()};t.prototype.pan=function(v){var x=this;this._d3TransformationScale.domain(this._d3TransformationScale.range().map(function(y){return x._d3TransformationScale.invert(y+v)}));this._dispatchUpdate()};t.prototype.scaleTransformation=function(v){return this._d3TransformationScale(v)};t.prototype.invertedTransformation= function(v){return this._d3TransformationScale.invert(v)};t.prototype.getTransformationExtent=function(){return p};t.prototype.getTransformationDomain=function(){return this._d3TransformationScale.domain()};t.prototype.setTransformationDomain=function(v){this._d3TransformationScale.domain(v);this._dispatchUpdate()};t.prototype._getDomain=function(){return this._backingScaleDomain()};t.prototype._backingScaleDomain=function(v){if(null==v)return this._d3Scale.domain();this._d3Scale.domain(v);this._setBands(); return this};t.prototype._getRange=function(){return this._range};t.prototype._setRange=function(v){this._range=v;this._d3TransformationScale.range(v);this._setBands()};t.prototype._rescaleBand=function(v){return Math.abs(this._d3TransformationScale(v)-this._d3TransformationScale(0))};return t}(g(17).Scale);e.Category=c},function(c,e,g){function k(A){try{var D=A.node().getBBox()}catch(H){D={x:0,y:0,width:0,height:0}}return D}function q(A){if("number"===typeof A)return{min:A,max:A};if(A instanceof Object&&"min"in A&&"max"in A)return A;throw Error("input '"+A+"' can't be parsed as an Range");}function l(A,D){A=A.getPropertyValue(D);return parseFloat(A)||0}function m(A){if(null==A||"none"===A)return null;A=A.match(y);if(null==A||2>A.length)return null;A=A[1].split(z).map(function(D){return parseFloat(D)});return 6!=A.length?null:A}var p=g(1),n=Math;e.contains=function(A,D){for(;null!=D&&D!==A;)D=D.parentNode;return D===A};e.elementBBox=k;e.entityBounds=function(A){return A instanceof SVGElement? k(p.select(A)):A instanceof HTMLElement?(A=A.getBoundingClientRect(),{x:A.left,y:A.top,width:A.width,height:A.height}):{x:0,y:0,width:0,height:0}};e.SCREEN_REFRESH_RATE_MILLISECONDS=1E3/60;e.requestAnimationFramePolyfill=function(A){null!=window.requestAnimationFrame?window.requestAnimationFrame(A):setTimeout(A,e.SCREEN_REFRESH_RATE_MILLISECONDS)};e.elementWidth=function(A){A=A instanceof p.selection?A.node():A;A=window.getComputedStyle(A);return l(A,"width")+l(A,"padding-left")+l(A,"padding-right")+ l(A,"border-left-width")+l(A,"border-right-width")};e.elementHeight=function(A){A=A instanceof p.selection?A.node():A;A=window.getComputedStyle(A);return l(A,"height")+l(A,"padding-top")+l(A,"padding-bottom")+l(A,"border-top-width")+l(A,"border-bottom-width")};var t=/translate\s*\(\s*((?:[-+]?[0-9]*\.?[0-9]+))(?:(?:(?:\s+,?\s*)|(?:,\s*))((?:[-+]?[0-9]*\.?[0-9]+)))?\s*\)/,v=/rotate\s*\(\s*((?:[-+]?[0-9]*\.?[0-9]+))\s*\)/,x=/scale\s*\(\s*((?:[-+]?[0-9]*\.?[0-9]+))(?:(?:(?:\s+,?\s*)|(?:,\s*))((?:[-+]?[0-9]*\.?[0-9]+)))?\s*\)/; e.getTranslateValues=function(A){A=t.exec(A.attr("transform"));if(null!=A){var D=A[2];return[+A[1],+(void 0===D?0:D)]}return[0,0]};e.getRotate=function(A){A=v.exec(A.attr("transform"));return null!=A?+A[1]:0};e.getScaleValues=function(A){var D=x.exec(A.attr("transform"));return null!=D?(A=D[1],D=D[2],[+A,null==D?+A:+D]):[0,0]};e.clientRectsOverlap=function(A,D){return n.floor(A.right)<=n.ceil(D.left)||n.ceil(A.left)>=n.floor(D.right)||n.floor(A.bottom)<=n.ceil(D.top)||n.ceil(A.top)>=n.floor(D.bottom)? !1:!0};e.expandRect=function(A,D){return{left:A.left-D,top:A.top-D,right:A.right+D,bottom:A.bottom+D,width:A.width+2*D,height:A.height+2*D}};e.clientRectInside=function(A,D){return n.floor(D.left)<=n.ceil(A.left)&&n.floor(D.top)<=n.ceil(A.top)&&n.floor(A.right)<=n.ceil(D.right)&&n.floor(A.bottom)<=n.ceil(D.bottom)};e.intersectsBBox=function(A,D,H,E){void 0===E&&(E=.5);A=q(A);D=q(D);return H.x+H.width>=A.min-E&&H.x<=A.max+E&&H.y+H.height>=D.min-E&&H.y<=D.max+E};e.getHtmlElementAncestors=function(A){for(var D= [];A&&A instanceof HTMLElement;)D.push(A),A=A.parentElement;return D};e.getElementTransform=function(A){A=window.getComputedStyle(A,null);A=A.getPropertyValue("-webkit-transform")||A.getPropertyValue("-moz-transform")||A.getPropertyValue("-ms-transform")||A.getPropertyValue("-o-transform")||A.getPropertyValue("transform");return m(A)};var y=/^matrix\(([^)]+)\)$/,z=/[, ]+/},function(c,e,g){function k(v,x){return[v[0]*x[0]+v[2]*x[1],v[1]*x[0]+v[3]*x[1],v[0]*x[2]+v[2]*x[3],v[1]*x[2]+v[3]*x[3],v[0]*x[4]+ v[2]*x[5]+v[4],v[1]*x[4]+v[3]*x[5]+v[5]]}function q(v,x){return[v[0],v[1],v[2],v[3],v[0]*x[0]+v[2]*x[1]+v[4],v[1]*x[0]+v[3]*x[1]+v[5]]}function l(v){var x=v[0]*v[3]-v[1]*v[2];if(0===x)throw Error("singular matrix");x=1/x;return[x*v[3],x*-v[1],x*-v[2],x*v[0],x*(-v[3]*v[4]+v[2]*v[5]),x*(v[1]*v[4]+-v[0]*v[5])]}var m=g(1),p=g(55),n=Math,t=[1,0,0,1,0,0];e.inRange=function(v,x,y){return n.min(x,y)<=v&&v<=n.max(x,y)};e.clamp=function(v,x,y){return n.min(n.max(x,v),y)};e.max=function(v,x,y){var z="function"=== typeof x?x:null;x=null==z?x:y;v=null==z?m.max(v):m.max(v,z);return void 0!==v?v:x};e.min=function(v,x,y){var z="function"===typeof x?x:null;x=null==z?x:y;v=null==z?m.min(v):m.min(v,z);return void 0!==v?v:x};e.isNaN=function(v){return v!==v};e.isValidNumber=function(v){return"number"===typeof v&&1>v-v};e.range=function(v,x,y){void 0===y&&(y=1);if(0===y)throw Error("step cannot be 0");x=n.max(n.ceil((x-v)/y),0);for(var z=[],A=0;A<x;++A)z[A]=v+y*A;return z};e.distanceSquared=function(v,x){return n.pow(x.y- v.y,2)+n.pow(x.x-v.x,2)};e.degreesToRadians=function(v){return v/360*n.PI*2};e.within=function(v,x){return x.topLeft.x<=v.x&&x.bottomRight.x>=v.x&&x.topLeft.y<=v.y&&x.bottomRight.y>=v.y};e.boundsIntersects=function(v,x,y,z,A,D){return v<=0+A&&0<=v+y&&x<=0+D&&0<=x+z};e.getCumulativeTransform=function(v){v=p.getHtmlElementAncestors(v);for(var x=t,y=null,z=0;z<v.length;z++){var A=v[z],D=p.getElementTransform(A);if(null!=D){var H=A.clientWidth/2,E=A.clientHeight/2;x=q(x,[H,E]);x=k(x,l(D));x=q(x,[-H,-E])}D= A.scrollLeft;H=A.scrollTop;if(null===y||A===y)D-=A.offsetLeft+A.clientLeft,H-=A.offsetTop+A.clientTop,y=A.offsetParent;x=q(x,[D,H])}return x};e.multiplyMatrix=k;e.premultiplyTranslate=function(v,x){return[x[0],x[1],x[2],x[3],x[4]+v[0],x[5]+v[1]]};e.multiplyTranslate=q;e.invertMatrix=l;e.applyTransform=function(v,x){return{x:v[0]*x.x+v[2]*x.y+v[4],y:v[1]*x.x+v[3]*x.y+v[5]}}},function(c,e,g){var k=new (g(114).SplitStrategyLinear);c=function(){function m(p,n){void 0===p&&(p=5);void 0===n&&(n=k);this.maxNodeChildren= p;this.splitStrategy=n;this.root=new q(!0);this.size=0}m.prototype.getRoot=function(){return this.root};m.prototype.clear=function(){this.root=new q(!0);this.size=0};m.prototype.insert=function(p,n){for(var t=this.root;!t.leaf;)t=t.subtree(p);p=q.valueNode(p,n);t.insert(p);for(this.size+=1;t.overflow(this.maxNodeChildren);)t=t.split(this.splitStrategy),null==t.parent&&(this.root=t)};m.prototype.locate=function(p){return this.query(function(n){return n.contains(p)})};m.prototype.intersect=function(p){return this.query(function(n){return l.isBoundsOverlapBounds(n, p)})};m.prototype.intersectX=function(p){return this.query(function(n){return l.isBoundsOverlapX(n,p)})};m.prototype.intersectY=function(p){return this.query(function(n){return l.isBoundsOverlapY(n,p)})};m.prototype.query=function(p){var n=[];if(null!=this.root.bounds&&!p(this.root.bounds))return n;for(var t=[this.root];0<t.length;)for(var v=t.shift(),x=0;x<v.entries.length;x++){var y=v.entries[x];p(y.bounds)&&(v.leaf?n.push(y.value):t.push(y))}return n};return m}();e.RTree=c;var q=function(){function m(p){this.leaf= p;this.bounds=null;this.entries=[];this.value=this.parent=null}m.valueNode=function(p,n){var t=new m(!0);t.bounds=p;t.value=n;return t};m.prototype.overflow=function(p){return this.entries.length>p};m.prototype.insert=function(p){this.entries.push(p);p.parent=this;for(var n=this;null!=n;)n.bounds=l.unionAll([n.bounds,p.bounds]),n=n.parent};m.prototype.remove=function(p){p=this.entries.indexOf(p);if(0<=p)for(this.entries.splice(p,1),p=this;null!=p;)p.bounds=l.unionAll(p.entries.map(function(n){return n.bounds})), p=p.parent;return this};m.prototype.subtree=function(p){for(var n=null,t=0;t<this.entries.length;t++){var v=this.entries[t],x=v.unionAreaDifference(p);if(Infinity>x||Infinity===x&&null!=n&&v.entries.length<n.entries.length)n=v}return n};m.prototype.split=function(p){null!=this.parent&&this.parent.remove(this);var n=[new m(this.leaf),new m(this.leaf)];p.split(this.entries,n);p=null!=this.parent?this.parent:new m(!1);p.insert(n[0]);p.insert(n[1]);return p};m.prototype.unionAreaDifference=function(p){return Math.abs(l.union(this.bounds, p).area()-this.bounds.area())};m.prototype.maxDepth=function(){return this.leaf?1:1+this.entries.map(function(p){return p.maxDepth()}).reduce(function(p,n){return Math.max(p,n)})};return m}();e.RTreeNode=q;var l=function(){function m(p,n,t,v){this.xl=p;this.yl=n;this.xh=t;this.yh=v;this.width=this.xh-this.xl;this.height=this.yh-this.yl}m.xywh=function(p,n,t,v){return new m(p,n,p+t,n+v)};m.entityBounds=function(p){return new m(p.x,p.y,p.x+p.width,p.y+p.height)};m.bounds=function(p){return m.pointPair(p.topLeft, p.bottomRight)};m.pointPair=function(p,n){return new m(Math.min(p.x,n.x),Math.min(p.y,n.y),Math.max(p.x,n.x),Math.max(p.y,n.y))};m.points=function(p){if(2>p.length)throw Error("need at least 2 points to create bounds");var n=p.map(function(t){return t.x});p=p.map(function(t){return t.y});return new m(n.reduce(function(t,v){return Math.min(t,v)}),p.reduce(function(t,v){return Math.min(t,v)}),n.reduce(function(t,v){return Math.max(t,v)}),p.reduce(function(t,v){return Math.max(t,v)}))};m.union=function(p, n){return new m(Math.min(p.xl,n.xl),Math.min(p.yl,n.yl),Math.max(p.xh,n.xh),Math.max(p.yh,n.yh))};m.unionAll=function(p){p=p.filter(function(n){return null!=n});return 0===p.length?null:p.reduce(function(n,t){return m.union(n,t)})};m.isBoundsOverlapBounds=function(p,n){return m.isBoundsOverlapX(p,n)&&m.isBoundsOverlapY(p,n)};m.isBoundsOverlapX=function(p,n){return!(p.xh<n.xl)&&!(p.xl>n.xh)};m.isBoundsOverlapY=function(p,n){return!(p.yh<n.yl)&&!(p.yl>n.yh)};m.prototype.area=function(){null==this.areaCached&& (this.areaCached=(this.xh-this.xl)*(this.yh-this.yl));return this.areaCached};m.prototype.contains=function(p){return this.xl<=p.x&&this.xh>=p.x&&this.yl<=p.y&&this.yh>=p.y};return m}();e.RTreeBounds=l},function(c,e){c=function(){function g(){"function"===typeof window.Set?this._es6Set=new window.Set:this._values=[];this.size=0}g.prototype.add=function(k){if(null!=this._es6Set)return this._es6Set.add(k),this.size=this._es6Set.size,this;this.has(k)||(this._values.push(k),this.size=this._values.length); return this};g.prototype.delete=function(k){if(null!=this._es6Set)return k=this._es6Set.delete(k),this.size=this._es6Set.size,k;k=this._values.indexOf(k);return-1!==k?(this._values.splice(k,1),this.size=this._values.length,!0):!1};g.prototype.has=function(k){return null!=this._es6Set?this._es6Set.has(k):-1!==this._values.indexOf(k)};g.prototype.forEach=function(k,q){var l=this;null!=this._es6Set?this._es6Set.forEach(function(m,p){return k.call(q,m,p,l)},q):this._values.forEach(function(m){k.call(q, m,m,l)})};return g}();e.Set=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(131));k(g(130))},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(21);c=function(l){function m(p,n){var t=l.call(this,p,n)||this;t.cache=new q.Cache(function(v){return t._measureCharacterNotFromCache(v)});return t}k(m,l);m.prototype._measureCharacterNotFromCache= function(p){return l.prototype._measureCharacter.call(this,p)};m.prototype._measureCharacter=function(p){return this.cache.get(p)};m.prototype.reset=function(){this.cache.clear()};return m}(g(61).CharacterMeasurer);e.CacheCharacterMeasurer=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){return q.apply(this,arguments)|| this}k(l,q);l.prototype._measureCharacter=function(m){return q.prototype._measureLine.call(this,m)};l.prototype._measureLine=function(m){var p=this;m=m.split("").map(function(n){return p._measureCharacter(n)});return{height:m.reduce(function(n,t){return Math.max(n,t.height)},0),width:m.reduce(function(n,t){return n+t.width},0)}};return l}(g(63).Measurer);e.CharacterMeasurer=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(36));k(g(60));k(g(132));k(g(61));k(g(63))}, function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(36);c=function(l){function m(p,n){void 0===n&&(n=!1);p=l.call(this,p)||this;p.useGuards=n;return p}k(m,l);m.prototype._addGuards=function(p){return q.AbstractMeasurer.HEIGHT_TEXT+p+q.AbstractMeasurer.HEIGHT_TEXT};m.prototype._measureLine=function(p){var n;void 0===n&&(n=!1);n=this.useGuards|| n||/^[\t ]$/.test(p);p=l.prototype.measure.call(this,n?this._addGuards(p):p);p.width-=n?2*this.getGuardWidth():0;return p};m.prototype.measure=function(p){var n=this;void 0===p&&(p=q.AbstractMeasurer.HEIGHT_TEXT);if(""===p.trim())return{width:0,height:0};p=p.trim().split("\n").map(function(t){return n._measureLine(t)});return{height:p.reduce(function(t,v){return t+v.height},0),width:p.reduce(function(t,v){return Math.max(t,v.width)},0)}};m.prototype.getGuardWidth=function(){null==this.guardWidth&& (this.guardWidth=l.prototype.measure.call(this).width);return this.guardWidth};return m}(q.AbstractMeasurer);e.Measurer=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(138));k(g(65))},function(c,e,g){var k=g(21);c=function(){function q(){this.maxLines(Infinity);this.textTrimming();this.allowBreakingWords();this._tokenizer=new k.Tokenizer;this._breakingCharacter="-"}q.prototype.maxLines=function(l){if(null==l)return this._maxLines;this._maxLines=l;return this}; q.prototype.textTrimming=function(){this._textTrimming="ellipsis"};q.prototype.allowBreakingWords=function(){this._allowBreakingWords=!0};q.prototype.wrap=function(l,m,p,n){var t=this;void 0===n&&(n=Infinity);var v={noBrokeWords:0,noLines:0,originalText:l,truncatedText:"",wrappedText:""};p={availableLines:Math.min(Math.floor(n/m.measure().height),this._maxLines),availableWidth:p,canFitText:!0,currentLine:"",wrapping:v};var x=l.split("\n");return x.reduce(function(y,z,A){return t.breakLineToFitWidth(y, z,A!==x.length-1,m)},p).wrapping};q.prototype.breakLineToFitWidth=function(l,m,p,n){var t=this;l.canFitText||""===l.wrapping.truncatedText||(l.wrapping.truncatedText+="\n");l=this._tokenizer.tokenize(m).reduce(function(v,x){return t.wrapNextToken(x,v,n)},l);m=k.StringMethods.trimEnd(l.currentLine);l.wrapping.noLines+=+(""!==m);l.wrapping.noLines===l.availableLines&&"none"!==this._textTrimming&&p?l.canFitText=!1:l.wrapping.wrappedText+=m;l.currentLine="\n";return l};q.prototype.canFitToken=function(l, m,p){var n=this,t=this._allowBreakingWords?l.split("").map(function(v,x){return x!==l.length-1?v+n._breakingCharacter:v}):[l];return p.measure(l).width<=m||t.every(function(v){return p.measure(v).width<=m})};q.prototype.addEllipsis=function(l,m,p){if("none"===this._textTrimming)return{remainingToken:"",wrappedToken:l};var n=l.substring(0).trim(),t=p.measure(n).width,v=p.measure("...").width,x=0<l.length&&"\n"===l[0]?"\n":"";if(m<=v)return{remainingToken:l,wrappedToken:x+"...".substr(0,Math.floor(m/ (v/3)))};for(;t+v>m;)n=k.StringMethods.trimEnd(n.substr(0,n.length-1)),t=p.measure(n).width;return{remainingToken:k.StringMethods.trimEnd(l.substring(n.length),"-").trim(),wrappedToken:x+n+"..."}};q.prototype.wrapNextToken=function(l,m,p){if(!m.canFitText||m.availableLines===m.wrapping.noLines||!this.canFitToken(l,m.availableWidth,p))return this.finishWrapping(l,m,p);for(;l;){var n=this.breakTokenToFitInWidth(l,m.currentLine,m.availableWidth,p);m.currentLine=n.line;l=n.remainingToken;if(null!=l)if(m.wrapping.noBrokeWords+= +n.breakWord,++m.wrapping.noLines,m.availableLines===m.wrapping.noLines){p=this.addEllipsis(m.currentLine,m.availableWidth,p);m.wrapping.wrappedText+=p.wrappedToken;m.wrapping.truncatedText+=p.remainingToken+l;m.currentLine="\n";break}else m.wrapping.wrappedText+=k.StringMethods.trimEnd(m.currentLine),m.currentLine="\n"}return m};q.prototype.finishWrapping=function(l,m,p){m.canFitText&&m.availableLines!==m.wrapping.noLines&&this._allowBreakingWords&&"none"!==this._textTrimming?(p=this.addEllipsis(m.currentLine+ l,m.availableWidth,p),m.wrapping.wrappedText+=p.wrappedToken,m.wrapping.truncatedText+=p.remainingToken,m.wrapping.noBrokeWords+=+(p.remainingToken.length<l.length),m.wrapping.noLines+=+(0<p.wrappedToken.length),m.currentLine=""):m.wrapping.truncatedText+=l;m.canFitText=!1;return m};q.prototype.breakTokenToFitInWidth=function(l,m,p,n){if(void 0===t)var t=this._breakingCharacter;if(n.measure(m+l).width<=p)return{breakWord:!1,line:m+l,remainingToken:null};if(""===l.trim())return{breakWord:!1,line:m, remainingToken:""};if(!this._allowBreakingWords)return{breakWord:!1,line:m,remainingToken:l};for(var v=0;v<l.length;)if(n.measure(m+l.substring(0,v+1)+t).width<=p)++v;else break;p="";0<v&&(p=t);return{breakWord:0<v,line:m+l.substring(0,v)+p,remainingToken:l.substring(v)}};return q}();e.Wrapper=c},function(c,e,g){(function(k){for(var q in k)e.hasOwnProperty(q)||(e[q]=k[q])})(g(139))},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}k(g(72));k(g(73));k(g(28))},function(c, e){e.version="3.7.0"},function(c,e,g){function k(A,D){return A.each(function(){var H=D.apply(this,arguments),E=z.select(this),F;for(F in H)E.attr(F,H[F])})}function q(A,D){for(var H in D)A.attr(H,D[H]);return A}function l(A,D,H){return A.each(function(){var E=D.apply(this,arguments),F=z.select(this),J;for(J in E)F.style(J,E[J],H)})}function m(A,D,H){for(var E in D)A.style(E,D[E],H);return A}function p(A,D){return A.each(function(){var H=D.apply(this,arguments),E=z.select(this),F;for(F in H)E.property(F, H[F])})}function n(A,D){for(var H in D)A.property(H,D[H]);return A}function t(A,D){return A.each(function(){var H=D.apply(this,arguments),E=z.select(this).transition(A),F;for(F in H)E.attr(F,H[F])})}function v(A,D){for(var H in D)A.attr(H,D[H]);return A}function x(A,D,H){return A.each(function(){var E=D.apply(this,arguments),F=z.select(this).transition(A),J;for(J in E)F.style(J,E[J],H)})}function y(A,D,H){for(var E in D)A.style(E,D[E],H);return A}var z=c=g(1);z.selection.prototype.attrs=function(A){return("function"=== typeof A?k:q)(this,A)};z.selection.prototype.styles=function(A){return("function"===typeof A?l:m)(this,A,"")};z.selection.prototype.properties=function(A){return("function"===typeof A?p:n)(this,A)};c.transition.prototype.attrs=function(A){return("function"===typeof A?t:v)(this,A)};c.transition.prototype.styles=function(A){return("function"===typeof A?x:y)(this,A,"")}},function(c,e,g){c=g(117);var k=g(12);g=g(10);var q={linear:c.easeLinear,quad:c.easeQuad,quadIn:c.easeQuadIn,quadOut:c.easeQuadOut, quadInOut:c.easeQuadInOut,cubic:c.easeCubic,cubicIn:c.easeCubicIn,cubicOut:c.easeCubicOut,cubicInOut:c.easeCubicInOut,poly:c.easePoly,polyIn:c.easePolyIn,polyOut:c.easePolyOut,polyInOut:c.easePolyInOut,sin:c.easeSin,sinIn:c.easeSinIn,sinOut:c.easeSinOut,sinInOut:c.easeSinInOut,exp:c.easeExp,expIn:c.easeExpIn,expOut:c.easeExpOut,expInOut:c.easeExpInOut,circle:c.easeCircle,circleIn:c.easeCircleIn,circleOut:c.easeCircleOut,circleInOut:c.easeCircleInOut,bounce:c.easeBounce,bounceIn:c.easeBounceIn,bounceOut:c.easeBounceOut, bounceInOut:c.easeBounceInOut,back:c.easeBack,backIn:c.easeBackIn,backOut:c.easeBackOut,backInOut:c.easeBackInOut,elastic:c.easeElastic,elasticIn:c.easeElasticIn,elasticOut:c.easeElasticOut,elasticInOut:c.easeElasticInOut};e.EaseName=g.makeEnum("linear quad quadIn quadOut quadInOut cubic cubicIn cubicOut cubicInOut poly polyIn polyOut polyInOut sin sinIn sinOut sinInOut exp expIn expOut expInOut circle circleIn circleOut circleInOut bounce bounceIn bounceOut bounceInOut back backIn backOut backInOut elastic elasticIn elasticOut elasticInOut".split(" ")); g=function(){function l(){this._startDelay=l._DEFAULT_START_DELAY_MILLISECONDS;this._stepDuration=l._DEFAULT_STEP_DURATION_MILLISECONDS;this._stepDelay=l._DEFAULT_ITERATIVE_DELAY_MILLISECONDS;this._maxTotalDuration=l._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS;this._easingMode=l._DEFAULT_EASING_MODE}l.prototype.totalTime=function(m){var p=this._getAdjustedIterativeDelay(m);return this.startDelay()+p*Math.max(m-1,0)+this.stepDuration()};l.prototype.animate=function(m,p){var n=this;m=k.coerceExternalD3(m); var t=m.size(),v=this._getAdjustedIterativeDelay(t);return m.transition().ease(this._getEaseFactory()).duration(this.stepDuration()).delay(function(x,y){return n.startDelay()+v*y}).attrs(p)};l.prototype.startDelay=function(m){if(null==m)return this._startDelay;this._startDelay=m;return this};l.prototype.stepDuration=function(m){if(null==m)return Math.min(this._stepDuration,this._maxTotalDuration);this._stepDuration=m;return this};l.prototype.stepDelay=function(){return this._stepDelay};l.prototype.maxTotalDuration= function(m){if(null==m)return this._maxTotalDuration;this._maxTotalDuration=m;return this};l.prototype.easingMode=function(m){if(null==m)return this._easingMode;this._easingMode=m;return this};l.prototype._getEaseFactory=function(){var m=this.easingMode();return"string"===typeof m?(m=q[m],null==m?q.linear:m):m};l.prototype._getAdjustedIterativeDelay=function(m){var p=this.maxTotalDuration()-this.stepDuration();p=Math.max(p,0);m=p/Math.max(m-1,1);return Math.min(this.stepDelay(),m)};return l}();g._DEFAULT_START_DELAY_MILLISECONDS= 0;g._DEFAULT_STEP_DURATION_MILLISECONDS=300;g._DEFAULT_ITERATIVE_DELAY_MILLISECONDS=15;g._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS=Infinity;g._DEFAULT_EASING_MODE="expOut";e.Easing=g},function(c,e,g){var k=g(12);c=function(){function q(){}q.prototype.totalTime=function(){return 0};q.prototype.animate=function(l,m){l=k.coerceExternalD3(l);return l.attrs(m)};return q}();e.Null=c},function(c,e,g){var k=this&&this.__extends||function(t,v){function x(){this.constructor=t}for(var y in v)v.hasOwnProperty(y)&& (t[y]=v[y]);t.prototype=null===v?Object.create(v):(x.prototype=v.prototype,new x)},q=g(1),l=g(5),m=g(4),p=g(0),n=g(22);c=function(t){function v(x,y){void 0===y&&(y="bottom");x=t.call(this,x,y)||this;x._tickLabelAngle=0;x._tickLabelShearAngle=0;x.addClass("category-axis");return x}k(v,t);Object.defineProperty(v.prototype,"_wrapper",{get:function(){var x=new l.Wrapper;null!=this._tickLabelMaxLines&&x.maxLines(this._tickLabelMaxLines);return x},enumerable:!0,configurable:!0});Object.defineProperty(v.prototype, "_writer",{get:function(){return new l.Writer(this._measurer,this._typesetterContext,this._wrapper)},enumerable:!0,configurable:!0});v.prototype._setup=function(){t.prototype._setup.call(this);this._typesetterContext=new l.SvgContext(this._tickLabelContainer.node());this._measurer=new l.CacheMeasurer(this._typesetterContext)};v.prototype._rescale=function(){return this.redraw()};v.prototype.requestedSpace=function(x,y){var z=this.isHorizontal()?0:this._tickSpaceRequired()+this.margin(),A=this.isHorizontal()? this._tickSpaceRequired()+this.margin():0;if(0===this._scale.domain().length)return{minWidth:0,minHeight:0};if(this.annotationsEnabled()){var D=this._annotationTierHeight()*this.annotationTierCount();this.isHorizontal()?A+=D:z+=D}x=this._measureTickLabels(x,y);return{minWidth:x.usedWidth+z,minHeight:x.usedHeight+A}};v.prototype._coreSize=function(){var x=this.isHorizontal()?this.height():this.width(),y=this.isHorizontal()?this.requestedSpace(this.width(),this.height()).minHeight:this.requestedSpace(this.width(), this.height()).minWidth,z=this.margin()+this._annotationTierHeight();return Math.min(y-z,x)};v.prototype._getTickValues=function(){return this.getDownsampleInfo().domain};v.prototype._sizeFromOffer=function(x,y){return m.Component.prototype._sizeFromOffer.call(this,x,y)};v.prototype.getDownsampleInfo=function(x){var y;void 0===x&&(x=this._scale);void 0===y&&(y=x.invertRange());var z=Math.ceil(v._MINIMUM_WIDTH_PER_LABEL_PX*(0===this._tickLabelAngle?1:1/Math.cos(this._tickLabelShearAngle/180*Math.PI))/ x.stepWidth());return{domain:y.filter(function(A,D){return 0===D%z}),stepWidth:z*x.stepWidth()}};v.prototype.tickLabelAngle=function(){return this._tickLabelAngle;throw Error("Angle undefined not supported; only 0, 90, and -90 are valid values");};v.prototype.tickLabelShearAngle=function(){return this._tickLabelShearAngle};v.prototype.tickLabelMaxWidth=function(x){if(0===arguments.length)return this._tickLabelMaxWidth;this._tickLabelMaxWidth=x;this.redraw();return this};v.prototype.tickLabelMaxLines= function(x){if(0===arguments.length)return this._tickLabelMaxLines;this._tickLabelMaxLines=x;this.redraw();return this};v.prototype._tickSpaceRequired=function(){return this._maxLabelTickLength()+this.tickLabelPadding()};v.prototype._drawTicks=function(x,y){var z=this;switch(this.tickLabelAngle()){case 0:var A={left:"right",right:"left",top:"center",bottom:"center"};var D={left:"center",right:"center",top:"bottom",bottom:"top"};break;case 90:A={left:"center",right:"center",top:"right",bottom:"left"}; D={left:"top",right:"bottom",top:"center",bottom:"center"};break;case -90:A={left:"center",right:"center",top:"left",bottom:"right"},D={left:"bottom",right:"top",top:"center",bottom:"center"}}y.each(function(H){var E=q.select(this),F=z.isHorizontal()?x:z.width()-z._tickSpaceRequired(),J=z.isHorizontal()?z.height()-z._tickSpaceRequired():x,O={xAlign:A[z.orientation()],yAlign:D[z.orientation()],textRotation:z.tickLabelAngle(),textShear:z.tickLabelShearAngle()};if(null!=z._tickLabelMaxWidth){if("left"=== z.orientation()&&F>z._tickLabelMaxWidth){var N=F-z._tickLabelMaxWidth;N=E.attr("transform")+" translate("+N+", 0)";E.attr("transform",N)}F=Math.min(F,z._tickLabelMaxWidth)}z._writer.write(z.formatter()(H),F,J,O,E.node())})};v.prototype._measureTickLabels=function(x,y){var z=this,A=this._scale.cloneWithoutProviders().range([0,this.isHorizontal()?x:y]),D=this.getDownsampleInfo(A);A=D.domain;D=D.stepWidth;var H=x-this._tickSpaceRequired();this.isHorizontal()&&(H=D,0!==this._tickLabelAngle&&(H=y-this._tickSpaceRequired()), H=Math.max(H,0));var E=D;this.isHorizontal()&&(E=y-this._tickSpaceRequired(),0!==this._tickLabelAngle&&(E=x-this._tickSpaceRequired()),E=Math.max(E,0));null!=this._tickLabelMaxWidth&&(H=Math.min(H,this._tickLabelMaxWidth));y=A.map(function(F){return z._wrapper.wrap(z.formatter()(F),z._measurer,H,E)});A=this.isHorizontal()&&0===this._tickLabelAngle?p.Math.max:q.sum;x=(this.isHorizontal()&&0===this._tickLabelAngle?q.sum:p.Math.max)(y,function(F){return z._measurer.measure(F.wrappedText).width},0);y= A(y,function(F){return z._measurer.measure(F.wrappedText).height},0);0!==this._tickLabelAngle&&(y=[y,x],x=y[0],y=y[1]);return{usedWidth:x,usedHeight:y}};v.prototype.renderImmediately=function(){var x=this;t.prototype.renderImmediately.call(this);var y=this._scale,z=this.getDownsampleInfo(y),A=z.domain,D=z=z.stepWidth;this.isHorizontal()&&null!=this._tickLabelMaxWidth&&(D=Math.min(D,this._tickLabelMaxWidth));A=this._tickLabelContainer.selectAll("."+n.Axis.TICK_LABEL_CLASS).data(A);var H=A.enter().append("g").classed(n.Axis.TICK_LABEL_CLASS, !0).merge(A);A.exit().remove();H.attr("transform",function(E){E=y.scale(E)-D/2;return"translate("+(x.isHorizontal()?E:0)+","+(x.isHorizontal()?0:E)+")"});H.text("");this._drawTicks(z,H);z="right"===this.orientation()?this._tickSpaceRequired():0;A="bottom"===this.orientation()?this._tickSpaceRequired():0;this._tickLabelContainer.attr("transform","translate("+z+","+A+")");this._showAllTickMarks();this._showAllTickLabels();this._hideTickMarksWithoutLabel();return this};v.prototype.computeLayout=function(x, y,z){t.prototype.computeLayout.call(this,x,y,z);this.isHorizontal()||this._scale.range([0,this.height()]);return this};v.prototype.invalidateCache=function(){t.prototype.invalidateCache.call(this);this._measurer.reset()};return v}(n.Axis);c._MINIMUM_WIDTH_PER_LABEL_PX=15;e.Category=c},function(c,e,g){var k=this&&this.__extends||function(t,v){function x(){this.constructor=t}for(var y in v)v.hasOwnProperty(y)&&(t[y]=v[y]);t.prototype=null===v?Object.create(v):(x.prototype=v.prototype,new x)},q=g(1), l=g(5),m=g(8),p=g(0),n=g(22);c=function(t){function v(x,y){x=t.call(this,x,y)||this;x._tickLabelPositioning="center";x._usesTextWidthApproximation=!1;x.formatter(m.general());return x}k(v,t);v.prototype._setup=function(){t.prototype._setup.call(this);var x=new l.SvgContext(this._tickLabelContainer.node(),n.Axis.TICK_LABEL_CLASS);this._measurer=new l.CacheMeasurer(x);this._wrapper=(new l.Wrapper).maxLines(1)};v.prototype._computeWidth=function(){var x=this._usesTextWidthApproximation?this._computeApproximateTextWidth(): this._computeExactTextWidth();return"center"===this._tickLabelPositioning?this._maxLabelTickLength()+this.tickLabelPadding()+x:Math.max(this._maxLabelTickLength(),this.tickLabelPadding()+x)};v.prototype._computeExactTextWidth=function(){var x=this,y=this._getTickValues().map(function(z){z=x.formatter()(z);return x._measurer.measure(z).width});return p.Math.max(y,0)};v.prototype._computeApproximateTextWidth=function(){var x=this,y=this._getTickValues(),z=this._measurer.measure("M").width;y=y.map(function(A){return x.formatter()(A).length* z});return p.Math.max(y,0)};v.prototype._computeHeight=function(){var x=this._measurer.measure().height;return"center"===this._tickLabelPositioning?this._maxLabelTickLength()+this.tickLabelPadding()+x:Math.max(this._maxLabelTickLength(),this.tickLabelPadding()+x)};v.prototype._getTickValues=function(){var x=this._scale,y=x.domain(),z=y[0]<=y[1]?y[0]:y[1],A=y[0]>=y[1]?y[0]:y[1];return x.ticks().filter(function(D){return D>=z&&D<=A})};v.prototype._rescale=function(){if(this._isSetup){if(!this.isHorizontal()){var x= this._computeWidth();if(x>this.width()||x<this.width()-this.margin()){this.redraw();return}}this.render()}};v.prototype.renderImmediately=function(){var x=this;t.prototype.renderImmediately.call(this);var y={x:0,y:0,dx:"0em",dy:"0.3em"},z=this._maxLabelTickLength(),A=this.tickLabelPadding(),D="middle",H=0,E=0,F=0,J=0;if(this.isHorizontal())switch(this._tickLabelPositioning){case "left":D="end";H=-A;J=A;break;case "center":J=z+A;break;case "right":D="start",J=H=A}else switch(this._tickLabelPositioning){case "top":y.dy= "-0.3em";F=A;E=-A;break;case "center":F=z+A;break;case "bottom":y.dy="1em",E=F=A}z=this._generateTickMarkAttrHash();switch(this.orientation()){case "bottom":y.x=z.x1;y.dy="0.95em";E=z.y1+J;break;case "top":y.x=z.x1;y.dy="-.25em";E=z.y1-J;break;case "left":D="end";H=z.x1-F;y.y=z.y1;break;case "right":D="start",H=z.x1+F,y.y=z.y1}F=this._getTickValues();F=this._tickLabelContainer.selectAll("."+n.Axis.TICK_LABEL_CLASS).data(F);F.exit().remove();F.enter().append("text").classed(n.Axis.TICK_LABEL_CLASS, !0).merge(F).style("text-anchor",D).style("visibility","inherit").attrs(y).text(function(O){return x.formatter()(O)});this._tickLabelContainer.attr("transform","translate("+H+", "+E+")");this._showAllTickMarks();this.showEndTickLabels()||this._hideEndTickLabels();this._hideOverflowingTickLabels();this._hideOverlappingTickLabels();"center"!==this._tickLabelPositioning&&this._hideTickMarksWithoutLabel();return this};v.prototype.tickLabelPosition=function(x){if(null==x)return this._tickLabelPositioning; x=x.toLowerCase();if(this.isHorizontal()){if("left"!==x&&"center"!==x&&"right"!==x)throw Error(x+" is not a valid tick label position for a horizontal NumericAxis");}else if("top"!==x&&"center"!==x&&"bottom"!==x)throw Error(x+" is not a valid tick label position for a vertical NumericAxis");this._tickLabelPositioning=x;this.redraw();return this};v.prototype.usesTextWidthApproximation=function(){this._usesTextWidthApproximation=!0};v.prototype._hideEndTickLabels=function(){var x=this.element().node().getBoundingClientRect(), y=this._tickLabelContainer.selectAll("."+n.Axis.TICK_LABEL_CLASS);if(0!==y.size()){var z=y.nodes()[0];p.DOM.clientRectInside(z.getBoundingClientRect(),x)||q.select(z).style("visibility","hidden");y=y.nodes()[y.size()-1];p.DOM.clientRectInside(y.getBoundingClientRect(),x)||q.select(y).style("visibility","hidden")}};v.prototype._hideOverlappingTickLabels=function(){for(var x=this._tickLabelContainer.selectAll("."+n.Axis.TICK_LABEL_CLASS).filter(function(){var A=q.select(this).style("visibility");return"inherit"=== A||"visible"===A}),y=x.nodes().map(function(A){return A.getBoundingClientRect()}),z=1;!this._hasOverlapWithInterval(z,y)&&z<y.length;)z+=1;x.each(function(A,D){A=q.select(this);0!==D%z&&A.style("visibility","hidden")})};v.prototype._hasOverlapWithInterval=function(x,y){var z="center"===this._tickLabelPositioning?this.tickLabelPadding():3*this.tickLabelPadding();y=y.map(function(D){return p.DOM.expandRect(D,z)});for(var A=0;A<y.length-x;A+=x)if(p.DOM.clientRectsOverlap(y[A],y[A+x]))return!1;return!0}; v.prototype.invalidateCache=function(){t.prototype.invalidateCache.call(this);this._measurer.reset()};return v}(n.Axis);e.Numeric=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)};c=g(42);var q=g(25),l=g(0);g=function(m){function p(n){function t(){A&&(A=!1,z._dragEndCallbacks.callCallbacks(z))}function v(D,H){A&&(z._setPixelPositionWithoutChangingMode(z._isVertical()? H.x:H.y),z._dragCallbacks.callCallbacks(z))}function x(D){y(D)&&(A=!0,z._dragStartCallbacks.callCallbacks(z))}function y(D){return z._isVertical()&&z.pixelPosition()-z.detectionRadius()<=D.x&&D.x<=z.pixelPosition()+z.detectionRadius()||!z._isVertical()&&z.pixelPosition()-z.detectionRadius()<=D.y&&D.y<=z.pixelPosition()+z.detectionRadius()}var z=m.call(this,n)||this;z._detectionRadius=3;z._enabled=!0;z.addClass("drag-line-layer");z.addClass("enabled");z._dragInteraction=new q.Drag;z._dragInteraction.attachTo(z); var A=!1;z._dragInteraction.onDragStart(x);z._dragInteraction.onDrag(v);z._dragInteraction.onDragEnd(t);z._disconnectInteraction=function(){z._dragInteraction.offDragStart(x);z._dragInteraction.offDrag(v);z._dragInteraction.offDragEnd(t);z._dragInteraction.detach()};z._dragStartCallbacks=new l.CallbackSet;z._dragCallbacks=new l.CallbackSet;z._dragEndCallbacks=new l.CallbackSet;return z}k(p,m);p.prototype._setup=function(){m.prototype._setup.call(this);this._detectionEdge=this.content().append("line").styles({opacity:0, stroke:"pink","pointer-events":"visibleStroke"}).classed("drag-edge",!0)};p.prototype.renderImmediately=function(){m.prototype.renderImmediately.call(this);this._detectionEdge.attrs({x1:this._isVertical()?this.pixelPosition():0,y1:this._isVertical()?0:this.pixelPosition(),x2:this._isVertical()?this.pixelPosition():this.width(),y2:this._isVertical()?this.height():this.pixelPosition(),"stroke-width":2*this._detectionRadius});return this};p.prototype.detectionRadius=function(){return this._detectionRadius}; p.prototype.enabled=function(n){if(null==n)return this._enabled;(this._enabled=n)?this.addClass("enabled"):this.removeClass("enabled");this._dragInteraction.enabled(n);return this};p.prototype.onDragStart=function(n){this._dragStartCallbacks.add(n)};p.prototype.offDragStart=function(n){this._dragStartCallbacks.delete(n)};p.prototype.onDrag=function(n){this._dragCallbacks.add(n)};p.prototype.offDrag=function(n){this._dragCallbacks.delete(n)};p.prototype.onDragEnd=function(n){this._dragEndCallbacks.add(n)}; p.prototype.offDragEnd=function(n){this._dragEndCallbacks.delete(n)};p.prototype.destroy=function(){var n=this;m.prototype.destroy.call(this);this._dragStartCallbacks.forEach(function(t){return n._dragStartCallbacks.delete(t)});this._dragCallbacks.forEach(function(t){return n._dragCallbacks.delete(t)});this._dragEndCallbacks.forEach(function(t){return n._dragEndCallbacks.delete(t)});this._disconnectInteraction()};return p}(c.GuideLineLayer);e.DragLineLayer=g},function(c,e,g){function k(l,m,p){var n= {};if(void 0!==p)for(var t=0;t<p.length;t++)n[p[t]]=p[t-1];return function(v){var x=l.scale(v);if(!m)return x;var y;v=void 0===n[v]?void 0:l.scale(n[v]);void 0!==v&&(y=v+(x-v)/2);return y}}var q=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)};c=function(l){function m(p,n){var t=l.call(this)||this;t.addClass("gridlines");t._xScale=p;t._yScale=n;t._renderCallback= function(){return t.render()};if(t._xScale)t._xScale.onUpdate(t._renderCallback);if(t._yScale)t._yScale.onUpdate(t._renderCallback);return t}q(m,l);m.prototype.betweenX=function(){return this._betweenX};m.prototype.betweenY=function(){return this._betweenY};m.prototype.destroy=function(){l.prototype.destroy.call(this);this._xScale&&this._xScale.offUpdate(this._renderCallback);this._yScale&&this._yScale.offUpdate(this._renderCallback);return this};m.prototype._setup=function(){l.prototype._setup.call(this); this._xLinesContainer=this.content().append("g").classed("x-gridlines",!0);this._yLinesContainer=this.content().append("g").classed("y-gridlines",!0)};m.prototype.renderImmediately=function(){l.prototype.renderImmediately.call(this);this._redrawXLines();this._redrawYLines();return this};m.prototype.computeLayout=function(p,n,t){l.prototype.computeLayout.call(this,p,n,t);null!=this._xScale&&this._xScale.range([0,this.width()]);null!=this._yScale&&this._yScale.range([this.height(),0]);return this}; m.prototype._redrawXLines=function(){if(this._xScale){var p=this.betweenX(),n=this._xScale.ticks().slice(p?1:0);n=this._xLinesContainer.selectAll("line").data(n);n.enter().append("line").merge(n).attr("x1",k(this._xScale,p,this._xScale.ticks())).attr("y1",0).attr("x2",k(this._xScale,p,this._xScale.ticks())).attr("y2",this.height()).classed("betweenline",p).classed("zeroline",function(t){return 0===t});n.exit().remove()}};m.prototype._redrawYLines=function(){if(this._yScale){var p=this.betweenY(), n=this._yScale.ticks().slice(p?1:0);n=this._yLinesContainer.selectAll("line").data(n);n.enter().append("line").merge(n).attr("x1",0).attr("y1",k(this._yScale,p,this._yScale.ticks())).attr("x2",this.width()).attr("y2",k(this._yScale,p,this._yScale.ticks())).classed("betweenline",p).classed("zeroline",function(t){return 0===t});n.exit().remove()}};return m}(g(4).Component);e.Gridlines=c},function(c,e,g){var k=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&& (n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},q=g(5),l=g(23),m=g(8),p=g(0);c=function(n){function t(v){var x=n.call(this)||this;x._textPadding=5;if(null==v)throw Error("InterpolatedColorLegend requires a interpolatedColorScale");x._scale=v;x._redrawCallback=function(){return x.redraw()};x._scale.onUpdate(x._redrawCallback);x._formatter=m.general();x._orientation="horizontal";x._expands=!1;x.addClass("legend");x.addClass("interpolated-color-legend");return x}k(t, n);t.prototype.destroy=function(){n.prototype.destroy.call(this);this._scale.offUpdate(this._redrawCallback)};t.prototype.formatter=function(v){if(void 0===v)return this._formatter;this._formatter=v;this.redraw();return this};t.prototype.expands=function(){return this._expands};t._ensureOrientation=function(v){v=v.toLowerCase();if("horizontal"===v||"left"===v||"right"===v)return v;throw Error('"'+v+'" is not a valid orientation for InterpolatedColorLegend');};t.prototype.orientation=function(v){if(null== v)return this._orientation;this._orientation=t._ensureOrientation(v);this.redraw();return this};t.prototype.fixedWidth=function(){return!this.expands()||this._isVertical()};t.prototype.fixedHeight=function(){return!this.expands()||!this._isVertical()};t.prototype._generateTicks=function(v){void 0===v&&(v=t._DEFAULT_NUM_SWATCHES);var x=this._scale.domain();if(1===v)return[x[0]];for(var y=(x[1]-x[0])/(v-1),z=[],A=0;A<v;A++)z.push(x[0]+y*A);return z};t.prototype._setup=function(){n.prototype._setup.call(this); this._swatchContainer=this.content().append("g").classed("swatch-container",!0);this._swatchBoundingBox=this.content().append("rect").classed("swatch-bounding-box",!0);this._lowerLabel=this.content().append("g").classed(t.LEGEND_LABEL_CLASS,!0);this._upperLabel=this.content().append("g").classed(t.LEGEND_LABEL_CLASS,!0);var v=new q.SvgContext(this.content().node());this._measurer=new q.Measurer(v);this._wrapper=new q.Wrapper;this._writer=new q.Writer(this._measurer,v,this._wrapper)};t.prototype.requestedSpace= function(){var v=this,x=this._measurer.measure().height,y=this._scale.domain().map(function(D){return v._measurer.measure(v._formatter(D)).width}),z=t._DEFAULT_NUM_SWATCHES;if(this._isVertical()){var A=p.Math.max(y,0);y=x+x+this._textPadding+A+this._textPadding;A=z*x}else A=x+x+x,y=this._textPadding+y[0]+z*x+y[1]+this._textPadding;return{minWidth:y,minHeight:A}};t.prototype._isVertical=function(){return"horizontal"!==this._orientation};t.prototype.renderImmediately=function(){var v=this;n.prototype.renderImmediately.call(this); var x=this._scale.domain(),y=this._formatter(x[0]),z=this._measurer.measure(y).width,A=this._formatter(x[1]);x=this._measurer.measure(A).width;var D=this._measurer.measure().height,H=this._textPadding,E=0,F=0,J=0,O=0,N={xAlign:"center",yAlign:"center",textRotation:0},P={xAlign:"center",yAlign:"center",textRotation:0},V={x:0,y:0,width:0,height:0};if(this._isVertical()){var T=Math.floor(this.height());var aa=Math.max(z,x);var da=(this.width()-aa-2*this._textPadding)/2;x=Math.max(this.width()-da-2*H- aa,0);D=1;var va=function(na,ya){return v.height()-(ya+1)};P.yAlign="top";F=0;N.yAlign="bottom";O=0;if("left"===this._orientation){var Da=function(){return H+aa+H};P.xAlign="right";E=-(da+x+H);N.xAlign="right";J=-(da+x+H)}else Da=function(){return da},P.xAlign="left",E=da+x+H,N.xAlign="left",J=da+x+H;V.width=x;V.height=T*D}else da=Math.max(H,(this.height()-D)/2),T=Math.max(Math.floor(this.width()-4*H-z-x),0),x=1,D=Math.max(this.height()-2*da,0),Da=function(na,ya){return Math.floor(z+2*H)+ya},va=function(){return da}, P.xAlign="right",E=-H,N.xAlign="left",J=H,V.y=da,V.width=T*x,V.height=D;V.x=Da(null,0);this._upperLabel.text("");this._writer.write(A,this.width(),this.height(),P,this._upperLabel.node());this._upperLabel.attr("transform","translate("+E+", "+F+")");this._lowerLabel.text("");this._writer.write(y,this.width(),this.height(),N,this._lowerLabel.node());this._lowerLabel.attr("transform","translate("+J+", "+O+")");this._swatchBoundingBox.attrs(V);y=this._generateTicks(T);y=this._swatchContainer.selectAll("rect.swatch").data(y); A=y.enter().append("rect").classed("swatch",!0);E=y.merge(A);y.exit().remove();E.attrs({fill:function(na){return v._scale.scale(na)},width:x,height:D,x:Da,y:va,"shape-rendering":"crispEdges"});l.ADD_TITLE_ELEMENTS&&A.append("title").text(function(na){return v._formatter(na)});return this};return t}(g(4).Component);c._DEFAULT_NUM_SWATCHES=11;c.LEGEND_LABEL_CLASS="legend-label";e.InterpolatedColorLegend=c},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&& (l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(5);c=function(l){function m(p,n){void 0===p&&(p="");void 0===n&&(n=0);var t=l.call(this)||this;t.addClass("label");t.text(p);t.angle(n);t.xAlignment("center").yAlignment("center");t._padding=0;return t}k(m,l);m.prototype.requestedSpace=function(){var p=this._measurer.measure(this._text),n=(0===this.angle()?p.width:p.height)+2*this.padding();p=(0===this.angle()?p.height:p.width)+2*this.padding();return{minWidth:n, minHeight:p}};m.prototype._setup=function(){l.prototype._setup.call(this);this._textContainer=this.content().append("g");var p=new q.SvgContext(this._textContainer.node());this._measurer=new q.CacheMeasurer(p);this._wrapper=new q.Wrapper;this._writer=new q.Writer(this._measurer,p,this._wrapper);this.text(this._text)};m.prototype.text=function(p){if(null==p)return this._text;if("string"!==typeof p)throw Error("Label.text() only takes strings as input");this._text=p;this.redraw();return this};m.prototype.angle= function(p){if(null==p)return this._angle;p%=360;180<p?p-=360:-180>p&&(p+=360);if(-90===p||0===p||90===p)this._angle=p;else throw Error(p+" is not a valid angle for Label");this.redraw();return this};m.prototype.padding=function(p){if(null==p)return this._padding;p=+p;if(0>p)throw Error(p+" is not a valid padding value. Cannot be less than 0.");this._padding=p;this.redraw();return this};m.prototype.fixedWidth=function(){return!0};m.prototype.fixedHeight=function(){return!0};m.prototype.renderImmediately= function(){l.prototype.renderImmediately.call(this);this._textContainer.selectAll("g").remove();var p=this._measurer.measure(this._text),n=Math.max(Math.min((this.height()-p.height)/2,this.padding()),0);p=Math.max(Math.min((this.width()-p.width)/2,this.padding()),0);this._textContainer.attr("transform","translate("+p+","+n+")");p=this.width()-2*p;n=this.height()-2*n;var t={xAlign:this.xAlignment(),yAlign:this.yAlignment(),textRotation:this.angle()};this._writer.write(this._text,p,n,t);return this}; m.prototype.invalidateCache=function(){l.prototype.invalidateCache.call(this);this._measurer.reset()};return m}(g(4).Component);e.Label=c;g=function(l){function m(p,n){p=l.call(this,p,n)||this;p.addClass(m.TITLE_LABEL_CLASS);return p}k(m,l);return m}(c);g.TITLE_LABEL_CLASS="title-label";e.TitleLabel=g;c=function(l){function m(p,n){p=l.call(this,p,n)||this;p.addClass(m.AXIS_LABEL_CLASS);return p}k(m,l);return m}(c);c.AXIS_LABEL_CLASS="axis-label";e.AxisLabel=c},function(c,e,g){var k=this&&this.__extends|| function(y,z){function A(){this.constructor=y}for(var D in z)z.hasOwnProperty(D)&&(y[D]=z[D]);y.prototype=null===z?Object.create(z):(A.prototype=z.prototype,new A)},q=g(1),l=g(5),m=g(23),p=g(8),n=g(31),t=g(0);c=g(4);var v=function(){function y(z,A,D){void 0===z&&(z=[]);void 0===A&&(A=0);void 0===D&&(D=Infinity);this.columns=z;this.bottomPadding=A;this.maxWidth=D}y.prototype.addColumn=function(z){var A=z.width,D=this.getWidthAvailable();z.width=Math.min(D,A);this.columns.push(z)};y.prototype.getBounds= function(z){for(var A=this.columns[z],D=0,H=0;H<z;H++)D+=this.columns[H].width;return{topLeft:{x:D,y:0},bottomRight:{x:D+A.width,y:A.height}}};y.prototype.getHeight=function(){return t.Math.max(this.columns.map(function(z){return z.height}),0)+this.bottomPadding};y.prototype.getWidth=function(){return Math.min(this.columns.reduce(function(z,A){return z+A.width},0),this.maxWidth)};y.prototype.getWidthAvailable=function(){var z=this.getWidth();return Math.max(this.maxWidth-z,0)};return y}(),x=function(){function y(z, A,D,H){void 0===z&&(z=Infinity);void 0===A&&(A=Infinity);void 0===D&&(D=0);void 0===H&&(H=[]);this.maxWidth=z;this.maxHeight=A;this.padding=D;this.rows=H}y.prototype.addRow=function(z){z.maxWidth=this.maxWidth-2*this.padding;this.rows.push(z)};y.prototype.getColumnBounds=function(z,A){var D=this.getRowBounds(z);z=this.rows[z].getBounds(A);z.topLeft.x+=D.topLeft.x;z.bottomRight.x+=D.topLeft.x;z.topLeft.y+=D.topLeft.y;z.bottomRight.y+=D.topLeft.y;return z};y.prototype.getRowBounds=function(z){for(var A= this.padding,D=this.padding,H=0;H<z;H++)D+=this.rows[H].getHeight();return{topLeft:{x:A,y:D},bottomRight:{x:A+this.rows[z].getWidth(),y:D+this.rows[z].getHeight()}}};y.prototype.getHeight=function(){return Math.min(this.rows.reduce(function(z,A){return z+A.getHeight()},0)+2*this.padding,this.maxHeight)};y.prototype.getWidth=function(){return Math.min(t.Math.max(this.rows.map(function(z){return z.getWidth()}),0)+2*this.padding,this.maxWidth)};return y}();c=function(y){function z(A){var D=y.call(this)|| this;D._padding=5;D._rowBottomPadding=3;D.addClass("legend");D.maxEntriesPerRow(1);if(null==A)throw Error("Legend requires a colorScale");D._colorScale=A;D._redrawCallback=function(){return D.redraw()};D._colorScale.onUpdate(D._redrawCallback);D._formatter=p.identity();D.maxLinesPerEntry(1);D.xAlignment("right").yAlignment("top");D.comparator(function(H,E){var F=D._colorScale.domain().slice().map(function(J){return D._formatter(J)});return F.indexOf(H)-F.indexOf(E)});D._symbolFactoryAccessor=function(){return n.circle()}; D._symbolOpacityAccessor=function(){return 1};return D}k(z,y);z.prototype._setup=function(){y.prototype._setup.call(this);var A=this.content().append("g").classed(z.LEGEND_ROW_CLASS,!0);A.append("g").classed(z.LEGEND_ENTRY_CLASS,!0).append("text");A=new l.SvgContext(A.node(),null,m.ADD_TITLE_ELEMENTS);this._measurer=new l.CacheMeasurer(A);this._wrapper=(new l.Wrapper).maxLines(this.maxLinesPerEntry());this._writer=new l.Writer(this._measurer,A,this._wrapper)};z.prototype.formatter=function(A){if(null== A)return this._formatter;this._formatter=A;this.redraw();return this};z.prototype.maxEntriesPerRow=function(A){if(null==A)return this._maxEntriesPerRow;this._maxEntriesPerRow=A;this.redraw();return this};z.prototype.maxLinesPerEntry=function(A){if(null==A)return this._maxLinesPerEntry;this._maxLinesPerEntry=A;this.redraw();return this};z.prototype.maxWidth=function(A){if(null==A)return this._maxWidth;this._maxWidth=A;this.redraw();return this};z.prototype.comparator=function(A){null!=A&&(this._comparator= A,this.redraw())};z.prototype.colorScale=function(A){return null!=A?(this._colorScale.offUpdate(this._redrawCallback),this._colorScale=A,this._colorScale.onUpdate(this._redrawCallback),this.redraw(),this):this._colorScale};z.prototype.destroy=function(){y.prototype.destroy.call(this);this._colorScale.offUpdate(this._redrawCallback)};z.prototype._buildLegendTable=function(A,D){var H=this,E=this._measurer.measure().height,F=new x(A,D,this._padding);A=this._colorScale.domain().slice().sort(function(O, N){return H._comparator(H._formatter(O),H._formatter(N))});var J=new v;F.addRow(J);J.bottomPadding=this._rowBottomPadding;A.forEach(function(O){J.columns.length/2===H.maxEntriesPerRow()&&(J=new v,J.bottomPadding=H._rowBottomPadding,F.addRow(J));var N=J.getWidthAvailable(),P=H._formatter(O),V=H._measurer.measure(P).width;0>N-E-V&&1<J.columns.length&&(J=new v,J.bottomPadding=H._rowBottomPadding,F.addRow(J));J.addColumn({width:E,height:E,data:{name:O,type:"symbol"}});N=J.getWidthAvailable();N=Math.min(N, V);H._wrapper.maxLines(H.maxLinesPerEntry());P=H._wrapper.wrap(P,H._measurer,N).noLines*E;J.addColumn({width:N,height:P,data:{name:O,type:"text"}})});return F};z.prototype.requestedSpace=function(A,D){A=this._buildLegendTable(t.Math.min([this.maxWidth(),A],A),D);return{minHeight:A.getHeight(),minWidth:A.getWidth()}};z.prototype.entitiesAt=function(A){var D=this;if(!this._isSetup)return[];var H=this._buildLegendTable(this.width(),this.height());return H.rows.reduce(function(E,F,J){if(0!==E.length)return E; var O=H.getRowBounds(J);return t.Math.within(A,O)?F.columns.reduce(function(N,P,V){var T=H.getColumnBounds(J,V);if(t.Math.within(A,T)){N=D.content().selectAll("."+z.LEGEND_ROW_CLASS).nodes()[J];V=q.select(N).selectAll("."+z.LEGEND_ENTRY_CLASS).nodes()[Math.floor(V/2)];var aa=q.select(V).select("."+z.LEGEND_SYMBOL_CLASS);T=t.DOM.getTranslateValues(q.select(N));aa=t.DOM.getTranslateValues(aa);return[{bounds:t.DOM.elementBBox(q.select(N)),datum:P.data.name,position:{x:T[0]+aa[0],y:T[1]+aa[1]},selection:q.select(V), component:D}]}return N},E):E},[])};z.prototype.renderImmediately=function(){y.prototype.renderImmediately.call(this);var A=this._buildLegendTable(this.width(),this.height());this.content().selectAll("*").remove();var D=this.content().selectAll("g."+z.LEGEND_ROW_CLASS).data(A.rows),H=D.enter().append("g").classed(z.LEGEND_ROW_CLASS,!0).merge(D);D.exit().remove();H.attr("transform",function(F,J){F=A.getRowBounds(J);return"translate("+F.topLeft.x+", "+F.topLeft.y+")"});var E=this;H.each(function(F,J){for(var O= [],N=0;N<F.columns.length;N+=2)O.push([F.columns[N],F.columns[N+1]]);F=q.select(this).selectAll("g."+z.LEGEND_ENTRY_CLASS).data(O);O=F.enter().append("g").classed(z.LEGEND_ENTRY_CLASS,!0).merge(F);O.append("path").attr("d",function(P){P=P[0];return E.symbol()(P.data.name,J)(.6*P.height)(null)}).attr("transform",function(P){P=P[0];return"translate("+(A.getColumnBounds(J,A.rows[J].columns.indexOf(P)).topLeft.x+P.width/2)+", "+P.height/2+")"}).attr("fill",function(P){return E._colorScale.scale(P[0].data.name)}).attr("opacity", function(P){return E.symbolOpacity()(P[0].data.name,J)}).classed(z.LEGEND_SYMBOL_CLASS,!0);O.append("g").classed("text-container",!0).attr("transform",function(P){return"translate("+A.getColumnBounds(J,A.rows[J].columns.indexOf(P[1])).topLeft.x+", 0)"}).each(function(P){var V=q.select(this);P=P[1];E._writer.write(E._formatter(P.data.name),P.width,E.height(),{xAlign:"left",yAlign:"top",textRotation:0},V.node())});F.exit().remove()});return this};z.prototype.symbol=function(A){if(null==A)return this._symbolFactoryAccessor; this._symbolFactoryAccessor=A;this.render();return this};z.prototype.symbolOpacity=function(){return this._symbolOpacityAccessor};z.prototype.fixedWidth=function(){return!0};z.prototype.fixedHeight=function(){return!0};z.prototype.invalidateCache=function(){this._measurer.reset()};return z}(c.Component);c.LEGEND_ROW_CLASS="legend-row";c.LEGEND_ENTRY_CLASS="legend-entry";c.LEGEND_SYMBOL_CLASS="legend-symbol";e.Legend=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor= m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(2),l=g(0);c=function(m){function p(){return null!==m&&m.apply(this,arguments)||this}k(p,m);p.prototype.entityNearest=function(n){var t,v=Infinity;this.components().forEach(function(x){x=x.entityNearest(n);if(null!=x){var y=l.Math.distanceSquared(x.position,n);y<=v&&(v=y,t=x)}});return t};p.prototype.append=function(n){if(null!=n&&!(n instanceof q.Plot))throw Error("Plot Group only accepts plots"); m.prototype.append.call(this,n);return this};return p}(g(41).Group);e.PlotGroup=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(1),l=g(0);c=function(m){function p(n){void 0===n&&(n=[]);var t=m.call(this)||this;t._rowPadding=0;t._columnPadding=0;t._rows=[];t._rowWeights=[];t._columnWeights=[];t._nRows=0;t._nCols=0;t._calculatedLayout= null;t.addClass("table");n.forEach(function(v,x){v.forEach(function(y,z){null!=y&&t.add(y,x,z)})});return t}k(p,m);p.prototype._forEach=function(n){for(var t=0;t<this._nRows;t++)for(var v=0;v<this._nCols;v++)null!=this._rows[t][v]&&n(this._rows[t][v])};p.prototype.has=function(n){for(var t=0;t<this._nRows;t++)for(var v=0;v<this._nCols;v++)if(this._rows[t][v]===n)return!0;return!1};p.prototype.componentAt=function(n){return 0>=this._nRows||0>n||n>=this._nCols?null:this._rows[0][n]};p.prototype.add= function(n,t,v){if(null==n)throw Error("Cannot add null to a table cell");if(!this.has(n)){if(null!=(this._rows[t]&&this._rows[t][v]))throw Error("cell is occupied");n.detach();this._nRows=Math.max(t+1,this._nRows);this._nCols=Math.max(v+1,this._nCols);this._padTableToSize(this._nRows,this._nCols);this._rows[t][v]=n;this._adoptAndAnchor(n);this.redraw()}return this};p.prototype._remove=function(n){for(var t=0;t<this._nRows;t++)for(var v=0;v<this._nCols;v++)if(this._rows[t][v]===n){this._rows[t][v]= null;return}};p.prototype._iterateLayout=function(n,t,v){void 0===v&&(v=!1);var x=this._rows,y=q.transpose(this._rows);n-=this._columnPadding*(this._nCols-1);t-=this._rowPadding*(this._nRows-1);x=p._calcComponentWeights(this._rowWeights,x,function(aa){return null==aa||aa.fixedHeight()});y=p._calcComponentWeights(this._columnWeights,y,function(aa){return null==aa||aa.fixedWidth()});var z=y.map(function(aa){return 0===aa?.5:aa}),A=x.map(function(aa){return 0===aa?.5:aa});z=p._calcProportionalSpace(z, n);var D=p._calcProportionalSpace(A,t),H=l.Array.createFilledArray(0,this._nCols),E=l.Array.createFilledArray(0,this._nRows);A=0;for(var F,J,O;;){E=l.Array.add(E,D);z=l.Array.add(H,z);F=this._determineGuarantees(z,E,v);H=F.guaranteedWidths;E=F.guaranteedHeights;J=F.wantsWidthArr.some(function(aa){return aa});O=F.wantsHeightArr.some(function(aa){return aa});var N=V,P=T;var V=n-q.sum(F.guaranteedWidths);var T=t-q.sum(F.guaranteedHeights);z=void 0;J?(z=F.wantsWidthArr.map(function(aa){return aa?.1:0}), z=l.Array.add(z,y)):z=y;D=void 0;O?(D=F.wantsHeightArr.map(function(aa){return aa?.1:0}),D=l.Array.add(D,x)):D=x;z=p._calcProportionalSpace(z,V);D=p._calcProportionalSpace(D,T);A++;P=0<T&&T!==P;if(!(0<V&&V!==N||P))break;if(5<A)break}V=n-q.sum(F.guaranteedWidths);T=t-q.sum(F.guaranteedHeights);z=p._calcProportionalSpace(y,V);D=p._calcProportionalSpace(x,T);return{colProportionalSpace:z,rowProportionalSpace:D,guaranteedWidths:F.guaranteedWidths,guaranteedHeights:F.guaranteedHeights,wantsWidth:J,wantsHeight:O}}; p.prototype._determineGuarantees=function(n,t,v){void 0===v&&(v=!1);var x=l.Array.createFilledArray(0,this._nCols),y=l.Array.createFilledArray(0,this._nRows),z=l.Array.createFilledArray(!1,this._nCols),A=l.Array.createFilledArray(!1,this._nRows);this._rows.forEach(function(D,H){D.forEach(function(E,F){E=null!=E?E.requestedSpace(n[F],t[H]):{minWidth:0,minHeight:0};x[F]=Math.max(x[F],v?Math.min(E.minWidth,n[F]):E.minWidth);y[H]=Math.max(y[H],v?Math.min(E.minHeight,t[H]):E.minHeight);var J=E.minWidth> n[F];z[F]=z[F]||J;F=E.minHeight>t[H];A[H]=A[H]||F})});return{guaranteedWidths:x,guaranteedHeights:y,wantsWidthArr:z,wantsHeightArr:A}};p.prototype.requestedSpace=function(n,t){this._calculatedLayout=this._iterateLayout(n,t);return{minWidth:q.sum(this._calculatedLayout.guaranteedWidths),minHeight:q.sum(this._calculatedLayout.guaranteedHeights)}};p.prototype.computeLayout=function(n,t,v){var x=this;m.prototype.computeLayout.call(this,n,t,v);n=q.sum(this._calculatedLayout.guaranteedWidths);t=q.sum(this._calculatedLayout.guaranteedHeights); v=this._calculatedLayout;if(n>this.width()||t>this.height())v=this._iterateLayout(this.width(),this.height(),!0);var y=0,z=l.Array.add(v.rowProportionalSpace,v.guaranteedHeights),A=l.Array.add(v.colProportionalSpace,v.guaranteedWidths);this._rows.forEach(function(D,H){var E=0;D.forEach(function(F,J){null!=F&&F.computeLayout({x:E,y},A[J],z[H]);E+=A[J]+x._columnPadding});y+=z[H]+x._rowPadding});return this};p.prototype.rowPadding=function(n){if(null==n)return this._rowPadding;if(!l.Math.isValidNumber(n)|| 0>n)throw Error("rowPadding must be a non-negative finite value");this._rowPadding=n;this.redraw();return this};p.prototype.columnPadding=function(n){if(null!=n){if(!l.Math.isValidNumber(n)||0>n)throw Error("columnPadding must be a non-negative finite value");this._columnPadding=n;this.redraw()}};p.prototype.rowWeight=function(n,t){if(null==t)return this._rowWeights[n];if(!l.Math.isValidNumber(t)||0>t)throw Error("rowWeight must be a non-negative finite value");this._rowWeights[n]=t;this.redraw(); return this};p.prototype.columnWeight=function(n,t){if(null==t)return this._columnWeights[n];if(!l.Math.isValidNumber(t)||0>t)throw Error("columnWeight must be a non-negative finite value");this._columnWeights[n]=t;this.redraw();return this};p.prototype.fixedWidth=function(){var n=q.transpose(this._rows);return p._fixedSpace(n,function(t){return null==t||t.fixedWidth()})};p.prototype.fixedHeight=function(){return p._fixedSpace(this._rows,function(n){return null==n||n.fixedHeight()})};p.prototype._padTableToSize= function(n,t){for(var v=0;v<n;v++){void 0===this._rows[v]&&(this._rows[v]=[],this._rowWeights[v]=null);for(var x=0;x<t;x++)void 0===this._rows[v][x]&&(this._rows[v][x]=null)}for(x=0;x<t;x++)void 0===this._columnWeights[x]&&(this._columnWeights[x]=null)};p._calcComponentWeights=function(n,t,v){return n.map(function(x,y){return null!=x?x:t[y].map(v).reduce(function(z,A){return z&&A},!0)?0:1})};p._calcProportionalSpace=function(n,t){var v=q.sum(n);return 0===v?l.Array.createFilledArray(0,n.length):n.map(function(x){return t* x/v})};p._fixedSpace=function(n,t){function v(x){return x.reduce(function(y,z){return y&&z},!0)}return v(n.map(function(x){return v(x.map(t))}))};return p}(g(29).ComponentContainer);e.Table=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){var m=q.call(this)||this;m.addClass("x-drag-box-layer");m._hasCorners=!1; return m}k(l,q);l.prototype.computeLayout=function(m,p,n){q.prototype.computeLayout.call(this,m,p,n);this._setBounds(this.bounds());return this};l.prototype._setBounds=function(m){q.prototype._setBounds.call(this,{topLeft:{x:m.topLeft.x,y:0},bottomRight:{x:m.bottomRight.x,y:this.height()}})};l.prototype._setResizableClasses=function(m){m&&this.enabled()?this.addClass("x-resizable"):this.removeClass("x-resizable")};l.prototype.yScale=function(m){if(null==m)return q.prototype.yScale.call(this);throw Error("yScales cannot be set on an XDragBoxLayer"); };l.prototype.yExtent=function(){return q.prototype.yExtent.call(this);throw Error("XDragBoxLayer has no yExtent");};return l}(g(32).DragBoxLayer);e.XDragBoxLayer=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){var m=q.call(this)||this;m.addClass("y-drag-box-layer");m._hasCorners=!1;return m}k(l,q);l.prototype.computeLayout= function(m,p,n){q.prototype.computeLayout.call(this,m,p,n);this._setBounds(this.bounds());return this};l.prototype._setBounds=function(m){q.prototype._setBounds.call(this,{topLeft:{x:0,y:m.topLeft.y},bottomRight:{x:this.width(),y:m.bottomRight.y}})};l.prototype._setResizableClasses=function(m){m&&this.enabled()?this.addClass("y-resizable"):this.removeClass("y-resizable")};l.prototype.xScale=function(m){if(null==m)return q.prototype.xScale.call(this);throw Error("xScales cannot be set on an YDragBoxLayer"); };l.prototype.xExtent=function(){return q.prototype.xExtent.call(this);throw Error("YDragBoxLayer has no xExtent");};return l}(g(32).DragBoxLayer);e.YDragBoxLayer=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){var m=q.call(this)||this;m._eventToProcessingFunction[l._KEYDOWN_EVENT_NAME]=function(p){return m._processKeydown(p)}; m._eventToProcessingFunction[l._KEYUP_EVENT_NAME]=function(p){return m._processKeyup(p)};return m}k(l,q);l.getDispatcher=function(){var m=document[l._DISPATCHER_KEY];null==m&&(m=new l,document[l._DISPATCHER_KEY]=m);return m};l.prototype._processKeydown=function(m){this._callCallbacksForEvent(l._KEYDOWN_EVENT_NAME,m.keyCode,m)};l.prototype._processKeyup=function(m){this._callCallbacksForEvent(l._KEYUP_EVENT_NAME,m.keyCode,m)};l.prototype.onKeyDown=function(m){this._addCallbackForEvent(l._KEYDOWN_EVENT_NAME, m)};l.prototype.offKeyDown=function(m){this._removeCallbackForEvent(l._KEYDOWN_EVENT_NAME,m)};l.prototype.onKeyUp=function(m){this._addCallbackForEvent(l._KEYUP_EVENT_NAME,m)};l.prototype.offKeyUp=function(m){this._removeCallbackForEvent(l._KEYUP_EVENT_NAME,m)};return l}(g(24).Dispatcher);c._DISPATCHER_KEY="__Plottable_Dispatcher_Key";c._KEYDOWN_EVENT_NAME="keydown";c._KEYUP_EVENT_NAME="keyup";e.Key=c},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&& (l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(0);c=function(l){function m(p){function n(v){return t._measureAndDispatch(p,v,m._MOUSEMOVE_EVENT_NAME,"page")}var t=l.call(this)||this;t._lastMousePosition={x:-1,y:-1};t._translator=q.getTranslator(p);t._eventToProcessingFunction[m._MOUSEOVER_EVENT_NAME]=n;t._eventToProcessingFunction[m._MOUSEMOVE_EVENT_NAME]=n;t._eventToProcessingFunction[m._MOUSEOUT_EVENT_NAME]=n;t._eventToProcessingFunction[m._MOUSEDOWN_EVENT_NAME]= function(v){return t._measureAndDispatch(p,v,m._MOUSEDOWN_EVENT_NAME)};t._eventToProcessingFunction[m._MOUSEUP_EVENT_NAME]=function(v){return t._measureAndDispatch(p,v,m._MOUSEUP_EVENT_NAME,"page")};t._eventToProcessingFunction[m._WHEEL_EVENT_NAME]=function(v){return t._measureAndDispatch(p,v,m._WHEEL_EVENT_NAME)};t._eventToProcessingFunction[m._DBLCLICK_EVENT_NAME]=function(v){return t._measureAndDispatch(p,v,m._DBLCLICK_EVENT_NAME)};return t}k(m,l);m.getDispatcher=function(p){var n=p.root().rootElement(), t=n[m._DISPATCHER_KEY];null==t&&(t=new m(p),n[m._DISPATCHER_KEY]=t);return t};m.prototype.onMouseMove=function(p){this._addCallbackForEvent(m._MOUSEMOVE_EVENT_NAME,p)};m.prototype.offMouseMove=function(p){this._removeCallbackForEvent(m._MOUSEMOVE_EVENT_NAME,p)};m.prototype.onMouseDown=function(p){this._addCallbackForEvent(m._MOUSEDOWN_EVENT_NAME,p)};m.prototype.offMouseDown=function(p){this._removeCallbackForEvent(m._MOUSEDOWN_EVENT_NAME,p)};m.prototype.onMouseUp=function(p){this._addCallbackForEvent(m._MOUSEUP_EVENT_NAME, p)};m.prototype.offMouseUp=function(p){this._removeCallbackForEvent(m._MOUSEUP_EVENT_NAME,p)};m.prototype.onWheel=function(p){this._addCallbackForEvent(m._WHEEL_EVENT_NAME,p);return this};m.prototype.offWheel=function(p){this._removeCallbackForEvent(m._WHEEL_EVENT_NAME,p)};m.prototype.onDblClick=function(p){this._addCallbackForEvent(m._DBLCLICK_EVENT_NAME,p)};m.prototype.offDblClick=function(p){this._removeCallbackForEvent(m._DBLCLICK_EVENT_NAME,p)};m.prototype._measureAndDispatch=function(p,n,t, v){void 0===v&&(v="element");if("page"!==v&&"element"!==v)throw Error("Invalid scope '"+v+"', must be 'element' or 'page'");if("page"===v||this.eventInside(p,n))this._lastMousePosition=this._translator.computePosition(n.clientX,n.clientY),this._callCallbacksForEvent(t,this.lastMousePosition(),n)};m.prototype.eventInside=function(p,n){return q.Translator.isEventInside(p,n)};m.prototype.lastMousePosition=function(){return this._lastMousePosition};return m}(g(24).Dispatcher);c._DISPATCHER_KEY="__Plottable_Dispatcher_Mouse"; c._MOUSEOVER_EVENT_NAME="mouseover";c._MOUSEMOVE_EVENT_NAME="mousemove";c._MOUSEOUT_EVENT_NAME="mouseout";c._MOUSEDOWN_EVENT_NAME="mousedown";c._MOUSEUP_EVENT_NAME="mouseup";c._WHEEL_EVENT_NAME="wheel";c._DBLCLICK_EVENT_NAME="dblclick";e.Mouse=c},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(0);c=function(l){function m(p){var n=l.call(this)|| this;n._translator=q.getTranslator(p);n._eventToProcessingFunction[m._TOUCHSTART_EVENT_NAME]=function(t){return n._measureAndDispatch(p,t,m._TOUCHSTART_EVENT_NAME,"page")};n._eventToProcessingFunction[m._TOUCHMOVE_EVENT_NAME]=function(t){return n._measureAndDispatch(p,t,m._TOUCHMOVE_EVENT_NAME,"page")};n._eventToProcessingFunction[m._TOUCHEND_EVENT_NAME]=function(t){return n._measureAndDispatch(p,t,m._TOUCHEND_EVENT_NAME,"page")};n._eventToProcessingFunction[m._TOUCHCANCEL_EVENT_NAME]=function(t){return n._measureAndDispatch(p, t,m._TOUCHCANCEL_EVENT_NAME,"page")};return n}k(m,l);m.getDispatcher=function(p){var n=p.root().rootElement(),t=n[m._DISPATCHER_KEY];null==t&&(t=new m(p),n[m._DISPATCHER_KEY]=t);return t};m.prototype.onTouchStart=function(p){this._addCallbackForEvent(m._TOUCHSTART_EVENT_NAME,p)};m.prototype.offTouchStart=function(p){this._removeCallbackForEvent(m._TOUCHSTART_EVENT_NAME,p)};m.prototype.onTouchMove=function(p){this._addCallbackForEvent(m._TOUCHMOVE_EVENT_NAME,p)};m.prototype.offTouchMove=function(p){this._removeCallbackForEvent(m._TOUCHMOVE_EVENT_NAME, p)};m.prototype.onTouchEnd=function(p){this._addCallbackForEvent(m._TOUCHEND_EVENT_NAME,p)};m.prototype.offTouchEnd=function(p){this._removeCallbackForEvent(m._TOUCHEND_EVENT_NAME,p)};m.prototype.onTouchCancel=function(p){this._addCallbackForEvent(m._TOUCHCANCEL_EVENT_NAME,p)};m.prototype.offTouchCancel=function(p){this._removeCallbackForEvent(m._TOUCHCANCEL_EVENT_NAME,p)};m.prototype._measureAndDispatch=function(p,n,t,v){void 0===v&&(v="element");if("page"!==v&&"element"!==v)throw Error("Invalid scope '"+ v+"', must be 'element' or 'page'");if("element"!==v||this.eventInside(p,n)){p=n.changedTouches;v={};for(var x=[],y=0;y<p.length;y++){var z=p[y],A=z.identifier;z=this._translator.computePosition(z.clientX,z.clientY);null!=z&&(v[A]=z,x.push(A))}0<x.length&&this._callCallbacksForEvent(t,x,v,n)}};m.prototype.eventInside=function(p,n){return q.Translator.isEventInside(p,n)};return m}(g(24).Dispatcher);c._DISPATCHER_KEY="__Plottable_Dispatcher_Touch";c._TOUCHSTART_EVENT_NAME="touchstart";c._TOUCHMOVE_EVENT_NAME= "touchmove";c._TOUCHEND_EVENT_NAME="touchend";c._TOUCHCANCEL_EVENT_NAME="touchcancel";e.Touch=c},function(c,e){c=function(){function g(k,q,l){void 0===l&&(l=window.devicePixelRatio);this.screenWidth=k;this.screenHeight=q;this.devicePixelRatio=l;this.pixelWidth=k*l;this.pixelHeight=q*l;this.canvas=document.createElement("canvas");this.ctx=this.canvas.getContext("2d");g.sizePixels(this.ctx,k,q,l)}g.sizePixels=function(k,q,l,m){var p=k.canvas;p.width=q*m;p.height=l*m;p.style.width=q+"px";p.style.height= l+"px";k.setTransform(1,0,0,1,0,0);k.scale(m,m)};g.prototype.blit=function(k,q,l){void 0===q&&(q=0);void 0===l&&(l=0);k.drawImage(this.canvas,q,l,this.screenWidth,this.screenHeight)};g.prototype.blitCenter=function(k,q,l){void 0===q&&(q=0);void 0===l&&(l=0);this.blit(k,Math.floor(q-this.screenWidth/2),Math.floor(l-this.screenHeight/2))};g.prototype.resize=function(k,q,l){void 0===l&&(l=!1);var m=this.devicePixelRatio;this.screenWidth=k;this.screenHeight=q;this.pixelWidth=k*m;this.pixelHeight=q*m; g.sizePixels(this.ctx,k,q,m);l&&this.ctx.translate(k/2,k/2);return this};g.prototype.clear=function(k){var q=this.pixelWidth,l=this.pixelHeight,m=this.ctx;m.save();m.setTransform(1,0,0,1,0,0);null==k?m.clearRect(0,0,q,l):(m.fillStyle=k,m.fillRect(0,0,q,l));m.restore();return this};g.prototype.getImageData=function(){return this.ctx.getImageData(0,0,this.pixelWidth,this.pixelHeight)};return g}();e.CanvasBuffer=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor= m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(13),l=g(0);c=function(m){function p(){var n=null!==m&&m.apply(this,arguments)||this;n._clickedDown=!1;n._doubleClicking=!1;n._onClickCallbacks=new l.CallbackSet;n._onDoubleClickCallbacks=new l.CallbackSet;n._mouseDownCallback=function(t){return n._handleClickDown(t)};n._mouseUpCallback=function(t,v){return n._handleClickUp(t,v)};n._dblClickCallback=function(t,v){return n._handleDblClick(t, v)};n._touchStartCallback=function(t,v){return n._handleClickDown(v[t[0]])};n._touchEndCallback=function(t,v,x){return n._handleClickUp(v[t[0]],x)};n._touchCancelCallback=function(){return n._clickedDown=!1};return n}k(p,m);p.prototype._anchor=function(n){m.prototype._anchor.call(this,n);this._mouseDispatcher=q.Mouse.getDispatcher(n);this._mouseDispatcher.onMouseDown(this._mouseDownCallback);this._mouseDispatcher.onMouseUp(this._mouseUpCallback);this._mouseDispatcher.onDblClick(this._dblClickCallback); this._touchDispatcher=q.Touch.getDispatcher(n);this._touchDispatcher.onTouchStart(this._touchStartCallback);this._touchDispatcher.onTouchEnd(this._touchEndCallback);this._touchDispatcher.onTouchCancel(this._touchCancelCallback)};p.prototype._unanchor=function(){m.prototype._unanchor.call(this);this._mouseDispatcher.offMouseDown(this._mouseDownCallback);this._mouseDispatcher.offMouseUp(this._mouseUpCallback);this._mouseDispatcher.offDblClick(this._dblClickCallback);this._mouseDispatcher=null;this._touchDispatcher.offTouchStart(this._touchStartCallback); this._touchDispatcher.offTouchEnd(this._touchEndCallback);this._touchDispatcher.offTouchCancel(this._touchCancelCallback);this._touchDispatcher=null};p.prototype._handleClickDown=function(n){n=this._translateToComponentSpace(n);this._isInsideComponent(n)&&(this._clickedDown=!0,this._clickedPoint=n)};p.prototype._handleClickUp=function(n,t){var v=this,x=this._translateToComponentSpace(n);this._clickedDown&&p._pointsEqual(x,this._clickedPoint)&&setTimeout(function(){v._doubleClicking||v._onClickCallbacks.callCallbacks(x, t)},0);this._clickedDown=!1};p.prototype._handleDblClick=function(n,t){var v=this;n=this._translateToComponentSpace(n);this._doubleClicking=!0;this._onDoubleClickCallbacks.callCallbacks(n,t);setTimeout(function(){return v._doubleClicking=!1},0)};p._pointsEqual=function(n,t){return n.x===t.x&&n.y===t.y};p.prototype.onClick=function(n){this._onClickCallbacks.add(n)};p.prototype.offClick=function(n){this._onClickCallbacks.delete(n)};p.prototype.onDoubleClick=function(n){this._onDoubleClickCallbacks.add(n)}; p.prototype.offDoubleClick=function(n){this._onDoubleClickCallbacks.delete(n);return this};return p}(g(15).Interaction);e.Click=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(13),l=g(0);c=function(m){function p(){var n=null!==m&&m.apply(this,arguments)||this;n._dragging=!1;n._constrainedToComponent=!0;n._mouseFilter=p._DEFAULT_MOUSE_FILTER; n._dragStartCallbacks=new l.CallbackSet;n._dragCallbacks=new l.CallbackSet;n._dragEndCallbacks=new l.CallbackSet;n._mouseDownCallback=function(t,v){return n._startDrag(t,v)};n._mouseMoveCallback=function(t){return n._doDrag(t)};n._mouseUpCallback=function(t,v){return n._endDrag(t,v)};n._touchStartCallback=function(t,v,x){return n._startDrag(v[t[0]],x)};n._touchMoveCallback=function(t,v){return n._doDrag(v[t[0]])};n._touchEndCallback=function(t,v,x){return n._endDrag(v[t[0]],x)};return n}k(p,m);p.prototype._anchor= function(n){m.prototype._anchor.call(this,n);this._mouseDispatcher=q.Mouse.getDispatcher(this._componentAttachedTo);this._mouseDispatcher.onMouseDown(this._mouseDownCallback);this._mouseDispatcher.onMouseMove(this._mouseMoveCallback);this._mouseDispatcher.onMouseUp(this._mouseUpCallback);this._touchDispatcher=q.Touch.getDispatcher(this._componentAttachedTo);this._touchDispatcher.onTouchStart(this._touchStartCallback);this._touchDispatcher.onTouchMove(this._touchMoveCallback);this._touchDispatcher.onTouchEnd(this._touchEndCallback)}; p.prototype._unanchor=function(){m.prototype._unanchor.call(this);this._mouseDispatcher.offMouseDown(this._mouseDownCallback);this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);this._mouseDispatcher.offMouseUp(this._mouseUpCallback);this._mouseDispatcher=null;this._touchDispatcher.offTouchStart(this._touchStartCallback);this._touchDispatcher.offTouchMove(this._touchMoveCallback);this._touchDispatcher.offTouchEnd(this._touchEndCallback);this._touchDispatcher=null};p.prototype._translateAndConstrain= function(n){n=this._translateToComponentSpace(n);return this._constrainedToComponent?{x:l.Math.clamp(n.x,0,this._componentAttachedTo.width()),y:l.Math.clamp(n.y,0,this._componentAttachedTo.height())}:n};p.prototype._startDrag=function(n,t){t instanceof MouseEvent&&!this._mouseFilter(t)||(n=this._translateToComponentSpace(n),this._isInsideComponent(n)&&(t.preventDefault(),this._dragging=!0,this._dragOrigin=n,this._dragStartCallbacks.callCallbacks(this._dragOrigin)))};p.prototype._doDrag=function(n){this._dragging&& this._dragCallbacks.callCallbacks(this._dragOrigin,this._translateAndConstrain(n))};p.prototype._endDrag=function(n,t){t instanceof MouseEvent&&0!==t.button||!this._dragging||(this._dragging=!1,this._dragEndCallbacks.callCallbacks(this._dragOrigin,this._translateAndConstrain(n)))};p.prototype.constrainedToComponent=function(){this._constrainedToComponent=!1};p.prototype.mouseFilter=function(n){0!==arguments.length&&(this._mouseFilter=n)};p.prototype.onDragStart=function(n){this._dragStartCallbacks.add(n)}; p.prototype.offDragStart=function(n){this._dragStartCallbacks.delete(n)};p.prototype.onDrag=function(n){this._dragCallbacks.add(n)};p.prototype.offDrag=function(n){this._dragCallbacks.delete(n)};p.prototype.onDragEnd=function(n){this._dragEndCallbacks.add(n)};p.prototype.offDragEnd=function(n){this._dragEndCallbacks.delete(n)};return p}(g(15).Interaction);c._DEFAULT_MOUSE_FILTER=function(m){return 0===m.button};e.Drag=c},function(c,e,g){var k=this&&this.__extends||function(v,x){function y(){this.constructor= v}for(var z in x)x.hasOwnProperty(z)&&(v[z]=x[z]);v.prototype=null===x?Object.create(x):(y.prototype=x.prototype,new y)},q=g(1),l=g(13),m=g(3),p=g(0),n=g(25);c=g(15);var t=g(26);g=function(v){function x(y,z){var A=v.call(this)||this;A._wheelFilter=function(){return!0};A._wheelCallback=function(D,H){return A._handleWheelEvent(D,H)};A._touchStartCallback=function(D,H){return A._handleTouchStart(D,H)};A._touchMoveCallback=function(D,H){return A._handlePinch(D,H)};A._touchEndCallback=function(D){return A._handleTouchEnd(D)}; A._touchCancelCallback=function(D){return A._handleTouchEnd(D)};A._panEndCallbacks=new p.CallbackSet;A._zoomEndCallbacks=new p.CallbackSet;A._panZoomUpdateCallbacks=new p.CallbackSet;A._xScales=new p.Set;A._yScales=new p.Set;A._dragInteraction=new n.Drag;A._setupDragInteraction();A._touchIds=q.map();A._minDomainExtents=new p.Map;A._maxDomainExtents=new p.Map;A._minDomainValues=new p.Map;A._maxDomainValues=new p.Map;null!=y&&A.addXScale(y);null!=z&&A.addYScale(z);return A}k(x,v);x.prototype.dragInteraction= function(){return this._dragInteraction};x.prototype.wheelFilter=function(y){0!==arguments.length&&(this._wheelFilter=y)};x.prototype.pan=function(y){var z=this;this.xScales().forEach(function(A){A.pan(z._constrainedTranslation(A,y.x))});this.yScales().forEach(function(A){A.pan(z._constrainedTranslation(A,y.y))});this._panZoomUpdateCallbacks.callCallbacks()};x.prototype.zoom=function(y,z,A){var D=this;void 0===A&&(A=!0);if(null!=z){var H=z.x;var E=z.y;A&&(this.xScales().forEach(function(F){F=D._constrainedZoom(F, y,H);H=F.centerPoint;y=F.zoomAmount}),this.yScales().forEach(function(F){F=D._constrainedZoom(F,y,E);E=F.centerPoint;y=F.zoomAmount}))}this.xScales().forEach(function(F){var J=F.range();F.zoom(y,null==H?(J[1]+J[0])/2:H)});this.yScales().forEach(function(F){var J=F.range();F.zoom(y,null==E?(J[1]+J[0])/2:E)});this._panZoomUpdateCallbacks.callCallbacks();return{zoomAmount:y,centerValue:{centerX:H,centerY:E}}};x.prototype._anchor=function(y){v.prototype._anchor.call(this,y);this._dragInteraction.attachTo(y); this._mouseDispatcher=l.Mouse.getDispatcher(this._componentAttachedTo);this._mouseDispatcher.onWheel(this._wheelCallback);this._touchDispatcher=l.Touch.getDispatcher(this._componentAttachedTo);this._touchDispatcher.onTouchStart(this._touchStartCallback);this._touchDispatcher.onTouchMove(this._touchMoveCallback);this._touchDispatcher.onTouchEnd(this._touchEndCallback);this._touchDispatcher.onTouchCancel(this._touchCancelCallback)};x.prototype._unanchor=function(){v.prototype._unanchor.call(this);this._mouseDispatcher.offWheel(this._wheelCallback); this._mouseDispatcher=null;this._touchDispatcher.offTouchStart(this._touchStartCallback);this._touchDispatcher.offTouchMove(this._touchMoveCallback);this._touchDispatcher.offTouchEnd(this._touchEndCallback);this._touchDispatcher.offTouchCancel(this._touchCancelCallback);this._touchDispatcher=null;this._dragInteraction.detach()};x.prototype._handleTouchStart=function(y,z){for(var A=0;A<y.length&&2>this._touchIds.size();A++){var D=y[A];this._touchIds.set(D.toString(),this._translateToComponentSpace(z[D]))}}; x.prototype._handlePinch=function(y,z){var A=this;if(!(2>this._touchIds.size())){var D=this._touchIds.values();if(this._isInsideComponent(this._translateToComponentSpace(D[0]))&&this._isInsideComponent(this._translateToComponentSpace(D[1]))){var H=x._pointDistance(D[0],D[1]);if(0!==H){y.forEach(function(N){A._touchIds.has(N.toString())&&A._touchIds.set(N.toString(),A._translateToComponentSpace(z[N]))});y=this._touchIds.values();var E=x._pointDistance(y[0],y[1]);if(0!==E){var F=H/E,J=y.map(function(N, P){return{x:(N.x-D[P].x)/F,y:(N.y-D[P].y)/F}});H=x.centerPoint(D[0],D[1]);H=this.zoom(F,H);y=H.centerValue;var O=H.zoomAmount;H=y.centerX;y=y.centerY;E=D.map(function(N,P){return{x:J[P].x*O+N.x,y:J[P].y*O+N.y}});this.pan({x:H-(E[0].x+E[1].x)/2,y:y-(E[0].y+E[1].y)/2})}}}}};x.centerPoint=function(y,z){return{x:(Math.min(y.x,z.x)+Math.max(y.x,z.x))/2,y:(Math.max(y.y,z.y)+Math.min(y.y,z.y))/2}};x._pointDistance=function(y,z){return Math.sqrt(Math.pow(Math.max(y.x,z.x)-Math.min(y.x,z.x),2)+Math.pow(Math.max(y.y, z.y)-Math.min(y.y,z.y),2))};x.prototype._handleTouchEnd=function(y){var z=this;y.forEach(function(A){z._touchIds.remove(A.toString())});0<this._touchIds.size()&&this._zoomEndCallbacks.callCallbacks()};x.prototype._handleWheelEvent=function(y,z){this._wheelFilter(z)&&(y=this._translateToComponentSpace(y),this._isInsideComponent(y)&&(z.preventDefault(),this.zoom(Math.pow(2,(0!==z.deltaY?z.deltaY:z.deltaX)*(z.deltaMode?x._PIXELS_PER_LINE:1)*.002),y),this._zoomEndCallbacks.callCallbacks()))};x.prototype._constrainedZoom= function(y,z,A){return t.constrainedZoom(y,z,A,this.minDomainExtent(y),this.maxDomainExtent(y),this.minDomainValue(y),this.maxDomainValue(y))};x.prototype._constrainedTranslation=function(y,z){return t.constrainedTranslation(y,z,this.minDomainValue(y),this.maxDomainValue(y))};x.prototype._setupDragInteraction=function(){var y=this;this._dragInteraction.constrainedToComponent();var z;this._dragInteraction.onDragStart(function(){return z=null});this._dragInteraction.onDrag(function(A,D){2<=y._touchIds.size()|| (y.pan({x:(null==z?A.x:z.x)-D.x,y:(null==z?A.y:z.y)-D.y}),z=D)});this._dragInteraction.onDragEnd(function(){return y._panEndCallbacks.callCallbacks()})};x.prototype._nonLinearScaleWithExtents=function(y){return null!=this.minDomainExtent(y)&&null!=this.maxDomainExtent(y)&&!(y instanceof m.Linear)&&!(y instanceof m.Time)};x.prototype.xScales=function(){var y=[];this._xScales.forEach(function(z){y.push(z)});return y};x.prototype.yScales=function(){var y=[];this._yScales.forEach(function(z){y.push(z)}); return y};x.prototype.addXScale=function(y){this._xScales.add(y)};x.prototype.removeXScale=function(y){this._xScales.delete(y);this._minDomainExtents.delete(y);this._maxDomainExtents.delete(y);this._minDomainValues.delete(y);this._maxDomainValues.delete(y);return this};x.prototype.addYScale=function(y){this._yScales.add(y)};x.prototype.removeYScale=function(y){this._yScales.delete(y);this._minDomainExtents.delete(y);this._maxDomainExtents.delete(y);this._minDomainValues.delete(y);this._maxDomainValues.delete(y); return this};x.prototype.minDomainExtent=function(y){return this._minDomainExtents.get(y)};x.prototype.maxDomainExtent=function(y){return this._maxDomainExtents.get(y)};x.prototype.minDomainValue=function(y,z){if(null==z)return this._minDomainValues.get(y);this._minDomainValues.set(y,z);return this};x.prototype.maxDomainValue=function(y,z){if(null==z)return this._maxDomainValues.get(y);this._maxDomainValues.set(y,z);return this};x.prototype.setMinMaxDomainValuesTo=function(y){this._minDomainValues.delete(y); this._maxDomainValues.delete(y);var z=y.getTransformationDomain(),A=z[1];this.minDomainValue(y,z[0]);this.maxDomainValue(y,A);return this};x.prototype.onPanEnd=function(y){this._panEndCallbacks.add(y)};x.prototype.offPanEnd=function(y){this._panEndCallbacks.delete(y);return this};x.prototype.onZoomEnd=function(y){this._zoomEndCallbacks.add(y)};x.prototype.offZoomEnd=function(y){this._zoomEndCallbacks.delete(y);return this};x.prototype.onPanZoomUpdate=function(y){this._panZoomUpdateCallbacks.add(y); return this};x.prototype.offPanZoomUpdate=function(y){this._panZoomUpdateCallbacks.delete(y);return this};return x}(c.Interaction);g._PIXELS_PER_LINE=120;e.PanZoom=g},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(13),l=g(0);c=function(m){function p(){var n=null!==m&&m.apply(this,arguments)||this;n._overComponent=!1;n._pointerEnterCallbacks= new l.CallbackSet;n._pointerMoveCallbacks=new l.CallbackSet;n._pointerExitCallbacks=new l.CallbackSet;n._mouseMoveCallback=function(t,v){return n._handleMouseEvent(t,v)};n._touchStartCallback=function(t,v,x){return n._handleTouchEvent(v[t[0]],x)};return n}k(p,m);p.prototype._anchor=function(n){m.prototype._anchor.call(this,n);this._mouseDispatcher=q.Mouse.getDispatcher(this._componentAttachedTo);this._mouseDispatcher.onMouseMove(this._mouseMoveCallback);this._touchDispatcher=q.Touch.getDispatcher(this._componentAttachedTo); this._touchDispatcher.onTouchStart(this._touchStartCallback)};p.prototype._unanchor=function(){m.prototype._unanchor.call(this);this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);this._mouseDispatcher=null;this._touchDispatcher.offTouchStart(this._touchStartCallback);this._touchDispatcher=null};p.prototype._handleMouseEvent=function(n,t){t=this._mouseDispatcher.eventInside(this._componentAttachedTo,t);this._handlePointerEvent(n,t)};p.prototype._handleTouchEvent=function(n,t){t=this._touchDispatcher.eventInside(this._componentAttachedTo, t);this._handlePointerEvent(n,t)};p.prototype._handlePointerEvent=function(n,t){n=this._translateToComponentSpace(n);var v=this._isInsideComponent(n);v&&t?(this._overComponent||this._pointerEnterCallbacks.callCallbacks(n),this._pointerMoveCallbacks.callCallbacks(n)):this._overComponent&&this._pointerExitCallbacks.callCallbacks(n);this._overComponent=v&&t};p.prototype.onPointerEnter=function(n){this._pointerEnterCallbacks.add(n);return this};p.prototype.offPointerEnter=function(n){this._pointerEnterCallbacks.delete(n); return this};p.prototype.onPointerMove=function(n){this._pointerMoveCallbacks.add(n)};p.prototype.offPointerMove=function(n){this._pointerMoveCallbacks.delete(n)};p.prototype.onPointerExit=function(n){this._pointerExitCallbacks.add(n)};p.prototype.offPointerExit=function(n){this._pointerExitCallbacks.delete(n);return this};return p}(g(15).Interaction);e.Pointer=c},function(c,e,g){var k=g(20);e.memThunk=function(){for(var q=[],l=0;l<arguments.length;l++)q[l]=arguments[l];var m=q.slice(0,-1),p=k.memoize(q[q.length- 1]);return function(){var n=this,t=m.map(function(v){return v.apply(n)});return p.apply(void 0,t)}}},function(c,e,g){var k=g(49);e.memoize=function(q){function l(){for(var v=[],x=0;x<arguments.length;x++)v[x]=arguments[x];if(n)return p;x=k.signArray(v);void 0===m||m.isDifferent(x)?(t&&console.log("cache miss! computing"),m=x,p=q.apply(this,v)):t&&console.log("cache hit!");return p}var m=void 0,p,n=!1,t=!1;l.doLocked=function(v){if(n)throw Error("Locking an already locked memoize function!");n=!0; v=v.apply(this);n=!1;return v};l.logPerformance=function(v){void 0===v&&(v=!0);t=v;return this};return l}},function(c,e,g){var k=this&&this.__extends||function(n,t){function v(){this.constructor=n}for(var x in t)t.hasOwnProperty(x)&&(n[x]=t[x]);n.prototype=null===t?Object.create(t):(v.prototype=t.prototype,new v)},q=g(3),l=g(0),m=g(27),p=g(2);c=function(n){function t(v){void 0===v&&(v="vertical");v=n.call(this,v)||this;v._clusterOffsets=new l.Map;return v}k(t,n);t.prototype._generateAttrToProjector= function(){function v(){return z.rangeBand()}var x=this,y=n.prototype._generateAttrToProjector.call(this),z=this._makeInnerScale();y.width=this._isVertical?v:y.width;y.height=this._isVertical?y.height:v;var A=y.x,D=y.y;y.x=this._isVertical?function(H,E,F){return A(H,E,F)+x._clusterOffsets.get(F)}:function(H,E,F){return A(H,E,F)};y.y=this._isVertical?function(H,E,F){return D(H,E,F)}:function(H,E,F){return D(H,E,F)+x._clusterOffsets.get(F)};return y};t.prototype._updateClusterPosition=function(){var v= this,x=this._makeInnerScale();this.datasets().forEach(function(y,z){return v._clusterOffsets.set(y,x.scale(String(z))-x.rangeBand()/2)})};t.prototype._makeInnerScale=function(){var v=new q.Category;v.domain(this.datasets().map(function(y,z){return String(z)}));var x=p.Plot._scaledAccessor(this.attr(m.Bar._BAR_THICKNESS_KEY));v.range([0,x(null,0,null)]);return v};t.prototype._getDataToDraw=function(){this._updateClusterPosition();return n.prototype._getDataToDraw.call(this)};return t}(m.Bar);e.ClusteredBar= c},function(c,e,g){var k=this&&this.__extends||function(D,H){function E(){this.constructor=D}for(var F in H)H.hasOwnProperty(F)&&(D[F]=H[F]);D.prototype=null===H?Object.create(H):(E.prototype=H.prototype,new E)},q=g(1),l=g(5),m=g(7),p=g(8),n=g(3),t=g(0),v=g(44),x=g(45),y=g(6),z=g(35),A=g(2);c=function(D){function H(){var E=D.call(this)||this;E._startAngle=0;E._endAngle=2*Math.PI;E._labelFormatter=p.identity();E._labelsEnabled=!1;E.innerRadius(0);E.outerRadius(function(){var F=E._pieCenter();return Math.min(Math.max(E.width()- F.x,F.x),Math.max(E.height()-F.y,F.y))});E.addClass("pie-plot");E.attr("fill",function(F,J){return String(J)},new n.Color);E._strokeDrawers=new t.Map;return E}k(H,D);H.prototype._setup=function(){var E=this;D.prototype._setup.call(this);this._strokeDrawers.forEach(function(F){return F.attachTo(E._renderArea)})};H.prototype.computeLayout=function(E,F,J){D.prototype.computeLayout.call(this,E,F,J);E=this._pieCenter();this._renderArea.attr("transform","translate("+E.x+","+E.y+")");E=Math.min(Math.max(this.width()- E.x,E.x),Math.max(this.height()-E.y,E.y));null!=this.innerRadius().scale&&this.innerRadius().scale.range([0,E]);null!=this.outerRadius().scale&&this.outerRadius().scale.range([0,E]);return this};H.prototype.addDataset=function(E){D.prototype.addDataset.call(this,E);return this};H.prototype._addDataset=function(E){if(1===this.datasets().length)return t.Window.warn("Only one dataset is supported in Pie plots"),this;this._updatePieAngles();var F=new x.ArcOutlineSVGDrawer;this._isSetup&&F.attachTo(this._renderArea); this._strokeDrawers.set(E,F);D.prototype._addDataset.call(this,E);return this};H.prototype.removeDataset=function(E){D.prototype.removeDataset.call(this,E)};H.prototype._removeDatasetNodes=function(E){D.prototype._removeDatasetNodes.call(this,E);this._strokeDrawers.get(E).remove()};H.prototype._removeDataset=function(E){D.prototype._removeDataset.call(this,E);this._startAngles=[];this._endAngles=[];return this};H.prototype.selections=function(E){var F=this;void 0===E&&(E=this.datasets());var J=D.prototype.selections.call(this, E).nodes();E.forEach(function(O){O=F._strokeDrawers.get(O);null!=O&&J.push.apply(J,O.getVisualPrimitives())});return q.selectAll(J)};H.prototype._onDatasetUpdate=function(){D.prototype._onDatasetUpdate.call(this);this._updatePieAngles();this.render()};H.prototype._createDrawer=function(){return new y.ProxyDrawer(function(){return new v.ArcSVGDrawer},function(){z.warn("canvas renderer is not supported on Pie Plot!");return null})};H.prototype.entities=function(E){var F=this;void 0===E&&(E=this.datasets()); return D.prototype.entities.call(this,E).map(function(J){J.position.x+=F.width()/2;J.position.y+=F.height()/2;var O=q.select(F._strokeDrawers.get(J.dataset).getVisualPrimitiveAtIndex(J.index));J.strokeSelection=O;return J})};H.prototype.sectorValue=function(){return this._propertyBindings.get(H._SECTOR_VALUE_KEY)};H.prototype.innerRadius=function(E,F){if(null==E)return this._propertyBindings.get(H._INNER_RADIUS_KEY);this._bindProperty(H._INNER_RADIUS_KEY,E,F);this.render();return this};H.prototype.outerRadius= function(E,F){if(null==E)return this._propertyBindings.get(H._OUTER_RADIUS_KEY);this._bindProperty(H._OUTER_RADIUS_KEY,E,F);this.render();return this};H.prototype.startAngle=function(E){if(null==E)return this._startAngle;this._startAngle=E;this._updatePieAngles();this.render();return this};H.prototype.endAngle=function(E){if(null==E)return this._endAngle;this._endAngle=E;this._updatePieAngles();this.render();return this};H.prototype.labelsEnabled=function(E){if(null==E)return this._labelsEnabled; this._labelsEnabled=E;this.render();return this};H.prototype.labelFormatter=function(E){if(null==E)return this._labelFormatter;this._labelFormatter=E;this.render();return this};H.prototype.entitiesAt=function(E){var F=this.width()/2,J=this.height()/2;E=this._sliceIndexForPoint({x:E.x-F,y:E.y-J});return null==E?[]:[this.entities()[E]]};H.prototype._propertyProjectors=function(){var E=this,F=D.prototype._propertyProjectors.call(this),J=A.Plot._scaledAccessor(this.innerRadius()),O=A.Plot._scaledAccessor(this.outerRadius()); F.d=function(N,P,V){return q.arc().innerRadius(J(N,P,V)).outerRadius(O(N,P,V)).startAngle(E._startAngles[P]).endAngle(E._endAngles[P])(N,P)};return F};H.prototype._updatePieAngles=function(){if(null!=this.sectorValue()&&0!==this.datasets().length){var E=A.Plot._scaledAccessor(this.sectorValue()),F=this.datasets()[0],J=this._getDataToDraw().get(F);J=q.pie().sort(null).startAngle(this._startAngle).endAngle(this._endAngle).value(function(O,N){return E(O,N,F)})(J);this._startAngles=J.map(function(O){return O.startAngle}); this._endAngles=J.map(function(O){return O.endAngle})}};H.prototype._pieCenter=function(){var E=this._startAngle<this._endAngle?this._startAngle:this._endAngle,F=this._startAngle<this._endAngle?this._endAngle:this._startAngle,J=Math.sin(E);E=Math.cos(E);var O=Math.sin(F);F=Math.cos(F);var N;if(0<=J&&0<=O)if(0<=E&&0<=F){var P=E;var V=N=0;var T=O}else 0>E&&0>F?(P=0,N=-F,V=0,T=J):0<=E&&0>F?(P=E,N=-F,V=0,T=J):0>E&&0<=F&&(V=N=P=1,T=Math.max(J,O));else 0<=J&&0>O?0<=E&&0<=F?(P=Math.max(E,F),T=V=N=1):0>E&& 0>F?(P=0,N=1,V=-O,T=J):0<=E&&0>F?(P=E,N=1,V=-O,T=1):0>E&&0<=F&&(P=F,V=N=1,T=J):0>J&&0<=O?0<=E&&0<=F?(P=1,N=0,V=-J,T=O):0>E&&0>F?(P=1,N=Math.max(-E,-F),T=V=1):0<=E&&0>F?(P=1,N=-F,V=-J,T=1):0>E&&0<=F&&(P=1,N=-E,V=1,T=O):0>J&&0>O&&(0<=E&&0<=F?(P=F,N=0,V=-J,T=0):0>E&&0>F?(P=0,N=-E,V=-O,T=0):0<=E&&0>F?(N=P=1,V=Math.max(E,-F),T=1):0>E&&0<=F&&(P=F,N=-E,V=1,T=0));return{x:0==V+T?0:V/(V+T)*this.width(),y:0==P+N?0:P/(P+N)*this.height()}};H.prototype._getDataToDraw=function(){var E=D.prototype._getDataToDraw.call(this); if(0===this.datasets().length)return E;var F=A.Plot._scaledAccessor(this.sectorValue()),J=this.datasets()[0],O=E.get(J).filter(function(N,P){return H._isValidData(F(N,P,J))});E.set(J,O);return E};H._isValidData=function(E){return t.Math.isValidNumber(E)&&0<=E};H.prototype._pixelPoint=function(E,F,J){var O=A.Plot._scaledAccessor(this.sectorValue());if(!H._isValidData(O(E,F,J)))return{x:NaN,y:NaN};var N=A.Plot._scaledAccessor(this.innerRadius())(E,F,J);E=A.Plot._scaledAccessor(this.outerRadius())(E, F,J);N=(N+E)/2;E=q.pie().sort(null).value(function(P,V){P=O(P,V,J);return H._isValidData(P)?P:0}).startAngle(this._startAngle).endAngle(this._endAngle)(J.data());F=(E[F].startAngle+E[F].endAngle)/2;return{x:N*Math.sin(F),y:-N*Math.cos(F)}};H.prototype._additionalPaint=function(E){var F=this;this._renderArea.select(".label-area").remove();this._labelsEnabled&&t.Window.setTimeout(function(){return F._drawLabels()},E);var J=this._generateStrokeDrawSteps(),O=this._getDataToDraw();this.datasets().forEach(function(N){var P= A.Plot.applyDrawSteps(J,N);F._strokeDrawers.get(N).draw(O.get(N),P)})};H.prototype._generateStrokeDrawSteps=function(){return[{attrToProjector:this._getAttrToProjector(),animator:new m.Null}]};H.prototype._sliceIndexForPoint=function(E){var F=Math.sqrt(Math.pow(E.x,2)+Math.pow(E.y,2)),J=Math.acos(-E.y/F);0>E.x&&(J=2*Math.PI-J);for(E=0;E<this._startAngles.length;E++)if(this._startAngles[E]<J&&this._endAngles[E]>J){var O=E;break}if(void 0!==O){E=this.datasets()[0];var N=E.data()[O];J=this.innerRadius().accessor(N, O,E);E=this.outerRadius().accessor(N,O,E);if(F>J&&F<E)return O}return null};H.prototype._drawLabels=function(){var E=this,F=this._getAttrToProjector(),J=this._renderArea.append("g").classed("label-area",!0),O=new l.SvgContext(J.node()),N=new l.CacheMeasurer(O),P=new l.Writer(N,O),V=this.datasets()[0];this._getDataToDraw().get(V).forEach(function(T,aa){var da=E.sectorValue().accessor(T,aa,V);if(t.Math.isValidNumber(da)){da=E._labelFormatter(da,T,aa,V);var va=N.measure(da),Da=(E._endAngles[aa]+E._startAngles[aa])/ 2,na=E.outerRadius().accessor(T,aa,V);E.outerRadius().scale&&(na=E.outerRadius().scale.scale(na));var ya=E.innerRadius().accessor(T,aa,V);E.innerRadius().scale&&(ya=E.innerRadius().scale.scale(ya));ya=(na+ya)/2;na=Math.sin(Da)*ya-va.width/2;ya=-Math.cos(Da)*ya-va.height/2;var Pa=[{x:na,y:ya},{x:na,y:ya+va.height},{x:na+va.width,y:ya},{x:na+va.width,y:ya+va.height}];(Da=Pa.every(function(Ja){return Math.abs(Ja.x)<=E.width()/2&&Math.abs(Ja.y)<=E.height()/2}))&&(Da=Pa.map(function(Ja){return E._sliceIndexForPoint(Ja)}).every(function(Ja){return Ja=== aa}));T=F.fill(T,aa,V);T=1.6*t.Color.contrast("white",T)<t.Color.contrast("black",T);na=J.append("g").attr("transform","translate("+na+","+ya+")");na.classed(T?"dark-label":"light-label",!0);na.style("visibility",Da?"inherit":"hidden");P.write(da,va.width,va.height,{xAlign:"center",yAlign:"center"},na.node())}})};return H}(A.Plot);c._INNER_RADIUS_KEY="inner-radius";c._OUTER_RADIUS_KEY="outer-radius";c._SECTOR_VALUE_KEY="sector-value";e.Pie=c},function(c,e,g){var k=this&&this.__extends||function(z, A){function D(){this.constructor=z}for(var H in A)A.hasOwnProperty(H)&&(z[H]=A[H]);z.prototype=null===A?Object.create(A):(D.prototype=A.prototype,new D)},q=g(1),l=g(5),m=g(7),p=g(14),n=g(6),t=g(34),v=g(3),x=g(0),y=g(2);c=function(z){function A(){var D=z.call(this)||this;D._labelsEnabled=!1;D._label=null;D.animator("rectangles",new m.Null);D.addClass("rectangle-plot");D.attr("fill",(new v.Color).range()[0]);return D}k(A,z);A.prototype._createDrawer=function(){return new n.ProxyDrawer(function(){return new t.RectangleSVGDrawer}, function(D){return new p.RectangleCanvasDrawer(D)})};A.prototype._generateAttrToProjector=function(){var D=this,H=z.prototype._generateAttrToProjector.call(this),E=y.Plot._scaledAccessor(this.x()),F=H[A._X2_KEY],J=y.Plot._scaledAccessor(this.y()),O=H[A._Y2_KEY],N=this.x().scale,P=this.y().scale;null!=F?(H.width=function(V,T,aa){return Math.abs(F(V,T,aa)-E(V,T,aa))},H.x=function(V,T,aa){return Math.min(F(V,T,aa),E(V,T,aa))}):(H.width=function(){return D._rectangleWidth(N)},H.x=function(V,T,aa){return E(V, T,aa)-.5*H.width(V,T,aa)});null!=O?(H.height=function(V,T,aa){return Math.abs(O(V,T,aa)-J(V,T,aa))},H.y=function(V,T,aa){return Math.max(O(V,T,aa),J(V,T,aa))-H.height(V,T,aa)}):(H.height=function(){return D._rectangleWidth(P)},H.y=function(V,T,aa){return J(V,T,aa)-.5*H.height(V,T,aa)});delete H[A._X2_KEY];delete H[A._Y2_KEY];return H};A.prototype._generateDrawSteps=function(){return[{attrToProjector:this._getAttrToProjector(),animator:this._getAnimator("rectangles")}]};A.prototype._filterForProperty= function(D){return"x2"===D?z.prototype._filterForProperty.call(this,"x"):"y2"===D?z.prototype._filterForProperty.call(this,"y"):z.prototype._filterForProperty.call(this,D)};A.prototype.x=function(D,H,E){if(null==D)return z.prototype.x.call(this);null==H?z.prototype.x.call(this,D):z.prototype.x.call(this,D,H,E);null!=H&&(E=(D=this.x2())&&D.accessor,null!=E&&this._bindProperty(A._X2_KEY,E,H,D.postScale));H instanceof v.Category&&H.innerPadding(0).outerPadding(0);return this};A.prototype.x2=function(D){if(null== D)return this._propertyBindings.get(A._X2_KEY);var H=this.x();this._bindProperty(A._X2_KEY,D,H&&H.scale,void 0);this.render();return this};A.prototype.y=function(D,H,E){if(null==D)return z.prototype.y.call(this);null==H?z.prototype.y.call(this,D):z.prototype.y.call(this,D,H,E);null!=H&&(E=(D=this.y2())&&D.accessor,null!=E&&this._bindProperty(A._Y2_KEY,E,H,D.postScale));H instanceof v.Category&&H.innerPadding(0).outerPadding(0);return this};A.prototype.y2=function(D){if(null==D)return this._propertyBindings.get(A._Y2_KEY); var H=this.y();this._bindProperty(A._Y2_KEY,D,H&&H.scale,void 0);this.render();return this};A.prototype.entitiesAt=function(D){var H=this._getAttrToProjector();return this.entities().filter(function(E){var F=E.datum,J=E.index,O=E.dataset;E=H.x(F,J,O);var N=H.y(F,J,O),P=H.width(F,J,O);F=H.height(F,J,O);return E<=D.x&&D.x<=E+P&&N<=D.y&&D.y<=N+F})};A.prototype._entityBounds=function(D){return this._entityBBox(D.datum,D.index,D.dataset,this._getAttrToProjector())};A.prototype._entityBBox=function(D,H, E,F){return{x:F.x(D,H,E),y:F.y(D,H,E),width:F.width(D,H,E),height:F.height(D,H,E)}};A.prototype.label=function(D){if(null==D)return this._label;this._label=D;this.render();return this};A.prototype.labelsEnabled=function(D){if(null==D)return this._labelsEnabled;this._labelsEnabled=D;this.render();return this};A.prototype._propertyProjectors=function(){var D=z.prototype._propertyProjectors.call(this);null!=this.x2()&&(D.x2=y.Plot._scaledAccessor(this.x2()));null!=this.y2()&&(D.y2=y.Plot._scaledAccessor(this.y2())); return D};A.prototype._pixelPoint=function(D,H,E){var F=this._getAttrToProjector(),J=F.x(D,H,E),O=F.y(D,H,E),N=F.width(D,H,E);D=F.height(D,H,E);return{x:J+N/2,y:O+D/2}};A.prototype._rectangleWidth=function(D){if(D instanceof v.Category)return D.rangeBand();var H=D===this.x().scale?this.x().accessor:this.y().accessor,E=q.set(x.Array.flatten(this.datasets().map(function(O){return O.data().map(function(N,P){return H(N,P,O).valueOf()})}))).values().map(function(O){return+O}),F=x.Math.min(E,0);E=x.Math.max(E, 0);var J=D.scale(F);return(D.scale(E)-J)/Math.abs(E-F)};A.prototype._getDataToDraw=function(){var D=new x.Map,H=this._getAttrToProjector();this.datasets().forEach(function(E){var F=E.data().map(function(J,O){return x.Math.isValidNumber(H.x(J,O,E))&&x.Math.isValidNumber(H.y(J,O,E))&&x.Math.isValidNumber(H.width(J,O,E))&&x.Math.isValidNumber(H.height(J,O,E))?J:null});D.set(E,F)});return D};A.prototype._additionalPaint=function(D){var H=this;this._renderArea.selectAll(".label-area").remove();this._labelsEnabled&& null!=this.label()&&x.Window.setTimeout(function(){return H._drawLabels()},D)};A.prototype._drawLabels=function(){var D=this,H=this._getDataToDraw();this.datasets().forEach(function(E,F){return D._drawLabel(H,E,F)})};A.prototype._drawLabel=function(D,H,E){var F=this,J=this._getAttrToProjector(),O=this._renderArea.append("g").classed("label-area",!0),N=new l.SvgContext(O.node()),P=new l.CacheMeasurer(N),V=new l.Writer(P,N);N=this.x().scale.range();var T=this.y().scale.range(),aa=Math.min.apply(null, N),da=Math.max.apply(null,N),va=Math.min.apply(null,T),Da=Math.max.apply(null,T);D.get(H).forEach(function(na,ya){if(null!=na){var Pa=""+F.label()(na,ya,H),Ja=P.measure(Pa),Oa=J.x(na,ya,H),pa=J.y(na,ya,H),tb=J.width(na,ya,H),ea=J.height(na,ya,H);Ja.height<=ea&&Ja.width<=tb&&(ea=(ea-Ja.height)/2,Oa+=(tb-Ja.width)/2,pa+=ea,tb={min:Oa,max:Oa+Ja.width},ea={min:pa,max:pa+Ja.height},tb.min<aa||tb.max>da||ea.min<va||ea.max>Da||F._overlayLabel(tb,ea,ya,E,D)||(na=J.fill(na,ya,H),na=1.6*x.Color.contrast("white", na)<x.Color.contrast("black",na),Oa=O.append("g").attr("transform","translate("+Oa+","+pa+")"),Oa.classed(na?"dark-label":"light-label",!0),V.write(Pa,Ja.width,Ja.height,{xAlign:"center",yAlign:"center"},Oa.node())))}})};A.prototype._overlayLabel=function(D,H,E,F,J){for(var O=this._getAttrToProjector(),N=this.datasets(),P=F;P<N.length;P++)for(var V=N[P],T=J.get(V),aa=P===F?E+1:0;aa<T.length;aa++)if(x.DOM.intersectsBBox(D,H,this._entityBBox(T[aa],aa,V,O)))return!0;return!1};return A}(g(16).XYPlot); c._X2_KEY="x2";c._Y2_KEY="y2";e.Rectangle=c},function(c,e,g){var k=this&&this.__extends||function(z,A){function D(){this.constructor=z}for(var H in A)A.hasOwnProperty(H)&&(z[H]=A[H]);z.prototype=null===A?Object.create(A):(D.prototype=A.prototype,new D)},q=g(31),l=g(6),m=g(48),p=g(7),n=g(14),t=g(3),v=g(0),x=g(19),y=g(2);c=function(z){function A(){var D=z.call(this)||this;D.addClass("scatter-plot");var H=new p.Easing;H.startDelay(5);H.stepDuration(250);H.maxTotalDuration(y.Plot._ANIMATION_MAX_DURATION); D.animator(x.Animator.MAIN,H);D.attr("opacity",.6);D.attr("fill",(new t.Color).range()[0]);D.size(6);var E=q.circle();D.symbol(function(){return E});return D}k(A,z);A.prototype._buildLightweightPlotEntities=function(D){var H=this;return z.prototype._buildLightweightPlotEntities.call(this,D).map(function(E){var F=y.Plot._scaledAccessor(H.size())(E.datum,E.index,E.dataset);E.diameter=F;return E})};A.prototype._createDrawer=function(D){var H=this;return new l.ProxyDrawer(function(){return new m.SymbolSVGDrawer}, function(E){return new n.CanvasDrawer(E,m.makeSymbolCanvasDrawStep(D,function(){return y.Plot._scaledAccessor(H.symbol())},function(){return y.Plot._scaledAccessor(H.size())}))})};A.prototype.size=function(D,H){if(null==D)return this._propertyBindings.get(A._SIZE_KEY);this._bindProperty(A._SIZE_KEY,D,H);this.render();return this};A.prototype.symbol=function(D){if(null==D)return this._propertyBindings.get(A._SYMBOL_KEY);this._propertyBindings.set(A._SYMBOL_KEY,{accessor:D});this.render();return this}; A.prototype._generateDrawSteps=function(){var D=[];if(this._animateOnNextRender()){var H=this._getAttrToProjector(),E=y.Plot._scaledAccessor(this.symbol());H.d=function(F,J,O){return E(F,J,O)(0)(null)};D.push({attrToProjector:H,animator:this._getAnimator(x.Animator.RESET)})}D.push({attrToProjector:this._getAttrToProjector(),animator:this._getAnimator(x.Animator.MAIN)});return D};A.prototype._propertyProjectors=function(){var D=z.prototype._propertyProjectors.call(this),H=y.Plot._scaledAccessor(this.x()), E=y.Plot._scaledAccessor(this.y());D.x=H;D.y=E;D.transform=function(F,J,O){return"translate("+H(F,J,O)+","+E(F,J,O)+")"};D.d=this._constructSymbolGenerator();return D};A.prototype._constructSymbolGenerator=function(){var D=y.Plot._scaledAccessor(this.symbol()),H=y.Plot._scaledAccessor(this.size());return function(E,F,J){return D(E,F,J)(H(E,F,J))(null)}};A.prototype._entityBounds=function(D){return{x:D.position.x-D.diameter/2,y:D.position.y-D.diameter/2,width:D.diameter,height:D.diameter}};A.prototype._entityVisibleOnPlot= function(D,H){var E={min:H.topLeft.x,max:H.bottomRight.x};H={min:H.topLeft.y,max:H.bottomRight.y};D=this._entityBounds(D);return v.DOM.intersectsBBox(E,H,D)};A.prototype.entitiesAt=function(D){var H=y.Plot._scaledAccessor(this.x()),E=y.Plot._scaledAccessor(this.y()),F=y.Plot._scaledAccessor(this.size());return this.entities().filter(function(J){var O=J.datum,N=J.index,P=J.dataset;J=H(O,N,P);var V=E(O,N,P);O=F(O,N,P);return J-O/2<=D.x&&D.x<=J+O/2&&V-O/2<=D.y&&D.y<=V+O/2})};return A}(g(16).XYPlot); c._SIZE_KEY="size";c._SYMBOL_KEY="symbol";e.Scatter=c},function(c,e,g){var k=this&&this.__extends||function(v,x){function y(){this.constructor=v}for(var z in x)x.hasOwnProperty(z)&&(v[z]=x[z]);v.prototype=null===x?Object.create(x):(y.prototype=x.prototype,new y)},q=g(7),l=g(6),m=g(47),p=g(3),n=g(35),t=g(2);c=function(v){function x(){var y=v.call(this)||this;y.addClass("segment-plot");y.attr("stroke",(new p.Color).range()[0]);y.attr("stroke-width","2px");return y}k(x,v);x.prototype._createDrawer=function(){return new l.ProxyDrawer(function(){return new m.SegmentSVGDrawer}, function(){n.warn("canvas renderer is not supported on Segment Plot!");return null})};x.prototype._generateDrawSteps=function(){return[{attrToProjector:this._getAttrToProjector(),animator:new q.Null}]};x.prototype._filterForProperty=function(y){return"x2"===y?v.prototype._filterForProperty.call(this,"x"):"y2"===y?v.prototype._filterForProperty.call(this,"y"):v.prototype._filterForProperty.call(this,y)};x.prototype.x=function(y,z){if(null==y)return v.prototype.x.call(this);null==z?v.prototype.x.call(this, y):(v.prototype.x.call(this,y,z),y=(y=this.x2())&&y.accessor,null!=y&&this._bindProperty(x._X2_KEY,y,z));return this};x.prototype.x2=function(y){if(null==y)return this._propertyBindings.get(x._X2_KEY);var z=this.x();this._bindProperty(x._X2_KEY,y,z&&z.scale);this.render();return this};x.prototype.y=function(y,z){if(null==y)return v.prototype.y.call(this);null==z?v.prototype.y.call(this,y):(v.prototype.y.call(this,y,z),y=(y=this.y2())&&y.accessor,null!=y&&this._bindProperty(x._Y2_KEY,y,z));return this}; x.prototype.y2=function(y){if(null==y)return this._propertyBindings.get(x._Y2_KEY);var z=this.y();this._bindProperty(x._Y2_KEY,y,z&&z.scale);this.render();return this};x.prototype._propertyProjectors=function(){var y=v.prototype._propertyProjectors.call(this);y.x1=t.Plot._scaledAccessor(this.x());y.x2=null==this.x2()?t.Plot._scaledAccessor(this.x()):t.Plot._scaledAccessor(this.x2());y.y1=t.Plot._scaledAccessor(this.y());y.y2=null==this.y2()?t.Plot._scaledAccessor(this.y()):t.Plot._scaledAccessor(this.y2()); return y};x.prototype.entitiesAt=function(y){y=this.entityNearest(y);return null!=y?[y]:[]};x.prototype.entitiesIn=function(y,z){if(null==z){var A={min:y.topLeft.x,max:y.bottomRight.x};y={min:y.topLeft.y,max:y.bottomRight.y}}else A=y,y=z;return this._entitiesIntersecting(A,y)};x.prototype._entitiesIntersecting=function(y,z){var A=this,D=[],H=this._getAttrToProjector();this.entities().forEach(function(E){A._lineIntersectsBox(E,y,z,H)&&D.push(E)});return D};x.prototype._lineIntersectsBox=function(y, z,A,D){var H=this,E=D.x1(y.datum,y.index,y.dataset),F=D.x2(y.datum,y.index,y.dataset),J=D.y1(y.datum,y.index,y.dataset);y=D.y2(y.datum,y.index,y.dataset);if(z.min<=E&&E<=z.max&&A.min<=J&&J<=A.max||z.min<=F&&F<=z.max&&A.min<=y&&y<=A.max)return!0;var O={x:E,y:J},N={x:F,y},P=[{x:z.min,y:A.min},{x:z.min,y:A.max},{x:z.max,y:A.max},{x:z.max,y:A.min}];return 0<P.filter(function(V,T){return 0!==T?H._lineIntersectsSegment(O,N,V,P[T-1])&&H._lineIntersectsSegment(V,P[T-1],O,N):!1}).length};x.prototype._lineIntersectsSegment= function(y,z,A,D){function H(E,F,J){return(F.x-E.x)*(J.y-F.y)-(F.y-E.y)*(J.x-F.x)}return 0>H(y,z,A)*H(y,z,D)};return x}(g(16).XYPlot);c._X2_KEY="x2";c._Y2_KEY="y2";e.Segment=c},function(c,e,g){var k=this&&this.__extends||function(t,v){function x(){this.constructor=t}for(var y in v)v.hasOwnProperty(y)&&(t[y]=v[y]);t.prototype=null===v?Object.create(v):(x.prototype=v.prototype,new x)},q=g(1),l=g(7),m=g(20),p=g(0);c=g(50);var n=g(2);g=function(t){function v(){var x=t.call(this)||this;x._stackingResult= m.memThunk(function(){return x.datasets()},function(){return x.x().accessor},function(){return x.y().accessor},function(){return x._stackingOrder},function(y,z,A,D){return p.Stacking.stack(y,z,A,D)});x._stackedExtent=m.memThunk(x._stackingResult,function(){return x.x().accessor},function(){return x._filterForProperty("y")},function(y,z,A){return p.Stacking.stackedExtent(y,z,A)});x._baselineValue=0;x._stackingOrder="bottomup";x.addClass("stacked-area-plot");x.attr("fill-opacity",1);x._baselineValueProvider= function(){return[x._baselineValue]};x.croppedRenderingEnabled(!1);return x}k(v,t);v.prototype.croppedRenderingEnabled=function(x){return null==x?t.prototype.croppedRenderingEnabled.call(this):x?(p.Window.warn("Warning: Stacked Area Plot does not support cropped rendering."),this):t.prototype.croppedRenderingEnabled.call(this,x)};v.prototype._getAnimator=function(){return new l.Null};v.prototype._setup=function(){t.prototype._setup.call(this);this._baseline=this._renderArea.append("line").classed("baseline", !0)};v.prototype.x=function(x,y){if(null==x)return t.prototype.x.call(this);null==y?t.prototype.x.call(this,x):t.prototype.x.call(this,x,y);this._checkSameDomain();return this};v.prototype.y=function(x,y){if(null==x)return t.prototype.y.call(this);null==y?t.prototype.y.call(this,x):t.prototype.y.call(this,x,y);this._checkSameDomain();return this};v.prototype.stackingOrder=function(x){if(null==x)return this._stackingOrder;this._stackingOrder=x;this._onDatasetUpdate();return this};v.prototype.downsamplingEnabled= function(){return t.prototype.downsamplingEnabled.call(this)};v.prototype._additionalPaint=function(){var x=this.y().scale.scale(this._baselineValue);x={x1:0,y1:x,x2:this.width(),y2:x};this._getAnimator("baseline").animate(this._baseline,x)};v.prototype._updateYScale=function(){var x=this.y();x=x&&x.scale;null!=x&&(x.addPaddingExceptionsProvider(this._baselineValueProvider),x.addIncludedValuesProvider(this._baselineValueProvider))};v.prototype._onDatasetUpdate=function(){this._checkSameDomain();t.prototype._onDatasetUpdate.call(this); return this};v.prototype.getExtentsForProperty=function(x){return"y"===x?[this._stackedExtent()]:t.prototype.getExtentsForProperty.call(this,x)};v.prototype._checkSameDomain=function(){if(this._projectorsReady()){var x=this.datasets(),y=this.x().accessor,z=x.map(function(D){return q.set(D.data().map(function(H,E){return y(H,E,D).toString()})).values()}),A=v._domainKeys(x,y);z.some(function(D){return D.length!==A.length})&&p.Window.warn("the domains across the datasets are not the same. Plot may produce unintended behavior.")}}; v._domainKeys=function(x,y){var z=q.set();x.forEach(function(A){A.data().forEach(function(D,H){z.add(y(D,H,A))})});return z.values()};v.prototype._propertyProjectors=function(){function x(E,F,J){return p.Stacking.normalizeKey(D(E,F,J))}var y=this,z=t.prototype._propertyProjectors.call(this),A=this.y().accessor,D=this.x().accessor,H=this._stackingResult();z.d=this._constructAreaProjector(n.Plot._scaledAccessor(this.x()),function(E,F,J){return y.y().scale.scale(+A(E,F,J)+H.get(J).get(x(E,F,J)).offset)}, function(E,F,J){return y.y().scale.scale(H.get(J).get(x(E,F,J)).offset)});return z};v.prototype._pixelPoint=function(x,y,z){var A=t.prototype._pixelPoint.call(this,x,y,z),D=this.x().accessor(x,y,z);x=this.y().accessor(x,y,z);z=this.y().scale.scale(+x+this._stackingResult().get(z).get(p.Stacking.normalizeKey(D)).offset);return{x:A.x,y:z}};return v}(c.Area);e.StackedArea=g},function(c,e,g){var k=this&&this.__extends||function(v,x){function y(){this.constructor=v}for(var z in x)x.hasOwnProperty(z)&& (v[z]=x[z]);v.prototype=null===x?Object.create(x):(y.prototype=x.prototype,new y)},q=g(5),l=g(8),m=g(20),p=g(0),n=g(27),t=g(2);c=function(v){function x(y){void 0===y&&(y="vertical");var z=v.call(this,y)||this;z._extremaFormatter=l.identity();z._stackingResult=m.memThunk(function(){return z.datasets()},function(){return z.position().accessor},function(){return z.length().accessor},function(){return z._stackingOrder},function(A,D,H,E){return p.Stacking.stack(A,D,H,E)});z._stackedExtent=m.memThunk(z._stackingResult, function(){return z.position().accessor},function(){return z._filterForProperty(z._isVertical?"y":"x")},function(A,D,H){return p.Stacking.stackedExtent(A,D,H)});z.addClass("stacked-bar-plot");z._stackingOrder="bottomup";return z}k(x,v);x.prototype.stackingOrder=function(y){if(null==y)return this._stackingOrder;this._stackingOrder=y;this._onDatasetUpdate();return this};x.prototype.extremaFormatter=function(y){if(0===arguments.length)return this._extremaFormatter;this._extremaFormatter=y;this.render(); return this};x.prototype._setup=function(){v.prototype._setup.call(this);this._labelArea=this._renderArea.append("g").classed(n.Bar._LABEL_AREA_CLASS,!0);var y=new q.SvgContext(this._labelArea.node());this._measurer=new q.CacheMeasurer(y);this._writer=new q.Writer(this._measurer,y)};x.prototype._drawLabels=function(){function y(N,P){var V=A._generateAttrToProjector(),T=A.width(),aa=A.height();N.forEach(function(da){if(da.extent!==D){var va=A.extremaFormatter()(da.extent),Da=A._measurer.measure(va), na=da.stackedDatum,ya=na.originalDatum,Pa=na.originalIndex;na=na.originalDataset;A._isDatumOnScreen(V,T,aa,ya,Pa,na)&&(ya=t.Plot._scaledAccessor(A.attr(n.Bar._BAR_THICKNESS_KEY))(ya,Pa,na),Pa=E.scale(da.extent),da=A._getPositionAttr(H.scale(da.axisValue),ya)+ya/2,da=P(A._isVertical?{x:da,y:Pa}:{x:Pa,y:da},Da,ya),va=z(va,{topLeft:da,bottomRight:{x:da.x+Da.width,y:da.y+Da.height}},ya),O.push(va))}})}function z(N,P,V){var T=P.topLeft,aa=T.x,da=T.y;T=P.bottomRight.x-P.topLeft.x;P=P.bottomRight.y-P.topLeft.y; V=A._isVertical?T>V:P>V;V||(aa=A._labelArea.append("g").attr("transform","translate("+aa+", "+da+")"),aa.classed("stacked-bar-label",!0),A._writer.write(N,T,P,{xAlign:"center",yAlign:"center"},aa.node()));return V}var A=this;v.prototype._drawLabels.call(this);this._labelArea.selectAll("g").remove();var D=+this.baselineValue(),H=this.position().scale,E=this.length().scale,F=p.Stacking.stackedExtents(this._stackingResult()),J=F.minimumExtents,O=[];y(F.maximumExtents,function(N,P){var V=A._isVertical? P.width:P.height;P=A._isVertical?P.height:P.width;return{x:A._isVertical?N.x-V/2:N.x+x._EXTREMA_LABEL_MARGIN_FROM_BAR,y:A._isVertical?N.y-P:N.y-V/2}});y(J,function(N,P){var V=A._isVertical?P.width:P.height;P=A._isVertical?P.height:P.width;return{x:A._isVertical?N.x-V/2:N.x-P,y:A._isVertical?N.y+x._EXTREMA_LABEL_MARGIN_FROM_BAR:N.y-V/2}});O.some(function(N){return N})&&this._labelArea.selectAll("g").remove()};x.prototype._generateAttrToProjector=function(){function y(T,aa,da){return 0>+N(T,aa,da)? D(T,aa,da):A(T,aa,da)}function z(T,aa,da){return Math.abs(A(T,aa,da)-D(T,aa,da))}function A(T,aa,da){return O.scale(+N(T,aa,da)+V.get(da).get(H(T,aa,da)).offset)}function D(T,aa,da){return O.scale(V.get(da).get(H(T,aa,da)).offset)}function H(T,aa,da){return p.Stacking.normalizeKey(P(T,aa,da))}var E=this,F=v.prototype._generateAttrToProjector.call(this),J=this._isVertical?"y":"x",O=this.length().scale,N=this.length().accessor,P=this.position().accessor,V=this._stackingResult();F[this._isVertical?"height": "width"]=z;F[J]=function(T,aa,da){return E._isVertical?y(T,aa,da):y(T,aa,da)-z(T,aa,da)};return F};x.prototype.getExtentsForProperty=function(y){return y===(this._isVertical?"y":"x")?[this._stackedExtent()]:v.prototype.getExtentsForProperty.call(this,y)};x.prototype.invalidateCache=function(){v.prototype.invalidateCache.call(this);this._measurer.reset()};return x}(n.Bar);c._EXTREMA_LABEL_MARGIN_FROM_BAR=5;e.StackedBar=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor= m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(0);c=g(27);var l=g(2);g=function(m){function p(){var n=m.call(this)||this;n._connectorsEnabled=!1;n.addClass("waterfall-plot");return n}k(p,m);p.prototype.connectorsEnabled=function(n){if(null==n)return this._connectorsEnabled;this._connectorsEnabled=n;return this};p.prototype.total=function(n){if(null==n)return this._propertyBindings.get(p._TOTAL_KEY);this._bindProperty(p._TOTAL_KEY, n,null);return this};p.prototype._additionalPaint=function(n){var t=this;this._connectorArea.selectAll("line").remove();this._connectorsEnabled&&q.Window.setTimeout(function(){return t._drawConnectors()},n)};p.prototype._createNodesForDataset=function(n){n=m.prototype._createNodesForDataset.call(this,n);this._connectorArea=this._renderArea.append("g").classed(p._CONNECTOR_AREA_CLASS,!0);return n};p.prototype.getExtentsForProperty=function(n){return"y"===n?[this._extent]:m.prototype.getExtentsForProperty.call(this, n)};p.prototype._generateAttrToProjector=function(){var n=this,t=m.prototype._generateAttrToProjector.call(this),v=this.y().scale,x=l.Plot._scaledAccessor(this.total());null==this.attr("y")&&(t.y=function(y,z,A){var D=n.y().accessor(y,z,A);if(x(y,z,A))return Math.min(v.scale(D),v.scale(0));y=n._subtotals[z];if(0===z)return 0>D?v.scale(y-D):v.scale(y);z=n._subtotals[z-1];return y>z?v.scale(y):v.scale(z)});null==this.attr("height")&&(t.height=function(y,z,A){var D=x(y,z,A);y=n.y().accessor(y,z,A);if(D)return Math.abs(v.scale(y)- v.scale(0));D=n._subtotals[z];if(0===z)return Math.abs(v.scale(D)-v.scale(D-y));z=n._subtotals[z-1];return Math.abs(v.scale(D)-v.scale(z))});t["class"]=function(y,z,A){var D="";null!=n.attr("class")&&(D=n.attr("class").accessor(y,z,A)+" ");if(x(y,z,A))return D+p._BAR_TOTAL_CLASS;y=n.y().accessor(y,z,A);return D+(0<y?p._BAR_GROWTH_CLASS:p._BAR_DECLINE_CLASS)};return t};p.prototype._onDatasetUpdate=function(){this._updateSubtotals();m.prototype._onDatasetUpdate.call(this);return this};p.prototype._calculateSubtotalsAndExtent= function(n){var t=this,v=Number.MAX_VALUE,x=Number.MIN_VALUE,y=0,z=!1;n.data().forEach(function(A,D){var H=t.y().accessor(A,D,n);(A=t.total().accessor(A,D,n))&&0!==D||(y+=H);t._subtotals.push(y);y<v&&(v=y);y>x&&(x=y);A&&(H<v&&(v=H),H>x&&(x=H));if(!z&&A){D=H-y;for(H=0;H<t._subtotals.length;H++)t._subtotals[H]+=D;z=!0;y+=D;v+=D;x+=D}});this._extent=[v,x]};p.prototype._drawConnectors=function(){for(var n=this._getAttrToProjector(),t=this.datasets()[0],v=1;v<t.data().length;v++){var x=v-1,y=t.data()[v], z=t.data()[x];z=n.x(z,x,t);var A=n.x(y,v,t)+n.width(y,v,t),D=n.y(y,v,t);if(0<this._subtotals[v]&&this._subtotals[v]>this._subtotals[x]||0>this._subtotals[v]&&this._subtotals[v]>=this._subtotals[x])D=n.y(y,v,t)+n.height(y,v,t);this._connectorArea.append("line").classed(p._CONNECTOR_CLASS,!0).attr("x1",z).attr("x2",A).attr("y1",D).attr("y2",D)}};p.prototype._updateSubtotals=function(){var n=this.datasets();0<n.length&&(n=n[n.length-1],this._subtotals=[],this._calculateSubtotalsAndExtent(n))};return p}(c.Bar); g._BAR_DECLINE_CLASS="waterfall-decline";g._BAR_GROWTH_CLASS="waterfall-growth";g._BAR_TOTAL_CLASS="waterfall-total";g._CONNECTOR_CLASS="connector";g._CONNECTOR_AREA_CLASS="connector-area";g._TOTAL_KEY="total";e.Waterfall=g},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(1),l=g(0);c=function(m){function p(n){var t=m.call(this)||this; switch(n){case null:case void 0:null==p._plottableColorCache&&(p._plottableColorCache=p._getPlottableColors());n=q.scaleOrdinal().range(p._plottableColorCache);break;case "Category10":case "category10":case "10":n=q.scaleOrdinal(q.schemeCategory10);break;case "Category20":case "category20":case "20":n=q.scaleOrdinal(q.schemeCategory20);break;case "Category20b":case "category20b":case "20b":n=q.scaleOrdinal(q.schemeCategory20b);break;case "Category20c":case "category20c":case "20c":n=q.scaleOrdinal(q.schemeCategory20c); break;default:throw Error("Unsupported ColorScale type");}t._d3Scale=n;return t}k(p,m);p.prototype.extentOfValues=function(n){return l.Array.uniq(n)};p.prototype._getExtent=function(){return l.Array.uniq(this._getAllIncludedValues())};p.invalidateColorCache=function(){p._plottableColorCache=null};p._getPlottableColors=function(){for(var n=[],t=q.select("body").append("plottable-color-tester"),v=l.Color.colorTest(t,""),x=0,y=l.Color.colorTest(t,"plottable-colors-0");null!=y&&x<this._MAXIMUM_COLORS_FROM_CSS&& (y!==v||y!==n[n.length-1]);)n.push(y),x++,y=l.Color.colorTest(t,"plottable-colors-"+x);t.remove();return n};p.prototype.scale=function(n){var t=this._d3Scale(n);n=this.domain().indexOf(n);n=Math.floor(n/this.range().length);return l.Color.lightenColor(t,Math.log(n*p._LOOP_LIGHTEN_FACTOR+1))};p.prototype._getDomain=function(){return this._backingScaleDomain()};p.prototype._backingScaleDomain=function(n){if(null==n)return this._d3Scale.domain();this._d3Scale.domain(n);return this};p.prototype._getRange= function(){return this._d3Scale.range()};p.prototype._setRange=function(n){this._d3Scale.range(n)};return p}(g(17).Scale);c._LOOP_LIGHTEN_FACTOR=1.6;c._MAXIMUM_COLORS_FROM_CSS=256;e.Color=c},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(1),l=g(0);c=function(m){function p(n){void 0===n&&(n="linear");var t=m.call(this)||this;switch(n){case "linear":t._colorScale= q.scaleLinear();break;case "log":t._colorScale=q.scaleLog();break;case "sqrt":t._colorScale=q.scaleSqrt();break;case "pow":t._colorScale=q.scalePow()}if(null==t._colorScale)throw Error("unknown QuantitativeScale scale type "+n);t.range(p.REDS);return t}k(p,m);p.prototype.extentOfValues=function(n){n=q.extent(n);return null==n[0]||null==n[1]?[]:n};p.prototype._d3InterpolatedScale=function(){return this._colorScale.range([0,1]).interpolate(this._interpolateColors())};p.prototype._interpolateColors= function(){var n=this._colorRange;if(2>n.length)throw Error("Color scale arrays must have at least two elements.");return function(){return function(t){t=Math.max(0,Math.min(1,t));t*=n.length-1;var v=Math.floor(t),x=t-v;return q.interpolateLab(n[v],n[Math.ceil(t)])(x)}}};p.prototype._resetScale=function(){this._d3Scale=this._d3InterpolatedScale();this._autoDomainIfAutomaticMode();this._dispatchUpdate()};p.prototype.autoDomain=function(){var n=this._getAllIncludedValues();0<n.length&&this._setDomain([l.Math.min(n, 0),l.Math.max(n,0)])};p.prototype.scale=function(n){return this._d3Scale(n)};p.prototype._getDomain=function(){return this._backingScaleDomain()};p.prototype._backingScaleDomain=function(n){if(null==n)return this._d3Scale.domain();this._d3Scale.domain(n);return this};p.prototype._getRange=function(){return this._colorRange};p.prototype._setRange=function(n){this._colorRange=n;this._resetScale()};return p}(g(17).Scale);c.REDS="#FFFFFF #FFF6E1 #FEF4C0 #FED976 #FEB24C #FD8D3C #FC4E2A #E31A1C #B10026".split(" "); c.BLUES="#FFFFFF #CCFFFF #A5FFFD #85F7FB #6ED3EF #55A7E0 #417FD0 #2545D3 #0B02E1".split(" ");c.POSNEG="#0B02E1 #2545D3 #417FD0 #55A7E0 #6ED3EF #85F7FB #A5FFFD #CCFFFF #FFFFFF #FFF6E1 #FEF4C0 #FED976 #FEB24C #FD8D3C #FC4E2A #E31A1C #B10026".split(" ");e.InterpolatedColor=c},function(c,e,g){var k=this&&this.__extends||function(l,m){function p(){this.constructor=l}for(var n in m)m.hasOwnProperty(n)&&(l[n]=m[n]);l.prototype=null===m?Object.create(m):(p.prototype=m.prototype,new p)},q=g(1);c=function(l){function m(){var p= l.call(this)||this;p._d3Scale=q.scaleLinear();return p}k(m,l);m.prototype._defaultExtent=function(){return[0,1]};m.prototype._expandSingleValueDomain=function(p){return p[0]===p[1]?[p[0]-1,p[1]+1]:p};m.prototype.scale=function(p){return this._d3Scale(p)};m.prototype.scaleTransformation=function(p){return this.scale(p)};m.prototype.invertedTransformation=function(p){return this.invert(p)};m.prototype.getTransformationExtent=function(){return this._getUnboundedExtent(!0)};m.prototype.getTransformationDomain= function(){return this.domain()};m.prototype.setTransformationDomain=function(p){this.domain(p)};m.prototype._getDomain=function(){return this._backingScaleDomain()};m.prototype._backingScaleDomain=function(p){if(null==p)return this._d3Scale.domain();this._d3Scale.domain(p);return this};m.prototype._getRange=function(){return this._d3Scale.range()};m.prototype._setRange=function(p){this._d3Scale.range(p)};m.prototype.invert=function(p){return this._d3Scale.invert(p)};m.prototype.defaultTicks=function(){return this._d3Scale.ticks()}; m.prototype._niceDomain=function(p,n){return this._d3Scale.copy().domain(p).nice(n).domain()};return m}(g(11).QuantitativeScale);e.Linear=c},function(c,e,g){var k=this&&this.__extends||function(p,n){function t(){this.constructor=p}for(var v in n)n.hasOwnProperty(v)&&(p[v]=n[v]);p.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)},q=g(1),l=g(0),m=g(3);c=function(p){function n(t){void 0===t&&(t=10);var v=p.call(this)||this;v._d3Scale=q.scaleLinear();v._base=t;v._pivot=v._base;v._setDomain(v._defaultExtent()); if(1>=t)throw Error("ModifiedLogScale: The base must be \x3e 1");return v}k(n,p);n.prototype._adjustedLog=function(t){var v=0>t?-1:1;t*=v;t<this._pivot&&(t+=(this._pivot-t)/this._pivot);t=Math.log(t)/Math.log(this._base);return t*v};n.prototype._invertedAdjustedLog=function(t){var v=0>t?-1:1;t=Math.pow(this._base,t*v);t<this._pivot&&(t=this._pivot*(t-1)/(this._pivot-1));return t*v};n.prototype.scale=function(t){return this._d3Scale(this._adjustedLog(t))};n.prototype.invert=function(t){return this._invertedAdjustedLog(this._d3Scale.invert(t))}; n.prototype.scaleTransformation=function(t){return this.scale(t)};n.prototype.invertedTransformation=function(t){return this.invert(t)};n.prototype.getTransformationExtent=function(){return this._getUnboundedExtent(!0)};n.prototype.getTransformationDomain=function(){return this.domain()};n.prototype.setTransformationDomain=function(t){this.domain(t)};n.prototype._getDomain=function(){return this._untransformedDomain};n.prototype._setDomain=function(t){this._untransformedDomain=t;p.prototype._setDomain.call(this, [this._adjustedLog(t[0]),this._adjustedLog(t[1])])};n.prototype._backingScaleDomain=function(t){if(null==t)return this._d3Scale.domain();this._d3Scale.domain(t);return this};n.prototype.ticks=function(){function t(H,E,F){return[H,E,F].sort(function(J,O){return J-O})[1]}var v=l.Math.min(this._untransformedDomain,0),x=l.Math.max(this._untransformedDomain,0),y=t(v,x,-this._pivot),z=t(v,x,this._pivot);y=this._logTicks(-y,-v).map(function(H){return-H}).reverse();z=this._logTicks(z,x);var A=Math.max(v, -this._pivot),D=Math.min(x,this._pivot);A=q.scaleLinear().domain([A,D]).ticks(this._howManyTicks(A,D));y=y.concat(A).concat(z);1>=y.length&&(y=q.scaleLinear().domain([v,x]).ticks());return y};n.prototype._logTicks=function(t,v){var x=this,y=this._howManyTicks(t,v);if(0===y)return[];var z=Math.floor(Math.log(t)/Math.log(this._base)),A=Math.ceil(Math.log(v)/Math.log(this._base));y=q.range(A,z,-Math.ceil((A-z)/y));z=q.range(this._base,1,-(this._base-1)).map(Math.floor);var D=l.Array.uniq(z);y=y.map(function(H){return D.map(function(E){return Math.pow(x._base, H-1)*E})});return l.Array.flatten(y).filter(function(H){return t<=H&&H<=v}).sort(function(H,E){return H-E})};n.prototype._howManyTicks=function(t,v){var x=this._adjustedLog(l.Math.min(this._untransformedDomain,0)),y=this._adjustedLog(l.Math.max(this._untransformedDomain,0));return Math.ceil((this._adjustedLog(v)-this._adjustedLog(t))/(y-x)*m.ModifiedLog._DEFAULT_NUM_TICKS)};n.prototype._niceDomain=function(t){return t};n.prototype._defaultExtent=function(){return[0,this._base]};n.prototype._expandSingleValueDomain= function(t){return t[0]===t[1]?(t=t[0],0<t?[t/this._base,t*this._base]:0===t?[-this._base,this._base]:[t*this._base,t/this._base]):t};n.prototype._getRange=function(){return this._d3Scale.range()};n.prototype._setRange=function(t){this._d3Scale.range(t)};n.prototype.defaultTicks=function(){return this._d3Scale.ticks()};return n}(g(11).QuantitativeScale);e.ModifiedLog=c},function(c,e,g){var k=g(0);e.intervalTickGenerator=function(q){if(0>=q)throw Error("interval must be positive number");return function(l){l= l.domain();var m=Math.min(l[0],l[1]);l=Math.max(l[0],l[1]);var p=Math.ceil(m/q)*q;m=0===m%q?[]:[m];var n=k.Math.range(0,Math.floor((l-p)/q)+1).map(function(t){return p+t*q});return m.concat(n).concat(0===l%q?[]:[l])}};e.integerTickGenerator=function(){return function(q){var l=q.defaultTicks();return l.filter(function(m,p){return 0===m%1||0===p||p===l.length-1})}}},function(c,e,g){var k=this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]); m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(1),l=g(28);c=function(m){function p(){var n=m.call(this)||this;n._d3Scale=q.scaleTime();n.autoDomain();return n}k(p,m);p.prototype.tickInterval=function(n,t){void 0===t&&(t=1);var v=q.scaleTime();p.timeIntervalToD3Time(n).every(t);v.domain(this.domain());v.range(this.range());return v.ticks()};p.prototype._setDomain=function(n){if(n[1]<n[0])throw Error("Scale.Time domain values must be in chronological order");return m.prototype._setDomain.call(this, n)};p.prototype._defaultExtent=function(){return[new Date("1970-01-01"),new Date("1970-01-02")]};p.prototype._expandSingleValueDomain=function(n){var t=n[0].getTime(),v=n[1].getTime();return t===v?(n=new Date(t),n.setDate(n.getDate()-1),v=new Date(v),v.setDate(v.getDate()+1),[n,v]):n};p.prototype.scale=function(n){return this._d3Scale(n)};p.prototype.scaleTransformation=function(n){return this.scale(new Date(n))};p.prototype.invertedTransformation=function(n){return this.invert(n).getTime()};p.prototype.getTransformationExtent= function(){var n=this._getUnboundedExtent(!0);return[n[0].valueOf(),n[1].valueOf()]};p.prototype.getTransformationDomain=function(){var n=this.domain();return[n[0].valueOf(),n[1].valueOf()]};p.prototype.setTransformationDomain=function(n){this.domain([new Date(n[0]),new Date(n[1])])};p.prototype._getDomain=function(){return this._backingScaleDomain()};p.prototype._backingScaleDomain=function(n){if(null==n)return this._d3Scale.domain();this._d3Scale.domain(n);return this};p.prototype._getRange=function(){return this._d3Scale.range()}; p.prototype._setRange=function(n){this._d3Scale.range(n)};p.prototype.invert=function(n){return this._d3Scale.invert(n)};p.prototype.defaultTicks=function(){return this._d3Scale.ticks()};p.prototype._niceDomain=function(n){return this._d3Scale.copy().domain(n).nice().domain()};p.timeIntervalToD3Time=function(n){switch(n){case l.TimeInterval.second:return q.timeSecond;case l.TimeInterval.minute:return q.timeMinute;case l.TimeInterval.hour:return q.timeHour;case l.TimeInterval.day:return q.timeDay; case l.TimeInterval.week:return q.timeWeek;case l.TimeInterval.month:return q.timeMonth;case l.TimeInterval.year:return q.timeYear;default:throw Error("TimeInterval specified does not exist: "+n);}};return p}(g(11).QuantitativeScale);e.Time=c},function(c,e,g){var k=g(1),q=Array;e.add=function(l,m){if(l.length!==m.length)throw Error("attempted to add arrays of unequal length");return l.map(function(p,n){return l[n]+m[n]})};e.uniq=function(l){var m=k.set(),p=[];l.forEach(function(n){m.has(String(n))|| (m.add(String(n)),p.push(n))});return p};e.flatten=function(l){return q.prototype.concat.apply([],l)};e.createFilledArray=function(l,m){for(var p=[],n=0;n<m;n++)p[n]="function"===typeof l?l(n):l;return p}},function(c,e){c=function(){function g(k,q,l){this.maxIndex=this.minIndex=this.exitIndex=this.entryIndex=k;this.bucketValue=q;this.maxValue=this.minValue=l}g.prototype.isInBucket=function(k){return k==this.bucketValue};g.prototype.addToBucket=function(k,q){k<this.minValue&&(this.minValue=k,this.minIndex= q);k>this.maxValue&&(this.maxValue=k,this.maxIndex=q);this.exitIndex=q};g.prototype.getUniqueIndices=function(){var k=[this.entryIndex,this.maxIndex,this.minIndex,this.exitIndex];return k.filter(function(q,l){return 0==l||q!=k[l-1]})};return g}();e.Bucket=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){return null!== q&&q.apply(this,arguments)||this}k(l,q);l.prototype.callCallbacks=function(){for(var m=this,p=[],n=0;n<arguments.length;n++)p[n]=arguments[n];this.forEach(function(t){t.apply(m,p)});return this};return l}(g(58).Set);e.CallbackSet=c},function(c,e,g){function k(m){function p(v){v/=255;return.03928>=v?v/12.92:l.pow((v+.055)/1.055,2.4)}var n=q.rgb(m);m=p(n.r);var t=p(n.g);n=p(n.b);return.2126*m+.7152*t+.0722*n}var q=g(1),l=Math;e.contrast=function(m,p){m=k(m)+.05;p=k(p)+.05;return m>p?m/p:p/m};e.lightenColor= function(m,p){return q.color(m).brighter(p).rgb().toString()};e.colorTest=function(m,p){m.classed(p,!0);var n=m.style("background-color");if("transparent"===n)return null;n=/\((.+)\)/.exec(n);if(!n)return null;n=n[1].split(",").map(function(t){t=+t;var v=t.toString(16);return 16>t?"0"+v:v});if(4===n.length&&"00"===n[3])return null;n="#"+n.join("");m.classed(p,!1);return n}},function(c,e,g){var k=g(1),q=g(57);c=function(){function l(){this._entities=[];this._rtree=new q.RTree;this._tree=k.quadtree().x(function(m){return Math.floor(m.position.x)}).y(function(m){return Math.floor(m.position.y)})} l.prototype.addAll=function(m,p,n){(x=this._entities).push.apply(x,m);if(void 0!==n)for(n=q.RTreeBounds.bounds(n),x=0;x<m.length;x++){var t=m[x],v=q.RTreeBounds.entityBounds(p(t));q.RTreeBounds.isBoundsOverlapBounds(n,v)&&(this._tree.add(t),this._rtree.insert(v,t))}else for(this._tree.addAll(m),x=0;x<m.length;x++)t=m[x],v=q.RTreeBounds.entityBounds(p(t)),this._rtree.insert(v,t);var x};l.prototype.entityNearest=function(m){return this._tree.find(m.x,m.y)};l.prototype.entitiesInBounds=function(m){return this._rtree.intersect(q.RTreeBounds.entityBounds(m))}; l.prototype.entitiesInXBounds=function(m){return this._rtree.intersectX(q.RTreeBounds.entityBounds(m))};l.prototype.entitiesInYBounds=function(m){return this._rtree.intersectY(q.RTreeBounds.entityBounds(m))};l.prototype.entities=function(){return this._entities};return l}();e.EntityStore=c},function(c,e,g){var k=g(56);c=function(){function q(){"function"===typeof window.Map?this._es6Map=new window.Map:this._keyValuePairs=[]}q.prototype.set=function(l,m){if(k.isNaN(l))throw Error("NaN may not be used as a key to the Map"); if(null!=this._es6Map)return this._es6Map.set(l,m),this;for(var p=0;p<this._keyValuePairs.length;p++)if(this._keyValuePairs[p].key===l)return this._keyValuePairs[p].value=m,this;this._keyValuePairs.push({key:l,value:m});return this};q.prototype.get=function(l){if(null!=this._es6Map)return this._es6Map.get(l);for(var m=0;m<this._keyValuePairs.length;m++)if(this._keyValuePairs[m].key===l)return this._keyValuePairs[m].value};q.prototype.has=function(l){if(null!=this._es6Map)return this._es6Map.has(l); for(var m=0;m<this._keyValuePairs.length;m++)if(this._keyValuePairs[m].key===l)return!0;return!1};q.prototype.forEach=function(l,m){var p=this;null!=this._es6Map?this._es6Map.forEach(function(n,t){return l.call(m,n,t,p)},m):this._keyValuePairs.forEach(function(n){l.call(m,n.value,n.key,p)})};q.prototype.delete=function(l){if(null!=this._es6Map)return this._es6Map.delete(l);for(var m=0;m<this._keyValuePairs.length;m++)if(this._keyValuePairs[m].key===l)return this._keyValuePairs.splice(m,1),!0;return!1}; return q}();e.Map=c},function(c,e){e.assign=function(){for(var g=[],k=0;k<arguments.length;k++)g[k]=arguments[k];k={};for(var q=0;q<g.length;q++)for(var l=g[q],m=0,p=Object.keys(l);m<p.length;m++){var n=p[m];k[n]=l[n]}return k}},function(c,e){c=function(){function g(){}g.prototype.split=function(k,q){for(var l=Math.ceil(k.length/2),m=0;m<l;m++)q[0].insert(k[m]);for(m=l;m<k.length;m++)q[1].insert(k[m])};return g}();e.SplitStrategyTrivial=c;c=function(){function g(){}g.prototype.split=function(k,q){k= k.slice();for(this.chooseFirstSplit(k,q);0<k.length;)this.addNext(k,q)};g.prototype.chooseFirstSplit=function(k,q){for(var l=0,m=0,p=k.length-1,n=k.length-1,t=1;t<k.length-1;t++){var v=k[t];v.bounds.xl>k[p].bounds.xl?p=t:v.bounds.xh<k[l].bounds.xh&&(l=t);v.bounds.yl>k[n].bounds.yl?n=t:v.bounds.yh<k[m].bounds.yh&&(m=t)}m=Math.abs(k[l].bounds.xh-k[p].bounds.xl)>Math.abs(k[m].bounds.yh-k[n].bounds.yl)?[l,p]:[m,n];l=m[0];m=m[1];l===m&&(l=0,m=k.length-1);q[0].insert(k.splice(Math.max(l,m),1)[0]);q[1].insert(k.splice(Math.min(l, m),1)[0])};g.prototype.addNext=function(k,q){for(var l=null,m=null,p=null,n=0;n<k.length;n++){var t=k[n],v=q[0].unionAreaDifference(t.bounds);t=q[1].unionAreaDifference(t.bounds);if(v<m||null==l)l=n,m=v,p=q[0];t<m&&(l=n,m=t,p=q[1])}p.insert(k.splice(l,1)[0])};return g}();e.SplitStrategyLinear=c},function(c,e,g){function k(p){return String(p)}var q=g(1),l=g(0);c=g(10);e.IStackingOrder=c.makeEnum(["topdown","bottomup"]);var m=Math;e.stack=function(p,n,t,v){void 0===v&&(v="bottomup");var x=q.map(),y= q.map(),z=new l.Map;"topdown"===v&&(p=p.slice(),p.reverse());p.forEach(function(A){var D=new l.Map;A.data().forEach(function(H,E){var F=k(n(H,E,A)),J=+t(H,E,A),O=0<=J?x:y;if(O.has(F)){var N=O.get(F);O.set(F,N+J)}else N=0,O.set(F,J);D.set(F,{offset:N,value:J,axisValue:n(H,E,A),originalDatum:H,originalDataset:A,originalIndex:E})});z.set(A,D)});return z};e.stackedExtents=function(p){var n=new l.Map,t=new l.Map;p.forEach(function(v){v.forEach(function(x,y){var z=l.Math.max([x.offset+x.value,x.offset], x.offset),A=l.Math.min([x.offset+x.value,x.offset],x.offset),D=x.axisValue;n.has(y)?n.get(y).extent<z&&n.set(y,{extent:z,axisValue:D,stackedDatum:x}):n.set(y,{extent:z,axisValue:D,stackedDatum:x});t.has(y)?t.get(y).extent>A&&t.set(y,{extent:A,axisValue:D,stackedDatum:x}):t.set(y,{extent:A,axisValue:D,stackedDatum:x})})});return{maximumExtents:n,minimumExtents:t}};e.stackedExtent=function(p,n,t){var v=[];p.forEach(function(y,z){z.data().forEach(function(A,D){if(null==t||t(A,D,z))A=y.get(k(n(A,D,z))), v.push(A.value+A.offset)})});p=l.Math.max(v,0);var x=l.Math.min(v,0);return[m.min(x,0),m.max(0,p)]};e.normalizeKey=k},function(c,e,g){var k=g(0);e.getTranslator=function(l){l=l.root().rootElement().node();var m=l.__Plottable_ClientTranslator;null==m&&(m=new q(l),l.__Plottable_ClientTranslator=m);return m};var q=function(){function l(m){this._rootElement=m}l.prototype.computePosition=function(m,p){m={x:m,y:p};p=k.Math.getCumulativeTransform(this._rootElement);return null==p?m:k.Math.applyTransform(p, m)};l.isEventInside=function(m,p){return k.DOM.contains(m.root().rootElement().node(),p.target)};return l}();e.Translator=q},function(c,e,g){Object.defineProperty(e,"__esModule",{value:!0});var k=g(124);g.d(e,"easeLinear",function(){return k.a});var q=g(126);g.d(e,"easeQuad",function(){return q.a});g.d(e,"easeQuadIn",function(){return q.b});g.d(e,"easeQuadOut",function(){return q.c});g.d(e,"easeQuadInOut",function(){return q.a});var l=g(121);g.d(e,"easeCubic",function(){return l.a});g.d(e,"easeCubicIn", function(){return l.b});g.d(e,"easeCubicOut",function(){return l.c});g.d(e,"easeCubicInOut",function(){return l.a});var m=g(125);g.d(e,"easePoly",function(){return m.a});g.d(e,"easePolyIn",function(){return m.b});g.d(e,"easePolyOut",function(){return m.c});g.d(e,"easePolyInOut",function(){return m.a});var p=g(127);g.d(e,"easeSin",function(){return p.a});g.d(e,"easeSinIn",function(){return p.b});g.d(e,"easeSinOut",function(){return p.c});g.d(e,"easeSinInOut",function(){return p.a});var n=g(123);g.d(e, "easeExp",function(){return n.a});g.d(e,"easeExpIn",function(){return n.b});g.d(e,"easeExpOut",function(){return n.c});g.d(e,"easeExpInOut",function(){return n.a});var t=g(120);g.d(e,"easeCircle",function(){return t.a});g.d(e,"easeCircleIn",function(){return t.b});g.d(e,"easeCircleOut",function(){return t.c});g.d(e,"easeCircleInOut",function(){return t.a});var v=g(119);g.d(e,"easeBounce",function(){return v.a});g.d(e,"easeBounceIn",function(){return v.b});g.d(e,"easeBounceOut",function(){return v.a}); g.d(e,"easeBounceInOut",function(){return v.c});var x=g(118);g.d(e,"easeBack",function(){return x.a});g.d(e,"easeBackIn",function(){return x.b});g.d(e,"easeBackOut",function(){return x.c});g.d(e,"easeBackInOut",function(){return x.a});var y=g(122);g.d(e,"easeElastic",function(){return y.a});g.d(e,"easeElasticIn",function(){return y.b});g.d(e,"easeElasticOut",function(){return y.a});g.d(e,"easeElasticInOut",function(){return y.c})},function(c,e,g){g.d(e,"b",function(){return k});g.d(e,"c",function(){return q}); g.d(e,"a",function(){return l});var k=function n(p){function t(v){return v*v*((p+1)*v-p)}p=+p;t.overshoot=n;return t}(1.70158),q=function t(n){function v(x){return--x*x*((n+1)*x+n)+1}n=+n;v.overshoot=t;return v}(1.70158),l=function v(t){function x(y){return(1>(y*=2)?y*y*((t+1)*y-t):(y-=2)*y*((t+1)*y+t)+2)/2}t=+t;x.overshoot=v;return x}(1.70158)},function(c,e){function g(z){return(z=+z)<k?y*z*z:z<l?y*(z-=q)*z+m:z<n?y*(z-=p)*z+t:y*(z-=v)*z+x}e.b=function(z){return 1-g(1-z)};e.a=g;e.c=function(z){return(1>= (z*=2)?1-g(1-z):g(z-1)+1)/2};var k=4/11,q=6/11,l=8/11,m=.75,p=9/11,n=10/11,t=.9375,v=21/22,x=.984375,y=1/k/k},function(c,e){e.b=function(g){return 1-Math.sqrt(1-g*g)};e.c=function(g){return Math.sqrt(1- --g*g)};e.a=function(g){return(1>=(g*=2)?1-Math.sqrt(1-g*g):Math.sqrt(1-(g-=2)*g)+1)/2}},function(c,e){e.b=function(g){return g*g*g};e.c=function(g){return--g*g*g+1};e.a=function(g){return(1>=(g*=2)?g*g*g:(g-=2)*g*g+2)/2}},function(c,e,g){g.d(e,"b",function(){return q});g.d(e,"a",function(){return l}); g.d(e,"c",function(){return m});var k=2*Math.PI,q=function v(n,t){function x(z){return n*Math.pow(2,10*--z)*Math.sin((y-z)/t)}var y=Math.asin(1/(n=Math.max(1,n)))*(t/=k);x.amplitude=function(z){return v(z,t*k)};x.period=function(z){return v(n,z)};return x}(1,.3),l=function x(t,v){function y(A){return 1-t*Math.pow(2,-10*(A=+A))*Math.sin((A+z)/v)}var z=Math.asin(1/(t=Math.max(1,t)))*(v/=k);y.amplitude=function(A){return x(A,v*k)};y.period=function(A){return x(t,A)};return y}(1,.3),m=function y(v,x){function z(D){return(0> (D=2*D-1)?v*Math.pow(2,10*D)*Math.sin((A-D)/x):2-v*Math.pow(2,-10*D)*Math.sin((A+D)/x))/2}var A=Math.asin(1/(v=Math.max(1,v)))*(x/=k);z.amplitude=function(D){return y(D,x*k)};z.period=function(D){return y(v,D)};return z}(1,.3)},function(c,e){e.b=function(g){return Math.pow(2,10*g-10)};e.c=function(g){return 1-Math.pow(2,-10*g)};e.a=function(g){return(1>=(g*=2)?Math.pow(2,10*g-10):2-Math.pow(2,10-10*g))/2}},function(c,e){e.a=function(g){return+g}},function(c,e,g){g.d(e,"b",function(){return k});g.d(e, "c",function(){return q});g.d(e,"a",function(){return l});var k=function n(p){function t(v){return Math.pow(v,p)}p=+p;t.exponent=n;return t}(3),q=function t(n){function v(x){return 1-Math.pow(1-x,n)}n=+n;v.exponent=t;return v}(3),l=function v(t){function x(y){return(1>=(y*=2)?Math.pow(y,t):2-Math.pow(2-y,t))/2}t=+t;x.exponent=v;return x}(3)},function(c,e){e.b=function(g){return g*g};e.c=function(g){return g*(2-g)};e.a=function(g){return(1>=(g*=2)?g*g:--g*(2-g)+1)/2}},function(c,e){e.b=function(q){return 1- Math.cos(q*k)};e.c=function(q){return Math.sin(q*k)};e.a=function(q){return(1-Math.cos(g*q))/2};var g=Math.PI,k=g/2},function(c,e,g){function k(l){return!0===q(l)&&"[object Object]"===Object.prototype.toString.call(l)}var q=g(129);c.exports=function(l){if(!1===k(l))return!1;l=l.constructor;if("function"!==typeof l)return!1;l=l.prototype;return!1===k(l)||!1===l.hasOwnProperty("isPrototypeOf")?!1:!0}},function(c){c.exports=function(e){return null!=e&&"object"===typeof e&&!1===Array.isArray(e)}},function(c, e){c=function(){function g(k,q,l){void 0===q&&(q=10);void 0===l&&(l={});var m=this;this.ctx=k;this.lineHeight=q;this.style=l;this.createRuler=function(){return function(p){m.ctx.font=m.style.font;return{width:m.ctx.measureText(p).width,height:m.lineHeight}}};this.createPen=function(p,n,t){null==t&&(t=m.ctx);t.save();t.translate(n.translate[0],n.translate[1]);t.rotate(n.rotate*Math.PI/180);return m.createCanvasPen(t)};void 0===this.style.fill&&(this.style.fill="#444")}g.prototype.createCanvasPen=function(k){var q= this;return{destroy:function(){k.restore()},write:function(l,m,p,n){k.textAlign=m;null!=q.style.font&&(k.font=q.style.font);null!=q.style.fill&&(k.fillStyle=q.style.fill,k.fillText(l,p,n));null!=q.style.stroke&&(k.strokeStyle=q.style.fill,k.strokeText(l,p,n))}}};return g}();e.CanvasContext=c},function(c,e){var g=function(){function k(){}k.append=function(q,l){for(var m=[],p=2;p<arguments.length;p++)m[p-2]=arguments[p];m=k.create.apply(k,[l].concat(m));q.appendChild(m);return m};k.create=function(q){for(var l= [],m=1;m<arguments.length;m++)l[m-1]=arguments[m];m=document.createElementNS(k.SVG_NS,q);k.addClasses.apply(k,[m].concat(l));return m};k.addClasses=function(q){for(var l=[],m=1;m<arguments.length;m++)l[m-1]=arguments[m];l=l.filter(function(p){return null!=p});null!=q.classList?l.forEach(function(p){q.classList.add(p)}):q.setAttribute("class",l.join(" "))};k.getDimensions=function(q){if(q.getBBox)try{var l=q.getBBox();return{width:l.width,height:l.height}}catch(m){}return{height:0,width:0}};return k}(); g.SVG_NS="http://www.w3.org/2000/svg";e.SvgUtils=g;c=function(){function k(q,l,m){void 0===m&&(m=!1);var p=this;this.element=q;this.className=l;this.addTitleElement=m;this.createRuler=function(){var n=p.getTextElements(p.element),t=n.parentElement,v=n.containerElement,x=n.textElement;return function(y){t.appendChild(v);x.textContent=y;y=g.getDimensions(x);t.removeChild(v);return y}};this.createPen=function(n,t,v){null==v&&(v=p.element);v=g.append(v,"g","text-container",p.className);p.addTitleElement&& (g.append(v,"title").textContent=n,v.setAttribute("title",n));n=g.append(v,"g","text-area");n.setAttribute("transform","translate("+t.translate[0]+","+t.translate[1]+")rotate("+(t.rotate+")"));return p.createSvgLinePen(n)}}k.prototype.setAddTitleElement=function(q){this.addTitleElement=q};k.prototype.createSvgLinePen=function(q){return{write:function(l,m,p,n){var t=g.append(q,"text","text-line");t.textContent=l;t.setAttribute("text-anchor",m);t.setAttribute("transform","translate("+p+","+n+")");t.setAttribute("y", "-0.25em")}}};k.prototype.getTextElements=function(q){if("text"===q.tagName){var l=q.parentElement;null==l&&(l=q.parentNode);l.removeChild(q);return{containerElement:q,parentElement:l,textElement:q}}var m=q.querySelector("text");if(null!=m)return l=q.parentElement,null==l&&(l=q.parentNode),l.removeChild(q),{containerElement:q,parentElement:l,textElement:m};l=g.create("text",this.className);return{containerElement:l,parentElement:q,textElement:l}};return k}();e.SvgContext=c},function(c,e,g){var k= this&&this.__extends||function(m,p){function n(){this.constructor=m}for(var t in p)p.hasOwnProperty(t)&&(m[t]=p[t]);m.prototype=null===p?Object.create(p):(n.prototype=p.prototype,new n)},q=g(21),l=g(36);c=function(m){function p(n){var t=m.call(this,n)||this;t.dimCache=new q.Cache(function(v){return t._measureNotFromCache(v)});return t}k(p,m);p.prototype._measureNotFromCache=function(n){return m.prototype.measure.call(this,n)};p.prototype.measure=function(n){void 0===n&&(n=l.AbstractMeasurer.HEIGHT_TEXT); return this.dimCache.get(n)};p.prototype.reset=function(){this.dimCache.clear();m.prototype.reset.call(this)};return p}(g(60).CacheCharacterMeasurer);e.CacheMeasurer=c},function(c,e,g){var k=g(59),q=g(62),l=g(64),m=g(66);c=function(){function p(n){this.context=n;this.measurer=new q.CacheMeasurer(this.context);this.wrapper=new l.Wrapper;this.writer=new m.Writer(this.measurer,this.context,this.wrapper)}p.svg=function(n,t,v){return new p(new k.SvgContext(n,t,v))};p.canvas=function(n,t,v){return new p(new k.CanvasContext(n, t,v))};p.prototype.write=function(n,t,v,x,y){this.writer.write(n,t,v,x,y)};p.prototype.clearMeasurerCache=function(){this.measurer.reset()};return p}();e.Typesetter=c},function(c,e){c=function(){function g(k){this.cache={};this.compute=k}g.prototype.get=function(k){this.cache.hasOwnProperty(k)||(this.cache[k]=this.compute(k));return this.cache[k]};g.prototype.clear=function(){this.cache={};return this};return g}();e.Cache=c},function(c,e){e.Methods=function(){function g(){}g.arrayEq=function(k,q){if(null== k||null==q)return k===q;if(k.length!==q.length)return!1;for(var l=0;l<k.length;l++)if(k[l]!==q[l])return!1;return!0};g.objEq=function(k,q){if(null==k||null==q)return k===q;var l=Object.keys(k).sort(),m=Object.keys(q).sort(),p=l.map(function(t){return k[t]}),n=m.map(function(t){return q[t]});return g.arrayEq(l,m)&&g.arrayEq(p,n)};g.strictEq=function(k,q){return k===q};g.defaults=function(k){for(var q=[],l=1;l<arguments.length;l++)q[l-1]=arguments[l];if(null==k)throw new TypeError("Cannot convert undefined or null to object"); var m=Object(k);q.forEach(function(p){if(null!=p)for(var n in p)Object.prototype.hasOwnProperty.call(p,n)&&(m[n]=p[n])});return m};return g}()},function(c,e){e.StringMethods=function(){function g(){}g.combineWhitespace=function(k){return k.replace(/[ \t]+/g," ")};g.isNotEmptyString=function(k){return k&&""!==k.trim()};g.trimStart=function(k,q){if(!k)return k;k=k.split("");var l=q?function(m){return m.split(q).some(g.isNotEmptyString)}:g.isNotEmptyString;return k.reduce(function(m,p){return l(m+p)? m+p:m},"")};g.trimEnd=function(k,q){if(!k)return k;k=k.split("");k.reverse();k=g.trimStart(k.join(""),q).split("");k.reverse();return k.join("")};return g}()},function(c,e){c=function(){function g(){this.WordDividerRegExp=/\W/;this.WhitespaceRegExp=/\s/}g.prototype.tokenize=function(k){var q=this;return k.split("").reduce(function(l,m){return l.slice(0,-1).concat(q.shouldCreateNewToken(l[l.length-1],m))},[""])};g.prototype.shouldCreateNewToken=function(k,q){if(!k)return[q];var l=k[k.length-1];return this.WhitespaceRegExp.test(l)&& this.WhitespaceRegExp.test(q)?[k+q]:this.WhitespaceRegExp.test(l)||this.WhitespaceRegExp.test(q)?[k,q]:this.WordDividerRegExp.test(l)||this.WordDividerRegExp.test(q)?l===q?[k+q]:[k,q]:[k+q]};return g}();e.Tokenizer=c},function(c,e,g){var k=this&&this.__extends||function(q,l){function m(){this.constructor=q}for(var p in l)l.hasOwnProperty(p)&&(q[p]=l[p]);q.prototype=null===l?Object.create(l):(m.prototype=l.prototype,new m)};c=function(q){function l(){return q.apply(this,arguments)||this}k(l,q);l.prototype.wrap= function(m,p,n,t){function v(E){return q.prototype.wrap.call(x,m,p,E,t)}var x=this;void 0===t&&(t=Infinity);if(1<m.split("\n").length)throw Error("SingleLineWrapper is designed to work only on single line");var y=v(n);if(2>y.noLines)return y;for(var z=0,A=0;A<l.NO_WRAP_ITERATIONS&&n>z;++A){var D=(n+z)/2,H=v(D);this.areSameResults(y,H)?(n=D,y=H):z=D}return y};l.prototype.areSameResults=function(m,p){return m.noLines===p.noLines&&m.truncatedText===p.truncatedText};return l}(g(65).Wrapper);c.NO_WRAP_ITERATIONS= 5;e.SingleLineWrapper=c},function(c,e,g){var k=g(21),q={textRotation:0,textShear:0,xAlign:"left",yAlign:"top"};c=function(){function l(m,p,n){this._measurer=m;this._penFactory=p;this._wrapper=n}l.prototype.measurer=function(m){this._measurer=m;return this};l.prototype.wrapper=function(m){this._wrapper=m;return this};l.prototype.penFactory=function(m){this._penFactory=m;return this};l.prototype.write=function(m,p,n,t,v){void 0===t&&(t={});t=k.Methods.defaults({},q,t);if(-1===l.SupportedRotation.indexOf(t.textRotation))throw Error("unsupported rotation - "+ t.textRotation+". Supported rotations are "+l.SupportedRotation.join(", "));if(null!=t.textShear&&-80>t.textShear||80<t.textShear)throw Error("unsupported shear angle - "+t.textShear+". Must be between -80 and 80");var x=45<Math.abs(Math.abs(t.textRotation)-90),y=x?p:n,z=x?n:p,A=t.textShear,D=A*Math.PI/180;x=this._measurer.measure().height;var H=x*Math.tan(D);y=y/Math.cos(D)-Math.abs(H);var E=z*Math.cos(D);z=k.StringMethods.combineWhitespace(m);z=(this._wrapper?this._wrapper.wrap(z,this._measurer, y,E).wrappedText:z).split("\n");D=l.XOffsetFactor[t.xAlign]*y*Math.sin(D)-l.YOffsetFactor[t.yAlign]*(E-z.length*x);A=t.textRotation+A;switch(t.textRotation){case 90:p=[p+D,0];break;case -90:p=[-D,n];break;case 180:p=[p,n+D];break;default:p=[0,-D]}m=this._penFactory.createPen(m,{translate:p,rotate:A},v);this.writeLines(z,m,y,x,H,t.xAlign);null!=m.destroy&&m.destroy()};l.prototype.writeLines=function(m,p,n,t,v,x){m.forEach(function(y,z){p.write(y,l.AnchorConverter[x],(0<v?(z+1)*v:z*v)+n*l.XOffsetFactor[x], (z+1)*t)})};return l}();c.SupportedRotation=[-90,0,180,90];c.AnchorConverter={center:"middle",left:"start",right:"end"};c.XOffsetFactor={center:.5,left:0,right:1};c.YOffsetFactor={bottom:1,center:.5,top:0};e.Writer=c},function(c,e,g){function k(q){for(var l in q)e.hasOwnProperty(l)||(e[l]=q[l])}g(69);c=g(7);e.Animators=c;c=g(67);e.Axes=c;c=g(37);e.Components=c;c=g(23);e.Configs=c;c=g(8);e.Formatters=c;c=g(30);e.RenderController=c;c=g(39);e.RenderPolicies=c;c=g(31);e.SymbolFactories=c;c=g(13);e.Dispatchers= c;c=g(14);e.Drawers=c;c=g(25);e.Interactions=c;c=g(19);e.Plots=c;c=g(3);e.Scales=c;c=g(0);e.Utils=c;k(g(22));c=g(28);e.TimeInterval=c.TimeInterval;k(g(4));k(g(29));k(g(38));c=g(68);e.version=c.version;k(g(24));k(g(6));k(g(15));k(g(40));k(g(16));k(g(2));k(g(11));k(g(17))}])}); //# sourceURL=build://vz-chart-helpers/plottable-interactions.js var To; (function(b){function c(p){const n=[];for(;p&&p instanceof HTMLElement;)if(n.push(p),p.assignedSlot)p=p.assignedSlot;else if(p.parentElement)p=p.parentElement;else{const t=p.parentNode;p=t instanceof DocumentFragment?t.host:t!==p?t:null}return n}function e(p){var n=c(p);p=g;let t=null;for(const x of n){n=Plottable.Utils.DOM.getElementTransform(x);if(null!=n){var v=x.clientWidth/2;const y=x.clientHeight/2;p=Plottable.Utils.Math.multiplyTranslate(p,[v,y]);p=Plottable.Utils.Math.multiplyMatrix(p,Plottable.Utils.Math.invertMatrix(n)); p=Plottable.Utils.Math.multiplyTranslate(p,[-v,-y])}n=x.scrollLeft;v=x.scrollTop;if(null===t||x===t)n-=x.offsetLeft+x.clientLeft,v-=x.offsetTop+x.clientTop,t=x.offsetParent;p=Plottable.Utils.Math.multiplyTranslate(p,[n,v])}return p}const g=[1,0,0,1,0,0];class k extends Plottable.Utils.Translator{computePosition(p,n){p={x:p,y:n};n=e(this._rootElement);return null==n?p:Plottable.Utils.Math.applyTransform(n,p)}}class q extends Plottable.Dispatchers.Mouse{constructor(p){super(p);this._eventTarget=p.root().rootElement().node(); this._translator=new k(p.root().rootElement().node())}static getDispatcher(p){const n=p.root().rootElement();let t=n[q._DISPATCHER_KEY];t||(t=new q(p),n[q._DISPATCHER_KEY]=t);return t}}class l extends Plottable.Dispatchers.Touch{constructor(p){super(p);this._eventTarget=p.root().rootElement().node();this._translator=new k(p.root().rootElement().node())}static getDispatcher(p){const n=p.root().rootElement();let t=n[l._DISPATCHER_KEY];t||(t=new l(p),n[l._DISPATCHER_KEY]=t);return t}}class m extends Plottable.Interactions.Pointer{_anchor(){this._isAnchored= !0;this._mouseDispatcher=q.getDispatcher(this._componentAttachedTo);this._mouseDispatcher.onMouseMove(this._mouseMoveCallback);this._touchDispatcher=l.getDispatcher(this._componentAttachedTo);this._touchDispatcher.onTouchStart(this._touchStartCallback)}}b.PointerInteraction=m})(To||(To={})); //# sourceURL=build://vz-chart-helpers/vz-chart-helpers.js (function(b){function c(){let q=new Plottable.Scales.Linear;q.tickGenerator();let l=new Plottable.Axes.Numeric(q,"bottom");l.formatter(b.stepFormatter);return{scale:q,axis:l,accessor:m=>m.step}}function e(){let q=new Plottable.Scales.Time;return{scale:q,axis:new Plottable.Axes.Time(q,"bottom"),accessor:l=>l.wall_time}}function g(){let q=new Plottable.Scales.Linear;return{scale:q,axis:new Plottable.Axes.Numeric(q,"bottom"),accessor:b.relativeAccessor}}b.SYMBOLS_LIST=[{character:"\u25fc",method:Plottable.SymbolFactories.square}, {character:"\u25c6",method:Plottable.SymbolFactories.diamond},{character:"\u25b2",method:Plottable.SymbolFactories.triangle},{character:"\u2605",method:Plottable.SymbolFactories.star},{character:"\u271a",method:Plottable.SymbolFactories.cross}];let k;(function(q){q.STEP="step";q.RELATIVE="relative";q.WALL_TIME="wall_time"})(k=b.XType||(b.XType={}));b.Y_TOOLTIP_FORMATTER_PRECISION=4;b.STEP_FORMATTER_PRECISION=4;b.Y_AXIS_FORMATTER_PRECISION=3;b.TOOLTIP_Y_PIXEL_OFFSET=20;b.TOOLTIP_CIRCLE_SIZE=4;b.NAN_SYMBOL_SIZE= 6;b.multiscaleFormatter=function(q){return l=>{let m=Math.abs(l);1E-15>m&&(m=0);return(1E4<=m?d3.format("."+q+"~e"):0<m&&.01>m?d3.format("."+q+"~e"):d3.format("."+q+"~g"))(l)}};b.computeDomain=function(q,l){q=q.filter(n=>isFinite(n));if(0===q.length)return[-.1,1.1];l?(q=_.sortBy(q),l=d3.quantile(q,.05),q=d3.quantile(q,.95)):(l=d3.min(q),q=d3.max(q));let m,p=q-l;m=0===p?1.1*Math.abs(l)+1.1:.2*p;l=[0<=l&&l<p?-.1*q:l-m,q+m];return l=d3.scaleLinear().domain(l).nice().domain()};b.accessorize=function(q){return l=> l[q]};b.stepFormatter=d3.format(`.${b.STEP_FORMATTER_PRECISION}~s`);b.stepX=c;b.timeFormatter=Plottable.Formatters.time("%a %b %e, %H:%M:%S");b.wallX=e;b.relativeAccessor=(q,l,m)=>{if(null!=q.relative)return q.relative;l=m.data();return(+q.wall_time-(0<l.length?+l[0].wall_time:0))/36E5};b.relativeFormatter=q=>{let l="",m=Math.floor(q/24);q-=24*m;m&&(l+=m+"d ");let p=Math.floor(q);q=60*(q-p);if(p||m)l+=p+"h ";let n=Math.floor(q);q=60*(q-n);if(n||p||m)l+=n+"m ";return l+Math.floor(q)+"s"};b.relativeX= g;b.getXComponents=function(q){switch(q){case k.STEP:return c();case k.WALL_TIME:return e();case k.RELATIVE:return g();default:throw Error("invalid xType: "+q);}}})(To||(To={})); //# sourceURL=build://vz-bar-chart/vz-bar-chart.js var Uo; (function(){Polymer({is:"vz-bar-chart",properties:{data:Object,lines:{type:Object,value:()=>({})},colorScale:{type:Object,value:function(){return(new Plottable.Scales.Color).range(d3.schemeCategory10)}},linesColorScale:{type:Object,value:function(){return(new Plottable.Scales.Color).range(d3.schemeCategory10)}},tooltipColumns:{type:Array,value:function(){return[{title:"Name",evaluate:function(c){return c.key}},{title:"X",evaluate:function(c){return c.value.x}},{title:"Y",evaluate:function(c){return c.value.y}}]}},_attached:Boolean, _chart:Object},observers:["_makeChart(data, lines, colorScale, linesColorScale, tooltipColumns, _attached)"],redraw:function(){this._chart&&this._chart.redraw()},attached:function(){this._attached=!0},detached:function(){this._attached=!1},ready:function(){this.scopeSubtree(this.$.tooltip,!0);this.scopeSubtree(this.$.chartdiv,!0)},_makeChart:function(){this._chart&&this._chart.destroy();var c=d3.select(this.$.tooltip);c=new b(this.data,this.lines,this.colorScale,this.linesColorScale,c,this.tooltipColumns); var e=d3.select(this.$.chartdiv);c.renderTo(e);this._chart=c}});class b{constructor(c,e,g,k,q,l){g.domain(_.sortBy(_.keys(c)));this.data=c;this.lines=e;this.colorScale=g;this.linesColorScale=k;this.tooltip=q;this.outer=this.plot=null;this.buildChart(c,e,g,k);this.setupTooltips(l)}buildChart(c,e,g){this.outer&&this.outer.destroy();var k=new Plottable.Scales.Category;const q=new Plottable.Scales.Linear,l=new Plottable.Axes.Category(k,"bottom"),m=new Plottable.Axes.Numeric(q,"left"),p=new Plottable.Plots.ClusteredBar; p.x(function(t){return t.x},k);p.y(function(t){return t.y},q);_.keys(c).forEach(t=>p.addDataset((new Plottable.Dataset(c[t])).metadata(t)));p.attr("fill",function(t,v,x){return g.scale(x.metadata())});this.plot=p;const n=_.keys(e);if(0<n.length){const t=new Plottable.Plots.Line;t.x(function(v){return v.x},k);t.y(function(v){return v.y},q);n.forEach(v=>t.addDataset((new Plottable.Dataset(e[v])).metadata(v)));t.attr("stroke",(v,x,y)=>this.linesColorScale.scale(y.metadata()));k=new Plottable.Components.Group([p, t]);this.outer=new Plottable.Components.Table([[m,k],[null,l]])}else this.outer=new Plottable.Components.Table([[m,p],[null,l]])}setupTooltips(c){var e=this.tooltip.select("thead tr");e.selectAll("th").data(c).enter().append("th").text(k=>k.title);e.insert("th",":first-child");const g=this.plot;e=new To.PointerInteraction;e.attachTo(g);e.onPointerMove(k=>{(k=g.entityNearest(k))&&this.drawTooltips(k,c)});e.onPointerExit(()=>{this.tooltip.style("opacity",0)})}drawTooltips(c,e){const g=c.datum.x,k=c.dataset.metadata(); var q=_.mapValues(this.data,p=>_.filter(p,n=>n.x==g));q=_.pickBy(q,p=>0<p.length);q=_.mapValues(q,p=>p[0]);q=d3.entries(q);const l=this.tooltip.select("tbody").html("").selectAll("tr").data(q).enter().append("tr");l.style("white-space","nowrap");l.classed("closest",p=>p.key==k);const m=this.colorScale;l.append("td").append("div").classed("swatch",!0).style("background-color",p=>m.scale(p.key));_.each(e,p=>{l.append("td").text(n=>p.evaluate(n))});this.tooltip.style("transform","translate("+c.position.x+ "px,"+c.position.y+"px)");this.tooltip.style("opacity",1)}renderTo(c){this.targetSVG=c;this.outer.renderTo(c)}redraw(){this.outer.redraw()}destroy(){this.outer.destroy()}}})(Uo||(Uo={})); //# sourceURL=build://vz-chart-helpers/vz-chart-tooltip.js var Vo; (function(b){let c;(function(g){g.AUTO="auto";g.BOTTOM="bottom";g.RIGHT="right"})(c=b.TooltipPosition||(b.TooltipPosition={}));const e={boxShadow:"0 1px 4px rgba(0, 0, 0, .3)",opacity:0,position:"fixed",willChange:"transform",zIndex:5};Polymer({is:"vz-chart-tooltip",_template:null,properties:{contentComponentName:String,position:{type:String,value:c.AUTO},minDistFromEdge:{type:Number,value:15}},ready(){this._tunnel=this._raf=this._styleCache=null},attached(){this._tunnel=this._createTunnel();this._hideOnBlur= ()=>{document.hidden&&this.hide()};window.addEventListener("visibilitychange",this._hideOnBlur)},detached(){this.hide();this._removeTunnel(this._tunnel);this._tunnel=null;window.removeEventListener("visibilitychange",this._hideOnBlur)},content(){return this._tunnel.shadowRoot},hide(){window.cancelAnimationFrame(this._raf);this._styleCache=null;this._tunnel.style.opacity=0},updateAndPosition(g){window.cancelAnimationFrame(this._raf);this._raf=window.requestAnimationFrame(()=>{this.isAttached&&this._repositionImpl(g)})}, _repositionImpl(g){const k=this._tunnel;g=g.getBoundingClientRect();const q=k.getBoundingClientRect(),l=window.innerHeight,m=document.body.clientWidth,p=g.top,n=p+g.height,t=q.height+To.TOOLTIP_Y_PIXEL_OFFSET;let v=null,x=Math.max(this.minDistFromEdge,g.left),y=null,z=p;this.position==c.RIGHT?x=g.right:(z=n+To.TOOLTIP_Y_PIXEL_OFFSET,m<x+q.width+this.minDistFromEdge&&(x=null,y=this.minDistFromEdge));this.position==c.AUTO&&0<g.top-t&&l<g.top+g.height+t&&(z=null,v=l-p+To.TOOLTIP_Y_PIXEL_OFFSET);g={opacity:1, left:x?`${x}px`:null,right:y?`${y}px`:null,top:z?`${z}px`:null,bottom:v?`${v}px`:null};_.isEqual(this._styleCache,g)||(Object.assign(k.style,g),this._styleCache=g)},_createTunnel(){if(!this.contentComponentName)throw new RangeError("Require `contentComponentName` to be a name of a Polymer component");const g=document.createElement(this.contentComponentName);Object.assign(g.style,e);document.body.appendChild(g);return g},_removeTunnel(g){document.body.removeChild(g)}})})(Vo||(Vo={})); //# sourceURL=build://vz-line-chart/dragZoomInteraction.js var Wo; (function(b){class c extends Plottable.Components.SelectionBoxLayer{constructor(e,g,k){super();this.easeFn=d3.easeCubicInOut;this._animationTime=750;this.xScale(e);this.yScale(g);this._dragInteraction=new Plottable.Interactions.Drag;this._doubleClickInteraction=new Plottable.Interactions.Click;this.setupCallbacks();this.unzoomMethod=k;this.onDetach(()=>{this._doubleClickInteraction.detachFrom();this._dragInteraction.detachFrom()});this.onAnchor(()=>{this._doubleClickInteraction.attachTo(this);this._dragInteraction.attachTo(this)})}interactionStart(e){this.onStart= e}interactionEnd(e){this.onEnd=e}dragInteraction(){return this._dragInteraction}setupCallbacks(){let e=!1;this._dragInteraction.onDragStart(g=>{this.bounds({topLeft:g,bottomRight:g});this.onStart()});this._dragInteraction.onDrag((g,k)=>{this.bounds({topLeft:g,bottomRight:k});this.boxVisible(!0);e=!0});this._dragInteraction.onDragEnd((g,k)=>{this.boxVisible(!1);this.bounds({topLeft:g,bottomRight:k});if(e)this.zoom();else this.onEnd();e=!1});this._doubleClickInteraction.onDoubleClick(this.unzoom.bind(this))}animationTime(e){if(null== e)return this._animationTime;if(0>e)throw Error("animationTime cannot be negative");this._animationTime=e;return this}ease(e){if("function"!==typeof e)throw Error("ease function must be a function");0===e(0)&&1===e(1)||Plottable.Utils.Window.warn("Easing function does not maintain invariant f(0)\x3d\x3d0 \x26\x26 f(1)\x3d\x3d1. Bad behavior may result.");this.easeFn=e;return this}zoom(){let e=this.xExtent()[0].valueOf(),g=this.xExtent()[1].valueOf(),k=this.yExtent()[1].valueOf(),q=this.yExtent()[0].valueOf(); e!==g&&k!==q&&this.interpolateZoom(e,g,k,q)}unzoom(){var e=this.xScale();e._domainMin=null;e._domainMax=null;e=e._getExtent();this.xScale().domain(e);this.unzoomMethod()}isZooming(e){this._dragInteraction.enabled(!e);this._doubleClickInteraction.enabled(!e)}interpolateZoom(e,g,k,q){let l=this.xScale().domain()[0].valueOf(),m=this.xScale().domain()[1].valueOf(),p=this.yScale().domain()[0].valueOf(),n=this.yScale().domain()[1].valueOf(),t=this.easeFn,v=(z,A,D)=>d3.interpolateNumber(z,A)(t(D));this.isZooming(!0); let x=Date.now(),y=()=>{var z=Date.now()-x;z=0===this._animationTime?1:Math.min(1,z/this._animationTime);let A=v(l,e,z),D=v(m,g,z),H=v(p,k,z),E=v(n,q,z);this.xScale().domain([A,D]);this.yScale().domain([H,E]);1>z?Plottable.Utils.DOM.requestAnimationFramePolyfill(y):(this.onEnd(),this.isZooming(!1))};y()}}b.DragZoomLayer=c})(Wo||(Wo={})); //# sourceURL=build://vz-line-chart2/panZoomDragLayer.js var Xo; (function(b){let c;(function(g){g[g.NONE=0]="NONE";g[g.DRAG_ZOOMING=1]="DRAG_ZOOMING";g[g.PANNING=2]="PANNING"})(c||(c={}));class e extends Plottable.Components.Group{constructor(g,k,q){super();this.state=c.NONE;this.panStartCallback=new Plottable.Utils.CallbackSet;this.panEndCallback=new Plottable.Utils.CallbackSet;this.panZoom=new Plottable.Interactions.PanZoom(g,k);this.panZoom.dragInteraction().mouseFilter(m=>e.isPanKey(m)&&0===m.button);this.panZoom.wheelFilter(this.canScrollZoom);this.dragZoomLayer=new Wo.DragZoomLayer(g, k,q);this.dragZoomLayer.dragInteraction().mouseFilter(m=>!e.isPanKey(m)&&0===m.button);this.append(this.dragZoomLayer);const l=this.onWheel.bind(this);this.onAnchor(()=>{this._mouseDispatcher=Plottable.Dispatchers.Mouse.getDispatcher(this);this._mouseDispatcher.onWheel(l);this.panZoom.attachTo(this)});this.onDetach(()=>{this.panZoom.detachFrom();this._mouseDispatcher&&(this._mouseDispatcher.offWheel(l),this._mouseDispatcher=null)});this.panZoom.dragInteraction().onDragStart(()=>{this.state==c.NONE&& this.setState(c.PANNING)});this.panZoom.dragInteraction().onDragEnd(()=>{this.state==c.PANNING&&this.setState(c.NONE)});this.dragZoomLayer.dragInteraction().onDragStart(()=>{this.state==c.NONE&&this.setState(c.DRAG_ZOOMING)});this.dragZoomLayer.dragInteraction().onDragEnd(()=>{this.state==c.DRAG_ZOOMING&&this.setState(c.NONE)})}onWheel(g,k){if(!this.canScrollZoom(k)&&(g=this.element(),g.select(".help").empty())){var q=g.append("div").classed("help",!0);q.append("span").text("Alt + Scroll to Zoom"); q.on("animationend",()=>void q.remove())}}static isPanKey(g){return!!g.altKey||!!g.shiftKey}canScrollZoom(g){return g.altKey}setState(g){if(this.state!=g){var k=this.state;this.state=g;this.root().removeClass(this.stateClassName(k));this.root().addClass(this.stateClassName(g));k==c.PANNING&&this.panEndCallback.callCallbacks();g==c.PANNING&&this.panStartCallback.callCallbacks()}}stateClassName(g){switch(g){case c.PANNING:return"panning";case c.DRAG_ZOOMING:return"drag-zooming";default:return""}}onPanStart(g){this.panStartCallback.add(g)}onPanEnd(g){this.panEndCallback.add(g)}onScrollZoom(g){this.panZoom.onZoomEnd(g)}onDragZoomStart(g){this.dragZoomLayer.interactionStart(g)}onDragZoomEnd(g){this.dragZoomLayer.interactionEnd(g)}} b.PanZoomDragLayer=e})(Xo||(Xo={})); //# sourceURL=build://vz-line-chart2/tf-scale.js (function(b){class c extends Plottable.QuantitativeScale{constructor(){super(...arguments);this._ignoreOutlier=!1}setValueProviderForDomain(e){this._valueProviderForDomain=e}ignoreOutlier(e){return"boolean"==typeof e?(this._ignoreOutlier=e,this):this._ignoreOutlier}_getAllIncludedValues(){const e=this._valueProviderForDomain?this._valueProviderForDomain():[];return this.extentOfValues(e)}}b.TfScale=c})(Xo||(Xo={})); //# sourceURL=build://vz-line-chart2/linear-scale.js (function(b){class c extends Plottable.Scales.Linear{constructor(){super();this._ignoreOutlier=!1;this.padProportion(.2)}setValueProviderForDomain(e){this._valueProviderForDomain=e}_niceDomain(e,g){const [k,q]=e,l=q-k;e=0===l?1.1*Math.abs(k)+1.1:l*this.padProportion();return super._niceDomain([0<=k&&k<l?-.1*q:k-e,q+e],g)}_getUnboundedExtent(e){e=this._getAllIncludedValues(e);let g=this._defaultExtent();0!==e.length&&(e=[Plottable.Utils.Math.min(e,g[0]),Plottable.Utils.Math.max(e,g[1])],g=this._niceDomain(e)); return g}_getAllIncludedValues(){const e=this._valueProviderForDomain?this._valueProviderForDomain():[];return this.extentOfValues(e)}extentOfValues(e){var g=e=e.filter(k=>Plottable.Utils.Math.isValidNumber(k));if(this.ignoreOutlier()){g=e.sort((l,m)=>l-m);const k=d3.quantile(g,.05),q=d3.quantile(g,.95);g=e.filter(l=>l>=k&&l<=q)}e=d3.extent(g);return null==e[0]||null==e[1]?[]:e}ignoreOutlier(e){return"boolean"==typeof e?(this._ignoreOutlier=e,this):this._ignoreOutlier}}b.LinearScale=c})(Xo||(Xo={})); //# sourceURL=build://vz-line-chart2/log-scale.js (function(b){function c(k){return Math.log10(k)}function e(k){return Math.pow(10,k)}b.MIN_POSITIVE_VALUE=Math.pow(2,-1074);class g extends b.TfScale{constructor(){super();this._d3LogScale=d3.scaleLog();this.padProportion(.2)}scale(k){return 0>=k?NaN:this._d3LogScale(k)}invert(k){return this._d3LogScale.invert(k)}scaleTransformation(k){return this.scale(k)}invertedTransformation(k){return this.invert(k)}getTransformationDomain(){return this.domain()}_getDomain(){return this._untransformedDomain}_setDomain(k){this._untransformedDomain= k;const [q,l]=k;super._setDomain([Math.max(b.MIN_POSITIVE_VALUE,q),l])}_niceDomain(k){const [q,l]=k;k=Math.max(c(b.MIN_POSITIVE_VALUE),c(q));const m=c(l);var p=m-k;p=p?p*this.padProportion():1;return[e(Math.max(c(b.MIN_POSITIVE_VALUE),k-p)),e(m+p)]}_getUnboundedExtent(k){k=this._getAllIncludedValues(k);let q=this._defaultExtent();0!==k.length&&(k=[Plottable.Utils.Math.min(k,q[0]),Plottable.Utils.Math.max(k,q[1])],q=this._niceDomain(k));return q}_getAllIncludedValues(){return super._getAllIncludedValues().map(k=> 0<k?k:b.MIN_POSITIVE_VALUE)}_defaultExtent(){return[1,10]}_backingScaleDomain(k){if(null==k)return this._d3LogScale.domain();this._d3LogScale.domain(k);return this}_getRange(){return this._d3LogScale.range()}_setRange(k){this._d3LogScale.range(k)}defaultTicks(){return this._d3LogScale.ticks()}ticks(){return this._d3LogScale.ticks()}extentOfValues(k){let q=k=k.filter(l=>Plottable.Utils.Math.isValidNumber(l)&&0<l);if(this.ignoreOutlier()){k=k.map(c).sort((p,n)=>p-n);const l=d3.quantile(k,.05),m=d3.quantile(k, .95);q=k.filter(p=>p>=l&&p<=m).map(e)}k=d3.extent(q);return null==k[0]||null==k[1]?[]:k}}b.LogScale=g})(Xo||(Xo={})); //# sourceURL=build://vz-line-chart2/line-chart.js (function(b){let c;(function(k){k[k.TEXT=0]="TEXT";k[k.DOM=1]="DOM"})(c||(c={}));let e;(function(k){k.LOG="log";k.LINEAR="linear"})(e||(e={}));class g{constructor(k,q,l,m,p,n,t,v,x,y,z){this.seriesNames=[];this.name2datasets={};this.colorScale=m;this.tooltip=p;this.datasets=[];this._ignoreYOutliers=!1;this.lastPointsDataset=new Plottable.Dataset;this.nanDataset=new Plottable.Dataset;this.yValueAccessor=q;this.symbolFunction=y;this.onDatasetChanged=this._onDatasetChanged.bind(this);this._defaultXRange= v;this._defaultYRange=x;this.tooltipColumns=n;this.buildChart(k,q,l,t,z)}buildChart(k,q,l,m,p){this.destroy();k=k();this.xAccessor=k.accessor;this.xScale=k.scale;this.xAxis=k.axis;this.xAxis.margin(0).tickLabelPadding(3);p&&this.xAxis.formatter(p);this.yScale=g.getYScaleFromType(l);this.yScale.setValueProviderForDomain(()=>this.getValuesForYAxisDomainCompute());this.yAxis=new Plottable.Axes.Numeric(this.yScale,"left");p=To.multiscaleFormatter(To.Y_AXIS_FORMATTER_PRECISION);this.yAxis.margin(0).tickLabelPadding(5).formatter(p); this.yAxis.usesTextWidthApproximation();this.fillArea=m;p=new b.PanZoomDragLayer(this.xScale,this.yScale,()=>this.resetDomain());this.tooltipInteraction=this.createTooltipInteraction(p);this.tooltipPointsComponent=new Plottable.Component;m=this.buildPlot(this.xScale,this.yScale,m);this.gridlines=new Plottable.Components.Gridlines(this.xScale,this.yScale);k=null;l!==e.LOG&&(k=new Plottable.Components.GuideLineLayer("horizontal"),k.scale(this.yScale).value(0));l=new Plottable.Components.GuideLineLayer("vertical"); l.scale(this.xScale).value(0);this.center=new Plottable.Components.Group([this.gridlines,k,l,m,this.tooltipPointsComponent,p]);this.center.addClass("main");this.outer=new Plottable.Components.Table([[this.yAxis,this.center],[null,this.xAxis]])}buildPlot(k,q,l){l&&(this.marginAreaPlot=new Plottable.Plots.Area,this.marginAreaPlot.x(this.xAccessor,k),this.marginAreaPlot.y(l.higherAccessor,q),this.marginAreaPlot.y0(l.lowerAccessor),this.marginAreaPlot.attr("fill",(t,v,x)=>this.colorScale.scale(x.metadata().name)), this.marginAreaPlot.attr("fill-opacity",.3),this.marginAreaPlot.attr("stroke-width",0));this.smoothedAccessor=t=>t.smoothed;l=new Plottable.Plots.Line;l.x(this.xAccessor,k);l.y(this.yValueAccessor,q);l.attr("stroke",(t,v,x)=>this.colorScale.scale(x.metadata().name));this.linePlot=l;this.setupTooltips(l);let m=new Plottable.Plots.Line;m.x(this.xAccessor,k);m.y(this.smoothedAccessor,q);m.attr("stroke",(t,v,x)=>this.colorScale.scale(x.metadata().name));this.smoothLinePlot=m;if(this.symbolFunction){var p= new Plottable.Plots.Scatter;p.x(this.xAccessor,k);p.y(this.yValueAccessor,q);p.attr("fill",(t,v,x)=>this.colorScale.scale(x.metadata().name));p.attr("opacity",1);p.size(2*To.TOOLTIP_CIRCLE_SIZE);p.symbol((t,v,x)=>this.symbolFunction(x.metadata().name));this.markersScatterPlot=p}p=new Plottable.Plots.Scatter;p.x(this.xAccessor,k);p.y(this.yValueAccessor,q);p.attr("fill",t=>this.colorScale.scale(t.name));p.attr("opacity",1);p.size(2*To.TOOLTIP_CIRCLE_SIZE);p.datasets([this.lastPointsDataset]);this.scatterPlot= p;let n=new Plottable.Plots.Scatter;n.x(this.xAccessor,k);n.y(t=>t.displayY,q);n.attr("fill",t=>this.colorScale.scale(t.name));n.attr("opacity",1);n.size(2*To.NAN_SYMBOL_SIZE);n.datasets([this.nanDataset]);n.symbol(Plottable.SymbolFactories.triangle);this.nanDisplay=n;k=[n,p,m,l];this.marginAreaPlot&&k.push(this.marginAreaPlot);this.markersScatterPlot&&k.push(this.markersScatterPlot);return new Plottable.Components.Group(k)}_onDatasetChanged(k){this.smoothingEnabled&&this.resmoothDataset(k);this.updateSpecialDatasets()}ignoreYOutliers(k){k!== this._ignoreYOutliers&&(this._ignoreYOutliers=k,this.updateSpecialDatasets(),this.yScale.ignoreOutlier(k),this.resetYDomain())}getValuesForYAxisDomainCompute(){const k=this.getAccessorsForComputingYRange();return _.flattenDeep(this.datasets.map(q=>k.map(l=>q.data().map(m=>l(m,-1,q))))).filter(isFinite)}updateSpecialDatasets(){const k=this.getYAxisAccessor();var q=this.datasets.map(l=>{let m=null,p=l.data().filter(n=>!isNaN(k(n,-1,l)));0<p.length&&(m=p[p.length-1],m.name=l.metadata().name,m.relative= To.relativeAccessor(m,-1,l));return m}).filter(l=>null!=l);this.lastPointsDataset.data(q);this.markersScatterPlot&&this.markersScatterPlot.datasets(this.datasets.map(this.createSampledDatasetForMarkers));q=_.flatten(this.datasets.map(l=>{let m=null,p=l.data(),n=0;for(;n<p.length&&null==m;)isNaN(k(p[n],-1,l))||(m=k(p[n],-1,l)),n++;null==m&&(m=0);let t=[];for(n=0;n<p.length;n++)isNaN(k(p[n],-1,l))?(p[n].name=l.metadata().name,p[n].displayY=m,p[n].relative=To.relativeAccessor(p[n],-1,l),t.push(p[n])): m=k(p[n],-1,l);return t}));this.nanDataset.data(q)}resetDomain(){this.resetXDomain();this.resetYDomain()}resetXDomain(){if(null!=this._defaultXRange)var k=this._defaultXRange;else k=this.xScale,k._domainMin=null,k._domainMax=null,k=k._getExtent();this.xScale.domain(k)}resetYDomain(){null!=this._defaultYRange?this.yScale.domain(this._defaultYRange):(this.yScale.autoDomain(),this.yScale.domain(this.yScale.domain()))}getAccessorsForComputingYRange(){const k=[this.getYAxisAccessor()];this.fillArea&&k.push(this.fillArea.lowerAccessor, this.fillArea.higherAccessor);return k}getYAxisAccessor(){return this.smoothingEnabled?this.smoothedAccessor:this.yValueAccessor}createTooltipInteraction(k){const q=new To.PointerInteraction,l=()=>{q.enabled(!1);this.hideTooltips()},m=()=>q.enabled(!0);k.onPanStart(l);k.onDragZoomStart(l);k.onPanEnd(m);k.onDragZoomEnd(m);k.onScrollZoom(()=>this.updateTooltipContent(this._lastMousePosition));q.onPointerMove(p=>{this._lastMousePosition=p;this.updateTooltipContent(p)});q.onPointerExit(()=>this.hideTooltips()); return q}updateTooltipContent(k){this.linePlot&&(window.cancelAnimationFrame(this._tooltipUpdateAnimationFrame),this._tooltipUpdateAnimationFrame=window.requestAnimationFrame(()=>{let q={x:k.x,y:k.y,datum:null,dataset:null},l=this.gridlines.content().node().getBBox();var m=this.linePlot.datasets().map(v=>this.findClosestPoint(q,v)).filter(Boolean);let p=Plottable.Utils.DOM.intersectsBBox,n=m.filter(v=>p(v.x,v.y,l)||isNaN(this.yValueAccessor(v.datum,0,v.dataset))),t=n.filter(v=>!isNaN(this.yValueAccessor(v.datum, 0,v.dataset)));0!==m.length?(this.scatterPlot.attr("display","none"),m=this.tooltipPointsComponent.content().selectAll(".point").data(t,v=>v.dataset.metadata().name),m.enter().append("circle").classed("point",!0),m.attr("r",To.TOOLTIP_CIRCLE_SIZE).attr("cx",v=>v.x).attr("cy",v=>v.y).style("stroke","none").attr("fill",v=>this.colorScale.scale(v.dataset.metadata().name)),m.exit().remove(),this.drawTooltips(n,q,this.tooltipColumns)):this.hideTooltips()}))}hideTooltips(){window.cancelAnimationFrame(this._tooltipUpdateAnimationFrame); this.tooltip.hide();this.scatterPlot.attr("display","block");this.tooltipPointsComponent.content().selectAll(".point").remove()}setupTooltips(k){k.onDetach(()=>{this.tooltipInteraction.detachFrom();this.tooltipInteraction.enabled(!1)});k.onAnchor(()=>{this.tooltipInteraction.attachTo(k);this.tooltipInteraction.enabled(!0)})}drawTooltips(k,q,l){if(k.length){var {colorScale:m}=this;l=[{title:"",static:!1,evalType:c.DOM,evaluate(z){d3.select(this).select("span").style("background-color",()=>m.scale(z.dataset.metadata().name)); return""},enter(z){d3.select(this).append("span").classed("swatch",!0).style("background-color",()=>m.scale(z.dataset.metadata().name))}},...l];var p=z=>Math.pow(z.x-q.x,2)+Math.pow(z.y-q.y,2),n=_.min(k.map(p)),t=this.smoothingEnabled?this.smoothedAccessor:this.yValueAccessor;k="ascending"===this.tooltipSortingMethod?_.sortBy(k,z=>t(z.datum,-1,z.dataset)):"descending"===this.tooltipSortingMethod?_.sortBy(k,z=>t(z.datum,-1,z.dataset)).reverse():"nearest"===this.tooltipSortingMethod?_.sortBy(k,p):k.slice(0).reverse(); var v=this,x=d3.select(this.tooltip.content()).select("table"),y=x.select("thead").selectAll("th").data(l,z=>z.title);y.enter().append("th").text(z=>z.title).nodes();y.exit().remove();k=x.select("tbody").selectAll("tr").data(k,z=>z.dataset.metadata().name);k.classed("distant",z=>{var A=z.dataset.data()[0],D=_.last(z.dataset.data());A=this.xScale.scale(this.xAccessor(A,0,z.dataset));D=this.xScale.scale(this.xAccessor(D,0,z.dataset));z=this.smoothingEnabled?z.datum.smoothed:this.yValueAccessor(z.datum, 0,z.dataset);return q.x<A||q.x>D||isNaN(z)}).classed("closest",z=>p(z)===n).each(function(z){v.drawTooltipRow(this,l,z)}).order();k.exit().remove();k.enter().append("tr").each(function(z){v.drawTooltipRow(this,l,z)}).nodes();this.tooltip.updateAndPosition(this.targetSVG.node())}else this.tooltip.hide()}drawTooltipRow(k,q,l){const m=this;k=d3.select(k).selectAll("td").data(q);k.each(function(p){p.static||m.drawTooltipColumn.call(m,this,p,l)});k.enter().append("td").each(function(p){p.enter&&p.enter.call(this, l);m.drawTooltipColumn.call(m,this,p,l)})}drawTooltipColumn(k,q,l){const {smoothingEnabled:m}=this;q.evalType==c.DOM?q.evaluate.call(k,l,{smoothingEnabled:m}):d3.select(k).text(q.evaluate.call(k,l,{smoothingEnabled:m}))}findClosestPoint(k,q){const l=q.data().map((n,t)=>this.xScale.scale(this.xAccessor(n,t,q)));let m=_.sortedIndex(l,k.x);if(0==l.length)return null;m===l.length?--m:0!==m&&(m=Math.abs(l[m-1]-k.x)<Math.abs(l[m]-k.x)?m-1:m);k=q.data()[m];const p=this.smoothingEnabled?this.smoothedAccessor(k, m,q):this.yValueAccessor(k,m,q);return{x:l[m],y:this.yScale.scale(p),datum:k,dataset:q}}resmoothDataset(k){let q=k.data();const l=this.smoothingWeight;let m=0<q.length?0:NaN,p=0;const n=q.map((v,x)=>this.yValueAccessor(v,x,k)),t=n.every(v=>v==n[0]);q.forEach((v,x)=>{x=n[x];t||!Number.isFinite(x)?v.smoothed=x:(m=m*l+(1-l)*x,p++,x=1,1!==l&&(x=1-Math.pow(l,p)),v.smoothed=m/x)})}getDataset(k){void 0===this.name2datasets[k]&&(this.name2datasets[k]=new Plottable.Dataset([],{name:k,meta:null}));return this.name2datasets[k]}static getYScaleFromType(k){if(k=== e.LOG)return new b.LogScale;if(k===e.LINEAR)return new b.LinearScale;throw Error("Unrecognized yScale type "+k);}setVisibleSeries(k){this.seriesNames=k=k.sort();k.reverse();this.datasets.forEach(q=>q.offUpdate(this.onDatasetChanged));this.datasets=k.map(q=>this.getDataset(q));this.datasets.forEach(q=>q.onUpdate(this.onDatasetChanged));this.linePlot.datasets(this.datasets);this.smoothingEnabled&&this.smoothLinePlot.datasets(this.datasets);this.marginAreaPlot&&this.marginAreaPlot.datasets(this.datasets); this.updateSpecialDatasets()}createSampledDatasetForMarkers(k){const q=k.data();if(20>=q.length)return k;const l=Math.ceil(q.length/20),m=Array(Math.floor(q.length/l));for(let p=0,n=0;p<m.length;p++,n+=l)m[p]=q[n];return new Plottable.Dataset(m,k.metadata())}setSeriesData(k,q){this.getDataset(k).data(q);this.measureBBoxAndMaybeInvalidateLayoutInRaf()}setSeriesMetadata(k,q){q=Object.assign({},this.getDataset(k).metadata(),{meta:q});this.getDataset(k).metadata(q)}smoothingUpdate(k){this.smoothingWeight= k;this.datasets.forEach(q=>this.resmoothDataset(q));this.smoothingEnabled||(this.linePlot.addClass("ghost"),this.scatterPlot.y(this.smoothedAccessor,this.yScale),this.smoothingEnabled=!0,this.smoothLinePlot.datasets(this.datasets));this.markersScatterPlot&&this.markersScatterPlot.y(this.getYAxisAccessor(),this.yScale);this.updateSpecialDatasets()}smoothingDisable(){this.smoothingEnabled&&(this.linePlot.removeClass("ghost"),this.scatterPlot.y(this.yValueAccessor,this.yScale),this.smoothLinePlot.datasets([]), this.smoothingEnabled=!1,this.updateSpecialDatasets());this.markersScatterPlot&&this.markersScatterPlot.y(this.getYAxisAccessor(),this.yScale)}setTooltipSortingMethod(k){this.tooltipSortingMethod=k}renderTo(k){this.targetSVG=k;this.outer.renderTo(k);null!=this._defaultXRange&&this.resetXDomain();null!=this._defaultYRange&&this.resetYDomain();this.measureBBoxAndMaybeInvalidateLayoutInRaf()}redraw(){window.cancelAnimationFrame(this._redrawRaf);this._redrawRaf=window.requestAnimationFrame(()=>{this.measureBBoxAndMaybeInvalidateLayout(); this.outer.redraw()})}measureBBoxAndMaybeInvalidateLayoutInRaf(){window.cancelAnimationFrame(this._invalidateLayoutRaf);this._invalidateLayoutRaf=window.requestAnimationFrame(()=>{this.measureBBoxAndMaybeInvalidateLayout()})}measureBBoxAndMaybeInvalidateLayout(){if(this._lastDrawBBox){const {width:k}=this._lastDrawBBox,{width:q}=this.targetSVG.node().getBoundingClientRect();0==k&&k<q&&this.outer.invalidateCache()}this._lastDrawBBox=this.targetSVG.node().getBoundingClientRect()}destroy(){window.cancelAnimationFrame(this._redrawRaf); window.cancelAnimationFrame(this._invalidateLayoutRaf);this.outer&&this.outer.destroy()}onAnchor(k){if(this.outer)this.outer.onAnchor(k)}}b.LineChart=g})(Xo||(Xo={})); //# sourceURL=build://vz-line-chart2/vz-line-chart2.js (function(b){const c=To.multiscaleFormatter(To.Y_TOOLTIP_FORMATTER_PRECISION),e=g=>isNaN(g)?"NaN":c(g);b.DEFAULT_TOOLTIP_COLUMNS=[{title:"Name",evaluate:g=>g.dataset.metadata().name},{title:"Smoothed",evaluate(g,k){({smoothingEnabled:k}=k);return e(k?g.datum.smoothed:g.datum.scalar)}},{title:"Value",evaluate:g=>e(g.datum.scalar)},{title:"Step",evaluate:g=>To.stepFormatter(g.datum.step)},{title:"Time",evaluate:g=>To.timeFormatter(g.datum.wall_time)},{title:"Relative",evaluate:g=>To.relativeFormatter(To.relativeAccessor(g.datum, -1,g.dataset))}];Polymer({is:"vz-line-chart2",properties:{colorScale:{type:Object,value:function(){return(new Plottable.Scales.Color).range(d3.schemeCategory10)}},symbolFunction:Object,smoothingEnabled:{type:Boolean,notify:!0,value:!1},smoothingWeight:{type:Number,value:.6},xType:{type:String,value:""},xComponentsCreationMethod:{type:Object,value:""},xAxisFormatter:Object,yValueAccessor:{type:Object,value:()=>g=>g.scalar},tooltipColumns:{type:Array,value:()=>b.DEFAULT_TOOLTIP_COLUMNS},fillArea:Object, defaultXRange:Array,defaultYRange:Array,yScaleType:{type:String,value:"linear"},ignoreYOutliers:{type:Boolean,value:!1},tooltipSortingMethod:{type:String,value:"default"},tooltipPosition:{type:String,value:Vo.TooltipPosition.BOTTOM},_chart:Object,_visibleSeriesCache:{type:Array,value:()=>[]},_seriesDataCache:{type:Object,value:()=>({})},_seriesMetadataCache:{type:Object,value:()=>({})},_makeChartAsyncCallbackId:{type:Number,value:null}},observers:["_makeChart(xComponentsCreationMethod, xType, yValueAccessor, yScaleType, tooltipColumns, colorScale, isAttached)", "_reloadFromCache(_chart, _visibleSeriesCache)","_smoothingChanged(smoothingEnabled, smoothingWeight, _chart)","_tooltipSortingMethodChanged(tooltipSortingMethod, _chart)","_outliersChanged(ignoreYOutliers, _chart)"],ready(){this.scopeSubtree(this.$.chartdiv,!0)},attached(){const g={capture:!0,passive:!0};this._listen(this,"mousedown",this._onMouseDown.bind(this),g);this._listen(this,"mouseup",this._onMouseUp.bind(this),g);this._listen(window,"keydown",this._onKeyDown.bind(this),g);this._listen(window, "keyup",this._onKeyUp.bind(this),g)},detached(){this.cancelAsync(this._makeChartAsyncCallbackId);this._chart&&this._chart.destroy();this._listeners&&(this._listeners.forEach(({node:g,eventName:k,func:q,option:l})=>{g.removeEventListener(k,q,l)}),this._listeners.clear())},_listen(g,k,q,l={}){this._listeners||(this._listeners=new Set);this._listeners.add({node:g,eventName:k,func:q,option:l});g.addEventListener(k,q,l)},_onKeyDown(g){this.toggleClass("pankey",b.PanZoomDragLayer.isPanKey(g))},_onKeyUp(g){this.toggleClass("pankey", b.PanZoomDragLayer.isPanKey(g))},_onMouseDown(){this.toggleClass("mousedown",!0)},_onMouseUp(){this.toggleClass("mousedown",!1)},setVisibleSeries:function(g){_.isEqual(this._visibleSeriesCache,g)||(this._visibleSeriesCache=g)},setSeriesData:function(g,k){this._seriesDataCache[g]=k;this._chart&&this._chart.setSeriesData(g,k)},setSeriesMetadata(g,k){this._seriesMetadataCache[g]=k;this._chart&&this._chart.setSeriesMetadata(g,k)},resetDomain:function(){this._chart&&this._chart.resetDomain()},redraw:function(){this._chart&& this._chart.redraw()},_makeChart:function(g,k,q,l,m,p){k||g?k&&(g=()=>To.getXComponents(k)):g=To.stepX;null!==this._makeChartAsyncCallbackId&&(this.cancelAsync(this._makeChartAsyncCallbackId),this._makeChartAsyncCallbackId=null);this._makeChartAsyncCallbackId=this.async(function(){this._makeChartAsyncCallbackId=null;if(g&&this.yValueAccessor&&this.tooltipColumns){var n=new b.LineChart(g,this.yValueAccessor,l,p,this.$.tooltip,this.tooltipColumns,this.fillArea,this.defaultXRange,this.defaultYRange, this.symbolFunction,this.xAxisFormatter),t=d3.select(this.$.chartdiv);n.renderTo(t);this._chart&&this._chart.destroy();this._chart=n;this._chart.onAnchor(()=>this.fire("chart-attached"))}},350)},_reloadFromCache:function(){this._chart&&(this._visibleSeriesCache.forEach(g=>{this._chart.setSeriesData(g,this._seriesDataCache[g]||[])}),this._visibleSeriesCache.filter(g=>this._seriesMetadataCache[g]).forEach(g=>{this._chart.setSeriesMetadata(g,this._seriesMetadataCache[g])}),this._chart.setVisibleSeries(this._visibleSeriesCache))}, _smoothingChanged:function(){this._chart&&(this.smoothingEnabled?this._chart.smoothingUpdate(this.smoothingWeight):this._chart.smoothingDisable())},_outliersChanged:function(){this._chart&&this._chart.ignoreYOutliers(this.ignoreYOutliers)},_tooltipSortingMethodChanged:function(){this._chart&&this._chart.setTooltipSortingMethod(this.tooltipSortingMethod)},getExporter(){return new b.LineChartExporter(this.$.chartdiv)}})})(Xo||(Xo={})); //# sourceURL=build://vz-line-chart2/vz-line-chart2.html.js Polymer({is:"vz-line-chart-tooltip"}); //# sourceURL=build://wit-dashboard/wit-attribution-table.html.js Polymer({is:"wit-attribution-table",properties:{attributions:Array,models:Array,colors:Object,textColorFunction:Object},displayNum:function(b){return d3.format(".3f")(b)},displayAttributionHeader:function(b,c){return null!=b&&1<b.length?`Model ${b[c]}`:"Attribution"},getStyle:function(b){if(null==this.colors)return"";const c=this.colors.domain();return"background-color:"+this.colors(b)+";color:"+this.textColorFunction(b,c[0],c[c.length-1])}}); //# sourceURL=build://wit-dashboard/wit-confusion-matrix.html.js Polymer({is:"wit-confusion-matrix",properties:{counts:Object,allItems:{type:Array,value:()=>[]},label:String,background:{type:Object,value:d3.color("gray")}},observers:["drawMatrix(counts, allItems)"],ready:function(){this.scopeSubtree(this.$.holder,!0)},drawMatrix:function(b,c){this.$.holder.innerHTML="";if(b){var e=c;if(null==e||0==e.length){c=new Set;var g=Object.keys(b);for(var k=0;k<g.length;k++){c.add(g[k]);var q=Object.keys(b[g[k]]);for(let n=0;n<q.length;n++)c.add(q[n])}e=Array.from(c.values())}e= e.sort();2==e.length&&"No"==e[0]&&"Yes"==e[1]&&(e=e.reverse());var l=Array(e.length);_.fill(l,0);var m=[];for(c=0;c<e.length;c++)g=Array(e.length),_.fill(g,0),m.push(g);for(c=0;c<e.length;c++)for(g=0;g<e.length;g++)k=e[c],q=e[g],k in b&&q in b[k]&&(m[c][g]=b[k][q]);b=[];var p=0;for(c=0;c<m.length;c++)for(g=m[c].reduce((n,t)=>n+t,0),b.push([0].concat(m[c]).concat([g])),g=0;g<m.length;g++)l[g]+=m[c][g],p+=m[c][g];c=this.getIndices(m.length+2);q=d3.select(this.$.holder).append("table");g=q.append("thead"); k=q.append("tbody");q=q.append("tfoot");g.append("tr").selectAll("th").data(c).enter().append("th").text(n=>0==n?this.label:n<=m.length?"Predicted "+e[n-1]:"Total").attr("class",n=>0==n?"n-label":n<=m.length?"pred-label":"total-label");b=k.selectAll("tr").data(b).enter().append("tr").selectAll("td").data((n,t)=>n.map((v,x)=>0==x?{value:"Actual "+e[t]}:{value:v,row:t})).enter().append("td").attr("class",(n,t)=>0==t?"actual-label":t<=m.length?"value-cell":"total-cell").style("background",(n,t)=>{if(0== t||t>m.length)return"#FFFFFF";t=this.background;t.opacity=n.value/p;return t+""}).append("div").classed("flex",!0);b.append("div").classed("parenthetical",(n,t)=>!!t).text(n=>"row"in n?"("+n.value+")":"");b.append("div").text((n,t)=>0<t?d3.format(",.1%")(n.value/p):n.value);b=q.append("tr").selectAll("td").data(c).enter().append("td");b.classed("total-label",(n,t)=>0==t);b.classed("total-cell",(n,t)=>0!=t);b=b.append("div").classed("flex",!0);b.append("div").classed("parenthetical",(n,t)=>!!t).text(n=> 0==n?"Total":n<=m.length?"("+l[n-1]+")":"");b.append("div").text(n=>0==n?"":n<=m.length?d3.format(",.1%")(l[n-1]/p):"")}},getIndices:function(b){return Array.apply(null,{length:b}).map(Number.call,Number)}}); //# sourceURL=build://iron-autogrow-textarea/iron-autogrow-textarea.html.js Polymer({is:"iron-autogrow-textarea",behaviors:[Polymer.IronValidatableBehavior,Polymer.IronControlState],properties:{value:{observer:"_valueChanged",type:String,notify:!0},bindValue:{observer:"_bindValueChanged",type:String,notify:!0},rows:{type:Number,value:1,observer:"_updateCached"},maxRows:{type:Number,value:0,observer:"_updateCached"},autocomplete:{type:String,value:"off"},autofocus:{type:Boolean,value:!1},inputmode:{type:String},placeholder:{type:String},readonly:{type:String},required:{type:Boolean}, minlength:{type:Number},maxlength:{type:Number},label:{type:String}},listeners:{input:"_onInput"},get textarea(){return this.$.textarea},get selectionStart(){return this.$.textarea.selectionStart},get selectionEnd(){return this.$.textarea.selectionEnd},set selectionStart(b){this.$.textarea.selectionStart=b},set selectionEnd(b){this.$.textarea.selectionEnd=b},attached:function(){navigator.userAgent.match(/iP(?:[oa]d|hone)/)&&(this.$.textarea.style.marginLeft="-3px")},validate:function(){var b=this.$.textarea.validity.valid; b&&(this.required&&""===this.value?b=!1:this.hasValidator()&&(b=Polymer.IronValidatableBehavior.validate.call(this,this.value)));this.invalid=!b;this.fire("iron-input-validate");return b},_bindValueChanged:function(b){this.value=b},_valueChanged:function(b){var c=this.textarea;c&&(c.value!==b&&(c.value=b||0===b?b:""),this.bindValue=b,this.$.mirror.innerHTML=this._valueForMirror(),this.fire("bind-value-changed",{value:this.bindValue}))},_onInput:function(b){var c=Polymer.dom(b).path;this.value=c?c[0].value: b.target.value},_constrain:function(b){b=b||[""];for(b=0<this.maxRows&&b.length>this.maxRows?b.slice(0,this.maxRows):b.slice(0);0<this.rows&&b.length<this.rows;)b.push("");return b.join("\x3cbr/\x3e")+"\x26#160;"},_valueForMirror:function(){var b=this.textarea;if(b)return this.tokens=b&&b.value?b.value.replace(/&/gm,"\x26amp;").replace(/"/gm,"\x26quot;").replace(/'/gm,"\x26#39;").replace(/</gm,"\x26lt;").replace(/>/gm,"\x26gt;").split("\n"):[""],this._constrain(this.tokens)},_updateCached:function(){this.$.mirror.innerHTML= this._constrain(this.tokens)}}); //# sourceURL=build://iron-image/iron-image.html.js Polymer({is:"iron-image",properties:{src:{type:String,value:""},alt:{type:String,value:null},crossorigin:{type:String,value:null},preventLoad:{type:Boolean,value:!1},sizing:{type:String,value:null,reflectToAttribute:!0},position:{type:String,value:"center"},preload:{type:Boolean,value:!1},placeholder:{type:String,value:null,observer:"_placeholderChanged"},fade:{type:Boolean,value:!1},loaded:{notify:!0,readOnly:!0,type:Boolean,value:!1},loading:{notify:!0,readOnly:!0,type:Boolean,value:!1},error:{notify:!0, readOnly:!0,type:Boolean,value:!1},width:{observer:"_widthChanged",type:Number,value:null},height:{observer:"_heightChanged",type:Number,value:null}},observers:["_transformChanged(sizing, position)","_loadStateObserver(src, preventLoad)"],created:function(){this._resolvedSrc=""},_imgOnLoad:function(){this.$.img.src===this._resolveSrc(this.src)&&(this._setLoading(!1),this._setLoaded(!0),this._setError(!1))},_imgOnError:function(){this.$.img.src===this._resolveSrc(this.src)&&(this.$.img.removeAttribute("src"), this.$.sizedImgDiv.style.backgroundImage="",this._setLoading(!1),this._setLoaded(!1),this._setError(!0))},_computePlaceholderHidden:function(){return!this.preload||!this.fade&&!this.loading&&this.loaded},_computePlaceholderClassName:function(){return this.preload&&this.fade&&!this.loading&&this.loaded?"faded-out":""},_computeImgDivHidden:function(){return!this.sizing},_computeImgDivARIAHidden:function(){return""===this.alt?"true":void 0},_computeImgDivARIALabel:function(){return null!==this.alt?this.alt: ""===this.src?"":this._resolveSrc(this.src).replace(/[?|#].*/g,"").split("/").pop()},_computeImgHidden:function(){return!!this.sizing},_widthChanged:function(){this.style.width=isNaN(this.width)?this.width:this.width+"px"},_heightChanged:function(){this.style.height=isNaN(this.height)?this.height:this.height+"px"},_loadStateObserver:function(b,c){var e=this._resolveSrc(b);e!==this._resolvedSrc&&(this._resolvedSrc="",this.$.img.removeAttribute("src"),this.$.sizedImgDiv.style.backgroundImage="",""=== b||c?this._setLoading(!1):(this._resolvedSrc=e,this.$.img.src=this._resolvedSrc,this.$.sizedImgDiv.style.backgroundImage='url("'+this._resolvedSrc+'")',this._setLoading(!0)),this._setLoaded(!1),this._setError(!1))},_placeholderChanged:function(){this.$.placeholder.style.backgroundImage=this.placeholder?'url("'+this.placeholder+'")':""},_transformChanged:function(){var b=this.$.sizedImgDiv.style,c=this.$.placeholder.style;b.backgroundSize=c.backgroundSize=this.sizing;b.backgroundPosition=c.backgroundPosition= this.sizing?this.position:"";b.backgroundRepeat=c.backgroundRepeat=this.sizing?"no-repeat":""},_resolveSrc:function(b){b=Polymer.ResolveUrl.resolveUrl(b,this.$.baseURIAnchor.href);"/"===b[0]&&(b=(location.origin||location.protocol+"//"+location.host)+b);return b}}); //# sourceURL=build://paper-card/paper-card.html.js Polymer({is:"paper-card",properties:{heading:{type:String,value:"",observer:"_headingChanged"},image:{type:String,value:""},alt:{type:String},preloadImage:{type:Boolean,value:!1},fadeImage:{type:Boolean,value:!1},placeholderImage:{type:String,value:null},elevation:{type:Number,value:1,reflectToAttribute:!0},animatedShadow:{type:Boolean,value:!1},animated:{type:Boolean,reflectToAttribute:!0,readOnly:!0,computed:"_computeAnimated(animatedShadow)"}},_isHidden:function(b){return b?"false":"true"},_headingChanged:function(b){var c= this.getAttribute("heading"),e=this.getAttribute("aria-label");"string"===typeof e&&e!==c||this.setAttribute("aria-label",b)},_computeHeadingClass:function(b){return b?" over-image":""},_computeAnimated:function(b){return b}}); //# sourceURL=build://paper-checkbox/paper-checkbox.html.js Polymer({is:"paper-checkbox",behaviors:[Polymer.PaperCheckedElementBehavior],hostAttributes:{role:"checkbox","aria-checked":!1,tabindex:0},properties:{ariaActiveAttribute:{type:String,value:"aria-checked"}},attached:function(){Polymer.RenderStatus.afterNextRender(this,function(){if("-1px"===this.getComputedStyleValue("--calculated-paper-checkbox-ink-size").trim()){var b=this.getComputedStyleValue("--calculated-paper-checkbox-size").trim(),c="px",e=b.match(/[A-Za-z]+$/);null!==e&&(c=e[0]);b=parseFloat(b); e=8/3*b;"px"===c&&(e=Math.floor(e),e%2!==b%2&&e++);this.updateStyles({"--paper-checkbox-ink-size":e+c})}})},_computeCheckboxClass:function(b,c){var e="";b&&(e+="checked ");c&&(e+="invalid");return e},_computeCheckmarkClass:function(b){return b?"":"hidden"},_createRipple:function(){this._rippleContainer=this.$.checkboxContainer;return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this)}}); //# sourceURL=build://wit-dashboard/wit-example-viewer.js var Yo; (function(){const b=/^image\/([^\/]+\/)*encoded$/,c=[1,20];Polymer({is:"wit-example-viewer",properties:{example:{type:Object},serializedExample:{type:String,observer:"updateExample"},serializedSeqExample:{type:String,observer:"updateSeqExample"},json:{type:Object,observer:"createExamplesFromJson"},saliency:{type:Object,value:{}},saliencyJsonString:{type:String,observer:"haveSaliencyJson"},readonly:{type:Boolean,value:!1},seqNumber:{type:Number,value:0,observer:"newSeqNum"},isSequence:Boolean,changeCallbackTimer:Number, ignoreChange:Boolean,minSal:Number,maxSal:Number,showSaliency:{type:Boolean,value:!0},imageInfo:{type:Object,value:{}},windowWidth:{type:Number,value:256},windowCenter:{type:Number,value:128},saliencyCutoff:{type:Number,value:0},hasImage:{type:Boolean,value:!0},allowImageControls:{type:Boolean,value:!1},imageScalePercentage:{type:Number,value:100},features:{type:Object,computed:"getFeatures(example)"},featuresList:{type:Object,computed:"getFeaturesList(features, compareFeatures)"},seqFeatures:{type:Object, computed:"getSeqFeatures(example)"},seqFeaturesList:{type:Object,computed:"getFeaturesList(seqFeatures, compareSeqFeatures)"},maxSeqNumber:{type:Number,computed:"getMaxSeqNumber(seqFeaturesList)"},colors:Object,highlightDifferences:{type:Boolean,value:!0},displayMode:{type:String,value:"grid"},featureSearchValue:{type:String,value:"",notify:!0},filteredFeaturesList:{type:Object},filteredSeqFeaturesList:{type:Object},focusedFeatureName:String,focusedFeatureValueIndex:Number,focusedSeqNumber:Number, showDeleteValueButton:{type:Boolean,value:!1},expandedFeatures:{type:Object,value:{}},expandAllFeatures:{type:Boolean,value:!1},zeroIndex:{type:Number,value:0},compareJson:{type:Object,observer:"createCompareExamplesFromJson"},compareExample:{type:Object},compareFeatures:{type:Object,computed:"getFeatures(compareExample)",observer:"updateCompareMode"},compareSeqFeatures:{type:Object,computed:"getSeqFeatures(compareExample)",observer:"updateCompareMode"},sortOrder:{type:String,value:"attribution"}, compareMode:Boolean,compareImageInfo:{type:Object,value:{}},compareTitle:String,textColorFunction:Object},observers:["displaySaliency(saliency, example)","haveSaliency(filteredFeaturesList, saliency, colors, showSaliency, saliencyCutoff)","seqSaliency(seqNumber, seqFeaturesList, saliency, colors, showSaliency, saliencyCutoff)","setFilteredFeaturesList(featuresList, featureSearchValue, saliency, sortOrder)","setFilteredSeqFeaturesList(seqFeaturesList, featureSearchValue, saliency, sortOrder)"],isExpanded:function(e){return this.expandAllFeatures|| this.sanitizeFeature(e)in this.expandedFeatures},updateExample:function(){this.deserializeExample(this.serializedExample,ul)},updateSeqExample:function(){this.deserializeExample(this.serializedSeqExample,yl)},stringToUint8Array:function(e){return(new window.TextEncoder).encode(e)},deserializeExample:function(e,g){this.ignoreChange||(e=this.decodedStringToCharCodes(atob(e)),this.example=g(e))},getFeatures:function(e){this.imageInfo={};this.hasImage=!1;if(null==e)return new Map([]);if(e instanceof rl)return this.isSequence= !1,e.hasFeatures()||e.setFeatures(new Hj),e.getFeatures().getFeatureMap();this.isSequence=!0;e.hasContext()||e.setContext(new Hj);return e.getContext().getFeatureMap()},getFeaturesList:function(e,g){if(null==e)return[];const k=[],q={};let l=e.keys();if(l){let m=l.next();for(;!m.done;)k.push({name:m.value,feature:e.get(m.value)}),q[m.value]=!0,m=l.next()}if(null==g)return k;if(l=g.keys())for(e=l.next();!e.done;)e.value in q||(k.push({name:e.value,feature:g.get(e.value)}),q[e.value]=!0),e=l.next(); return k},getSeqFeatures:function(e){return null==e||e instanceof rl?new Map([]):this.example.getFeatureLists().getFeatureListMap()},setFilteredFeaturesList:function(e,g,k,q){this.filteredFeaturesList=[];this.filteredFeaturesList=this.getFilteredFeaturesList(e,g,k,q)},setFilteredSeqFeaturesList:function(e,g,k,q){this.filteredSeqFeaturesList=[];this.filteredSeqFeaturesList=this.getFilteredFeaturesList(e,g,k,q)},getFilteredFeaturesList:function(e,g,k,q){if(null!=e){var l=e,m=k&&0<Object.keys(k).length&& "alphabetical"!=q,p=m?Object.assign({},...Object.keys(k).map(n=>({[n]:"number"==typeof k[n]?k[n]:k[n].reduce((t,v)=>t+v,0)}))):{};if(""!=g){const n=new RegExp(g,"i");l=e.filter(t=>n.test(t.name))}return l.sort((n,t)=>{if(this.isImage(n.name)&&!this.isImage(t.name))return-1;if(this.isImage(t.name)&&!this.isImage(n.name))return 1;if(m){if(n.name in k&&!(t.name in k))return-1;if(t.name in k&&!(n.name in k))return 1;{const v="attribution"==q?p[t.name]-p[n.name]:"reverse-attribution"==q?p[n.name]-p[t.name]: Math.abs(p[t.name])-Math.abs(p[n.name]);if(0!=v)return v}}return n.name.localeCompare(t.name)})}},getMaxSeqNumber:function(){let e=-1;for(const g of this.seqFeaturesList){const k=g.feature;k&&k.getFeatureList().length-1>e&&(e=k.getFeatureList().length-1)}return e},haveSaliencyJson:function(){this.saliency=JSON.parse(this.saliencyJsonString)},selectAll:function(e){return d3.selectAll(Polymer.dom(this.root).querySelectorAll(e))},displaySaliency:function(e){const g=Object.keys(e),k={};for(let q=0;q< g.length;q++){const l=g[q];let m=e[l];Array.isArray(m)||(m=[m]);k[l]={floatList:{value:m.map(p=>d3.format(".4f")(p))}}}this.compareJson=this.saliencyJson={features:{feature:k}}},haveSaliency:function(){requestAnimationFrame(()=>this._haveSaliencyImpl())},_haveSaliencyImpl:function(){this.selectAll(".value-pill").style("background","#fff").attr("title","").style("color","#3c4043");if(this.filteredFeaturesList&&this.saliency&&0!==Object.keys(this.saliency).length&&this.colors)for(const g of this.filteredFeaturesList){const k= this.saliency[g.name];if(null!=k){var e=Array.isArray(k)?(q,l)=>this.getColorForSaliency(k[l]):()=>this.getColorForSaliency(k);this.selectAll(`.${this.sanitizeFeature(g.name)}.value-pill`).style("background",this.showSaliency?e:()=>"#fff").attr("title",(q,l)=>"Attribution: "+d3.format(".4f")(Array.isArray(k)?k[l]:k)).style("color",(q,l)=>this.textColorFunction(Array.isArray(k)?k[l]:k,this.minSal,this.maxSal));if(Array.isArray(k)){e=k;const q=this.selectAll(`paper-button.${this.sanitizeFeature(g.name)}.value-pill`); let l=0;for(let m=1;m<e.length;m++)Math.abs(e[m])>Math.abs(l)&&(l=e[m]);q.style("background",this.showSaliency?()=>this.getColorForSaliency(l):()=>"#fff")}}}},newSeqNum:function(){this.seqSaliency()},seqSaliency:function(){if(this.seqFeaturesList&&this.saliency&&0!==Object.keys(this.saliency).length&&this.colors)if(this.selectAll(".value input").size()<this.seqFeaturesList.length)requestAnimationFrame(()=>this.seqSaliency());else for(const g of this.seqFeaturesList){var e=this.saliency[g.name];if(!e)continue; const k=e[this.seqNumber];e=Array.isArray(k)?(q,l)=>this.getColorForSaliency(k[l]):()=>this.getColorForSaliency(k);this.selectAll(`.${this.sanitizeFeature(g.name)} input`).style("color",this.showSaliency?e:()=>"black")}},getFeatureValues:function(e,g,k,q){return(e=q?this.compareFeatures.get(e):this.features.get(e))?e.getBytesList()?g?e.getBytesList().getValueList().slice():e.getBytesList().getValueList_asU8().map(l=>this.decodeBytesListString(l,k)):e.getInt64List()?e.getInt64List().getValueList().slice(): e.getFloatList()?e.getFloatList().getValueList().slice():[]:[]},getCompareFeatureValues:function(e,g,k){return this.getFeatureValues(e,g,k,!0)},getFirstFeatureValue:function(e){return this.getFeatureValues(e)[0]},getFirstCompareFeatureValue:function(e){return this.getCompareFeatureValues(e)[0]},featureHasMultipleValues:function(e){return 1<this.getFeatureValues(e).length},compareFeatureHasMultipleValues:function(e){return 1<this.getCompareFeatureValues(e).length},getSeqFeatureValues:function(e,g, k,q,l){e=l?this.compareSeqFeatures.get(e):this.seqFeatures.get(e);if(!e)return[];e=e.getFeatureList();return!e||e.length<=g?[]:(g=e[g])?g.getBytesList()?k?g.getBytesList().getValueList():g.getBytesList().getValueList_asU8().map(m=>this.decodeBytesListString(m,q)):g.getInt64List()?g.getInt64List().getValueList():g.getFloatList()?g.getFloatList().getValueList():[]:[]},getCompareSeqFeatureValues:function(e,g,k,q){return this.getSeqFeatureValues(e,g,k,q,!0)},getFirstSeqFeatureValue:function(e,g){return this.getSeqFeatureValues(e, g)[0]},getFirstSeqCompareFeatureValue:function(e,g){return this.getCompareSeqFeatureValues(e,g)[0]},seqFeatureHasMultipleValues:function(e,g){return 1<this.getSeqFeatureValues(e,g).length},compareSeqFeatureHasMultipleValues:function(e,g){return 1<this.getCompareSeqFeatureValues(e,g).length},decodeBytesListString:function(e,g){return 32768E3<e.length?"String too large to display":g?this.decodeBytesListToString(e):(new window.TextDecoder).decode(e)},isBytesFeature:function(e){const g=this.features.get(e); return g&&g.hasBytesList()?!0:(e=this.seqFeatures.get(e))&&e.getFeatureList()[0].hasBytesList()?!0:!1},getJsonFeature:function(e){if(!this.json)return null;if(this.json.features&&this.json.features.feature){var g=this.json.features.feature[e];if(g)return g}return this.json.context&&this.json.context.feature&&(g=this.json.context.feature[e])?g:this.json.featureLists&&this.json.featureLists.featureList?this.json.featureLists.featureList[e]:null},getJsonValueList:function(e,g){e=this.getJsonFeature(e); if(!e)return null;isNaN(g)||(e=e.feature[g]);return(g=e.bytesList||e.int64List||e.floatList)?g.value:null},getDataFromElem:function(e){for(;null==e.dataFeature;){if(!e.parentElement)throw Error("Could not find ancestor control element");e=e.parentElement}return{feature:e.dataFeature,valueIndex:e.dataIndex,seqNum:e.dataSeqNum}},getDataFromEvent:function(e){return this.getDataFromElem(e.target)},getFeatureFromData:function(e){if(isNaN(e.seqNum))return this.features.get(e.feature);var g=this.seqFeatures.get(e.feature); if(g)return(g=g.getFeatureList())?g[e.seqNum]:void 0},getValueListFromData:function(e){return isNaN(e.seqNum)?this.getFeatureValues(e.feature,!0):this.getSeqFeatureValues(e.feature,e.seqNum,!0)},setFeatureValues:function(e,g){const k=e.getBytesList(),q=e.getInt64List();e=e.getFloatList();k?k.setValueList(g):q?q.setValueList(g):e&&e.setValueList(g)},onValueChanged:function(e){const g=e.target;e=this.getDataFromEvent(e);const k=this.getFeatureFromData(e),q=this.getValueListFromData(e);if(k){if(this.isBytesFeature(e.feature)){var l= this.stringToUint8Array(g.value);q[e.valueIndex]=l;(l=this.getJsonValueList(e.feature,e.seqNum))&&(l[e.valueIndex]=btoa(g.value))}else q[e.valueIndex]=+g.value,(l=this.getJsonValueList(e.feature,e.seqNum))&&(l[e.valueIndex]=+g.value);this.setFeatureValues(k,q);this.exampleChanged()}},onInputFocus:function(e){const g=e.target;e=this.getDataFromEvent(e);this.focusedFeatureName=e.feature;this.focusedFeatureValueIndex=e.valueIndex;this.focusedSeqNumber=e.seqNum;this.$.deletevalue.style.top=g.getBoundingClientRect().top- this.getBoundingClientRect().top-25+"px";this.$.deletevalue.style.right=this.getBoundingClientRect().right-g.getBoundingClientRect().right+30+"px";this.showDeleteValueButton=!0},onInputBlur:function(){this.showDeleteValueButton=!1},deleteFeature:function(e){e=this.getDataFromEvent(e);this.features.del&&this.features.del(e.feature);this.seqFeatures.del&&this.seqFeatures.del(e.feature);this.deleteJsonFeature(e.feature);this.exampleChanged();this.refreshExampleViewer()},deleteJsonFeature:function(e){this.json&& (this.json.features&&this.json.features.feature&&delete this.json.features.feature[e],this.json.context&&this.json.context.feature&&delete this.json.context.feature[e],this.json.featureLists&&this.json.featureLists.featureList&&delete this.json.featureLists.featureList[e])},deleteValue:function(e){e=this.getDataFromEvent(e);const g=this.getFeatureFromData(e),k=this.getValueListFromData(e);if(g){if(this.isBytesFeature(e.feature)){const q=this.getJsonValueList(e.feature,e.seqNum);q&&q.splice(e.valueIndex, 1)}k.splice(e.valueIndex,1);this.setFeatureValues(g,k);this.exampleChanged();this.refreshExampleViewer()}},openAddFeatureDialog:function(){this.$.addFeatureDialog.open()},addFeature:function(){if(this.json){var e=new Fj;if("int"===this.newFeatureType){var g=[];var k=new Dj;k.setValueList(g);e.setInt64List(k);g={int64List:{value:g}}}else"float"===this.newFeatureType?(g=[],k=new Bj,k.setValueList(g),e.setFloatList(k),g={floatList:{value:g}}):(g=[],k=new zj,k.setValueList(g),e.setBytesList(k),g={bytesList:{value:g}}); this.features.set(this.newFeatureName,e);this.addJsonFeature(this.newFeatureName,g);this.newFeatureName="";this.exampleChanged();this.refreshExampleViewer()}},addJsonFeature:function(e,g){this.json&&this.json.features&&this.json.features.feature?this.json.features.feature[e]=g:this.json&&this.json.context&&this.json.context.feature&&(this.json.context.feature[e]=g)},addValue:function(e){e=this.getDataFromEvent(e);const g=this.getFeatureFromData(e),k=this.getValueListFromData(e);g&&(this.isBytesFeature(e.feature)? k.push(""):k.push(0),this.setFeatureValues(g,k),this.exampleChanged(),this.refreshExampleViewer())},refreshExampleViewer:function(){const e=this.example;this.ignoreChange=!0;this.example=new rl;this.ignoreChange=!1;setTimeout(()=>{this.example=e;this.haveSaliency()},0)},exampleChanged:function(){this.fire("example-change",{example:this.example});clearTimeout(this.changeCallbackTimer);this.changeCallbackTimer=setTimeout(this.changeCallback.bind(this),1E3)},changeCallback:function(){this.ignoreChange= !0;this.isSequence&&this.serializedSeqExample?this.serializedSeqExample=btoa(this.decodeBytesListString(this.example.serializeBinary(),!0)):this.serializedExample&&(this.serializedExample=btoa(this.decodeBytesListString(this.example.serializeBinary(),!0)));this.ignoreChange=!1},getInputPillClass:function(e,g){return this.sanitizeFeature(e)+" value-pill"+("grid"==g?" value-pill-grid":" value-pill-stacked")},getCompareInputClass:function(e,g,k){g="value-compare"+("grid"==g?" value-pill-grid":" value-pill-stacked"); if(null!=k){const q=this.getFeatureValues(e,!0);e=this.getCompareFeatureValues(e,!0);g=this.highlightDifferences&&(k>=q.length||k>=e.length||q[k]!=e[k])?g+" value-different":g+" value-same"}return g},getSeqCompareInputClass:function(e,g,k,q){g="value-compare"+("grid"==g?" value-pill-grid":" value-pill-stacked");if(null!=q){const l=this.getSeqFeatureValues(e,k,!0);e=this.getCompareSeqFeatureValues(e,k,!0);g=q>=l.length||q>=e.length||l[q]!=e[q]?g+" value-different":g+" value-same"}return g},sanitizeFeature:function(e){e= e.trim();e.match(/^[A-Za-z].*$/)||(e="_"+e);return e.replace(/[\/\.#\s]/g,"_")},isSeqExample:function(e){return 0<=e},isImage:function(e){return b.test(e)},getImageSrc:function(e){this.setupOnloadCallback(e);return this.getImageSrcForData(e,this.getFeatureValues(e,!1,!0)[0])},getCompareImageSrc:function(e){this.setupOnloadCallback(e,!0);return this.getImageSrcForData(e,this.getCompareFeatureValues(e,!1,!0)[0],!0)},getSeqImageSrc:function(e,g){this.setupOnloadCallback(e);return this.getImageSrcForData(e, this.getSeqFeatureValues(e,g,!1,!0)[0])},getCompareSeqImageSrc:function(e,g){this.setupOnloadCallback(e,!0);return this.getImageSrcForData(e,this.getCompareSeqFeatureValues(e,g,!1,!0)[0],!0)},setupOnloadCallback:function(e,g){requestAnimationFrame(()=>{const k=this.$$("#"+this.getImageId(e,g));k.onload=this.getOnLoadForImage(e,k,g)})},getImageSrcForData:function(e,g,k){e=b.exec(e);if(null==e)return null;e=e[1]||"";k=k?this.getCompareFeatureValues("image"+e+"/format",!1):this.getFeatureValues("image"+ e+"/format",!1);e="jpeg";0<k.length&&(e=k[0].toLowerCase());return"data:image/"+e+";base64,"+btoa(decodeURIComponent(encodeURIComponent(g)))},getIterLength:function(e){let g=0;if(e){let k=e.next();for(;!k.done;)g++,k=e.next()}return g},updateCompareMode:function(){let e=!1;if(this.compareFeatures&&0<this.getIterLength(this.compareFeatures.keys())||this.compareSeqFeatures&&0<this.getIterLength(this.compareSeqFeatures.keys()))e=!0;this.compareMode=e},createExamplesFromJson:function(e){this.example= this.createExamplesFromJsonHelper(e);this.compareJson={}},createCompareExamplesFromJson:function(e){if(!e||!Object.keys(e).length)if(this.saliencyJson)e=this.saliencyJson;else{this.compareExample=null;return}this.compareExample=this.createExamplesFromJsonHelper(e)},createExamplesFromJsonHelper:function(e){if(!e)return null;"string"===typeof this.json&&(e=JSON.parse(this.json));if(e.features){var g=new rl;g.setFeatures(this.parseFeatures(e.features));return g}return e.context||e.featureLists?(g=new sl, e.context&&g.setContext(this.parseFeatures(e.context)),e.featureLists&&g.setFeatureLists(this.parseFeatureLists(e.featureLists)),g):new rl},parseFeatures:function(e){const g=new Hj;for(const k in e.feature)if(e.feature.hasOwnProperty(k)){const q=e.feature[k];g.getFeatureMap().set(k,this.parseFeature(q,this.isImage(k)))}return g},parseFeatureLists:function(e){const g=new Kj;for(const k in e.featureList)if(e.featureList.hasOwnProperty(k)){const q=e.featureList[k],l=new Ij,m=[];for(const p in q.feature)q.feature.hasOwnProperty(p)&& m.push(this.parseFeature(q.feature[p],this.isImage(k)));l.setFeatureList(m);g.getFeatureListMap().set(k,l)}return g},parseFeature:function(e){const g=new Fj;if(e.floatList){var k=new Bj;k.setValueList(e.floatList.value);g.setFloatList(k)}else e.bytesList?(k=new zj,e.bytesList.value&&k.setValueList(e.bytesList.value),g.setBytesList(k)):e.int64List&&(k=new Dj,k.setValueList(e.int64List.value),g.setInt64List(k));return g},getImageId:function(e,g){return g?this.getCompareImageId(e):this.sanitizeFeature(e)+ "_image"},getCanvasId:function(e,g){return g?this.getCompareCanvasId(e):this.sanitizeFeature(e)+"_canvas"},getImageCardId:function(e,g){return g?this.getCompareImageCardId(e):this.sanitizeFeature(e)+"_card"},getCompareImageId:function(e){return this.sanitizeFeature(e)+"_image_compare"},getCompareCanvasId:function(e){return this.sanitizeFeature(e)+"_canvas_compare"},getCompareImageCardId:function(e){return this.sanitizeFeature(e)+"_card_compare"},getFeatureDialogId:function(e){return this.sanitizeFeature(e)+ "_dialog"},featureMoreClicked:function(e){e=e.srcElement;const g=this.$$("#"+this.sanitizeFeature(e.dataFeature)+"_dialog");g.positionTarget=e;g.open()},expandFeature:function(e){this.set("expandedFeatures."+this.sanitizeFeature(e.srcElement.dataFeature),!0);this.refreshExampleViewer()},decodedStringToCharCodes:function(e){const g=new Uint8Array(e.length);for(let k=0;k<e.length;++k)g[k]=e.charCodeAt(k);return g},handleImageUpload:function(e){this.handleFileSelect(e,this)},uploadImageClicked:function(e){e= this.getDataFromEvent(e);const g=Polymer.dom(this.root).querySelectorAll("paper-input");let k=null;for(let q=0;q<g.length;q++)if(g[q].dataFeature==e.feature){k=g[q];break}k&&k.shadowRoot.querySelector("input").click()},handleFileSelect:function(e,g){e.stopPropagation();e.preventDefault();const k=e.target,q=new FileReader;e=e.dataTransfer?e.dataTransfer.files:e.target.inputElement.inputElement.files;0!==e.length&&(q.addEventListener("load",()=>{const l=q.result.substring(+q.result.indexOf("base64,")+ 7);var m=g.decodedStringToCharCodes(atob(l));const p=g.getDataFromElem(k),n=g.getFeatureFromData(p),t=g.getValueListFromData(p);if(n){t[0]=m;n.getBytesList().setValueList(t);(m=g.getJsonValueList(p.feature,p.seqNum))&&(m[0]=l);const v=new Image;g.addImageElement(p.feature,v);v.addEventListener("load",()=>{g.getOnLoadForImage(p.feature,v);var x=b.exec(p.feature)[1]||"";const y="image"+x+"/width";x="image"+x+"/height";const z=g.getFeatureValues(y,!1),A=g.getFeatureValues(x,!1);0<z.length&&(z[0]=+v.width, g.features.get(y).getInt64List().setValueList(z));0<A.length&&(A[0]=+v.height,g.features.get(x).getInt64List().setValueList(A));g.exampleChanged()});v.src=q.result}},!1),q.readAsDataURL(e[0]))},addDragDropBehaviorToCanvas:function(e){function g(l){l.stopPropagation();l.preventDefault();l.dataTransfer.dropEffect="copy"}function k(l){q.handleFileSelect(l,q)}const q=this;!this.readonly&&e&&(e.addEventListener("dragover",g,!1),e.addEventListener("drop",k,!1))},getOnLoadForImage:function(e,g,k){const q= (l,m,p)=>{const n=this.$$("#"+this.getCanvasId(l,p));p||this.addDragDropBehaviorToCanvas(n);if(m&&n){const t=n.getContext("2d");let v=this.imageScalePercentage/100;if(!this.allowImageControls){let z=this.$$("#"+this.getImageCardId(l,p)).parentElement.getBoundingClientRect().width/2;16<z&&(z-=16);z<m.width&&(v=z/m.width)}n.width=m.width*v;n.height=m.height*v;const x=z=>{t.save();t.clearRect(0,0,n.width,n.height);t.translate(z.x,z.y);t.scale(z.k,z.k);this.renderImageOnCanvas(t,n.width,n.height,l,p); t.restore()},y=d3.zoom().scaleExtent(c).on("zoom",()=>{this.addImageTransform(l,d3.event.transform,p);x(d3.event.transform)});d3.select(n).call(y).on("dblclick.zoom",()=>d3.select(n).call(y.transform,d3.zoomIdentity));t.save();t.scale(v,v);t.drawImage(m,0,0);t.restore();this.setImageDatum(t,n.width,n.height,l,p);this.renderImageOnCanvas(t,n.width,n.height,l,p);p?this.compareImageInfo[l].transform&&x(this.compareImageInfo[l].transform):this.imageInfo[l].transform&&x(this.imageInfo[l].transform)}else requestAnimationFrame(()=> q(l,m,p))};this.addImageElement(e,g,k);this.addImageOnLoad(e,q,k);return q.apply(this,[e,g,k])},addImageOnLoad:function(e,g,k){this.hasImage=!0;k?(this.compareImageInfo[e]||(this.compareImageInfo[e]={}),this.compareImageInfo[e].onload=g):(this.imageInfo[e]||(this.imageInfo[e]={}),this.imageInfo[e].onload=g)},addImageData:function(e,g,k){k?(this.compareImageInfo[e]||(this.compareImageInfo[e]={}),this.compareImageInfo[e].imageData=g):(this.imageInfo[e]||(this.imageInfo[e]={}),this.imageInfo[e].imageData= g)},addImageElement:function(e,g,k){k?(this.compareImageInfo[e]||(this.compareImageInfo[e]={}),this.compareImageInfo[e].imageElement=g):(this.imageInfo[e]||(this.imageInfo[e]={}),this.imageInfo[e].imageElement=g)},addImageGrayscaleData:function(e,g){this.imageInfo[e]||(this.imageInfo[e]={});this.imageInfo[e].imageGrayscaleData=g},addImageTransform:function(e,g,k){k?(this.compareImageInfo[e]||(this.compareImageInfo[e]={}),this.compareImageInfo[e].transform=g):(this.imageInfo[e]||(this.imageInfo[e]= {}),this.imageInfo[e].transform=g)},setImageDatum:function(e,g,k,q,l){if(g&&k&&(e=e.getImageData(0,0,g,k),e=Uint8ClampedArray.from(e.data),this.addImageData(q,e,l),this.saliency&&this.showSaliency&&this.saliency[q]&&!l)){l=Uint8ClampedArray.from(e);for(g=0;g<e.length;g+=4)k=(e[g]+e[g+1]+e[g+2])/3,l[g]=k,l[g+1]=k,l[g+2]=k;this.addImageGrayscaleData(q,l)}},contrastImage:function(e,g,k){g=d3.scaleLinear().domain([k-.5-g/2,k-.5+(g-1)/2]).clamp(!0).range([0,255]);for(k=0;k<e.length;k++)3!==k%4&&(e[k]= g(e[k]))},showSaliencyForValue:function(e){return Math.abs(e)>=Math.abs(0<=e?this.maxSal:this.minSal)*this.saliencyCutoff/100},getColorForSaliency:function(e){return this.showSaliencyForValue(e)?this.colors(e):"#fff"},addSaliencyToImage:function(e,g){Array.isArray(g)&&0<g.length&&Array.isArray(g[0])&&(g=g[this.seqNumber]);const k=1/Math.pow(this.imageScalePercentage/100,2);for(let l=0;l<e.length;l+=4){var q=Math.floor(l/4*k);q=Array.isArray(g)?g.length>q?g[q]:0:g;const m=.5*(this.showSaliencyForValue(q)? 0<=q?0===this.maxSal?0:q/this.maxSal:q/this.minSal:0),{r:p,g:n,b:t}=d3.rgb(0<q?this.colors(this.maxSal):this.colors(this.minSal));e[l]=e[l]*(1-m)+p*m;e[l+1]=e[l+1]*(1-m)+n*m;e[l+2]=e[l+2]*(1-m)+t*m}},renderImageOnCanvas:function(e,g,k,q,l){if(g&&k){var m=e.getImageData(0,0,g,k);l?m.data.set(this.compareImageInfo[q].imageData):m.data.set(this.saliency&&this.showSaliency&&this.saliency[q]?this.imageInfo[q].imageGrayscaleData:this.imageInfo[q].imageData);256===this.windowWidth&&128===this.windowCenter|| this.contrastImage(m.data,this.windowWidth,this.windowCenter);!l&&this.saliency&&this.showSaliency&&this.saliency[q]&&this.addSaliencyToImage(m.data,this.saliency[q]);q=document.createElement("canvas");q.width=g;q.height=k;q.getContext("2d").putImageData(m,0,0);e.clearRect(0,0,g,k);e.drawImage(q,0,0)}},showSalCheckboxChange:function(){this.showSaliency=this.$.salCheckbox.checked},updateImages:function(){for(const e in this.imageInfo)if(this.imageInfo.hasOwnProperty(e))this.imageInfo[e].onload(e,this.imageInfo[e].imageElement)}, shouldShowImageControls:function(e,g){return e&&g},shouldEnableAddFeature:function(e){return 0<e.length},getDeleteValueButtonClass:function(e,g){return e||!g?"delete-value-button delete-value-button-hidden":"delete-value-button"},getDeleteFeatureButtonClass:function(e){return e?"hide-controls":"delete-feature-button"},getAddValueButtonClass:function(e){return e?"hide-controls":"add-value-button"},getAddFeatureButtonClass:function(e){return e?"hide-controls":"add-feature-button"},getUploadImageClass:function(e){return e? "hide-controls":"upload-image-button"},getCompareHeaderClass:function(e){return e?"compare-value-text":"no-compare-value-text"},decodeBytesListToString:function(e){let g="",k;for(k=0;k<e.length/16384;k++)g+=String.fromCharCode.apply(null,e.slice(16384*k,16384*(k+1)));return g+=String.fromCharCode.apply(null,e.slice(16384*k))}})})(Yo||(Yo={})); //# sourceURL=build://wit-dashboard/wit-inference-viewer.html.js Polymer({is:"wit-inference-viewer",properties:{inferences:Array,modelType:String,modelNames:Array,maxEntriesPerRun:{type:Number,value:5}},getLabel:function(b){let c=b.label;b.vocabLabel&&(c+=" ("+b.vocabLabel+")");return c},getLabelClass:function(b){return"classification"==b?"show-label text":"no-label"},getLabelHeaderClass:function(b){return"classification"==b?"show-label":"no-label"},getModelClass:function(b){return b&&1<b[0].length?"multi-model text":"one-model"},getModelHeaderClass:function(b){return b&& 1<b[0].length?"multi-model":"one-model"},getScoreLabel:function(b){return"classification"==b?"Score":"Value"},getIconClass:function(b,c,e){return this.getIconDecision(b,c,e,"green","red")},getIcon:function(b,c,e){return this.getIconDecision(b,c,e,"icons:arrow-upward","icons:arrow-downward")},getIconDecision:function(b,c,e,g,k){if(0==b)return"";const q=this.inferences[b][e][c].label;c=this.inferences[b][e][c].score;b=this.inferences[b-1][e];for(e=0;e<b.length;e++)if(b[e].label==q){if(b[e].score>c)return k; if(b[e].score<c)break;return""}return g},getRunNumber:function(b){return b+1},getModelName:function(b,c){return b[c]},getMarkerClass:function(b,c,e){return"marker"+(null!=c&&b==c.length-1?0==e?" mark-one":" mark-two":"")},getRowClass:function(b,c,e){let g="row ";return g=null!=c&&b==c.length-1?g+(0==e?"dark-row-one":"dark-row-two"):g+"white-row"},getInference:function(b){return b},getPrintableScore:function(b){return b.toFixed(3)},getPrintableDelta:function(b,c,e){if(0==b)return"";const g=this.inferences[b][e][c].label; c=this.inferences[b][e][c].score;b=this.inferences[b-1][e];for(e=0;e<b.length;e++)if(b[e].label==g)return(c-b[e].score).toFixed(6);return""},getInferenceList:function(b,c){return b.slice(0,c)}}); //# sourceURL=build://facets-dive/lib/bounded-object.js /* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var Zo;(function(b){b[b.Bottom=0]="Bottom";b[b.Left=1]="Left";b[b.Right=2]="Right";b[b.Top=3]="Top"})(Zo||(Zo={})); class $o{shouldBeVisible(b,c,e,g){if(void 0!==this.minScale)return this.scaleDown||c>=this.minScale;if(!this.boundingBox)return!0;const k=this.boundingBox;if(k.left>e.x+g.right||k.right<e.x+g.left||k.bottom>e.y+g.top||k.top<e.y+g.bottom)return!1;g=this.elementMargin||{bottom:0,left:0,right:0,top:0};e=void 0===this.width?b.getBoundingClientRect().width+g.left+g.right:this.width;b=void 0===this.height?b.getBoundingClientRect().height+g.top+g.bottom:this.height;g=isFinite(k.top)&&isFinite(k.bottom)? k.top-k.bottom:Infinity;return(isFinite(k.left)&&isFinite(k.right)?k.right-k.left:Infinity)*c>=e&&g*c>=b}}; //# sourceURL=build://facets-dive/lib/sorting.js function ap(b,c){return null!==b&&void 0!==b||null!==c&&void 0!==c?null===b||void 0===b?-1:null===c||void 0===c?1:"number"===typeof b&&"number"===typeof c?isNaN(b)&&isNaN(c)?0:isNaN(b)?-1:isNaN(c)?1:b-c:"string"!==typeof b?-1:"string"!==typeof c?1:b.localeCompare(c):b===c?0:void 0===b?-1:1} function bp(b,c){return null!==b&&void 0!==b||null!==c&&void 0!==c?null===b||void 0===b?-1:null===c||void 0===c?1:"number"===typeof b&&"number"===typeof c?isNaN(b)&&isNaN(c)?0:isNaN(b)?-1:isNaN(c)?1:c-b:"string"!==typeof b?-1:"string"!==typeof c?1:-b.localeCompare(c):b===c?0:void 0===b?-1:1} function cp(b,c){return null!==b&&void 0!==b||null!==c&&void 0!==c?null===b||void 0===b?-1:null===c||void 0===c?1:"string"===typeof b&&"string"===typeof c?b.localeCompare(c):"number"!==typeof b?-1:"number"!==typeof c?1:isNaN(b)&&isNaN(c)?0:isNaN(b)?-1:isNaN(c)?1:b-c:b===c?0:void 0===b?-1:1}; //# sourceURL=build://facets-dive/lib/grid.js const dp=(b,c,e,g)=>{b=Math.floor(1E-6+e.minWidth/g.itemAspectRatio);return 1<b?c%b/(b-1):0},ep=(b,c,e,g)=>{b=Math.floor(1E-6+e.minWidth/g.itemAspectRatio);e=Math.ceil(e.items.length/b);return 1<e?Math.floor(c/b)/(e-1):0},fp=(b,c)=>{const e="right"===c?1:"middle"===c?.5:0,g="top"===b?1:"middle"===b?.5:0;return(k,q,l,m)=>{const p=l.innerWidth-m.itemAspectRatio,n=l.innerHeight-1;return{x:dp(k,q,l,m)/p*(l.minWidth-m.itemAspectRatio)+e*(l.innerWidth-l.minWidth)/p,y:ep(k,q,l,m)/n*(l.minHeight-1)+g*(l.innerHeight- l.minHeight)/n}}},gp=fp("bottom","left");var hp;(function(b){b[b.Tight=0]="Tight";b[b.Uniform=1]="Uniform"})(hp||(hp={})); class ip{constructor(b){this.items=b;this.cellMargin=this.itemAspectRatio=1;this.cellPadding={bottom:0,left:0,right:0,top:0};this.targetGridAspectRatio=1;this.minCellAspectRatio=0;this.maxCellAspectRatio=Infinity;this.verticalFacet=()=>null;this.horizontalFacet=()=>null;this.verticalKeyCompare=bp;this.horizontalKeyCompare=ap;this.verticalKeys=[];this.verticalKeysHash={};this.horizontalKeys=[];this.horizontalKeysHash={};this.cells={};this.height=this.width=this.longestCellLength=0;this.itemPositionSetter= (c,e,g)=>{c.x=e;c.y=g};this.computeItemPosition=gp;this.horizontalGridAlignment=this.verticalGridAlignment=hp.Tight;this.cellItemComparator=null}clear(){this.verticalKeys=[];this.verticalKeysHash={};this.horizontalKeys=[];this.horizontalKeysHash={};this.cells={};this.height=this.width=this.longestCellLength=0}arrange(){this.facetItemsIntoCells();var b=this.computeOptimalCellAspectRatio(this.targetGridAspectRatio),c=Math.min(this.maxCellAspectRatio,Math.max(this.minCellAspectRatio,b));b=[];const e= [];for(var g=0;g<this.verticalKeys.length;g++)for(var k=0;k<this.horizontalKeys.length;k++){var q=this.getOrCreateCell(this.verticalKeys[g],this.horizontalKeys[k]);[q.minWidth,q.minHeight]=this.computeCellDimensions(c,q.items.length);b[g]=Math.max(b[g]||0,q.minHeight);e[k]=Math.max(e[k]||0,q.minWidth)}for(c=0;c<this.verticalKeys.length;c++)for(g=0;g<this.horizontalKeys.length;g++)k=this.getCell(this.verticalKeys[c],this.horizontalKeys[g]),c<this.verticalKeys.length-1&&(k.siblings.above=this.getCell(this.verticalKeys[c+ 1],this.horizontalKeys[g])),0<c&&(k.siblings.below=this.getCell(this.verticalKeys[c-1],this.horizontalKeys[g])),0<g&&(k.siblings.left=this.getCell(this.verticalKeys[c],this.horizontalKeys[g-1])),g<this.horizontalKeys.length-1&&(k.siblings.right=this.getCell(this.verticalKeys[c],this.horizontalKeys[g+1]));if(this.verticalGridAlignment===hp.Uniform)for(c=Math.max(...b),g=0;g<b.length;g++)b[g]=c;if(this.horizontalGridAlignment===hp.Uniform)for(c=Math.max(...e),g=0;g<e.length;g++)e[g]=c;for(c=0;c<this.verticalKeys.length;c++)for(g= 0;g<this.horizontalKeys.length;g++)k=this.getCell(this.verticalKeys[c],this.horizontalKeys[g]),k.height=b[c],k.width=e[g],k.innerHeight=k.height-this.cellPadding.top-this.cellPadding.bottom,k.innerWidth=k.width-this.cellPadding.left-this.cellPadding.right;c=this.cellMargin*this.itemAspectRatio;for(g=0;g<this.verticalKeys.length;g++)for(k=0;k<this.horizontalKeys.length;k++)q=this.getCell(this.verticalKeys[g],this.horizontalKeys[k]),q.y=g?this.getCell(this.verticalKeys[g-1],this.horizontalKeys[k]).y+ b[g-1]+c:0,q.contentY=q.y+this.cellPadding.bottom,q.x=k?this.getCell(this.verticalKeys[g],this.horizontalKeys[k-1]).x+e[k-1]+c:0,q.contentX=q.x+this.cellPadding.left;this.eachCell(l=>{this.width=Math.max(this.width,l.x+l.width);this.height=Math.max(this.height,l.y+l.height)});this.positionItems()}positionItems(){this.eachCell(b=>{const c=Math.max(0,b.innerWidth-this.itemAspectRatio),e=Math.max(0,b.innerHeight-1),g=b.items.slice(0);this.cellItemComparator&&g.sort(this.cellItemComparator);for(let k= 0;k<g.length;k++){const q=this.computeItemPosition(g[k],k,b,this);this.itemPositionSetter(g[k],b.contentX+(!q||isNaN(q.x)?0:Math.max(0,Math.min(1,q.x)))*c,b.contentY+(!q||isNaN(q.y)?0:Math.max(0,Math.min(1,q.y)))*e)}})}facetItemsIntoCells(){this.clear();this.eachItem(b=>{const c=this.getOrCreateCell(this.verticalFacet(b),this.horizontalFacet(b));c.items.push(b);this.longestCellLength=Math.max(this.longestCellLength,c.items.length)});for(const b in this.verticalKeysHash)this.verticalKeys.push(this.verticalKeysHash[b]); this.verticalKeys.sort(this.verticalKeyCompare);for(const b in this.horizontalKeysHash)this.horizontalKeys.push(this.horizontalKeysHash[b]);this.horizontalKeys.sort(this.horizontalKeyCompare)}eachItem(b){if(this.items)for(let c=0;c<this.items.length;c++)b.call(this,this.items[c])}eachCell(b){for(const c in this.cells)b.call(this,this.cells[c])}getCompoundKey(b,c){return typeof b+"\u001f"+b+"\u001e"+typeof c+"\u001f"+c}getCell(b,c){b=this.getCompoundKey(b,c);return b in this.cells?this.cells[b]:null}getCells(){return Object.keys(this.cells).map(b=> this.cells[b])}getOrCreateCell(b,c){let e=this.getCell(b,c);if(e)return e;this.addVerticalKey(b);this.addHorizontalKey(c);const g=this.getCompoundKey(b,c);e={verticalKey:b,horizontalKey:c,compoundKey:g,items:[],siblings:{}};return this.cells[g]=e}getRow(b){const c=[];for(let e=0;e<this.horizontalKeys.length;e++){const g=this.getCell(b,this.horizontalKeys[e]);g&&c.push(g)}return c}getColumn(b){const c=[];for(let e=0;e<this.verticalKeys.length;e++){const g=this.getCell(this.verticalKeys[e],b);g&&c.push(g)}return c}addVerticalKey(b){const c= typeof b+"\u001f"+b;c in this.verticalKeysHash||(this.verticalKeysHash[c]=b)}addHorizontalKey(b){const c=typeof b+"\u001f"+b;c in this.horizontalKeysHash||(this.horizontalKeysHash[c]=b)}computeOptimalCellAspectRatio(b){var c=this.verticalKeys.length,e=this.horizontalKeys.length;if(!c||!e)return 1;let g=c/e,k=g,q=Infinity,l=0,m=Infinity;c=Math.min(20,Math.max(c,e,this.longestCellLength));for(e=0;e<c;){e++;const p=this.computeGridAspectRatio(g),n=Math.abs(1-p/b);n<q&&(k=g,q=n);if(.001>n)break;p>b?(m= g,g-=(m-l)/2):(l=g,g=isFinite(m)?g+(m-l)/2:2*g)}return k}computeGridAspectRatio(b){const c=this.verticalKeys.length,e=this.horizontalKeys.length;let g=-Infinity,k=-Infinity,q=-Infinity,l=-Infinity;const m=[];for(let p=0;p<c;p++){m[p]=[];for(let n=0;n<e;n++){const t=m[p][n]={width:n?m[p][n-1].width:0,height:p?m[p-1][n].height:0},v=this.getCell(this.verticalKeys[p],this.horizontalKeys[n]);if(!v||!v.items||!v.items.length)continue;const [x,y]=this.computeCellDimensions(b,v.items.length);t.width+=x;t.height+= y;g=Math.max(g,t.width);k=Math.max(k,y);q=Math.max(q,x);l=Math.max(l,t.height)}}this.verticalGridAlignment===hp.Uniform&&(l=k*c);this.horizontalGridAlignment===hp.Uniform&&(g=q*e);b=this.cellMargin*this.itemAspectRatio;return(g+b*(e-1))/(l+b*(c-1))}computeCellDimensions(b,c){const e=[this.itemAspectRatio*(this.cellPadding.left+this.cellPadding.right),this.itemAspectRatio*(this.cellPadding.top+this.cellPadding.bottom)];if(!c)return e;b=Math.min(c,Math.ceil(Math.sqrt(b*c)/this.itemAspectRatio));e[0]+= this.itemAspectRatio*b;e[1]+=Math.ceil(c/b);return e}}; //# sourceURL=build://facets-dive/lib/axis.js class jp extends $o{constructor(b,c){super();this.side=b;this.cell=c;switch(b){case Zo.Left:this.minScale=30/c.innerHeight;for(b=c.siblings.left;!(!b||b.items.length||b.siblings.above&&b.siblings.above.items.length);)b=b.siblings.left;b&&(this.minScale=Math.max(this.minScale,39.2/(c.contentX-(b.contentX+b.innerWidth))));break;case Zo.Bottom:this.minScale=30/c.innerWidth;for(b=c.siblings.below;!(!b||b.items.length||b.siblings.right&&b.siblings.right.items.length);)b=b.siblings.below;b&&(this.minScale= Math.max(this.minScale,39.2/(c.contentY-(b.contentY+b.innerHeight))));break;default:throw Error("Axes for specified side are not implemented.");}}strokeWidth(b){return 1.2/b}path(b){const c=4/b,e=6/b;return this.side===Zo.Left?`M ${this.cell.contentX-c-e},${this.cell.contentY+.6/b} h ${e} v ${this.cell.innerHeight-1.2/b} h -${e}`:this.side===Zo.Bottom?`M ${this.cell.contentX+.6/b},${this.cell.contentY-c-e} v ${e} h ${this.cell.innerWidth-1.2/b} v -${e}`:""}key(){return`${this.cell.compoundKey}-${this.side}`}} ; //# sourceURL=build://facets-dive/lib/data-example.js //# sourceURL=build://facets-dive/lib/label.js //# sourceURL=build://facets-dive/lib/layout.js class kp{constructor(){this.grid={bottom:0,left:0,right:0,top:0};this.viewport={height:0,width:0};this.padding={bottom:0,left:0,right:0,top:0}}computeScale(){const b=this.viewport.width-this.padding.left-this.padding.right,c=this.viewport.height-this.padding.top-this.padding.bottom;if(isNaN(b)||0>=b||isNaN(c)||0>=c)return NaN;const e=this.grid.right-this.grid.left,g=this.grid.top-this.grid.bottom;return isNaN(e)||0>=e||isNaN(g)||0>=g?NaN:b/c>e/g?c/g:b/e}computeCamera(){const b=this.computeScale(); if(isNaN(b)||0>=b)return{position:{x:NaN,y:NaN},frustum:{bottom:NaN,left:NaN,right:NaN,top:NaN}};const c=this.viewport.width/b,e=this.viewport.height/b;return{position:{x:this.grid.left-(c-(this.padding.left+this.padding.right)/b-(this.grid.right-this.grid.left))/2-this.padding.left/b,y:this.grid.top+(e-(this.padding.top+this.padding.bottom)/b-(this.grid.top-this.grid.bottom))/2+this.padding.top/b},frustum:{bottom:-e,left:0,right:c,top:0}}}reducePaddingToFitWidth(b){if(200>b)this.padding.left=0,this.padding.right= 0;else if(this.padding.left+this.padding.right+200>b){const c=this.padding.left+this.padding.right;b-=200;this.padding.left=this.padding.left/c*b||0;this.padding.right=this.padding.right/c*b||0}}reducePaddingToFitHeight(b){if(200>b)this.padding.top=0,this.padding.bottom=0;else if(this.padding.top+this.padding.bottom+200>b){const c=this.padding.top+this.padding.bottom;b-=200;this.padding.top=this.padding.top/c*b||0;this.padding.bottom=this.padding.bottom/c*b||0}}}; //# sourceURL=build://facets-dive/lib/text.js var lp;(function(b){b[b.Left=0]="Left";b[b.Right=1]="Right";b[b.Center=2]="Center"})(lp||(lp={}));var mp;(function(b){b[b.Top=0]="Top";b[b.Bottom=1]="Bottom";b[b.Middle=2]="Middle"})(mp||(mp={}));const np={x:0,y:0,glyphAspectRatio:.6,lineHeight:1.1,horizontalAlign:lp.Center,verticalAlign:mp.Middle}; class op{constructor(b){this.settings=Object.assign({},np,b)}fit(b){b=b.trim();const {max:c,segments:e}=this.split(b),{cutoff:g,width:k,height:q}=this.computeCutoff(e,b.length,c);b=k*this.settings.glyphAspectRatio;b=b/q>this.settings.width/this.settings.height?this.settings.width/b:this.settings.height/q;const l=this.settings.horizontalAlign===lp.Left?0:this.settings.horizontalAlign===lp.Right?1:.5,m=Math.max(0,this.settings.height-q*b)*(this.settings.verticalAlign===mp.Top?0:this.settings.verticalAlign=== mp.Bottom?1:.5),p=this.wrapLines(e,g),n=[];for(let t=0;t<p.length;t++){const {startPos:v,endPos:x}=p[t];let y="";for(let z=v;z<x;z++)y+=e[z].text;n.push({text:y,x:this.settings.x+l*Math.max(0,this.settings.width-y.length*this.settings.glyphAspectRatio*b),y:this.settings.y+m+t*this.settings.lineHeight*b})}return{lines:n,fontSize:b}}split(b){const c=[];let e=1,g=/\s/.test(b.charAt(0)),k=0,q=0;for(;e<=b.length;){const l=b.charAt(e),m=/\s/.test(l);l.length&&g===m||(q=Math.max(q,e-k),c.push({text:b.substring(k, e),whitespace:g}),k=e);g=m;e++}return{max:q,segments:c}}computeTextRect(b,c){let e=0,g=0,k=0,q=1;for(let l=0;l<b.length;l++){const {text:m,whitespace:p}=b[l],n=m.length;if(!p||e)p?e+n<=c?e+=n:(g=e=0,q+=this.settings.lineHeight):e+n<=c?g=e+=n:(g?e=g=n:(k=Math.max(k,n),e=g=0),q+=this.settings.lineHeight),k=Math.max(k,g)}return{width:k,height:q}}computeCutoff(b,c,e){const g=this.settings.width/this.settings.height;let k=e+(c-e)/2,q=k,l=null,m=Infinity;const p=Math.min(20,(b.length+1)/2);let n=0;for(;n< p;){n++;const t=this.computeTextRect(b,k),v=t.width/t.height*this.settings.glyphAspectRatio,x=Math.abs(1-v/g);x<m&&(q=k,l=t,m=x);if(.01>x)break;v>g?c=k:e=k;k=e+(c-e)/2}return{cutoff:q,width:l.width,height:l.height}}wrapLines(b,c){const e=[];let g=0,k=0,q=0,l=0;for(let m=0;m<b.length;m++){const {text:p,whitespace:n}=b[m],t=p.length;n&&!q?g=k=m+1:n?q+t<=c?q+=t:(e.push({startPos:g,endPos:k,textLength:l}),q=l=0,g=k=m+1):q+t<=c?(l=q+=t,k=m+1):l?(e.push({startPos:g,endPos:k,textLength:l}),q=l=t,g=m,k=m+ 1):(e.push({startPos:m,endPos:m+1,textLength:t}),q=l=0,g=k=m+1)}k>g&&e.push({startPos:g,endPos:k,textLength:l});return e}}; //# sourceURL=build://tf-imports/three.js (function(b,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):(b=b||self,c(b.THREE={}))})(this,function(b){function c(){}function e(a,d){this.x=a||0;this.y=d||0}function g(a,d,f,h){this._x=a||0;this._y=d||0;this._z=f||0;this._w=void 0!==h?h:1}function k(a,d,f){this.x=a||0;this.y=d||0;this.z=f||0}function q(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")} function l(a,d,f,h,r,u,w,B,C,G){Object.defineProperty(this,"id",{value:$p++});this.uuid=bb.generateUUID();this.name="";this.image=void 0!==a?a:l.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==d?d:l.DEFAULT_MAPPING;this.wrapS=void 0!==f?f:1001;this.wrapT=void 0!==h?h:1001;this.magFilter=void 0!==r?r:1006;this.minFilter=void 0!==u?u:1008;this.anisotropy=void 0!==C?C:1;this.format=void 0!==w?w:1023;this.type=void 0!==B?B:1009;this.offset=new e(0,0);this.repeat=new e(1,1);this.center=new e(0,0); this.rotation=0;this.matrixAutoUpdate=!0;this.matrix=new q;this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==G?G:3E3;this.version=0;this.onUpdate=null}function m(a,d,f,h){this.x=a||0;this.y=d||0;this.z=f||0;this.w=void 0!==h?h:1}function p(a,d,f){this.width=a;this.height=d;this.scissor=new m(0,0,a,d);this.scissorTest=!1;this.viewport=new m(0,0,a,d);f=f||{};this.texture=new l(void 0,void 0,f.wrapS,f.wrapT,f.magFilter,f.minFilter,f.format,f.type, f.anisotropy,f.encoding);this.texture.image={};this.texture.image.width=a;this.texture.image.height=d;this.texture.generateMipmaps=void 0!==f.generateMipmaps?f.generateMipmaps:!1;this.texture.minFilter=void 0!==f.minFilter?f.minFilter:1006;this.depthBuffer=void 0!==f.depthBuffer?f.depthBuffer:!0;this.stencilBuffer=void 0!==f.stencilBuffer?f.stencilBuffer:!0;this.depthTexture=void 0!==f.depthTexture?f.depthTexture:null}function n(a,d,f){p.call(this,a,d,f);this.samples=4}function t(){this.elements= [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function v(a,d,f,h){this._x=a||0;this._y=d||0;this._z=f||0;this._order=h||v.DefaultOrder}function x(){this.mask=1}function y(){Object.defineProperty(this,"id",{value:aq++});this.uuid=bb.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=y.DefaultUp.clone();var a=new k,d=new v,f=new g,h=new k(1,1,1);d._onChange(function(){f.setFromEuler(d, !1)});f._onChange(function(){d.setFromQuaternion(f,void 0,!1)});Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:a},rotation:{configurable:!0,enumerable:!0,value:d},quaternion:{configurable:!0,enumerable:!0,value:f},scale:{configurable:!0,enumerable:!0,value:h},modelViewMatrix:{value:new t},normalMatrix:{value:new q}});this.matrix=new t;this.matrixWorld=new t;this.matrixAutoUpdate=y.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new x;this.visible=!0; this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}}function z(){y.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0;"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function A(a,d){this.min=void 0!==a?a:new k(Infinity,Infinity,Infinity);this.max=void 0!==d?d:new k(-Infinity,-Infinity,-Infinity)}function D(a,d,f,h,r){var u;var w=0;for(u=a.length- 3;w<=u;w+=3){ve.fromArray(a,w);var B=d.dot(ve),C=f.dot(ve),G=h.dot(ve);if(Math.max(-Math.max(B,C,G),Math.min(B,C,G))>r.x*Math.abs(ve.x)+r.y*Math.abs(ve.y)+r.z*Math.abs(ve.z))return!1}return!0}function H(a,d){this.center=void 0!==a?a:new k;this.radius=void 0!==d?d:0}function E(a,d){this.origin=void 0!==a?a:new k;this.direction=void 0!==d?d:new k}function F(a,d,f){this.a=void 0!==a?a:new k;this.b=void 0!==d?d:new k;this.c=void 0!==f?f:new k}function J(a,d,f){return void 0===d&&void 0===f?this.set(a): this.setRGB(a,d,f)}function O(a,d,f){0>f&&(f+=1);1<f&&--f;return f<1/6?a+6*(d-a)*f:.5>f?d:f<2/3?a+6*(d-a)*(2/3-f):a}function N(a){return.04045>a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function P(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}function V(a,d,f,h,r,u){this.a=a;this.b=d;this.c=f;this.normal=h&&h.isVector3?h:new k;this.vertexNormals=Array.isArray(h)?h:[];this.color=r&&r.isColor?r:new J;this.vertexColors=Array.isArray(r)?r:[];this.materialIndex=void 0!==u?u:0} function T(){Object.defineProperty(this,"id",{value:bq++});this.uuid=bb.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.vertexTangents=this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilFunc=519;this.stencilRef=0;this.stencilMask= 255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.needsUpdate=!0}function aa(a){T.call(this);this.type="MeshBasicMaterial";this.color=new J(16777215);this.lightMap= this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function da(a,d,f){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=a;this.itemSize= d;this.count=void 0!==a?a.length/d:0;this.normalized=!0===f;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function va(a,d,f){da.call(this,new Int8Array(a),d,f)}function Da(a,d,f){da.call(this,new Uint8Array(a),d,f)}function na(a,d,f){da.call(this,new Uint8ClampedArray(a),d,f)}function ya(a,d,f){da.call(this,new Int16Array(a),d,f)}function Pa(a,d,f){da.call(this,new Uint16Array(a),d,f)}function Ja(a,d,f){da.call(this,new Int32Array(a),d,f)}function Oa(a,d,f){da.call(this,new Uint32Array(a), d,f)}function pa(a,d,f){da.call(this,new Float32Array(a),d,f)}function tb(a,d,f){da.call(this,new Float64Array(a),d,f)}function ea(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function Xb(a){if(0===a.length)return-Infinity;for(var d=a[0],f= 1,h=a.length;f<h;++f)a[f]>d&&(d=a[f]);return d}function Ba(){Object.defineProperty(this,"id",{value:cq+=2});this.uuid=bb.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function Nb(a,d){y.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new Ba;this.material=void 0!==d?d:new aa({color:16777215*Math.random()});this.drawMode= 0;this.updateMorphTargets()}function kb(a,d,f,h,r,u,w,B){if(null===(1===d.side?h.intersectTriangle(w,u,r,!0,B):h.intersectTriangle(r,u,w,2!==d.side,B)))return null;Zh.copy(B);Zh.applyMatrix4(a.matrixWorld);d=f.ray.origin.distanceTo(Zh);return d<f.near||d>f.far?null:{distance:d,point:Zh.clone(),object:a}}function rb(a,d,f,h,r,u,w,B,C,G,K){we.fromBufferAttribute(r,C);xe.fromBufferAttribute(r,G);ye.fromBufferAttribute(r,K);r=a.morphTargetInfluences;if(d.morphTargets&&u&&r){Nj.set(0,0,0);Oj.set(0,0,0); Pj.set(0,0,0);for(var L=0,M=u.length;L<M;L++){var R=r[L],S=u[L];0!==R&&(zm.fromBufferAttribute(S,C),Am.fromBufferAttribute(S,G),Bm.fromBufferAttribute(S,K),Nj.addScaledVector(zm.sub(we),R),Oj.addScaledVector(Am.sub(xe),R),Pj.addScaledVector(Bm.sub(ye),R))}we.add(Nj);xe.add(Oj);ye.add(Pj)}if(a=kb(a,d,f,h,we,xe,ye,Ig))w&&(kf.fromBufferAttribute(w,C),lf.fromBufferAttribute(w,G),mf.fromBufferAttribute(w,K),a.uv=F.getUV(Ig,we,xe,ye,kf,lf,mf,new e)),B&&(kf.fromBufferAttribute(B,C),lf.fromBufferAttribute(B, G),mf.fromBufferAttribute(B,K),a.uv2=F.getUV(Ig,we,xe,ye,kf,lf,mf,new e)),w=new V(C,G,K),F.getNormal(we,xe,ye,w.normal),a.face=w;return a}function Ua(){Object.defineProperty(this,"id",{value:dq+=2});this.uuid=bb.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate= this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function Cb(a,d,f,h,r,u){Ua.call(this);this.type="BoxGeometry";this.parameters={width:a,height:d,depth:f,widthSegments:h,heightSegments:r,depthSegments:u};this.fromBufferGeometry(new Qb(a,d,f,h,r,u));this.mergeVertices()}function Qb(a,d,f,h,r,u){function w(S,X,W,ja,ha,ia,ma,fa,la,qa,Ka){var La=ia/la,ra=ma/qa,ua=ia/2,sa=ma/2,Ca=fa/2;ma=la+1;var Za=qa+1,ob=ia=0,za,Wa,db=new k;for(Wa=0;Wa< Za;Wa++){var zb=Wa*ra-sa;for(za=0;za<ma;za++)db[S]=(za*La-ua)*ja,db[X]=zb*ha,db[W]=Ca,G.push(db.x,db.y,db.z),db[S]=0,db[X]=0,db[W]=0<fa?1:-1,K.push(db.x,db.y,db.z),L.push(za/la),L.push(1-Wa/qa),ia+=1}for(Wa=0;Wa<qa;Wa++)for(za=0;za<la;za++)S=M+za+ma*(Wa+1),X=M+(za+1)+ma*(Wa+1),W=M+(za+1)+ma*Wa,C.push(M+za+ma*Wa,S,W),C.push(S,X,W),ob+=6;B.addGroup(R,ob,Ka);R+=ob;M+=ia}Ba.call(this);this.type="BoxBufferGeometry";this.parameters={width:a,height:d,depth:f,widthSegments:h,heightSegments:r,depthSegments:u}; var B=this;a=a||1;d=d||1;f=f||1;h=Math.floor(h)||1;r=Math.floor(r)||1;u=Math.floor(u)||1;var C=[],G=[],K=[],L=[],M=0,R=0;w("z","y","x",-1,-1,f,d,a,u,r,0);w("z","y","x",1,-1,f,d,-a,u,r,1);w("x","z","y",1,1,a,f,d,h,u,2);w("x","z","y",1,-1,a,f,-d,h,u,3);w("x","y","z",1,-1,a,d,f,h,r,4);w("x","y","z",-1,-1,a,d,-f,h,r,5);this.setIndex(C);this.addAttribute("position",new pa(G,3));this.addAttribute("normal",new pa(K,3));this.addAttribute("uv",new pa(L,2))}function Fc(a){var d={},f;for(f in a){d[f]={};for(var h in a[f]){var r= a[f][h];d[f][h]=r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?r.clone():Array.isArray(r)?r.slice():r}}return d}function Tb(a){for(var d={},f=0;f<a.length;f++){var h=Fc(a[f]),r;for(r in h)d[r]=h[r]}return d}function Ub(a){T.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position \x3d projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor \x3d vec4( 1.0, 0.0, 0.0, 1.0 );\n}"; this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!1;this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;this.uniformsNeedUpdate=!1;void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))} function $b(){y.call(this);this.type="Camera";this.matrixWorldInverse=new t;this.projectionMatrix=new t;this.projectionMatrixInverse=new t}function Ab(a,d,f,h){$b.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==f?f:.1;this.far=void 0!==h?h:2E3;this.focus=10;this.aspect=void 0!==d?d:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function wc(a,d,f,h){y.call(this);this.type="CubeCamera";var r=new Ab(90,1,a,d);r.up.set(0, -1,0);r.lookAt(new k(1,0,0));this.add(r);var u=new Ab(90,1,a,d);u.up.set(0,-1,0);u.lookAt(new k(-1,0,0));this.add(u);var w=new Ab(90,1,a,d);w.up.set(0,0,1);w.lookAt(new k(0,1,0));this.add(w);var B=new Ab(90,1,a,d);B.up.set(0,0,-1);B.lookAt(new k(0,-1,0));this.add(B);var C=new Ab(90,1,a,d);C.up.set(0,-1,0);C.lookAt(new k(0,0,1));this.add(C);var G=new Ab(90,1,a,d);G.up.set(0,-1,0);G.lookAt(new k(0,0,-1));this.add(G);h=h||{format:1022,magFilter:1006,minFilter:1006};this.renderTarget=new jc(f,f,h);this.renderTarget.texture.name= "CubeCamera";this.update=function(K,L){null===this.parent&&this.updateMatrixWorld();var M=K.getRenderTarget(),R=this.renderTarget,S=R.texture.generateMipmaps;R.texture.generateMipmaps=!1;K.setRenderTarget(R,0);K.render(L,r);K.setRenderTarget(R,1);K.render(L,u);K.setRenderTarget(R,2);K.render(L,w);K.setRenderTarget(R,3);K.render(L,B);K.setRenderTarget(R,4);K.render(L,C);R.texture.generateMipmaps=S;K.setRenderTarget(R,5);K.render(L,G);K.setRenderTarget(M)};this.clear=function(K,L,M,R){for(var S=K.getRenderTarget(), X=this.renderTarget,W=0;6>W;W++)K.setRenderTarget(X,W),K.clear(L,M,R);K.setRenderTarget(S)}}function jc(a,d,f){p.call(this,a,d,f)}function mc(a,d,f,h,r,u,w,B,C,G,K,L){l.call(this,null,u,w,B,C,G,h,r,K,L);this.image={data:a,width:d,height:f};this.magFilter=void 0!==C?C:1003;this.minFilter=void 0!==G?G:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}function cc(a,d){this.normal=void 0!==a?a:new k(1,0,0);this.constant=void 0!==d?d:0}function Gc(a,d,f,h,r,u){this.planes=[void 0!==a?a:new cc, void 0!==d?d:new cc,void 0!==f?f:new cc,void 0!==h?h:new cc,void 0!==r?r:new cc,void 0!==u?u:new cc]}function id(){function a(r,u){!1!==f&&(h(r,u),d.requestAnimationFrame(a))}var d=null,f=!1,h=null;return{start:function(){!0!==f&&null!==h&&(d.requestAnimationFrame(a),f=!0)},stop:function(){f=!1},setAnimationLoop:function(r){h=r},setContext:function(r){d=r}}}function ze(a){function d(r,u){var w=r.array,B=r.dynamic?35048:35044,C=a.createBuffer();a.bindBuffer(u,C);a.bufferData(u,w,B);r.onUploadCallback(); u=5126;w instanceof Float32Array?u=5126:w instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):w instanceof Uint16Array?u=5123:w instanceof Int16Array?u=5122:w instanceof Uint32Array?u=5125:w instanceof Int32Array?u=5124:w instanceof Int8Array?u=5120:w instanceof Uint8Array&&(u=5121);return{buffer:C,type:u,bytesPerElement:w.BYTES_PER_ELEMENT,version:r.version}}function f(r,u,w){var B=u.array,C=u.updateRange;a.bindBuffer(w,r);!1===u.dynamic?a.bufferData(w, B,35044):-1===C.count?a.bufferSubData(w,0,B):0===C.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(a.bufferSubData(w,C.offset*B.BYTES_PER_ELEMENT,B.subarray(C.offset,C.offset+C.count)),C.count=-1)}var h=new WeakMap;return{get:function(r){r.isInterleavedBufferAttribute&&(r=r.data);return h.get(r)},remove:function(r){r.isInterleavedBufferAttribute&&(r=r.data); var u=h.get(r);u&&(a.deleteBuffer(u.buffer),h.delete(r))},update:function(r,u){r.isInterleavedBufferAttribute&&(r=r.data);var w=h.get(r);void 0===w?h.set(r,d(r,u)):w.version<r.version&&(f(w.buffer,r,u),w.version=r.version)}}}function Yd(a,d,f,h){Ua.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:d,widthSegments:f,heightSegments:h};this.fromBufferGeometry(new jd(a,d,f,h));this.mergeVertices()}function jd(a,d,f,h){Ba.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a, height:d,widthSegments:f,heightSegments:h};a=a||1;d=d||1;var r=a/2,u=d/2;f=Math.floor(f)||1;h=Math.floor(h)||1;var w=f+1,B=h+1,C=a/f,G=d/h,K=[],L=[],M=[],R=[];for(a=0;a<B;a++){var S=a*G-u;for(d=0;d<w;d++)L.push(d*C-r,-S,0),M.push(0,0,1),R.push(d/f),R.push(1-a/h)}for(a=0;a<h;a++)for(d=0;d<f;d++)r=d+w*(a+1),u=d+1+w*(a+1),B=d+1+w*a,K.push(d+w*a,r,B),K.push(r,u,B);this.setIndex(K);this.addAttribute("position",new pa(L,3));this.addAttribute("normal",new pa(M,3));this.addAttribute("uv",new pa(R,2))}function Zd(a, d,f,h){function r(L,M){d.buffers.color.setClear(L.r,L.g,L.b,M,h)}var u=new J(0),w=0,B,C,G=null,K=0;return{getClearColor:function(){return u},setClearColor:function(L,M){u.set(L);w=void 0!==M?M:1;r(u,w)},getClearAlpha:function(){return w},setClearAlpha:function(L){w=L;r(u,w)},render:function(L,M,R,S){M=M.background;R=a.vr;(R=R.getSession&&R.getSession())&&"additive"===R.environmentBlendMode&&(M=null);null===M?(r(u,w),G=null,K=0):M&&M.isColor&&(r(M,1),S=!0,G=null,K=0);(a.autoClear||S)&&a.clear(a.autoClearColor, a.autoClearDepth,a.autoClearStencil);if(M&&(M.isCubeTexture||M.isWebGLRenderTargetCube)){void 0===C&&(C=new Nb(new Qb(1,1,1),new Ub({type:"BackgroundCubeMaterial",uniforms:Fc(kd.cube.uniforms),vertexShader:kd.cube.vertexShader,fragmentShader:kd.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),C.geometry.removeAttribute("normal"),C.geometry.removeAttribute("uv"),C.onBeforeRender=function(X,W,ja){this.matrixWorld.copyPosition(ja.matrixWorld)},Object.defineProperty(C.material,"map",{get:function(){return this.uniforms.tCube.value}}), f.update(C));S=M.isWebGLRenderTargetCube?M.texture:M;C.material.uniforms.tCube.value=S;C.material.uniforms.tFlip.value=M.isWebGLRenderTargetCube?1:-1;if(G!==M||K!==S.version)C.material.needsUpdate=!0,G=M,K=S.version;L.unshift(C,C.geometry,C.material,0,0,null)}else if(M&&M.isTexture){void 0===B&&(B=new Nb(new jd(2,2),new Ub({type:"BackgroundMaterial",uniforms:Fc(kd.background.uniforms),vertexShader:kd.background.vertexShader,fragmentShader:kd.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1, fog:!1})),B.geometry.removeAttribute("normal"),Object.defineProperty(B.material,"map",{get:function(){return this.uniforms.t2D.value}}),f.update(B));B.material.uniforms.t2D.value=M;!0===M.matrixAutoUpdate&&M.updateMatrix();B.material.uniforms.uvTransform.value.copy(M.matrix);if(G!==M||K!==M.version)B.material.needsUpdate=!0,G=M,K=M.version;L.unshift(B,B.geometry,B.material,0,0,null)}}}}function ka(a,d,f,h){var r;this.setMode=function(u){r=u};this.render=function(u,w){a.drawArrays(r,u,w);f.update(w, r)};this.renderInstances=function(u,w,B){if(h.isWebGL2){var C=a;var G="drawArraysInstanced"}else if(C=d.get("ANGLE_instanced_arrays"),G="drawArraysInstancedANGLE",null===C){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}C[G](r,w,B,u.maxInstancedCount);f.update(B,r,u.maxInstancedCount)}}function Ob(a,d,f){function h(ia){if("highp"===ia){if(0<a.getShaderPrecisionFormat(35633,36338).precision&&0<a.getShaderPrecisionFormat(35632, 36338).precision)return"highp";ia="mediump"}return"mediump"===ia&&0<a.getShaderPrecisionFormat(35633,36337).precision&&0<a.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var r,u="undefined"!==typeof WebGL2RenderingContext&&a instanceof WebGL2RenderingContext,w=void 0!==f.precision?f.precision:"highp",B=h(w);B!==w&&(console.warn("THREE.WebGLRenderer:",w,"not supported, using",B,"instead."),w=B);f=!0===f.logarithmicDepthBuffer;B=a.getParameter(34930);var C=a.getParameter(35660),G= a.getParameter(3379),K=a.getParameter(34076),L=a.getParameter(34921),M=a.getParameter(36347),R=a.getParameter(36348),S=a.getParameter(36349),X=0<C,W=u||!!d.get("OES_texture_float"),ja=X&&W,ha=u?a.getParameter(36183):0;return{isWebGL2:u,getMaxAnisotropy:function(){if(void 0!==r)return r;var ia=d.get("EXT_texture_filter_anisotropic");return r=null!==ia?a.getParameter(ia.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:h,precision:w,logarithmicDepthBuffer:f,maxTextures:B,maxVertexTextures:C,maxTextureSize:G, maxCubemapSize:K,maxAttributes:L,maxVertexUniforms:M,maxVaryings:R,maxFragmentUniforms:S,vertexTextures:X,floatFragmentTextures:W,floatVertexTextures:ja,maxSamples:ha}}function Oc(){function a(){G.value!==h&&(G.value=h,G.needsUpdate=0<r);f.numPlanes=r;f.numIntersection=0}function d(K,L,M,R){var S=null!==K?K.length:0,X=null;if(0!==S){X=G.value;if(!0!==R||null===X){R=M+4*S;L=L.matrixWorldInverse;C.getNormalMatrix(L);if(null===X||X.length<R)X=new Float32Array(R);for(R=0;R!==S;++R,M+=4)B.copy(K[R]).applyMatrix4(L, C),B.normal.toArray(X,M),X[M+3]=B.constant}G.value=X;G.needsUpdate=!0}f.numPlanes=S;return X}var f=this,h=null,r=0,u=!1,w=!1,B=new cc,C=new q,G={value:null,needsUpdate:!1};this.uniform=G;this.numIntersection=this.numPlanes=0;this.init=function(K,L,M){var R=0!==K.length||L||0!==r||u;u=L;h=d(K,M,0);r=K.length;return R};this.beginShadows=function(){w=!0;d(null)};this.endShadows=function(){w=!1;a()};this.setState=function(K,L,M,R,S,X){if(!u||null===K||0===K.length||w&&!M)w?d(null):a();else{M=w?0:r;var W= 4*M,ja=S.clippingState||null;G.value=ja;ja=d(K,R,W,X);for(K=0;K!==W;++K)ja[K]=h[K];S.clippingState=ja;this.numIntersection=L?this.numPlanes:0;this.numPlanes+=M}}}function Bd(a){var d={};return{get:function(f){if(void 0!==d[f])return d[f];switch(f){case "WEBGL_depth_texture":var h=a.getExtension("WEBGL_depth_texture")||a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture");break;case "EXT_texture_filter_anisotropic":h=a.getExtension("EXT_texture_filter_anisotropic")|| a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":h=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case "WEBGL_compressed_texture_pvrtc":h=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:h=a.getExtension(f)}null=== h&&console.warn("THREE.WebGLRenderer: "+f+" extension not supported.");return d[f]=h}}}function $d(a,d,f){function h(B){var C=B.target;B=u.get(C);null!==B.index&&d.remove(B.index);for(var G in B.attributes)d.remove(B.attributes[G]);C.removeEventListener("dispose",h);u.delete(C);if(G=w.get(B))d.remove(G),w.delete(B);f.memory.geometries--}function r(B){var C=[],G=B.index,K=B.attributes.position;if(null!==G){var L=G.array;G=G.version;K=0;for(var M=L.length;K<M;K+=3){var R=L[K+0],S=L[K+1],X=L[K+2];C.push(R, S,S,X,X,R)}}else for(L=K.array,G=K.version,K=0,M=L.length/3-1;K<M;K+=3)R=K+0,S=K+1,X=K+2,C.push(R,S,S,X,X,R);C=new (65535<Xb(C)?Oa:Pa)(C,1);C.version=G;d.update(C,34963);(L=w.get(B))&&d.remove(L);w.set(B,C)}var u=new WeakMap,w=new WeakMap;return{get:function(B,C){var G=u.get(C);if(G)return G;C.addEventListener("dispose",h);C.isBufferGeometry?G=C:C.isGeometry&&(void 0===C._bufferGeometry&&(C._bufferGeometry=(new Ba).setFromObject(B)),G=C._bufferGeometry);u.set(C,G);f.memory.geometries++;return G}, update:function(B){var C=B.index,G=B.attributes;null!==C&&d.update(C,34963);for(var K in G)d.update(G[K],34962);B=B.morphAttributes;for(K in B){C=B[K];G=0;for(var L=C.length;G<L;G++)d.update(C[G],34962)}},getWireframeAttribute:function(B){var C=w.get(B);if(C){var G=B.index;null!==G&&C.version<G.version&&r(B)}else r(B);return w.get(B)}}}function $h(a,d,f,h){var r,u,w;this.setMode=function(B){r=B};this.setIndex=function(B){u=B.type;w=B.bytesPerElement};this.render=function(B,C){a.drawElements(r,C,u, B*w);f.update(C,r)};this.renderInstances=function(B,C,G){if(h.isWebGL2){var K=a;var L="drawElementsInstanced"}else if(K=d.get("ANGLE_instanced_arrays"),L="drawElementsInstancedANGLE",null===K){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}K[L](r,G,u,C*w,B.maxInstancedCount);f.update(G,r,B.maxInstancedCount)}}function eq(){var a={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0, textures:0},render:a,programs:null,autoReset:!0,reset:function(){a.frame++;a.calls=0;a.triangles=0;a.points=0;a.lines=0},update:function(d,f,h){h=h||1;a.calls++;switch(f){case 4:a.triangles+=d/3*h;break;case 5:case 6:a.triangles+=h*(d-2);break;case 1:a.lines+=d/2*h;break;case 3:a.lines+=h*(d-1);break;case 2:a.lines+=h*d;break;case 0:a.points+=h*d;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",f)}}}}function fq(a,d){return Math.abs(d[1])-Math.abs(a[1])}function gq(a){var d={},f= new Float32Array(8);return{update:function(h,r,u,w){var B=h.morphTargetInfluences,C=B.length;h=d[r.id];if(void 0===h){h=[];for(var G=0;G<C;G++)h[G]=[G,0];d[r.id]=h}var K=u.morphTargets&&r.morphAttributes.position;u=u.morphNormals&&r.morphAttributes.normal;for(G=0;G<C;G++){var L=h[G];0!==L[1]&&(K&&r.removeAttribute("morphTarget"+G),u&&r.removeAttribute("morphNormal"+G))}for(G=0;G<C;G++)L=h[G],L[0]=G,L[1]=B[G];h.sort(fq);for(G=0;8>G;G++){if(L=h[G])if(B=L[0],C=L[1]){K&&r.addAttribute("morphTarget"+G, K[B]);u&&r.addAttribute("morphNormal"+G,u[B]);f[G]=C;continue}f[G]=0}w.getUniforms().setValue(a,"morphTargetInfluences",f)}}}function hq(a,d){var f={};return{update:function(h){var r=d.render.frame,u=h.geometry,w=a.get(h,u);f[w.id]!==r&&(u.isGeometry&&w.updateFromObject(h),a.update(w),f[w.id]=r);return w},dispose:function(){f={}}}}function Cd(a,d,f,h,r,u,w,B,C,G){a=void 0!==a?a:[];l.call(this,a,void 0!==d?d:301,f,h,r,u,void 0!==w?w:1022,B,C,G);this.flipY=!1}function nf(a,d,f,h){l.call(this,null); this.image={data:a,width:d,height:f,depth:h};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function of(a,d,f,h){l.call(this,null);this.image={data:a,width:d,height:f,depth:h};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function pf(a,d,f){var h=a[0];if(0>=h||0<h)return a;var r=d*f,u=Cm[r];void 0===u&&(u=new Float32Array(r),Cm[r]=u);if(0!==d)for(h.toArray(u,0),h=1,r=0;h!==d;++h)r+=f,a[h].toArray(u,r);return u}function Hc(a, d){if(a.length!==d.length)return!1;for(var f=0,h=a.length;f<h;f++)if(a[f]!==d[f])return!1;return!0}function xc(a,d){for(var f=0,h=d.length;f<h;f++)a[f]=d[f]}function Dm(a,d){var f=Em[d];void 0===f&&(f=new Int32Array(d),Em[d]=f);for(var h=0;h!==d;++h)f[h]=a.allocateTextureUnit();return f}function iq(a,d){var f=this.cache;f[0]!==d&&(a.uniform1f(this.addr,d),f[0]=d)}function jq(a,d){var f=this.cache;if(void 0!==d.x){if(f[0]!==d.x||f[1]!==d.y)a.uniform2f(this.addr,d.x,d.y),f[0]=d.x,f[1]=d.y}else Hc(f, d)||(a.uniform2fv(this.addr,d),xc(f,d))}function kq(a,d){var f=this.cache;if(void 0!==d.x){if(f[0]!==d.x||f[1]!==d.y||f[2]!==d.z)a.uniform3f(this.addr,d.x,d.y,d.z),f[0]=d.x,f[1]=d.y,f[2]=d.z}else if(void 0!==d.r){if(f[0]!==d.r||f[1]!==d.g||f[2]!==d.b)a.uniform3f(this.addr,d.r,d.g,d.b),f[0]=d.r,f[1]=d.g,f[2]=d.b}else Hc(f,d)||(a.uniform3fv(this.addr,d),xc(f,d))}function lq(a,d){var f=this.cache;if(void 0!==d.x){if(f[0]!==d.x||f[1]!==d.y||f[2]!==d.z||f[3]!==d.w)a.uniform4f(this.addr,d.x,d.y,d.z,d.w), f[0]=d.x,f[1]=d.y,f[2]=d.z,f[3]=d.w}else Hc(f,d)||(a.uniform4fv(this.addr,d),xc(f,d))}function mq(a,d){var f=this.cache,h=d.elements;void 0===h?Hc(f,d)||(a.uniformMatrix2fv(this.addr,!1,d),xc(f,d)):Hc(f,h)||(Fm.set(h),a.uniformMatrix2fv(this.addr,!1,Fm),xc(f,h))}function nq(a,d){var f=this.cache,h=d.elements;void 0===h?Hc(f,d)||(a.uniformMatrix3fv(this.addr,!1,d),xc(f,d)):Hc(f,h)||(Gm.set(h),a.uniformMatrix3fv(this.addr,!1,Gm),xc(f,h))}function oq(a,d){var f=this.cache,h=d.elements;void 0===h?Hc(f, d)||(a.uniformMatrix4fv(this.addr,!1,d),xc(f,d)):Hc(f,h)||(Hm.set(h),a.uniformMatrix4fv(this.addr,!1,Hm),xc(f,h))}function pq(a,d,f){var h=this.cache,r=f.allocateTextureUnit();h[0]!==r&&(a.uniform1i(this.addr,r),h[0]=r);f.safeSetTexture2D(d||Im,r)}function qq(a,d,f){var h=this.cache,r=f.allocateTextureUnit();h[0]!==r&&(a.uniform1i(this.addr,r),h[0]=r);f.setTexture2DArray(d||rq,r)}function sq(a,d,f){var h=this.cache,r=f.allocateTextureUnit();h[0]!==r&&(a.uniform1i(this.addr,r),h[0]=r);f.setTexture3D(d|| tq,r)}function uq(a,d,f){var h=this.cache,r=f.allocateTextureUnit();h[0]!==r&&(a.uniform1i(this.addr,r),h[0]=r);f.safeSetTextureCube(d||Jm,r)}function vq(a,d){var f=this.cache;f[0]!==d&&(a.uniform1i(this.addr,d),f[0]=d)}function wq(a,d){var f=this.cache;Hc(f,d)||(a.uniform2iv(this.addr,d),xc(f,d))}function xq(a,d){var f=this.cache;Hc(f,d)||(a.uniform3iv(this.addr,d),xc(f,d))}function yq(a,d){var f=this.cache;Hc(f,d)||(a.uniform4iv(this.addr,d),xc(f,d))}function zq(a){switch(a){case 5126:return iq; case 35664:return jq;case 35665:return kq;case 35666:return lq;case 35674:return mq;case 35675:return nq;case 35676:return oq;case 35678:case 36198:return pq;case 35679:return sq;case 35680:return uq;case 36289:return qq;case 5124:case 35670:return vq;case 35667:case 35671:return wq;case 35668:case 35672:return xq;case 35669:case 35673:return yq}}function Aq(a,d){a.uniform1fv(this.addr,d)}function Bq(a,d){a.uniform1iv(this.addr,d)}function Cq(a,d){a.uniform2iv(this.addr,d)}function Dq(a,d){a.uniform3iv(this.addr, d)}function Eq(a,d){a.uniform4iv(this.addr,d)}function Fq(a,d){d=pf(d,this.size,2);a.uniform2fv(this.addr,d)}function Gq(a,d){d=pf(d,this.size,3);a.uniform3fv(this.addr,d)}function Hq(a,d){d=pf(d,this.size,4);a.uniform4fv(this.addr,d)}function Iq(a,d){d=pf(d,this.size,4);a.uniformMatrix2fv(this.addr,!1,d)}function Jq(a,d){d=pf(d,this.size,9);a.uniformMatrix3fv(this.addr,!1,d)}function Kq(a,d){d=pf(d,this.size,16);a.uniformMatrix4fv(this.addr,!1,d)}function Lq(a,d,f){var h=d.length,r=Dm(f,h);a.uniform1iv(this.addr, r);for(a=0;a!==h;++a)f.safeSetTexture2D(d[a]||Im,r[a])}function Mq(a,d,f){var h=d.length,r=Dm(f,h);a.uniform1iv(this.addr,r);for(a=0;a!==h;++a)f.safeSetTextureCube(d[a]||Jm,r[a])}function Nq(a){switch(a){case 5126:return Aq;case 35664:return Fq;case 35665:return Gq;case 35666:return Hq;case 35674:return Iq;case 35675:return Jq;case 35676:return Kq;case 35678:return Lq;case 35680:return Mq;case 5124:case 35670:return Bq;case 35667:case 35671:return Cq;case 35668:case 35672:return Dq;case 35669:case 35673:return Eq}} function Oq(a,d,f){this.id=a;this.addr=f;this.cache=[];this.setValue=zq(d.type)}function Km(a,d,f){this.id=a;this.addr=f;this.cache=[];this.size=d.size;this.setValue=Nq(d.type)}function Lm(a){this.id=a;this.seq=[];this.map={}}function Mm(a,d){a.seq.push(d);a.map[d.id]=d}function Pq(a,d,f){var h=a.name,r=h.length;for(Qj.lastIndex=0;;){var u=Qj.exec(h),w=Qj.lastIndex,B=u[1],C=u[3];"]"===u[2]&&(B|=0);if(void 0===C||"["===C&&w+2===r){Mm(f,void 0===C?new Oq(B,a,d):new Km(B,a,d));break}else u=f.map[B], void 0===u&&(u=new Lm(B),Mm(f,u)),f=u}}function ae(a,d){this.seq=[];this.map={};for(var f=a.getProgramParameter(d,35718),h=0;h<f;++h){var r=a.getActiveUniform(d,h);Pq(r,a.getUniformLocation(d,r.name),this)}}function Nm(a,d,f){d=a.createShader(d);a.shaderSource(d,f);a.compileShader(d);return d}function Qq(a){a=a.split("\n");for(var d=0;d<a.length;d++)a[d]=d+1+": "+a[d];return a.join("\n")}function Om(a){switch(a){case 3E3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE", "( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:throw Error("unsupported encoding: "+a);}}function Pm(a,d,f){var h=a.getShaderParameter(d,35713),r=a.getShaderInfoLog(d).trim();return h&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+f+"\n"+r+Qq(a.getShaderSource(d))}function ai(a,d){d=Om(d); return"vec4 "+a+"( vec4 value ) { return "+d[0]+"ToLinear"+d[1]+"; }"}function Rq(a,d){d=Om(d);return"vec4 "+a+"( vec4 value ) { return LinearTo"+d[0]+d[1]+"; }"}function Sq(a,d){switch(d){case 1:d="Linear";break;case 2:d="Reinhard";break;case 3:d="Uncharted2";break;case 4:d="OptimizedCineon";break;case 5:d="ACESFilmic";break;default:throw Error("unsupported toneMapping: "+d);}return"vec3 "+a+"( vec3 color ) { return "+d+"ToneMapping( color ); }"}function Tq(a,d,f){a=a||{};return[a.derivatives||d.envMapCubeUV|| d.bumpMap||d.tangentSpaceNormalMap||d.clearcoatNormalMap||d.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||d.logarithmicDepthBuffer)&&f.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&f.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||d.envMap)&&f.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Jg).join("\n")}function Uq(a){var d=[],f;for(f in a){var h= a[f];!1!==h&&d.push("#define "+f+" "+h)}return d.join("\n")}function Vq(a,d){for(var f={},h=a.getProgramParameter(d,35721),r=0;r<h;r++){var u=a.getActiveAttrib(d,r).name;f[u]=a.getAttribLocation(d,u)}return f}function Jg(a){return""!==a}function Qm(a,d){return a.replace(/NUM_DIR_LIGHTS/g,d.numDirLights).replace(/NUM_SPOT_LIGHTS/g,d.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,d.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,d.numPointLights).replace(/NUM_HEMI_LIGHTS/g,d.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, d.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,d.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,d.numPointLightShadows)}function Rm(a,d){return a.replace(/NUM_CLIPPING_PLANES/g,d.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,d.numClippingPlanes-d.numClipIntersection)}function Rj(a){return a.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(d,f){d=mb[f];if(void 0===d)throw Error("Can not resolve #include \x3c"+f+"\x3e");return Rj(d)})}function Sm(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g, function(d,f,h,r){d="";for(f=parseInt(f);f<parseInt(h);f++)d+=r.replace(/\[ i \]/g,"[ "+f+" ]").replace(/UNROLLED_LOOP_INDEX/g,f);return d})}function Wq(a,d,f,h,r,u,w){var B=a.getContext(),C=h.defines,G=r.vertexShader,K=r.fragmentShader,L="SHADOWMAP_TYPE_BASIC";1===u.shadowMapType?L="SHADOWMAP_TYPE_PCF":2===u.shadowMapType?L="SHADOWMAP_TYPE_PCF_SOFT":3===u.shadowMapType&&(L="SHADOWMAP_TYPE_VSM");var M="ENVMAP_TYPE_CUBE",R="ENVMAP_MODE_REFLECTION",S="ENVMAP_BLENDING_MULTIPLY";if(u.envMap){switch(h.envMap.mapping){case 301:case 302:M= "ENVMAP_TYPE_CUBE";break;case 306:case 307:M="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:M="ENVMAP_TYPE_EQUIREC";break;case 305:M="ENVMAP_TYPE_SPHERE"}switch(h.envMap.mapping){case 302:case 304:R="ENVMAP_MODE_REFRACTION"}switch(h.combine){case 0:S="ENVMAP_BLENDING_MULTIPLY";break;case 1:S="ENVMAP_BLENDING_MIX";break;case 2:S="ENVMAP_BLENDING_ADD"}}var X=0<a.gammaFactor?a.gammaFactor:1,W=w.isWebGL2?"":Tq(h.extensions,u,d),ja=Uq(C),ha=B.createProgram();h.isRawShaderMaterial?(C=[ja].filter(Jg).join("\n"), 0<C.length&&(C+="\n"),d=[W,ja].filter(Jg).join("\n"),0<d.length&&(d+="\n")):(C=["precision "+u.precision+" float;","precision "+u.precision+" int;","highp"===u.precision?"#define HIGH_PRECISION":"","#define SHADER_NAME "+r.name,ja,u.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+X,"#define MAX_BONES "+u.maxBones,u.useFog&&u.fog?"#define USE_FOG":"",u.useFog&&u.fogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.envMap?"#define "+ R:"",u.lightMap?"#define USE_LIGHTMAP":"",u.aoMap?"#define USE_AOMAP":"",u.emissiveMap?"#define USE_EMISSIVEMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.normalMap?"#define USE_NORMALMAP":"",u.normalMap&&u.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",u.normalMap&&u.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",u.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",u.displacementMap&&u.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",u.specularMap?"#define USE_SPECULARMAP": "",u.roughnessMap?"#define USE_ROUGHNESSMAP":"",u.metalnessMap?"#define USE_METALNESSMAP":"",u.alphaMap?"#define USE_ALPHAMAP":"",u.vertexTangents?"#define USE_TANGENT":"",u.vertexColors?"#define USE_COLOR":"",u.vertexUvs?"#define USE_UV":"",u.flatShading?"#define FLAT_SHADED":"",u.skinning?"#define USE_SKINNING":"",u.useVertexTexture?"#define BONE_TEXTURE":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.morphNormals&&!1===u.flatShading?"#define USE_MORPHNORMALS":"",u.doubleSided?"#define DOUBLE_SIDED": "",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapEnabled?"#define "+L:"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",u.logarithmicDepthBuffer&&(w.isWebGL2||d.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_TANGENT","\tattribute vec4 tangent;","#endif","#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(Jg).join("\n"),d=[W,"precision "+u.precision+" float;","precision "+u.precision+" int;","highp"===u.precision?"#define HIGH_PRECISION":"","#define SHADER_NAME "+r.name,ja,u.alphaTest?"#define ALPHATEST "+u.alphaTest+(u.alphaTest% 1?"":".0"):"","#define GAMMA_FACTOR "+X,u.useFog&&u.fog?"#define USE_FOG":"",u.useFog&&u.fogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.matcap?"#define USE_MATCAP":"",u.envMap?"#define USE_ENVMAP":"",u.envMap?"#define "+M:"",u.envMap?"#define "+R:"",u.envMap?"#define "+S:"",u.lightMap?"#define USE_LIGHTMAP":"",u.aoMap?"#define USE_AOMAP":"",u.emissiveMap?"#define USE_EMISSIVEMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.normalMap?"#define USE_NORMALMAP":"",u.normalMap&&u.objectSpaceNormalMap? "#define OBJECTSPACE_NORMALMAP":"",u.normalMap&&u.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",u.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.roughnessMap?"#define USE_ROUGHNESSMAP":"",u.metalnessMap?"#define USE_METALNESSMAP":"",u.alphaMap?"#define USE_ALPHAMAP":"",u.sheen?"#define USE_SHEEN":"",u.vertexTangents?"#define USE_TANGENT":"",u.vertexColors?"#define USE_COLOR":"",u.vertexUvs?"#define USE_UV":"",u.gradientMap?"#define USE_GRADIENTMAP": "",u.flatShading?"#define FLAT_SHADED":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapEnabled?"#define "+L:"",u.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",u.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",u.logarithmicDepthBuffer&&(w.isWebGL2||d.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(h.extensions&&h.extensions.shaderTextureLOD|| u.envMap)&&(w.isWebGL2||d.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==u.toneMapping?"#define TONE_MAPPING":"",0!==u.toneMapping?mb.tonemapping_pars_fragment:"",0!==u.toneMapping?Sq("toneMapping",u.toneMapping):"",u.dithering?"#define DITHERING":"",u.outputEncoding||u.mapEncoding||u.matcapEncoding||u.envMapEncoding||u.emissiveMapEncoding?mb.encodings_pars_fragment:"",u.mapEncoding?ai("mapTexelToLinear",u.mapEncoding):"", u.matcapEncoding?ai("matcapTexelToLinear",u.matcapEncoding):"",u.envMapEncoding?ai("envMapTexelToLinear",u.envMapEncoding):"",u.emissiveMapEncoding?ai("emissiveMapTexelToLinear",u.emissiveMapEncoding):"",u.outputEncoding?Rq("linearToOutputTexel",u.outputEncoding):"",u.depthPacking?"#define DEPTH_PACKING "+h.depthPacking:"","\n"].filter(Jg).join("\n"));G=Rj(G);G=Qm(G,u);G=Rm(G,u);K=Rj(K);K=Qm(K,u);K=Rm(K,u);G=Sm(G);K=Sm(K);w.isWebGL2&&!h.isRawShaderMaterial&&(w=!1,L=/^\s*#version\s+300\s+es\s*\n/, h.isShaderMaterial&&null!==G.match(L)&&null!==K.match(L)&&(w=!0,G=G.replace(L,""),K=K.replace(L,"")),C="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+C,d=["#version 300 es\n\n#define varying in",w?"":"out highp vec4 pc_fragColor;",w?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+ "\n"+d);K=d+K;G=Nm(B,35633,C+G);K=Nm(B,35632,K);B.attachShader(ha,G);B.attachShader(ha,K);void 0!==h.index0AttributeName?B.bindAttribLocation(ha,0,h.index0AttributeName):!0===u.morphTargets&&B.bindAttribLocation(ha,0,"position");B.linkProgram(ha);if(a.debug.checkShaderErrors){a=B.getProgramInfoLog(ha).trim();u=B.getShaderInfoLog(G).trim();w=B.getShaderInfoLog(K).trim();M=L=!0;if(!1===B.getProgramParameter(ha,35714))L=!1,R=Pm(B,G,"vertex"),S=Pm(B,K,"fragment"),console.error("THREE.WebGLProgram: shader error: ", B.getError(),"35715",B.getProgramParameter(ha,35715),"gl.getProgramInfoLog",a,R,S);else if(""!==a)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",a);else if(""===u||""===w)M=!1;M&&(this.diagnostics={runnable:L,material:h,programLog:a,vertexShader:{log:u,prefix:C},fragmentShader:{log:w,prefix:d}})}B.deleteShader(G);B.deleteShader(K);var ia;this.getUniforms=function(){void 0===ia&&(ia=new ae(B,ha));return ia};var ma;this.getAttributes=function(){void 0===ma&&(ma=Vq(B,ha));return ma};this.destroy= function(){B.deleteProgram(ha);this.program=void 0};this.name=r.name;this.id=Xq++;this.code=f;this.usedTimes=1;this.program=ha;this.vertexShader=G;this.fragmentShader=K;return this}function Yq(a,d,f){function h(C){C=C.skeleton.bones;if(f.floatVertexTextures)return 1024;var G=Math.min(Math.floor((f.maxVertexUniforms-20)/4),C.length);return G<C.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+C.length+" bones. This GPU supports "+G+"."),0):G}function r(C,G){if(C)C.isTexture?K=C.encoding:C.isWebGLRenderTarget&& (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),K=C.texture.encoding);else var K=3E3;3E3===K&&G&&(K=3007);return K}var u=[],w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap", LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},B="precision supportsVertexTextures map mapEncoding matcap matcapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap objectSpaceNormalMap tangentSpaceNormalMap clearcoatNormalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors vertexTangents fog useFog fogExp2 flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering sheen".split(" "); this.getParameters=function(C,G,K,L,M,R,S){var X=w[C.type],W=S.isSkinnedMesh?h(S):0,ja=f.precision;null!==C.precision&&(ja=f.getMaxPrecision(C.precision),ja!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",ja,"instead."));var ha=a.getRenderTarget();return{shaderID:X,precision:ja,supportsVertexTextures:f.vertexTextures,outputEncoding:r(ha?ha.texture:null,a.gammaOutput),map:!!C.map,mapEncoding:r(C.map,a.gammaInput),matcap:!!C.matcap,matcapEncoding:r(C.matcap, a.gammaInput),envMap:!!C.envMap,envMapMode:C.envMap&&C.envMap.mapping,envMapEncoding:r(C.envMap,a.gammaInput),envMapCubeUV:!!C.envMap&&(306===C.envMap.mapping||307===C.envMap.mapping),lightMap:!!C.lightMap,aoMap:!!C.aoMap,emissiveMap:!!C.emissiveMap,emissiveMapEncoding:r(C.emissiveMap,a.gammaInput),bumpMap:!!C.bumpMap,normalMap:!!C.normalMap,objectSpaceNormalMap:1===C.normalMapType,tangentSpaceNormalMap:0===C.normalMapType,clearcoatNormalMap:!!C.clearcoatNormalMap,displacementMap:!!C.displacementMap, roughnessMap:!!C.roughnessMap,metalnessMap:!!C.metalnessMap,specularMap:!!C.specularMap,alphaMap:!!C.alphaMap,gradientMap:!!C.gradientMap,sheen:!!C.sheen,combine:C.combine,vertexTangents:C.normalMap&&C.vertexTangents,vertexColors:C.vertexColors,vertexUvs:!!C.map||!!C.bumpMap||!!C.normalMap||!!C.specularMap||!!C.alphaMap||!!C.emissiveMap||!!C.roughnessMap||!!C.metalnessMap||!!C.clearcoatNormalMap,fog:!!L,useFog:C.fog,fogExp2:L&&L.isFogExp2,flatShading:C.flatShading,sizeAttenuation:C.sizeAttenuation, logarithmicDepthBuffer:f.logarithmicDepthBuffer,skinning:C.skinning&&0<W,maxBones:W,useVertexTexture:f.floatVertexTextures,morphTargets:C.morphTargets,morphNormals:C.morphNormals,maxMorphTargets:a.maxMorphTargets,maxMorphNormals:a.maxMorphNormals,numDirLights:G.directional.length,numPointLights:G.point.length,numSpotLights:G.spot.length,numRectAreaLights:G.rectArea.length,numHemiLights:G.hemi.length,numDirLightShadows:G.directionalShadowMap.length,numPointLightShadows:G.pointShadowMap.length,numSpotLightShadows:G.spotShadowMap.length, numClippingPlanes:M,numClipIntersection:R,dithering:C.dithering,shadowMapEnabled:a.shadowMap.enabled&&S.receiveShadow&&0<K.length,shadowMapType:a.shadowMap.type,toneMapping:C.toneMapped?a.toneMapping:0,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:C.premultipliedAlpha,alphaTest:C.alphaTest,doubleSided:2===C.side,flipSided:1===C.side,depthPacking:void 0!==C.depthPacking?C.depthPacking:!1}};this.getProgramCode=function(C,G){var K=[];G.shaderID?K.push(G.shaderID):(K.push(C.fragmentShader), K.push(C.vertexShader));if(void 0!==C.defines)for(var L in C.defines)K.push(L),K.push(C.defines[L]);for(L=0;L<B.length;L++)K.push(G[B[L]]);K.push(C.onBeforeCompile.toString());K.push(a.gammaOutput);K.push(a.gammaFactor);return K.join()};this.acquireProgram=function(C,G,K,L){for(var M,R=0,S=u.length;R<S;R++){var X=u[R];if(X.code===L){M=X;++M.usedTimes;break}}void 0===M&&(M=new Wq(a,d,L,C,G,K,f),u.push(M));return M};this.releaseProgram=function(C){0===--C.usedTimes&&(u[u.indexOf(C)]=u[u.length-1],u.pop(), C.destroy())};this.programs=u}function Zq(){var a=new WeakMap;return{get:function(d){var f=a.get(d);void 0===f&&(f={},a.set(d,f));return f},remove:function(d){a.delete(d)},update:function(d,f,h){a.get(d)[f]=h},dispose:function(){a=new WeakMap}}}function $q(a,d){return a.groupOrder!==d.groupOrder?a.groupOrder-d.groupOrder:a.renderOrder!==d.renderOrder?a.renderOrder-d.renderOrder:a.program!==d.program?a.program.id-d.program.id:a.material.id!==d.material.id?a.material.id-d.material.id:a.z!==d.z?a.z- d.z:a.id-d.id}function ar(a,d){return a.groupOrder!==d.groupOrder?a.groupOrder-d.groupOrder:a.renderOrder!==d.renderOrder?a.renderOrder-d.renderOrder:a.z!==d.z?d.z-a.z:a.id-d.id}function Tm(){function a(w,B,C,G,K,L){var M=d[f];void 0===M?(M={id:w.id,object:w,geometry:B,material:C,program:C.program||u,groupOrder:G,renderOrder:w.renderOrder,z:K,group:L},d[f]=M):(M.id=w.id,M.object=w,M.geometry=B,M.material=C,M.program=C.program||u,M.groupOrder=G,M.renderOrder=w.renderOrder,M.z=K,M.group=L);f++;return M} var d=[],f=0,h=[],r=[],u={id:-1};return{opaque:h,transparent:r,init:function(){f=0;h.length=0;r.length=0},push:function(w,B,C,G,K,L){w=a(w,B,C,G,K,L);(!0===C.transparent?r:h).push(w)},unshift:function(w,B,C,G,K,L){w=a(w,B,C,G,K,L);(!0===C.transparent?r:h).unshift(w)},sort:function(){1<h.length&&h.sort($q);1<r.length&&r.sort(ar)}}}function br(){function a(f){f=f.target;f.removeEventListener("dispose",a);d.delete(f)}var d=new WeakMap;return{get:function(f,h){var r=d.get(f);if(void 0===r){var u=new Tm; d.set(f,new WeakMap);d.get(f).set(h,u);f.addEventListener("dispose",a)}else u=r.get(h),void 0===u&&(u=new Tm,r.set(h,u));return u},dispose:function(){d=new WeakMap}}}function cr(){var a={};return{get:function(d){if(void 0!==a[d.id])return a[d.id];switch(d.type){case "DirectionalLight":var f={direction:new k,color:new J,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new e};break;case "SpotLight":f={position:new k,direction:new k,color:new J,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1, shadowBias:0,shadowRadius:1,shadowMapSize:new e};break;case "PointLight":f={position:new k,color:new J,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new e,shadowCameraNear:1,shadowCameraFar:1E3};break;case "HemisphereLight":f={direction:new k,skyColor:new J,groundColor:new J};break;case "RectAreaLight":f={color:new J,position:new k,halfWidth:new k,halfHeight:new k}}return a[d.id]=f}}}function dr(a,d){return(d.castShadow?1:0)-(a.castShadow?1:0)}function er(){for(var a=new cr, d={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},f=0;9>f;f++)d.probe.push(new k);var h=new k,r=new t,u=new t;return{setup:function(w, B,C){for(var G=0,K=0,L=0,M=0;9>M;M++)d.probe[M].set(0,0,0);var R=B=0,S=0,X=0,W=0,ja=0,ha=0,ia=0;C=C.matrixWorldInverse;w.sort(dr);M=0;for(var ma=w.length;M<ma;M++){var fa=w[M],la=fa.color,qa=fa.intensity,Ka=fa.distance,La=fa.shadow&&fa.shadow.map?fa.shadow.map.texture:null;if(fa.isAmbientLight)G+=la.r*qa,K+=la.g*qa,L+=la.b*qa;else if(fa.isLightProbe)for(La=0;9>La;La++)d.probe[La].addScaledVector(fa.sh.coefficients[La],qa);else if(fa.isDirectionalLight){var ra=a.get(fa);ra.color.copy(fa.color).multiplyScalar(fa.intensity); ra.direction.setFromMatrixPosition(fa.matrixWorld);h.setFromMatrixPosition(fa.target.matrixWorld);ra.direction.sub(h);ra.direction.transformDirection(C);if(ra.shadow=fa.castShadow)qa=fa.shadow,ra.shadowBias=qa.bias,ra.shadowRadius=qa.radius,ra.shadowMapSize=qa.mapSize,d.directionalShadowMap[B]=La,d.directionalShadowMatrix[B]=fa.shadow.matrix,ja++;d.directional[B]=ra;B++}else if(fa.isSpotLight){ra=a.get(fa);ra.position.setFromMatrixPosition(fa.matrixWorld);ra.position.applyMatrix4(C);ra.color.copy(la).multiplyScalar(qa); ra.distance=Ka;ra.direction.setFromMatrixPosition(fa.matrixWorld);h.setFromMatrixPosition(fa.target.matrixWorld);ra.direction.sub(h);ra.direction.transformDirection(C);ra.coneCos=Math.cos(fa.angle);ra.penumbraCos=Math.cos(fa.angle*(1-fa.penumbra));ra.decay=fa.decay;if(ra.shadow=fa.castShadow)qa=fa.shadow,ra.shadowBias=qa.bias,ra.shadowRadius=qa.radius,ra.shadowMapSize=qa.mapSize,d.spotShadowMap[S]=La,d.spotShadowMatrix[S]=fa.shadow.matrix,ia++;d.spot[S]=ra;S++}else if(fa.isRectAreaLight)ra=a.get(fa), ra.color.copy(la).multiplyScalar(qa),ra.position.setFromMatrixPosition(fa.matrixWorld),ra.position.applyMatrix4(C),u.identity(),r.copy(fa.matrixWorld),r.premultiply(C),u.extractRotation(r),ra.halfWidth.set(.5*fa.width,0,0),ra.halfHeight.set(0,.5*fa.height,0),ra.halfWidth.applyMatrix4(u),ra.halfHeight.applyMatrix4(u),d.rectArea[X]=ra,X++;else if(fa.isPointLight){ra=a.get(fa);ra.position.setFromMatrixPosition(fa.matrixWorld);ra.position.applyMatrix4(C);ra.color.copy(fa.color).multiplyScalar(fa.intensity); ra.distance=fa.distance;ra.decay=fa.decay;if(ra.shadow=fa.castShadow)qa=fa.shadow,ra.shadowBias=qa.bias,ra.shadowRadius=qa.radius,ra.shadowMapSize=qa.mapSize,ra.shadowCameraNear=qa.camera.near,ra.shadowCameraFar=qa.camera.far,d.pointShadowMap[R]=La,d.pointShadowMatrix[R]=fa.shadow.matrix,ha++;d.point[R]=ra;R++}else fa.isHemisphereLight&&(ra=a.get(fa),ra.direction.setFromMatrixPosition(fa.matrixWorld),ra.direction.transformDirection(C),ra.direction.normalize(),ra.skyColor.copy(fa.color).multiplyScalar(qa), ra.groundColor.copy(fa.groundColor).multiplyScalar(qa),d.hemi[W]=ra,W++)}d.ambient[0]=G;d.ambient[1]=K;d.ambient[2]=L;w=d.hash;if(w.directionalLength!==B||w.pointLength!==R||w.spotLength!==S||w.rectAreaLength!==X||w.hemiLength!==W||w.numDirectionalShadows!==ja||w.numPointShadows!==ha||w.numSpotShadows!==ia)d.directional.length=B,d.spot.length=S,d.rectArea.length=X,d.point.length=R,d.hemi.length=W,d.directionalShadowMap.length=ja,d.pointShadowMap.length=ha,d.spotShadowMap.length=ia,d.directionalShadowMatrix.length= ja,d.pointShadowMatrix.length=ha,d.spotShadowMatrix.length=ia,w.directionalLength=B,w.pointLength=R,w.spotLength=S,w.rectAreaLength=X,w.hemiLength=W,w.numDirectionalShadows=ja,w.numPointShadows=ha,w.numSpotShadows=ia,d.version=fr++},state:d}}function Um(){var a=new er,d=[],f=[];return{init:function(){d.length=0;f.length=0},state:{lightsArray:d,shadowsArray:f,lights:a},setupLights:function(h){a.setup(d,f,h)},pushLight:function(h){d.push(h)},pushShadow:function(h){f.push(h)}}}function gr(){function a(f){f= f.target;f.removeEventListener("dispose",a);d.delete(f)}var d=new WeakMap;return{get:function(f,h){if(!1===d.has(f)){var r=new Um;d.set(f,new WeakMap);d.get(f).set(h,r);f.addEventListener("dispose",a)}else!1===d.get(f).has(h)?(r=new Um,d.get(f).set(h,r)):r=d.get(f).get(h);return r},dispose:function(){d=new WeakMap}}}function be(a){T.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale= 1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function ce(a){T.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new k;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Vm(a,d,f){function h(la,qa){var Ka=d.update(ja);S.uniforms.shadow_pass.value= la.map.texture;S.uniforms.resolution.value=la.mapSize;S.uniforms.radius.value=la.radius;a.setRenderTarget(la.mapPass);a.clear();a.renderBufferDirect(qa,null,Ka,S,ja,null);X.uniforms.shadow_pass.value=la.mapPass.texture;X.uniforms.resolution.value=la.mapSize;X.uniforms.radius.value=la.radius;a.setRenderTarget(la.map);a.clear();a.renderBufferDirect(qa,null,Ka,X,ja,null)}function r(la,qa,Ka,La,ra,ua){var sa=la.geometry;var Ca=K;var Za=la.customDepthMaterial;Ka.isPointLight&&(Ca=L,Za=la.customDistanceMaterial); Za?Ca=Za:(Za=!1,qa.morphTargets&&(sa&&sa.isBufferGeometry?Za=sa.morphAttributes&&sa.morphAttributes.position&&0<sa.morphAttributes.position.length:sa&&sa.isGeometry&&(Za=sa.morphTargets&&0<sa.morphTargets.length)),la.isSkinnedMesh&&!1===qa.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",la),la=la.isSkinnedMesh&&qa.skinning,sa=0,Za&&(sa|=1),la&&(sa|=2),Ca=Ca[sa]);a.localClippingEnabled&&!0===qa.clipShadows&&0!==qa.clippingPlanes.length&&(sa=Ca.uuid, Za=qa.uuid,la=M[sa],void 0===la&&(la={},M[sa]=la),sa=la[Za],void 0===sa&&(sa=Ca.clone(),la[Za]=sa),Ca=sa);Ca.visible=qa.visible;Ca.wireframe=qa.wireframe;Ca.side=3===ua?null!=qa.shadowSide?qa.shadowSide:qa.side:null!=qa.shadowSide?qa.shadowSide:R[qa.side];Ca.clipShadows=qa.clipShadows;Ca.clippingPlanes=qa.clippingPlanes;Ca.clipIntersection=qa.clipIntersection;Ca.wireframeLinewidth=qa.wireframeLinewidth;Ca.linewidth=qa.linewidth;Ka.isPointLight&&Ca.isMeshDistanceMaterial&&(Ca.referencePosition.setFromMatrixPosition(Ka.matrixWorld), Ca.nearDistance=La,Ca.farDistance=ra);return Ca}function u(la,qa,Ka,La,ra){if(!1!==la.visible){if(la.layers.test(qa.layers)&&(la.isMesh||la.isLine||la.isPoints)&&(la.castShadow||la.receiveShadow&&3===ra)&&(!la.frustumCulled||w.intersectsObject(la))){la.modelViewMatrix.multiplyMatrices(Ka.matrixWorldInverse,la.matrixWorld);var ua=d.update(la),sa=la.material;if(Array.isArray(sa))for(var Ca=ua.groups,Za=0,ob=Ca.length;Za<ob;Za++){var za=Ca[Za],Wa=sa[za.materialIndex];Wa&&Wa.visible&&(Wa=r(la,Wa,La,Ka.near, Ka.far,ra),a.renderBufferDirect(Ka,null,ua,Wa,la,za))}else sa.visible&&(Wa=r(la,sa,La,Ka.near,Ka.far,ra),a.renderBufferDirect(Ka,null,ua,Wa,la,null))}la=la.children;ua=0;for(sa=la.length;ua<sa;ua++)u(la[ua],qa,Ka,La,ra)}}var w=new Gc,B=new e,C=new e,G=new m,K=Array(4),L=Array(4),M={},R={0:1,1:0,2:2},S=new Ub({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:.125},uniforms:{shadow_pass:{value:null},resolution:{value:new e},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position \x3d vec4( position, 1.0 );\n}", fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \x3cpacking\x3e\nvoid main() {\n float mean \x3d 0.0;\n float squared_mean \x3d 0.0;\n \n\tfloat depth \x3d unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i \x3d -1.0; i \x3c 1.0 ; i +\x3d SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution \x3d decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean +\x3d distribution.x;\n squared_mean +\x3d distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth \x3d unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean +\x3d depth;\n squared_mean +\x3d depth * depth;\n #endif\n }\n mean \x3d mean * HALF_SAMPLE_RATE;\n squared_mean \x3d squared_mean * HALF_SAMPLE_RATE;\n float std_dev \x3d pow( squared_mean - mean * mean, 0.5 );\n gl_FragColor \x3d encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}), X=S.clone();X.defines.HORIZONAL_PASS=1;var W=new Ba;W.addAttribute("position",new da(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var ja=new Nb(W,S);for(W=0;4!==W;++W){var ha=0!==(W&1),ia=0!==(W&2),ma=new be({depthPacking:3201,morphTargets:ha,skinning:ia});K[W]=ma;ha=new ce({morphTargets:ha,skinning:ia});L[W]=ha}var fa=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(la,qa,Ka){if(!1!==fa.enabled&&(!1!==fa.autoUpdate||!1!==fa.needsUpdate)&&0!==la.length){var La= a.getRenderTarget(),ra=a.getActiveCubeFace(),ua=a.getActiveMipmapLevel(),sa=a.state;sa.setBlending(0);sa.buffers.color.setClear(1,1,1,1);sa.buffers.depth.setTest(!0);sa.setScissorTest(!1);for(var Ca=0,Za=la.length;Ca<Za;Ca++){var ob=la[Ca],za=ob.shadow;if(void 0===za)console.warn("THREE.WebGLShadowMap:",ob,"has no shadow.");else{B.copy(za.mapSize);var Wa=za.getFrameExtents();B.multiply(Wa);C.copy(za.mapSize);if(B.x>f||B.y>f)console.warn("THREE.WebGLShadowMap:",ob,"has shadow exceeding max texture size, reducing"), B.x>f&&(C.x=Math.floor(f/Wa.x),B.x=C.x*Wa.x,za.mapSize.x=C.x),B.y>f&&(C.y=Math.floor(f/Wa.y),B.y=C.y*Wa.y,za.mapSize.y=C.y);null!==za.map||za.isPointLightShadow||3!==this.type||(Wa={minFilter:1006,magFilter:1006,format:1023},za.map=new p(B.x,B.y,Wa),za.map.texture.name=ob.name+".shadowMap",za.mapPass=new p(B.x,B.y,Wa),za.camera.updateProjectionMatrix());null===za.map&&(Wa={minFilter:1003,magFilter:1003,format:1023},za.map=new p(B.x,B.y,Wa),za.map.texture.name=ob.name+".shadowMap",za.camera.updateProjectionMatrix()); a.setRenderTarget(za.map);a.clear();Wa=za.getViewportCount();for(var db=0;db<Wa;db++){var zb=za.getViewport(db);G.set(C.x*zb.x,C.y*zb.y,C.x*zb.z,C.y*zb.w);sa.viewport(G);za.updateMatrices(ob,Ka,db);w=za.getFrustum();u(qa,Ka,za.camera,ob,this.type)}za.isPointLightShadow||3!==this.type||h(za,Ka)}}fa.needsUpdate=!1;a.setRenderTarget(La,ra,ua)}}}function hr(a,d,f,h){function r(Z,ta,Aa){var hb=new Uint8Array(4),Ma=a.createTexture();a.bindTexture(Z,Ma);a.texParameteri(Z,10241,9728);a.texParameteri(Z,10240, 9728);for(Z=0;Z<Aa;Z++)a.texImage2D(ta+Z,0,6408,1,1,0,6408,5121,hb);return Ma}function u(Z,ta){ja[Z]=1;0===ha[Z]&&(a.enableVertexAttribArray(Z),ha[Z]=1);ia[Z]!==ta&&((h.isWebGL2?a:d.get("ANGLE_instanced_arrays"))[h.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](Z,ta),ia[Z]=ta)}function w(Z){!0!==ma[Z]&&(a.enable(Z),ma[Z]=!0)}function B(Z){!1!==ma[Z]&&(a.disable(Z),ma[Z]=!1)}function C(Z,ta,Aa,hb,Ma,cb,eb,Ha){if(0===Z)qa&&(B(3042),qa=!1);else if(qa||(w(3042),qa=!0),5!==Z){if(Z!==Ka||Ha!== ob){if(100!==La||100!==sa)a.blendEquation(32774),sa=La=100;if(Ha)switch(Z){case 1:a.blendFuncSeparate(1,771,1,771);break;case 2:a.blendFunc(1,1);break;case 3:a.blendFuncSeparate(0,0,769,771);break;case 4:a.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",Z)}else switch(Z){case 1:a.blendFuncSeparate(770,771,1,771);break;case 2:a.blendFunc(770,1);break;case 3:a.blendFunc(0,769);break;case 4:a.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ", Z)}Za=Ca=ua=ra=null;Ka=Z;ob=Ha}}else{Ma=Ma||ta;cb=cb||Aa;eb=eb||hb;if(ta!==La||Ma!==sa)a.blendEquationSeparate(f.convert(ta),f.convert(Ma)),La=ta,sa=Ma;if(Aa!==ra||hb!==ua||cb!==Ca||eb!==Za)a.blendFuncSeparate(f.convert(Aa),f.convert(hb),f.convert(cb),f.convert(eb)),ra=Aa,ua=hb,Ca=cb,Za=eb;Ka=Z;ob=null}}function G(Z){za!==Z&&(Z?a.frontFace(2304):a.frontFace(2305),za=Z)}function K(Z){0!==Z?(w(2884),Z!==Wa&&(1===Z?a.cullFace(1029):2===Z?a.cullFace(1028):a.cullFace(1032))):B(2884);Wa=Z}function L(Z, ta,Aa){if(Z){if(w(32823),zb!==ta||pb!==Aa)a.polygonOffset(ta,Aa),zb=ta,pb=Aa}else B(32823)}function M(Z){void 0===Z&&(Z=33984+Y-1);oa!==Z&&(a.activeTexture(Z),oa=Z)}var R=new function(){var Z=!1,ta=new m,Aa=null,hb=new m(0,0,0,0);return{setMask:function(Ma){Aa===Ma||Z||(a.colorMask(Ma,Ma,Ma,Ma),Aa=Ma)},setLocked:function(Ma){Z=Ma},setClear:function(Ma,cb,eb,Ha,$a){!0===$a&&(Ma*=Ha,cb*=Ha,eb*=Ha);ta.set(Ma,cb,eb,Ha);!1===hb.equals(ta)&&(a.clearColor(Ma,cb,eb,Ha),hb.copy(ta))},reset:function(){Z=!1; Aa=null;hb.set(-1,0,0,0)}}},S=new function(){var Z=!1,ta=null,Aa=null,hb=null;return{setTest:function(Ma){Ma?w(2929):B(2929)},setMask:function(Ma){ta===Ma||Z||(a.depthMask(Ma),ta=Ma)},setFunc:function(Ma){if(Aa!==Ma){if(Ma)switch(Ma){case 0:a.depthFunc(512);break;case 1:a.depthFunc(519);break;case 2:a.depthFunc(513);break;case 3:a.depthFunc(515);break;case 4:a.depthFunc(514);break;case 5:a.depthFunc(518);break;case 6:a.depthFunc(516);break;case 7:a.depthFunc(517);break;default:a.depthFunc(515)}else a.depthFunc(515); Aa=Ma}},setLocked:function(Ma){Z=Ma},setClear:function(Ma){hb!==Ma&&(a.clearDepth(Ma),hb=Ma)},reset:function(){Z=!1;hb=Aa=ta=null}}},X=new function(){var Z=!1,ta=null,Aa=null,hb=null,Ma=null,cb=null,eb=null,Ha=null,$a=null;return{setTest:function(gb){Z||(gb?w(2960):B(2960))},setMask:function(gb){ta===gb||Z||(a.stencilMask(gb),ta=gb)},setFunc:function(gb,jb,nb){if(Aa!==gb||hb!==jb||Ma!==nb)a.stencilFunc(gb,jb,nb),Aa=gb,hb=jb,Ma=nb},setOp:function(gb,jb,nb){if(cb!==gb||eb!==jb||Ha!==nb)a.stencilOp(gb, jb,nb),cb=gb,eb=jb,Ha=nb},setLocked:function(gb){Z=gb},setClear:function(gb){$a!==gb&&(a.clearStencil(gb),$a=gb)},reset:function(){Z=!1;$a=Ha=eb=cb=Ma=hb=Aa=ta=null}}},W=a.getParameter(34921),ja=new Uint8Array(W),ha=new Uint8Array(W),ia=new Uint8Array(W),ma={},fa=null,la=null,qa=null,Ka=null,La=null,ra=null,ua=null,sa=null,Ca=null,Za=null,ob=!1,za=null,Wa=null,db=null,zb=null,pb=null,Y=a.getParameter(35661),ca=!1;W=0;W=a.getParameter(7938);-1!==W.indexOf("WebGL")?(W=parseFloat(/^WebGL ([0-9])/.exec(W)[1]), ca=1<=W):-1!==W.indexOf("OpenGL ES")&&(W=parseFloat(/^OpenGL ES ([0-9])/.exec(W)[1]),ca=2<=W);var oa=null,xa={},Qa=new m,Ea=new m,Xa={};Xa[3553]=r(3553,3553,1);Xa[34067]=r(34067,34069,6);R.setClear(0,0,0,1);S.setClear(1);X.setClear(0);w(2929);S.setFunc(3);G(!1);K(1);w(2884);C(0);return{buffers:{color:R,depth:S,stencil:X},initAttributes:function(){for(var Z=0,ta=ja.length;Z<ta;Z++)ja[Z]=0},enableAttribute:function(Z){u(Z,0)},enableAttributeAndDivisor:u,disableUnusedAttributes:function(){for(var Z= 0,ta=ha.length;Z!==ta;++Z)ha[Z]!==ja[Z]&&(a.disableVertexAttribArray(Z),ha[Z]=0)},enable:w,disable:B,getCompressedTextureFormats:function(){if(null===fa&&(fa=[],d.get("WEBGL_compressed_texture_pvrtc")||d.get("WEBGL_compressed_texture_s3tc")||d.get("WEBGL_compressed_texture_etc1")||d.get("WEBGL_compressed_texture_astc")))for(var Z=a.getParameter(34467),ta=0;ta<Z.length;ta++)fa.push(Z[ta]);return fa},useProgram:function(Z){return la!==Z?(a.useProgram(Z),la=Z,!0):!1},setBlending:C,setMaterial:function(Z, ta){2===Z.side?B(2884):w(2884);var Aa=1===Z.side;ta&&(Aa=!Aa);G(Aa);1===Z.blending&&!1===Z.transparent?C(0):C(Z.blending,Z.blendEquation,Z.blendSrc,Z.blendDst,Z.blendEquationAlpha,Z.blendSrcAlpha,Z.blendDstAlpha,Z.premultipliedAlpha);S.setFunc(Z.depthFunc);S.setTest(Z.depthTest);S.setMask(Z.depthWrite);R.setMask(Z.colorWrite);ta=Z.stencilWrite;X.setTest(ta);ta&&(X.setFunc(Z.stencilFunc,Z.stencilRef,Z.stencilMask),X.setOp(Z.stencilFail,Z.stencilZFail,Z.stencilZPass));L(Z.polygonOffset,Z.polygonOffsetFactor, Z.polygonOffsetUnits)},setFlipSided:G,setCullFace:K,setLineWidth:function(Z){Z!==db&&(ca&&a.lineWidth(Z),db=Z)},setPolygonOffset:L,setScissorTest:function(Z){Z?w(3089):B(3089)},activeTexture:M,bindTexture:function(Z,ta){null===oa&&M();var Aa=xa[oa];void 0===Aa&&(Aa={type:void 0,texture:void 0},xa[oa]=Aa);if(Aa.type!==Z||Aa.texture!==ta)a.bindTexture(Z,ta||Xa[Z]),Aa.type=Z,Aa.texture=ta},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(Z){console.error("THREE.WebGLState:", Z)}},texImage2D:function(){try{a.texImage2D.apply(a,arguments)}catch(Z){console.error("THREE.WebGLState:",Z)}},texImage3D:function(){try{a.texImage3D.apply(a,arguments)}catch(Z){console.error("THREE.WebGLState:",Z)}},scissor:function(Z){!1===Qa.equals(Z)&&(a.scissor(Z.x,Z.y,Z.z,Z.w),Qa.copy(Z))},viewport:function(Z){!1===Ea.equals(Z)&&(a.viewport(Z.x,Z.y,Z.z,Z.w),Ea.copy(Z))},reset:function(){for(var Z=0;Z<ha.length;Z++)1===ha[Z]&&(a.disableVertexAttribArray(Z),ha[Z]=0);ma={};oa=fa=null;xa={};Wa= za=Ka=la=null;R.reset();S.reset();X.reset()}}}function ir(a,d,f,h,r,u,w){function B(Y,ca){return Wa?new OffscreenCanvas(Y,ca):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function C(Y,ca,oa,xa){var Qa=1;if(Y.width>xa||Y.height>xa)Qa=xa/Math.max(Y.width,Y.height);if(1>Qa||!0===ca){if("undefined"!==typeof HTMLImageElement&&Y instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&Y instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&Y instanceof ImageBitmap)return xa= ca?bb.floorPowerOfTwo:Math.floor,ca=xa(Qa*Y.width),Qa=xa(Qa*Y.height),void 0===za&&(za=B(ca,Qa)),oa=oa?B(ca,Qa):za,oa.width=ca,oa.height=Qa,oa.getContext("2d").drawImage(Y,0,0,ca,Qa),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Y.width+"x"+Y.height+") to ("+ca+"x"+Qa+")."),oa;"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Y.width+"x"+Y.height+").")}return Y}function G(Y){return bb.isPowerOfTwo(Y.width)&&bb.isPowerOfTwo(Y.height)}function K(Y){return r.isWebGL2? !1:1001!==Y.wrapS||1001!==Y.wrapT||1003!==Y.minFilter&&1006!==Y.minFilter}function L(Y,ca){return Y.generateMipmaps&&ca&&1003!==Y.minFilter&&1006!==Y.minFilter}function M(Y,ca,oa,xa){a.generateMipmap(Y);h.get(ca).__maxMipLevel=Math.log(Math.max(oa,xa))*Math.LOG2E}function R(Y,ca){if(!r.isWebGL2)return Y;var oa=Y;6403===Y&&(5126===ca&&(oa=33326),5131===ca&&(oa=33325),5121===ca&&(oa=33321));6407===Y&&(5126===ca&&(oa=34837),5131===ca&&(oa=34843),5121===ca&&(oa=32849));6408===Y&&(5126===ca&&(oa=34836), 5131===ca&&(oa=34842),5121===ca&&(oa=32856));33325===oa||33326===oa||34842===oa||34836===oa?d.get("EXT_color_buffer_float"):(34843===oa||34837===oa)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.");return oa}function S(Y){return 1003===Y||1004===Y||1005===Y?9728:9729}function X(Y){Y=Y.target;Y.removeEventListener("dispose",X);ja(Y);Y.isVideoTexture&&ob.delete(Y);w.memory.textures--}function W(Y){Y=Y.target;Y.removeEventListener("dispose", W);ha(Y);w.memory.textures--}function ja(Y){var ca=h.get(Y);void 0!==ca.__webglInit&&(a.deleteTexture(ca.__webglTexture),h.remove(Y))}function ha(Y){var ca=h.get(Y),oa=h.get(Y.texture);if(Y){void 0!==oa.__webglTexture&&a.deleteTexture(oa.__webglTexture);Y.depthTexture&&Y.depthTexture.dispose();if(Y.isWebGLRenderTargetCube)for(oa=0;6>oa;oa++)a.deleteFramebuffer(ca.__webglFramebuffer[oa]),ca.__webglDepthbuffer&&a.deleteRenderbuffer(ca.__webglDepthbuffer[oa]);else a.deleteFramebuffer(ca.__webglFramebuffer), ca.__webglDepthbuffer&&a.deleteRenderbuffer(ca.__webglDepthbuffer);h.remove(Y.texture);h.remove(Y)}}function ia(Y,ca){var oa=h.get(Y);Y.isVideoTexture&&Za(Y);if(0<Y.version&&oa.__version!==Y.version){var xa=Y.image;if(void 0===xa)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(!1===xa.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ka(oa,Y,ca);return}}f.activeTexture(33984+ca);f.bindTexture(3553,oa.__webglTexture)} function ma(Y,ca){if(6===Y.image.length){var oa=h.get(Y);if(0<Y.version&&oa.__version!==Y.version){qa(oa,Y);f.activeTexture(33984+ca);f.bindTexture(34067,oa.__webglTexture);a.pixelStorei(37440,Y.flipY);var xa=Y&&Y.isCompressedTexture;ca=Y.image[0]&&Y.image[0].isDataTexture;for(var Qa=[],Ea=0;6>Ea;Ea++)Qa[Ea]=xa||ca?ca?Y.image[Ea].image:Y.image[Ea]:C(Y.image[Ea],!1,!0,r.maxCubemapSize);var Xa=Qa[0],Z=G(Xa)||r.isWebGL2,ta=u.convert(Y.format),Aa=u.convert(Y.type),hb=R(ta,Aa);la(34067,Y,Z);if(xa){for(Ea= 0;6>Ea;Ea++){var Ma=Qa[Ea].mipmaps;for(xa=0;xa<Ma.length;xa++){var cb=Ma[xa];1023!==Y.format&&1022!==Y.format?-1<f.getCompressedTextureFormats().indexOf(ta)?f.compressedTexImage2D(34069+Ea,xa,hb,cb.width,cb.height,0,cb.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):f.texImage2D(34069+Ea,xa,hb,cb.width,cb.height,0,ta,Aa,cb.data)}}oa.__maxMipLevel=Ma.length-1}else{Ma=Y.mipmaps;for(Ea=0;6>Ea;Ea++)if(ca)for(f.texImage2D(34069+Ea,0, hb,Qa[Ea].width,Qa[Ea].height,0,ta,Aa,Qa[Ea].data),xa=0;xa<Ma.length;xa++)cb=Ma[xa],cb=cb.image[Ea].image,f.texImage2D(34069+Ea,xa+1,hb,cb.width,cb.height,0,ta,Aa,cb.data);else for(f.texImage2D(34069+Ea,0,hb,ta,Aa,Qa[Ea]),xa=0;xa<Ma.length;xa++)cb=Ma[xa],f.texImage2D(34069+Ea,xa+1,hb,ta,Aa,cb.image[Ea]);oa.__maxMipLevel=Ma.length}L(Y,Z)&&M(34067,Y,Xa.width,Xa.height);oa.__version=Y.version;if(Y.onUpdate)Y.onUpdate(Y)}else f.activeTexture(33984+ca),f.bindTexture(34067,oa.__webglTexture)}}function fa(Y, ca){f.activeTexture(33984+ca);f.bindTexture(34067,h.get(Y).__webglTexture)}function la(Y,ca,oa){oa?(a.texParameteri(Y,10242,u.convert(ca.wrapS)),a.texParameteri(Y,10243,u.convert(ca.wrapT)),32879!==Y&&35866!==Y||a.texParameteri(Y,32882,u.convert(ca.wrapR)),a.texParameteri(Y,10240,u.convert(ca.magFilter)),a.texParameteri(Y,10241,u.convert(ca.minFilter))):(a.texParameteri(Y,10242,33071),a.texParameteri(Y,10243,33071),32879!==Y&&35866!==Y||a.texParameteri(Y,32882,33071),1001===ca.wrapS&&1001===ca.wrapT|| console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),a.texParameteri(Y,10240,S(ca.magFilter)),a.texParameteri(Y,10241,S(ca.minFilter)),1003!==ca.minFilter&&1006!==ca.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));!(oa=d.get("EXT_texture_filter_anisotropic"))||1015===ca.type&&null===d.get("OES_texture_float_linear")|| 1016===ca.type&&null===(r.isWebGL2||d.get("OES_texture_half_float_linear"))||!(1<ca.anisotropy||h.get(ca).__currentAnisotropy)||(a.texParameterf(Y,oa.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(ca.anisotropy,r.getMaxAnisotropy())),h.get(ca).__currentAnisotropy=ca.anisotropy)}function qa(Y,ca){void 0===Y.__webglInit&&(Y.__webglInit=!0,ca.addEventListener("dispose",X),Y.__webglTexture=a.createTexture(),w.memory.textures++)}function Ka(Y,ca,oa){var xa=3553;ca.isDataTexture2DArray&&(xa=35866);ca.isDataTexture3D&& (xa=32879);qa(Y,ca);f.activeTexture(33984+oa);f.bindTexture(xa,Y.__webglTexture);a.pixelStorei(37440,ca.flipY);a.pixelStorei(37441,ca.premultiplyAlpha);a.pixelStorei(3317,ca.unpackAlignment);oa=K(ca)&&!1===G(ca.image);oa=C(ca.image,oa,!1,r.maxTextureSize);var Qa=G(oa)||r.isWebGL2,Ea=u.convert(ca.format),Xa=u.convert(ca.type),Z=R(Ea,Xa);la(xa,ca,Qa);var ta=ca.mipmaps;if(ca.isDepthTexture){Z=6402;if(1015===ca.type){if(!r.isWebGL2)throw Error("Float Depth Texture only supported in WebGL2.0");Z=36012}else r.isWebGL2&& (Z=33189);1026===ca.format&&6402===Z&&1012!==ca.type&&1014!==ca.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),ca.type=1012,Xa=u.convert(ca.type));1027===ca.format&&(Z=34041,1020!==ca.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),ca.type=1020,Xa=u.convert(ca.type)));f.texImage2D(3553,0,Z,oa.width,oa.height,0,Ea,Xa,null)}else if(ca.isDataTexture)if(0<ta.length&&Qa){for(var Aa= 0,hb=ta.length;Aa<hb;Aa++)xa=ta[Aa],f.texImage2D(3553,Aa,Z,xa.width,xa.height,0,Ea,Xa,xa.data);ca.generateMipmaps=!1;Y.__maxMipLevel=ta.length-1}else f.texImage2D(3553,0,Z,oa.width,oa.height,0,Ea,Xa,oa.data),Y.__maxMipLevel=0;else if(ca.isCompressedTexture){Aa=0;for(hb=ta.length;Aa<hb;Aa++)xa=ta[Aa],1023!==ca.format&&1022!==ca.format?-1<f.getCompressedTextureFormats().indexOf(Ea)?f.compressedTexImage2D(3553,Aa,Z,xa.width,xa.height,0,xa.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"): f.texImage2D(3553,Aa,Z,xa.width,xa.height,0,Ea,Xa,xa.data);Y.__maxMipLevel=ta.length-1}else if(ca.isDataTexture2DArray)f.texImage3D(35866,0,Z,oa.width,oa.height,oa.depth,0,Ea,Xa,oa.data),Y.__maxMipLevel=0;else if(ca.isDataTexture3D)f.texImage3D(32879,0,Z,oa.width,oa.height,oa.depth,0,Ea,Xa,oa.data),Y.__maxMipLevel=0;else if(0<ta.length&&Qa){Aa=0;for(hb=ta.length;Aa<hb;Aa++)xa=ta[Aa],f.texImage2D(3553,Aa,Z,Ea,Xa,xa);ca.generateMipmaps=!1;Y.__maxMipLevel=ta.length-1}else f.texImage2D(3553,0,Z,Ea,Xa, oa),Y.__maxMipLevel=0;L(ca,Qa)&&M(3553,ca,oa.width,oa.height);Y.__version=ca.version;if(ca.onUpdate)ca.onUpdate(ca)}function La(Y,ca,oa,xa){var Qa=u.convert(ca.texture.format),Ea=u.convert(ca.texture.type),Xa=R(Qa,Ea);f.texImage2D(xa,0,Xa,ca.width,ca.height,0,Qa,Ea,null);a.bindFramebuffer(36160,Y);a.framebufferTexture2D(36160,oa,xa,h.get(ca.texture).__webglTexture,0);a.bindFramebuffer(36160,null)}function ra(Y,ca,oa){a.bindRenderbuffer(36161,Y);if(ca.depthBuffer&&!ca.stencilBuffer)oa?(oa=Ca(ca),a.renderbufferStorageMultisample(36161, oa,33189,ca.width,ca.height)):a.renderbufferStorage(36161,33189,ca.width,ca.height),a.framebufferRenderbuffer(36160,36096,36161,Y);else if(ca.depthBuffer&&ca.stencilBuffer)oa?(oa=Ca(ca),a.renderbufferStorageMultisample(36161,oa,35056,ca.width,ca.height)):a.renderbufferStorage(36161,34041,ca.width,ca.height),a.framebufferRenderbuffer(36160,33306,36161,Y);else{Y=u.convert(ca.texture.format);var xa=u.convert(ca.texture.type);Y=R(Y,xa);oa?(oa=Ca(ca),a.renderbufferStorageMultisample(36161,oa,Y,ca.width, ca.height)):a.renderbufferStorage(36161,Y,ca.width,ca.height)}a.bindRenderbuffer(36161,null)}function ua(Y,ca){if(ca&&ca.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(36160,Y);if(!ca.depthTexture||!ca.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");h.get(ca.depthTexture).__webglTexture&&ca.depthTexture.image.width===ca.width&&ca.depthTexture.image.height===ca.height||(ca.depthTexture.image.width= ca.width,ca.depthTexture.image.height=ca.height,ca.depthTexture.needsUpdate=!0);ia(ca.depthTexture,0);Y=h.get(ca.depthTexture).__webglTexture;if(1026===ca.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,Y,0);else if(1027===ca.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,Y,0);else throw Error("Unknown depthTexture format");}function sa(Y){var ca=h.get(Y),oa=!0===Y.isWebGLRenderTargetCube;if(Y.depthTexture){if(oa)throw Error("target.depthTexture not supported in Cube render targets"); ua(ca.__webglFramebuffer,Y)}else if(oa)for(ca.__webglDepthbuffer=[],oa=0;6>oa;oa++)a.bindFramebuffer(36160,ca.__webglFramebuffer[oa]),ca.__webglDepthbuffer[oa]=a.createRenderbuffer(),ra(ca.__webglDepthbuffer[oa],Y);else a.bindFramebuffer(36160,ca.__webglFramebuffer),ca.__webglDepthbuffer=a.createRenderbuffer(),ra(ca.__webglDepthbuffer,Y);a.bindFramebuffer(36160,null)}function Ca(Y){return r.isWebGL2&&Y.isWebGLMultisampleRenderTarget?Math.min(r.maxSamples,Y.samples):0}function Za(Y){var ca=w.render.frame; ob.get(Y)!==ca&&(ob.set(Y,ca),Y.update())}var ob=new WeakMap,za,Wa="undefined"!==typeof OffscreenCanvas,db=0,zb=!1,pb=!1;this.allocateTextureUnit=function(){var Y=db;Y>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+r.maxTextures);db+=1;return Y};this.resetTextureUnits=function(){db=0};this.setTexture2D=ia;this.setTexture2DArray=function(Y,ca){var oa=h.get(Y);0<Y.version&&oa.__version!==Y.version?Ka(oa,Y,ca):(f.activeTexture(33984+ ca),f.bindTexture(35866,oa.__webglTexture))};this.setTexture3D=function(Y,ca){var oa=h.get(Y);0<Y.version&&oa.__version!==Y.version?Ka(oa,Y,ca):(f.activeTexture(33984+ca),f.bindTexture(32879,oa.__webglTexture))};this.setTextureCube=ma;this.setTextureCubeDynamic=fa;this.setupRenderTarget=function(Y){var ca=h.get(Y),oa=h.get(Y.texture);Y.addEventListener("dispose",W);oa.__webglTexture=a.createTexture();w.memory.textures++;var xa=!0===Y.isWebGLRenderTargetCube,Qa=!0===Y.isWebGLMultisampleRenderTarget, Ea=G(Y)||r.isWebGL2;if(xa)for(ca.__webglFramebuffer=[],Qa=0;6>Qa;Qa++)ca.__webglFramebuffer[Qa]=a.createFramebuffer();else if(ca.__webglFramebuffer=a.createFramebuffer(),Qa)if(r.isWebGL2){ca.__webglMultisampledFramebuffer=a.createFramebuffer();ca.__webglColorRenderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,ca.__webglColorRenderbuffer);Qa=u.convert(Y.texture.format);var Xa=u.convert(Y.texture.type);Qa=R(Qa,Xa);Xa=Ca(Y);a.renderbufferStorageMultisample(36161,Xa,Qa,Y.width,Y.height);a.bindFramebuffer(36160, ca.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,ca.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);Y.depthBuffer&&(ca.__webglDepthRenderbuffer=a.createRenderbuffer(),ra(ca.__webglDepthRenderbuffer,Y,!0));a.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(xa){f.bindTexture(34067,oa.__webglTexture);la(34067,Y.texture,Ea);for(Qa=0;6>Qa;Qa++)La(ca.__webglFramebuffer[Qa],Y,36064,34069+ Qa);L(Y.texture,Ea)&&M(34067,Y.texture,Y.width,Y.height);f.bindTexture(34067,null)}else f.bindTexture(3553,oa.__webglTexture),la(3553,Y.texture,Ea),La(ca.__webglFramebuffer,Y,36064,3553),L(Y.texture,Ea)&&M(3553,Y.texture,Y.width,Y.height),f.bindTexture(3553,null);Y.depthBuffer&&sa(Y)};this.updateRenderTargetMipmap=function(Y){var ca=Y.texture,oa=G(Y)||r.isWebGL2;if(L(ca,oa)){oa=Y.isWebGLRenderTargetCube?34067:3553;var xa=h.get(ca).__webglTexture;f.bindTexture(oa,xa);M(oa,ca,Y.width,Y.height);f.bindTexture(oa, null)}};this.updateMultisampleRenderTarget=function(Y){if(Y.isWebGLMultisampleRenderTarget)if(r.isWebGL2){var ca=h.get(Y);a.bindFramebuffer(36008,ca.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,ca.__webglFramebuffer);ca=Y.width;var oa=Y.height,xa=16384;Y.depthBuffer&&(xa|=256);Y.stencilBuffer&&(xa|=1024);a.blitFramebuffer(0,0,ca,oa,0,0,ca,oa,xa,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(Y,ca){Y&& Y.isWebGLRenderTarget&&(!1===zb&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),zb=!0),Y=Y.texture);ia(Y,ca)};this.safeSetTextureCube=function(Y,ca){Y&&Y.isWebGLRenderTargetCube&&(!1===pb&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),pb=!0),Y=Y.texture);Y&&Y.isCubeTexture||Array.isArray(Y.image)&&6===Y.image.length?ma(Y,ca): fa(Y,ca)}}function Wm(a,d,f){return{convert:function(h){if(1E3===h)return 10497;if(1001===h)return 33071;if(1002===h)return 33648;if(1003===h)return 9728;if(1004===h)return 9984;if(1005===h)return 9986;if(1006===h)return 9729;if(1007===h)return 9985;if(1008===h)return 9987;if(1009===h)return 5121;if(1017===h)return 32819;if(1018===h)return 32820;if(1019===h)return 33635;if(1010===h)return 5120;if(1011===h)return 5122;if(1012===h)return 5123;if(1013===h)return 5124;if(1014===h)return 5125;if(1015=== h)return 5126;if(1016===h){if(f.isWebGL2)return 5131;var r=d.get("OES_texture_half_float");if(null!==r)return r.HALF_FLOAT_OES}if(1021===h)return 6406;if(1022===h)return 6407;if(1023===h)return 6408;if(1024===h)return 6409;if(1025===h)return 6410;if(1026===h)return 6402;if(1027===h)return 34041;if(1028===h)return 6403;if(100===h)return 32774;if(101===h)return 32778;if(102===h)return 32779;if(200===h)return 0;if(201===h)return 1;if(202===h)return 768;if(203===h)return 769;if(204===h)return 770;if(205=== h)return 771;if(206===h)return 772;if(207===h)return 773;if(208===h)return 774;if(209===h)return 775;if(210===h)return 776;if(33776===h||33777===h||33778===h||33779===h)if(r=d.get("WEBGL_compressed_texture_s3tc"),null!==r){if(33776===h)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===h)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===h)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===h)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===h||35841===h||35842===h||35843===h)if(r=d.get("WEBGL_compressed_texture_pvrtc"), null!==r){if(35840===h)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===h)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===h)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===h)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===h&&(r=d.get("WEBGL_compressed_texture_etc1"),null!==r))return r.COMPRESSED_RGB_ETC1_WEBGL;if(37808===h||37809===h||37810===h||37811===h||37812===h||37813===h||37814===h||37815===h||37816===h||37817===h||37818===h||37819===h||37820===h||37821===h)if(r=d.get("WEBGL_compressed_texture_astc"), null!==r)return h;if(103===h||104===h){if(f.isWebGL2){if(103===h)return 32775;if(104===h)return 32776}r=d.get("EXT_blend_minmax");if(null!==r){if(103===h)return r.MIN_EXT;if(104===h)return r.MAX_EXT}}if(1020===h){if(f.isWebGL2)return 34042;r=d.get("WEBGL_depth_texture");if(null!==r)return r.UNSIGNED_INT_24_8_WEBGL}return 0}}}function qf(){y.call(this);this.type="Group"}function Kg(a){Ab.call(this);this.cameras=a||[]}function Xm(a,d,f){Ym.setFromMatrixPosition(d.matrixWorld);Zm.setFromMatrixPosition(f.matrixWorld); var h=Ym.distanceTo(Zm),r=d.projectionMatrix.elements,u=f.projectionMatrix.elements,w=r[14]/(r[10]-1);f=r[14]/(r[10]+1);var B=(r[9]+1)/r[5],C=(r[9]-1)/r[5],G=(r[8]-1)/r[0],K=(u[8]+1)/u[0];r=w*G;u=w*K;K=h/(-G+K);G=K*-G;d.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(G);a.translateZ(K);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld);d=w+K;w=f+K;a.projectionMatrix.makePerspective(r-G,u+(h-G),B*f/w*d,C*f/w*d,d,w)}function Sj(a){function d(){return null!== G&&!0===G.isPresenting}function f(){if(d()){var ua=G.getEyeParameters("left");w=2*ua.renderWidth*X;B=ua.renderHeight*X;Ka=a.getPixelRatio();a.getSize(qa);a.setDrawingBufferSize(w,B,1);ma.viewport.set(0,0,w/2,B);fa.viewport.set(w/2,0,w/2,B);ra.start();C.dispatchEvent({type:"sessionstart"})}else C.enabled&&a.setDrawingBufferSize(qa.width,qa.height,Ka),ra.stop(),C.dispatchEvent({type:"sessionend"})}function h(ua){for(var sa=navigator.getGamepads&&navigator.getGamepads(),Ca=0,Za=0,ob=sa.length;Ca<ob;Ca++){var za= sa[Ca];if(za&&("Daydream Controller"===za.id||"Gear VR Controller"===za.id||"Oculus Go Controller"===za.id||"OpenVR Gamepad"===za.id||za.id.startsWith("Oculus Touch")||za.id.startsWith("HTC Vive Focus")||za.id.startsWith("Spatial Controller"))){if(Za===ua)return za;Za++}}}function r(){for(var ua=0;ua<M.length;ua++){var sa=M[ua],Ca=h(ua);if(void 0!==Ca&&void 0!==Ca.pose){if(null===Ca.pose)break;var Za=Ca.pose;!1===Za.hasPosition&&sa.position.set(.2,-.6,-.05);null!==Za.position&&sa.position.fromArray(Za.position); null!==Za.orientation&&sa.quaternion.fromArray(Za.orientation);sa.matrix.compose(sa.position,sa.quaternion,sa.scale);sa.matrix.premultiply(R);sa.matrix.decompose(sa.position,sa.quaternion,sa.scale);sa.matrixWorldNeedsUpdate=!0;sa.visible=!0;Za="Daydream Controller"===Ca.id?0:1;void 0===La[ua]&&(La[ua]=!1);La[ua]!==Ca.buttons[Za].pressed&&(La[ua]=Ca.buttons[Za].pressed,!0===La[ua]?sa.dispatchEvent({type:"selectstart"}):(sa.dispatchEvent({type:"selectend"}),sa.dispatchEvent({type:"select"})))}else sa.visible= !1}}function u(ua,sa){null!==sa&&4===sa.length&&ua.set(sa[0]*w,sa[1]*B,sa[2]*w,sa[3]*B)}var w,B,C=this,G=null,K=null,L=null,M=[],R=new t,S=new t,X=1,W="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(K=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",f,!1));var ja=new t,ha=new g,ia=new k,ma=new Ab;ma.viewport=new m;ma.layers.enable(1);var fa=new Ab;fa.viewport=new m;fa.layers.enable(2);var la=new Kg([ma,fa]);la.layers.enable(1);la.layers.enable(2);var qa= new e,Ka,La=[];this.enabled=!1;this.getController=function(ua){var sa=M[ua];void 0===sa&&(sa=new qf,sa.matrixAutoUpdate=!1,sa.visible=!1,M[ua]=sa);return sa};this.getDevice=function(){return G};this.setDevice=function(ua){void 0!==ua&&(G=ua);ra.setContext(ua)};this.setFramebufferScaleFactor=function(ua){X=ua};this.setReferenceSpaceType=function(ua){W=ua};this.setPoseTarget=function(ua){void 0!==ua&&(L=ua)};this.getCamera=function(ua){var sa="local-floor"===W?1.6:0;if(!1===d())return ua.position.set(0, sa,0),ua.rotation.set(0,0,0),ua;G.depthNear=ua.near;G.depthFar=ua.far;G.getFrameData(K);if("local-floor"===W){var Ca=G.stageParameters;Ca?R.fromArray(Ca.sittingToStandingTransform):R.makeTranslation(0,sa,0)}sa=K.pose;Ca=null!==L?L:ua;Ca.matrix.copy(R);Ca.matrix.decompose(Ca.position,Ca.quaternion,Ca.scale);null!==sa.orientation&&(ha.fromArray(sa.orientation),Ca.quaternion.multiply(ha));null!==sa.position&&(ha.setFromRotationMatrix(R),ia.fromArray(sa.position),ia.applyQuaternion(ha),Ca.position.add(ia)); Ca.updateMatrixWorld();ma.near=ua.near;fa.near=ua.near;ma.far=ua.far;fa.far=ua.far;ma.matrixWorldInverse.fromArray(K.leftViewMatrix);fa.matrixWorldInverse.fromArray(K.rightViewMatrix);S.getInverse(R);"local-floor"===W&&(ma.matrixWorldInverse.multiply(S),fa.matrixWorldInverse.multiply(S));ua=Ca.parent;null!==ua&&(ja.getInverse(ua.matrixWorld),ma.matrixWorldInverse.multiply(ja),fa.matrixWorldInverse.multiply(ja));ma.matrixWorld.getInverse(ma.matrixWorldInverse);fa.matrixWorld.getInverse(fa.matrixWorldInverse); ma.projectionMatrix.fromArray(K.leftProjectionMatrix);fa.projectionMatrix.fromArray(K.rightProjectionMatrix);Xm(la,ma,fa);ua=G.getLayers();ua.length&&(ua=ua[0],u(ma.viewport,ua.leftBounds),u(fa.viewport,ua.rightBounds));r();return la};this.getStandingMatrix=function(){return R};this.isPresenting=d;var ra=new id;this.setAnimationLoop=function(ua){ra.setAnimationLoop(ua);d()&&ra.start()};this.submitFrame=function(){d()&&G.submitFrame()};this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange", f)};this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function $m(a,d){function f(){return null!==C&&null!==G}function h(ia){for(var ma=0;ma<M.length;ma++)R[ma]===ia.inputSource&&M[ma].dispatchEvent({type:ia.type})}function r(){a.setFramebuffer(null);a.setRenderTarget(a.getRenderTarget());ha.stop();B.dispatchEvent({type:"sessionend"})}function u(ia){G=ia;ha.setContext(C);ha.start();B.dispatchEvent({type:"sessionstart"})}function w(ia, ma){null===ma?ia.matrixWorld.copy(ia.matrix):ia.matrixWorld.multiplyMatrices(ma.matrixWorld,ia.matrix);ia.matrixWorldInverse.getInverse(ia.matrixWorld)}var B=this,C=null,G=null,K="local-floor",L=null,M=[],R=[],S=new Ab;S.layers.enable(1);S.viewport=new m;var X=new Ab;X.layers.enable(2);X.viewport=new m;var W=new Kg([S,X]);W.layers.enable(1);W.layers.enable(2);this.enabled=!1;this.getController=function(ia){var ma=M[ia];void 0===ma&&(ma=new qf,ma.matrixAutoUpdate=!1,ma.visible=!1,M[ia]=ma);return ma}; this.setFramebufferScaleFactor=function(){};this.setReferenceSpaceType=function(ia){K=ia};this.getSession=function(){return C};this.setSession=function(ia){C=ia;null!==C&&(C.addEventListener("select",h),C.addEventListener("selectstart",h),C.addEventListener("selectend",h),C.addEventListener("end",r),C.updateRenderState({baseLayer:new XRWebGLLayer(C,d)}),C.requestReferenceSpace(K).then(u),R=C.inputSources,C.addEventListener("inputsourceschange",function(){R=C.inputSources;console.log(R);for(var ma= 0;ma<M.length;ma++)M[ma].userData.inputSource=R[ma]}))};this.getCamera=function(ia){if(f()){var ma=ia.parent,fa=W.cameras;w(W,ma);for(var la=0;la<fa.length;la++)w(fa[la],ma);ia.matrixWorld.copy(W.matrixWorld);ia=ia.children;la=0;for(ma=ia.length;la<ma;la++)ia[la].updateMatrixWorld(!0);Xm(W,S,X);return W}return ia};this.isPresenting=f;var ja=null,ha=new id;ha.setAnimationLoop(function(ia,ma){L=ma.getViewerPose(G);if(null!==L){var fa=L.views,la=C.renderState.baseLayer;a.setFramebuffer(la.framebuffer); for(var qa=0;qa<fa.length;qa++){var Ka=fa[qa],La=la.getViewport(Ka),ra=W.cameras[qa];ra.matrix.fromArray(Ka.transform.inverse.matrix).getInverse(ra.matrix);ra.projectionMatrix.fromArray(Ka.projectionMatrix);ra.viewport.set(La.x,La.y,La.width,La.height);0===qa&&W.matrix.copy(ra.matrix)}}for(qa=0;qa<M.length;qa++){fa=M[qa];if(la=R[qa])if(la=ma.getPose(la.targetRaySpace,G),null!==la){fa.matrix.fromArray(la.transform.matrix);fa.matrix.decompose(fa.position,fa.rotation,fa.scale);fa.visible=!0;continue}fa.visible= !1}ja&&ja(ia)});this.setAnimationLoop=function(ia){ja=ia};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new t};this.getDevice=function(){console.warn("THREE.WebXRManager: getDevice() has been deprecated.")};this.setDevice=function(){console.warn("THREE.WebXRManager: setDevice() has been deprecated.")};this.setFrameOfReferenceType=function(){console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.")}; this.submitFrame=function(){}}function Tj(a){var d;function f(){return null===cb?nc:1}function h(){Lb=new Bd(Ia);oc=new Ob(Ia,Lb,a);oc.isWebGL2||(Lb.get("WEBGL_depth_texture"),Lb.get("OES_texture_float"),Lb.get("OES_texture_half_float"),Lb.get("OES_texture_half_float_linear"),Lb.get("OES_standard_derivatives"),Lb.get("OES_element_index_uint"),Lb.get("ANGLE_instanced_arrays"));Lb.get("OES_texture_float_linear");ld=new Wm(Ia,Lb,oc);qb=new hr(Ia,Lb,ld,oc);qb.scissor(Zb.copy(rf).multiplyScalar(nc).floor()); qb.viewport(Ib.copy(sf).multiplyScalar(nc).floor());de=new eq(Ia);pc=new Zq;md=new ir(Ia,Lb,qb,pc,oc,ld,de);bi=new ze(Ia);Uj=new $d(Ia,bi,de);uf=new hq(Uj,de);an=new gq(Ia);Ae=new Yq(Z,Lb,oc);ci=new br;vf=new gr;ee=new Zd(Z,qb,uf,ca);bn=new ka(Ia,Lb,de,oc);cn=new $h(Ia,Lb,de,oc);de.programs=Ae.programs;Z.capabilities=oc;Z.extensions=Lb;Z.properties=pc;Z.renderLists=ci;Z.state=qb;Z.info=de}function r(Q){Q.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");ta=!0}function u(){console.log("THREE.WebGLRenderer: Context Restored."); ta=!1;h()}function w(Q){Q=Q.target;Q.removeEventListener("dispose",w);B(Q)}function B(Q){C(Q);pc.remove(Q)}function C(Q){var U=pc.get(Q).program;Q.program=void 0;void 0!==U&&Ae.releaseProgram(U)}function G(Q,U){Q.render(function(ba){Z.renderBufferImmediate(ba,U)})}function K(Q,U,ba){if(ba&&ba.isInstancedBufferGeometry&&!oc.isWebGL2&&null===Lb.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); else{qb.initAttributes();var wa=ba.attributes;U=U.getAttributes();Q=Q.defaultAttributeValues;for(var Fa in U){var Va=U[Fa];if(0<=Va){var Ga=wa[Fa];if(void 0!==Ga){var ab=Ga.normalized,ub=Ga.itemSize,ib=bi.get(Ga);if(void 0!==ib){var Sa=ib.buffer,nd=ib.type;ib=ib.bytesPerElement;if(Ga.isInterleavedBufferAttribute){var Pc=Ga.data,wf=Pc.stride;Ga=Ga.offset;Pc&&Pc.isInstancedInterleavedBuffer?(qb.enableAttributeAndDivisor(Va,Pc.meshPerAttribute),void 0===ba.maxInstancedCount&&(ba.maxInstancedCount=Pc.meshPerAttribute* Pc.count)):qb.enableAttribute(Va);Ia.bindBuffer(34962,Sa);Ia.vertexAttribPointer(Va,ub,nd,ab,wf*ib,Ga*ib)}else Ga.isInstancedBufferAttribute?(qb.enableAttributeAndDivisor(Va,Ga.meshPerAttribute),void 0===ba.maxInstancedCount&&(ba.maxInstancedCount=Ga.meshPerAttribute*Ga.count)):qb.enableAttribute(Va),Ia.bindBuffer(34962,Sa),Ia.vertexAttribPointer(Va,ub,nd,ab,0,0)}}else if(void 0!==Q&&(ab=Q[Fa],void 0!==ab))switch(ab.length){case 2:Ia.vertexAttrib2fv(Va,ab);break;case 3:Ia.vertexAttrib3fv(Va,ab);break; case 4:Ia.vertexAttrib4fv(Va,ab);break;default:Ia.vertexAttrib1fv(Va,ab)}}}qb.disableUnusedAttributes()}}function L(Q,U,ba,wa){if(!1!==Q.visible){if(Q.layers.test(U.layers))if(Q.isGroup)ba=Q.renderOrder;else if(Q.isLOD)!0===Q.autoUpdate&&Q.update(U);else if(Q.isLight)Xa.pushLight(Q),Q.castShadow&&Xa.pushShadow(Q);else if(Q.isSprite){if(!Q.frustumCulled||Vj.intersectsSprite(Q)){wa&&fe.setFromMatrixPosition(Q.matrixWorld).applyMatrix4(Lg);var Fa=uf.update(Q),Va=Q.material;Va.visible&&Ea.push(Q,Fa,Va, ba,fe.z,null)}}else if(Q.isImmediateRenderObject)wa&&fe.setFromMatrixPosition(Q.matrixWorld).applyMatrix4(Lg),Ea.push(Q,null,Q.material,ba,fe.z,null);else if(Q.isMesh||Q.isLine||Q.isPoints)if(Q.isSkinnedMesh&&Q.skeleton.update(),!Q.frustumCulled||Vj.intersectsObject(Q))if(wa&&fe.setFromMatrixPosition(Q.matrixWorld).applyMatrix4(Lg),Fa=uf.update(Q),Va=Q.material,Array.isArray(Va))for(var Ga=Fa.groups,ab=0,ub=Ga.length;ab<ub;ab++){var ib=Ga[ab],Sa=Va[ib.materialIndex];Sa&&Sa.visible&&Ea.push(Q,Fa,Sa, ba,fe.z,ib)}else Va.visible&&Ea.push(Q,Fa,Va,ba,fe.z,null);Q=Q.children;ab=0;for(ub=Q.length;ab<ub;ab++)L(Q[ab],U,ba,wa)}}function M(Q,U,ba,wa){for(var Fa=0,Va=Q.length;Fa<Va;Fa++){var Ga=Q[Fa],ab=Ga.object,ub=Ga.geometry,ib=void 0===wa?Ga.material:wa;Ga=Ga.group;if(ba.isArrayCamera){nb=ba;for(var Sa=ba.cameras,nd=0,Pc=Sa.length;nd<Pc;nd++){var wf=Sa[nd];ab.layers.test(wf.layers)&&(qb.viewport(Ib.copy(wf.viewport)),Xa.setupLights(wf),R(ab,U,wf,ub,ib,Ga))}}else nb=null,R(ab,U,ba,ub,ib,Ga)}}function R(Q, U,ba,wa,Fa,Va){Q.onBeforeRender(Z,U,ba,wa,Fa,Va);Xa=vf.get(U,nb||ba);Q.modelViewMatrix.multiplyMatrices(ba.matrixWorldInverse,Q.matrixWorld);Q.normalMatrix.getNormalMatrix(Q.modelViewMatrix);Q.isImmediateRenderObject?(qb.setMaterial(Fa),wa=X(ba,U.fog,Fa,Q),$a=d=null,gb=!1,G(Q,wa)):Z.renderBufferDirect(ba,U.fog,wa,Fa,Q,Va);Xa=vf.get(U,nb||ba)}function S(Q,U,ba){var wa=pc.get(Q),Fa=Xa.state.lights,Va=Fa.state.version;ba=Ae.getParameters(Q,Fa.state,Xa.state.shadowsArray,U,Qc.numPlanes,Qc.numIntersection, ba);var Ga=Ae.getProgramCode(Q,ba),ab=wa.program,ub=!0;if(void 0===ab)Q.addEventListener("dispose",w);else if(ab.code!==Ga)C(Q);else{if(wa.lightsStateVersion!==Va)wa.lightsStateVersion=Va;else if(void 0!==ba.shaderID)return;ub=!1}ub&&(ba.shaderID?(Ga=kd[ba.shaderID],wa.shader={name:Q.type,uniforms:Fc(Ga.uniforms),vertexShader:Ga.vertexShader,fragmentShader:Ga.fragmentShader}):wa.shader={name:Q.type,uniforms:Q.uniforms,vertexShader:Q.vertexShader,fragmentShader:Q.fragmentShader},Ga=Ae.getProgramCode(Q, ba),ab=Ae.acquireProgram(Q,wa.shader,ba,Ga),wa.program=ab,Q.program=ab);ba=ab.getAttributes();if(Q.morphTargets)for(Ga=Q.numSupportedMorphTargets=0;Ga<Z.maxMorphTargets;Ga++)0<=ba["morphTarget"+Ga]&&Q.numSupportedMorphTargets++;if(Q.morphNormals)for(Ga=Q.numSupportedMorphNormals=0;Ga<Z.maxMorphNormals;Ga++)0<=ba["morphNormal"+Ga]&&Q.numSupportedMorphNormals++;ba=wa.shader.uniforms;if(!Q.isShaderMaterial&&!Q.isRawShaderMaterial||!0===Q.clipping)wa.numClippingPlanes=Qc.numPlanes,wa.numIntersection= Qc.numIntersection,ba.clippingPlanes=Qc.uniform;wa.fog=U;wa.lightsStateVersion=Va;Q.lights&&(ba.ambientLightColor.value=Fa.state.ambient,ba.lightProbe.value=Fa.state.probe,ba.directionalLights.value=Fa.state.directional,ba.spotLights.value=Fa.state.spot,ba.rectAreaLights.value=Fa.state.rectArea,ba.pointLights.value=Fa.state.point,ba.hemisphereLights.value=Fa.state.hemi,ba.directionalShadowMap.value=Fa.state.directionalShadowMap,ba.directionalShadowMatrix.value=Fa.state.directionalShadowMatrix,ba.spotShadowMap.value= Fa.state.spotShadowMap,ba.spotShadowMatrix.value=Fa.state.spotShadowMatrix,ba.pointShadowMap.value=Fa.state.pointShadowMap,ba.pointShadowMatrix.value=Fa.state.pointShadowMatrix);Q=wa.program.getUniforms();Q=ae.seqWithValue(Q.seq,ba);wa.uniformsList=Q}function X(Q,U,ba,wa){md.resetTextureUnits();var Fa=pc.get(ba),Va=Xa.state.lights;di&&(Wj||Q!==jb)&&Qc.setState(ba.clippingPlanes,ba.clipIntersection,ba.clipShadows,Q,Fa,Q===jb&&ba.id===Ha);!1===ba.needsUpdate&&(void 0===Fa.program?ba.needsUpdate=!0: ba.fog&&Fa.fog!==U?ba.needsUpdate=!0:ba.lights&&Fa.lightsStateVersion!==Va.state.version?ba.needsUpdate=!0:void 0===Fa.numClippingPlanes||Fa.numClippingPlanes===Qc.numPlanes&&Fa.numIntersection===Qc.numIntersection||(ba.needsUpdate=!0));ba.needsUpdate&&(S(ba,U,wa),ba.needsUpdate=!1);var Ga=!1,ab=Va=!1,ub=Fa.program,ib=ub.getUniforms(),Sa=Fa.shader.uniforms;qb.useProgram(ub.program)&&(ab=Va=Ga=!0);ba.id!==Ha&&(Ha=ba.id,Va=!0);if(Ga||jb!==Q){ib.setValue(Ia,"projectionMatrix",Q.projectionMatrix);oc.logarithmicDepthBuffer&& ib.setValue(Ia,"logDepthBufFC",2/(Math.log(Q.far+1)/Math.LN2));jb!==Q&&(jb=Q,ab=Va=!0);if(ba.isShaderMaterial||ba.isMeshPhongMaterial||ba.isMeshStandardMaterial||ba.envMap)Ga=ib.map.cameraPosition,void 0!==Ga&&Ga.setValue(Ia,fe.setFromMatrixPosition(Q.matrixWorld));(ba.isMeshPhongMaterial||ba.isMeshLambertMaterial||ba.isMeshBasicMaterial||ba.isMeshStandardMaterial||ba.isShaderMaterial||ba.skinning)&&ib.setValue(Ia,"viewMatrix",Q.matrixWorldInverse)}if(ba.skinning&&(ib.setOptional(Ia,wa,"bindMatrix"), ib.setOptional(Ia,wa,"bindMatrixInverse"),Q=wa.skeleton))if(Ga=Q.bones,oc.floatVertexTextures){if(void 0===Q.boneTexture){Ga=Math.sqrt(4*Ga.length);Ga=bb.ceilPowerOfTwo(Ga);Ga=Math.max(Ga,4);var nd=new Float32Array(Ga*Ga*4);nd.set(Q.boneMatrices);var Pc=new mc(nd,Ga,Ga,1023,1015);Pc.needsUpdate=!0;Q.boneMatrices=nd;Q.boneTexture=Pc;Q.boneTextureSize=Ga}ib.setValue(Ia,"boneTexture",Q.boneTexture,md);ib.setValue(Ia,"boneTextureSize",Q.boneTextureSize)}else ib.setOptional(Ia,Q,"boneMatrices");Va&&(ib.setValue(Ia, "toneMappingExposure",Z.toneMappingExposure),ib.setValue(Ia,"toneMappingWhitePoint",Z.toneMappingWhitePoint),ba.lights&&ob(Sa,ab),U&&ba.fog&&fa(Sa,U),ba.isMeshBasicMaterial?W(Sa,ba):ba.isMeshLambertMaterial?(W(Sa,ba),la(Sa,ba)):ba.isMeshPhongMaterial?(W(Sa,ba),ba.isMeshToonMaterial?Ka(Sa,ba):qa(Sa,ba)):ba.isMeshStandardMaterial?(W(Sa,ba),ba.isMeshPhysicalMaterial?ra(Sa,ba):La(Sa,ba)):ba.isMeshMatcapMaterial?(W(Sa,ba),ua(Sa,ba)):ba.isMeshDepthMaterial?(W(Sa,ba),sa(Sa,ba)):ba.isMeshDistanceMaterial? (W(Sa,ba),Ca(Sa,ba)):ba.isMeshNormalMaterial?(W(Sa,ba),Za(Sa,ba)):ba.isLineBasicMaterial?(ja(Sa,ba),ba.isLineDashedMaterial&&ha(Sa,ba)):ba.isPointsMaterial?ia(Sa,ba):ba.isSpriteMaterial?ma(Sa,ba):ba.isShadowMaterial&&(Sa.color.value.copy(ba.color),Sa.opacity.value=ba.opacity),void 0!==Sa.ltc_1&&(Sa.ltc_1.value=Na.LTC_1),void 0!==Sa.ltc_2&&(Sa.ltc_2.value=Na.LTC_2),ae.upload(Ia,Fa.uniformsList,Sa,md));ba.isShaderMaterial&&!0===ba.uniformsNeedUpdate&&(ae.upload(Ia,Fa.uniformsList,Sa,md),ba.uniformsNeedUpdate= !1);ba.isSpriteMaterial&&ib.setValue(Ia,"center",wa.center);ib.setValue(Ia,"modelViewMatrix",wa.modelViewMatrix);ib.setValue(Ia,"normalMatrix",wa.normalMatrix);ib.setValue(Ia,"modelMatrix",wa.matrixWorld);return ub}function W(Q,U){Q.opacity.value=U.opacity;U.color&&Q.diffuse.value.copy(U.color);U.emissive&&Q.emissive.value.copy(U.emissive).multiplyScalar(U.emissiveIntensity);U.map&&(Q.map.value=U.map);U.alphaMap&&(Q.alphaMap.value=U.alphaMap);U.specularMap&&(Q.specularMap.value=U.specularMap);U.envMap&& (Q.envMap.value=U.envMap,Q.flipEnvMap.value=U.envMap.isCubeTexture?-1:1,Q.reflectivity.value=U.reflectivity,Q.refractionRatio.value=U.refractionRatio,Q.maxMipLevel.value=pc.get(U.envMap).__maxMipLevel);U.lightMap&&(Q.lightMap.value=U.lightMap,Q.lightMapIntensity.value=U.lightMapIntensity);U.aoMap&&(Q.aoMap.value=U.aoMap,Q.aoMapIntensity.value=U.aoMapIntensity);if(U.map)var ba=U.map;else U.specularMap?ba=U.specularMap:U.displacementMap?ba=U.displacementMap:U.normalMap?ba=U.normalMap:U.bumpMap?ba=U.bumpMap: U.roughnessMap?ba=U.roughnessMap:U.metalnessMap?ba=U.metalnessMap:U.alphaMap?ba=U.alphaMap:U.emissiveMap&&(ba=U.emissiveMap);void 0!==ba&&(ba.isWebGLRenderTarget&&(ba=ba.texture),!0===ba.matrixAutoUpdate&&ba.updateMatrix(),Q.uvTransform.value.copy(ba.matrix))}function ja(Q,U){Q.diffuse.value.copy(U.color);Q.opacity.value=U.opacity}function ha(Q,U){Q.dashSize.value=U.dashSize;Q.totalSize.value=U.dashSize+U.gapSize;Q.scale.value=U.scale}function ia(Q,U){Q.diffuse.value.copy(U.color);Q.opacity.value= U.opacity;Q.size.value=U.size*nc;Q.scale.value=.5*Rc;Q.map.value=U.map;null!==U.map&&(!0===U.map.matrixAutoUpdate&&U.map.updateMatrix(),Q.uvTransform.value.copy(U.map.matrix))}function ma(Q,U){Q.diffuse.value.copy(U.color);Q.opacity.value=U.opacity;Q.rotation.value=U.rotation;Q.map.value=U.map;null!==U.map&&(!0===U.map.matrixAutoUpdate&&U.map.updateMatrix(),Q.uvTransform.value.copy(U.map.matrix))}function fa(Q,U){Q.fogColor.value.copy(U.color);U.isFog?(Q.fogNear.value=U.near,Q.fogFar.value=U.far): U.isFogExp2&&(Q.fogDensity.value=U.density)}function la(Q,U){U.emissiveMap&&(Q.emissiveMap.value=U.emissiveMap)}function qa(Q,U){Q.specular.value.copy(U.specular);Q.shininess.value=Math.max(U.shininess,1E-4);U.emissiveMap&&(Q.emissiveMap.value=U.emissiveMap);U.bumpMap&&(Q.bumpMap.value=U.bumpMap,Q.bumpScale.value=U.bumpScale,1===U.side&&(Q.bumpScale.value*=-1));U.normalMap&&(Q.normalMap.value=U.normalMap,Q.normalScale.value.copy(U.normalScale),1===U.side&&Q.normalScale.value.negate());U.displacementMap&& (Q.displacementMap.value=U.displacementMap,Q.displacementScale.value=U.displacementScale,Q.displacementBias.value=U.displacementBias)}function Ka(Q,U){qa(Q,U);U.gradientMap&&(Q.gradientMap.value=U.gradientMap)}function La(Q,U){Q.roughness.value=U.roughness;Q.metalness.value=U.metalness;U.roughnessMap&&(Q.roughnessMap.value=U.roughnessMap);U.metalnessMap&&(Q.metalnessMap.value=U.metalnessMap);U.emissiveMap&&(Q.emissiveMap.value=U.emissiveMap);U.bumpMap&&(Q.bumpMap.value=U.bumpMap,Q.bumpScale.value= U.bumpScale,1===U.side&&(Q.bumpScale.value*=-1));U.normalMap&&(Q.normalMap.value=U.normalMap,Q.normalScale.value.copy(U.normalScale),1===U.side&&Q.normalScale.value.negate());U.displacementMap&&(Q.displacementMap.value=U.displacementMap,Q.displacementScale.value=U.displacementScale,Q.displacementBias.value=U.displacementBias);U.envMap&&(Q.envMapIntensity.value=U.envMapIntensity)}function ra(Q,U){La(Q,U);Q.reflectivity.value=U.reflectivity;Q.clearcoat.value=U.clearcoat;Q.clearcoatRoughness.value=U.clearcoatRoughness; U.sheen&&Q.sheen.value.copy(U.sheen);U.clearcoatNormalMap&&(Q.clearcoatNormalScale.value.copy(U.clearcoatNormalScale),Q.clearcoatNormalMap.value=U.clearcoatNormalMap,1===U.side&&Q.clearcoatNormalScale.value.negate());Q.transparency.value=U.transparency}function ua(Q,U){U.matcap&&(Q.matcap.value=U.matcap);U.bumpMap&&(Q.bumpMap.value=U.bumpMap,Q.bumpScale.value=U.bumpScale,1===U.side&&(Q.bumpScale.value*=-1));U.normalMap&&(Q.normalMap.value=U.normalMap,Q.normalScale.value.copy(U.normalScale),1===U.side&& Q.normalScale.value.negate());U.displacementMap&&(Q.displacementMap.value=U.displacementMap,Q.displacementScale.value=U.displacementScale,Q.displacementBias.value=U.displacementBias)}function sa(Q,U){U.displacementMap&&(Q.displacementMap.value=U.displacementMap,Q.displacementScale.value=U.displacementScale,Q.displacementBias.value=U.displacementBias)}function Ca(Q,U){U.displacementMap&&(Q.displacementMap.value=U.displacementMap,Q.displacementScale.value=U.displacementScale,Q.displacementBias.value= U.displacementBias);Q.referencePosition.value.copy(U.referencePosition);Q.nearDistance.value=U.nearDistance;Q.farDistance.value=U.farDistance}function Za(Q,U){U.bumpMap&&(Q.bumpMap.value=U.bumpMap,Q.bumpScale.value=U.bumpScale,1===U.side&&(Q.bumpScale.value*=-1));U.normalMap&&(Q.normalMap.value=U.normalMap,Q.normalScale.value.copy(U.normalScale),1===U.side&&Q.normalScale.value.negate());U.displacementMap&&(Q.displacementMap.value=U.displacementMap,Q.displacementScale.value=U.displacementScale,Q.displacementBias.value= U.displacementBias)}function ob(Q,U){Q.ambientLightColor.needsUpdate=U;Q.lightProbe.needsUpdate=U;Q.directionalLights.needsUpdate=U;Q.pointLights.needsUpdate=U;Q.spotLights.needsUpdate=U;Q.rectAreaLights.needsUpdate=U;Q.hemisphereLights.needsUpdate=U}a=a||{};var za=void 0!==a.canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),Wa=void 0!==a.context?a.context:null,db=void 0!==a.alpha?a.alpha:!1,zb=void 0!==a.depth?a.depth:!0,pb=void 0!==a.stencil?a.stencil:!0,Y=void 0!== a.antialias?a.antialias:!1,ca=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,xa=void 0!==a.powerPreference?a.powerPreference:"default",Qa=void 0!==a.failIfMajorPerformanceCaveat?a.failIfMajorPerformanceCaveat:!1,Ea=null,Xa=null;this.domElement=za;this.debug={checkShaderErrors:!0};this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor= 2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var Z=this,ta=!1,Aa=null,hb=0,Ma=0,cb=null,eb=null,Ha=-1;var $a=d=null;var gb=!1;var jb=null,nb=null,Ib=new m,Zb=new m,yc=null,od=za.width,Rc=za.height,nc=1,sf=new m(0,0,od,Rc),rf=new m(0,0,od,Rc),Xj=!1,Vj=new Gc,Qc=new Oc,di=!1,Wj=!1,Lg=new t,fe=new k;try{db={alpha:db,depth:zb,stencil:pb,antialias:Y,premultipliedAlpha:ca, preserveDrawingBuffer:oa,powerPreference:xa,failIfMajorPerformanceCaveat:Qa,xrCompatible:!0};za.addEventListener("webglcontextlost",r,!1);za.addEventListener("webglcontextrestored",u,!1);var Ia=Wa||za.getContext("webgl",db)||za.getContext("experimental-webgl",db);if(null===Ia){if(null!==za.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.");}void 0===Ia.getShaderPrecisionFormat&&(Ia.getShaderPrecisionFormat=function(){return{rangeMin:1, rangeMax:1,precision:1}})}catch(Q){throw console.error("THREE.WebGLRenderer: "+Q.message),Q;}var Lb,oc,qb,de,pc,md,bi,Uj,uf,Ae,ci,vf,ee,an,bn,cn,ld;h();var Dd="undefined"!==typeof navigator&&"xr"in navigator&&"supportsSession"in navigator.xr?new $m(Z,Ia):new Sj(Z);this.vr=Dd;var dn=new Vm(Z,uf,oc.maxTextureSize);this.shadowMap=dn;this.getContext=function(){return Ia};this.getContextAttributes=function(){return Ia.getContextAttributes()};this.forceContextLoss=function(){var Q=Lb.get("WEBGL_lose_context"); Q&&Q.loseContext()};this.forceContextRestore=function(){var Q=Lb.get("WEBGL_lose_context");Q&&Q.restoreContext()};this.getPixelRatio=function(){return nc};this.setPixelRatio=function(){var Q=window.devicePixelRatio;void 0!==Q&&(nc=Q,this.setSize(od,Rc,!1))};this.getSize=function(Q){void 0===Q&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),Q=new e);return Q.set(od,Rc)};this.setSize=function(Q,U,ba){Dd.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."): (od=Q,Rc=U,za.width=Math.floor(Q*nc),za.height=Math.floor(U*nc),!1!==ba&&(za.style.width=Q+"px",za.style.height=U+"px"),this.setViewport(Q,U))};this.getDrawingBufferSize=function(Q){void 0===Q&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),Q=new e);return Q.set(od*nc,Rc*nc).floor()};this.setDrawingBufferSize=function(Q,U,ba){od=Q;Rc=U;nc=ba;za.width=Math.floor(Q*ba);za.height=Math.floor(U*ba);this.setViewport(Q,U)};this.getCurrentViewport=function(Q){void 0=== Q&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),Q=new m);return Q.copy(Ib)};this.getViewport=function(Q){return Q.copy(sf)};this.setViewport=function(Q,U){(0).isVector4?sf.set((0).x,(0).y,(0).z,(0).w):sf.set(0,0,Q,U);qb.viewport(Ib.copy(sf).multiplyScalar(nc).floor())};this.getScissor=function(Q){return Q.copy(rf)};this.setScissor=function(Q,U,ba,wa){Q.isVector4?rf.set(Q.x,Q.y,Q.z,Q.w):rf.set(Q,U,ba,wa);qb.scissor(Zb.copy(rf).multiplyScalar(nc).floor())}; this.getScissorTest=function(){return Xj};this.setScissorTest=function(Q){qb.setScissorTest(Xj=Q)};this.getClearColor=function(){return ee.getClearColor()};this.setClearColor=function(){ee.setClearColor.apply(ee,arguments)};this.getClearAlpha=function(){return ee.getClearAlpha()};this.setClearAlpha=function(){ee.setClearAlpha.apply(ee,arguments)};this.clear=function(Q,U,ba){var wa=0;if(void 0===Q||Q)wa|=16384;if(void 0===U||U)wa|=256;if(void 0===ba||ba)wa|=1024;Ia.clear(wa)};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.dispose=function(){za.removeEventListener("webglcontextlost",r,!1);za.removeEventListener("webglcontextrestored",u,!1);ci.dispose();vf.dispose();pc.dispose();uf.dispose();Dd.dispose();ei.stop()};this.renderBufferImmediate=function(Q,U){qb.initAttributes();var ba=pc.get(Q);Q.hasPositions&&!ba.position&&(ba.position=Ia.createBuffer());Q.hasNormals&&!ba.normal&&(ba.normal=Ia.createBuffer()); Q.hasUvs&&!ba.uv&&(ba.uv=Ia.createBuffer());Q.hasColors&&!ba.color&&(ba.color=Ia.createBuffer());U=U.getAttributes();Q.hasPositions&&(Ia.bindBuffer(34962,ba.position),Ia.bufferData(34962,Q.positionArray,35048),qb.enableAttribute(U.position),Ia.vertexAttribPointer(U.position,3,5126,!1,0,0));Q.hasNormals&&(Ia.bindBuffer(34962,ba.normal),Ia.bufferData(34962,Q.normalArray,35048),qb.enableAttribute(U.normal),Ia.vertexAttribPointer(U.normal,3,5126,!1,0,0));Q.hasUvs&&(Ia.bindBuffer(34962,ba.uv),Ia.bufferData(34962, Q.uvArray,35048),qb.enableAttribute(U.uv),Ia.vertexAttribPointer(U.uv,2,5126,!1,0,0));Q.hasColors&&(Ia.bindBuffer(34962,ba.color),Ia.bufferData(34962,Q.colorArray,35048),qb.enableAttribute(U.color),Ia.vertexAttribPointer(U.color,3,5126,!1,0,0));qb.disableUnusedAttributes();Ia.drawArrays(4,0,Q.count);Q.count=0};this.renderBufferDirect=function(Q,U,ba,wa,Fa,Va){qb.setMaterial(wa,Fa.isMesh&&0>Fa.matrixWorld.determinant());var Ga=X(Q,U,wa,Fa),ab=!1;if(d!==ba.id||$a!==Ga.id||gb!==(!0===wa.wireframe))d= ba.id,$a=Ga.id,gb=!0===wa.wireframe,ab=!0;Fa.morphTargetInfluences&&(an.update(Fa,ba,wa,Ga),ab=!0);var ub=ba.index,ib=ba.attributes.position;U=1;!0===wa.wireframe&&(ub=Uj.getWireframeAttribute(ba),U=2);Q=bn;if(null!==ub){var Sa=bi.get(ub);Q=cn;Q.setIndex(Sa)}ab&&(K(wa,Ga,ba),null!==ub&&Ia.bindBuffer(34963,Sa.buffer));Sa=Infinity;null!==ub?Sa=ub.count:void 0!==ib&&(Sa=ib.count);ib=ba.drawRange.start*U;Ga=null!==Va?Va.start*U:0;ub=Math.max(ib,Ga);Va=Math.max(0,Math.min(Sa,ib+ba.drawRange.count*U,Ga+ (null!==Va?Va.count*U:Infinity))-1-ub+1);if(0!==Va){if(Fa.isMesh)if(!0===wa.wireframe)qb.setLineWidth(wa.wireframeLinewidth*f()),Q.setMode(1);else switch(Fa.drawMode){case 0:Q.setMode(4);break;case 1:Q.setMode(5);break;case 2:Q.setMode(6)}else Fa.isLine?(wa=wa.linewidth,void 0===wa&&(wa=1),qb.setLineWidth(wa*f()),Fa.isLineSegments?Q.setMode(1):Fa.isLineLoop?Q.setMode(2):Q.setMode(3)):Fa.isPoints?Q.setMode(0):Fa.isSprite&&Q.setMode(4);ba&&ba.isInstancedBufferGeometry?0<ba.maxInstancedCount&&Q.renderInstances(ba, ub,Va):Q.render(ub,Va)}};this.compile=function(Q,U){Xa=vf.get(Q,U);Xa.init();Q.traverse(function(ba){ba.isLight&&(Xa.pushLight(ba),ba.castShadow&&Xa.pushShadow(ba))});Xa.setupLights(U);Q.traverse(function(ba){if(ba.material)if(Array.isArray(ba.material))for(var wa=0;wa<ba.material.length;wa++)S(ba.material[wa],Q.fog,ba);else S(ba.material,Q.fog,ba)})};var Yj=null,ei=new id;ei.setAnimationLoop(function(Q){Dd.isPresenting()||Yj&&Yj(Q)});"undefined"!==typeof window&&ei.setContext(window);this.setAnimationLoop= function(Q){Yj=Q;Dd.setAnimationLoop(Q);ei.start()};this.render=function(Q,U,ba,wa){if(void 0!==ba){console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.");var Fa=ba}if(void 0!==wa){console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.");var Va=wa}U&&U.isCamera?ta||($a=d=null,gb=!1,Ha=-1,jb=null,!0===Q.autoUpdate&&Q.updateMatrixWorld(),null===U.parent&&U.updateMatrixWorld(),Dd.enabled&& (U=Dd.getCamera(U)),Xa=vf.get(Q,U),Xa.init(),Q.onBeforeRender(Z,Q,U,Fa||cb),Lg.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Vj.setFromMatrix(Lg),Wj=this.localClippingEnabled,di=Qc.init(this.clippingPlanes,Wj,U),Ea=ci.get(Q,U),Ea.init(),L(Q,U,0,Z.sortObjects),!0===Z.sortObjects&&Ea.sort(),di&&Qc.beginShadows(),dn.render(Xa.state.shadowsArray,Q,U),Xa.setupLights(U),di&&Qc.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==Fa&&this.setRenderTarget(Fa),ee.render(Ea,Q,U,Va),ba=Ea.opaque, wa=Ea.transparent,Q.overrideMaterial?(Fa=Q.overrideMaterial,ba.length&&M(ba,Q,U,Fa),wa.length&&M(wa,Q,U,Fa)):(ba.length&&M(ba,Q,U),wa.length&&M(wa,Q,U)),null!==cb&&(md.updateRenderTargetMipmap(cb),md.updateMultisampleRenderTarget(cb)),qb.buffers.depth.setTest(!0),qb.buffers.depth.setMask(!0),qb.buffers.color.setMask(!0),qb.setPolygonOffset(!1),Dd.enabled&&Dd.submitFrame(),Xa=Ea=null):console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")};this.setFramebuffer=function(Q){Aa!== Q&&Ia.bindFramebuffer(36160,Q);Aa=Q};this.getActiveCubeFace=function(){return hb};this.getActiveMipmapLevel=function(){return Ma};this.getRenderTarget=function(){return cb};this.setRenderTarget=function(Q,U,ba){cb=Q;hb=U;Ma=ba;Q&&void 0===pc.get(Q).__webglFramebuffer&&md.setupRenderTarget(Q);var wa=Aa,Fa=!1;Q?(wa=pc.get(Q).__webglFramebuffer,Q.isWebGLRenderTargetCube?(wa=wa[U||0],Fa=!0):wa=Q.isWebGLMultisampleRenderTarget?pc.get(Q).__webglMultisampledFramebuffer:wa,Ib.copy(Q.viewport),Zb.copy(Q.scissor), yc=Q.scissorTest):(Ib.copy(sf).multiplyScalar(nc).floor(),Zb.copy(rf).multiplyScalar(nc).floor(),yc=Xj);eb!==wa&&(Ia.bindFramebuffer(36160,wa),eb=wa);qb.viewport(Ib);qb.scissor(Zb);qb.setScissorTest(yc);Fa&&(Q=pc.get(Q.texture),Ia.framebufferTexture2D(36160,36064,34069+(U||0),Q.__webglTexture,ba||0))};this.readRenderTargetPixels=function(Q,U,ba,wa,Fa,Va,Ga){if(Q&&Q.isWebGLRenderTarget){var ab=pc.get(Q).__webglFramebuffer;Q.isWebGLRenderTargetCube&&void 0!==Ga&&(ab=ab[Ga]);if(ab){Ga=!1;ab!==eb&&(Ia.bindFramebuffer(36160, ab),Ga=!0);try{var ub=Q.texture,ib=ub.format,Sa=ub.type;1023!==ib&&ld.convert(ib)!==Ia.getParameter(35739)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===Sa||ld.convert(Sa)===Ia.getParameter(35738)||1015===Sa&&(oc.isWebGL2||Lb.get("OES_texture_float")||Lb.get("WEBGL_color_buffer_float"))||1016===Sa&&(oc.isWebGL2?Lb.get("EXT_color_buffer_float"):Lb.get("EXT_color_buffer_half_float"))?36053===Ia.checkFramebufferStatus(36160)? 0<=U&&U<=Q.width-wa&&0<=ba&&ba<=Q.height-Fa&&Ia.readPixels(U,ba,wa,Fa,ld.convert(ib),ld.convert(Sa),Va):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{Ga&&Ia.bindFramebuffer(36160,eb)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}; this.copyFramebufferToTexture=function(Q,U,ba){var wa=U.image.width,Fa=U.image.height,Va=ld.convert(U.format);md.setTexture2D(U,0);Ia.copyTexImage2D(3553,ba||0,Va,Q.x,Q.y,wa,Fa,0)};this.copyTextureToTexture=function(Q,U,ba,wa){var Fa=U.image.width,Va=U.image.height,Ga=ld.convert(ba.format),ab=ld.convert(ba.type);md.setTexture2D(ba,0);U.isDataTexture?Ia.texSubImage2D(3553,wa||0,Q.x,Q.y,Fa,Va,Ga,ab,U.image.data):Ia.texSubImage2D(3553,wa||0,Q.x,Q.y,Ga,ab,U.image)};"undefined"!==typeof __THREE_DEVTOOLS__&& __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function fi(a,d){this.name="";this.color=new J(a);this.density=void 0!==d?d:2.5E-4}function gi(a,d,f){this.name="";this.color=new J(a);this.near=void 0!==d?d:1;this.far=void 0!==f?f:1E3}function Be(a,d){this.array=a;this.stride=d;this.count=void 0!==a?a.length/d:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function Mg(a,d,f,h){this.data=a;this.itemSize=d;this.offset=f;this.normalized=!0===h}function ge(a){T.call(this); this.type="SpriteMaterial";this.color=new J(16777215);this.map=null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(a)}function Ng(a){y.call(this);this.type="Sprite";if(void 0===xf){xf=new Ba;var d=new Be(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);xf.setIndex([0,1,2,0,2,3]);xf.addAttribute("position",new Mg(d,3,0,!1));xf.addAttribute("uv",new Mg(d,2,3,!1))}this.geometry=xf;this.material=void 0!==a?a:new ge;this.center=new e(.5, .5)}function hi(a,d,f,h,r,u){yf.subVectors(a,f).addScalar(.5).multiply(h);void 0!==r?(Og.x=u*yf.x-r*yf.y,Og.y=r*yf.x+u*yf.y):Og.copy(yf);a.copy(d);a.x+=Og.x;a.y+=Og.y;a.applyMatrix4(en)}function Pg(){y.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}});this.autoUpdate=!0}function Qg(a,d){a&&a.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");Nb.call(this,a,d);this.type="SkinnedMesh";this.bindMode= "attached";this.bindMatrix=new t;this.bindMatrixInverse=new t}function ii(a,d){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===d)this.calculateInverses();else if(this.bones.length===d.length)this.boneInverses=d.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],a=0,d=this.bones.length;a<d;a++)this.boneInverses.push(new t)}function Zj(){y.call(this);this.type="Bone"}function Bb(a){T.call(this);this.type= "LineBasicMaterial";this.color=new J(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.lights=!1;this.setValues(a)}function dc(a,d,f){1===f&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");y.call(this);this.type="Line";this.geometry=void 0!==a?a:new Ba;this.material=void 0!==d?d:new Bb({color:16777215*Math.random()})}function Eb(a,d){dc.call(this,a,d);this.type="LineSegments"}function ji(a,d){dc.call(this,a,d);this.type= "LineLoop"}function Sc(a){T.call(this);this.type="PointsMaterial";this.color=new J(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=this.morphTargets=!1;this.setValues(a)}function zf(a,d){y.call(this);this.type="Points";this.geometry=void 0!==a?a:new Ba;this.material=void 0!==d?d:new Sc({color:16777215*Math.random()});this.updateMorphTargets()}function ak(a,d,f,h,r,u,w){var B=bk.distanceSqToPoint(a);B<f&&(f=new k,bk.closestPointToPoint(a,f),f.applyMatrix4(h),a=r.ray.origin.distanceTo(f), a<r.near||a>r.far||u.push({distance:a,distanceToRay:Math.sqrt(B),point:f,index:d,face:null,object:w}))}function ck(a,d,f,h,r,u,w,B,C){l.call(this,a,d,f,h,r,u,w,B,C);this.format=void 0!==w?w:1022;this.minFilter=void 0!==u?u:1006;this.magFilter=void 0!==r?r:1006;this.generateMipmaps=!1}function Af(a,d,f,h,r,u,w,B,C,G,K,L){l.call(this,null,u,w,B,C,G,h,r,K,L);this.image={width:d,height:f};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Rg(a,d,f,h,r,u,w,B,C){l.call(this,a,d,f,h,r,u,w,B,C);this.needsUpdate= !0}function Sg(a,d,f,h,r,u,w,B,C,G){G=void 0!==G?G:1026;if(1026!==G&&1027!==G)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===f&&1026===G&&(f=1012);void 0===f&&1027===G&&(f=1020);l.call(this,null,h,r,u,w,B,G,f,C);this.image={width:a,height:d};this.magFilter=void 0!==w?w:1003;this.minFilter=void 0!==B?B:1003;this.generateMipmaps=this.flipY=!1}function Bf(a){Ba.call(this);this.type="WireframeGeometry";var d=[],f,h,r,u=[0,0],w={},B=["a","b","c"]; if(a&&a.isGeometry){var C=a.faces;var G=0;for(h=C.length;G<h;G++){var K=C[G];for(f=0;3>f;f++){var L=K[B[f]];var M=K[B[(f+1)%3]];u[0]=Math.min(L,M);u[1]=Math.max(L,M);L=u[0]+","+u[1];void 0===w[L]&&(w[L]={index1:u[0],index2:u[1]})}}for(L in w)G=w[L],B=a.vertices[G.index1],d.push(B.x,B.y,B.z),B=a.vertices[G.index2],d.push(B.x,B.y,B.z)}else if(a&&a.isBufferGeometry)if(B=new k,null!==a.index){C=a.attributes.position;K=a.index;var R=a.groups;0===R.length&&(R=[{start:0,count:K.count,materialIndex:0}]); a=0;for(r=R.length;a<r;++a)for(G=R[a],f=G.start,h=G.count,G=f,h=f+h;G<h;G+=3)for(f=0;3>f;f++)L=K.getX(G+f),M=K.getX(G+(f+1)%3),u[0]=Math.min(L,M),u[1]=Math.max(L,M),L=u[0]+","+u[1],void 0===w[L]&&(w[L]={index1:u[0],index2:u[1]});for(L in w)G=w[L],B.fromBufferAttribute(C,G.index1),d.push(B.x,B.y,B.z),B.fromBufferAttribute(C,G.index2),d.push(B.x,B.y,B.z)}else for(C=a.attributes.position,G=0,h=C.count/3;G<h;G++)for(f=0;3>f;f++)w=3*G+f,B.fromBufferAttribute(C,w),d.push(B.x,B.y,B.z),w=3*G+(f+1)%3,B.fromBufferAttribute(C, w),d.push(B.x,B.y,B.z);this.addAttribute("position",new pa(d,3))}function Tg(a,d,f){Ua.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:d,stacks:f};this.fromBufferGeometry(new Cf(a,d,f));this.mergeVertices()}function Cf(a,d,f){Ba.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:d,stacks:f};var h=[],r=[],u=[],w=[],B=new k,C=new k,G=new k,K=new k,L=new k,M,R;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); var S=d+1;for(M=0;M<=f;M++){var X=M/f;for(R=0;R<=d;R++){var W=R/d;a(W,X,C);r.push(C.x,C.y,C.z);0<=W-1E-5?(a(W-1E-5,X,G),K.subVectors(C,G)):(a(W+1E-5,X,G),K.subVectors(G,C));0<=X-1E-5?(a(W,X-1E-5,G),L.subVectors(C,G)):(a(W,X+1E-5,G),L.subVectors(G,C));B.crossVectors(K,L).normalize();u.push(B.x,B.y,B.z);w.push(W,X)}}for(M=0;M<f;M++)for(R=0;R<d;R++)a=M*S+R+1,B=(M+1)*S+R+1,C=(M+1)*S+R,h.push(M*S+R,a,C),h.push(a,B,C);this.setIndex(h);this.addAttribute("position",new pa(r,3));this.addAttribute("normal", new pa(u,3));this.addAttribute("uv",new pa(w,2))}function Ug(a,d,f,h){Ua.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:d,radius:f,detail:h};this.fromBufferGeometry(new tc(a,d,f,h));this.mergeVertices()}function tc(a,d,f,h){function r(S,X,W,ja){ja=Math.pow(2,ja);var ha=[],ia,ma;for(ia=0;ia<=ja;ia++){ha[ia]=[];var fa=S.clone().lerp(W,ia/ja),la=X.clone().lerp(W,ia/ja),qa=ja-ia;for(ma=0;ma<=qa;ma++)ha[ia][ma]=0===ma&&ia===ja?fa:fa.clone().lerp(la,ma/qa)}for(ia=0;ia<ja;ia++)for(ma= 0;ma<2*(ja-ia)-1;ma++)S=Math.floor(ma/2),0===ma%2?(w(ha[ia][S+1]),w(ha[ia+1][S]),w(ha[ia][S])):(w(ha[ia][S+1]),w(ha[ia+1][S+1]),w(ha[ia+1][S]))}function u(){for(var S=0;S<R.length;S+=6){var X=R[S+0],W=R[S+2],ja=R[S+4],ha=Math.min(X,W,ja);.9<Math.max(X,W,ja)&&.1>ha&&(.2>X&&(R[S+0]+=1),.2>W&&(R[S+2]+=1),.2>ja&&(R[S+4]+=1))}}function w(S){M.push(S.x,S.y,S.z)}function B(S,X){S*=3;X.x=a[S+0];X.y=a[S+1];X.z=a[S+2]}function C(){for(var S=new k,X=new k,W=new k,ja=new k,ha=new e,ia=new e,ma=new e,fa=0,la= 0;fa<M.length;fa+=9,la+=6){S.set(M[fa+0],M[fa+1],M[fa+2]);X.set(M[fa+3],M[fa+4],M[fa+5]);W.set(M[fa+6],M[fa+7],M[fa+8]);ha.set(R[la+0],R[la+1]);ia.set(R[la+2],R[la+3]);ma.set(R[la+4],R[la+5]);ja.copy(S).add(X).add(W).divideScalar(3);var qa=K(ja);G(ha,la+0,S,qa);G(ia,la+2,X,qa);G(ma,la+4,W,qa)}}function G(S,X,W,ja){0>ja&&1===S.x&&(R[X]=S.x-1);0===W.x&&0===W.z&&(R[X]=ja/2/Math.PI+.5)}function K(S){return Math.atan2(S.z,-S.x)}function L(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}Ba.call(this); this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:d,radius:f,detail:h};f=f||1;h=h||0;var M=[],R=[];(function(S){for(var X=new k,W=new k,ja=new k,ha=0;ha<d.length;ha+=3)B(d[ha+0],X),B(d[ha+1],W),B(d[ha+2],ja),r(X,W,ja,S)})(h);(function(S){for(var X=new k,W=0;W<M.length;W+=3)X.x=M[W+0],X.y=M[W+1],X.z=M[W+2],X.normalize().multiplyScalar(S),M[W+0]=X.x,M[W+1]=X.y,M[W+2]=X.z})(f);(function(){for(var S=new k,X=0;X<M.length;X+=3){S.x=M[X+0];S.y=M[X+1];S.z=M[X+2];var W=K(S)/2/Math.PI+ .5,ja=L(S)/Math.PI+.5;R.push(W,1-ja)}C();u()})();this.addAttribute("position",new pa(M,3));this.addAttribute("normal",new pa(M.slice(),3));this.addAttribute("uv",new pa(R,2));0===h?this.computeVertexNormals():this.normalizeNormals()}function Vg(a,d){Ua.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:d};this.fromBufferGeometry(new Df(a,d));this.mergeVertices()}function Df(a,d){tc.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],a,d);this.type="TetrahedronBufferGeometry"; this.parameters={radius:a,detail:d}}function Wg(a,d){Ua.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:d};this.fromBufferGeometry(new Ce(a,d));this.mergeVertices()}function Ce(a,d){tc.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],a,d);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:d}}function Xg(a,d){Ua.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:d};this.fromBufferGeometry(new Ef(a, d));this.mergeVertices()}function Ef(a,d){var f=(1+Math.sqrt(5))/2;tc.call(this,[-1,f,0,1,f,0,-1,-f,0,1,-f,0,0,-1,f,0,1,f,0,-1,-f,0,1,-f,f,0,-1,f,0,1,-f,0,-1,-f,0,1],[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],a,d);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:d}}function Yg(a,d){Ua.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:d};this.fromBufferGeometry(new Ff(a, d));this.mergeVertices()}function Ff(a,d){var f=(1+Math.sqrt(5))/2,h=1/f;tc.call(this,[-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,-h,-f,0,-h,f,0,h,-f,0,h,f,-h,-f,0,-h,f,0,h,-f,0,h,f,0,-f,0,-h,f,0,-h,-f,0,h,f,0,h],[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],a, d);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:d}}function Zg(a,d,f,h,r,u){Ua.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:d,radius:f,radialSegments:h,closed:r};void 0!==u&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new De(a,d,f,h,r);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function De(a,d,f,h,r){function u(ia){M=a.getPointAt(ia/d,M);var ma= C.normals[ia];ia=C.binormals[ia];for(S=0;S<=h;S++){var fa=S/h*Math.PI*2,la=Math.sin(fa);fa=-Math.cos(fa);K.x=fa*ma.x+la*ia.x;K.y=fa*ma.y+la*ia.y;K.z=fa*ma.z+la*ia.z;K.normalize();W.push(K.x,K.y,K.z);G.x=M.x+f*K.x;G.y=M.y+f*K.y;G.z=M.z+f*K.z;X.push(G.x,G.y,G.z)}}function w(){for(S=1;S<=d;S++)for(R=1;R<=h;R++){var ia=(h+1)*S+(R-1),ma=(h+1)*S+R,fa=(h+1)*(S-1)+R;ha.push((h+1)*(S-1)+(R-1),ia,fa);ha.push(ia,ma,fa)}}function B(){for(R=0;R<=d;R++)for(S=0;S<=h;S++)L.x=R/d,L.y=S/h,ja.push(L.x,L.y)}Ba.call(this); this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:d,radius:f,radialSegments:h,closed:r};d=d||64;f=f||1;h=h||8;r=r||!1;var C=a.computeFrenetFrames(d,r);this.tangents=C.tangents;this.normals=C.normals;this.binormals=C.binormals;var G=new k,K=new k,L=new e,M=new k,R,S,X=[],W=[],ja=[],ha=[];(function(){for(R=0;R<d;R++)u(R);u(!1===r?d:0);B();w()})();this.setIndex(ha);this.addAttribute("position",new pa(X,3));this.addAttribute("normal",new pa(W,3));this.addAttribute("uv",new pa(ja, 2))}function $g(a,d,f,h,r,u,w){Ua.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:d,tubularSegments:f,radialSegments:h,p:r,q:u};void 0!==w&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.");this.fromBufferGeometry(new Gf(a,d,f,h,r,u));this.mergeVertices()}function Gf(a,d,f,h,r,u){function w(la,qa,Ka,La,ra){var ua=Math.sin(la);qa=Ka/qa*la;Ka=Math.cos(qa);ra.x=La*(2+Ka)*.5*Math.cos(la);ra.y=La*(2+Ka)*ua*.5;ra.z=La*Math.sin(qa)* .5}Ba.call(this);this.type="TorusKnotBufferGeometry";this.parameters={radius:a,tube:d,tubularSegments:f,radialSegments:h,p:r,q:u};a=a||1;d=d||.4;f=Math.floor(f)||64;h=Math.floor(h)||8;r=r||2;u=u||3;var B=[],C=[],G=[],K=[],L,M=new k,R=new k,S=new k,X=new k,W=new k,ja=new k,ha=new k;for(L=0;L<=f;++L){var ia=L/f*r*Math.PI*2;w(ia,r,u,a,S);w(ia+.01,r,u,a,X);ja.subVectors(X,S);ha.addVectors(X,S);W.crossVectors(ja,ha);ha.crossVectors(W,ja);W.normalize();ha.normalize();for(ia=0;ia<=h;++ia){var ma=ia/h*Math.PI* 2,fa=-d*Math.cos(ma);ma=d*Math.sin(ma);M.x=S.x+(fa*ha.x+ma*W.x);M.y=S.y+(fa*ha.y+ma*W.y);M.z=S.z+(fa*ha.z+ma*W.z);C.push(M.x,M.y,M.z);R.subVectors(M,S).normalize();G.push(R.x,R.y,R.z);K.push(L/f);K.push(ia/h)}}for(ia=1;ia<=f;ia++)for(L=1;L<=h;L++)a=(h+1)*ia+(L-1),d=(h+1)*ia+L,r=(h+1)*(ia-1)+L,B.push((h+1)*(ia-1)+(L-1),a,r),B.push(a,d,r);this.setIndex(B);this.addAttribute("position",new pa(C,3));this.addAttribute("normal",new pa(G,3));this.addAttribute("uv",new pa(K,2))}function ah(a,d,f,h,r){Ua.call(this); this.type="TorusGeometry";this.parameters={radius:a,tube:d,radialSegments:f,tubularSegments:h,arc:r};this.fromBufferGeometry(new Hf(a,d,f,h,r));this.mergeVertices()}function Hf(a,d,f,h,r){Ba.call(this);this.type="TorusBufferGeometry";this.parameters={radius:a,tube:d,radialSegments:f,tubularSegments:h,arc:r};a=a||1;d=d||.4;f=Math.floor(f)||8;h=Math.floor(h)||6;r=r||2*Math.PI;var u=[],w=[],B=[],C=[],G=new k,K=new k,L=new k,M,R;for(M=0;M<=f;M++)for(R=0;R<=h;R++){var S=R/h*r,X=M/f*Math.PI*2;K.x=(a+d* Math.cos(X))*Math.cos(S);K.y=(a+d*Math.cos(X))*Math.sin(S);K.z=d*Math.sin(X);w.push(K.x,K.y,K.z);G.x=a*Math.cos(S);G.y=a*Math.sin(S);L.subVectors(K,G).normalize();B.push(L.x,L.y,L.z);C.push(R/h);C.push(M/f)}for(M=1;M<=f;M++)for(R=1;R<=h;R++)a=(h+1)*(M-1)+R-1,d=(h+1)*(M-1)+R,r=(h+1)*M+R,u.push((h+1)*M+R-1,a,r),u.push(a,d,r);this.setIndex(u);this.addAttribute("position",new pa(w,3));this.addAttribute("normal",new pa(B,3));this.addAttribute("uv",new pa(C,2))}function fn(a,d,f,h,r){if(r===0<jr(a,d,f, h))for(r=d;r<f;r+=h)var u=gn(r,a[r],a[r+1],u);else for(r=f-h;r>=d;r-=h)u=gn(r,a[r],a[r+1],u);u&&Ee(u,u.next)&&(bh(u),u=u.next);return u}function ch(a,d){if(!a)return a;d||(d=a);do{var f=!1;if(a.steiner||!Ee(a,a.next)&&0!==ec(a.prev,a,a.next))a=a.next;else{bh(a);a=d=a.prev;if(a===a.next)break;f=!0}}while(f||a!==d);return d}function dh(a,d,f,h,r,u,w){if(a){!w&&u&&kr(a,h,r,u);for(var B=a,C,G;a.prev!==a.next;)if(C=a.prev,G=a.next,u?lr(a,h,r,u):mr(a))d.push(C.i/f),d.push(a.i/f),d.push(G.i/f),bh(a),B=a= G.next;else if(a=G,a===B){w?1===w?(a=nr(a,d,f),dh(a,d,f,h,r,u,2)):2===w&&or(a,d,f,h,r,u):dh(ch(a),d,f,h,r,u,1);break}}}function mr(a){var d=a.prev,f=a.next;if(0<=ec(d,a,f))return!1;for(var h=a.next.next;h!==a.prev;){if(If(d.x,d.y,a.x,a.y,f.x,f.y,h.x,h.y)&&0<=ec(h.prev,h,h.next))return!1;h=h.next}return!0}function lr(a,d,f,h){var r=a.prev,u=a.next;if(0<=ec(r,a,u))return!1;var w=r.x>a.x?r.x>u.x?r.x:u.x:a.x>u.x?a.x:u.x,B=r.y>a.y?r.y>u.y?r.y:u.y:a.y>u.y?a.y:u.y,C=dk(r.x<a.x?r.x<u.x?r.x:u.x:a.x<u.x?a.x: u.x,r.y<a.y?r.y<u.y?r.y:u.y:a.y<u.y?a.y:u.y,d,f,h);d=dk(w,B,d,f,h);f=a.prevZ;for(h=a.nextZ;f&&f.z>=C&&h&&h.z<=d;){if(f!==a.prev&&f!==a.next&&If(r.x,r.y,a.x,a.y,u.x,u.y,f.x,f.y)&&0<=ec(f.prev,f,f.next))return!1;f=f.prevZ;if(h!==a.prev&&h!==a.next&&If(r.x,r.y,a.x,a.y,u.x,u.y,h.x,h.y)&&0<=ec(h.prev,h,h.next))return!1;h=h.nextZ}for(;f&&f.z>=C;){if(f!==a.prev&&f!==a.next&&If(r.x,r.y,a.x,a.y,u.x,u.y,f.x,f.y)&&0<=ec(f.prev,f,f.next))return!1;f=f.prevZ}for(;h&&h.z<=d;){if(h!==a.prev&&h!==a.next&&If(r.x,r.y, a.x,a.y,u.x,u.y,h.x,h.y)&&0<=ec(h.prev,h,h.next))return!1;h=h.nextZ}return!0}function nr(a,d,f){var h=a;do{var r=h.prev,u=h.next.next;!Ee(r,u)&&hn(r,h,h.next,u)&&eh(r,u)&&eh(u,r)&&(d.push(r.i/f),d.push(h.i/f),d.push(u.i/f),bh(h),bh(h.next),h=a=u);h=h.next}while(h!==a);return h}function or(a,d,f,h,r,u){var w=a;do{for(var B=w.next.next;B!==w.prev;){if(w.i!==B.i&&pr(w,B)){a=jn(w,B);w=ch(w,w.next);a=ch(a,a.next);dh(w,d,f,h,r,u);dh(a,d,f,h,r,u);return}B=B.next}w=w.next}while(w!==a)}function qr(a,d,f,h){var r= [],u;var w=0;for(u=d.length;w<u;w++){var B=d[w]*h;var C=w<u-1?d[w+1]*h:a.length;B=fn(a,B,C,h,!1);B===B.next&&(B.steiner=!0);r.push(rr(B))}r.sort(sr);for(w=0;w<r.length;w++)tr(r[w],f),f=ch(f,f.next);return f}function sr(a,d){return a.x-d.x}function tr(a,d){if(d=ur(a,d))a=jn(d,a),ch(a,a.next)}function ur(a,d){var f=d,h=a.x,r=a.y,u=-Infinity;do{if(r<=f.y&&r>=f.next.y&&f.next.y!==f.y){var w=f.x+(r-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(w<=h&&w>u){u=w;if(w===h){if(r===f.y)return f;if(r===f.next.y)return f.next}var B= f.x<f.next.x?f:f.next}}f=f.next}while(f!==d);if(!B)return null;if(h===u)return B.prev;d=B;w=B.x;var C=B.y,G=Infinity;for(f=B.next;f!==d;){if(h>=f.x&&f.x>=w&&h!==f.x&&If(r<C?h:u,r,w,C,r<C?u:h,r,f.x,f.y)){var K=Math.abs(r-f.y)/(h-f.x);(K<G||K===G&&f.x>B.x)&&eh(f,a)&&(B=f,G=K)}f=f.next}return B}function kr(a,d,f,h){var r=a;do null===r.z&&(r.z=dk(r.x,r.y,d,f,h)),r.prevZ=r.prev,r=r.nextZ=r.next;while(r!==a);r.prevZ.nextZ=null;r.prevZ=null;vr(r)}function vr(a){var d,f,h,r,u=1;do{var w=a;var B=a=null;for(f= 0;w;){f++;var C=w;for(d=h=0;d<u&&(h++,C=C.nextZ,C);d++);for(r=u;0<h||0<r&&C;)0!==h&&(0===r||!C||w.z<=C.z)?(d=w,w=w.nextZ,h--):(d=C,C=C.nextZ,r--),B?B.nextZ=d:a=d,d.prevZ=B,B=d;w=C}B.nextZ=null;u*=2}while(1<f);return a}function dk(a,d,f,h,r){a=32767*(a-f)*r;d=32767*(d-h)*r;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;d=(d|d<<8)&16711935;d=(d|d<<4)&252645135;d=(d|d<<2)&858993459;return(a|a<<1)&1431655765|((d|d<<1)&1431655765)<<1}function rr(a){var d=a,f=a;do{if(d.x<f.x||d.x===f.x&& d.y<f.y)f=d;d=d.next}while(d!==a);return f}function If(a,d,f,h,r,u,w,B){return 0<=(r-w)*(d-B)-(a-w)*(u-B)&&0<=(a-w)*(h-B)-(f-w)*(d-B)&&0<=(f-w)*(u-B)-(r-w)*(h-B)}function pr(a,d){return a.next.i!==d.i&&a.prev.i!==d.i&&!wr(a,d)&&eh(a,d)&&eh(d,a)&&xr(a,d)}function ec(a,d,f){return(d.y-a.y)*(f.x-d.x)-(d.x-a.x)*(f.y-d.y)}function Ee(a,d){return a.x===d.x&&a.y===d.y}function hn(a,d,f,h){return Ee(a,f)&&Ee(d,h)||Ee(a,h)&&Ee(f,d)?!0:0<ec(a,d,f)!==0<ec(a,d,h)&&0<ec(f,h,a)!==0<ec(f,h,d)}function wr(a,d){var f= a;do{if(f.i!==a.i&&f.next.i!==a.i&&f.i!==d.i&&f.next.i!==d.i&&hn(f,f.next,a,d))return!0;f=f.next}while(f!==a);return!1}function eh(a,d){return 0>ec(a.prev,a,a.next)?0<=ec(a,d,a.next)&&0<=ec(a,a.prev,d):0>ec(a,d,a.prev)||0>ec(a,a.next,d)}function xr(a,d){var f=a,h=!1,r=(a.x+d.x)/2;d=(a.y+d.y)/2;do f.y>d!==f.next.y>d&&f.next.y!==f.y&&r<(f.next.x-f.x)*(d-f.y)/(f.next.y-f.y)+f.x&&(h=!h),f=f.next;while(f!==a);return h}function jn(a,d){var f=new ek(a.i,a.x,a.y),h=new ek(d.i,d.x,d.y),r=a.next,u=d.prev;a.next= d;d.prev=a;f.next=r;r.prev=f;h.next=f;f.prev=h;u.next=h;h.prev=u;return h}function gn(a,d,f,h){a=new ek(a,d,f);h?(a.next=h.next,a.prev=h,h.next.prev=a,h.next=a):(a.prev=a,a.next=a);return a}function bh(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function ek(a,d,f){this.i=a;this.x=d;this.y=f;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function jr(a,d,f,h){for(var r=0,u=f-h;d<f;d+=h)r+=(a[u]-a[d])*(a[d+1]+a[u+1]), u=d;return r}function kn(a){var d=a.length;2<d&&a[d-1].equals(a[0])&&a.pop()}function ln(a,d){for(var f=0;f<d.length;f++)a.push(d[f].x),a.push(d[f].y)}function Fe(a,d){Ua.call(this);this.type="ExtrudeGeometry";this.parameters={shapes:a,options:d};this.fromBufferGeometry(new pd(a,d));this.mergeVertices()}function pd(a,d){function f(C){function G(Ha,$a,gb){$a||console.error("THREE.ExtrudeGeometry: vec does not exist");return $a.clone().multiplyScalar(gb).add(Ha)}function K(Ha,$a,gb){var jb=Ha.x-$a.x; var nb=Ha.y-$a.y;var Ib=gb.x-Ha.x;var Zb=gb.y-Ha.y,yc=jb*jb+nb*nb;if(Math.abs(jb*Zb-nb*Ib)>Number.EPSILON){var od=Math.sqrt(yc),Rc=Math.sqrt(Ib*Ib+Zb*Zb);yc=$a.x-nb/od;$a=$a.y+jb/od;Zb=((gb.x-Zb/Rc-yc)*Zb-(gb.y+Ib/Rc-$a)*Ib)/(jb*Zb-nb*Ib);Ib=yc+jb*Zb-Ha.x;jb=$a+nb*Zb-Ha.y;nb=Ib*Ib+jb*jb;if(2>=nb)return new e(Ib,jb);nb=Math.sqrt(nb/2)}else Ha=!1,jb>Number.EPSILON?Ib>Number.EPSILON&&(Ha=!0):jb<-Number.EPSILON?Ib<-Number.EPSILON&&(Ha=!0):Math.sign(nb)===Math.sign(Zb)&&(Ha=!0),Ha?(Ib=-nb,nb=Math.sqrt(yc)): (Ib=jb,jb=nb,nb=Math.sqrt(yc/2));return new e(Ib/nb,jb/nb)}function L(Ha,$a){for(Z=Ha.length;0<=--Z;){var gb=Z;var jb=Z-1;0>jb&&(jb=Ha.length-1);var nb,Ib=ia+2*La;for(nb=0;nb<Ib;nb++){var Zb=Qa*nb,yc=Qa*(nb+1);S($a+gb+Zb,$a+jb+Zb,$a+jb+yc,$a+gb+yc)}}}function M(Ha,$a,gb){ja.push(Ha);ja.push($a);ja.push(gb)}function R(Ha,$a,gb){X(Ha);X($a);X(gb);Ha=r.length/3;Ha=ua.generateTopUV(h,r,Ha-3,Ha-2,Ha-1);W(Ha[0]);W(Ha[1]);W(Ha[2])}function S(Ha,$a,gb,jb){X(Ha);X($a);X(jb);X($a);X(gb);X(jb);Ha=r.length/3; Ha=ua.generateSideWallUV(h,r,Ha-6,Ha-3,Ha-2,Ha-1);W(Ha[0]);W(Ha[1]);W(Ha[3]);W(Ha[1]);W(Ha[2]);W(Ha[3])}function X(Ha){r.push(ja[3*Ha]);r.push(ja[3*Ha+1]);r.push(ja[3*Ha+2])}function W(Ha){u.push(Ha.x);u.push(Ha.y)}var ja=[],ha=void 0!==d.curveSegments?d.curveSegments:12,ia=void 0!==d.steps?d.steps:1,ma=void 0!==d.depth?d.depth:100,fa=void 0!==d.bevelEnabled?d.bevelEnabled:!0,la=void 0!==d.bevelThickness?d.bevelThickness:6,qa=void 0!==d.bevelSize?d.bevelSize:la-2,Ka=void 0!==d.bevelOffset?d.bevelOffset: 0,La=void 0!==d.bevelSegments?d.bevelSegments:3,ra=d.extrudePath,ua=void 0!==d.UVGenerator?d.UVGenerator:yr;void 0!==d.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),ma=d.amount);var sa=!1;if(ra){var Ca=ra.getSpacedPoints(ia);sa=!0;fa=!1;var Za=ra.computeFrenetFrames(ia,!1);var ob=new k;var za=new k;var Wa=new k}fa||(Ka=qa=la=La=0);var db;ha=C.extractPoints(ha);C=ha.shape;var zb=ha.holes;if(!Ed.isClockWise(C)){C=C.reverse();var pb=0;for(db=zb.length;pb<db;pb++){var Y= zb[pb];Ed.isClockWise(Y)&&(zb[pb]=Y.reverse())}}var ca=Ed.triangulateShape(C,zb),oa=C;pb=0;for(db=zb.length;pb<db;pb++)Y=zb[pb],C=C.concat(Y);var xa,Qa=C.length,Ea,Xa=ca.length;ha=[];var Z=0;var ta=oa.length;var Aa=ta-1;for(xa=Z+1;Z<ta;Z++,Aa++,xa++)Aa===ta&&(Aa=0),xa===ta&&(xa=0),ha[Z]=K(oa[Z],oa[Aa],oa[xa]);ra=[];var hb=ha.concat();pb=0;for(db=zb.length;pb<db;pb++){Y=zb[pb];var Ma=[];Z=0;ta=Y.length;Aa=ta-1;for(xa=Z+1;Z<ta;Z++,Aa++,xa++)Aa===ta&&(Aa=0),xa===ta&&(xa=0),Ma[Z]=K(Y[Z],Y[Aa],Y[xa]); ra.push(Ma);hb=hb.concat(Ma)}for(Aa=0;Aa<La;Aa++){ta=Aa/La;var cb=la*Math.cos(ta*Math.PI/2);xa=qa*Math.sin(ta*Math.PI/2)+Ka;Z=0;for(ta=oa.length;Z<ta;Z++){var eb=G(oa[Z],ha[Z],xa);M(eb.x,eb.y,-cb)}pb=0;for(db=zb.length;pb<db;pb++)for(Y=zb[pb],Ma=ra[pb],Z=0,ta=Y.length;Z<ta;Z++)eb=G(Y[Z],Ma[Z],xa),M(eb.x,eb.y,-cb)}xa=qa+Ka;for(Z=0;Z<Qa;Z++)eb=fa?G(C[Z],hb[Z],xa):C[Z],sa?(za.copy(Za.normals[0]).multiplyScalar(eb.x),ob.copy(Za.binormals[0]).multiplyScalar(eb.y),Wa.copy(Ca[0]).add(za).add(ob),M(Wa.x, Wa.y,Wa.z)):M(eb.x,eb.y,0);for(ta=1;ta<=ia;ta++)for(Z=0;Z<Qa;Z++)eb=fa?G(C[Z],hb[Z],xa):C[Z],sa?(za.copy(Za.normals[ta]).multiplyScalar(eb.x),ob.copy(Za.binormals[ta]).multiplyScalar(eb.y),Wa.copy(Ca[ta]).add(za).add(ob),M(Wa.x,Wa.y,Wa.z)):M(eb.x,eb.y,ma/ia*ta);for(Aa=La-1;0<=Aa;Aa--){ta=Aa/La;cb=la*Math.cos(ta*Math.PI/2);xa=qa*Math.sin(ta*Math.PI/2)+Ka;Z=0;for(ta=oa.length;Z<ta;Z++)eb=G(oa[Z],ha[Z],xa),M(eb.x,eb.y,ma+cb);pb=0;for(db=zb.length;pb<db;pb++)for(Y=zb[pb],Ma=ra[pb],Z=0,ta=Y.length;Z<ta;Z++)eb= G(Y[Z],Ma[Z],xa),sa?M(eb.x,eb.y+Ca[ia-1].y,Ca[ia-1].x+cb):M(eb.x,eb.y,ma+cb)}(function(){var Ha=r.length/3;if(fa){var $a=0*Qa;for(Z=0;Z<Xa;Z++)Ea=ca[Z],R(Ea[2]+$a,Ea[1]+$a,Ea[0]+$a);$a=Qa*(ia+2*La);for(Z=0;Z<Xa;Z++)Ea=ca[Z],R(Ea[0]+$a,Ea[1]+$a,Ea[2]+$a)}else{for(Z=0;Z<Xa;Z++)Ea=ca[Z],R(Ea[2],Ea[1],Ea[0]);for(Z=0;Z<Xa;Z++)Ea=ca[Z],R(Ea[0]+Qa*ia,Ea[1]+Qa*ia,Ea[2]+Qa*ia)}h.addGroup(Ha,r.length/3-Ha,0)})();(function(){var Ha=r.length/3,$a=0;L(oa,$a);$a+=oa.length;pb=0;for(db=zb.length;pb<db;pb++)Y=zb[pb], L(Y,$a),$a+=Y.length;h.addGroup(Ha,r.length/3-Ha,1)})()}Ba.call(this);this.type="ExtrudeBufferGeometry";this.parameters={shapes:a,options:d};a=Array.isArray(a)?a:[a];for(var h=this,r=[],u=[],w=0,B=a.length;w<B;w++)f(a[w]);this.addAttribute("position",new pa(r,3));this.addAttribute("uv",new pa(u,2));this.computeVertexNormals()}function mn(a,d,f){f.shapes=[];if(Array.isArray(a))for(var h=0,r=a.length;h<r;h++)f.shapes.push(a[h].uuid);else f.shapes.push(a.uuid);void 0!==d.extrudePath&&(f.options.extrudePath= d.extrudePath.toJSON());return f}function fh(a,d){Ua.call(this);this.type="TextGeometry";this.parameters={text:a,parameters:d};this.fromBufferGeometry(new Jf(a,d));this.mergeVertices()}function Jf(a,d){d=d||{};var f=d.font;if(!f||!f.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Ua;a=f.generateShapes(a,d.size);d.depth=void 0!==d.height?d.height:50;void 0===d.bevelThickness&&(d.bevelThickness=10);void 0===d.bevelSize&&(d.bevelSize=8);void 0=== d.bevelEnabled&&(d.bevelEnabled=!1);pd.call(this,a,d);this.type="TextBufferGeometry"}function gh(a,d,f,h,r,u,w){Ua.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:d,heightSegments:f,phiStart:h,phiLength:r,thetaStart:u,thetaLength:w};this.fromBufferGeometry(new he(a,d,f,h,r,u,w));this.mergeVertices()}function he(a,d,f,h,r,u,w){Ba.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:d,heightSegments:f,phiStart:h,phiLength:r,thetaStart:u,thetaLength:w}; a=a||1;d=Math.max(3,Math.floor(d)||8);f=Math.max(2,Math.floor(f)||6);h=void 0!==h?h:0;r=void 0!==r?r:2*Math.PI;u=void 0!==u?u:0;w=void 0!==w?w:Math.PI;var B=Math.min(u+w,Math.PI),C,G,K=0,L=[],M=new k,R=new k,S=[],X=[],W=[],ja=[];for(G=0;G<=f;G++){var ha=[],ia=G/f,ma=0;0==G&&0==u?ma=.5/d:G==f&&B==Math.PI&&(ma=-.5/d);for(C=0;C<=d;C++){var fa=C/d;M.x=-a*Math.cos(h+fa*r)*Math.sin(u+ia*w);M.y=a*Math.cos(u+ia*w);M.z=a*Math.sin(h+fa*r)*Math.sin(u+ia*w);X.push(M.x,M.y,M.z);R.copy(M).normalize();W.push(R.x, R.y,R.z);ja.push(fa+ma,1-ia);ha.push(K++)}L.push(ha)}for(G=0;G<f;G++)for(C=0;C<d;C++)a=L[G][C+1],h=L[G][C],r=L[G+1][C],w=L[G+1][C+1],(0!==G||0<u)&&S.push(a,h,w),(G!==f-1||B<Math.PI)&&S.push(h,r,w);this.setIndex(S);this.addAttribute("position",new pa(X,3));this.addAttribute("normal",new pa(W,3));this.addAttribute("uv",new pa(ja,2))}function hh(a,d,f,h,r,u){Ua.call(this);this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:d,thetaSegments:f,phiSegments:h,thetaStart:r,thetaLength:u};this.fromBufferGeometry(new Kf(a, d,f,h,r,u));this.mergeVertices()}function Kf(a,d,f,h,r,u){Ba.call(this);this.type="RingBufferGeometry";this.parameters={innerRadius:a,outerRadius:d,thetaSegments:f,phiSegments:h,thetaStart:r,thetaLength:u};a=a||.5;d=d||1;r=void 0!==r?r:0;u=void 0!==u?u:2*Math.PI;f=void 0!==f?Math.max(3,f):8;h=void 0!==h?Math.max(1,h):1;var w=[],B=[],C=[],G=[],K=a,L=(d-a)/h,M=new k,R=new e,S,X;for(S=0;S<=h;S++){for(X=0;X<=f;X++)a=r+X/f*u,M.x=K*Math.cos(a),M.y=K*Math.sin(a),B.push(M.x,M.y,M.z),C.push(0,0,1),R.x=(M.x/ d+1)/2,R.y=(M.y/d+1)/2,G.push(R.x,R.y);K+=L}for(S=0;S<h;S++)for(d=S*(f+1),X=0;X<f;X++)a=X+d,r=a+f+1,u=a+f+2,K=a+1,w.push(a,r,K),w.push(r,u,K);this.setIndex(w);this.addAttribute("position",new pa(B,3));this.addAttribute("normal",new pa(C,3));this.addAttribute("uv",new pa(G,2))}function ih(a,d,f,h){Ua.call(this);this.type="LatheGeometry";this.parameters={points:a,segments:d,phiStart:f,phiLength:h};this.fromBufferGeometry(new Lf(a,d,f,h));this.mergeVertices()}function Lf(a,d,f,h){Ba.call(this);this.type= "LatheBufferGeometry";this.parameters={points:a,segments:d,phiStart:f,phiLength:h};d=Math.floor(d)||12;f=f||0;h=h||2*Math.PI;h=bb.clamp(h,0,2*Math.PI);var r=[],u=[],w=[],B=1/d,C=new k,G=new e,K;for(K=0;K<=d;K++){var L=f+K*B*h;var M=Math.sin(L),R=Math.cos(L);for(L=0;L<=a.length-1;L++)C.x=a[L].x*M,C.y=a[L].y,C.z=a[L].x*R,u.push(C.x,C.y,C.z),G.x=K/d,G.y=L/(a.length-1),w.push(G.x,G.y)}for(K=0;K<d;K++)for(L=0;L<a.length-1;L++)f=L+K*a.length,B=f+a.length,C=f+a.length+1,G=f+1,r.push(f,B,G),r.push(B,C,G); this.setIndex(r);this.addAttribute("position",new pa(u,3));this.addAttribute("uv",new pa(w,2));this.computeVertexNormals();if(h===2*Math.PI)for(h=this.attributes.normal.array,r=new k,u=new k,w=new k,f=d*a.length*3,L=K=0;K<a.length;K++,L+=3)r.x=h[L+0],r.y=h[L+1],r.z=h[L+2],u.x=h[f+L+0],u.y=h[f+L+1],u.z=h[f+L+2],w.addVectors(r,u).normalize(),h[L+0]=h[f+L+0]=w.x,h[L+1]=h[f+L+1]=w.y,h[L+2]=h[f+L+2]=w.z}function Ge(a,d){Ua.call(this);this.type="ShapeGeometry";"object"===typeof d&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."), d=d.curveSegments);this.parameters={shapes:a,curveSegments:d};this.fromBufferGeometry(new He(a,d));this.mergeVertices()}function He(a,d){function f(K){var L,M=r.length/3;K=K.extractPoints(d);var R=K.shape,S=K.holes;!1===Ed.isClockWise(R)&&(R=R.reverse());K=0;for(L=S.length;K<L;K++){var X=S[K];!0===Ed.isClockWise(X)&&(S[K]=X.reverse())}var W=Ed.triangulateShape(R,S);K=0;for(L=S.length;K<L;K++)X=S[K],R=R.concat(X);K=0;for(L=R.length;K<L;K++)X=R[K],r.push(X.x,X.y,0),u.push(0,0,1),w.push(X.x,X.y);K=0; for(L=W.length;K<L;K++)R=W[K],h.push(R[0]+M,R[1]+M,R[2]+M),C+=3}Ba.call(this);this.type="ShapeBufferGeometry";this.parameters={shapes:a,curveSegments:d};d=d||12;var h=[],r=[],u=[],w=[],B=0,C=0;if(!1===Array.isArray(a))f(a);else for(var G=0;G<a.length;G++)f(a[G]),this.addGroup(B,C,G),B+=C,C=0;this.setIndex(h);this.addAttribute("position",new pa(r,3));this.addAttribute("normal",new pa(u,3));this.addAttribute("uv",new pa(w,2))}function nn(a,d){d.shapes=[];if(Array.isArray(a))for(var f=0,h=a.length;f< h;f++)d.shapes.push(a[f].uuid);else d.shapes.push(a.uuid);return d}function Mf(a,d){Ba.call(this);this.type="EdgesGeometry";this.parameters={thresholdAngle:d};var f=[];d=Math.cos(bb.DEG2RAD*(void 0!==d?d:1));var h=[0,0],r={},u=["a","b","c"];if(a.isBufferGeometry){var w=new Ua;w.fromBufferGeometry(a)}else w=a.clone();w.mergeVertices();w.computeFaceNormals();a=w.vertices;w=w.faces;for(var B=0,C=w.length;B<C;B++)for(var G=w[B],K=0;3>K;K++){var L=G[u[K]];var M=G[u[(K+1)%3]];h[0]=Math.min(L,M);h[1]=Math.max(L, M);L=h[0]+","+h[1];void 0===r[L]?r[L]={index1:h[0],index2:h[1],face1:B,face2:void 0}:r[L].face2=B}for(L in r)if(h=r[L],void 0===h.face2||w[h.face1].normal.dot(w[h.face2].normal)<=d)u=a[h.index1],f.push(u.x,u.y,u.z),u=a[h.index2],f.push(u.x,u.y,u.z);this.addAttribute("position",new pa(f,3))}function Ie(a,d,f,h,r,u,w,B){Ua.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:d,height:f,radialSegments:h,heightSegments:r,openEnded:u,thetaStart:w,thetaLength:B};this.fromBufferGeometry(new Fd(a, d,f,h,r,u,w,B));this.mergeVertices()}function Fd(a,d,f,h,r,u,w,B){function C(ha){var ia,ma=new e,fa=new k,la=0,qa=!0===ha?a:d,Ka=!0===ha?1:-1;var La=S;for(ia=1;ia<=h;ia++)L.push(0,W*Ka,0),M.push(0,Ka,0),R.push(.5,.5),S++;var ra=S;for(ia=0;ia<=h;ia++){var ua=ia/h*B+w,sa=Math.cos(ua);ua=Math.sin(ua);fa.x=qa*ua;fa.y=W*Ka;fa.z=qa*sa;L.push(fa.x,fa.y,fa.z);M.push(0,Ka,0);ma.x=.5*sa+.5;ma.y=.5*ua*Ka+.5;R.push(ma.x,ma.y);S++}for(ia=0;ia<h;ia++)ma=La+ia,fa=ra+ia,!0===ha?K.push(fa,fa+1,ma):K.push(fa+1,fa, ma),la+=3;G.addGroup(ja,la,!0===ha?1:2);ja+=la}Ba.call(this);this.type="CylinderBufferGeometry";this.parameters={radiusTop:a,radiusBottom:d,height:f,radialSegments:h,heightSegments:r,openEnded:u,thetaStart:w,thetaLength:B};var G=this;a=void 0!==a?a:1;d=void 0!==d?d:1;f=f||1;h=Math.floor(h)||8;r=Math.floor(r)||1;u=void 0!==u?u:!1;w=void 0!==w?w:0;B=void 0!==B?B:2*Math.PI;var K=[],L=[],M=[],R=[],S=0,X=[],W=f/2,ja=0;(function(){var ha,ia,ma=new k,fa=new k,la=0,qa=(d-a)/f;for(ia=0;ia<=r;ia++){var Ka= [],La=ia/r,ra=La*(d-a)+a;for(ha=0;ha<=h;ha++){var ua=ha/h,sa=ua*B+w,Ca=Math.sin(sa);sa=Math.cos(sa);fa.x=ra*Ca;fa.y=-La*f+W;fa.z=ra*sa;L.push(fa.x,fa.y,fa.z);ma.set(Ca,qa,sa).normalize();M.push(ma.x,ma.y,ma.z);R.push(ua,1-La);Ka.push(S++)}X.push(Ka)}for(ha=0;ha<h;ha++)for(ia=0;ia<r;ia++)ma=X[ia+1][ha],fa=X[ia+1][ha+1],qa=X[ia][ha+1],K.push(X[ia][ha],ma,qa),K.push(ma,fa,qa),la+=6;G.addGroup(ja,la,0);ja+=la})();!1===u&&(0<a&&C(!0),0<d&&C(!1));this.setIndex(K);this.addAttribute("position",new pa(L,3)); this.addAttribute("normal",new pa(M,3));this.addAttribute("uv",new pa(R,2))}function jh(a,d,f,h,r,u,w){Ie.call(this,0,a,d,f,h,r,u,w);this.type="ConeGeometry";this.parameters={radius:a,height:d,radialSegments:f,heightSegments:h,openEnded:r,thetaStart:u,thetaLength:w}}function kh(a,d,f,h,r,u,w){Fd.call(this,0,a,d,f,h,r,u,w);this.type="ConeBufferGeometry";this.parameters={radius:a,height:d,radialSegments:f,heightSegments:h,openEnded:r,thetaStart:u,thetaLength:w}}function lh(a,d,f,h){Ua.call(this);this.type= "CircleGeometry";this.parameters={radius:a,segments:d,thetaStart:f,thetaLength:h};this.fromBufferGeometry(new Nf(a,d,f,h));this.mergeVertices()}function Nf(a,d,f,h){Ba.call(this);this.type="CircleBufferGeometry";this.parameters={radius:a,segments:d,thetaStart:f,thetaLength:h};a=a||1;d=void 0!==d?Math.max(3,d):8;f=void 0!==f?f:0;h=void 0!==h?h:2*Math.PI;var r=[],u=[],w=[],B=[],C,G=new k,K=new e;u.push(0,0,0);w.push(0,0,1);B.push(.5,.5);var L=0;for(C=3;L<=d;L++,C+=3){var M=f+L/d*h;G.x=a*Math.cos(M); G.y=a*Math.sin(M);u.push(G.x,G.y,G.z);w.push(0,0,1);K.x=(u[C]/a+1)/2;K.y=(u[C+1]/a+1)/2;B.push(K.x,K.y)}for(C=1;C<=d;C++)r.push(C,C+1,0);this.setIndex(r);this.addAttribute("position",new pa(u,3));this.addAttribute("normal",new pa(w,3));this.addAttribute("uv",new pa(B,2))}function Je(a){T.call(this);this.type="ShadowMaterial";this.color=new J(0);this.transparent=!0;this.setValues(a)}function Of(a){Ub.call(this,a);this.type="RawShaderMaterial"}function qd(a){T.call(this);this.defines={STANDARD:""}; this.type="MeshStandardMaterial";this.color=new J(16777215);this.metalness=this.roughness=.5;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new J(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new e(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null;this.envMapIntensity= 1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Ke(a){qd.call(this);this.defines={STANDARD:"",PHYSICAL:""};this.type="MeshPhysicalMaterial";this.reflectivity=.5;this.clearcoatRoughness=this.clearcoat=0;this.sheen=null;this.clearcoatNormalScale=new e(1,1);this.clearcoatNormalMap=null;this.transparency=0;this.setValues(a)}function Tc(a){T.call(this); this.type="MeshPhongMaterial";this.color=new J(16777215);this.specular=new J(1118481);this.shininess=30;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new J(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new e(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0; this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Le(a){Tc.call(this);this.defines={TOON:""};this.type="MeshToonMaterial";this.gradientMap=null;this.setValues(a)}function Me(a){T.call(this);this.type="MeshNormalMaterial";this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new e(1,1);this.displacementMap= null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1;this.setValues(a)}function Ne(a){T.call(this);this.type="MeshLambertMaterial";this.color=new J(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new J(0);this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=0;this.reflectivity= 1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Oe(a){T.call(this);this.defines={MATCAP:""};this.type="MeshMatcapMaterial";this.color=new J(16777215);this.bumpMap=this.map=this.matcap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new e(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias= 0;this.alphaMap=null;this.lights=this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Pe(a){Bb.call(this);this.type="LineDashedMaterial";this.scale=1;this.dashSize=3;this.gapSize=1;this.setValues(a)}function zc(a,d,f,h){this.parameterPositions=a;this._cachedIndex=0;this.resultBuffer=void 0!==h?h:new d.constructor(f);this.sampleValues=d;this.valueSize=f}function ki(a,d,f,h){zc.call(this,a,d,f,h);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function mh(a, d,f,h){zc.call(this,a,d,f,h)}function li(a,d,f,h){zc.call(this,a,d,f,h)}function fc(a,d,f,h){if(void 0===a)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===d||0===d.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+a);this.name=a;this.times=ac.convertArray(d,this.TimeBufferType);this.values=ac.convertArray(f,this.ValueBufferType);this.setInterpolation(h||this.DefaultInterpolation)}function mi(a,d,f){fc.call(this,a,d,f)}function ni(a,d,f,h){fc.call(this, a,d,f,h)}function Pf(a,d,f,h){fc.call(this,a,d,f,h)}function oi(a,d,f,h){zc.call(this,a,d,f,h)}function nh(a,d,f,h){fc.call(this,a,d,f,h)}function pi(a,d,f,h){fc.call(this,a,d,f,h)}function Qf(a,d,f,h){fc.call(this,a,d,f,h)}function Ic(a,d,f){this.name=a;this.tracks=f;this.duration=void 0!==d?d:-1;this.uuid=bb.generateUUID();0>this.duration&&this.resetDuration()}function zr(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return Pf;case "vector":case "vector2":case "vector3":case "vector4":return Qf; case "color":return ni;case "quaternion":return nh;case "bool":case "boolean":return mi;case "string":return pi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function Ar(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var d=zr(a.type);if(void 0===a.times){var f=[],h=[];ac.flattenJSON(a.keys,f,h,"value");a.times=f;a.values=h}return void 0!==d.parse?d.parse(a):new d(a.name,a.times,a.values,a.interpolation)}function fk(a,d,f){var h=this,r= !1,u=0,w=0,B=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=d;this.onError=f;this.itemStart=function(C){w++;if(!1===r&&void 0!==h.onStart)h.onStart(C,u,w);r=!0};this.itemEnd=function(C){u++;if(void 0!==h.onProgress)h.onProgress(C,u,w);if(u===w&&(r=!1,void 0!==h.onLoad))h.onLoad()};this.itemError=function(C){if(void 0!==h.onError)h.onError(C)};this.resolveURL=function(C){return B?B(C):C};this.setURLModifier=function(C){B=C;return this}}function vb(a){this.manager=void 0!==a?a:on;this.crossOrigin= "anonymous";this.resourcePath=this.path=""}function Jc(a){vb.call(this,a)}function gk(a){vb.call(this,a)}function hk(a){vb.call(this,a);this._parser=null}function qi(a){vb.call(this,a);this._parser=null}function Rf(a){vb.call(this,a)}function ri(a){vb.call(this,a)}function si(a){vb.call(this,a)}function Ra(){this.type="Curve";this.arcLengthDivisions=200}function Ac(a,d,f,h,r,u,w,B){Ra.call(this);this.type="EllipseCurve";this.aX=a||0;this.aY=d||0;this.xRadius=f||1;this.yRadius=h||1;this.aStartAngle= r||0;this.aEndAngle=u||2*Math.PI;this.aClockwise=w||!1;this.aRotation=B||0}function Sf(a,d,f,h,r,u){Ac.call(this,a,d,f,f,h,r,u);this.type="ArcCurve"}function ik(){function a(u,w,B,C){d=u;f=B;h=-3*u+3*w-2*B-C;r=2*u-2*w+B+C}var d=0,f=0,h=0,r=0;return{initCatmullRom:function(u,w,B,C,G){a(w,B,G*(B-u),G*(C-w))},initNonuniformCatmullRom:function(u,w,B,C,G,K,L){a(w,B,((w-u)/G-(B-u)/(G+K)+(B-w)/K)*K,((B-w)/K-(C-w)/(K+L)+(C-B)/L)*K)},calc:function(u){var w=u*u;return d+f*u+h*w+r*w*u}}}function kc(a,d,f,h){Ra.call(this); this.type="CatmullRomCurve3";this.points=a||[];this.closed=d||!1;this.curveType=f||"centripetal";this.tension=h||.5}function pn(a,d,f,h,r){d=.5*(h-d);r=.5*(r-f);var u=a*a;return(2*f-2*h+d+r)*a*u+(-3*f+3*h-2*d-r)*u+d*a+f}function Br(a,d){a=1-a;return a*a*d}function Cr(a,d){return 2*(1-a)*a*d}function Dr(a,d){return a*a*d}function oh(a,d,f,h){return Br(a,d)+Cr(a,f)+Dr(a,h)}function Er(a,d){a=1-a;return a*a*a*d}function Fr(a,d){var f=1-a;return 3*f*f*a*d}function Gr(a,d){return 3*(1-a)*a*a*d}function Hr(a, d){return a*a*a*d}function ph(a,d,f,h,r){return Er(a,d)+Fr(a,f)+Gr(a,h)+Hr(a,r)}function Uc(a,d,f,h){Ra.call(this);this.type="CubicBezierCurve";this.v0=a||new e;this.v1=d||new e;this.v2=f||new e;this.v3=h||new e}function rd(a,d,f,h){Ra.call(this);this.type="CubicBezierCurve3";this.v0=a||new k;this.v1=d||new k;this.v2=f||new k;this.v3=h||new k}function uc(a,d){Ra.call(this);this.type="LineCurve";this.v1=a||new e;this.v2=d||new e}function Vc(a,d){Ra.call(this);this.type="LineCurve3";this.v1=a||new k; this.v2=d||new k}function Wc(a,d,f){Ra.call(this);this.type="QuadraticBezierCurve";this.v0=a||new e;this.v1=d||new e;this.v2=f||new e}function sd(a,d,f){Ra.call(this);this.type="QuadraticBezierCurve3";this.v0=a||new k;this.v1=d||new k;this.v2=f||new k}function Xc(a){Ra.call(this);this.type="SplineCurve";this.points=a||[]}function Gd(){Ra.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function Yc(a){Gd.call(this);this.type="Path";this.currentPoint=new e;a&&this.setFromPoints(a)} function ie(a){Yc.call(this,a);this.uuid=bb.generateUUID();this.type="Shape";this.holes=[]}function Gb(a,d){y.call(this);this.type="Light";this.color=new J(a);this.intensity=void 0!==d?d:1;this.receiveShadow=void 0}function ti(a,d,f){Gb.call(this,a,f);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(y.DefaultUp);this.updateMatrix();this.groundColor=new J(d)}function td(a){this.camera=a;this.bias=0;this.radius=1;this.mapSize=new e(512,512);this.mapPass=this.map=null;this.matrix= new t;this._frustum=new Gc;this._frameExtents=new e(1,1);this._viewportCount=1;this._viewports=[new m(0,0,1,1)]}function ui(){td.call(this,new Ab(50,1,.5,500))}function vi(a,d,f,h,r,u){Gb.call(this,a,d);this.type="SpotLight";this.position.copy(y.DefaultUp);this.updateMatrix();this.target=new y;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(w){this.intensity=w/Math.PI}});this.distance=void 0!==f?f:0;this.angle=void 0!==h?h:Math.PI/3;this.penumbra=void 0!== r?r:0;this.decay=void 0!==u?u:1;this.shadow=new ui}function jk(){td.call(this,new Ab(90,1,.5,500));this._frameExtents=new e(4,2);this._viewportCount=6;this._viewports=[new m(2,1,1,1),new m(0,1,1,1),new m(3,1,1,1),new m(1,1,1,1),new m(3,0,1,1),new m(1,0,1,1)];this._cubeDirections=[new k(1,0,0),new k(-1,0,0),new k(0,0,1),new k(0,0,-1),new k(0,1,0),new k(0,-1,0)];this._cubeUps=[new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,0,1),new k(0,0,-1)]}function wi(a,d,f,h){Gb.call(this,a,d);this.type= "PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(r){this.intensity=r/(4*Math.PI)}});this.distance=void 0!==f?f:0;this.decay=void 0!==h?h:1;this.shadow=new jk}function qh(a,d,f,h,r,u){$b.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==d?d:1;this.top=void 0!==f?f:1;this.bottom=void 0!==h?h:-1;this.near=void 0!==r?r:.1;this.far=void 0!==u?u:2E3;this.updateProjectionMatrix()} function xi(){td.call(this,new qh(-5,5,5,-5,.5,500))}function yi(a,d){Gb.call(this,a,d);this.type="DirectionalLight";this.position.copy(y.DefaultUp);this.updateMatrix();this.target=new y;this.shadow=new xi}function zi(a,d){Gb.call(this,a,d);this.type="AmbientLight";this.castShadow=void 0}function Ai(a,d,f,h){Gb.call(this,a,d);this.type="RectAreaLight";this.width=void 0!==f?f:10;this.height=void 0!==h?h:10}function Bi(a){vb.call(this,a);this.textures={}}function Ci(){Ba.call(this);this.type="InstancedBufferGeometry"; this.maxInstancedCount=void 0}function Di(a,d,f,h){"number"===typeof f&&(h=f,f=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));da.call(this,a,d,f);this.meshPerAttribute=h||1}function Ei(a){vb.call(this,a)}function Fi(a){vb.call(this,a)}function kk(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."); vb.call(this,a);this.options=void 0}function lk(){this.type="ShapePath";this.color=new J;this.subPaths=[];this.currentPath=null}function mk(a){this.type="Font";this.data=a}function Ir(a,d,f){a=Array.from?Array.from(a):String(a).split("");d/=f.resolution;for(var h=(f.boundingBox.yMax-f.boundingBox.yMin+f.underlineThickness)*d,r=[],u=0,w=0,B=0;B<a.length;B++){var C=a[B];"\n"===C?(u=0,w-=h):(C=Jr(C,d,u,w,f),u+=C.offsetX,r.push(C.path))}return r}function Jr(a,d,f,h,r){var u=r.glyphs[a]||r.glyphs["?"]; if(u){a=new lk;if(u.o){r=u._cachedOutline||(u._cachedOutline=u.o.split(" "));for(var w=0,B=r.length;w<B;)switch(r[w++]){case "m":var C=r[w++]*d+f;var G=r[w++]*d+h;a.moveTo(C,G);break;case "l":C=r[w++]*d+f;G=r[w++]*d+h;a.lineTo(C,G);break;case "q":C=r[w++]*d+f;G=r[w++]*d+h;var K=r[w++]*d+f;var L=r[w++]*d+h;a.quadraticCurveTo(K,L,C,G);break;case "b":C=r[w++]*d+f;G=r[w++]*d+h;K=r[w++]*d+f;L=r[w++]*d+h;var M=r[w++]*d+f;var R=r[w++]*d+h;a.bezierCurveTo(K,L,M,R,C,G)}}return{offsetX:u.ha*d,path:a}}console.error('THREE.Font: character "'+ a+'" does not exists in font family '+r.familyName+".")}function nk(a){vb.call(this,a)}function Gi(a){vb.call(this,a)}function Hi(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new k)}function Zc(a,d){Gb.call(this,void 0,d);this.sh=void 0!==a?a:new Hi}function ok(a,d,f){Zc.call(this,void 0,f);a=(new J).set(a);f=(new J).set(d);d=new k(a.r,a.g,a.b);a=new k(f.r,f.g,f.b);f=Math.sqrt(Math.PI);var h=f*Math.sqrt(.75);this.sh.coefficients[0].copy(d).add(a).multiplyScalar(f);this.sh.coefficients[1].copy(d).sub(a).multiplyScalar(h)} function pk(a,d){Zc.call(this,void 0,d);a=(new J).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function qn(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new Ab;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new Ab;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function qk(a){this.autoStart=void 0!==a?a: !0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function rk(){y.call(this);this.type="AudioListener";this.context=sk.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new qk}function Tf(a){y.call(this);this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset= this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function tk(a){Tf.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function uk(a,d){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==d?d:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function vk(a,d,f){this.binding= a;this.valueSize=f;a=Float64Array;switch(d){case "quaternion":d=this._slerp;break;case "string":case "bool":a=Array;d=this._select;break;default:d=this._lerp}this.buffer=new a(4*f);this._mixBufferRegion=d;this.referenceCount=this.useCount=this.cumulativeWeight=0}function rn(a,d,f){f=f||lc.parseTrackName(d);this._targetGroup=a;this._bindings=a.subscribe_(d,f)}function lc(a,d,f){this.path=d;this.parsedPath=f||lc.parseTrackName(d);this.node=lc.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a} function sn(){this.uuid=bb.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var d=0,f=arguments.length;d!==f;++d)a[arguments[d].uuid]=d;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var h=this;this.stats={objects:{get total(){return h._objects.length},get inUse(){return this.total-h.nCachedObjects_}},get bindingsPerObject(){return h._bindings.length}}}function tn(a,d,f){this._mixer=a; this._clip=d;this._localRoot=f||null;a=d.tracks;d=a.length;f=Array(d);for(var h={endingStart:2400,endingEnd:2400},r=0;r!==d;++r){var u=a[r].createInterpolant(null);f[r]=u;u.settings=h}this._interpolantSettings=h;this._interpolants=f;this._propertyBindings=Array(d);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale= 1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function wk(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Ii(a,d){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=d);this.value=a}function xk(a,d,f){Be.call(this,a,d);this.meshPerAttribute=f||1}function un(a,d,f,h){this.ray=new E(a,d);this.near=f||0;this.far=h||Infinity;this.camera= null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function vn(a,d){return a.distance-d.distance}function yk(a,d,f,h){if(!1!==a.visible&&(a.raycast(d,f),!0===h)){a=a.children;h=0;for(var r=a.length;h<r;h++)yk(a[h],d,f,!0)}}function wn(a,d,f){this.radius=void 0!==a?a:1;this.phi=void 0!==d?d:0;this.theta=void 0!== f?f:0;return this}function xn(a,d,f){this.radius=void 0!==a?a:1;this.theta=void 0!==d?d:0;this.y=void 0!==f?f:0;return this}function zk(a,d){this.min=void 0!==a?a:new e(Infinity,Infinity);this.max=void 0!==d?d:new e(-Infinity,-Infinity)}function Ak(a,d){this.start=void 0!==a?a:new k;this.end=void 0!==d?d:new k}function rh(a){y.call(this);this.material=a;this.render=function(){}}function sh(a,d,f,h){this.object=a;this.size=void 0!==d?d:1;a=void 0!==f?f:16711680;h=void 0!==h?h:1;d=0;(f=this.object.geometry)&& f.isGeometry?d=3*f.faces.length:f&&f.isBufferGeometry&&(d=f.attributes.normal.count);f=new Ba;d=new pa(6*d,3);f.addAttribute("position",d);Eb.call(this,f,new Bb({color:a,linewidth:h}));this.matrixAutoUpdate=!1;this.update()}function Uf(a,d){y.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=d;a=new Ba;d=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(var f=0,h=1;32>f;f++,h++){var r=f/32*Math.PI*2,u=h/32*Math.PI* 2;d.push(Math.cos(r),Math.sin(r),1,Math.cos(u),Math.sin(u),1)}a.addAttribute("position",new pa(d,3));d=new Bb({fog:!1});this.cone=new Eb(a,d);this.add(this.cone);this.update()}function yn(a){var d=[];a&&a.isBone&&d.push(a);for(var f=0;f<a.children.length;f++)d.push.apply(d,yn(a.children[f]));return d}function Vf(a){for(var d=yn(a),f=new Ba,h=[],r=[],u=new J(0,0,1),w=new J(0,1,0),B=0;B<d.length;B++){var C=d[B];C.parent&&C.parent.isBone&&(h.push(0,0,0),h.push(0,0,0),r.push(u.r,u.g,u.b),r.push(w.r,w.g, w.b))}f.addAttribute("position",new pa(h,3));f.addAttribute("color",new pa(r,3));h=new Bb({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});Eb.call(this,f,h);this.root=a;this.bones=d;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1}function Wf(a,d,f){this.light=a;this.light.updateMatrixWorld();this.color=f;a=new he(d,4,2);d=new aa({wireframe:!0,fog:!1});Nb.call(this,a,d);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1;this.update()}function Xf(a,d){this.type="RectAreaLightHelper"; this.light=a;this.color=d;a=new Ba;a.addAttribute("position",new pa([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3));a.computeBoundingSphere();d=new Bb({fog:!1});dc.call(this,a,d);a=new Ba;a.addAttribute("position",new pa([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3));a.computeBoundingSphere();this.add(new Nb(a,new aa({side:1,fog:!1})));this.update()}function Yf(a,d,f){y.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=f;a=new Ce(d);a.rotateY(.5* Math.PI);this.material=new aa({wireframe:!0,fog:!1});void 0===this.color&&(this.material.vertexColors=2);d=a.getAttribute("position");a.addAttribute("color",new da(new Float32Array(3*d.count),3));this.add(new Nb(a,this.material));this.update()}function Zf(a,d){this.lightProbe=a;this.size=d;a=new Ub({defines:{GAMMA_OUTPUT:""},uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:"varying vec3 vNormal;\nvoid main() {\n\tvNormal \x3d normalize( normalMatrix * normal );\n\tgl_Position \x3d projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}", fragmentShader:"#define RECIPROCAL_PI 0.318309886\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\t// matrix is assumed to be orthogonal\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\t// normal is assumed to have unit length\n\tfloat x \x3d normal.x, y \x3d normal.y, z \x3d normal.z;\n\t// band 0\n\tvec3 result \x3d shCoefficients[ 0 ] * 0.886227;\n\t// band 1\n\tresult +\x3d shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult +\x3d shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult +\x3d shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\t// band 2\n\tresult +\x3d shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult +\x3d shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult +\x3d shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult +\x3d shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult +\x3d shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nuniform vec3 sh[ 9 ]; // sh coefficients\nuniform float intensity; // light probe intensity\nvarying vec3 vNormal;\nvoid main() {\n\tvec3 normal \x3d normalize( vNormal );\n\tvec3 worldNormal \x3d inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance \x3d shGetIrradianceAt( worldNormal, sh );\n\tvec3 outgoingLight \x3d RECIPROCAL_PI * irradiance * intensity;\n\toutgoingLight \x3d linearToOutput( outgoingLight );\n\tgl_FragColor \x3d vec4( outgoingLight, 1.0 );\n}"}); d=new he(1,32,16);Nb.call(this,d,a);this.onBeforeRender()}function Ji(a,d,f,h){a=a||10;d=d||10;f=new J(void 0!==f?f:4473924);h=new J(void 0!==h?h:8947848);var r=d/2,u=a/d,w=a/2;a=[];for(var B=[],C=0,G=0,K=-w;C<=d;C++,K+=u){a.push(-w,0,K,w,0,K);a.push(K,0,-w,K,0,w);var L=C===r?f:h;L.toArray(B,G);G+=3;L.toArray(B,G);G+=3;L.toArray(B,G);G+=3;L.toArray(B,G);G+=3}d=new Ba;d.addAttribute("position",new pa(a,3));d.addAttribute("color",new pa(B,3));f=new Bb({vertexColors:2});Eb.call(this,d,f)}function Ki(a, d,f,h,r,u){a=a||10;d=d||16;f=f||8;h=h||64;r=new J(void 0!==r?r:4473924);u=new J(void 0!==u?u:8947848);var w=[],B=[],C;for(C=0;C<=d;C++){var G=C/d*2*Math.PI;var K=Math.sin(G)*a;G=Math.cos(G)*a;w.push(0,0,0);w.push(K,0,G);var L=C&1?r:u;B.push(L.r,L.g,L.b);B.push(L.r,L.g,L.b)}for(C=0;C<=f;C++){L=C&1?r:u;var M=a-a/f*C;for(d=0;d<h;d++)G=d/h*2*Math.PI,K=Math.sin(G)*M,G=Math.cos(G)*M,w.push(K,0,G),B.push(L.r,L.g,L.b),G=(d+1)/h*2*Math.PI,K=Math.sin(G)*M,G=Math.cos(G)*M,w.push(K,0,G),B.push(L.r,L.g,L.b)}a= new Ba;a.addAttribute("position",new pa(w,3));a.addAttribute("color",new pa(B,3));w=new Bb({vertexColors:2});Eb.call(this,a,w)}function $f(a,d,f,h){this.audio=a;this.range=d||1;this.divisionsInnerAngle=f||16;this.divisionsOuterAngle=h||2;a=new Ba;a.addAttribute("position",new da(new Float32Array(3*(3*(this.divisionsInnerAngle+2*this.divisionsOuterAngle)+3)),3));d=new Bb({color:65280});f=new Bb({color:16776960});dc.call(this,a,[f,d]);this.update()}function th(a,d,f,h){this.object=a;this.size=void 0!== d?d:1;a=void 0!==f?f:16776960;h=void 0!==h?h:1;d=0;(f=this.object.geometry)&&f.isGeometry?d=f.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");f=new Ba;d=new pa(6*d,3);f.addAttribute("position",d);Eb.call(this,f,new Bb({color:a,linewidth:h}));this.matrixAutoUpdate=!1;this.update()}function ag(a,d,f){y.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=f; void 0===d&&(d=1);a=new Ba;a.addAttribute("position",new pa([-d,d,0,d,d,0,d,-d,0,-d,-d,0,-d,d,0],3));d=new Bb({fog:!1});this.lightPlane=new dc(a,d);this.add(this.lightPlane);a=new Ba;a.addAttribute("position",new pa([0,0,0,0,0,1],3));this.targetLine=new dc(a,d);this.add(this.targetLine);this.update()}function uh(a){function d(R,S,X){f(R,X);f(S,X)}function f(R,S){u.push(0,0,0);w.push(S.r,S.g,S.b);void 0===B[R]&&(B[R]=[]);B[R].push(u.length/3-1)}var h=new Ba,r=new Bb({color:16777215,vertexColors:1}), u=[],w=[],B={},C=new J(16755200),G=new J(16711680),K=new J(43775),L=new J(16777215),M=new J(3355443);d("n1","n2",C);d("n2","n4",C);d("n4","n3",C);d("n3","n1",C);d("f1","f2",C);d("f2","f4",C);d("f4","f3",C);d("f3","f1",C);d("n1","f1",C);d("n2","f2",C);d("n3","f3",C);d("n4","f4",C);d("p","n1",G);d("p","n2",G);d("p","n3",G);d("p","n4",G);d("u1","u2",K);d("u2","u3",K);d("u3","u1",K);d("c","t",L);d("p","c",M);d("cn1","cn2",M);d("cn3","cn4",M);d("cf1","cf2",M);d("cf3","cf4",M);h.addAttribute("position", new pa(u,3));h.addAttribute("color",new pa(w,3));Eb.call(this,h,r);this.camera=a;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=B;this.update()}function Vb(a,d,f,h,r,u,w){Li.set(r,u,w).unproject(h);a=d[a];if(void 0!==a)for(f=f.getAttribute("position"),d=0,h=a.length;d<h;d++)f.setXYZ(a[d],Li.x,Li.y,Li.z)}function Hd(a,d){this.object=a;void 0===d&&(d=16776960);a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7, 4,0,4,1,5,2,6,3,7]);var f=new Float32Array(24),h=new Ba;h.setIndex(new da(a,1));h.addAttribute("position",new da(f,3));Eb.call(this,h,new Bb({color:d}));this.matrixAutoUpdate=!1;this.update()}function vh(a,d){this.type="Box3Helper";this.box=a;d=d||16776960;a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);var f=new Ba;f.setIndex(new da(a,1));f.addAttribute("position",new pa([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3));Eb.call(this,f,new Bb({color:d}));this.geometry.computeBoundingSphere()} function wh(a,d,f){this.type="PlaneHelper";this.plane=a;this.size=void 0===d?1:d;a=void 0!==f?f:16776960;d=new Ba;d.addAttribute("position",new pa([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,0,1,0,0,0],3));d.computeBoundingSphere();dc.call(this,d,new Bb({color:a}));d=new Ba;d.addAttribute("position",new pa([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3));d.computeBoundingSphere();this.add(new Nb(d,new aa({color:a,opacity:.2,transparent:!0,depthWrite:!1})))}function Id(a,d,f,h,r,u){y.call(this); void 0===a&&(a=new k(0,0,1));void 0===d&&(d=new k(0,0,0));void 0===f&&(f=1);void 0===h&&(h=16776960);void 0===r&&(r=.2*f);void 0===u&&(u=.2*r);void 0===Mi&&(Mi=new Ba,Mi.addAttribute("position",new pa([0,0,0,0,1,0],3)),Bk=new Fd(0,.5,1,5,1),Bk.translate(0,-.5,0));this.position.copy(d);this.line=new dc(Mi,new Bb({color:h}));this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new Nb(Bk,new aa({color:h}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(f, r,u)}function xh(a){a=a||1;var d=[0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a];a=new Ba;a.addAttribute("position",new pa(d,3));a.addAttribute("color",new pa([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));d=new Bb({vertexColors:2});Eb.call(this,a,d)}function zn(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");kc.call(this,a);this.type="catmullrom";this.closed=!0}function An(a){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."); kc.call(this,a);this.type="catmullrom"}function Ck(a){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.");kc.call(this,a);this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(a){return"number"===typeof a&&isFinite(a)&&Math.floor(a)===a});void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a});!1==="name"in Function.prototype&&Object.defineProperty(Function.prototype,"name", {get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});void 0===Object.assign&&(Object.assign=function(a){if(void 0===a||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(a),f=1;f<arguments.length;f++){var h=arguments[f];if(void 0!==h&&null!==h)for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&(d[r]=h[r])}return d});Object.assign(c.prototype,{addEventListener:function(a,d){void 0===this._listeners&&(this._listeners={});var f= this._listeners;void 0===f[a]&&(f[a]=[]);-1===f[a].indexOf(d)&&f[a].push(d)},hasEventListener:function(a,d){if(void 0===this._listeners)return!1;var f=this._listeners;return void 0!==f[a]&&-1!==f[a].indexOf(d)},removeEventListener:function(a,d){void 0!==this._listeners&&(a=this._listeners[a],void 0!==a&&(d=a.indexOf(d),-1!==d&&a.splice(d,1)))},dispatchEvent:function(a){if(void 0!==this._listeners){var d=this._listeners[a.type];if(void 0!==d){a.target=this;d=d.slice(0);for(var f=0,h=d.length;f<h;f++)d[f].call(this, a)}}}});for(var gc=[],yh=0;256>yh;yh++)gc[yh]=(16>yh?"0":"")+yh.toString(16);var bb={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a=4294967295*Math.random()|0,d=4294967295*Math.random()|0,f=4294967295*Math.random()|0,h=4294967295*Math.random()|0;return(gc[a&255]+gc[a>>8&255]+gc[a>>16&255]+gc[a>>24&255]+"-"+gc[d&255]+gc[d>>8&255]+"-"+gc[d>>16&15|64]+gc[d>>24&255]+"-"+gc[f&63|128]+gc[f>>8&255]+"-"+gc[f>>16&255]+gc[f>>24&255]+gc[h&255]+gc[h>>8&255]+gc[h>>16&255]+gc[h>>24&255]).toUpperCase()}, clamp:function(a,d,f){return Math.max(d,Math.min(f,a))},euclideanModulo:function(a,d){return(a%d+d)%d},mapLinear:function(a,d,f,h,r){return h+(a-d)*(r-h)/(f-d)},lerp:function(a,d,f){return(1-f)*a+f*d},smoothstep:function(a,d,f){if(a<=d)return 0;if(a>=f)return 1;a=(a-d)/(f-d);return a*a*(3-2*a)},smootherstep:function(a,d,f){if(a<=d)return 0;if(a>=f)return 1;a=(a-d)/(f-d);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,d){return a+Math.floor(Math.random()*(d-a+1))},randFloat:function(a,d){return a+ Math.random()*(d-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*bb.DEG2RAD},radToDeg:function(a){return a*bb.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(e.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y}, set:function(a){this.y=a}}});Object.assign(e.prototype,{isVector2:!0,set:function(a,d){this.x=a;this.y=d;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,d){switch(a){case 0:this.x=d;break;case 1:this.y=d;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+ a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,d){if(void 0!==d)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,d);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,d){this.x=a.x+d.x;this.y=a.y+d.y;return this},addScaledVector:function(a,d){this.x+=a.x*d;this.y+=a.y*d;return this}, sub:function(a,d){if(void 0!==d)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,d);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,d){this.x=a.x-d.x;this.y=a.y-d.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},applyMatrix3:function(a){var d=this.x,f=this.y;a=a.elements;this.x=a[0]*d+a[3]*f+a[6];this.y=a[1]*d+a[4]*f+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,d){this.x=Math.max(a.x,Math.min(d.x,this.x));this.y=Math.max(a.y,Math.min(d.y,this.y));return this},clampScalar:function(a,d){this.x=Math.max(a,Math.min(d,this.x));this.y=Math.max(a,Math.min(d, this.y));return this},clampLength:function(a,d){var f=this.length();return this.divideScalar(f||1).multiplyScalar(Math.max(a,Math.min(d,f)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y); return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.x},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 a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a}, distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var d=this.x-a.x;a=this.y-a.y;return d*d+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,d){this.x+=(a.x-this.x)*d;this.y+=(a.y-this.y)*d;return this},lerpVectors:function(a,d,f){return this.subVectors(d,a).multiplyScalar(f).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y}, fromArray:function(a,d){void 0===d&&(d=0);this.x=a[d];this.y=a[d+1];return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);a[d]=this.x;a[d+1]=this.y;return a},fromBufferAttribute:function(a,d,f){void 0!==f&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(d);this.y=a.getY(d);return this},rotateAround:function(a,d){var f=Math.cos(d);d=Math.sin(d);var h=this.x-a.x,r=this.y-a.y;this.x=h*f-r*d+a.x;this.y=h*d+r*f+a.y;return this}});Object.assign(g, {slerp:function(a,d,f,h){return f.copy(a).slerp(d,h)},slerpFlat:function(a,d,f,h,r,u,w){var B=f[h+0],C=f[h+1],G=f[h+2];f=f[h+3];h=r[u+0];var K=r[u+1],L=r[u+2];r=r[u+3];if(f!==r||B!==h||C!==K||G!==L){u=1-w;var M=B*h+C*K+G*L+f*r,R=0<=M?1:-1,S=1-M*M;S>Number.EPSILON&&(S=Math.sqrt(S),M=Math.atan2(S,M*R),u=Math.sin(u*M)/S,w=Math.sin(w*M)/S);R*=w;B=B*u+h*R;C=C*u+K*R;G=G*u+L*R;f=f*u+r*R;u===1-w&&(w=1/Math.sqrt(B*B+C*C+G*G+f*f),B*=w,C*=w,G*=w,f*=w)}a[d]=B;a[d+1]=C;a[d+2]=G;a[d+3]=f}});Object.defineProperties(g.prototype, {x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this._onChangeCallback()}}});Object.assign(g.prototype,{isQuaternion:!0,set:function(a,d,f,h){this._x=a;this._y=d;this._z=f;this._w=h;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x, this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this._onChangeCallback();return this},setFromEuler:function(a,d){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var f=a._x,h=a._y,r=a._z;a=a.order;var u=Math.cos,w=Math.sin,B=u(f/2),C=u(h/2);u=u(r/2);f=w(f/2);h=w(h/2);r=w(r/2);"XYZ"===a?(this._x=f*C*u+B*h*r,this._y=B*h*u-f*C*r,this._z=B*C*r+f*h*u,this._w=B*C*u-f*h*r):"YXZ"=== a?(this._x=f*C*u+B*h*r,this._y=B*h*u-f*C*r,this._z=B*C*r-f*h*u,this._w=B*C*u+f*h*r):"ZXY"===a?(this._x=f*C*u-B*h*r,this._y=B*h*u+f*C*r,this._z=B*C*r+f*h*u,this._w=B*C*u-f*h*r):"ZYX"===a?(this._x=f*C*u-B*h*r,this._y=B*h*u+f*C*r,this._z=B*C*r-f*h*u,this._w=B*C*u+f*h*r):"YZX"===a?(this._x=f*C*u+B*h*r,this._y=B*h*u+f*C*r,this._z=B*C*r-f*h*u,this._w=B*C*u-f*h*r):"XZY"===a&&(this._x=f*C*u-B*h*r,this._y=B*h*u-f*C*r,this._z=B*C*r+f*h*u,this._w=B*C*u+f*h*r);!1!==d&&this._onChangeCallback();return this},setFromAxisAngle:function(a, d){d/=2;var f=Math.sin(d);this._x=a.x*f;this._y=a.y*f;this._z=a.z*f;this._w=Math.cos(d);this._onChangeCallback();return this},setFromRotationMatrix:function(a){var d=a.elements,f=d[0];a=d[4];var h=d[8],r=d[1],u=d[5],w=d[9],B=d[2],C=d[6];d=d[10];var G=f+u+d;0<G?(f=.5/Math.sqrt(G+1),this._w=.25/f,this._x=(C-w)*f,this._y=(h-B)*f,this._z=(r-a)*f):f>u&&f>d?(f=2*Math.sqrt(1+f-u-d),this._w=(C-w)/f,this._x=.25*f,this._y=(a+r)/f,this._z=(h+B)/f):u>d?(f=2*Math.sqrt(1+u-f-d),this._w=(h-B)/f,this._x=(a+r)/f, this._y=.25*f,this._z=(w+C)/f):(f=2*Math.sqrt(1+d-f-u),this._w=(r-a)/f,this._x=(h+B)/f,this._y=(w+C)/f,this._z=.25*f);this._onChangeCallback();return this},setFromUnitVectors:function(a,d){var f=a.dot(d)+1;1E-6>f?(f=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*d.z-a.z*d.y,this._y=a.z*d.x-a.x*d.z,this._z=a.x*d.y-a.y*d.x);this._w=f;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(bb.clamp(this.dot(a),-1, 1)))},rotateTowards:function(a,d){var f=this.angleTo(a);if(0===f)return this;this.slerp(a,Math.min(1,d/f));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._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 a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this._onChangeCallback();return this},multiply:function(a,d){return void 0!==d?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,d)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a, d){var f=a._x,h=a._y,r=a._z;a=a._w;var u=d._x,w=d._y,B=d._z;d=d._w;this._x=f*d+a*u+h*B-r*w;this._y=h*d+a*w+r*u-f*B;this._z=r*d+a*B+f*w-h*u;this._w=a*d-f*u-h*w-r*B;this._onChangeCallback();return this},slerp:function(a,d){if(0===d)return this;if(1===d)return this.copy(a);var f=this._x,h=this._y,r=this._z,u=this._w,w=u*a._w+f*a._x+h*a._y+r*a._z;0>w?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,w=-w):this.copy(a);if(1<=w)return this._w=u,this._x=f,this._y=h,this._z=r,this;a=1-w*w;if(a<=Number.EPSILON)return w= 1-d,this._w=w*u+d*this._w,this._x=w*f+d*this._x,this._y=w*h+d*this._y,this._z=w*r+d*this._z,this.normalize(),this._onChangeCallback(),this;a=Math.sqrt(a);var B=Math.atan2(a,w);w=Math.sin((1-d)*B)/a;d=Math.sin(d*B)/a;this._w=u*w+this._w*d;this._x=f*w+this._x*d;this._y=h*w+this._y*d;this._z=r*w+this._z*d;this._onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,d){void 0===d&&(d=0);this._x=a[d];this._y=a[d+1]; this._z=a[d+2];this._w=a[d+3];this._onChangeCallback();return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);a[d]=this._x;a[d+1]=this._y;a[d+2]=this._z;a[d+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var Dk=new k,Bn=new g;Object.assign(k.prototype,{isVector3:!0,set:function(a,d,f){this.x=a;this.y=d;this.z=f;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this}, setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,d){switch(a){case 0:this.x=d;break;case 1:this.y=d;break;case 2:this.z=d;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y; this.z=a.z;return this},add:function(a,d){if(void 0!==d)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,d);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.z;return this},addScaledVector:function(a,d){this.x+=a.x*d;this.y+=a.y*d;this.z+=a.z*d;return this},sub:function(a,d){if(void 0!==d)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,d);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;return this},multiply:function(a,d){if(void 0!==d)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,d);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*= a;return this},multiplyVectors:function(a,d){this.x=a.x*d.x;this.y=a.y*d.y;this.z=a.z*d.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(Bn.setFromEuler(a))},applyAxisAngle:function(a,d){return this.applyQuaternion(Bn.setFromAxisAngle(a,d))},applyMatrix3:function(a){var d=this.x,f=this.y,h=this.z;a=a.elements;this.x=a[0]*d+a[3]*f+a[6]*h;this.y=a[1]*d+a[4]*f+a[7]* h;this.z=a[2]*d+a[5]*f+a[8]*h;return this},applyMatrix4:function(a){var d=this.x,f=this.y,h=this.z;a=a.elements;var r=1/(a[3]*d+a[7]*f+a[11]*h+a[15]);this.x=(a[0]*d+a[4]*f+a[8]*h+a[12])*r;this.y=(a[1]*d+a[5]*f+a[9]*h+a[13])*r;this.z=(a[2]*d+a[6]*f+a[10]*h+a[14])*r;return this},applyQuaternion:function(a){var d=this.x,f=this.y,h=this.z,r=a.x,u=a.y,w=a.z;a=a.w;var B=a*d+u*h-w*f,C=a*f+w*d-r*h,G=a*h+r*f-u*d;d=-r*d-u*f-w*h;this.x=B*a+d*-r+C*-w-G*-u;this.y=C*a+d*-u+G*-r-B*-w;this.z=G*a+d*-w+B*-u-C*-r;return this}, project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var d=this.x,f=this.y,h=this.z;a=a.elements;this.x=a[0]*d+a[4]*f+a[8]*h;this.y=a[1]*d+a[5]*f+a[9]*h;this.z=a[2]*d+a[6]*f+a[10]*h;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,d){this.x=Math.max(a.x,Math.min(d.x,this.x));this.y=Math.max(a.y,Math.min(d.y,this.y));this.z=Math.max(a.z,Math.min(d.z,this.z));return this},clampScalar:function(a,d){this.x=Math.max(a,Math.min(d,this.x));this.y=Math.max(a,Math.min(d,this.y));this.z=Math.max(a, Math.min(d,this.z));return this},clampLength:function(a,d){var f=this.length();return this.divideScalar(f||1).multiplyScalar(Math.max(a,Math.min(d,f)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= 0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){return this.normalize().multiplyScalar(a)},lerp:function(a,d){this.x+=(a.x-this.x)*d;this.y+=(a.y-this.y)*d;this.z+=(a.z-this.z)*d;return this},lerpVectors:function(a,d,f){return this.subVectors(d,a).multiplyScalar(f).add(a)},cross:function(a,d){return void 0!==d?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,d)):this.crossVectors(this, a)},crossVectors:function(a,d){var f=a.x,h=a.y;a=a.z;var r=d.x,u=d.y;d=d.z;this.x=h*d-a*u;this.y=a*r-f*d;this.z=f*u-h*r;return this},projectOnVector:function(a){var d=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(d)},projectOnPlane:function(a){Dk.copy(this).projectOnVector(a);return this.sub(Dk)},reflect:function(a){return this.sub(Dk.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){return Math.acos(bb.clamp(this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq()),-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, distanceToSquared:function(a){var d=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return d*d+f*f+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,d,f){var h=Math.sin(d)*a;this.x=h*Math.sin(f);this.y=Math.cos(d)*a;this.z=h*Math.cos(f);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta, a.y)},setFromCylindricalCoords:function(a,d,f){this.x=a*Math.sin(d);this.y=f;this.z=a*Math.cos(d);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var d=this.setFromMatrixColumn(a,0).length(),f=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=d;this.y=f;this.z=a;return this},setFromMatrixColumn:function(a,d){return this.fromArray(a.elements,4*d)},equals:function(a){return a.x=== this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,d){void 0===d&&(d=0);this.x=a[d];this.y=a[d+1];this.z=a[d+2];return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);a[d]=this.x;a[d+1]=this.y;a[d+2]=this.z;return a},fromBufferAttribute:function(a,d,f){void 0!==f&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(d);this.y=a.getY(d);this.z=a.getZ(d);return this}});var Qe=new k;Object.assign(q.prototype,{isMatrix3:!0,set:function(a, d,f,h,r,u,w,B,C){var G=this.elements;G[0]=a;G[1]=h;G[2]=w;G[3]=d;G[4]=r;G[5]=B;G[6]=f;G[7]=u;G[8]=C;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var d=this.elements;a=a.elements;d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];d[4]=a[4];d[5]=a[5];d[6]=a[6];d[7]=a[7];d[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this}, applyToBufferAttribute:function(a){for(var d=0,f=a.count;d<f;d++)Qe.x=a.getX(d),Qe.y=a.getY(d),Qe.z=a.getZ(d),Qe.applyMatrix3(this),a.setXYZ(d,Qe.x,Qe.y,Qe.z);return a},multiply:function(a){return this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,d){var f=a.elements,h=d.elements;d=this.elements;a=f[0];var r=f[3],u=f[6],w=f[1],B=f[4],C=f[7],G=f[2],K=f[5];f=f[8];var L=h[0],M=h[3],R=h[6],S=h[1],X=h[4],W=h[7],ja=h[2],ha=h[5];h=h[8]; d[0]=a*L+r*S+u*ja;d[3]=a*M+r*X+u*ha;d[6]=a*R+r*W+u*h;d[1]=w*L+B*S+C*ja;d[4]=w*M+B*X+C*ha;d[7]=w*R+B*W+C*h;d[2]=G*L+K*S+f*ja;d[5]=G*M+K*X+f*ha;d[8]=G*R+K*W+f*h;return this},multiplyScalar:function(a){var d=this.elements;d[0]*=a;d[3]*=a;d[6]*=a;d[1]*=a;d[4]*=a;d[7]*=a;d[2]*=a;d[5]*=a;d[8]*=a;return this},determinant:function(){var a=this.elements,d=a[0],f=a[1],h=a[2],r=a[3],u=a[4],w=a[5],B=a[6],C=a[7];a=a[8];return d*u*a-d*w*C-f*r*a+f*w*B+h*r*C-h*u*B},getInverse:function(a,d){a&&a.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument."); var f=a.elements;a=this.elements;var h=f[0],r=f[1],u=f[2],w=f[3],B=f[4],C=f[5],G=f[6],K=f[7];f=f[8];var L=f*B-C*K,M=C*G-f*w,R=K*w-B*G,S=h*L+r*M+u*R;if(0===S){if(!0===d)throw Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");console.warn("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}d=1/S;a[0]=L*d;a[1]=(u*K-f*r)*d;a[2]=(C*r-u*B)*d;a[3]=M*d;a[4]=(f*h-u*G)*d;a[5]=(u*w-C*h)*d;a[6]=R*d;a[7]=(r*G-K*h)*d;a[8]=(B*h-r*w)*d;return this}, transpose:function(){var a=this.elements;var d=a[1];a[1]=a[3];a[3]=d;d=a[2];a[2]=a[6];a[6]=d;d=a[5];a[5]=a[7];a[7]=d;return this},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var d=this.elements;a[0]=d[0];a[1]=d[3];a[2]=d[6];a[3]=d[1];a[4]=d[4];a[5]=d[7];a[6]=d[2];a[7]=d[5];a[8]=d[8];return this},setUvTransform:function(a,d,f,h,r,u,w){var B=Math.cos(r);r=Math.sin(r);this.set(f*B,f*r,-f*(B*u+r*w)+u+a,-h*r,h*B,-h*(-r*u+B*w)+w+ d,0,0,1)},scale:function(a,d){var f=this.elements;f[0]*=a;f[3]*=a;f[6]*=a;f[1]*=d;f[4]*=d;f[7]*=d;return this},rotate:function(a){var d=Math.cos(a);a=Math.sin(a);var f=this.elements,h=f[0],r=f[3],u=f[6],w=f[1],B=f[4],C=f[7];f[0]=d*h+a*w;f[3]=d*r+a*B;f[6]=d*u+a*C;f[1]=-a*h+d*w;f[4]=-a*r+d*B;f[7]=-a*u+d*C;return this},translate:function(a,d){var f=this.elements;f[0]+=a*f[2];f[3]+=a*f[5];f[6]+=a*f[8];f[1]+=d*f[2];f[4]+=d*f[5];f[7]+=d*f[8];return this},equals:function(a){var d=this.elements;a=a.elements; for(var f=0;9>f;f++)if(d[f]!==a[f])return!1;return!0},fromArray:function(a,d){void 0===d&&(d=0);for(var f=0;9>f;f++)this.elements[f]=a[f+d];return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);var f=this.elements;a[d]=f[0];a[d+1]=f[1];a[d+2]=f[2];a[d+3]=f[3];a[d+4]=f[4];a[d+5]=f[5];a[d+6]=f[6];a[d+7]=f[7];a[d+8]=f[8];return a}});var bg,je={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===bg&&(bg=document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"));bg.width=a.width;bg.height=a.height;var d=bg.getContext("2d");a instanceof ImageData?d.putImageData(a,0,0):d.drawImage(a,0,0,a.width,a.height);a=bg}return 2048<a.width||2048<a.height?a.toDataURL("image/jpeg",.6):a.toDataURL("image/png")}},$p=0;l.DEFAULT_IMAGE=void 0;l.DEFAULT_MAPPING=300;l.prototype=Object.assign(Object.create(c.prototype),{constructor:l,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation, this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name;this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.center.copy(a.center);this.rotation=a.rotation;this.matrixAutoUpdate=a.matrixAutoUpdate; this.matrix.copy(a.matrix);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment;this.encoding=a.encoding;return this},toJSON:function(a){var d=void 0===a||"string"===typeof a;if(!d&&void 0!==a.textures[this.uuid])return a.textures[this.uuid];var f={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x, this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var h=this.image;void 0===h.uuid&&(h.uuid=bb.generateUUID());if(!d&&void 0===a.images[h.uuid]){if(Array.isArray(h)){var r=[];for(var u=0,w=h.length;u< w;u++)r.push(je.getDataURL(h[u]))}else r=je.getDataURL(h);a.images[h.uuid]={uuid:h.uuid,url:r}}f.image=h.uuid}d||(a.textures[this.uuid]=f);return f},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(a){if(300!==this.mapping)return a;a.applyMatrix3(this.matrix);if(0>a.x||1<a.x)switch(this.wrapS){case 1E3:a.x-=Math.floor(a.x);break;case 1001:a.x=0>a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1<a.y)switch(this.wrapT){case 1E3:a.y-= Math.floor(a.y);break;case 1001:a.y=0>a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(l.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.defineProperties(m.prototype,{width:{get:function(){return this.z},set:function(a){this.z=a}},height:{get:function(){return this.w},set:function(a){this.w=a}}});Object.assign(m.prototype,{isVector4:!0,set:function(a,d,f,h){this.x= a;this.y=d;this.z=f;this.w=h;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,d){switch(a){case 0:this.x=d;break;case 1:this.y=d;break;case 2:this.z=d;break;case 3:this.w=d;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,d){if(void 0!==d)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,d);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this}, addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.z;this.w=a.w+d.w;return this},addScaledVector:function(a,d){this.x+=a.x*d;this.y+=a.y*d;this.z+=a.z*d;this.w+=a.w*d;return this},sub:function(a,d){if(void 0!==d)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,d);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-= a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;this.w=a.w-d.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var d=this.x,f=this.y,h=this.z,r=this.w;a=a.elements;this.x=a[0]*d+a[4]*f+a[8]*h+a[12]*r;this.y=a[1]*d+a[5]*f+a[9]*h+a[13]*r;this.z=a[2]*d+a[6]*f+a[10]*h+a[14]*r;this.w=a[3]*d+a[7]*f+a[11]*h+a[15]*r;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var d=Math.sqrt(1-a.w*a.w);1E-4>d?(this.x=1,this.z=this.y=0):(this.x=a.x/d,this.y=a.y/d,this.z=a.z/d);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var d=a[0];var f=a[4];var h=a[8],r=a[1],u=a[5],w=a[9];var B=a[2];var C=a[6];var G=a[10];if(.01>Math.abs(f-r)&&.01>Math.abs(h-B)&&.01>Math.abs(w-C)){if(.1>Math.abs(f+r)&&.1>Math.abs(h+B)&&.1>Math.abs(w+C)&&.1>Math.abs(d+u+G-3))return this.set(1,0,0,0),this;a=Math.PI; d=(d+1)/2;u=(u+1)/2;G=(G+1)/2;f=(f+r)/4;h=(h+B)/4;w=(w+C)/4;d>u&&d>G?.01>d?(C=0,f=B=.707106781):(C=Math.sqrt(d),B=f/C,f=h/C):u>G?.01>u?(C=.707106781,B=0,f=.707106781):(B=Math.sqrt(u),C=f/B,f=w/B):.01>G?(B=C=.707106781,f=0):(f=Math.sqrt(G),C=h/f,B=w/f);this.set(C,B,f,a);return this}a=Math.sqrt((C-w)*(C-w)+(h-B)*(h-B)+(r-f)*(r-f));.001>Math.abs(a)&&(a=1);this.x=(C-w)/a;this.y=(h-B)/a;this.z=(r-f)/a;this.w=Math.acos((d+u+G-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,d){this.x=Math.max(a.x,Math.min(d.x,this.x));this.y=Math.max(a.y,Math.min(d.y,this.y));this.z=Math.max(a.z,Math.min(d.z,this.z));this.w=Math.max(a.w,Math.min(d.w,this.w));return this},clampScalar:function(a,d){this.x=Math.max(a,Math.min(d,this.x));this.y=Math.max(a,Math.min(d, this.y));this.z=Math.max(a,Math.min(d,this.z));this.w=Math.max(a,Math.min(d,this.w));return this},clampLength:function(a,d){var f=this.length();return this.divideScalar(f||1).multiplyScalar(Math.max(a,Math.min(d,f)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x= Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z* a.z+this.w*a.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(a){return this.normalize().multiplyScalar(a)},lerp:function(a,d){this.x+=(a.x-this.x)*d;this.y+=(a.y-this.y)*d;this.z+=(a.z- this.z)*d;this.w+=(a.w-this.w)*d;return this},lerpVectors:function(a,d,f){return this.subVectors(d,a).multiplyScalar(f).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,d){void 0===d&&(d=0);this.x=a[d];this.y=a[d+1];this.z=a[d+2];this.w=a[d+3];return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);a[d]=this.x;a[d+1]=this.y;a[d+2]=this.z;a[d+3]=this.w;return a},fromBufferAttribute:function(a,d,f){void 0!==f&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."); this.x=a.getX(d);this.y=a.getY(d);this.z=a.getZ(d);this.w=a.getW(d);return this}});p.prototype=Object.assign(Object.create(c.prototype),{constructor:p,isWebGLRenderTarget:!0,setSize:function(a,d){if(this.width!==a||this.height!==d)this.width=a,this.height=d,this.texture.image.width=a,this.texture.image.height=d,this.dispose();this.viewport.set(0,0,a,d);this.scissor.set(0,0,a,d)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport); this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});n.prototype=Object.assign(Object.create(p.prototype),{constructor:n,isWebGLMultisampleRenderTarget:!0,copy:function(a){p.prototype.copy.call(this,a);this.samples=a.samples;return this}});var Bc=new k,Wb=new t,Kr=new k(0,0,0),Lr=new k(1,1,1),ke=new k,Ni=new k,qc=new k;Object.assign(t.prototype,{isMatrix4:!0, set:function(a,d,f,h,r,u,w,B,C,G,K,L,M,R,S,X){var W=this.elements;W[0]=a;W[4]=d;W[8]=f;W[12]=h;W[1]=r;W[5]=u;W[9]=w;W[13]=B;W[2]=C;W[6]=G;W[10]=K;W[14]=L;W[3]=M;W[7]=R;W[11]=S;W[15]=X;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new t).fromArray(this.elements)},copy:function(a){var d=this.elements;a=a.elements;d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];d[4]=a[4];d[5]=a[5];d[6]=a[6];d[7]=a[7];d[8]=a[8];d[9]=a[9];d[10]=a[10];d[11]=a[11]; d[12]=a[12];d[13]=a[13];d[14]=a[14];d[15]=a[15];return this},copyPosition:function(a){var d=this.elements;a=a.elements;d[12]=a[12];d[13]=a[13];d[14]=a[14];return this},extractBasis:function(a,d,f){a.setFromMatrixColumn(this,0);d.setFromMatrixColumn(this,1);f.setFromMatrixColumn(this,2);return this},makeBasis:function(a,d,f){this.set(a.x,d.x,f.x,0,a.y,d.y,f.y,0,a.z,d.z,f.z,0,0,0,0,1);return this},extractRotation:function(a){var d=this.elements,f=a.elements,h=1/Bc.setFromMatrixColumn(a,0).length(), r=1/Bc.setFromMatrixColumn(a,1).length();a=1/Bc.setFromMatrixColumn(a,2).length();d[0]=f[0]*h;d[1]=f[1]*h;d[2]=f[2]*h;d[3]=0;d[4]=f[4]*r;d[5]=f[5]*r;d[6]=f[6]*r;d[7]=0;d[8]=f[8]*a;d[9]=f[9]*a;d[10]=f[10]*a;d[11]=0;d[12]=0;d[13]=0;d[14]=0;d[15]=1;return this},makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var d=this.elements,f=a.x,h=a.y,r=a.z,u=Math.cos(f);f=Math.sin(f);var w=Math.cos(h); h=Math.sin(h);var B=Math.cos(r);r=Math.sin(r);if("XYZ"===a.order){a=u*B;var C=u*r,G=f*B,K=f*r;d[0]=w*B;d[4]=-w*r;d[8]=h;d[1]=C+G*h;d[5]=a-K*h;d[9]=-f*w;d[2]=K-a*h;d[6]=G+C*h;d[10]=u*w}else"YXZ"===a.order?(a=w*B,C=w*r,G=h*B,K=h*r,d[0]=a+K*f,d[4]=G*f-C,d[8]=u*h,d[1]=u*r,d[5]=u*B,d[9]=-f,d[2]=C*f-G,d[6]=K+a*f,d[10]=u*w):"ZXY"===a.order?(a=w*B,C=w*r,G=h*B,K=h*r,d[0]=a-K*f,d[4]=-u*r,d[8]=G+C*f,d[1]=C+G*f,d[5]=u*B,d[9]=K-a*f,d[2]=-u*h,d[6]=f,d[10]=u*w):"ZYX"===a.order?(a=u*B,C=u*r,G=f*B,K=f*r,d[0]=w*B, d[4]=G*h-C,d[8]=a*h+K,d[1]=w*r,d[5]=K*h+a,d[9]=C*h-G,d[2]=-h,d[6]=f*w,d[10]=u*w):"YZX"===a.order?(a=u*w,C=u*h,G=f*w,K=f*h,d[0]=w*B,d[4]=K-a*r,d[8]=G*r+C,d[1]=r,d[5]=u*B,d[9]=-f*B,d[2]=-h*B,d[6]=C*r+G,d[10]=a-K*r):"XZY"===a.order&&(a=u*w,C=u*h,G=f*w,K=f*h,d[0]=w*B,d[4]=-r,d[8]=h*B,d[1]=a*r+K,d[5]=u*B,d[9]=C*r-G,d[2]=G*r-C,d[6]=f*B,d[10]=K*r+a);d[3]=0;d[7]=0;d[11]=0;d[12]=0;d[13]=0;d[14]=0;d[15]=1;return this},makeRotationFromQuaternion:function(a){return this.compose(Kr,a,Lr)},lookAt:function(a,d, f){var h=this.elements;qc.subVectors(a,d);0===qc.lengthSq()&&(qc.z=1);qc.normalize();ke.crossVectors(f,qc);0===ke.lengthSq()&&(1===Math.abs(f.z)?qc.x+=1E-4:qc.z+=1E-4,qc.normalize(),ke.crossVectors(f,qc));ke.normalize();Ni.crossVectors(qc,ke);h[0]=ke.x;h[4]=Ni.x;h[8]=qc.x;h[1]=ke.y;h[5]=Ni.y;h[9]=qc.y;h[2]=ke.z;h[6]=Ni.z;h[10]=qc.z;return this},multiply:function(a,d){return void 0!==d?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(a,d)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,d){var f=a.elements,h=d.elements;d=this.elements;a=f[0];var r=f[4],u=f[8],w=f[12],B=f[1],C=f[5],G=f[9],K=f[13],L=f[2],M=f[6],R=f[10],S=f[14],X=f[3],W=f[7],ja=f[11];f=f[15];var ha=h[0],ia=h[4],ma=h[8],fa=h[12],la=h[1],qa=h[5],Ka=h[9],La=h[13],ra=h[2],ua=h[6],sa=h[10],Ca=h[14],Za=h[3],ob=h[7],za=h[11];h=h[15];d[0]=a*ha+r*la+u*ra+w*Za;d[4]=a*ia+r*qa+u*ua+ w*ob;d[8]=a*ma+r*Ka+u*sa+w*za;d[12]=a*fa+r*La+u*Ca+w*h;d[1]=B*ha+C*la+G*ra+K*Za;d[5]=B*ia+C*qa+G*ua+K*ob;d[9]=B*ma+C*Ka+G*sa+K*za;d[13]=B*fa+C*La+G*Ca+K*h;d[2]=L*ha+M*la+R*ra+S*Za;d[6]=L*ia+M*qa+R*ua+S*ob;d[10]=L*ma+M*Ka+R*sa+S*za;d[14]=L*fa+M*La+R*Ca+S*h;d[3]=X*ha+W*la+ja*ra+f*Za;d[7]=X*ia+W*qa+ja*ua+f*ob;d[11]=X*ma+W*Ka+ja*sa+f*za;d[15]=X*fa+W*La+ja*Ca+f*h;return this},multiplyScalar:function(a){var d=this.elements;d[0]*=a;d[4]*=a;d[8]*=a;d[12]*=a;d[1]*=a;d[5]*=a;d[9]*=a;d[13]*=a;d[2]*=a;d[6]*= a;d[10]*=a;d[14]*=a;d[3]*=a;d[7]*=a;d[11]*=a;d[15]*=a;return this},applyToBufferAttribute:function(a){for(var d=0,f=a.count;d<f;d++)Bc.x=a.getX(d),Bc.y=a.getY(d),Bc.z=a.getZ(d),Bc.applyMatrix4(this),a.setXYZ(d,Bc.x,Bc.y,Bc.z);return a},determinant:function(){var a=this.elements,d=a[0],f=a[4],h=a[8],r=a[12],u=a[1],w=a[5],B=a[9],C=a[13],G=a[2],K=a[6],L=a[10],M=a[14];return a[3]*(+r*B*K-h*C*K-r*w*L+f*C*L+h*w*M-f*B*M)+a[7]*(+d*B*M-d*C*L+r*u*L-h*u*M+h*C*G-r*B*G)+a[11]*(+d*C*K-d*w*M-r*u*K+f*u*M+r*w*G-f* C*G)+a[15]*(-h*w*G-d*B*K+d*w*L+h*u*K-f*u*L+f*B*G)},transpose:function(){var a=this.elements;var d=a[1];a[1]=a[4];a[4]=d;d=a[2];a[2]=a[8];a[8]=d;d=a[6];a[6]=a[9];a[9]=d;d=a[3];a[3]=a[12];a[12]=d;d=a[7];a[7]=a[13];a[13]=d;d=a[11];a[11]=a[14];a[14]=d;return this},setPosition:function(a,d,f){var h=this.elements;a.isVector3?(h[12]=a.x,h[13]=a.y,h[14]=a.z):(h[12]=a,h[13]=d,h[14]=f);return this},getInverse:function(a,d){var f=this.elements,h=a.elements;a=h[0];var r=h[1],u=h[2],w=h[3],B=h[4],C=h[5],G=h[6], K=h[7],L=h[8],M=h[9],R=h[10],S=h[11],X=h[12],W=h[13],ja=h[14];h=h[15];var ha=M*ja*K-W*R*K+W*G*S-C*ja*S-M*G*h+C*R*h,ia=X*R*K-L*ja*K-X*G*S+B*ja*S+L*G*h-B*R*h,ma=L*W*K-X*M*K+X*C*S-B*W*S-L*C*h+B*M*h,fa=X*M*G-L*W*G-X*C*R+B*W*R+L*C*ja-B*M*ja,la=a*ha+r*ia+u*ma+w*fa;if(0===la){if(!0===d)throw Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");console.warn("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}d=1/la;f[0]=ha*d;f[1]=(W*R*w-M*ja* w-W*u*S+r*ja*S+M*u*h-r*R*h)*d;f[2]=(C*ja*w-W*G*w+W*u*K-r*ja*K-C*u*h+r*G*h)*d;f[3]=(M*G*w-C*R*w-M*u*K+r*R*K+C*u*S-r*G*S)*d;f[4]=ia*d;f[5]=(L*ja*w-X*R*w+X*u*S-a*ja*S-L*u*h+a*R*h)*d;f[6]=(X*G*w-B*ja*w-X*u*K+a*ja*K+B*u*h-a*G*h)*d;f[7]=(B*R*w-L*G*w+L*u*K-a*R*K-B*u*S+a*G*S)*d;f[8]=ma*d;f[9]=(X*M*w-L*W*w-X*r*S+a*W*S+L*r*h-a*M*h)*d;f[10]=(B*W*w-X*C*w+X*r*K-a*W*K-B*r*h+a*C*h)*d;f[11]=(L*C*w-B*M*w-L*r*K+a*M*K+B*r*S-a*C*S)*d;f[12]=fa*d;f[13]=(L*W*u-X*M*u+X*r*R-a*W*R-L*r*ja+a*M*ja)*d;f[14]=(X*C*u-B*W*u-X*r*G+ a*W*G+B*r*ja-a*C*ja)*d;f[15]=(B*M*u-L*C*u+L*r*G-a*M*G-B*r*R+a*C*R)*d;return this},scale:function(a){var d=this.elements,f=a.x,h=a.y;a=a.z;d[0]*=f;d[4]*=h;d[8]*=a;d[1]*=f;d[5]*=h;d[9]*=a;d[2]*=f;d[6]*=h;d[10]*=a;d[3]*=f;d[7]*=h;d[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,d,f){this.set(1,0,0,a,0,1,0,d,0,0,1,f,0,0,0,1);return this}, makeRotationX:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,d,-a,0,0,a,d,0,0,0,0,1);return this},makeRotationY:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,0,a,0,0,1,0,0,-a,0,d,0,0,0,0,1);return this},makeRotationZ:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,-a,0,0,a,d,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,d){var f=Math.cos(d);d=Math.sin(d);var h=1-f,r=a.x,u=a.y;a=a.z;var w=h*r,B=h*u;this.set(w*r+f,w*u-d*a,w*a+d*u,0,w*u+d*a,B*u+f,B*a-d* r,0,w*a-d*u,B*a+d*r,h*a*a+f,0,0,0,0,1);return this},makeScale:function(a,d,f){this.set(a,0,0,0,0,d,0,0,0,0,f,0,0,0,0,1);return this},makeShear:function(a,d,f){this.set(1,d,f,0,a,1,f,0,a,d,1,0,0,0,0,1);return this},compose:function(a,d,f){var h=this.elements,r=d._x,u=d._y,w=d._z,B=d._w,C=r+r,G=u+u,K=w+w;d=r*C;var L=r*G;r*=K;var M=u*G;u*=K;w*=K;C*=B;G*=B;B*=K;K=f.x;var R=f.y;f=f.z;h[0]=(1-(M+w))*K;h[1]=(L+B)*K;h[2]=(r-G)*K;h[3]=0;h[4]=(L-B)*R;h[5]=(1-(d+w))*R;h[6]=(u+C)*R;h[7]=0;h[8]=(r+G)*f;h[9]=(u- C)*f;h[10]=(1-(d+M))*f;h[11]=0;h[12]=a.x;h[13]=a.y;h[14]=a.z;h[15]=1;return this},decompose:function(a,d,f){var h=this.elements,r=Bc.set(h[0],h[1],h[2]).length(),u=Bc.set(h[4],h[5],h[6]).length(),w=Bc.set(h[8],h[9],h[10]).length();0>this.determinant()&&(r=-r);a.x=h[12];a.y=h[13];a.z=h[14];Wb.copy(this);a=1/r;h=1/u;var B=1/w;Wb.elements[0]*=a;Wb.elements[1]*=a;Wb.elements[2]*=a;Wb.elements[4]*=h;Wb.elements[5]*=h;Wb.elements[6]*=h;Wb.elements[8]*=B;Wb.elements[9]*=B;Wb.elements[10]*=B;d.setFromRotationMatrix(Wb); f.x=r;f.y=u;f.z=w;return this},makePerspective:function(a,d,f,h,r,u){void 0===u&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var w=this.elements;w[0]=2*r/(d-a);w[4]=0;w[8]=(d+a)/(d-a);w[12]=0;w[1]=0;w[5]=2*r/(f-h);w[9]=(f+h)/(f-h);w[13]=0;w[2]=0;w[6]=0;w[10]=-(u+r)/(u-r);w[14]=-2*u*r/(u-r);w[3]=0;w[7]=0;w[11]=-1;w[15]=0;return this},makeOrthographic:function(a,d,f,h,r,u){var w=this.elements,B=1/(d-a),C=1/(f-h),G=1/(u-r);w[0]= 2*B;w[4]=0;w[8]=0;w[12]=-((d+a)*B);w[1]=0;w[5]=2*C;w[9]=0;w[13]=-((f+h)*C);w[2]=0;w[6]=0;w[10]=-2*G;w[14]=-((u+r)*G);w[3]=0;w[7]=0;w[11]=0;w[15]=1;return this},equals:function(a){var d=this.elements;a=a.elements;for(var f=0;16>f;f++)if(d[f]!==a[f])return!1;return!0},fromArray:function(a,d){void 0===d&&(d=0);for(var f=0;16>f;f++)this.elements[f]=a[f+d];return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);var f=this.elements;a[d]=f[0];a[d+1]=f[1];a[d+2]=f[2];a[d+3]=f[3];a[d+4]=f[4]; a[d+5]=f[5];a[d+6]=f[6];a[d+7]=f[7];a[d+8]=f[8];a[d+9]=f[9];a[d+10]=f[10];a[d+11]=f[11];a[d+12]=f[12];a[d+13]=f[13];a[d+14]=f[14];a[d+15]=f[15];return a}});var Cn=new t,Dn=new g;v.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");v.DefaultOrder="XYZ";Object.defineProperties(v.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z= a;this._onChangeCallback()}},order:{get:function(){return this._order},set:function(a){this._order=a;this._onChangeCallback()}}});Object.assign(v.prototype,{isEuler:!0,set:function(a,d,f,h){this._x=a;this._y=d;this._z=f;this._order=h||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this},setFromRotationMatrix:function(a, d,f){var h=bb.clamp,r=a.elements;a=r[0];var u=r[4],w=r[8],B=r[1],C=r[5],G=r[9],K=r[2],L=r[6];r=r[10];d=d||this._order;"XYZ"===d?(this._y=Math.asin(h(w,-1,1)),.9999999>Math.abs(w)?(this._x=Math.atan2(-G,r),this._z=Math.atan2(-u,a)):(this._x=Math.atan2(L,C),this._z=0)):"YXZ"===d?(this._x=Math.asin(-h(G,-1,1)),.9999999>Math.abs(G)?(this._y=Math.atan2(w,r),this._z=Math.atan2(B,C)):(this._y=Math.atan2(-K,a),this._z=0)):"ZXY"===d?(this._x=Math.asin(h(L,-1,1)),.9999999>Math.abs(L)?(this._y=Math.atan2(-K, r),this._z=Math.atan2(-u,C)):(this._y=0,this._z=Math.atan2(B,a))):"ZYX"===d?(this._y=Math.asin(-h(K,-1,1)),.9999999>Math.abs(K)?(this._x=Math.atan2(L,r),this._z=Math.atan2(B,a)):(this._x=0,this._z=Math.atan2(-u,C))):"YZX"===d?(this._z=Math.asin(h(B,-1,1)),.9999999>Math.abs(B)?(this._x=Math.atan2(-G,C),this._y=Math.atan2(-K,a)):(this._x=0,this._y=Math.atan2(w,r))):"XZY"===d?(this._z=Math.asin(-h(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(L,C),this._y=Math.atan2(w,a)):(this._x=Math.atan2(-G, r),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+d);this._order=d;!1!==f&&this._onChangeCallback();return this},setFromQuaternion:function(a,d,f){Cn.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(Cn,d,f)},setFromVector3:function(a,d){return this.set(a.x,a.y,a.z,d||this._order)},reorder:function(a){Dn.setFromEuler(this);return this.setFromQuaternion(Dn,a)},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order=== this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);a[d]=this._x;a[d+1]=this._y;a[d+2]=this._z;a[d+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new k(this._x,this._y,this._z)},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});Object.assign(x.prototype,{set:function(a){this.mask= 1<<a|0},enable:function(a){this.mask=this.mask|1<<a|0},enableAll:function(){this.mask=-1},toggle:function(a){this.mask^=1<<a|0},disable:function(a){this.mask&=~(1<<a|0)},disableAll:function(){this.mask=0},test:function(a){return 0!==(this.mask&a.mask)}});var aq=0,En=new k,cg=new g,Jd=new t,Oi=new k,zh=new k,Mr=new k,Nr=new g,Fn=new k(1,0,0),Gn=new k(0,1,0),Hn=new k(0,0,1),Or={type:"added"},Pr={type:"removed"};y.DefaultUp=new k(0,1,0);y.DefaultMatrixAutoUpdate=!0;y.prototype=Object.assign(Object.create(c.prototype), {constructor:y,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(a){this.matrixAutoUpdate&&this.updateMatrix();this.matrix.premultiply(a);this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(a){this.quaternion.premultiply(a);return this},setRotationFromAxisAngle:function(a,d){this.quaternion.setFromAxisAngle(a,d)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)}, setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(a,d){cg.setFromAxisAngle(a,d);this.quaternion.multiply(cg);return this},rotateOnWorldAxis:function(a,d){cg.setFromAxisAngle(a,d);this.quaternion.premultiply(cg);return this},rotateX:function(a){return this.rotateOnAxis(Fn,a)},rotateY:function(a){return this.rotateOnAxis(Gn,a)},rotateZ:function(a){return this.rotateOnAxis(Hn,a)},translateOnAxis:function(a,d){En.copy(a).applyQuaternion(this.quaternion);this.position.add(En.multiplyScalar(d)); return this},translateX:function(a){return this.translateOnAxis(Fn,a)},translateY:function(a){return this.translateOnAxis(Gn,a)},translateZ:function(a){return this.translateOnAxis(Hn,a)},localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(a){return a.applyMatrix4(Jd.getInverse(this.matrixWorld))},lookAt:function(a,d,f){a.isVector3?Oi.copy(a):Oi.set(a,d,f);a=this.parent;this.updateWorldMatrix(!0,!1);zh.setFromMatrixPosition(this.matrixWorld);this.isCamera||this.isLight? Jd.lookAt(zh,Oi,this.up):Jd.lookAt(Oi,zh,this.up);this.quaternion.setFromRotationMatrix(Jd);a&&(Jd.extractRotation(a.matrixWorld),cg.setFromRotationMatrix(Jd),this.quaternion.premultiply(cg.inverse()))},add:function(a){if(1<arguments.length){for(var d=0;d<arguments.length;d++)this.add(arguments[d]);return this}if(a===this)return console.error("THREE.Object3D.add: object can't be added as a child of itself.",a),this;a&&a.isObject3D?(null!==a.parent&&a.parent.remove(a),a.parent=this,this.children.push(a), a.dispatchEvent(Or)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",a);return this},remove:function(a){if(1<arguments.length){for(var d=0;d<arguments.length;d++)this.remove(arguments[d]);return this}d=this.children.indexOf(a);-1!==d&&(a.parent=null,this.children.splice(d,1),a.dispatchEvent(Pr));return this},attach:function(a){this.updateWorldMatrix(!0,!1);Jd.getInverse(this.matrixWorld);null!==a.parent&&(a.parent.updateWorldMatrix(!0,!1),Jd.multiply(a.parent.matrixWorld)); a.applyMatrix(Jd);a.updateWorldMatrix(!1,!1);this.add(a);return this},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,d){if(this[a]===d)return this;for(var f=0,h=this.children.length;f<h;f++){var r=this.children[f].getObjectByProperty(a,d);if(void 0!==r)return r}},getWorldPosition:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"), a=new k);this.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),a=new g);this.updateMatrixWorld(!0);this.matrixWorld.decompose(zh,a,Mr);return a},getWorldScale:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),a=new k);this.updateMatrixWorld(!0);this.matrixWorld.decompose(zh,Nr,a);return a},getWorldDirection:function(a){void 0=== a&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),a=new k);this.updateMatrixWorld(!0);var d=this.matrixWorld.elements;return a.set(d[8],d[9],d[10]).normalize()},raycast:function(){},traverse:function(a){a(this);for(var d=this.children,f=0,h=d.length;f<h;f++)d[f].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var d=this.children,f=0,h=d.length;f<h;f++)d[f].traverseVisible(a)}},traverseAncestors:function(a){var d=this.parent;null!==d&&(a(d), d.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var d=this.children,f=0,h=d.length;f<h;f++)d[f].updateMatrixWorld(a)},updateWorldMatrix:function(a, d){var f=this.parent;!0===a&&null!==f&&f.updateWorldMatrix(!0,!1);this.matrixAutoUpdate&&this.updateMatrix();null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(!0===d)for(a=this.children,d=0,f=a.length;d<f;d++)a[d].updateWorldMatrix(!1,!0)},toJSON:function(a){function d(K,L){void 0===K[L.uuid]&&(K[L.uuid]=L.toJSON(a));return L.uuid}function f(K){var L=[],M;for(M in K){var R=K[M];delete R.metadata;L.push(R)}return L}var h= void 0===a||"string"===typeof a,r={};h&&(a={geometries:{},materials:{},textures:{},images:{},shapes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var u={};u.uuid=this.uuid;u.type=this.type;""!==this.name&&(u.name=this.name);!0===this.castShadow&&(u.castShadow=!0);!0===this.receiveShadow&&(u.receiveShadow=!0);!1===this.visible&&(u.visible=!1);!1===this.frustumCulled&&(u.frustumCulled=!1);0!==this.renderOrder&&(u.renderOrder=this.renderOrder);"{}"!==JSON.stringify(this.userData)&& (u.userData=this.userData);u.layers=this.layers.mask;u.matrix=this.matrix.toArray();!1===this.matrixAutoUpdate&&(u.matrixAutoUpdate=!1);this.isMesh&&0!==this.drawMode&&(u.drawMode=this.drawMode);if(this.isMesh||this.isLine||this.isPoints){u.geometry=d(a.geometries,this.geometry);var w=this.geometry.parameters;if(void 0!==w&&void 0!==w.shapes)if(w=w.shapes,Array.isArray(w))for(var B=0,C=w.length;B<C;B++)d(a.shapes,w[B]);else d(a.shapes,w)}if(void 0!==this.material)if(Array.isArray(this.material)){w= [];B=0;for(C=this.material.length;B<C;B++)w.push(d(a.materials,this.material[B]));u.material=w}else u.material=d(a.materials,this.material);if(0<this.children.length)for(u.children=[],B=0;B<this.children.length;B++)u.children.push(this.children[B].toJSON(a).object);if(h){h=f(a.geometries);B=f(a.materials);C=f(a.textures);var G=f(a.images);w=f(a.shapes);0<h.length&&(r.geometries=h);0<B.length&&(r.materials=B);0<C.length&&(r.textures=C);0<G.length&&(r.images=G);0<w.length&&(r.shapes=w)}r.object=u;return r}, clone:function(a){return(new this.constructor).copy(this,a)},copy:function(a,d){void 0===d&&(d=!0);this.name=a.name;this.up.copy(a.up);this.position.copy(a.position);this.quaternion.copy(a.quaternion);this.scale.copy(a.scale);this.matrix.copy(a.matrix);this.matrixWorld.copy(a.matrixWorld);this.matrixAutoUpdate=a.matrixAutoUpdate;this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;this.layers.mask=a.layers.mask;this.visible=a.visible;this.castShadow=a.castShadow;this.receiveShadow=a.receiveShadow; this.frustumCulled=a.frustumCulled;this.renderOrder=a.renderOrder;this.userData=JSON.parse(JSON.stringify(a.userData));if(!0===d)for(d=0;d<a.children.length;d++)this.add(a.children[d].clone());return this}});z.prototype=Object.assign(Object.create(y.prototype),{constructor:z,isScene:!0,copy:function(a,d){y.prototype.copy.call(this,a,d);null!==a.background&&(this.background=a.background.clone());null!==a.fog&&(this.fog=a.fog.clone());null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone()); this.autoUpdate=a.autoUpdate;this.matrixAutoUpdate=a.matrixAutoUpdate;return this},toJSON:function(a){var d=y.prototype.toJSON.call(this,a);null!==this.background&&(d.object.background=this.background.toJSON(a));null!==this.fog&&(d.object.fog=this.fog.toJSON());return d},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Kd=[new k,new k,new k,new k,new k,new k,new k,new k],ud=new k,dg=new k,eg=new k,fg=new k,le=new k,me=new k,Re=new k,Ah=new k,Pi=new k,Qi=new k,ve=new k;Object.assign(A.prototype, {isBox3:!0,set:function(a,d){this.min.copy(a);this.max.copy(d);return this},setFromArray:function(a){for(var d=Infinity,f=Infinity,h=Infinity,r=-Infinity,u=-Infinity,w=-Infinity,B=0,C=a.length;B<C;B+=3){var G=a[B],K=a[B+1],L=a[B+2];G<d&&(d=G);K<f&&(f=K);L<h&&(h=L);G>r&&(r=G);K>u&&(u=K);L>w&&(w=L)}this.min.set(d,f,h);this.max.set(r,u,w);return this},setFromBufferAttribute:function(a){for(var d=Infinity,f=Infinity,h=Infinity,r=-Infinity,u=-Infinity,w=-Infinity,B=0,C=a.count;B<C;B++){var G=a.getX(B), K=a.getY(B),L=a.getZ(B);G<d&&(d=G);K<f&&(f=K);L<h&&(h=L);G>r&&(r=G);K>u&&(u=K);L>w&&(w=L)}this.min.set(d,f,h);this.max.set(r,u,w);return this},setFromPoints:function(a){this.makeEmpty();for(var d=0,f=a.length;d<f;d++)this.expandByPoint(a[d]);return this},setFromCenterAndSize:function(a,d){d=ud.copy(d).multiplyScalar(.5);this.min.copy(a).sub(d);this.max.copy(a).add(d);return this},setFromObject:function(a){this.makeEmpty();return this.expandByObject(a)},clone:function(){return(new this.constructor).copy(this)}, copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(a){void 0===a&&(console.warn("THREE.Box3: .getCenter() target is now required"),a=new k);return this.isEmpty()?a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){void 0=== a&&(console.warn("THREE.Box3: .getSize() target is now required"),a=new k);return this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},expandByObject:function(a){var d;a.updateWorldMatrix(!1,!1);var f=a.geometry;if(void 0!==f)if(f.isGeometry){var h=f.vertices;f=0;for(d= h.length;f<d;f++)ud.copy(h[f]),ud.applyMatrix4(a.matrixWorld),this.expandByPoint(ud)}else if(f.isBufferGeometry&&(h=f.attributes.position,void 0!==h))for(f=0,d=h.count;f<d;f++)ud.fromBufferAttribute(h,f).applyMatrix4(a.matrixWorld),this.expandByPoint(ud);a=a.children;f=0;for(d=a.length;f<d;f++)this.expandByObject(a[f]);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<= a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,d){void 0===d&&(console.warn("THREE.Box3: .getParameter() target is now required"),d=new k);return d.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z|| a.min.z>this.max.z?!1:!0},intersectsSphere:function(a){this.clampPoint(a.center,ud);return ud.distanceToSquared(a.center)<=a.radius*a.radius},intersectsPlane:function(a){if(0<a.normal.x){var d=a.normal.x*this.min.x;var f=a.normal.x*this.max.x}else d=a.normal.x*this.max.x,f=a.normal.x*this.min.x;0<a.normal.y?(d+=a.normal.y*this.min.y,f+=a.normal.y*this.max.y):(d+=a.normal.y*this.max.y,f+=a.normal.y*this.min.y);0<a.normal.z?(d+=a.normal.z*this.min.z,f+=a.normal.z*this.max.z):(d+=a.normal.z*this.max.z, f+=a.normal.z*this.min.z);return d<=-a.constant&&f>=-a.constant},intersectsTriangle:function(a){if(this.isEmpty())return!1;this.getCenter(Ah);Pi.subVectors(this.max,Ah);dg.subVectors(a.a,Ah);eg.subVectors(a.b,Ah);fg.subVectors(a.c,Ah);le.subVectors(eg,dg);me.subVectors(fg,eg);Re.subVectors(dg,fg);a=[0,-le.z,le.y,0,-me.z,me.y,0,-Re.z,Re.y,le.z,0,-le.x,me.z,0,-me.x,Re.z,0,-Re.x,-le.y,le.x,0,-me.y,me.x,0,-Re.y,Re.x,0];if(!D(a,dg,eg,fg,Pi))return!1;a=[1,0,0,0,1,0,0,0,1];if(!D(a,dg,eg,fg,Pi))return!1; Qi.crossVectors(le,me);a=[Qi.x,Qi.y,Qi.z];return D(a,dg,eg,fg,Pi)},clampPoint:function(a,d){void 0===d&&(console.warn("THREE.Box3: .clampPoint() target is now required"),d=new k);return d.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return ud.copy(a).clamp(this.min,this.max).sub(a).length()},getBoundingSphere:function(a){void 0===a&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(a.center);a.radius=.5*this.getSize(ud).length();return a},intersect:function(a){this.min.max(a.min); this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(a){if(this.isEmpty())return this;Kd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);Kd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a);Kd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);Kd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);Kd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);Kd[5].set(this.max.x, this.min.y,this.max.z).applyMatrix4(a);Kd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);Kd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(Kd);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Qr=new A;Object.assign(H.prototype,{set:function(a,d){this.center.copy(a);this.radius=d;return this},setFromPoints:function(a,d){var f=this.center;void 0!==d?f.copy(d): Qr.setFromPoints(a).getCenter(f);for(var h=d=0,r=a.length;h<r;h++)d=Math.max(d,f.distanceToSquared(a[h]));this.radius=Math.sqrt(d);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var d= this.radius+a.radius;return a.center.distanceToSquared(this.center)<=d*d},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,d){var f=this.center.distanceToSquared(a);void 0===d&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),d=new k);d.copy(a);f>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d}, getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new A);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});var Ld=new k,Ek=new k,Ri=new k,ne=new k,Fk=new k,Si=new k,Gk=new k;Object.assign(E.prototype, {set:function(a,d){this.origin.copy(a);this.direction.copy(d);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,d){void 0===d&&(console.warn("THREE.Ray: .at() target is now required"),d=new k);return d.copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(a){this.origin.copy(this.at(a, Ld));return this},closestPointToPoint:function(a,d){void 0===d&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),d=new k);d.subVectors(a,this.origin);a=d.dot(this.direction);return 0>a?d.copy(this.origin):d.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(a){var d=Ld.subVectors(a,this.origin).dot(this.direction);if(0>d)return this.origin.distanceToSquared(a);Ld.copy(this.direction).multiplyScalar(d).add(this.origin); return Ld.distanceToSquared(a)},distanceSqToSegment:function(a,d,f,h){Ek.copy(a).add(d).multiplyScalar(.5);Ri.copy(d).sub(a).normalize();ne.copy(this.origin).sub(Ek);var r=.5*a.distanceTo(d),u=-this.direction.dot(Ri),w=ne.dot(this.direction),B=-ne.dot(Ri),C=ne.lengthSq(),G=Math.abs(1-u*u);if(0<G){a=u*B-w;d=u*w-B;var K=r*G;0<=a?d>=-K?d<=K?(r=1/G,a*=r,d*=r,u=a*(a+u*d+2*w)+d*(u*a+d+2*B)+C):(d=r,a=Math.max(0,-(u*d+w)),u=-a*a+d*(d+2*B)+C):(d=-r,a=Math.max(0,-(u*d+w)),u=-a*a+d*(d+2*B)+C):d<=-K?(a=Math.max(0, -(-u*r+w)),d=0<a?-r:Math.min(Math.max(-r,-B),r),u=-a*a+d*(d+2*B)+C):d<=K?(a=0,d=Math.min(Math.max(-r,-B),r),u=d*(d+2*B)+C):(a=Math.max(0,-(u*r+w)),d=0<a?r:Math.min(Math.max(-r,-B),r),u=-a*a+d*(d+2*B)+C)}else d=0<u?-r:r,a=Math.max(0,-(u*d+w)),u=-a*a+d*(d+2*B)+C;f&&f.copy(this.direction).multiplyScalar(a).add(this.origin);h&&h.copy(Ri).multiplyScalar(d).add(Ek);return u},intersectSphere:function(a,d){Ld.subVectors(a.center,this.origin);var f=Ld.dot(this.direction),h=Ld.dot(Ld)-f*f;a=a.radius*a.radius; if(h>a)return null;a=Math.sqrt(a-h);h=f-a;f+=a;return 0>h&&0>f?null:0>h?this.at(f,d):this.at(h,d)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var d=a.normal.dot(this.direction);if(0===d)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/d;return 0<=a?a:null},intersectPlane:function(a,d){a=this.distanceToPlane(a);return null===a?null:this.at(a,d)},intersectsPlane:function(a){var d=a.distanceToPoint(this.origin); return 0===d||0>a.normal.dot(this.direction)*d?!0:!1},intersectBox:function(a,d){var f=1/this.direction.x;var h=1/this.direction.y;var r=1/this.direction.z,u=this.origin;if(0<=f){var w=(a.min.x-u.x)*f;f*=a.max.x-u.x}else w=(a.max.x-u.x)*f,f*=a.min.x-u.x;if(0<=h){var B=(a.min.y-u.y)*h;h*=a.max.y-u.y}else B=(a.max.y-u.y)*h,h*=a.min.y-u.y;if(w>h||B>f)return null;if(B>w||w!==w)w=B;if(h<f||f!==f)f=h;0<=r?(B=(a.min.z-u.z)*r,a=(a.max.z-u.z)*r):(B=(a.max.z-u.z)*r,a=(a.min.z-u.z)*r);if(w>a||B>f)return null; if(B>w||w!==w)w=B;if(a<f||f!==f)f=a;return 0>f?null:this.at(0<=w?w:f,d)},intersectsBox:function(a){return null!==this.intersectBox(a,Ld)},intersectTriangle:function(a,d,f,h,r){Fk.subVectors(d,a);Si.subVectors(f,a);Gk.crossVectors(Fk,Si);d=this.direction.dot(Gk);if(0<d){if(h)return null;h=1}else if(0>d)h=-1,d=-d;else return null;ne.subVectors(this.origin,a);a=h*this.direction.dot(Si.crossVectors(ne,Si));if(0>a)return null;f=h*this.direction.dot(Fk.cross(ne));if(0>f||a+f>d)return null;a=-h*ne.dot(Gk); return 0>a?null:this.at(a/d,r)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var $c=new k,Md=new k,Hk=new k,Nd=new k,gg=new k,hg=new k,In=new k,Ik=new k,Jk=new k,Kk=new k;Object.assign(F,{getNormal:function(a,d,f,h){void 0===h&&(console.warn("THREE.Triangle: .getNormal() target is now required"),h=new k);h.subVectors(f,d);$c.subVectors(a,d);h.cross($c); a=h.lengthSq();return 0<a?h.multiplyScalar(1/Math.sqrt(a)):h.set(0,0,0)},getBarycoord:function(a,d,f,h,r){$c.subVectors(h,d);Md.subVectors(f,d);Hk.subVectors(a,d);a=$c.dot($c);d=$c.dot(Md);f=$c.dot(Hk);var u=Md.dot(Md);h=Md.dot(Hk);var w=a*u-d*d;void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new k);if(0===w)return r.set(-2,-1,-1);w=1/w;u=(u*f-d*h)*w;a=(a*h-d*f)*w;return r.set(1-u-a,a,u)},containsPoint:function(a,d,f,h){F.getBarycoord(a,d,f,h,Nd);return 0<=Nd.x&& 0<=Nd.y&&1>=Nd.x+Nd.y},getUV:function(a,d,f,h,r,u,w,B){this.getBarycoord(a,d,f,h,Nd);B.set(0,0);B.addScaledVector(r,Nd.x);B.addScaledVector(u,Nd.y);B.addScaledVector(w,Nd.z);return B},isFrontFacing:function(a,d,f,h){$c.subVectors(f,d);Md.subVectors(a,d);return 0>$c.cross(Md).dot(h)?!0:!1}});Object.assign(F.prototype,{set:function(a,d,f){this.a.copy(a);this.b.copy(d);this.c.copy(f);return this},setFromPointsAndIndices:function(a,d,f,h){this.a.copy(a[d]);this.b.copy(a[f]);this.c.copy(a[h]);return this}, clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){$c.subVectors(this.c,this.b);Md.subVectors(this.a,this.b);return.5*$c.cross(Md).length()},getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new k);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return F.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0=== a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new k);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,d){return F.getBarycoord(a,this.a,this.b,this.c,d)},getUV:function(a,d,f,h,r){return F.getUV(a,this.a,this.b,this.c,d,f,h,r)},containsPoint:function(a){return F.containsPoint(a,this.a,this.b,this.c)},isFrontFacing:function(a){return F.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a, d){void 0===d&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),d=new k);var f=this.a,h=this.b,r=this.c;gg.subVectors(h,f);hg.subVectors(r,f);Ik.subVectors(a,f);var u=gg.dot(Ik),w=hg.dot(Ik);if(0>=u&&0>=w)return d.copy(f);Jk.subVectors(a,h);var B=gg.dot(Jk),C=hg.dot(Jk);if(0<=B&&C<=B)return d.copy(h);var G=u*C-B*w;if(0>=G&&0<=u&&0>=B)return h=u/(u-B),d.copy(f).addScaledVector(gg,h);Kk.subVectors(a,r);a=gg.dot(Kk);var K=hg.dot(Kk);if(0<=K&&a<=K)return d.copy(r);u=a*w- u*K;if(0>=u&&0<=w&&0>=K)return G=w/(w-K),d.copy(f).addScaledVector(hg,G);w=B*K-a*C;if(0>=w&&0<=C-B&&0<=a-K)return In.subVectors(r,h),G=(C-B)/(C-B+(a-K)),d.copy(h).addScaledVector(In,G);r=1/(w+u+G);h=u*r;G*=r;return d.copy(f).addScaledVector(gg,h).addScaledVector(hg,G)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});var Rr={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},vc={h:0, s:0,l:0},Ti={h:0,s:0,l:0};Object.assign(J.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,d,f){this.r=a;this.g=d;this.b=f;return this},setHSL:function(a,d,f){a=bb.euclideanModulo(a,1);d=bb.clamp(d,0, 1);f=bb.clamp(f,0,1);0===d?this.r=this.g=this.b=f:(d=.5>=f?f*(1+d):f+d-f*d,f=2*f-d,this.r=O(f,d,a+1/3),this.g=O(f,d,a),this.b=O(f,d,a-1/3));return this},setStyle:function(a){function d(w){void 0!==w&&1>parseFloat(w)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var f;if(f=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var h=f[2];switch(f[1]){case "rgb":case "rgba":if(f=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(h))return this.r=Math.min(255,parseInt(f[1], 10))/255,this.g=Math.min(255,parseInt(f[2],10))/255,this.b=Math.min(255,parseInt(f[3],10))/255,d(f[5]),this;if(f=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(h))return this.r=Math.min(100,parseInt(f[1],10))/100,this.g=Math.min(100,parseInt(f[2],10))/100,this.b=Math.min(100,parseInt(f[3],10))/100,d(f[5]),this;break;case "hsl":case "hsla":if(f=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(h)){h=parseFloat(f[1])/360;var r=parseInt(f[2], 10)/100,u=parseInt(f[3],10)/100;d(f[5]);return this.setHSL(h,r,u)}}}else if(f=/^#([A-Fa-f0-9]+)$/.exec(a)){f=f[1];h=f.length;if(3===h)return this.r=parseInt(f.charAt(0)+f.charAt(0),16)/255,this.g=parseInt(f.charAt(1)+f.charAt(1),16)/255,this.b=parseInt(f.charAt(2)+f.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(f.charAt(0)+f.charAt(1),16)/255,this.g=parseInt(f.charAt(2)+f.charAt(3),16)/255,this.b=parseInt(f.charAt(4)+f.charAt(5),16)/255,this}a&&0<a.length&&(f=Rr[a],void 0!==f?this.setHex(f): console.warn("THREE.Color: Unknown color "+a));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a,d){void 0===d&&(d=2);this.r=Math.pow(a.r,d);this.g=Math.pow(a.g,d);this.b=Math.pow(a.b,d);return this},copyLinearToGamma:function(a,d){void 0===d&&(d=2);d=0<d?1/d:1;this.r=Math.pow(a.r,d);this.g=Math.pow(a.g,d);this.b=Math.pow(a.b,d);return this},convertGammaToLinear:function(a){this.copyGammaToLinear(this, a);return this},convertLinearToGamma:function(a){this.copyLinearToGamma(this,a);return this},copySRGBToLinear:function(a){this.r=N(a.r);this.g=N(a.g);this.b=N(a.b);return this},copyLinearToSRGB:function(a){this.r=P(a.r);this.g=P(a.g);this.b=P(a.b);return this},convertSRGBToLinear:function(){this.copySRGBToLinear(this);return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return 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(a){void 0===a&&(console.warn("THREE.Color: .getHSL() target is now required"),a={h:0,s:0,l:0});var d=this.r,f=this.g,h=this.b,r=Math.max(d,f,h),u=Math.min(d,f,h),w,B=(u+r)/2;if(u===r)u=w=0;else{var C=r-u;u=.5>=B?C/(r+u):C/(2-r-u);switch(r){case d:w=(f-h)/C+(f<h?6:0);break;case f:w=(h-d)/C+2;break;case h:w=(d-f)/C+4}w/=6}a.h=w;a.s=u;a.l=B;return a},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a, d,f){this.getHSL(vc);vc.h+=a;vc.s+=d;vc.l+=f;this.setHSL(vc.h,vc.s,vc.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,d){this.r=a.r+d.r;this.g=a.g+d.g;this.b=a.b+d.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},sub:function(a){this.r=Math.max(0,this.r-a.r);this.g=Math.max(0,this.g-a.g);this.b=Math.max(0,this.b-a.b);return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*= a;this.g*=a;this.b*=a;return this},lerp:function(a,d){this.r+=(a.r-this.r)*d;this.g+=(a.g-this.g)*d;this.b+=(a.b-this.b)*d;return this},lerpHSL:function(a,d){this.getHSL(vc);a.getHSL(Ti);a=bb.lerp(vc.h,Ti.h,d);var f=bb.lerp(vc.s,Ti.s,d);d=bb.lerp(vc.l,Ti.l,d);this.setHSL(a,f,d);return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a,d){void 0===d&&(d=0);this.r=a[d];this.g=a[d+1];this.b=a[d+2];return this},toArray:function(a,d){void 0===a&&(a=[]);void 0=== d&&(d=0);a[d]=this.r;a[d+1]=this.g;a[d+2]=this.b;return a},toJSON:function(){return this.getHex()}});Object.assign(V.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a=a.a;this.b=a.b;this.c=a.c;this.normal.copy(a.normal);this.color.copy(a.color);this.materialIndex=a.materialIndex;for(var d=0,f=a.vertexNormals.length;d<f;d++)this.vertexNormals[d]=a.vertexNormals[d].clone();d=0;for(f=a.vertexColors.length;d<f;d++)this.vertexColors[d]=a.vertexColors[d].clone(); return this}});var bq=0;T.prototype=Object.assign(Object.create(c.prototype),{constructor:T,isMaterial:!0,onBeforeCompile:function(){},setValues:function(a){if(void 0!==a)for(var d in a){var f=a[d];if(void 0===f)console.warn("THREE.Material: '"+d+"' parameter is undefined.");else if("shading"===d)console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===f?!0:!1;else{var h=this[d];void 0===h?console.warn("THREE."+this.type+": '"+d+"' is not a property of this material."): h&&h.isColor?h.set(f):h&&h.isVector3&&f&&f.isVector3?h.copy(f):this[d]=f}}},toJSON:function(a){function d(r){var u=[],w;for(w in r){var B=r[w];delete B.metadata;u.push(B)}return u}var f=void 0===a||"string"===typeof a;f&&(a={textures:{},images:{}});var h={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};h.uuid=this.uuid;h.type=this.type;""!==this.name&&(h.name=this.name);this.color&&this.color.isColor&&(h.color=this.color.getHex());void 0!==this.roughness&&(h.roughness=this.roughness); void 0!==this.metalness&&(h.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(h.emissive=this.emissive.getHex());this.emissiveIntensity&&1!==this.emissiveIntensity&&(h.emissiveIntensity=this.emissiveIntensity);this.specular&&this.specular.isColor&&(h.specular=this.specular.getHex());void 0!==this.shininess&&(h.shininess=this.shininess);void 0!==this.clearcoat&&(h.clearcoat=this.clearcoat);void 0!==this.clearcoatRoughness&&(h.clearcoatRoughness=this.clearcoatRoughness);this.clearcoatNormalMap&& this.clearcoatNormalMap.isTexture&&(h.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(a).uuid,h.clearcoatNormalScale=this.clearcoatNormalScale.toArray());this.map&&this.map.isTexture&&(h.map=this.map.toJSON(a).uuid);this.matcap&&this.matcap.isTexture&&(h.matcap=this.matcap.toJSON(a).uuid);this.alphaMap&&this.alphaMap.isTexture&&(h.alphaMap=this.alphaMap.toJSON(a).uuid);this.lightMap&&this.lightMap.isTexture&&(h.lightMap=this.lightMap.toJSON(a).uuid);this.aoMap&&this.aoMap.isTexture&&(h.aoMap=this.aoMap.toJSON(a).uuid, h.aoMapIntensity=this.aoMapIntensity);this.bumpMap&&this.bumpMap.isTexture&&(h.bumpMap=this.bumpMap.toJSON(a).uuid,h.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(h.normalMap=this.normalMap.toJSON(a).uuid,h.normalMapType=this.normalMapType,h.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(h.displacementMap=this.displacementMap.toJSON(a).uuid,h.displacementScale=this.displacementScale,h.displacementBias=this.displacementBias);this.roughnessMap&& this.roughnessMap.isTexture&&(h.roughnessMap=this.roughnessMap.toJSON(a).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&(h.metalnessMap=this.metalnessMap.toJSON(a).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(h.emissiveMap=this.emissiveMap.toJSON(a).uuid);this.specularMap&&this.specularMap.isTexture&&(h.specularMap=this.specularMap.toJSON(a).uuid);this.envMap&&this.envMap.isTexture&&(h.envMap=this.envMap.toJSON(a).uuid,h.reflectivity=this.reflectivity,h.refractionRatio=this.refractionRatio, void 0!==this.combine&&(h.combine=this.combine),void 0!==this.envMapIntensity&&(h.envMapIntensity=this.envMapIntensity));this.gradientMap&&this.gradientMap.isTexture&&(h.gradientMap=this.gradientMap.toJSON(a).uuid);void 0!==this.size&&(h.size=this.size);void 0!==this.sizeAttenuation&&(h.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(h.blending=this.blending);!0===this.flatShading&&(h.flatShading=this.flatShading);0!==this.side&&(h.side=this.side);0!==this.vertexColors&&(h.vertexColors= this.vertexColors);1>this.opacity&&(h.opacity=this.opacity);!0===this.transparent&&(h.transparent=this.transparent);h.depthFunc=this.depthFunc;h.depthTest=this.depthTest;h.depthWrite=this.depthWrite;h.stencilWrite=this.stencilWrite;h.stencilFunc=this.stencilFunc;h.stencilRef=this.stencilRef;h.stencilMask=this.stencilMask;h.stencilFail=this.stencilFail;h.stencilZFail=this.stencilZFail;h.stencilZPass=this.stencilZPass;this.rotation&&0!==this.rotation&&(h.rotation=this.rotation);!0===this.polygonOffset&& (h.polygonOffset=!0);0!==this.polygonOffsetFactor&&(h.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(h.polygonOffsetUnits=this.polygonOffsetUnits);this.linewidth&&1!==this.linewidth&&(h.linewidth=this.linewidth);void 0!==this.dashSize&&(h.dashSize=this.dashSize);void 0!==this.gapSize&&(h.gapSize=this.gapSize);void 0!==this.scale&&(h.scale=this.scale);!0===this.dithering&&(h.dithering=!0);0<this.alphaTest&&(h.alphaTest=this.alphaTest);!0===this.premultipliedAlpha&&(h.premultipliedAlpha= this.premultipliedAlpha);!0===this.wireframe&&(h.wireframe=this.wireframe);1<this.wireframeLinewidth&&(h.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(h.wireframeLinecap=this.wireframeLinecap);"round"!==this.wireframeLinejoin&&(h.wireframeLinejoin=this.wireframeLinejoin);!0===this.morphTargets&&(h.morphTargets=!0);!0===this.morphNormals&&(h.morphNormals=!0);!0===this.skinning&&(h.skinning=!0);!1===this.visible&&(h.visible=!1);!1===this.toneMapped&&(h.toneMapped=!1); "{}"!==JSON.stringify(this.userData)&&(h.userData=this.userData);f&&(f=d(a.textures),a=d(a.images),0<f.length&&(h.textures=f),0<a.length&&(h.images=a));return h},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name;this.fog=a.fog;this.lights=a.lights;this.blending=a.blending;this.side=a.side;this.flatShading=a.flatShading;this.vertexColors=a.vertexColors;this.opacity=a.opacity;this.transparent=a.transparent;this.blendSrc=a.blendSrc;this.blendDst=a.blendDst;this.blendEquation= a.blendEquation;this.blendSrcAlpha=a.blendSrcAlpha;this.blendDstAlpha=a.blendDstAlpha;this.blendEquationAlpha=a.blendEquationAlpha;this.depthFunc=a.depthFunc;this.depthTest=a.depthTest;this.depthWrite=a.depthWrite;this.stencilWrite=a.stencilWrite;this.stencilFunc=a.stencilFunc;this.stencilRef=a.stencilRef;this.stencilMask=a.stencilMask;this.stencilFail=a.stencilFail;this.stencilZFail=a.stencilZFail;this.stencilZPass=a.stencilZPass;this.colorWrite=a.colorWrite;this.precision=a.precision;this.polygonOffset= a.polygonOffset;this.polygonOffsetFactor=a.polygonOffsetFactor;this.polygonOffsetUnits=a.polygonOffsetUnits;this.dithering=a.dithering;this.alphaTest=a.alphaTest;this.premultipliedAlpha=a.premultipliedAlpha;this.visible=a.visible;this.toneMapped=a.toneMapped;this.userData=JSON.parse(JSON.stringify(a.userData));this.clipShadows=a.clipShadows;this.clipIntersection=a.clipIntersection;var d=a.clippingPlanes,f=null;if(null!==d){var h=d.length;f=Array(h);for(var r=0;r!==h;++r)f[r]=d[r].clone()}this.clippingPlanes= f;this.shadowSide=a.shadowSide;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});aa.prototype=Object.create(T.prototype);aa.prototype.constructor=aa;aa.prototype.isMeshBasicMaterial=!0;aa.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap; this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};Object.defineProperty(da.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(da.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.count=void 0!==a?a.length/this.itemSize:0;this.array=a;return this},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.name=a.name;this.array=new a.array.constructor(a.array);this.itemSize=a.itemSize;this.count=a.count;this.normalized=a.normalized;this.dynamic=a.dynamic;return this},copyAt:function(a,d,f){a*=this.itemSize;f*=d.itemSize;for(var h=0,r=this.itemSize;h<r;h++)this.array[a+h]=d.array[f+h];return this},copyArray:function(a){this.array.set(a);return this},copyColorsArray:function(a){for(var d= this.array,f=0,h=0,r=a.length;h<r;h++){var u=a[h];void 0===u&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",h),u=new J);d[f++]=u.r;d[f++]=u.g;d[f++]=u.b}return this},copyVector2sArray:function(a){for(var d=this.array,f=0,h=0,r=a.length;h<r;h++){var u=a[h];void 0===u&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",h),u=new e);d[f++]=u.x;d[f++]=u.y}return this},copyVector3sArray:function(a){for(var d=this.array,f=0,h=0,r=a.length;h<r;h++){var u= a[h];void 0===u&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",h),u=new k);d[f++]=u.x;d[f++]=u.y;d[f++]=u.z}return this},copyVector4sArray:function(a){for(var d=this.array,f=0,h=0,r=a.length;h<r;h++){var u=a[h];void 0===u&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",h),u=new m);d[f++]=u.x;d[f++]=u.y;d[f++]=u.z;d[f++]=u.w}return this},set:function(a,d){void 0===d&&(d=0);this.array.set(a,d);return this},getX:function(a){return this.array[a* this.itemSize]},setX:function(a,d){this.array[a*this.itemSize]=d;return this},getY:function(a){return this.array[a*this.itemSize+1]},setY:function(a,d){this.array[a*this.itemSize+1]=d;return this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,d){this.array[a*this.itemSize+2]=d;return this},getW:function(a){return this.array[a*this.itemSize+3]},setW:function(a,d){this.array[a*this.itemSize+3]=d;return this},setXY:function(a,d,f){a*=this.itemSize;this.array[a+0]=d;this.array[a+ 1]=f;return this},setXYZ:function(a,d,f,h){a*=this.itemSize;this.array[a+0]=d;this.array[a+1]=f;this.array[a+2]=h;return this},setXYZW:function(a,d,f,h,r){a*=this.itemSize;this.array[a+0]=d;this.array[a+1]=f;this.array[a+2]=h;this.array[a+3]=r;return this},onUpload:function(a){this.onUploadCallback=a;return this},clone:function(){return(new this.constructor(this.array,this.itemSize)).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array), normalized:this.normalized}}});va.prototype=Object.create(da.prototype);va.prototype.constructor=va;Da.prototype=Object.create(da.prototype);Da.prototype.constructor=Da;na.prototype=Object.create(da.prototype);na.prototype.constructor=na;ya.prototype=Object.create(da.prototype);ya.prototype.constructor=ya;Pa.prototype=Object.create(da.prototype);Pa.prototype.constructor=Pa;Ja.prototype=Object.create(da.prototype);Ja.prototype.constructor=Ja;Oa.prototype=Object.create(da.prototype);Oa.prototype.constructor= Oa;pa.prototype=Object.create(da.prototype);pa.prototype.constructor=pa;tb.prototype=Object.create(da.prototype);tb.prototype.constructor=tb;Object.assign(ea.prototype,{computeGroups:function(a){var d=[],f=void 0;a=a.faces;for(var h=0;h<a.length;h++){var r=a[h];if(r.materialIndex!==f){f=r.materialIndex;void 0!==u&&(u.count=3*h-u.start,d.push(u));var u={start:3*h,materialIndex:f}}}void 0!==u&&(u.count=3*h-u.start,d.push(u));this.groups=d},fromGeometry:function(a){var d=a.faces,f=a.vertices,h=a.faceVertexUvs, r=h[0]&&0<h[0].length,u=h[1]&&0<h[1].length,w=a.morphTargets,B=w.length;if(0<B){var C=[];for(var G=0;G<B;G++)C[G]={name:w[G].name,data:[]};this.morphTargets.position=C}var K=a.morphNormals,L=K.length;if(0<L){var M=[];for(G=0;G<L;G++)M[G]={name:K[G].name,data:[]};this.morphTargets.normal=M}var R=a.skinIndices,S=a.skinWeights,X=R.length===f.length,W=S.length===f.length;0<f.length&&0===d.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(G=0;G<d.length;G++){var ja= d[G];this.vertices.push(f[ja.a],f[ja.b],f[ja.c]);var ha=ja.vertexNormals;3===ha.length?this.normals.push(ha[0],ha[1],ha[2]):(ha=ja.normal,this.normals.push(ha,ha,ha));ha=ja.vertexColors;3===ha.length?this.colors.push(ha[0],ha[1],ha[2]):(ha=ja.color,this.colors.push(ha,ha,ha));!0===r&&(ha=h[0][G],void 0!==ha?this.uvs.push(ha[0],ha[1],ha[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",G),this.uvs.push(new e,new e,new e)));!0===u&&(ha=h[1][G],void 0!==ha?this.uvs2.push(ha[0], ha[1],ha[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",G),this.uvs2.push(new e,new e,new e)));for(ha=0;ha<B;ha++){var ia=w[ha].vertices;C[ha].data.push(ia[ja.a],ia[ja.b],ia[ja.c])}for(ha=0;ha<L;ha++)ia=K[ha].vertexNormals[G],M[ha].data.push(ia.a,ia.b,ia.c);X&&this.skinIndices.push(R[ja.a],R[ja.b],R[ja.c]);W&&this.skinWeights.push(S[ja.a],S[ja.b],S[ja.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate= a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this}});var cq=1,vd=new t,Lk=new y,Ui=new k,Se=new A,Mk=new A,ad=new k;Ba.prototype=Object.assign(Object.create(c.prototype),{constructor:Ba,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){this.index=Array.isArray(a)?new (65535<Xb(a)? Oa:Pa)(a,1):a},addAttribute:function(a,d,f){if(!(d&&d.isBufferAttribute||d&&d.isInterleavedBufferAttribute))return console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a,new da(d,f));if("index"===a)return console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(d),this;this.attributes[a]=d;return this},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){delete this.attributes[a]; return this},addGroup:function(a,d,f){this.groups.push({start:a,count:d,materialIndex:void 0!==f?f:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,d){this.drawRange.start=a;this.drawRange.count=d},applyMatrix:function(a){var d=this.attributes.position;void 0!==d&&(a.applyToBufferAttribute(d),d.needsUpdate=!0);var f=this.attributes.normal;void 0!==f&&(d=(new q).getNormalMatrix(a),d.applyToBufferAttribute(f),f.needsUpdate=!0);f=this.attributes.tangent;void 0!==f&&(d=(new q).getNormalMatrix(a), d.applyToBufferAttribute(f),f.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this},rotateX:function(a){vd.makeRotationX(a);this.applyMatrix(vd);return this},rotateY:function(a){vd.makeRotationY(a);this.applyMatrix(vd);return this},rotateZ:function(a){vd.makeRotationZ(a);this.applyMatrix(vd);return this},translate:function(a,d,f){vd.makeTranslation(a,d,f);this.applyMatrix(vd);return this},scale:function(a,d,f){vd.makeScale(a, d,f);this.applyMatrix(vd);return this},lookAt:function(a){Lk.lookAt(a);Lk.updateMatrix();this.applyMatrix(Lk.matrix);return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(Ui).negate();this.translate(Ui.x,Ui.y,Ui.z);return this},setFromObject:function(a){var d=a.geometry;if(a.isPoints||a.isLine){a=new pa(3*d.vertices.length,3);var f=new pa(3*d.colors.length,3);this.addAttribute("position",a.copyVector3sArray(d.vertices));this.addAttribute("color",f.copyColorsArray(d.colors)); d.lineDistances&&d.lineDistances.length===d.vertices.length&&(a=new pa(d.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(d.lineDistances)));null!==d.boundingSphere&&(this.boundingSphere=d.boundingSphere.clone());null!==d.boundingBox&&(this.boundingBox=d.boundingBox.clone())}else a.isMesh&&d&&d.isGeometry&&this.fromGeometry(d);return this},setFromPoints:function(a){for(var d=[],f=0,h=a.length;f<h;f++){var r=a[f];d.push(r.x,r.y,r.z||0)}this.addAttribute("position",new pa(d,3)); return this},updateFromObject:function(a){var d=a.geometry;if(a.isMesh){var f=d.__directGeometry;!0===d.elementsNeedUpdate&&(f=void 0,d.elementsNeedUpdate=!1);if(void 0===f)return this.fromGeometry(d);f.verticesNeedUpdate=d.verticesNeedUpdate;f.normalsNeedUpdate=d.normalsNeedUpdate;f.colorsNeedUpdate=d.colorsNeedUpdate;f.uvsNeedUpdate=d.uvsNeedUpdate;f.groupsNeedUpdate=d.groupsNeedUpdate;d.verticesNeedUpdate=!1;d.normalsNeedUpdate=!1;d.colorsNeedUpdate=!1;d.uvsNeedUpdate=!1;d.groupsNeedUpdate=!1; d=f}!0===d.verticesNeedUpdate&&(f=this.attributes.position,void 0!==f&&(f.copyVector3sArray(d.vertices),f.needsUpdate=!0),d.verticesNeedUpdate=!1);!0===d.normalsNeedUpdate&&(f=this.attributes.normal,void 0!==f&&(f.copyVector3sArray(d.normals),f.needsUpdate=!0),d.normalsNeedUpdate=!1);!0===d.colorsNeedUpdate&&(f=this.attributes.color,void 0!==f&&(f.copyColorsArray(d.colors),f.needsUpdate=!0),d.colorsNeedUpdate=!1);d.uvsNeedUpdate&&(f=this.attributes.uv,void 0!==f&&(f.copyVector2sArray(d.uvs),f.needsUpdate= !0),d.uvsNeedUpdate=!1);d.lineDistancesNeedUpdate&&(f=this.attributes.lineDistance,void 0!==f&&(f.copyArray(d.lineDistances),f.needsUpdate=!0),d.lineDistancesNeedUpdate=!1);d.groupsNeedUpdate&&(d.computeGroups(a.geometry),this.groups=d.groups,d.groupsNeedUpdate=!1);return this},fromGeometry:function(a){a.__directGeometry=(new ea).fromGeometry(a);return this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){this.addAttribute("position",(new da(new Float32Array(3*a.vertices.length), 3)).copyVector3sArray(a.vertices));0<a.normals.length&&this.addAttribute("normal",(new da(new Float32Array(3*a.normals.length),3)).copyVector3sArray(a.normals));0<a.colors.length&&this.addAttribute("color",(new da(new Float32Array(3*a.colors.length),3)).copyColorsArray(a.colors));0<a.uvs.length&&this.addAttribute("uv",(new da(new Float32Array(2*a.uvs.length),2)).copyVector2sArray(a.uvs));0<a.uvs2.length&&this.addAttribute("uv2",(new da(new Float32Array(2*a.uvs2.length),2)).copyVector2sArray(a.uvs2)); this.groups=a.groups;for(var d in a.morphTargets){for(var f=[],h=a.morphTargets[d],r=0,u=h.length;r<u;r++){var w=h[r],B=new pa(3*w.data.length,3);B.name=w.name;f.push(B.copyVector3sArray(w.data))}this.morphAttributes[d]=f}0<a.skinIndices.length&&(d=new pa(4*a.skinIndices.length,4),this.addAttribute("skinIndex",d.copyVector4sArray(a.skinIndices)));0<a.skinWeights.length&&(d=new pa(4*a.skinWeights.length,4),this.addAttribute("skinWeight",d.copyVector4sArray(a.skinWeights)));null!==a.boundingSphere&& (this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new A);var a=this.attributes.position,d=this.morphAttributes.position;if(void 0!==a){if(this.boundingBox.setFromBufferAttribute(a),d){a=0;for(var f=d.length;a<f;a++)Se.setFromBufferAttribute(d[a]),this.boundingBox.expandByPoint(Se.min),this.boundingBox.expandByPoint(Se.max)}}else 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(){null===this.boundingSphere&&(this.boundingSphere=new H);var a=this.attributes.position,d=this.morphAttributes.position;if(a){var f=this.boundingSphere.center;Se.setFromBufferAttribute(a);if(d)for(var h=0,r=d.length;h<r;h++){var u= d[h];Mk.setFromBufferAttribute(u);Se.expandByPoint(Mk.min);Se.expandByPoint(Mk.max)}Se.getCenter(f);var w=0;h=0;for(r=a.count;h<r;h++)ad.fromBufferAttribute(a,h),w=Math.max(w,f.distanceToSquared(ad));if(d)for(h=0,r=d.length;h<r;h++){u=d[h];a=0;for(var B=u.count;a<B;a++)ad.fromBufferAttribute(u,a),w=Math.max(w,f.distanceToSquared(ad))}this.boundingSphere.radius=Math.sqrt(w);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.index,d=this.attributes;if(d.position){var f=d.position.array;if(void 0===d.normal)this.addAttribute("normal",new da(new Float32Array(f.length),3));else for(var h=d.normal.array,r=0,u=h.length;r<u;r++)h[r]=0;h=d.normal.array;var w=new k,B=new k,C=new k,G=new k,K=new k;if(a){var L=a.array;r=0;for(u=a.count;r<u;r+=3){a=3*L[r+0];var M=3*L[r+1];var R=3*L[r+2];w.fromArray(f,a);B.fromArray(f,M);C.fromArray(f,R);G.subVectors(C, B);K.subVectors(w,B);G.cross(K);h[a]+=G.x;h[a+1]+=G.y;h[a+2]+=G.z;h[M]+=G.x;h[M+1]+=G.y;h[M+2]+=G.z;h[R]+=G.x;h[R+1]+=G.y;h[R+2]+=G.z}}else for(r=0,u=f.length;r<u;r+=9)w.fromArray(f,r),B.fromArray(f,r+3),C.fromArray(f,r+6),G.subVectors(C,B),K.subVectors(w,B),G.cross(K),h[r]=G.x,h[r+1]=G.y,h[r+2]=G.z,h[r+3]=G.x,h[r+4]=G.y,h[r+5]=G.z,h[r+6]=G.x,h[r+7]=G.y,h[r+8]=G.z;this.normalizeNormals();d.normal.needsUpdate=!0}},merge:function(a,d){if(a&&a.isBufferGeometry){void 0===d&&(d=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset\x3d0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.")); var f=this.attributes,h;for(h in f)if(void 0!==a.attributes[h]){var r=f[h].array,u=a.attributes[h],w=u.array,B=u.itemSize*d;u=Math.min(w.length,r.length-B);for(var C=0;C<u;C++,B++)r[B]=w[C]}return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a)},normalizeNormals:function(){for(var a=this.attributes.normal,d=0,f=a.count;d<f;d++)ad.x=a.getX(d),ad.y=a.getY(d),ad.z=a.getZ(d),ad.normalize(),a.setXYZ(d,ad.x,ad.y,ad.z)},toNonIndexed:function(){function a(K, L){var M=K.array;K=K.itemSize;for(var R=new M.constructor(L.length*K),S,X=0,W=0,ja=L.length;W<ja;W++){S=L[W]*K;for(var ha=0;ha<K;ha++)R[X++]=M[S++]}return new da(R,K)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var d=new Ba,f=this.index.array,h=this.attributes,r;for(r in h){var u=h[r];u=a(u,f);d.addAttribute(r,u)}var w=this.morphAttributes;for(r in w){var B=[],C=w[r];h=0;for(var G=C.length;h<G;h++)u=C[h],u=a(u,f),B.push(u); d.morphAttributes[r]=B}f=this.groups;h=0;for(r=f.length;h<r;h++)u=f[h],d.addGroup(u.start,u.count,u.materialIndex);return d},toJSON:function(){var a={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};a.uuid=this.uuid;a.type=this.type;""!==this.name&&(a.name=this.name);0<Object.keys(this.userData).length&&(a.userData=this.userData);if(void 0!==this.parameters){var d=this.parameters;for(G in d)void 0!==d[G]&&(a[G]=d[G]);return a}a.data={attributes:{}};d=this.index;null!== d&&(a.data.index={type:d.array.constructor.name,array:Array.prototype.slice.call(d.array)});var f=this.attributes;for(G in f){d=f[G];var h=d.toJSON();""!==d.name&&(h.name=d.name);a.data.attributes[G]=h}f={};var r=!1;for(G in this.morphAttributes){for(var u=this.morphAttributes[G],w=[],B=0,C=u.length;B<C;B++)d=u[B],h=d.toJSON(),""!==d.name&&(h.name=d.name),w.push(h);0<w.length&&(f[G]=w,r=!0)}r&&(a.data.morphAttributes=f);var G=this.groups;0<G.length&&(a.data.groups=JSON.parse(JSON.stringify(G)));G= this.boundingSphere;null!==G&&(a.data.boundingSphere={center:G.center.toArray(),radius:G.radius});return a},clone:function(){return(new Ba).copy(this)},copy:function(a){var d;this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.name=a.name;var f=a.index;null!==f&&this.setIndex(f.clone());f=a.attributes;for(w in f)this.addAttribute(w,f[w].clone());var h=a.morphAttributes;for(w in h){var r=[],u=h[w];f=0;for(d=u.length;f<d;f++)r.push(u[f].clone()); this.morphAttributes[w]=r}var w=a.groups;f=0;for(d=w.length;f<d;f++)h=w[f],this.addGroup(h.start,h.count,h.materialIndex);w=a.boundingBox;null!==w&&(this.boundingBox=w.clone());w=a.boundingSphere;null!==w&&(this.boundingSphere=w.clone());this.drawRange.start=a.drawRange.start;this.drawRange.count=a.drawRange.count;this.userData=a.userData;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Jn=new t,Te=new E,Nk=new H,we=new k,xe=new k,ye=new k,zm=new k,Am=new k,Bm=new k,Nj= new k,Oj=new k,Pj=new k,kf=new e,lf=new e,mf=new e,Ig=new k,Zh=new k;Nb.prototype=Object.assign(Object.create(y.prototype),{constructor:Nb,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){y.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary));return this},updateMorphTargets:function(){var a= this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var d=Object.keys(a);if(0<d.length){var f=a[d[0]];if(void 0!==f)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},a=0,d=f.length;a<d;a++){var h=f[a].name||String(a);this.morphTargetInfluences.push(0);this.morphTargetDictionary[h]=a}}}else a=a.morphTargets,void 0!==a&&0<a.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},raycast:function(a,d){var f=this.geometry, h=this.material,r=this.matrixWorld;if(void 0!==h&&(null===f.boundingSphere&&f.computeBoundingSphere(),Nk.copy(f.boundingSphere),Nk.applyMatrix4(r),!1!==a.ray.intersectsSphere(Nk)&&(Jn.getInverse(r),Te.copy(a.ray).applyMatrix4(Jn),null===f.boundingBox||!1!==Te.intersectsBox(f.boundingBox))))if(f.isBufferGeometry){var u=f.index;r=f.attributes.position;var w=f.morphAttributes.position,B=f.attributes.uv,C=f.attributes.uv2,G=f.groups,K=f.drawRange,L,M;if(null!==u)if(Array.isArray(h)){var R=0;for(L=G.length;R< L;R++){var S=G[R];var X=h[S.materialIndex];var W=Math.max(S.start,K.start);for(M=f=Math.min(S.start+S.count,K.start+K.count);W<M;W+=3){f=u.getX(W);var ja=u.getX(W+1);var ha=u.getX(W+2);if(f=rb(this,X,a,Te,r,w,B,C,f,ja,ha))f.faceIndex=Math.floor(W/3),f.face.materialIndex=S.materialIndex,d.push(f)}}}else for(W=Math.max(0,K.start),f=Math.min(u.count,K.start+K.count),R=W,L=f;R<L;R+=3){if(f=u.getX(R),ja=u.getX(R+1),ha=u.getX(R+2),f=rb(this,h,a,Te,r,w,B,C,f,ja,ha))f.faceIndex=Math.floor(R/3),d.push(f)}else if(void 0!== r)if(Array.isArray(h))for(R=0,L=G.length;R<L;R++)for(S=G[R],X=h[S.materialIndex],W=Math.max(S.start,K.start),M=f=Math.min(S.start+S.count,K.start+K.count);W<M;W+=3){if(f=W,ja=W+1,ha=W+2,f=rb(this,X,a,Te,r,w,B,C,f,ja,ha))f.faceIndex=Math.floor(W/3),f.face.materialIndex=S.materialIndex,d.push(f)}else for(W=Math.max(0,K.start),f=Math.min(r.count,K.start+K.count),R=W,L=f;R<L;R+=3)if(f=R,ja=R+1,ha=R+2,f=rb(this,h,a,Te,r,w,B,C,f,ja,ha))f.faceIndex=Math.floor(R/3),d.push(f)}else if(f.isGeometry)for(r=Array.isArray(h), w=f.vertices,B=f.faces,f=f.faceVertexUvs[0],0<f.length&&(u=f),R=0,L=B.length;R<L;R++)if(S=B[R],f=r?h[S.materialIndex]:h,void 0!==f&&(C=w[S.a],G=w[S.b],K=w[S.c],f=kb(this,f,a,Te,C,G,K,Ig)))u&&u[R]&&(X=u[R],kf.copy(X[0]),lf.copy(X[1]),mf.copy(X[2]),f.uv=F.getUV(Ig,C,G,K,kf,lf,mf,new e)),f.face=S,f.faceIndex=R,d.push(f)},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var dq=0,wd=new t,Ok=new y,Vi=new k;Ua.prototype=Object.assign(Object.create(c.prototype),{constructor:Ua, isGeometry:!0,applyMatrix:function(a){for(var d=(new q).getNormalMatrix(a),f=0,h=this.vertices.length;f<h;f++)this.vertices[f].applyMatrix4(a);f=0;for(h=this.faces.length;f<h;f++){a=this.faces[f];a.normal.applyMatrix3(d).normalize();for(var r=0,u=a.vertexNormals.length;r<u;r++)a.vertexNormals[r].applyMatrix3(d).normalize()}null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();this.normalsNeedUpdate=this.verticesNeedUpdate=!0;return this},rotateX:function(a){wd.makeRotationX(a); this.applyMatrix(wd);return this},rotateY:function(a){wd.makeRotationY(a);this.applyMatrix(wd);return this},rotateZ:function(a){wd.makeRotationZ(a);this.applyMatrix(wd);return this},translate:function(a,d,f){wd.makeTranslation(a,d,f);this.applyMatrix(wd);return this},scale:function(a,d,f){wd.makeScale(a,d,f);this.applyMatrix(wd);return this},lookAt:function(a){Ok.lookAt(a);Ok.updateMatrix();this.applyMatrix(Ok.matrix);return this},fromBufferGeometry:function(a){function d(R,S,X,W){var ja=void 0=== B?[]:[f.colors[R].clone(),f.colors[S].clone(),f.colors[X].clone()],ha=void 0===w?[]:[(new k).fromArray(w,3*R),(new k).fromArray(w,3*S),(new k).fromArray(w,3*X)];W=new V(R,S,X,ha,ja,W);f.faces.push(W);void 0!==C&&f.faceVertexUvs[0].push([(new e).fromArray(C,2*R),(new e).fromArray(C,2*S),(new e).fromArray(C,2*X)]);void 0!==G&&f.faceVertexUvs[1].push([(new e).fromArray(G,2*R),(new e).fromArray(G,2*S),(new e).fromArray(G,2*X)])}var f=this,h=null!==a.index?a.index.array:void 0,r=a.attributes,u=r.position.array, w=void 0!==r.normal?r.normal.array:void 0,B=void 0!==r.color?r.color.array:void 0,C=void 0!==r.uv?r.uv.array:void 0,G=void 0!==r.uv2?r.uv2.array:void 0;void 0!==G&&(this.faceVertexUvs[1]=[]);for(r=0;r<u.length;r+=3)f.vertices.push((new k).fromArray(u,r)),void 0!==B&&f.colors.push((new J).fromArray(B,r));var K=a.groups;if(0<K.length)for(r=0;r<K.length;r++){u=K[r];var L=u.start,M=L;for(L+=u.count;M<L;M+=3)void 0!==h?d(h[M],h[M+1],h[M+2],u.materialIndex):d(M,M+1,M+2,u.materialIndex)}else if(void 0!== h)for(r=0;r<h.length;r+=3)d(h[r],h[r+1],h[r+2]);else for(r=0;r<u.length/3;r+=3)d(r,r+1,r+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(Vi).negate();this.translate(Vi.x,Vi.y,Vi.z);return this},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,d=this.boundingSphere.radius; d=0===d?1:1/d;var f=new t;f.set(d,0,0,-d*a.x,0,d,0,-d*a.y,0,0,d,-d*a.z,0,0,0,1);this.applyMatrix(f);return this},computeFaceNormals:function(){for(var a=new k,d=new k,f=0,h=this.faces.length;f<h;f++){var r=this.faces[f],u=this.vertices[r.a],w=this.vertices[r.b];a.subVectors(this.vertices[r.c],w);d.subVectors(u,w);a.cross(d);a.normalize();r.normal.copy(a)}},computeVertexNormals:function(a){void 0===a&&(a=!0);var d;var f=Array(this.vertices.length);var h=0;for(d=this.vertices.length;h<d;h++)f[h]=new k; if(a){var r=new k,u=new k;a=0;for(h=this.faces.length;a<h;a++){d=this.faces[a];var w=this.vertices[d.a];var B=this.vertices[d.b];var C=this.vertices[d.c];r.subVectors(C,B);u.subVectors(w,B);r.cross(u);f[d.a].add(r);f[d.b].add(r);f[d.c].add(r)}}else for(this.computeFaceNormals(),a=0,h=this.faces.length;a<h;a++)d=this.faces[a],f[d.a].add(d.normal),f[d.b].add(d.normal),f[d.c].add(d.normal);h=0;for(d=this.vertices.length;h<d;h++)f[h].normalize();a=0;for(h=this.faces.length;a<h;a++)d=this.faces[a],w=d.vertexNormals, 3===w.length?(w[0].copy(f[d.a]),w[1].copy(f[d.b]),w[2].copy(f[d.c])):(w[0]=f[d.a].clone(),w[1]=f[d.b].clone(),w[2]=f[d.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var a;this.computeFaceNormals();var d=0;for(a=this.faces.length;d<a;d++){var f=this.faces[d];var h=f.vertexNormals;3===h.length?(h[0].copy(f.normal),h[1].copy(f.normal),h[2].copy(f.normal)):(h[0]=f.normal.clone(),h[1]=f.normal.clone(),h[2]=f.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate= !0)},computeMorphNormals:function(){var a,d;var f=0;for(d=this.faces.length;f<d;f++){var h=this.faces[f];h.__originalFaceNormal?h.__originalFaceNormal.copy(h.normal):h.__originalFaceNormal=h.normal.clone();h.__originalVertexNormals||(h.__originalVertexNormals=[]);var r=0;for(a=h.vertexNormals.length;r<a;r++)h.__originalVertexNormals[r]?h.__originalVertexNormals[r].copy(h.vertexNormals[r]):h.__originalVertexNormals[r]=h.vertexNormals[r].clone()}var u=new Ua;u.faces=this.faces;r=0;for(a=this.morphTargets.length;r< a;r++){if(!this.morphNormals[r]){this.morphNormals[r]={};this.morphNormals[r].faceNormals=[];this.morphNormals[r].vertexNormals=[];h=this.morphNormals[r].faceNormals;var w=this.morphNormals[r].vertexNormals;f=0;for(d=this.faces.length;f<d;f++){var B=new k;var C={a:new k,b:new k,c:new k};h.push(B);w.push(C)}}w=this.morphNormals[r];u.vertices=this.morphTargets[r].vertices;u.computeFaceNormals();u.computeVertexNormals();f=0;for(d=this.faces.length;f<d;f++)h=this.faces[f],B=w.faceNormals[f],C=w.vertexNormals[f], B.copy(h.normal),C.a.copy(h.vertexNormals[0]),C.b.copy(h.vertexNormals[1]),C.c.copy(h.vertexNormals[2])}f=0;for(d=this.faces.length;f<d;f++)h=this.faces[f],h.normal=h.__originalFaceNormal,h.vertexNormals=h.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new A);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new H);this.boundingSphere.setFromPoints(this.vertices)},merge:function(a, d,f){if(a&&a.isGeometry){var h,r=this.vertices.length,u=this.vertices,w=a.vertices,B=this.faces,C=a.faces,G=this.colors,K=a.colors;void 0===f&&(f=0);void 0!==d&&(h=(new q).getNormalMatrix(d));for(var L=0,M=w.length;L<M;L++){var R=w[L].clone();void 0!==d&&R.applyMatrix4(d);u.push(R)}L=0;for(M=K.length;L<M;L++)G.push(K[L].clone());L=0;for(M=C.length;L<M;L++){w=C[L];var S=w.vertexNormals;K=w.vertexColors;G=new V(w.a+r,w.b+r,w.c+r);G.normal.copy(w.normal);void 0!==h&&G.normal.applyMatrix3(h).normalize(); d=0;for(u=S.length;d<u;d++)R=S[d].clone(),void 0!==h&&R.applyMatrix3(h).normalize(),G.vertexNormals.push(R);G.color.copy(w.color);d=0;for(u=K.length;d<u;d++)R=K[d],G.vertexColors.push(R.clone());G.materialIndex=w.materialIndex+f;B.push(G)}L=0;for(M=a.faceVertexUvs.length;L<M;L++)for(f=a.faceVertexUvs[L],void 0===this.faceVertexUvs[L]&&(this.faceVertexUvs[L]=[]),d=0,u=f.length;d<u;d++){h=f[d];r=[];B=0;for(C=h.length;B<C;B++)r.push(h[B].clone());this.faceVertexUvs[L].push(r)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", a)},mergeMesh:function(a){a&&a.isMesh?(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a)},mergeVertices:function(){var a={},d=[],f=[],h=Math.pow(10,4),r;var u=0;for(r=this.vertices.length;u<r;u++){var w=this.vertices[u];w=Math.round(w.x*h)+"_"+Math.round(w.y*h)+"_"+Math.round(w.z*h);void 0===a[w]?(a[w]=u,d.push(this.vertices[u]),f[u]=d.length-1):f[u]=f[a[w]]}a=[];u=0;for(r=this.faces.length;u<r;u++)for(h= this.faces[u],h.a=f[h.a],h.b=f[h.b],h.c=f[h.c],h=[h.a,h.b,h.c],w=0;3>w;w++)if(h[w]===h[(w+1)%3]){a.push(u);break}for(u=a.length-1;0<=u;u--)for(h=a[u],this.faces.splice(h,1),f=0,r=this.faceVertexUvs.length;f<r;f++)this.faceVertexUvs[f].splice(h,1);u=this.vertices.length-d.length;this.vertices=d;return u},setFromPoints:function(a){this.vertices=[];for(var d=0,f=a.length;d<f;d++){var h=a[d];this.vertices.push(new k(h.x,h.y,h.z||0))}return this},sortFacesByMaterialIndex:function(){for(var a=this.faces, d=a.length,f=0;f<d;f++)a[f]._id=f;a.sort(function(C,G){return C.materialIndex-G.materialIndex});var h=this.faceVertexUvs[0],r=this.faceVertexUvs[1],u,w;h&&h.length===d&&(u=[]);r&&r.length===d&&(w=[]);for(f=0;f<d;f++){var B=a[f]._id;u&&u.push(h[B]);w&&w.push(r[B])}u&&(this.faceVertexUvs[0]=u);w&&(this.faceVertexUvs[1]=w)},toJSON:function(){function a(fa,la,qa){return qa?fa|1<<la:fa&~(1<<la)}function d(fa){var la=fa.x.toString()+fa.y.toString()+fa.z.toString();if(void 0!==G[la])return G[la];G[la]=C.length/ 3;C.push(fa.x,fa.y,fa.z);return G[la]}function f(fa){var la=fa.r.toString()+fa.g.toString()+fa.b.toString();if(void 0!==L[la])return L[la];L[la]=K.length;K.push(fa.getHex());return L[la]}function h(fa){var la=fa.x.toString()+fa.y.toString();if(void 0!==R[la])return R[la];R[la]=M.length/2;M.push(fa.x,fa.y);return R[la]}var r={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};r.uuid=this.uuid;r.type=this.type;""!==this.name&&(r.name=this.name);if(void 0!==this.parameters){var u=this.parameters, w;for(w in u)void 0!==u[w]&&(r[w]=u[w]);return r}u=[];for(w=0;w<this.vertices.length;w++){var B=this.vertices[w];u.push(B.x,B.y,B.z)}B=[];var C=[],G={},K=[],L={},M=[],R={};for(w=0;w<this.faces.length;w++){var S=this.faces[w],X=void 0!==this.faceVertexUvs[0][w],W=0<S.normal.length(),ja=0<S.vertexNormals.length,ha=1!==S.color.r||1!==S.color.g||1!==S.color.b,ia=0<S.vertexColors.length,ma=0;ma=a(ma,0,0);ma=a(ma,1,!0);ma=a(ma,2,!1);ma=a(ma,3,X);ma=a(ma,4,W);ma=a(ma,5,ja);ma=a(ma,6,ha);ma=a(ma,7,ia);B.push(ma); B.push(S.a,S.b,S.c);B.push(S.materialIndex);X&&(X=this.faceVertexUvs[0][w],B.push(h(X[0]),h(X[1]),h(X[2])));W&&B.push(d(S.normal));ja&&(W=S.vertexNormals,B.push(d(W[0]),d(W[1]),d(W[2])));ha&&B.push(f(S.color));ia&&(S=S.vertexColors,B.push(f(S[0]),f(S[1]),f(S[2])))}r.data={};r.data.vertices=u;r.data.normals=C;0<K.length&&(r.data.colors=K);0<M.length&&(r.data.uvs=[M]);r.data.faces=B;return r},clone:function(){return(new Ua).copy(this)},copy:function(a){var d,f,h;this.vertices=[];this.colors=[];this.faces= [];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.name=a.name;var r=a.vertices;var u=0;for(d=r.length;u<d;u++)this.vertices.push(r[u].clone());r=a.colors;u=0;for(d=r.length;u<d;u++)this.colors.push(r[u].clone());r=a.faces;u=0;for(d=r.length;u<d;u++)this.faces.push(r[u].clone());u=0;for(d=a.faceVertexUvs.length;u<d;u++){var w=a.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&& (this.faceVertexUvs[u]=[]);r=0;for(f=w.length;r<f;r++){var B=w[r],C=[];var G=0;for(h=B.length;G<h;G++)C.push(B[G].clone());this.faceVertexUvs[u].push(C)}}G=a.morphTargets;u=0;for(d=G.length;u<d;u++){h={};h.name=G[u].name;if(void 0!==G[u].vertices)for(h.vertices=[],r=0,f=G[u].vertices.length;r<f;r++)h.vertices.push(G[u].vertices[r].clone());if(void 0!==G[u].normals)for(h.normals=[],r=0,f=G[u].normals.length;r<f;r++)h.normals.push(G[u].normals[r].clone());this.morphTargets.push(h)}G=a.morphNormals; u=0;for(d=G.length;u<d;u++){h={};if(void 0!==G[u].vertexNormals)for(h.vertexNormals=[],r=0,f=G[u].vertexNormals.length;r<f;r++)w=G[u].vertexNormals[r],B={},B.a=w.a.clone(),B.b=w.b.clone(),B.c=w.c.clone(),h.vertexNormals.push(B);if(void 0!==G[u].faceNormals)for(h.faceNormals=[],r=0,f=G[u].faceNormals.length;r<f;r++)h.faceNormals.push(G[u].faceNormals[r].clone());this.morphNormals.push(h)}r=a.skinWeights;u=0;for(d=r.length;u<d;u++)this.skinWeights.push(r[u].clone());r=a.skinIndices;u=0;for(d=r.length;u< d;u++)this.skinIndices.push(r[u].clone());r=a.lineDistances;u=0;for(d=r.length;u<d;u++)this.lineDistances.push(r[u]);u=a.boundingBox;null!==u&&(this.boundingBox=u.clone());u=a.boundingSphere;null!==u&&(this.boundingSphere=u.clone());this.elementsNeedUpdate=a.elementsNeedUpdate;this.verticesNeedUpdate=a.verticesNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.lineDistancesNeedUpdate=a.lineDistancesNeedUpdate;this.groupsNeedUpdate= a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Cb.prototype=Object.create(Ua.prototype);Cb.prototype.constructor=Cb;Qb.prototype=Object.create(Ba.prototype);Qb.prototype.constructor=Qb;var Sr={clone:Fc,merge:Tb};Ub.prototype=Object.create(T.prototype);Ub.prototype.constructor=Ub;Ub.prototype.isShaderMaterial=!0;Ub.prototype.copy=function(a){T.prototype.copy.call(this,a);this.fragmentShader=a.fragmentShader;this.vertexShader=a.vertexShader;this.uniforms= Fc(a.uniforms);this.defines=Object.assign({},a.defines);this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.lights=a.lights;this.clipping=a.clipping;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;this.extensions=a.extensions;return this};Ub.prototype.toJSON=function(a){var d=T.prototype.toJSON.call(this,a);d.uniforms={};for(var f in this.uniforms){var h=this.uniforms[f].value;d.uniforms[f]=h&&h.isTexture?{type:"t",value:h.toJSON(a).uuid}: h&&h.isColor?{type:"c",value:h.getHex()}:h&&h.isVector2?{type:"v2",value:h.toArray()}:h&&h.isVector3?{type:"v3",value:h.toArray()}:h&&h.isVector4?{type:"v4",value:h.toArray()}:h&&h.isMatrix3?{type:"m3",value:h.toArray()}:h&&h.isMatrix4?{type:"m4",value:h.toArray()}:{value:h}}0<Object.keys(this.defines).length&&(d.defines=this.defines);d.vertexShader=this.vertexShader;d.fragmentShader=this.fragmentShader;a={};for(var r in this.extensions)!0===this.extensions[r]&&(a[r]=!0);0<Object.keys(a).length&& (d.extensions=a);return d};$b.prototype=Object.assign(Object.create(y.prototype),{constructor:$b,isCamera:!0,copy:function(a,d){y.prototype.copy.call(this,a,d);this.matrixWorldInverse.copy(a.matrixWorldInverse);this.projectionMatrix.copy(a.projectionMatrix);this.projectionMatrixInverse.copy(a.projectionMatrixInverse);return this},getWorldDirection:function(a){void 0===a&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),a=new k);this.updateMatrixWorld(!0);var d=this.matrixWorld.elements; return a.set(-d[8],-d[9],-d[10]).normalize()},updateMatrixWorld:function(a){y.prototype.updateMatrixWorld.call(this,a);this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}});Ab.prototype=Object.assign(Object.create($b.prototype),{constructor:Ab,isPerspectiveCamera:!0,copy:function(a,d){$b.prototype.copy.call(this,a,d);this.fov=a.fov;this.zoom=a.zoom;this.near=a.near;this.far=a.far;this.focus=a.focus;this.aspect=a.aspect;this.view=null===a.view? null:Object.assign({},a.view);this.filmGauge=a.filmGauge;this.filmOffset=a.filmOffset;return this},setFocalLength:function(a){this.fov=2*bb.RAD2DEG*Math.atan(.5*this.getFilmHeight()/a);this.updateProjectionMatrix()},getFocalLength:function(){return.5*this.getFilmHeight()/Math.tan(.5*bb.DEG2RAD*this.fov)},getEffectiveFOV:function(){return 2*bb.RAD2DEG*Math.atan(Math.tan(.5*bb.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/ Math.max(this.aspect,1)},setViewOffset:function(a,d,f,h,r,u){this.aspect=a/d;null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1});this.view.enabled=!0;this.view.fullWidth=a;this.view.fullHeight=d;this.view.offsetX=f;this.view.offsetY=h;this.view.width=r;this.view.height=u;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=this.near, d=a*Math.tan(.5*bb.DEG2RAD*this.fov)/this.zoom,f=2*d,h=this.aspect*f,r=-.5*h,u=this.view;if(null!==this.view&&this.view.enabled){var w=u.fullWidth,B=u.fullHeight;r+=u.offsetX*h/w;d-=u.offsetY*f/B;h*=u.width/w;f*=u.height/B}u=this.filmOffset;0!==u&&(r+=a*u/this.getFilmWidth());this.projectionMatrix.makePerspective(r,r+h,d,d-f,a,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(a){a=y.prototype.toJSON.call(this,a);a.object.fov=this.fov;a.object.zoom=this.zoom; a.object.near=this.near;a.object.far=this.far;a.object.focus=this.focus;a.object.aspect=this.aspect;null!==this.view&&(a.object.view=Object.assign({},this.view));a.object.filmGauge=this.filmGauge;a.object.filmOffset=this.filmOffset;return a}});wc.prototype=Object.create(y.prototype);wc.prototype.constructor=wc;jc.prototype=Object.create(p.prototype);jc.prototype.constructor=jc;jc.prototype.isWebGLRenderTargetCube=!0;jc.prototype.fromEquirectangularTexture=function(a,d){this.texture.type=d.type;this.texture.format= d.format;this.texture.encoding=d.encoding;var f=new z,h=new Ub({type:"CubemapFromEquirect",uniforms:Fc({tEquirect:{value:null}}),vertexShader:"varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection \x3d transformDirection( position, modelMatrix );\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n}",fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction \x3d normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y \x3d asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x \x3d atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor \x3d texture2D( tEquirect, sampleUV );\n}", side:1,blending:0});h.uniforms.tEquirect.value=d;d=new Nb(new Qb(5,5,5),h);f.add(d);h=new wc(1,10,1);h.renderTarget=this;h.renderTarget.texture.name="CubeCameraTexture";h.update(a,f);d.geometry.dispose();d.material.dispose();return this};mc.prototype=Object.create(l.prototype);mc.prototype.constructor=mc;mc.prototype.isDataTexture=!0;var Pk=new k,Tr=new k,Ur=new q;Object.assign(cc.prototype,{isPlane:!0,set:function(a,d){this.normal.copy(a);this.constant=d;return this},setComponents:function(a,d,f, h){this.normal.set(a,d,f);this.constant=h;return this},setFromNormalAndCoplanarPoint:function(a,d){this.normal.copy(a);this.constant=-d.dot(this.normal);return this},setFromCoplanarPoints:function(a,d,f){d=Pk.subVectors(f,d).cross(Tr.subVectors(a,d)).normalize();this.setFromNormalAndCoplanarPoint(d,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length(); this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,d){void 0===d&&(console.warn("THREE.Plane: .projectPoint() target is now required"),d=new k);return d.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(a,d){void 0=== d&&(console.warn("THREE.Plane: .intersectLine() target is now required"),d=new k);var f=a.delta(Pk),h=this.normal.dot(f);if(0===h){if(0===this.distanceToPoint(a.start))return d.copy(a.start)}else if(h=-(a.start.dot(this.normal)+this.constant)/h,!(0>h||1<h))return d.copy(f).multiplyScalar(h).add(a.start)},intersectsLine:function(a){var d=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>d&&0<a||0>a&&0<d},intersectsBox:function(a){return a.intersectsPlane(this)},intersectsSphere:function(a){return a.intersectsPlane(this)}, coplanarPoint:function(a){void 0===a&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),a=new k);return a.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(a,d){d=d||Ur.getNormalMatrix(a);a=this.coplanarPoint(Pk).applyMatrix4(a);d=this.normal.applyMatrix3(d).normalize();this.constant=-a.dot(d);return this},translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant===this.constant}}); var ig=new H,Wi=new k;Object.assign(Gc.prototype,{set:function(a,d,f,h,r,u){var w=this.planes;w[0].copy(a);w[1].copy(d);w[2].copy(f);w[3].copy(h);w[4].copy(r);w[5].copy(u);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var d=this.planes,f=0;6>f;f++)d[f].copy(a.planes[f]);return this},setFromMatrix:function(a){var d=this.planes,f=a.elements;a=f[0];var h=f[1],r=f[2],u=f[3],w=f[4],B=f[5],C=f[6],G=f[7],K=f[8],L=f[9],M=f[10],R=f[11],S=f[12],X=f[13],W=f[14]; f=f[15];d[0].setComponents(u-a,G-w,R-K,f-S).normalize();d[1].setComponents(u+a,G+w,R+K,f+S).normalize();d[2].setComponents(u+h,G+B,R+L,f+X).normalize();d[3].setComponents(u-h,G-B,R-L,f-X).normalize();d[4].setComponents(u-r,G-C,R-M,f-W).normalize();d[5].setComponents(u+r,G+C,R+M,f+W).normalize();return this},intersectsObject:function(a){var d=a.geometry;null===d.boundingSphere&&d.computeBoundingSphere();ig.copy(d.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(ig)},intersectsSprite:function(a){ig.center.set(0, 0,0);ig.radius=.7071067811865476;ig.applyMatrix4(a.matrixWorld);return this.intersectsSphere(ig)},intersectsSphere:function(a){var d=this.planes,f=a.center;a=-a.radius;for(var h=0;6>h;h++)if(d[h].distanceToPoint(f)<a)return!1;return!0},intersectsBox:function(a){for(var d=this.planes,f=0;6>f;f++){var h=d[f];Wi.x=0<h.normal.x?a.max.x:a.min.x;Wi.y=0<h.normal.y?a.max.y:a.min.y;Wi.z=0<h.normal.z?a.max.z:a.min.z;if(0>h.distanceToPoint(Wi))return!1}return!0},containsPoint:function(a){for(var d=this.planes, f=0;6>f;f++)if(0>d[f].distanceToPoint(a))return!1;return!0}});var mb={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *\x3d texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a \x3c ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion \x3d ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *\x3d ambientOcclusion;\n\t#if defined( USE_ENVMAP ) \x26\x26 defined( STANDARD )\n\t\tfloat dotNV \x3d saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *\x3d computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif", aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed \x3d vec3( position );",beginnormal_vertex:"vec3 objectNormal \x3d vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent \x3d vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 \x3d vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 \x3d vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r \x3d roughness * c0 + c1;\n\tfloat a004 \x3d min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff \x3d 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance \x3e 0.0 ) {\n\t\tdistanceFalloff *\x3d pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance \x3e 0.0 \x26\x26 decayExponent \x3e 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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 \x3d exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel \x3d exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr \x3d max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 \x3d pow2( alpha );\n\tfloat gl \x3d dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv \x3d 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 \x3d pow2( alpha );\n\tfloat gv \x3d dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl \x3d 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 \x3d pow2( alpha );\n\tfloat denom \x3d 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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha \x3d pow2( roughness );\n\tvec3 halfDir \x3d normalize( incidentLight.direction + viewDir );\n\tfloat dotNL \x3d saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV \x3d saturate( dot( normal, viewDir ) );\n\tfloat dotNH \x3d saturate( dot( normal, halfDir ) );\n\tfloat dotLH \x3d saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F \x3d F_Schlick( specularColor, dotLH );\n\tfloat G \x3d G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D \x3d 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 \x3d 64.0;\n\tconst float LUT_SCALE \x3d ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS \x3d 0.5 / LUT_SIZE;\n\tfloat dotNV \x3d saturate( dot( N, V ) );\n\tvec2 uv \x3d vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv \x3d uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l \x3d 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 \x3d dot( v1, v2 );\n\tfloat y \x3d abs( x );\n\tfloat a \x3d 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b \x3d 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v \x3d a / b;\n\tfloat theta_sintheta \x3d ( x \x3e 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 \x3d rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 \x3d rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal \x3d cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) \x3c 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 \x3d normalize( V - N * dot( V, N ) );\n\tT2 \x3d - cross( N, T1 );\n\tmat3 mat \x3d mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] \x3d mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] \x3d mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] \x3d mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] \x3d mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] \x3d normalize( coords[ 0 ] );\n\tcoords[ 1 ] \x3d normalize( coords[ 1 ] );\n\tcoords[ 2 ] \x3d normalize( coords[ 2 ] );\n\tcoords[ 3 ] \x3d normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor \x3d vec3( 0.0 );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result \x3d LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV \x3d saturate( dot( normal, viewDir ) );\n\tvec2 brdf \x3d integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV \x3d saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F \x3d F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf \x3d integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss \x3d F * brdf.x + brdf.y;\n\tfloat Ess \x3d brdf.x + brdf.y;\n\tfloat Ems \x3d 1.0 - Ess;\n\tvec3 Favg \x3d specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms \x3d FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter +\x3d FssEss;\n\tmultiScatter +\x3d Fms * Ems;\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 \x3d normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH \x3d saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH \x3d saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F \x3d F_Schlick( specularColor, dotLH );\n\tfloat G \x3d G_BlinnPhong_Implicit( );\n\tfloat D \x3d 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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha \x3d 1.0 / roughness;\n\tfloat cos2h \x3d NoH * NoH;\n\tfloat sin2h \x3d max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N \x3d geometry.normal;\n\tvec3 V \x3d geometry.viewDir;\n\tvec3 H \x3d normalize( V + L );\n\tfloat dotNH \x3d saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx \x3d dFdx( vUv );\n\t\tvec2 dSTdy \x3d dFdy( vUv );\n\t\tfloat Hll \x3d bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx \x3d bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy \x3d 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 \x3d vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY \x3d vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN \x3d surf_norm;\n\t\tvec3 R1 \x3d cross( vSigmaY, vN );\n\t\tvec3 R2 \x3d cross( vN, vSigmaX );\n\t\tfloat fDet \x3d dot( vSigmaX, R1 );\n\t\tfDet *\x3d ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad \x3d sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES \x3e 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane \x3d clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) \x3e plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES \x3c NUM_CLIPPING_PLANES\n\t\tbool clipped \x3d true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i \x3d UNION_CLIPPING_PLANES; i \x3c NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane \x3d clippingPlanes[ i ];\n\t\t\tclipped \x3d ( dot( vViewPosition, plane.xyz ) \x3e plane.w ) \x26\x26 clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES \x3e 0\n\t#if ! defined( STANDARD ) \x26\x26 ! defined( PHONG ) \x26\x26 ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES \x3e 0 \x26\x26 ! defined( STANDARD ) \x26\x26 ! defined( PHONG ) \x26\x26 ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES \x3e 0 \x26\x26 ! defined( STANDARD ) \x26\x26 ! defined( PHONG ) \x26\x26 ! defined( MATCAP )\n\tvViewPosition \x3d - mvPosition.xyz;\n#endif", color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *\x3d vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz \x3d 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 whiteComplement(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 \x3d 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 \x3d 12.9898, b \x3d 78.233, c \x3d 43758.5453;\n\thighp float dt \x3d dot( uv.xy, vec2( a,b ) ), sn \x3d mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent \x3d max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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 \x3d 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 ] \x3d vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] \x3d vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] \x3d vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights \x3d vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}", cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection \x3d abs(direction);\n\tint face \x3d -1;\n\tif( absDirection.x \x3e absDirection.z ) {\n\t\tif(absDirection.x \x3e absDirection.y )\n\t\t\tface \x3d direction.x \x3e 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface \x3d direction.y \x3e 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z \x3e absDirection.y )\n\t\t\tface \x3d direction.z \x3e 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface \x3d direction.y \x3e 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 \x3d exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness \x3d dFdx(roughness);\n\tfloat dyRoughness \x3d dFdy(roughness);\n\tvec3 dx \x3d dFdx( vec * scale * dxRoughness );\n\tvec3 dy \x3d dFdy( vec * scale * dyRoughness );\n\tfloat d \x3d max( dot( dx, dx ), dot( dy, dy ) );\n\td \x3d clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel \x3d 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 \x3d roughnessLevel \x3e cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a \x3d 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed \x3d exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed \x3d vec2( 1.0 ) / exp2_packed;\n\tfloat powScale \x3d exp2_packed.x * exp2_packed.y;\n\tfloat scale \x3d rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset \x3d 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes \x3d mipLevel \x3d\x3d 0.0;\n\tscale \x3d bRes \x26\x26 (scale \x3c a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face \x3d getFaceFromDirection(direction);\n\tfloat rcpPowScale \x3d 1.0 / powScale;\n\tif( face \x3d\x3d 0) {\n\t\tr \x3d vec3(direction.x, -direction.z, direction.y);\n\t\toffset \x3d vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? a : offset.y;\n\t}\n\telse if( face \x3d\x3d 1) {\n\t\tr \x3d vec3(direction.y, direction.x, direction.z);\n\t\toffset \x3d vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? a : offset.y;\n\t}\n\telse if( face \x3d\x3d 2) {\n\t\tr \x3d vec3(direction.z, direction.x, direction.y);\n\t\toffset \x3d vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? a : offset.y;\n\t}\n\telse if( face \x3d\x3d 3) {\n\t\tr \x3d vec3(direction.x, direction.z, direction.y);\n\t\toffset \x3d vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face \x3d\x3d 4) {\n\t\tr \x3d vec3(direction.y, direction.x, -direction.z);\n\t\toffset \x3d vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr \x3d vec3(direction.z, -direction.x, direction.y);\n\t\toffset \x3d vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr \x3d normalize(r);\n\tfloat texelOffset \x3d 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s \x3d ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base \x3d 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( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal \x3d roughness* cubeUV_maxLods3;\n\tfloat r1 \x3d floor(roughnessVal);\n\tfloat r2 \x3d r1 + 1.0;\n\tfloat t \x3d fract(roughnessVal);\n\tvec2 mipInfo \x3d MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s \x3d mipInfo.y;\n\tfloat level0 \x3d mipInfo.x;\n\tfloat level1 \x3d level0 + 1.0;\n\tlevel1 \x3d level1 \x3e 5.0 ? 5.0 : level1;\n\tlevel0 +\x3d min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 \x3d getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 \x3d envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 \x3d getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 \x3d envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result \x3d mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif", defaultnormal_vertex:"vec3 transformedNormal \x3d normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal \x3d - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent \x3d normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent \x3d - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed +\x3d normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif", emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor \x3d texture2D( emissiveMap, vUv );\n\temissiveColor.rgb \x3d emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *\x3d emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor \x3d linearToOutputTexel( gl_FragColor );",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.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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.a );\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.a );\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 \x3d max( max( value.r, value.g ), value.b );\n\tfloat fExp \x3d 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.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB \x3d max( value.r, max( value.g, value.b ) );\n\tfloat M \x3d clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM \x3d 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 \x3d max( value.r, max( value.g, value.b ) );\n\tfloat D \x3d max( maxRange / maxRGB, 1.0 );\n\tD \x3d min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM \x3d 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 \x3d cLogLuvM * value.rgb;\n\tXp_Y_XYZp \x3d max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy \x3d Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le \x3d 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w \x3d fract( Le );\n\tvResult.z \x3d ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM \x3d 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 \x3d value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y \x3d exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z \x3d Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x \x3d value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB \x3d cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}", envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToVertex \x3d normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal \x3d inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec \x3d reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec \x3d refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec \x3d vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor \x3d textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec \x3d normalize( reflectVec );\n\t\tsampleUV.y \x3d asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x \x3d atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor \x3d texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec \x3d normalize( reflectVec );\n\t\tvec3 reflectView \x3d normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor \x3d texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor \x3d vec4( 0.0 );\n\t#endif\n\tenvColor \x3d envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight \x3d mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight \x3d mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight +\x3d envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif", envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif", envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal \x3d inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec \x3d vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor \x3d textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec \x3d vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor \x3d textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor \x3d vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar \x3d float( maxMIPLevel );\n\t\tfloat sigma \x3d PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel \x3d maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec \x3d reflect( -viewDir, normal );\n\t\t reflectVec \x3d normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec \x3d refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec \x3d inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel \x3d getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec \x3d vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor \x3d textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec \x3d vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor \x3d textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y \x3d asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x \x3d atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor \x3d texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView \x3d 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 \x3d texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition \x3d worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex \x3d normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal \x3d inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect \x3d reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect \x3d refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth \x3d -mvPosition.z;\n#endif", fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor \x3d 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor \x3d smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb \x3d mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",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", gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL \x3d dot( normal, lightDirection );\n\t\tvec2 coord \x3d 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 \x3c 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse +\x3d PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif", lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse \x3d vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position \x3d mvPosition.xyz;\ngeometry.normal \x3d normalize( transformedNormal );\ngeometry.viewDir \x3d normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position \x3d geometry.position;\nbackGeometry.normal \x3d -geometry.normal;\nbackGeometry.viewDir \x3d geometry.viewDir;\nvLightFront \x3d vec3( 0.0 );\nvIndirectFront \x3d vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack \x3d vec3( 0.0 );\n\tvIndirectBack \x3d vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL \x3d dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse \x3d PI * directLight.color;\n\t\tvLightFront +\x3d saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +\x3d saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL \x3d dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse \x3d PI * directLight.color;\n\t\tvLightFront +\x3d saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +\x3d saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL \x3d dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse \x3d PI * directLight.color;\n\t\tvLightFront +\x3d saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +\x3d saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront +\x3d getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack +\x3d getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif", lights_pars_begin:"uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x \x3d normal.x, y \x3d normal.y, z \x3d normal.z;\n\tvec3 result \x3d shCoefficients[ 0 ] * 0.886227;\n\tresult +\x3d shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult +\x3d shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult +\x3d shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult +\x3d shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult +\x3d shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult +\x3d shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult +\x3d shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult +\x3d shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal \x3d inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance \x3d shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance \x3d ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *\x3d PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS \x3e 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 \x3d directionalLight.color;\n\t\tdirectLight.direction \x3d directionalLight.direction;\n\t\tdirectLight.visible \x3d true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS \x3e 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 \x3d pointLight.position - geometry.position;\n\t\tdirectLight.direction \x3d normalize( lVector );\n\t\tfloat lightDistance \x3d length( lVector );\n\t\tdirectLight.color \x3d pointLight.color;\n\t\tdirectLight.color *\x3d punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible \x3d ( directLight.color !\x3d vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS \x3e 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 \x3d spotLight.position - geometry.position;\n\t\tdirectLight.direction \x3d normalize( lVector );\n\t\tfloat lightDistance \x3d length( lVector );\n\t\tfloat angleCos \x3d dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos \x3e spotLight.coneCos ) {\n\t\t\tfloat spotEffect \x3d smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color \x3d spotLight.color;\n\t\t\tdirectLight.color *\x3d spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible \x3d true;\n\t\t} else {\n\t\t\tdirectLight.color \x3d vec3( 0.0 );\n\t\t\tdirectLight.visible \x3d false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS \x3e 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 \x3e 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 \x3d dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight \x3d 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance \x3d mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *\x3d PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor \x3d diffuseColor.rgb;\nmaterial.specularColor \x3d specular;\nmaterial.specularShininess \x3d shininess;\nmaterial.specularStrength \x3d specularStrength;",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 \x3d getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL \x3d saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance \x3d dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *\x3d PI;\n\t#endif\n\treflectedLight.directDiffuse +\x3d irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular +\x3d 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 +\x3d 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)", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor \x3d diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness \x3d clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor \x3d mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor \x3d mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat \x3d saturate( clearcoat );\tmaterial.clearcoatRoughness \x3d clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor \x3d sheen;\n#endif", lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#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 \x3e 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 \x3d geometry.normal;\n\t\tvec3 viewDir \x3d geometry.viewDir;\n\t\tvec3 position \x3d geometry.position;\n\t\tvec3 lightPos \x3d rectAreaLight.position;\n\t\tvec3 halfWidth \x3d rectAreaLight.halfWidth;\n\t\tvec3 halfHeight \x3d rectAreaLight.halfHeight;\n\t\tvec3 lightColor \x3d rectAreaLight.color;\n\t\tfloat roughness \x3d material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] \x3d lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] \x3d lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] \x3d lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] \x3d lightPos + halfWidth + halfHeight;\n\t\tvec2 uv \x3d LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 \x3d texture2D( ltc_1, uv );\n\t\tvec4 t2 \x3d texture2D( ltc_2, uv );\n\t\tmat3 mInv \x3d 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 \x3d ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular +\x3d lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse +\x3d 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 \x3d saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance \x3d dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *\x3d PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL \x3d saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance \x3d ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *\x3d PI;\n\t\t#endif\n\t\tfloat clearcoatDHR \x3d material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular +\x3d ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR \x3d 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular +\x3d ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular +\x3d ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse +\x3d ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse +\x3d irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV \x3d saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular +\x3d clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL \x3d ccDotNV;\n\t\tfloat clearcoatDHR \x3d material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR \x3d 0.0;\n\t#endif\n\tfloat clearcoatInv \x3d 1.0 - clearcoatDHR;\n\tvec3 singleScattering \x3d vec3( 0.0 );\n\tvec3 multiScattering \x3d vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance \x3d irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse \x3d material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular +\x3d clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse +\x3d multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse +\x3d diffuse * cosineWeightedIrradiance;\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\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}", lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position \x3d - vViewPosition;\ngeometry.normal \x3d normal;\ngeometry.viewDir \x3d normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal \x3d clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS \x3e 0 ) \x26\x26 defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight \x3d pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) \x26\x26 ( UNROLLED_LOOP_INDEX \x3c NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *\x3d 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 \x3e 0 ) \x26\x26 defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight \x3d spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) \x26\x26 ( UNROLLED_LOOP_INDEX \x3c NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *\x3d 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 \x3e 0 ) \x26\x26 defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight \x3d directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) \x26\x26 ( UNROLLED_LOOP_INDEX \x3c NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *\x3d 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 \x3e 0 ) \x26\x26 defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight \x3d rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance \x3d vec3( 0.0 );\n\tvec3 irradiance \x3d getAmbientLightIrradiance( ambientLightColor );\n\tirradiance +\x3d getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS \x3e 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i \x3d 0; i \x3c NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance +\x3d getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance \x3d vec3( 0.0 );\n\tvec3 clearcoatRadiance \x3d vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance \x3d texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *\x3d PI;\n\t\t#endif\n\t\tirradiance +\x3d lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) \x26\x26 defined( STANDARD ) \x26\x26 defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance +\x3d getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) \x26\x26 defined( RE_IndirectSpecular )\n\tradiance +\x3d getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance +\x3d getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif", 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, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) \x26\x26 defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT \x3d log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) \x26\x26 defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif", logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth \x3d 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z \x3d log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *\x3d gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor \x3d texture2D( map, vUv );\n\ttexelColor \x3d mapTexelToLinear( texelColor );\n\tdiffuseColor *\x3d texelColor;\n#endif", map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv \x3d ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel \x3d texture2D( map, uv );\n\tdiffuseColor *\x3d mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor \x3d metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness \x3d texture2D( metalnessMap, vUv );\n\tmetalnessFactor *\x3d texelMetalness.b;\n#endif", metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal +\x3d ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal +\x3d ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal +\x3d ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal +\x3d ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",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 +\x3d ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed +\x3d ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed +\x3d ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed +\x3d ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed +\x3d ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed +\x3d ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed +\x3d ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed +\x3d ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif", normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx \x3d vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy \x3d vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal \x3d normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal \x3d normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal \x3d normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent \x3d normalize( vTangent );\n\t\tvec3 bitangent \x3d normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent \x3d tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent \x3d bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal \x3d normal;", normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal \x3d - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal \x3d normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal \x3d normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN \x3d mat3( tangent, bitangent, normal );\n\t\tvec3 mapN \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy \x3d normalScale * mapN.xy;\n\t\tnormal \x3d normalize( vTBN * mapN );\n\t#else\n\t\tnormal \x3d perturbNormal2Arb( -vViewPosition, normal, normalScale, normalMap );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal \x3d perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif", normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) \x26\x26 ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap ) {\n\t\tvec3 q0 \x3d vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 \x3d vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 \x3d dFdx( vUv.st );\n\t\tvec2 st1 \x3d dFdy( vUv.st );\n\t\tfloat scale \x3d sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S \x3d normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T \x3d normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N \x3d normalize( surf_norm );\n\t\tvec3 mapN \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy *\x3d normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvec3 NfromST \x3d cross( S, T );\n\t\t\tif( dot( NfromST, N ) \x3e 0.0 ) {\n\t\t\t\tS *\x3d -1.0;\n\t\t\t\tT *\x3d -1.0;\n\t\t\t}\n\t\t#else\n\t\t\tmapN.xy *\x3d ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tmat3 tsn \x3d mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif", clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal \x3d geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN \x3d mat3( tangent, bitangent, clearcoatNormal );\n\t\tvec3 mapN \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy \x3d clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal \x3d normalize( vTBN * mapN );\n\t#else\n\t\tclearcoatNormal \x3d perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap );\n\t#endif\n#endif", clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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 \x3d 256. / 255.;const float UnpackDownscale \x3d 255. / 256.;\nconst vec3 PackFactors \x3d vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors \x3d UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 \x3d 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r \x3d vec4( fract( v * PackFactors ), v );\n\tr.yzw -\x3d r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 encodeHalfRGBA ( vec2 v ) {\n\tvec4 encoded \x3d vec4( 0.0 );\n\tconst vec2 offset \x3d vec2( 1.0 / 255.0, 0.0 );\n\tencoded.xy \x3d vec2( v.x, fract( v.x * 255.0 ) );\n\tencoded.xy \x3d encoded.xy - ( encoded.yy * offset );\n\tencoded.zw \x3d vec2( v.y, fract( v.y * 255.0 ) );\n\tencoded.zw \x3d encoded.zw - ( encoded.ww * offset );\n\treturn encoded;\n}\nvec2 decodeHalfRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\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}", premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *\x3d gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition \x3d modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position \x3d projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb \x3d dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position \x3d rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB \x3d vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB \x3d mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif", roughnessmap_fragment:"float roughnessFactor \x3d roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness \x3d texture2D( roughnessMap, vUv );\n\troughnessFactor *\x3d texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS \x3e 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS \x3e 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn decodeHalfRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion \x3d 1.0;\n\t\tvec2 distribution \x3d texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow \x3d step( compare , distribution.x );\n\t\tif (hard_shadow !\x3d 1.0 ) {\n\t\t\tfloat distance \x3d compare - distribution.x ;\n\t\t\tfloat variance \x3d max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability \x3d variance / (variance + distance * distance );\t\t\tsoftness_probability \x3d clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion \x3d clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset \x3d vec2( 0.0, 1.0 );\n\t\tvec2 texelSize \x3d vec2( 1.0 ) / size;\n\t\tvec2 centroidUV \x3d ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb \x3d texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt \x3d texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb \x3d texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt \x3d texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f \x3d fract( uv * size + 0.5 );\n\t\tfloat a \x3d mix( lb, lt, f.y );\n\t\tfloat b \x3d mix( rb, rt, f.y );\n\t\tfloat c \x3d 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 \x3d 1.0;\n\t\tshadowCoord.xyz /\x3d shadowCoord.w;\n\t\tshadowCoord.z +\x3d shadowBias;\n\t\tbvec4 inFrustumVec \x3d bvec4 ( shadowCoord.x \x3e\x3d 0.0, shadowCoord.x \x3c\x3d 1.0, shadowCoord.y \x3e\x3d 0.0, shadowCoord.y \x3c\x3d 1.0 );\n\t\tbool inFrustum \x3d all( inFrustumVec );\n\t\tbvec2 frustumTestVec \x3d bvec2( inFrustum, shadowCoord.z \x3c\x3d 1.0 );\n\t\tbool frustumTest \x3d all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize \x3d vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 \x3d - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 \x3d - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 \x3d + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 \x3d + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 \x3d dx0 / 2.0;\n\t\t\tfloat dy2 \x3d dy0 / 2.0;\n\t\t\tfloat dx3 \x3d dx1 / 2.0;\n\t\t\tfloat dy3 \x3d dy1 / 2.0;\n\t\t\tshadow \x3d (\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( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize \x3d vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 \x3d - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 \x3d - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 \x3d + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 \x3d + texelSize.y * shadowRadius;\n\t\t\tshadow \x3d (\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#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow \x3d VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow \x3d 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 \x3d abs( v );\n\t\tfloat scaleToCube \x3d 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *\x3d scaleToCube;\n\t\tv *\x3d scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar \x3d v.xy;\n\t\tfloat almostATexel \x3d 1.5 * texelSizeY;\n\t\tfloat almostOne \x3d 1.0 - almostATexel;\n\t\tif ( absV.z \x3e\x3d almostOne ) {\n\t\t\tif ( v.z \x3e 0.0 )\n\t\t\t\tplanar.x \x3d 4.0 - v.x;\n\t\t} else if ( absV.x \x3e\x3d almostOne ) {\n\t\t\tfloat signX \x3d sign( v.x );\n\t\t\tplanar.x \x3d v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y \x3e\x3d almostOne ) {\n\t\t\tfloat signY \x3d sign( v.y );\n\t\t\tplanar.x \x3d v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y \x3d 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 \x3d vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition \x3d shadowCoord.xyz;\n\t\tfloat dp \x3d ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp +\x3d shadowBias;\n\t\tvec3 bd3D \x3d normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset \x3d 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", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS \x3e 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS \x3e 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif", shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] \x3d directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] \x3d spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] \x3d pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif", shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow \x3d 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight \x3d directionalLights[ i ];\n\t\tshadow *\x3d 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_LIGHT_SHADOWS \x3e 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight \x3d spotLights[ i ];\n\t\tshadow *\x3d 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_LIGHT_SHADOWS \x3e 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight \x3d pointLights[ i ];\n\t\tshadow *\x3d 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}", skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX \x3d getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY \x3d getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ \x3d getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW \x3d 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 highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j \x3d i * 4.0;\n\t\t\tfloat x \x3d mod( j, float( boneTextureSize ) );\n\t\t\tfloat y \x3d floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx \x3d 1.0 / float( boneTextureSize );\n\t\t\tfloat dy \x3d 1.0 / float( boneTextureSize );\n\t\t\ty \x3d dy * ( y + 0.5 );\n\t\t\tvec4 v1 \x3d texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 \x3d texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 \x3d texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 \x3d texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone \x3d 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 \x3d boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif", skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex \x3d bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned \x3d vec4( 0.0 );\n\tskinned +\x3d boneMatX * skinVertex * skinWeight.x;\n\tskinned +\x3d boneMatY * skinVertex * skinWeight.y;\n\tskinned +\x3d boneMatZ * skinVertex * skinWeight.z;\n\tskinned +\x3d boneMatW * skinVertex * skinWeight.w;\n\ttransformed \x3d ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix \x3d mat4( 0.0 );\n\tskinMatrix +\x3d skinWeight.x * boneMatX;\n\tskinMatrix +\x3d skinWeight.y * boneMatY;\n\tskinMatrix +\x3d skinWeight.z * boneMatZ;\n\tskinMatrix +\x3d skinWeight.w * boneMatW;\n\tskinMatrix \x3d bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal \x3d vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent \x3d vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif", specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular \x3d texture2D( specularMap, vUv );\n\tspecularStrength \x3d texelSpecular.r;\n#else\n\tspecularStrength \x3d 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb \x3d toneMapping( gl_FragColor.rgb );\n#endif",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 *\x3d 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 *\x3d toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *\x3d toneMappingExposure;\n\tcolor \x3d 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}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *\x3d toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}", uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv \x3d ( 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 \x3d uv2;\n#endif", worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition \x3d modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor \x3d texture2D( t2D, vUv );\n\tgl_FragColor \x3d mapTexelToLinear( texColor );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv \x3d ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position \x3d vec4( position.xy, 1.0, 1.0 );\n}", cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor \x3d textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor \x3d mapTexelToLinear( texColor );\n\tgl_FragColor.a *\x3d opacity;\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n}",cube_vert:"varying vec3 vWorldDirection;\n#include \x3ccommon\x3e\nvoid main() {\n\tvWorldDirection \x3d transformDirection( position, modelMatrix );\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\tgl_Position.z \x3d gl_Position.w;\n}", depth_frag:"#if DEPTH_PACKING \x3d\x3d 3200\n\tuniform float opacity;\n#endif\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( 1.0 );\n\t#if DEPTH_PACKING \x3d\x3d 3200\n\t\tdiffuseColor.a \x3d opacity;\n\t#endif\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#if DEPTH_PACKING \x3d\x3d 3200\n\t\tgl_FragColor \x3d vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING \x3d\x3d 3201\n\t\tgl_FragColor \x3d packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}", depth_vert:"#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \x3cbeginnormal_vertex\x3e\n\t\t#include \x3cmorphnormal_vertex\x3e\n\t\t#include \x3cskinnormal_vertex\x3e\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n}", distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main () {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( 1.0 );\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\tfloat dist \x3d length( vWorldPosition - referencePosition );\n\tdist \x3d ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist \x3d saturate( dist );\n\tgl_FragColor \x3d packDepthToRGBA( dist );\n}", distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \x3cbeginnormal_vertex\x3e\n\t\t#include \x3cmorphnormal_vertex\x3e\n\t\t#include \x3cskinnormal_vertex\x3e\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\tvWorldPosition \x3d worldPosition.xyz;\n}", equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \x3ccommon\x3e\nvoid main() {\n\tvec3 direction \x3d normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y \x3d asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x \x3d atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor \x3d texture2D( tEquirect, sampleUV );\n\tgl_FragColor \x3d mapTexelToLinear( texColor );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n}", equirect_vert:"varying vec3 vWorldDirection;\n#include \x3ccommon\x3e\nvoid main() {\n\tvWorldDirection \x3d transformDirection( position, modelMatrix );\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tif ( mod( vLineDistance, totalSize ) \x3e dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight \x3d vec3( 0.0 );\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\toutgoingLight \x3d diffuseColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}", linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3ccolor_vertex\x3e\n\tvLineDistance \x3d scale * lineDistance;\n\tvec4 mvPosition \x3d modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position \x3d projectionMatrix * mvPosition;\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cspecularmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cspecularmap_fragment\x3e\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse +\x3d texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse +\x3d vec3( 1.0 );\n\t#endif\n\t#include \x3caomap_fragment\x3e\n\treflectedLight.indirectDiffuse *\x3d diffuseColor.rgb;\n\tvec3 outgoingLight \x3d reflectedLight.indirectDiffuse;\n\t#include \x3cenvmap_fragment\x3e\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}", meshbasic_vert:"#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cenvmap_pars_vertex\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#ifdef USE_ENVMAP\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cenvmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cdithering_pars_fragment\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cemissivemap_pars_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cshadowmask_pars_fragment\x3e\n#include \x3cspecularmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance \x3d emissive;\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cspecularmap_fragment\x3e\n\t#include \x3cemissivemap_fragment\x3e\n\treflectedLight.indirectDiffuse \x3d getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse +\x3d ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse +\x3d vIndirectFront;\n\t#endif\n\t#include \x3clightmap_fragment\x3e\n\treflectedLight.indirectDiffuse *\x3d BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse \x3d ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse \x3d vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *\x3d BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \x3caomap_fragment\x3e\n\tvec3 outgoingLight \x3d reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \x3cenvmap_fragment\x3e\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3cdithering_fragment\x3e\n}", meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cenvmap_pars_vertex\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cenvmap_vertex\x3e\n\t#include \x3clights_lambert_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\tvec3 viewDir \x3d normalize( vViewPosition );\n\tvec3 x \x3d normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y \x3d cross( viewDir, x );\n\tvec2 uv \x3d vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor \x3d texture2D( matcap, uv );\n\t\tmatcapColor \x3d matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor \x3d vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight \x3d diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}", meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n\t#ifndef FLAT_SHADED\n\t\tvNormal \x3d normalize( transformedNormal );\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n\tvViewPosition \x3d - mvPosition.xyz;\n}", meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cdithering_pars_fragment\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cemissivemap_pars_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_pars_fragment\x3e\n#include \x3cgradientmap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3clights_phong_pars_fragment\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3cspecularmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance \x3d emissive;\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cspecularmap_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\t#include \x3cemissivemap_fragment\x3e\n\t#include \x3clights_phong_fragment\x3e\n\t#include \x3clights_fragment_begin\x3e\n\t#include \x3clights_fragment_maps\x3e\n\t#include \x3clights_fragment_end\x3e\n\t#include \x3caomap_fragment\x3e\n\tvec3 outgoingLight \x3d reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \x3cenvmap_fragment\x3e\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3cdithering_fragment\x3e\n}", meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cenvmap_pars_vertex\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n#ifndef FLAT_SHADED\n\tvNormal \x3d normalize( transformedNormal );\n#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\tvViewPosition \x3d - mvPosition.xyz;\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cenvmap_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cdithering_pars_fragment\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cemissivemap_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3ccube_uv_reflection_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_physical_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3clights_physical_pars_fragment\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3cclearcoat_normalmap_pars_fragment\x3e\n#include \x3croughnessmap_pars_fragment\x3e\n#include \x3cmetalnessmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance \x3d emissive;\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3croughnessmap_fragment\x3e\n\t#include \x3cmetalnessmap_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\t#include \x3cclearcoat_normal_fragment_begin\x3e\n\t#include \x3cclearcoat_normal_fragment_maps\x3e\n\t#include \x3cemissivemap_fragment\x3e\n\t#include \x3clights_physical_fragment\x3e\n\t#include \x3clights_fragment_begin\x3e\n\t#include \x3clights_fragment_maps\x3e\n\t#include \x3clights_fragment_end\x3e\n\t#include \x3caomap_fragment\x3e\n\tvec3 outgoingLight \x3d reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *\x3d saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3cdithering_fragment\x3e\n}", meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n#ifndef FLAT_SHADED\n\tvNormal \x3d normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent \x3d normalize( transformedTangent );\n\t\tvBitangent \x3d normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\tvViewPosition \x3d - mvPosition.xyz;\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3cpacking\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\tgl_FragColor \x3d vec4( packNormalToRGB( normal ), opacity );\n}", normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n#ifndef FLAT_SHADED\n\tvNormal \x3d normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent \x3d normalize( transformedTangent );\n\t\tvBitangent \x3d normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition \x3d - mvPosition.xyz;\n#endif\n}", points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cmap_particle_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec3 outgoingLight \x3d vec3( 0.0 );\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_particle_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\toutgoingLight \x3d diffuseColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}", points_vert:"uniform float size;\nuniform float scale;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\tgl_PointSize \x3d size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective \x3d ( projectionMatrix[ 2 ][ 3 ] \x3d\x3d - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *\x3d ( scale / - mvPosition.z );\n\t#endif\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cshadowmask_pars_fragment\x3e\nvoid main() {\n\tgl_FragColor \x3d vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \x3cfog_fragment\x3e\n}",shadow_vert:"#include \x3cfog_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\nvoid main() {\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec3 outgoingLight \x3d vec3( 0.0 );\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\toutgoingLight \x3d diffuseColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\tvec4 mvPosition \x3d modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x \x3d length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y \x3d length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective \x3d ( projectionMatrix[ 2 ][ 3 ] \x3d\x3d - 1.0 );\n\t\tif ( isPerspective ) scale *\x3d - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition \x3d ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x \x3d cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y \x3d sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy +\x3d rotatedPosition;\n\tgl_Position \x3d projectionMatrix * mvPosition;\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}"}, Na={common:{diffuse:{value:new J(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new q},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null}, normalScale:{value:new e(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new J(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{}, shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}}, pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new J(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new q}},sprite:{diffuse:{value:new J(15658734)},opacity:{value:1},center:{value:new e(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new q}}},kd= {basic:{uniforms:Tb([Na.common,Na.specularmap,Na.envmap,Na.aomap,Na.lightmap,Na.fog]),vertexShader:mb.meshbasic_vert,fragmentShader:mb.meshbasic_frag},lambert:{uniforms:Tb([Na.common,Na.specularmap,Na.envmap,Na.aomap,Na.lightmap,Na.emissivemap,Na.fog,Na.lights,{emissive:{value:new J(0)}}]),vertexShader:mb.meshlambert_vert,fragmentShader:mb.meshlambert_frag},phong:{uniforms:Tb([Na.common,Na.specularmap,Na.envmap,Na.aomap,Na.lightmap,Na.emissivemap,Na.bumpmap,Na.normalmap,Na.displacementmap,Na.gradientmap, Na.fog,Na.lights,{emissive:{value:new J(0)},specular:{value:new J(1118481)},shininess:{value:30}}]),vertexShader:mb.meshphong_vert,fragmentShader:mb.meshphong_frag},standard:{uniforms:Tb([Na.common,Na.envmap,Na.aomap,Na.lightmap,Na.emissivemap,Na.bumpmap,Na.normalmap,Na.displacementmap,Na.roughnessmap,Na.metalnessmap,Na.fog,Na.lights,{emissive:{value:new J(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:mb.meshphysical_vert,fragmentShader:mb.meshphysical_frag}, matcap:{uniforms:Tb([Na.common,Na.bumpmap,Na.normalmap,Na.displacementmap,Na.fog,{matcap:{value:null}}]),vertexShader:mb.meshmatcap_vert,fragmentShader:mb.meshmatcap_frag},points:{uniforms:Tb([Na.points,Na.fog]),vertexShader:mb.points_vert,fragmentShader:mb.points_frag},dashed:{uniforms:Tb([Na.common,Na.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:mb.linedashed_vert,fragmentShader:mb.linedashed_frag},depth:{uniforms:Tb([Na.common,Na.displacementmap]),vertexShader:mb.depth_vert, fragmentShader:mb.depth_frag},normal:{uniforms:Tb([Na.common,Na.bumpmap,Na.normalmap,Na.displacementmap,{opacity:{value:1}}]),vertexShader:mb.normal_vert,fragmentShader:mb.normal_frag},sprite:{uniforms:Tb([Na.sprite,Na.fog]),vertexShader:mb.sprite_vert,fragmentShader:mb.sprite_frag},background:{uniforms:{uvTransform:{value:new q},t2D:{value:null}},vertexShader:mb.background_vert,fragmentShader:mb.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:mb.cube_vert, fragmentShader:mb.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:mb.equirect_vert,fragmentShader:mb.equirect_frag},distanceRGBA:{uniforms:Tb([Na.common,Na.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:mb.distanceRGBA_vert,fragmentShader:mb.distanceRGBA_frag},shadow:{uniforms:Tb([Na.lights,Na.fog,{color:{value:new J(0)},opacity:{value:1}}]),vertexShader:mb.shadow_vert,fragmentShader:mb.shadow_frag}};kd.physical= {uniforms:Tb([kd.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new J(0)},clearcoatNormalScale:{value:new e(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:mb.meshphysical_vert,fragmentShader:mb.meshphysical_frag};Yd.prototype=Object.create(Ua.prototype);Yd.prototype.constructor=Yd;jd.prototype=Object.create(Ba.prototype);jd.prototype.constructor=jd;Cd.prototype=Object.create(l.prototype);Cd.prototype.constructor=Cd;Cd.prototype.isCubeTexture= !0;Object.defineProperty(Cd.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});nf.prototype=Object.create(l.prototype);nf.prototype.constructor=nf;nf.prototype.isDataTexture2DArray=!0;of.prototype=Object.create(l.prototype);of.prototype.constructor=of;of.prototype.isDataTexture3D=!0;var Im=new l,rq=new nf,tq=new of,Jm=new Cd,Cm=[],Em=[],Hm=new Float32Array(16),Gm=new Float32Array(9),Fm=new Float32Array(4);Km.prototype.updateCache=function(a){var d=this.cache;a instanceof Float32Array&&d.length!==a.length&&(this.cache=new Float32Array(a.length));xc(d,a)};Lm.prototype.setValue=function(a,d,f){for(var h=this.seq,r=0,u=h.length;r!==u;++r){var w=h[r];w.setValue(a,d[w.id],f)}};var Qj=/([\w\d_]+)(\])?(\[|\.)?/g;ae.prototype.setValue=function(a,d,f,h){d=this.map[d];void 0!==d&&d.setValue(a,f,h)};ae.prototype.setOptional=function(a,d,f){d=d[f];void 0!==d&&this.setValue(a,f,d)};ae.upload=function(a,d,f,h){for(var r=0,u=d.length;r!==u;++r){var w=d[r],B=f[w.id];!1!==B.needsUpdate&& w.setValue(a,B.value,h)}};ae.seqWithValue=function(a,d){for(var f=[],h=0,r=a.length;h!==r;++h){var u=a[h];u.id in d&&f.push(u)}return f};var Xq=0,fr=0;be.prototype=Object.create(T.prototype);be.prototype.constructor=be;be.prototype.isMeshDepthMaterial=!0;be.prototype.copy=function(a){T.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale= a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this};ce.prototype=Object.create(T.prototype);ce.prototype.constructor=ce;ce.prototype.isMeshDistanceMaterial=!0;ce.prototype.copy=function(a){T.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition);this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap= a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;return this};qf.prototype=Object.assign(Object.create(y.prototype),{constructor:qf,isGroup:!0});Kg.prototype=Object.assign(Object.create(Ab.prototype),{constructor:Kg,isArrayCamera:!0});var Ym=new k,Zm=new k;Object.assign(Sj.prototype,c.prototype);Object.assign($m.prototype,c.prototype);Object.assign(fi.prototype,{isFogExp2:!0,clone:function(){return new fi(this.color, this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(gi.prototype,{isFog:!0,clone:function(){return new gi(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(Be.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Be.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.count=void 0!==a?a.length/this.stride:0;this.array=a;return this},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.dynamic=a.dynamic;return this},copyAt:function(a,d,f){a*=this.stride;f*=d.stride;for(var h=0,r=this.stride;h<r;h++)this.array[a+h]=d.array[f+h];return this},set:function(a,d){void 0===d&&(d=0);this.array.set(a,d);return this},clone:function(){return(new this.constructor).copy(this)}, onUpload:function(a){this.onUploadCallback=a;return this}});Object.defineProperties(Mg.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}});Object.assign(Mg.prototype,{isInterleavedBufferAttribute:!0,setX:function(a,d){this.data.array[a*this.data.stride+this.offset]=d;return this},setY:function(a,d){this.data.array[a*this.data.stride+this.offset+1]=d;return this},setZ:function(a,d){this.data.array[a*this.data.stride+this.offset+2]=d;return this}, setW:function(a,d){this.data.array[a*this.data.stride+this.offset+3]=d;return this},getX:function(a){return this.data.array[a*this.data.stride+this.offset]},getY:function(a){return this.data.array[a*this.data.stride+this.offset+1]},getZ:function(a){return this.data.array[a*this.data.stride+this.offset+2]},getW:function(a){return this.data.array[a*this.data.stride+this.offset+3]},setXY:function(a,d,f){a=a*this.data.stride+this.offset;this.data.array[a+0]=d;this.data.array[a+1]=f;return this},setXYZ:function(a, d,f,h){a=a*this.data.stride+this.offset;this.data.array[a+0]=d;this.data.array[a+1]=f;this.data.array[a+2]=h;return this},setXYZW:function(a,d,f,h,r){a=a*this.data.stride+this.offset;this.data.array[a+0]=d;this.data.array[a+1]=f;this.data.array[a+2]=h;this.data.array[a+3]=r;return this}});ge.prototype=Object.create(T.prototype);ge.prototype.constructor=ge;ge.prototype.isSpriteMaterial=!0;ge.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.rotation= a.rotation;this.sizeAttenuation=a.sizeAttenuation;return this};var xf,Bh=new k,jg=new k,kg=new k,yf=new e,Og=new e,en=new t,Xi=new k,Ch=new k,Yi=new k,Kn=new e,Qk=new e,Ln=new e;Ng.prototype=Object.assign(Object.create(y.prototype),{constructor:Ng,isSprite:!0,raycast:function(a,d){null===a.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');jg.setFromMatrixScale(this.matrixWorld);en.copy(a.camera.matrixWorld);this.modelViewMatrix.multiplyMatrices(a.camera.matrixWorldInverse, this.matrixWorld);kg.setFromMatrixPosition(this.modelViewMatrix);a.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&jg.multiplyScalar(-kg.z);var f=this.material.rotation;if(0!==f){var h=Math.cos(f);var r=Math.sin(f)}f=this.center;hi(Xi.set(-.5,-.5,0),kg,f,jg,r,h);hi(Ch.set(.5,-.5,0),kg,f,jg,r,h);hi(Yi.set(.5,.5,0),kg,f,jg,r,h);Kn.set(0,0);Qk.set(1,0);Ln.set(1,1);var u=a.ray.intersectTriangle(Xi,Ch,Yi,!1,Bh);if(null===u&&(hi(Ch.set(-.5,.5,0),kg,f,jg,r,h),Qk.set(0,1),u=a.ray.intersectTriangle(Xi, Yi,Ch,!1,Bh),null===u))return;r=a.ray.origin.distanceTo(Bh);r<a.near||r>a.far||d.push({distance:r,point:Bh.clone(),uv:F.getUV(Bh,Xi,Ch,Yi,Kn,Qk,Ln,new e),face:null,object:this})},clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){y.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});var Zi=new k,Mn=new k;Pg.prototype=Object.assign(Object.create(y.prototype),{constructor:Pg,isLOD:!0,copy:function(a){y.prototype.copy.call(this, a,!1);a=a.levels;for(var d=0,f=a.length;d<f;d++){var h=a[d];this.addLevel(h.object.clone(),h.distance)}return this},addLevel:function(a,d){void 0===d&&(d=0);d=Math.abs(d);for(var f=this.levels,h=0;h<f.length&&!(d<f[h].distance);h++);f.splice(h,0,{distance:d,object:a});this.add(a);return this},getObjectForDistance:function(a){for(var d=this.levels,f=1,h=d.length;f<h&&!(a<d[f].distance);f++);return d[f-1].object},raycast:function(a,d){Zi.setFromMatrixPosition(this.matrixWorld);this.getObjectForDistance(a.ray.origin.distanceTo(Zi)).raycast(a, d)},update:function(a){var d=this.levels;if(1<d.length){Zi.setFromMatrixPosition(a.matrixWorld);Mn.setFromMatrixPosition(this.matrixWorld);a=Zi.distanceTo(Mn);d[0].object.visible=!0;for(var f=1,h=d.length;f<h;f++)if(a>=d[f].distance)d[f-1].object.visible=!1,d[f].object.visible=!0;else break;for(;f<h;f++)d[f].object.visible=!1}},toJSON:function(a){a=y.prototype.toJSON.call(this,a);a.object.levels=[];for(var d=this.levels,f=0,h=d.length;f<h;f++){var r=d[f];a.object.levels.push({object:r.object.uuid, distance:r.distance})}return a}});Qg.prototype=Object.assign(Object.create(Nb.prototype),{constructor:Qg,isSkinnedMesh:!0,bind:function(a,d){this.skeleton=a;void 0===d&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),d=this.matrixWorld);this.bindMatrix.copy(d);this.bindMatrixInverse.getInverse(d)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var a=new m,d=this.geometry.attributes.skinWeight,f=0,h=d.count;f<h;f++){a.x=d.getX(f);a.y=d.getY(f);a.z=d.getZ(f); a.w=d.getW(f);var r=1/a.manhattanLength();Infinity!==r?a.multiplyScalar(r):a.set(1,0,0,0);d.setXYZW(f,a.x,a.y,a.z,a.w)}},updateMatrixWorld:function(a){Nb.prototype.updateMatrixWorld.call(this,a);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}}); var Nn=new t,Vr=new t;Object.assign(ii.prototype,{calculateInverses:function(){this.boneInverses=[];for(var a=0,d=this.bones.length;a<d;a++){var f=new t;this.bones[a]&&f.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(f)}},pose:function(){var a,d;var f=0;for(d=this.bones.length;f<d;f++)(a=this.bones[f])&&a.matrixWorld.getInverse(this.boneInverses[f]);f=0;for(d=this.bones.length;f<d;f++)if(a=this.bones[f])a.parent&&a.parent.isBone?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)): a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale)},update:function(){for(var a=this.bones,d=this.boneInverses,f=this.boneMatrices,h=this.boneTexture,r=0,u=a.length;r<u;r++)Nn.multiplyMatrices(a[r]?a[r].matrixWorld:Vr,d[r]),Nn.toArray(f,16*r);void 0!==h&&(h.needsUpdate=!0)},clone:function(){return new ii(this.bones,this.boneInverses)},getBoneByName:function(a){for(var d=0,f=this.bones.length;d<f;d++){var h=this.bones[d];if(h.name===a)return h}}});Zj.prototype=Object.assign(Object.create(y.prototype), {constructor:Zj,isBone:!0});Bb.prototype=Object.create(T.prototype);Bb.prototype.constructor=Bb;Bb.prototype.isLineBasicMaterial=!0;Bb.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);this.linewidth=a.linewidth;this.linecap=a.linecap;this.linejoin=a.linejoin;return this};var On=new k,Pn=new k,Qn=new t,$i=new E,Dh=new H;dc.prototype=Object.assign(Object.create(y.prototype),{constructor:dc,isLine:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null=== a.index){for(var d=a.attributes.position,f=[0],h=1,r=d.count;h<r;h++)On.fromBufferAttribute(d,h-1),Pn.fromBufferAttribute(d,h),f[h]=f[h-1],f[h]+=On.distanceTo(Pn);a.addAttribute("lineDistance",new pa(f,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(a.isGeometry)for(d=a.vertices,f=a.lineDistances,f[0]=0,h=1,r=d.length;h<r;h++)f[h]=f[h-1],f[h]+=d[h-1].distanceTo(d[h]);return this},raycast:function(a,d){var f=a.linePrecision, h=this.geometry,r=this.matrixWorld;null===h.boundingSphere&&h.computeBoundingSphere();Dh.copy(h.boundingSphere);Dh.applyMatrix4(r);Dh.radius+=f;if(!1!==a.ray.intersectsSphere(Dh)){Qn.getInverse(r);$i.copy(a.ray).applyMatrix4(Qn);f/=(this.scale.x+this.scale.y+this.scale.z)/3;f*=f;var u=new k,w=new k;r=new k;var B=new k,C=this&&this.isLineSegments?2:1;if(h.isBufferGeometry){var G=h.index,K=h.attributes.position.array;if(null!==G){G=G.array;h=0;for(var L=G.length-1;h<L;h+=C){var M=G[h+1];u.fromArray(K, 3*G[h]);w.fromArray(K,3*M);M=$i.distanceSqToSegment(u,w,B,r);M>f||(B.applyMatrix4(this.matrixWorld),M=a.ray.origin.distanceTo(B),M<a.near||M>a.far||d.push({distance:M,point:r.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}}else for(h=0,L=K.length/3-1;h<L;h+=C)u.fromArray(K,3*h),w.fromArray(K,3*h+3),M=$i.distanceSqToSegment(u,w,B,r),M>f||(B.applyMatrix4(this.matrixWorld),M=a.ray.origin.distanceTo(B),M<a.near||M>a.far||d.push({distance:M,point:r.clone().applyMatrix4(this.matrixWorld), index:h,face:null,faceIndex:null,object:this}))}else if(h.isGeometry)for(u=h.vertices,w=u.length,h=0;h<w-1;h+=C)M=$i.distanceSqToSegment(u[h],u[h+1],B,r),M>f||(B.applyMatrix4(this.matrixWorld),M=a.ray.origin.distanceTo(B),M<a.near||M>a.far||d.push({distance:M,point:r.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var aj=new k,bj=new k;Eb.prototype=Object.assign(Object.create(dc.prototype), {constructor:Eb,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var d=a.attributes.position,f=[],h=0,r=d.count;h<r;h+=2)aj.fromBufferAttribute(d,h),bj.fromBufferAttribute(d,h+1),f[h]=0===h?0:f[h-1],f[h+1]=f[h]+aj.distanceTo(bj);a.addAttribute("lineDistance",new pa(f,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(a.isGeometry)for(d=a.vertices,f= a.lineDistances,h=0,r=d.length;h<r;h+=2)aj.copy(d[h]),bj.copy(d[h+1]),f[h]=0===h?0:f[h-1],f[h+1]=f[h]+aj.distanceTo(bj);return this}});ji.prototype=Object.assign(Object.create(dc.prototype),{constructor:ji,isLineLoop:!0});Sc.prototype=Object.create(T.prototype);Sc.prototype.constructor=Sc;Sc.prototype.isPointsMaterial=!0;Sc.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;this.morphTargets=a.morphTargets; return this};var Rn=new t,bk=new E,Eh=new H,cj=new k;zf.prototype=Object.assign(Object.create(y.prototype),{constructor:zf,isPoints:!0,raycast:function(a,d){var f=this.geometry,h=this.matrixWorld,r=a.params.Points.threshold;null===f.boundingSphere&&f.computeBoundingSphere();Eh.copy(f.boundingSphere);Eh.applyMatrix4(h);Eh.radius+=r;if(!1!==a.ray.intersectsSphere(Eh))if(Rn.getInverse(h),bk.copy(a.ray).applyMatrix4(Rn),r/=(this.scale.x+this.scale.y+this.scale.z)/3,r*=r,f.isBufferGeometry){var u=f.index; f=f.attributes.position.array;if(null!==u){var w=u.array;u=0;for(var B=w.length;u<B;u++){var C=w[u];cj.fromArray(f,3*C);ak(cj,C,r,h,a,d,this)}}else for(u=0,w=f.length/3;u<w;u++)cj.fromArray(f,3*u),ak(cj,u,r,h,a,d,this)}else for(f=f.vertices,u=0,w=f.length;u<w;u++)ak(f[u],u,r,h,a,d,this)},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var d=Object.keys(a);if(0<d.length){var f=a[d[0]];if(void 0!==f)for(this.morphTargetInfluences=[],this.morphTargetDictionary= {},a=0,d=f.length;a<d;a++){var h=f[a].name||String(a);this.morphTargetInfluences.push(0);this.morphTargetDictionary[h]=a}}}else a=a.morphTargets,void 0!==a&&0<a.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});ck.prototype=Object.assign(Object.create(l.prototype),{constructor:ck,isVideoTexture:!0,update:function(){var a=this.image;a.readyState>= a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Af.prototype=Object.create(l.prototype);Af.prototype.constructor=Af;Af.prototype.isCompressedTexture=!0;Rg.prototype=Object.create(l.prototype);Rg.prototype.constructor=Rg;Rg.prototype.isCanvasTexture=!0;Sg.prototype=Object.create(l.prototype);Sg.prototype.constructor=Sg;Sg.prototype.isDepthTexture=!0;Bf.prototype=Object.create(Ba.prototype);Bf.prototype.constructor=Bf;Tg.prototype=Object.create(Ua.prototype);Tg.prototype.constructor=Tg;Cf.prototype=Object.create(Ba.prototype); Cf.prototype.constructor=Cf;Ug.prototype=Object.create(Ua.prototype);Ug.prototype.constructor=Ug;tc.prototype=Object.create(Ba.prototype);tc.prototype.constructor=tc;Vg.prototype=Object.create(Ua.prototype);Vg.prototype.constructor=Vg;Df.prototype=Object.create(tc.prototype);Df.prototype.constructor=Df;Wg.prototype=Object.create(Ua.prototype);Wg.prototype.constructor=Wg;Ce.prototype=Object.create(tc.prototype);Ce.prototype.constructor=Ce;Xg.prototype=Object.create(Ua.prototype);Xg.prototype.constructor= Xg;Ef.prototype=Object.create(tc.prototype);Ef.prototype.constructor=Ef;Yg.prototype=Object.create(Ua.prototype);Yg.prototype.constructor=Yg;Ff.prototype=Object.create(tc.prototype);Ff.prototype.constructor=Ff;Zg.prototype=Object.create(Ua.prototype);Zg.prototype.constructor=Zg;De.prototype=Object.create(Ba.prototype);De.prototype.constructor=De;De.prototype.toJSON=function(){var a=Ba.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};$g.prototype=Object.create(Ua.prototype); $g.prototype.constructor=$g;Gf.prototype=Object.create(Ba.prototype);Gf.prototype.constructor=Gf;ah.prototype=Object.create(Ua.prototype);ah.prototype.constructor=ah;Hf.prototype=Object.create(Ba.prototype);Hf.prototype.constructor=Hf;var Wr={triangulate:function(a,d,f){f=f||2;var h=d&&d.length,r=h?d[0]*f:a.length,u=fn(a,0,r,f,!0),w=[];if(!u||u.next===u.prev)return w;h&&(u=qr(a,d,u,f));if(a.length>80*f){var B=d=a[0];var C=h=a[1];for(var G=f;G<r;G+=f){var K=a[G];var L=a[G+1];K<B&&(B=K);L<C&&(C=L); K>d&&(d=K);L>h&&(h=L)}K=Math.max(d-B,h-C);K=0!==K?1/K:0}dh(u,w,f,B,C,K);return w}},Ed={area:function(a){for(var d=a.length,f=0,h=d-1,r=0;r<d;h=r++)f+=a[h].x*a[r].y-a[r].x*a[h].y;return.5*f},isClockWise:function(a){return 0>Ed.area(a)},triangulateShape:function(a,d){var f=[],h=[],r=[];kn(a);ln(f,a);var u=a.length;d.forEach(kn);for(a=0;a<d.length;a++)h.push(u),u+=d[a].length,ln(f,d[a]);d=Wr.triangulate(f,h);for(a=0;a<d.length;a+=3)r.push(d.slice(a,a+3));return r}};Fe.prototype=Object.create(Ua.prototype); Fe.prototype.constructor=Fe;Fe.prototype.toJSON=function(){var a=Ua.prototype.toJSON.call(this);return mn(this.parameters.shapes,this.parameters.options,a)};pd.prototype=Object.create(Ba.prototype);pd.prototype.constructor=pd;pd.prototype.toJSON=function(){var a=Ba.prototype.toJSON.call(this);return mn(this.parameters.shapes,this.parameters.options,a)};var yr={generateTopUV:function(a,d,f,h,r){a=d[3*h];h=d[3*h+1];var u=d[3*r];r=d[3*r+1];return[new e(d[3*f],d[3*f+1]),new e(a,h),new e(u,r)]},generateSideWallUV:function(a, d,f,h,r,u){a=d[3*f];var w=d[3*f+1];f=d[3*f+2];var B=d[3*h],C=d[3*h+1];h=d[3*h+2];var G=d[3*r],K=d[3*r+1];r=d[3*r+2];var L=d[3*u],M=d[3*u+1];d=d[3*u+2];return.01>Math.abs(w-C)?[new e(a,1-f),new e(B,1-h),new e(G,1-r),new e(L,1-d)]:[new e(w,1-f),new e(C,1-h),new e(K,1-r),new e(M,1-d)]}};fh.prototype=Object.create(Ua.prototype);fh.prototype.constructor=fh;Jf.prototype=Object.create(pd.prototype);Jf.prototype.constructor=Jf;gh.prototype=Object.create(Ua.prototype);gh.prototype.constructor=gh;he.prototype= Object.create(Ba.prototype);he.prototype.constructor=he;hh.prototype=Object.create(Ua.prototype);hh.prototype.constructor=hh;Kf.prototype=Object.create(Ba.prototype);Kf.prototype.constructor=Kf;ih.prototype=Object.create(Ua.prototype);ih.prototype.constructor=ih;Lf.prototype=Object.create(Ba.prototype);Lf.prototype.constructor=Lf;Ge.prototype=Object.create(Ua.prototype);Ge.prototype.constructor=Ge;Ge.prototype.toJSON=function(){var a=Ua.prototype.toJSON.call(this);return nn(this.parameters.shapes, a)};He.prototype=Object.create(Ba.prototype);He.prototype.constructor=He;He.prototype.toJSON=function(){var a=Ba.prototype.toJSON.call(this);return nn(this.parameters.shapes,a)};Mf.prototype=Object.create(Ba.prototype);Mf.prototype.constructor=Mf;Ie.prototype=Object.create(Ua.prototype);Ie.prototype.constructor=Ie;Fd.prototype=Object.create(Ba.prototype);Fd.prototype.constructor=Fd;jh.prototype=Object.create(Ie.prototype);jh.prototype.constructor=jh;kh.prototype=Object.create(Fd.prototype);kh.prototype.constructor= kh;lh.prototype=Object.create(Ua.prototype);lh.prototype.constructor=lh;Nf.prototype=Object.create(Ba.prototype);Nf.prototype.constructor=Nf;var rc=Object.freeze({WireframeGeometry:Bf,ParametricGeometry:Tg,ParametricBufferGeometry:Cf,TetrahedronGeometry:Vg,TetrahedronBufferGeometry:Df,OctahedronGeometry:Wg,OctahedronBufferGeometry:Ce,IcosahedronGeometry:Xg,IcosahedronBufferGeometry:Ef,DodecahedronGeometry:Yg,DodecahedronBufferGeometry:Ff,PolyhedronGeometry:Ug,PolyhedronBufferGeometry:tc,TubeGeometry:Zg, TubeBufferGeometry:De,TorusKnotGeometry:$g,TorusKnotBufferGeometry:Gf,TorusGeometry:ah,TorusBufferGeometry:Hf,TextGeometry:fh,TextBufferGeometry:Jf,SphereGeometry:gh,SphereBufferGeometry:he,RingGeometry:hh,RingBufferGeometry:Kf,PlaneGeometry:Yd,PlaneBufferGeometry:jd,LatheGeometry:ih,LatheBufferGeometry:Lf,ShapeGeometry:Ge,ShapeBufferGeometry:He,ExtrudeGeometry:Fe,ExtrudeBufferGeometry:pd,EdgesGeometry:Mf,ConeGeometry:jh,ConeBufferGeometry:kh,CylinderGeometry:Ie,CylinderBufferGeometry:Fd,CircleGeometry:lh, CircleBufferGeometry:Nf,BoxGeometry:Cb,BoxBufferGeometry:Qb});Je.prototype=Object.create(T.prototype);Je.prototype.constructor=Je;Je.prototype.isShadowMaterial=!0;Je.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);return this};Of.prototype=Object.create(Ub.prototype);Of.prototype.constructor=Of;Of.prototype.isRawShaderMaterial=!0;qd.prototype=Object.create(T.prototype);qd.prototype.constructor=qd;qd.prototype.isMeshStandardMaterial=!0;qd.prototype.copy=function(a){T.prototype.copy.call(this, a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale); this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets= a.morphTargets;this.morphNormals=a.morphNormals;return this};Ke.prototype=Object.create(qd.prototype);Ke.prototype.constructor=Ke;Ke.prototype.isMeshPhysicalMaterial=!0;Ke.prototype.copy=function(a){qd.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatRoughness=a.clearcoatRoughness;this.sheen=a.sheen?(this.sheen||new J).copy(a.sheen):null;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale); this.transparency=a.transparency;return this};Tc.prototype=Object.create(T.prototype);Tc.prototype.constructor=Tc;Tc.prototype.isMeshPhongMaterial=!0;Tc.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity= a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth= a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Le.prototype=Object.create(Tc.prototype);Le.prototype.constructor=Le;Le.prototype.isMeshToonMaterial=!0;Le.prototype.copy=function(a){Tc.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};Me.prototype=Object.create(T.prototype);Me.prototype.constructor=Me;Me.prototype.isMeshNormalMaterial= !0;Me.prototype.copy=function(a){T.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this}; Ne.prototype=Object.create(T.prototype);Ne.prototype.constructor=Ne;Ne.prototype.isMeshLambertMaterial=!0;Ne.prototype.copy=function(a){T.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap= a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Oe.prototype=Object.create(T.prototype);Oe.prototype.constructor=Oe;Oe.prototype.isMeshMatcapMaterial=!0;Oe.prototype.copy=function(a){T.prototype.copy.call(this, a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Pe.prototype= Object.create(Bb.prototype);Pe.prototype.constructor=Pe;Pe.prototype.isLineDashedMaterial=!0;Pe.prototype.copy=function(a){Bb.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Xr=Object.freeze({ShadowMaterial:Je,SpriteMaterial:ge,RawShaderMaterial:Of,ShaderMaterial:Ub,PointsMaterial:Sc,MeshPhysicalMaterial:Ke,MeshStandardMaterial:qd,MeshPhongMaterial:Tc,MeshToonMaterial:Le,MeshNormalMaterial:Me,MeshLambertMaterial:Ne,MeshDepthMaterial:be, MeshDistanceMaterial:ce,MeshBasicMaterial:aa,MeshMatcapMaterial:Oe,LineDashedMaterial:Pe,LineBasicMaterial:Bb,Material:T}),ac={arraySlice:function(a,d,f){return ac.isTypedArray(a)?new a.constructor(a.subarray(d,void 0!==f?f:a.length)):a.slice(d,f)},convertArray:function(a,d,f){return!a||!f&&a.constructor===d?a:"number"===typeof d.BYTES_PER_ELEMENT?new d(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var d= a.length,f=Array(d),h=0;h!==d;++h)f[h]=h;f.sort(function(r,u){return a[r]-a[u]});return f},sortedArray:function(a,d,f){for(var h=a.length,r=new a.constructor(h),u=0,w=0;w!==h;++u)for(var B=f[u]*d,C=0;C!==d;++C)r[w++]=a[B+C];return r},flattenJSON:function(a,d,f,h){for(var r=1,u=a[0];void 0!==u&&void 0===u[h];)u=a[r++];if(void 0!==u){var w=u[h];if(void 0!==w)if(Array.isArray(w)){do w=u[h],void 0!==w&&(d.push(u.time),f.push.apply(f,w)),u=a[r++];while(void 0!==u)}else if(void 0!==w.toArray){do w=u[h], void 0!==w&&(d.push(u.time),w.toArray(f,f.length)),u=a[r++];while(void 0!==u)}else{do w=u[h],void 0!==w&&(d.push(u.time),f.push(w)),u=a[r++];while(void 0!==u)}}}};Object.assign(zc.prototype,{evaluate:function(a){var d=this.parameterPositions,f=this._cachedIndex,h=d[f],r=d[f-1];a:{b:{c:{d:if(!(a<h)){for(var u=f+2;;){if(void 0===h){if(a<r)break d;this._cachedIndex=f=d.length;return this.afterEnd_(f-1,a,r)}if(f===u)break;r=h;h=d[++f];if(a<h)break b}h=d.length;break c}if(a>=r)break a;else{u=d[1];a<u&& (f=2,r=u);for(u=f-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,a,h);if(f===u)break;h=r;r=d[--f-1];if(a>=r)break b}h=f;f=0}}for(;f<h;)r=f+h>>>1,a<d[r]?h=r:f=r+1;h=d[f];r=d[f-1];if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,a,h);if(void 0===h)return this._cachedIndex=f=d.length,this.afterEnd_(f-1,r,a)}this._cachedIndex=f;this.intervalChanged_(f,r,h)}return this.interpolate_(f,r,a,h)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings|| this.DefaultSettings_},copySampleValue_:function(a){var d=this.resultBuffer,f=this.sampleValues,h=this.valueSize;a*=h;for(var r=0;r!==h;++r)d[r]=f[a+r];return d},interpolate_:function(){throw Error("call to abstract method");},intervalChanged_:function(){}});Object.assign(zc.prototype,{beforeStart_:zc.prototype.copySampleValue_,afterEnd_:zc.prototype.copySampleValue_});ki.prototype=Object.assign(Object.create(zc.prototype),{constructor:ki,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(a, d,f){var h=this.parameterPositions,r=a-2,u=a+1,w=h[r],B=h[u];if(void 0===w)switch(this.getSettings_().endingStart){case 2401:r=a;w=2*d-f;break;case 2402:r=h.length-2;w=d+h[r]-h[r+1];break;default:r=a,w=f}if(void 0===B)switch(this.getSettings_().endingEnd){case 2401:u=a;B=2*f-d;break;case 2402:u=1;B=f+h[1]-h[0];break;default:u=a-1,B=d}a=.5*(f-d);h=this.valueSize;this._weightPrev=a/(d-w);this._weightNext=a/(B-f);this._offsetPrev=r*h;this._offsetNext=u*h},interpolate_:function(a,d,f,h){var r=this.resultBuffer, u=this.sampleValues,w=this.valueSize;a*=w;var B=a-w,C=this._offsetPrev,G=this._offsetNext,K=this._weightPrev,L=this._weightNext,M=(f-d)/(h-d);f=M*M;h=f*M;d=-K*h+2*K*f-K*M;K=(1+K)*h+(-1.5-2*K)*f+(-.5+K)*M+1;M=(-1-L)*h+(1.5+L)*f+.5*M;L=L*h-L*f;for(f=0;f!==w;++f)r[f]=d*u[C+f]+K*u[B+f]+M*u[a+f]+L*u[G+f];return r}});mh.prototype=Object.assign(Object.create(zc.prototype),{constructor:mh,interpolate_:function(a,d,f,h){var r=this.resultBuffer,u=this.sampleValues,w=this.valueSize;a*=w;var B=a-w;d=(f-d)/(h- d);f=1-d;for(h=0;h!==w;++h)r[h]=u[B+h]*f+u[a+h]*d;return r}});li.prototype=Object.assign(Object.create(zc.prototype),{constructor:li,interpolate_:function(a){return this.copySampleValue_(a-1)}});Object.assign(fc,{toJSON:function(a){var d=a.constructor;if(void 0!==d.toJSON)d=d.toJSON(a);else{d={name:a.name,times:ac.convertArray(a.times,Array),values:ac.convertArray(a.values,Array)};var f=a.getInterpolation();f!==a.DefaultInterpolation&&(d.interpolation=f)}d.type=a.ValueTypeName;return d}});Object.assign(fc.prototype, {constructor:fc,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new li(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new mh(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:function(a){return new ki(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){switch(a){case 2300:var d=this.InterpolantFactoryMethodDiscrete; break;case 2301:d=this.InterpolantFactoryMethodLinear;break;case 2302:d=this.InterpolantFactoryMethodSmooth}if(void 0===d){d="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(d);console.warn("THREE.KeyframeTrack:",d);return this}this.createInterpolant=d;return this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300; case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(a){if(0!==a)for(var d=this.times,f=0,h=d.length;f!==h;++f)d[f]+=a;return this},scale:function(a){if(1!==a)for(var d=this.times,f=0,h=d.length;f!==h;++f)d[f]*=a;return this},trim:function(a,d){for(var f=this.times,h=f.length,r=0,u=h-1;r!==h&&f[r]<a;)++r;for(;-1!==u&&f[u]>d;)--u;++u;if(0!==r||u!==h)r>=u&&(u=Math.max(u, 1),r=u-1),a=this.getValueSize(),this.times=ac.arraySlice(f,r,u),this.values=ac.arraySlice(this.values,r*a,u*a);return this},validate:function(){var a=!0,d=this.getValueSize();0!==d-Math.floor(d)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var f=this.times;d=this.values;var h=f.length;0===h&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var r=null,u=0;u!==h;u++){var w=f[u];if("number"===typeof w&&isNaN(w)){console.error("THREE.KeyframeTrack: Time is not a valid number.", this,u,w);a=!1;break}if(null!==r&&r>w){console.error("THREE.KeyframeTrack: Out of order keys.",this,u,w,r);a=!1;break}r=w}if(void 0!==d&&ac.isTypedArray(d))for(u=0,f=d.length;u!==f;++u)if(h=d[u],isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,u,h);a=!1;break}return a},optimize:function(){for(var a=this.times,d=this.values,f=this.getValueSize(),h=2302===this.getInterpolation(),r=1,u=a.length-1,w=1;w<u;++w){var B=!1,C=a[w];if(C!==a[w+1]&&(1!==w||C!==C[0]))if(h)B=!0; else{var G=w*f,K=G-f,L=G+f;for(C=0;C!==f;++C){var M=d[G+C];if(M!==d[K+C]||M!==d[L+C]){B=!0;break}}}if(B){if(w!==r)for(a[r]=a[w],B=w*f,G=r*f,C=0;C!==f;++C)d[G+C]=d[B+C];++r}}if(0<u){a[r]=a[u];B=u*f;G=r*f;for(C=0;C!==f;++C)d[G+C]=d[B+C];++r}r!==a.length&&(this.times=ac.arraySlice(a,0,r),this.values=ac.arraySlice(d,0,r*f));return this},clone:function(){var a=ac.arraySlice(this.times,0),d=ac.arraySlice(this.values,0);a=new this.constructor(this.name,a,d);a.createInterpolant=this.createInterpolant;return a}}); mi.prototype=Object.assign(Object.create(fc.prototype),{constructor:mi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});ni.prototype=Object.assign(Object.create(fc.prototype),{constructor:ni,ValueTypeName:"color"});Pf.prototype=Object.assign(Object.create(fc.prototype),{constructor:Pf,ValueTypeName:"number"});oi.prototype=Object.assign(Object.create(zc.prototype),{constructor:oi,interpolate_:function(a, d,f,h){var r=this.resultBuffer,u=this.sampleValues,w=this.valueSize;a*=w;d=(f-d)/(h-d);for(f=a+w;a!==f;a+=4)g.slerpFlat(r,0,u,a-w,u,a,d);return r}});nh.prototype=Object.assign(Object.create(fc.prototype),{constructor:nh,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(a){return new oi(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:void 0});pi.prototype=Object.assign(Object.create(fc.prototype),{constructor:pi,ValueTypeName:"string", ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});Qf.prototype=Object.assign(Object.create(fc.prototype),{constructor:Qf,ValueTypeName:"vector"});Object.assign(Ic,{parse:function(a){for(var d=[],f=a.tracks,h=1/(a.fps||1),r=0,u=f.length;r!==u;++r)d.push(Ar(f[r]).scale(h));return new Ic(a.name,a.duration,d)},toJSON:function(a){var d=[],f=a.tracks;a={name:a.name,duration:a.duration,tracks:d,uuid:a.uuid};for(var h=0,r=f.length;h!== r;++h)d.push(fc.toJSON(f[h]));return a},CreateFromMorphTargetSequence:function(a,d,f,h){for(var r=d.length,u=[],w=0;w<r;w++){var B=[],C=[];B.push((w+r-1)%r,w,(w+1)%r);C.push(0,1,0);var G=ac.getKeyframeOrder(B);B=ac.sortedArray(B,1,G);C=ac.sortedArray(C,1,G);h||0!==B[0]||(B.push(r),C.push(C[0]));u.push((new Pf(".morphTargetInfluences["+d[w].name+"]",B,C)).scale(1/f))}return new Ic(a,-1,u)},findByName:function(a,d){var f=a;Array.isArray(a)||(f=a.geometry&&a.geometry.animations||a.animations);for(a= 0;a<f.length;a++)if(f[a].name===d)return f[a];return null},CreateClipsFromMorphTargetSequences:function(a,d,f){for(var h={},r=/^([\w-]*?)([\d]+)$/,u=0,w=a.length;u<w;u++){var B=a[u],C=B.name.match(r);if(C&&1<C.length){var G=C[1];(C=h[G])||(h[G]=C=[]);C.push(B)}}a=[];for(G in h)a.push(Ic.CreateFromMorphTargetSequence(G,h[G],d,f));return a},parseAnimation:function(a,d){function f(X,W,ja,ha,ia){if(0!==ja.length){var ma=[],fa=[];ac.flattenJSON(ja,ma,fa,ha);0!==ma.length&&ia.push(new X(W,ma,fa))}}if(!a)return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null;var h=[],r=a.name||"default",u=a.length||-1,w=a.fps||30;a=a.hierarchy||[];for(var B=0;B<a.length;B++){var C=a[B].keys;if(C&&0!==C.length)if(C[0].morphTargets){u={};for(var G=0;G<C.length;G++)if(C[G].morphTargets)for(var K=0;K<C[G].morphTargets.length;K++)u[C[G].morphTargets[K]]=-1;for(var L in u){var M=[],R=[];for(K=0;K!==C[G].morphTargets.length;++K){var S=C[G];M.push(S.time);R.push(S.morphTarget===L?1:0)}h.push(new Pf(".morphTargetInfluence["+L+"]",M,R))}u=u.length*(w||1)}else G=".bones["+ d[B].name+"]",f(Qf,G+".position",C,"pos",h),f(nh,G+".quaternion",C,"rot",h),f(Qf,G+".scale",C,"scl",h)}return 0===h.length?null:new Ic(r,u,h)}});Object.assign(Ic.prototype,{resetDuration:function(){for(var a=0,d=0,f=this.tracks.length;d!==f;++d){var h=this.tracks[d];a=Math.max(a,h.times[h.times.length-1])}this.duration=a;return this},trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},validate:function(){for(var a=!0,d=0;d<this.tracks.length;d++)a= a&&this.tracks[d].validate();return a},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this},clone:function(){for(var a=[],d=0;d<this.tracks.length;d++)a.push(this.tracks[d].clone());return new Ic(this.name,this.duration,a)}});var Ue={enabled:!1,files:{},add:function(a,d){!1!==this.enabled&&(this.files[a]=d)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},on=new fk;Object.assign(vb.prototype, {load:function(){},parse:function(){},setCrossOrigin:function(a){this.crossOrigin=a;return this},setPath:function(a){this.path=a;return this},setResourcePath:function(a){this.resourcePath=a;return this}});vb.Handlers={handlers:[],add:function(a,d){this.handlers.push(a,d)},get:function(a){for(var d=this.handlers,f=0,h=d.length;f<h;f+=2){var r=d[f+1];if(d[f].test(a))return r}return null}};var bd={};Jc.prototype=Object.assign(Object.create(vb.prototype),{constructor:Jc,load:function(a,d,f,h){void 0=== a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var r=this,u=Ue.get(a);if(void 0!==u)return r.manager.itemStart(a),setTimeout(function(){d&&d(u);r.manager.itemEnd(a)},0),u;if(void 0!==bd[a])bd[a].push({onLoad:d,onProgress:f,onError:h});else{var w=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(w){f=w[1];var B=!!w[2];w=w[3];w=decodeURIComponent(w);B&&(w=atob(w));try{var C=(this.responseType||"").toLowerCase();switch(C){case "arraybuffer":case "blob":var G=new Uint8Array(w.length); for(B=0;B<w.length;B++)G[B]=w.charCodeAt(B);var K="blob"===C?new Blob([G.buffer],{type:f}):G.buffer;break;case "document":K=(new DOMParser).parseFromString(w,f);break;case "json":K=JSON.parse(w);break;default:K=w}setTimeout(function(){d&&d(K);r.manager.itemEnd(a)},0)}catch(M){setTimeout(function(){h&&h(M);r.manager.itemError(a);r.manager.itemEnd(a)},0)}}else{bd[a]=[];bd[a].push({onLoad:d,onProgress:f,onError:h});var L=new XMLHttpRequest;L.open("GET",a,!0);L.addEventListener("load",function(M){var R= this.response;Ue.add(a,R);var S=bd[a];delete bd[a];if(200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var X=0,W=S.length;X<W;X++){var ja=S[X];if(ja.onLoad)ja.onLoad(R)}}else{X=0;for(W=S.length;X<W;X++)if(ja=S[X],ja.onError)ja.onError(M);r.manager.itemError(a)}r.manager.itemEnd(a)},!1);L.addEventListener("progress",function(M){for(var R=bd[a],S=0,X=R.length;S<X;S++){var W=R[S];if(W.onProgress)W.onProgress(M)}},!1);L.addEventListener("error", function(M){var R=bd[a];delete bd[a];for(var S=0,X=R.length;S<X;S++){var W=R[S];if(W.onError)W.onError(M)}r.manager.itemError(a);r.manager.itemEnd(a)},!1);L.addEventListener("abort",function(M){var R=bd[a];delete bd[a];for(var S=0,X=R.length;S<X;S++){var W=R[S];if(W.onError)W.onError(M)}r.manager.itemError(a);r.manager.itemEnd(a)},!1);void 0!==this.responseType&&(L.responseType=this.responseType);void 0!==this.withCredentials&&(L.withCredentials=this.withCredentials);L.overrideMimeType&&L.overrideMimeType(void 0!== this.mimeType?this.mimeType:"text/plain");for(B in this.requestHeader)L.setRequestHeader(B,this.requestHeader[B]);L.send(null)}r.manager.itemStart(a);return L}},setResponseType:function(a){this.responseType=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setMimeType:function(a){this.mimeType=a;return this},setRequestHeader:function(a){this.requestHeader=a;return this}});gk.prototype=Object.assign(Object.create(vb.prototype),{constructor:gk,load:function(a,d,f,h){var r= this,u=new Jc(r.manager);u.setPath(r.path);u.load(a,function(w){d(r.parse(JSON.parse(w)))},f,h)},parse:function(a){for(var d=[],f=0;f<a.length;f++){var h=Ic.parse(a[f]);d.push(h)}return d}});hk.prototype=Object.assign(Object.create(vb.prototype),{constructor:hk,load:function(a,d,f,h){function r(M){C.load(a[M],function(R){R=u._parser(R,!0);w[M]={width:R.width,height:R.height,format:R.format,mipmaps:R.mipmaps};G+=1;6===G&&(1===R.mipmapCount&&(B.minFilter=1006),B.format=R.format,B.needsUpdate=!0,d&& d(B))},f,h)}var u=this,w=[],B=new Af;B.image=w;var C=new Jc(this.manager);C.setPath(this.path);C.setResponseType("arraybuffer");if(Array.isArray(a))for(var G=0,K=0,L=a.length;K<L;++K)r(K);else C.load(a,function(M){M=u._parser(M,!0);if(M.isCubemap)for(var R=M.mipmaps.length/M.mipmapCount,S=0;S<R;S++){w[S]={mipmaps:[]};for(var X=0;X<M.mipmapCount;X++)w[S].mipmaps.push(M.mipmaps[S*M.mipmapCount+X]),w[S].format=M.format,w[S].width=M.width,w[S].height=M.height}else B.image.width=M.width,B.image.height= M.height,B.mipmaps=M.mipmaps;1===M.mipmapCount&&(B.minFilter=1006);B.format=M.format;B.needsUpdate=!0;d&&d(B)},f,h);return B}});qi.prototype=Object.assign(Object.create(vb.prototype),{constructor:qi,load:function(a,d,f,h){var r=this,u=new mc,w=new Jc(this.manager);w.setResponseType("arraybuffer");w.setPath(this.path);w.load(a,function(B){if(B=r._parser(B))void 0!==B.image?u.image=B.image:void 0!==B.data&&(u.image.width=B.width,u.image.height=B.height,u.image.data=B.data),u.wrapS=void 0!==B.wrapS? B.wrapS:1001,u.wrapT=void 0!==B.wrapT?B.wrapT:1001,u.magFilter=void 0!==B.magFilter?B.magFilter:1006,u.minFilter=void 0!==B.minFilter?B.minFilter:1008,u.anisotropy=void 0!==B.anisotropy?B.anisotropy:1,void 0!==B.format&&(u.format=B.format),void 0!==B.type&&(u.type=B.type),void 0!==B.mipmaps&&(u.mipmaps=B.mipmaps),1===B.mipmapCount&&(u.minFilter=1006),u.needsUpdate=!0,d&&d(u,B)},f,h);return u}});Rf.prototype=Object.assign(Object.create(vb.prototype),{constructor:Rf,load:function(a,d,f,h){function r(){C.removeEventListener("load", r,!1);C.removeEventListener("error",u,!1);Ue.add(a,this);d&&d(this);w.manager.itemEnd(a)}function u(G){C.removeEventListener("load",r,!1);C.removeEventListener("error",u,!1);h&&h(G);w.manager.itemError(a);w.manager.itemEnd(a)}void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var w=this,B=Ue.get(a);if(void 0!==B)return w.manager.itemStart(a),setTimeout(function(){d&&d(B);w.manager.itemEnd(a)},0),B;var C=document.createElementNS("http://www.w3.org/1999/xhtml","img");C.addEventListener("load", r,!1);C.addEventListener("error",u,!1);"data:"!==a.substr(0,5)&&void 0!==this.crossOrigin&&(C.crossOrigin=this.crossOrigin);w.manager.itemStart(a);C.src=a;return C}});ri.prototype=Object.assign(Object.create(vb.prototype),{constructor:ri,load:function(a,d,f,h){function r(C){w.load(a[C],function(G){u.images[C]=G;B++;6===B&&(u.needsUpdate=!0,d&&d(u))},void 0,h)}var u=new Cd,w=new Rf(this.manager);w.setCrossOrigin(this.crossOrigin);w.setPath(this.path);var B=0;for(f=0;f<a.length;++f)r(f);return u}}); si.prototype=Object.assign(Object.create(vb.prototype),{constructor:si,load:function(a,d,f,h){var r=new l,u=new Rf(this.manager);u.setCrossOrigin(this.crossOrigin);u.setPath(this.path);u.load(a,function(w){r.image=w;w=0<a.search(/\.jpe?g($|\?)/i)||0===a.search(/^data:image\/jpeg/);r.format=w?1022:1023;r.needsUpdate=!0;void 0!==d&&d(r)},f,h);return r}});Object.assign(Ra.prototype,{getPoint:function(){console.warn("THREE.Curve: .getPoint() not implemented.");return null},getPointAt:function(a,d){a= this.getUtoTmapping(a);return this.getPoint(a,d)},getPoints:function(a){void 0===a&&(a=5);for(var d=[],f=0;f<=a;f++)d.push(this.getPoint(f/a));return d},getSpacedPoints:function(a){void 0===a&&(a=5);for(var d=[],f=0;f<=a;f++)d.push(this.getPointAt(f/a));return d},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){void 0===a&&(a=this.arcLengthDivisions);if(this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate= !1;var d=[],f=this.getPoint(0),h,r=0;d.push(0);for(h=1;h<=a;h++){var u=this.getPoint(h/a);r+=u.distanceTo(f);d.push(r);f=u}return this.cacheArcLengths=d},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(a,d){var f=this.getLengths(),h=f.length;d=d?d:a*f[h-1];for(var r=0,u=h-1,w;r<=u;)if(a=Math.floor(r+(u-r)/2),w=f[a]-d,0>w)r=a+1;else if(0<w)u=a-1;else{u=a;break}a=u;if(f[a]===d)return a/(h-1);r=f[a];return(a+(d-r)/(f[a+1]-r))/(h-1)},getTangent:function(a){var d= a-1E-4;a+=1E-4;0>d&&(d=0);1<a&&(a=1);d=this.getPoint(d);return this.getPoint(a).clone().sub(d).normalize()},getTangentAt:function(a){a=this.getUtoTmapping(a);return this.getTangent(a)},computeFrenetFrames:function(a,d){var f=new k,h=[],r=[],u=[],w=new k,B=new t,C;for(C=0;C<=a;C++){var G=C/a;h[C]=this.getTangentAt(G);h[C].normalize()}r[0]=new k;u[0]=new k;C=Number.MAX_VALUE;G=Math.abs(h[0].x);var K=Math.abs(h[0].y),L=Math.abs(h[0].z);G<=C&&(C=G,f.set(1,0,0));K<=C&&(C=K,f.set(0,1,0));L<=C&&f.set(0, 0,1);w.crossVectors(h[0],f).normalize();r[0].crossVectors(h[0],w);u[0].crossVectors(h[0],r[0]);for(C=1;C<=a;C++)r[C]=r[C-1].clone(),u[C]=u[C-1].clone(),w.crossVectors(h[C-1],h[C]),w.length()>Number.EPSILON&&(w.normalize(),f=Math.acos(bb.clamp(h[C-1].dot(h[C]),-1,1)),r[C].applyMatrix4(B.makeRotationAxis(w,f))),u[C].crossVectors(h[C],r[C]);if(!0===d)for(f=Math.acos(bb.clamp(r[0].dot(r[a]),-1,1)),f/=a,0<h[0].dot(w.crossVectors(r[0],r[a]))&&(f=-f),C=1;C<=a;C++)r[C].applyMatrix4(B.makeRotationAxis(h[C], f*C)),u[C].crossVectors(h[C],r[C]);return{tangents:h,normals:r,binormals:u}},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.arcLengthDivisions=a.arcLengthDivisions;return this},toJSON:function(){var a={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};a.arcLengthDivisions=this.arcLengthDivisions;a.type=this.type;return a},fromJSON:function(a){this.arcLengthDivisions=a.arcLengthDivisions;return this}});Ac.prototype=Object.create(Ra.prototype);Ac.prototype.constructor= Ac;Ac.prototype.isEllipseCurve=!0;Ac.prototype.getPoint=function(a,d){d=d||new e;for(var f=2*Math.PI,h=this.aEndAngle-this.aStartAngle,r=Math.abs(h)<Number.EPSILON;0>h;)h+=f;for(;h>f;)h-=f;h<Number.EPSILON&&(h=r?0:f);!0!==this.aClockwise||r||(h=h===f?-f:h-f);f=this.aStartAngle+a*h;a=this.aX+this.xRadius*Math.cos(f);var u=this.aY+this.yRadius*Math.sin(f);0!==this.aRotation&&(f=Math.cos(this.aRotation),h=Math.sin(this.aRotation),r=a-this.aX,u-=this.aY,a=r*f-u*h+this.aX,u=r*h+u*f+this.aY);return d.set(a, u)};Ac.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.aX=a.aX;this.aY=a.aY;this.xRadius=a.xRadius;this.yRadius=a.yRadius;this.aStartAngle=a.aStartAngle;this.aEndAngle=a.aEndAngle;this.aClockwise=a.aClockwise;this.aRotation=a.aRotation;return this};Ac.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.aX=this.aX;a.aY=this.aY;a.xRadius=this.xRadius;a.yRadius=this.yRadius;a.aStartAngle=this.aStartAngle;a.aEndAngle=this.aEndAngle;a.aClockwise=this.aClockwise;a.aRotation= this.aRotation;return a};Ac.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.aX=a.aX;this.aY=a.aY;this.xRadius=a.xRadius;this.yRadius=a.yRadius;this.aStartAngle=a.aStartAngle;this.aEndAngle=a.aEndAngle;this.aClockwise=a.aClockwise;this.aRotation=a.aRotation;return this};Sf.prototype=Object.create(Ac.prototype);Sf.prototype.constructor=Sf;Sf.prototype.isArcCurve=!0;var dj=new k,Rk=new ik,Sk=new ik,Tk=new ik;kc.prototype=Object.create(Ra.prototype);kc.prototype.constructor=kc; kc.prototype.isCatmullRomCurve3=!0;kc.prototype.getPoint=function(a,d){d=d||new k;var f=this.points,h=f.length;a*=h-(this.closed?0:1);var r=Math.floor(a);a-=r;this.closed?r+=0<r?0:(Math.floor(Math.abs(r)/h)+1)*h:0===a&&r===h-1&&(r=h-2,a=1);if(this.closed||0<r)var u=f[(r-1)%h];else dj.subVectors(f[0],f[1]).add(f[0]),u=dj;var w=f[r%h];var B=f[(r+1)%h];this.closed||r+2<h?f=f[(r+2)%h]:(dj.subVectors(f[h-1],f[h-2]).add(f[h-1]),f=dj);if("centripetal"===this.curveType||"chordal"===this.curveType){var C= "chordal"===this.curveType?.5:.25;h=Math.pow(u.distanceToSquared(w),C);r=Math.pow(w.distanceToSquared(B),C);C=Math.pow(B.distanceToSquared(f),C);1E-4>r&&(r=1);1E-4>h&&(h=r);1E-4>C&&(C=r);Rk.initNonuniformCatmullRom(u.x,w.x,B.x,f.x,h,r,C);Sk.initNonuniformCatmullRom(u.y,w.y,B.y,f.y,h,r,C);Tk.initNonuniformCatmullRom(u.z,w.z,B.z,f.z,h,r,C)}else"catmullrom"===this.curveType&&(Rk.initCatmullRom(u.x,w.x,B.x,f.x,this.tension),Sk.initCatmullRom(u.y,w.y,B.y,f.y,this.tension),Tk.initCatmullRom(u.z,w.z,B.z, f.z,this.tension));d.set(Rk.calc(a),Sk.calc(a),Tk.calc(a));return d};kc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.points=[];for(var d=0,f=a.points.length;d<f;d++)this.points.push(a.points[d].clone());this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;return this};kc.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.points=[];for(var d=0,f=this.points.length;d<f;d++)a.points.push(this.points[d].toArray());a.closed=this.closed;a.curveType=this.curveType; a.tension=this.tension;return a};kc.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.points=[];for(var d=0,f=a.points.length;d<f;d++){var h=a.points[d];this.points.push((new k).fromArray(h))}this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;return this};Uc.prototype=Object.create(Ra.prototype);Uc.prototype.constructor=Uc;Uc.prototype.isCubicBezierCurve=!0;Uc.prototype.getPoint=function(a,d){d=d||new e;var f=this.v0,h=this.v1,r=this.v2,u=this.v3;d.set(ph(a, f.x,h.x,r.x,u.x),ph(a,f.y,h.y,r.y,u.y));return d};Uc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);this.v3.copy(a.v3);return this};Uc.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();a.v3=this.v3.toArray();return a};Uc.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2); this.v3.fromArray(a.v3);return this};rd.prototype=Object.create(Ra.prototype);rd.prototype.constructor=rd;rd.prototype.isCubicBezierCurve3=!0;rd.prototype.getPoint=function(a,d){d=d||new k;var f=this.v0,h=this.v1,r=this.v2,u=this.v3;d.set(ph(a,f.x,h.x,r.x,u.x),ph(a,f.y,h.y,r.y,u.y),ph(a,f.z,h.z,r.z,u.z));return d};rd.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);this.v3.copy(a.v3);return this};rd.prototype.toJSON=function(){var a= Ra.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();a.v3=this.v3.toArray();return a};rd.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);this.v3.fromArray(a.v3);return this};uc.prototype=Object.create(Ra.prototype);uc.prototype.constructor=uc;uc.prototype.isLineCurve=!0;uc.prototype.getPoint=function(a,d){d=d||new e;1===a?d.copy(this.v2):(d.copy(this.v2).sub(this.v1), d.multiplyScalar(a).add(this.v1));return d};uc.prototype.getPointAt=function(a,d){return this.getPoint(a,d)};uc.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};uc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.v1.copy(a.v1);this.v2.copy(a.v2);return this};uc.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};uc.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.v1.fromArray(a.v1); this.v2.fromArray(a.v2);return this};Vc.prototype=Object.create(Ra.prototype);Vc.prototype.constructor=Vc;Vc.prototype.isLineCurve3=!0;Vc.prototype.getPoint=function(a,d){d=d||new k;1===a?d.copy(this.v2):(d.copy(this.v2).sub(this.v1),d.multiplyScalar(a).add(this.v1));return d};Vc.prototype.getPointAt=function(a,d){return this.getPoint(a,d)};Vc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.v1.copy(a.v1);this.v2.copy(a.v2);return this};Vc.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this); a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};Vc.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this};Wc.prototype=Object.create(Ra.prototype);Wc.prototype.constructor=Wc;Wc.prototype.isQuadraticBezierCurve=!0;Wc.prototype.getPoint=function(a,d){d=d||new e;var f=this.v0,h=this.v1,r=this.v2;d.set(oh(a,f.x,h.x,r.x),oh(a,f.y,h.y,r.y));return d};Wc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.v0.copy(a.v0); this.v1.copy(a.v1);this.v2.copy(a.v2);return this};Wc.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};Wc.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this};sd.prototype=Object.create(Ra.prototype);sd.prototype.constructor=sd;sd.prototype.isQuadraticBezierCurve3=!0;sd.prototype.getPoint=function(a,d){d=d|| new k;var f=this.v0,h=this.v1,r=this.v2;d.set(oh(a,f.x,h.x,r.x),oh(a,f.y,h.y,r.y),oh(a,f.z,h.z,r.z));return d};sd.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);return this};sd.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};sd.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1); this.v2.fromArray(a.v2);return this};Xc.prototype=Object.create(Ra.prototype);Xc.prototype.constructor=Xc;Xc.prototype.isSplineCurve=!0;Xc.prototype.getPoint=function(a,d){d=d||new e;var f=this.points,h=(f.length-1)*a;a=Math.floor(h);h-=a;var r=f[0===a?a:a-1],u=f[a],w=f[a>f.length-2?f.length-1:a+1];f=f[a>f.length-3?f.length-1:a+2];d.set(pn(h,r.x,u.x,w.x,f.x),pn(h,r.y,u.y,w.y,f.y));return d};Xc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.points=[];for(var d=0,f=a.points.length;d< f;d++)this.points.push(a.points[d].clone());return this};Xc.prototype.toJSON=function(){var a=Ra.prototype.toJSON.call(this);a.points=[];for(var d=0,f=this.points.length;d<f;d++)a.points.push(this.points[d].toArray());return a};Xc.prototype.fromJSON=function(a){Ra.prototype.fromJSON.call(this,a);this.points=[];for(var d=0,f=a.points.length;d<f;d++){var h=a.points[d];this.points.push((new e).fromArray(h))}return this};var Uk=Object.freeze({ArcCurve:Sf,CatmullRomCurve3:kc,CubicBezierCurve:Uc,CubicBezierCurve3:rd, EllipseCurve:Ac,LineCurve:uc,LineCurve3:Vc,QuadraticBezierCurve:Wc,QuadraticBezierCurve3:sd,SplineCurve:Xc});Gd.prototype=Object.assign(Object.create(Ra.prototype),{constructor:Gd,add:function(a){this.curves.push(a)},closePath:function(){var a=this.curves[0].getPoint(0),d=this.curves[this.curves.length-1].getPoint(1);a.equals(d)||this.curves.push(new uc(d,a))},getPoint:function(a){var d=a*this.getLength(),f=this.getCurveLengths();for(a=0;a<f.length;){if(f[a]>=d)return d=f[a]-d,a=this.curves[a],f= a.getLength(),a.getPointAt(0===f?0:1-d/f);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.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 a=[],d=0,f=0,h=this.curves.length;f<h;f++)d+=this.curves[f].getLength(),a.push(d);return this.cacheLengths=a},getSpacedPoints:function(a){void 0=== a&&(a=40);for(var d=[],f=0;f<=a;f++)d.push(this.getPoint(f/a));this.autoClose&&d.push(d[0]);return d},getPoints:function(a){a=a||12;for(var d=[],f,h=0,r=this.curves;h<r.length;h++){var u=r[h];u=u.getPoints(u&&u.isEllipseCurve?2*a:u&&(u.isLineCurve||u.isLineCurve3)?1:u&&u.isSplineCurve?a*u.points.length:a);for(var w=0;w<u.length;w++){var B=u[w];f&&f.equals(B)||(d.push(B),f=B)}}this.autoClose&&1<d.length&&!d[d.length-1].equals(d[0])&&d.push(d[0]);return d},copy:function(a){Ra.prototype.copy.call(this, a);this.curves=[];for(var d=0,f=a.curves.length;d<f;d++)this.curves.push(a.curves[d].clone());this.autoClose=a.autoClose;return this},toJSON:function(){var a=Ra.prototype.toJSON.call(this);a.autoClose=this.autoClose;a.curves=[];for(var d=0,f=this.curves.length;d<f;d++)a.curves.push(this.curves[d].toJSON());return a},fromJSON:function(a){Ra.prototype.fromJSON.call(this,a);this.autoClose=a.autoClose;this.curves=[];for(var d=0,f=a.curves.length;d<f;d++){var h=a.curves[d];this.curves.push((new Uk[h.type]).fromJSON(h))}return this}}); Yc.prototype=Object.assign(Object.create(Gd.prototype),{constructor:Yc,setFromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var d=1,f=a.length;d<f;d++)this.lineTo(a[d].x,a[d].y)},moveTo:function(a,d){this.currentPoint.set(a,d)},lineTo:function(a,d){var f=new uc(this.currentPoint.clone(),new e(a,d));this.curves.push(f);this.currentPoint.set(a,d)},quadraticCurveTo:function(a,d,f,h){a=new Wc(this.currentPoint.clone(),new e(a,d),new e(f,h));this.curves.push(a);this.currentPoint.set(f,h)},bezierCurveTo:function(a, d,f,h,r,u){a=new Uc(this.currentPoint.clone(),new e(a,d),new e(f,h),new e(r,u));this.curves.push(a);this.currentPoint.set(r,u)},splineThru:function(a){var d=[this.currentPoint.clone()].concat(a);d=new Xc(d);this.curves.push(d);this.currentPoint.copy(a[a.length-1])},arc:function(a,d,f,h,r,u){this.absarc(a+this.currentPoint.x,d+this.currentPoint.y,f,h,r,u)},absarc:function(a,d,f,h,r,u){this.absellipse(a,d,f,f,h,r,u)},ellipse:function(a,d,f,h,r,u,w,B){this.absellipse(a+this.currentPoint.x,d+this.currentPoint.y, f,h,r,u,w,B)},absellipse:function(a,d,f,h,r,u,w,B){a=new Ac(a,d,f,h,r,u,w,B);0<this.curves.length&&(d=a.getPoint(0),d.equals(this.currentPoint)||this.lineTo(d.x,d.y));this.curves.push(a);a=a.getPoint(1);this.currentPoint.copy(a)},copy:function(a){Gd.prototype.copy.call(this,a);this.currentPoint.copy(a.currentPoint);return this},toJSON:function(){var a=Gd.prototype.toJSON.call(this);a.currentPoint=this.currentPoint.toArray();return a},fromJSON:function(a){Gd.prototype.fromJSON.call(this,a);this.currentPoint.fromArray(a.currentPoint); return this}});ie.prototype=Object.assign(Object.create(Yc.prototype),{constructor:ie,getPointsHoles:function(a){for(var d=[],f=0,h=this.holes.length;f<h;f++)d[f]=this.holes[f].getPoints(a);return d},extractPoints:function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}},copy:function(a){Yc.prototype.copy.call(this,a);this.holes=[];for(var d=0,f=a.holes.length;d<f;d++)this.holes.push(a.holes[d].clone());return this},toJSON:function(){var a=Yc.prototype.toJSON.call(this);a.uuid=this.uuid; a.holes=[];for(var d=0,f=this.holes.length;d<f;d++)a.holes.push(this.holes[d].toJSON());return a},fromJSON:function(a){Yc.prototype.fromJSON.call(this,a);this.uuid=a.uuid;this.holes=[];for(var d=0,f=a.holes.length;d<f;d++){var h=a.holes[d];this.holes.push((new Yc).fromJSON(h))}return this}});Gb.prototype=Object.assign(Object.create(y.prototype),{constructor:Gb,isLight:!0,copy:function(a){y.prototype.copy.call(this,a);this.color.copy(a.color);this.intensity=a.intensity;return this},toJSON:function(a){a= y.prototype.toJSON.call(this,a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&(a.object.distance=this.distance);void 0!==this.angle&&(a.object.angle=this.angle);void 0!==this.decay&&(a.object.decay=this.decay);void 0!==this.penumbra&&(a.object.penumbra=this.penumbra);void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON());return a}});ti.prototype=Object.assign(Object.create(Gb.prototype), {constructor:ti,isHemisphereLight:!0,copy:function(a){Gb.prototype.copy.call(this,a);this.groundColor.copy(a.groundColor);return this}});Object.assign(td.prototype,{_projScreenMatrix:new t,_lightPositionWorld:new k,_lookTarget:new k,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(a){var d=this.camera,f=this.matrix,h=this._projScreenMatrix,r=this._lookTarget,u=this._lightPositionWorld;u.setFromMatrixPosition(a.matrixWorld); d.position.copy(u);r.setFromMatrixPosition(a.target.matrixWorld);d.lookAt(r);d.updateMatrixWorld();h.multiplyMatrices(d.projectionMatrix,d.matrixWorldInverse);this._frustum.setFromMatrix(h);f.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);f.multiply(d.projectionMatrix);f.multiply(d.matrixWorldInverse)},getViewport:function(a){return this._viewports[a]},getFrameExtents:function(){return this._frameExtents},copy:function(a){this.camera=a.camera.clone();this.bias=a.bias;this.radius=a.radius;this.mapSize.copy(a.mapSize); return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};0!==this.bias&&(a.bias=this.bias);1!==this.radius&&(a.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)a.mapSize=this.mapSize.toArray();a.camera=this.camera.toJSON(!1).object;delete a.camera.matrix;return a}});ui.prototype=Object.assign(Object.create(td.prototype),{constructor:ui,isSpotLightShadow:!0,updateMatrices:function(a,d,f){var h=this.camera,r=2*bb.RAD2DEG*a.angle,u=this.mapSize.width/ this.mapSize.height,w=a.distance||h.far;if(r!==h.fov||u!==h.aspect||w!==h.far)h.fov=r,h.aspect=u,h.far=w,h.updateProjectionMatrix();td.prototype.updateMatrices.call(this,a,d,f)}});vi.prototype=Object.assign(Object.create(Gb.prototype),{constructor:vi,isSpotLight:!0,copy:function(a){Gb.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=a.shadow.clone();return this}});jk.prototype=Object.assign(Object.create(td.prototype), {constructor:jk,isPointLightShadow:!0,updateMatrices:function(a,d,f){d=this.camera;var h=this.matrix,r=this._lightPositionWorld,u=this._lookTarget,w=this._projScreenMatrix;r.setFromMatrixPosition(a.matrixWorld);d.position.copy(r);u.copy(d.position);u.add(this._cubeDirections[f]);d.up.copy(this._cubeUps[f]);d.lookAt(u);d.updateMatrixWorld();h.makeTranslation(-r.x,-r.y,-r.z);w.multiplyMatrices(d.projectionMatrix,d.matrixWorldInverse);this._frustum.setFromMatrix(w)}});wi.prototype=Object.assign(Object.create(Gb.prototype), {constructor:wi,isPointLight:!0,copy:function(a){Gb.prototype.copy.call(this,a);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this}});qh.prototype=Object.assign(Object.create($b.prototype),{constructor:qh,isOrthographicCamera:!0,copy:function(a,d){$b.prototype.copy.call(this,a,d);this.left=a.left;this.right=a.right;this.top=a.top;this.bottom=a.bottom;this.near=a.near;this.far=a.far;this.zoom=a.zoom;this.view=null===a.view?null:Object.assign({},a.view);return this}, setViewOffset:function(a,d,f,h,r,u){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1});this.view.enabled=!0;this.view.fullWidth=a;this.view.fullHeight=d;this.view.offsetX=f;this.view.offsetY=h;this.view.width=r;this.view.height=u;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=(this.right-this.left)/(2*this.zoom),d=(this.top- this.bottom)/(2*this.zoom),f=(this.right+this.left)/2,h=(this.top+this.bottom)/2,r=f-a;f+=a;a=h+d;d=h-d;if(null!==this.view&&this.view.enabled){f=this.zoom/(this.view.width/this.view.fullWidth);d=this.zoom/(this.view.height/this.view.fullHeight);var u=(this.right-this.left)/this.view.width;h=(this.top-this.bottom)/this.view.height;r+=this.view.offsetX/f*u;f=r+this.view.width/f*u;a-=this.view.offsetY/d*h;d=a-this.view.height/d*h}this.projectionMatrix.makeOrthographic(r,f,a,d,this.near,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)}, toJSON:function(a){a=y.prototype.toJSON.call(this,a);a.object.zoom=this.zoom;a.object.left=this.left;a.object.right=this.right;a.object.top=this.top;a.object.bottom=this.bottom;a.object.near=this.near;a.object.far=this.far;null!==this.view&&(a.object.view=Object.assign({},this.view));return a}});xi.prototype=Object.assign(Object.create(td.prototype),{constructor:xi,isDirectionalLightShadow:!0,updateMatrices:function(a,d,f){td.prototype.updateMatrices.call(this,a,d,f)}});yi.prototype=Object.assign(Object.create(Gb.prototype), {constructor:yi,isDirectionalLight:!0,copy:function(a){Gb.prototype.copy.call(this,a);this.target=a.target.clone();this.shadow=a.shadow.clone();return this}});zi.prototype=Object.assign(Object.create(Gb.prototype),{constructor:zi,isAmbientLight:!0});Ai.prototype=Object.assign(Object.create(Gb.prototype),{constructor:Ai,isRectAreaLight:!0,copy:function(a){Gb.prototype.copy.call(this,a);this.width=a.width;this.height=a.height;return this},toJSON:function(a){a=Gb.prototype.toJSON.call(this,a);a.object.width= this.width;a.object.height=this.height;return a}});Bi.prototype=Object.assign(Object.create(vb.prototype),{constructor:Bi,load:function(a,d,f,h){var r=this,u=new Jc(r.manager);u.setPath(r.path);u.load(a,function(w){d(r.parse(JSON.parse(w)))},f,h)},parse:function(a){function d(B){void 0===f[B]&&console.warn("THREE.MaterialLoader: Undefined texture",B);return f[B]}var f=this.textures,h=new Xr[a.type];void 0!==a.uuid&&(h.uuid=a.uuid);void 0!==a.name&&(h.name=a.name);void 0!==a.color&&h.color.setHex(a.color); void 0!==a.roughness&&(h.roughness=a.roughness);void 0!==a.metalness&&(h.metalness=a.metalness);void 0!==a.emissive&&h.emissive.setHex(a.emissive);void 0!==a.specular&&h.specular.setHex(a.specular);void 0!==a.shininess&&(h.shininess=a.shininess);void 0!==a.clearcoat&&(h.clearcoat=a.clearcoat);void 0!==a.clearcoatRoughness&&(h.clearcoatRoughness=a.clearcoatRoughness);void 0!==a.vertexColors&&(h.vertexColors=a.vertexColors);void 0!==a.fog&&(h.fog=a.fog);void 0!==a.flatShading&&(h.flatShading=a.flatShading); void 0!==a.blending&&(h.blending=a.blending);void 0!==a.combine&&(h.combine=a.combine);void 0!==a.side&&(h.side=a.side);void 0!==a.opacity&&(h.opacity=a.opacity);void 0!==a.transparent&&(h.transparent=a.transparent);void 0!==a.alphaTest&&(h.alphaTest=a.alphaTest);void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(h.colorWrite=a.colorWrite);void 0!==a.wireframe&&(h.wireframe=a.wireframe);void 0!==a.wireframeLinewidth&&(h.wireframeLinewidth= a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(h.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(h.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.rotation&&(h.rotation=a.rotation);1!==a.linewidth&&(h.linewidth=a.linewidth);void 0!==a.dashSize&&(h.dashSize=a.dashSize);void 0!==a.gapSize&&(h.gapSize=a.gapSize);void 0!==a.scale&&(h.scale=a.scale);void 0!==a.polygonOffset&&(h.polygonOffset=a.polygonOffset);void 0!==a.polygonOffsetFactor&&(h.polygonOffsetFactor=a.polygonOffsetFactor); void 0!==a.polygonOffsetUnits&&(h.polygonOffsetUnits=a.polygonOffsetUnits);void 0!==a.skinning&&(h.skinning=a.skinning);void 0!==a.morphTargets&&(h.morphTargets=a.morphTargets);void 0!==a.morphNormals&&(h.morphNormals=a.morphNormals);void 0!==a.dithering&&(h.dithering=a.dithering);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.toneMapped&&(h.toneMapped=a.toneMapped);void 0!==a.userData&&(h.userData=a.userData);if(void 0!==a.uniforms)for(var r in a.uniforms){var u=a.uniforms[r];h.uniforms[r]= {};switch(u.type){case "t":h.uniforms[r].value=d(u.value);break;case "c":h.uniforms[r].value=(new J).setHex(u.value);break;case "v2":h.uniforms[r].value=(new e).fromArray(u.value);break;case "v3":h.uniforms[r].value=(new k).fromArray(u.value);break;case "v4":h.uniforms[r].value=(new m).fromArray(u.value);break;case "m3":h.uniforms[r].value=(new q).fromArray(u.value);case "m4":h.uniforms[r].value=(new t).fromArray(u.value);break;default:h.uniforms[r].value=u.value}}void 0!==a.defines&&(h.defines=a.defines); void 0!==a.vertexShader&&(h.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(h.fragmentShader=a.fragmentShader);if(void 0!==a.extensions)for(var w in a.extensions)h.extensions[w]=a.extensions[w];void 0!==a.shading&&(h.flatShading=1===a.shading);void 0!==a.size&&(h.size=a.size);void 0!==a.sizeAttenuation&&(h.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(h.map=d(a.map));void 0!==a.matcap&&(h.matcap=d(a.matcap));void 0!==a.alphaMap&&(h.alphaMap=d(a.alphaMap),h.transparent=!0);void 0!== a.bumpMap&&(h.bumpMap=d(a.bumpMap));void 0!==a.bumpScale&&(h.bumpScale=a.bumpScale);void 0!==a.normalMap&&(h.normalMap=d(a.normalMap));void 0!==a.normalMapType&&(h.normalMapType=a.normalMapType);void 0!==a.normalScale&&(r=a.normalScale,!1===Array.isArray(r)&&(r=[r,r]),h.normalScale=(new e).fromArray(r));void 0!==a.displacementMap&&(h.displacementMap=d(a.displacementMap));void 0!==a.displacementScale&&(h.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(h.displacementBias=a.displacementBias); void 0!==a.roughnessMap&&(h.roughnessMap=d(a.roughnessMap));void 0!==a.metalnessMap&&(h.metalnessMap=d(a.metalnessMap));void 0!==a.emissiveMap&&(h.emissiveMap=d(a.emissiveMap));void 0!==a.emissiveIntensity&&(h.emissiveIntensity=a.emissiveIntensity);void 0!==a.specularMap&&(h.specularMap=d(a.specularMap));void 0!==a.envMap&&(h.envMap=d(a.envMap));void 0!==a.envMapIntensity&&(h.envMapIntensity=a.envMapIntensity);void 0!==a.reflectivity&&(h.reflectivity=a.reflectivity);void 0!==a.refractionRatio&&(h.refractionRatio= a.refractionRatio);void 0!==a.lightMap&&(h.lightMap=d(a.lightMap));void 0!==a.lightMapIntensity&&(h.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(h.aoMap=d(a.aoMap));void 0!==a.aoMapIntensity&&(h.aoMapIntensity=a.aoMapIntensity);void 0!==a.gradientMap&&(h.gradientMap=d(a.gradientMap));void 0!==a.clearcoatNormalMap&&(h.clearcoatNormalMap=d(a.clearcoatNormalMap));void 0!==a.clearcoatNormalScale&&(h.clearcoatNormalScale=(new e).fromArray(a.clearcoatNormalScale));return h},setTextures:function(a){this.textures= a;return this}});var Vk={decodeText:function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var d="",f=0,h=a.length;f<h;f++)d+=String.fromCharCode(a[f]);try{return decodeURIComponent(escape(d))}catch(r){return d}},extractUrlBase:function(a){var d=a.lastIndexOf("/");return-1===d?"./":a.substr(0,d+1)}};Ci.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Ci,isInstancedBufferGeometry:!0,copy:function(a){Ba.prototype.copy.call(this,a);this.maxInstancedCount= a.maxInstancedCount;return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a=Ba.prototype.toJSON.call(this);a.maxInstancedCount=this.maxInstancedCount;a.isInstancedBufferGeometry=!0;return a}});Di.prototype=Object.assign(Object.create(da.prototype),{constructor:Di,isInstancedBufferAttribute:!0,copy:function(a){da.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this},toJSON:function(){var a=da.prototype.toJSON.call(this);a.meshPerAttribute= this.meshPerAttribute;a.isInstancedBufferAttribute=!0;return a}});Ei.prototype=Object.assign(Object.create(vb.prototype),{constructor:Ei,load:function(a,d,f,h){var r=this,u=new Jc(r.manager);u.setPath(r.path);u.load(a,function(w){d(r.parse(JSON.parse(w)))},f,h)},parse:function(a){var d=a.isInstancedBufferGeometry?new Ci:new Ba,f=a.data.index;if(void 0!==f){var h=new Wk[f.type](f.array);d.setIndex(new da(h,1))}f=a.data.attributes;for(var r in f){var u=f[r];h=new Wk[u.type](u.array);h=new (u.isInstancedBufferAttribute? Di:da)(h,u.itemSize,u.normalized);void 0!==u.name&&(h.name=u.name);d.addAttribute(r,h)}var w=a.data.morphAttributes;if(w)for(r in w){var B=w[r],C=[];f=0;for(var G=B.length;f<G;f++)u=B[f],h=new Wk[u.type](u.array),h=new da(h,u.itemSize,u.normalized),void 0!==u.name&&(h.name=u.name),C.push(h);d.morphAttributes[r]=C}r=a.data.groups||a.data.drawcalls||a.data.offsets;if(void 0!==r)for(f=0,u=r.length;f!==u;++f)h=r[f],d.addGroup(h.start,h.count,h.materialIndex);f=a.data.boundingSphere;void 0!==f&&(r=new k, void 0!==f.center&&r.fromArray(f.center),d.boundingSphere=new H(r,f.radius));a.name&&(d.name=a.name);a.userData&&(d.userData=a.userData);return d}});var Wk={Int8Array,Uint8Array,Uint8ClampedArray:"undefined"!==typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};Fi.prototype=Object.assign(Object.create(vb.prototype),{constructor:Fi,load:function(a,d,f,h){var r=this,u=""===this.path?Vk.extractUrlBase(a):this.path;this.resourcePath= this.resourcePath||u;u=new Jc(r.manager);u.setPath(this.path);u.load(a,function(w){var B=null;try{B=JSON.parse(w)}catch(C){void 0!==h&&h(C);console.error("THREE:ObjectLoader: Can't parse "+a+".",C.message);return}w=B.metadata;void 0===w||void 0===w.type||"geometry"===w.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+a):r.parse(B,d)},f,h)},parse:function(a,d){var f=this.parseShape(a.shapes);f=this.parseGeometries(a.geometries,f);var h=this.parseImages(a.images,function(){void 0!== d&&d(r)});h=this.parseTextures(a.textures,h);h=this.parseMaterials(a.materials,h);var r=this.parseObject(a.object,f,h);a.animations&&(r.animations=this.parseAnimations(a.animations));void 0!==a.images&&0!==a.images.length||void 0===d||d(r);return r},parseShape:function(a){var d={};if(void 0!==a)for(var f=0,h=a.length;f<h;f++){var r=(new ie).fromJSON(a[f]);d[r.uuid]=r}return d},parseGeometries:function(a,d){var f={};if(void 0!==a)for(var h=new Ei,r=0,u=a.length;r<u;r++){var w=a[r];switch(w.type){case "PlaneGeometry":case "PlaneBufferGeometry":var B= new rc[w.type](w.width,w.height,w.widthSegments,w.heightSegments);break;case "BoxGeometry":case "BoxBufferGeometry":case "CubeGeometry":B=new rc[w.type](w.width,w.height,w.depth,w.widthSegments,w.heightSegments,w.depthSegments);break;case "CircleGeometry":case "CircleBufferGeometry":B=new rc[w.type](w.radius,w.segments,w.thetaStart,w.thetaLength);break;case "CylinderGeometry":case "CylinderBufferGeometry":B=new rc[w.type](w.radiusTop,w.radiusBottom,w.height,w.radialSegments,w.heightSegments,w.openEnded, w.thetaStart,w.thetaLength);break;case "ConeGeometry":case "ConeBufferGeometry":B=new rc[w.type](w.radius,w.height,w.radialSegments,w.heightSegments,w.openEnded,w.thetaStart,w.thetaLength);break;case "SphereGeometry":case "SphereBufferGeometry":B=new rc[w.type](w.radius,w.widthSegments,w.heightSegments,w.phiStart,w.phiLength,w.thetaStart,w.thetaLength);break;case "DodecahedronGeometry":case "DodecahedronBufferGeometry":case "IcosahedronGeometry":case "IcosahedronBufferGeometry":case "OctahedronGeometry":case "OctahedronBufferGeometry":case "TetrahedronGeometry":case "TetrahedronBufferGeometry":B= new rc[w.type](w.radius,w.detail);break;case "RingGeometry":case "RingBufferGeometry":B=new rc[w.type](w.innerRadius,w.outerRadius,w.thetaSegments,w.phiSegments,w.thetaStart,w.thetaLength);break;case "TorusGeometry":case "TorusBufferGeometry":B=new rc[w.type](w.radius,w.tube,w.radialSegments,w.tubularSegments,w.arc);break;case "TorusKnotGeometry":case "TorusKnotBufferGeometry":B=new rc[w.type](w.radius,w.tube,w.tubularSegments,w.radialSegments,w.p,w.q);break;case "TubeGeometry":case "TubeBufferGeometry":B= new rc[w.type]((new Uk[w.path.type]).fromJSON(w.path),w.tubularSegments,w.radius,w.radialSegments,w.closed);break;case "LatheGeometry":case "LatheBufferGeometry":B=new rc[w.type](w.points,w.segments,w.phiStart,w.phiLength);break;case "PolyhedronGeometry":case "PolyhedronBufferGeometry":B=new rc[w.type](w.vertices,w.indices,w.radius,w.details);break;case "ShapeGeometry":case "ShapeBufferGeometry":B=[];for(var C=0,G=w.shapes.length;C<G;C++){var K=d[w.shapes[C]];B.push(K)}B=new rc[w.type](B,w.curveSegments); break;case "ExtrudeGeometry":case "ExtrudeBufferGeometry":B=[];C=0;for(G=w.shapes.length;C<G;C++)K=d[w.shapes[C]],B.push(K);C=w.options.extrudePath;void 0!==C&&(w.options.extrudePath=(new Uk[C.type]).fromJSON(C));B=new rc[w.type](B,w.options);break;case "BufferGeometry":case "InstancedBufferGeometry":B=h.parse(w);break;case "Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?B=(new THREE.LegacyJSONLoader).parse(w,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".'); break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+w.type+'"');continue}B.uuid=w.uuid;void 0!==w.name&&(B.name=w.name);!0===B.isBufferGeometry&&void 0!==w.userData&&(B.userData=w.userData);f[w.uuid]=B}return f},parseMaterials:function(a,d){var f={},h={};if(void 0!==a){var r=new Bi;r.setTextures(d);d=0;for(var u=a.length;d<u;d++){var w=a[d];if("MultiMaterial"===w.type){for(var B=[],C=0;C<w.materials.length;C++){var G=w.materials[C];void 0===f[G.uuid]&&(f[G.uuid]=r.parse(G)); B.push(f[G.uuid])}h[w.uuid]=B}else void 0===f[w.uuid]&&(f[w.uuid]=r.parse(w)),h[w.uuid]=f[w.uuid]}}return h},parseAnimations:function(a){for(var d=[],f=0;f<a.length;f++){var h=a[f],r=Ic.parse(h);void 0!==h.uuid&&(r.uuid=h.uuid);d.push(r)}return d},parseImages:function(a,d){function f(M){h.manager.itemStart(M);return u.load(M,function(){h.manager.itemEnd(M)},void 0,function(){h.manager.itemError(M);h.manager.itemEnd(M)})}var h=this,r={};if(void 0!==a&&0<a.length){d=new fk(d);var u=new Rf(d);u.setCrossOrigin(this.crossOrigin); d=0;for(var w=a.length;d<w;d++){var B=a[d],C=B.url;if(Array.isArray(C)){r[B.uuid]=[];for(var G=0,K=C.length;G<K;G++){var L=C[G];L=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(L)?L:h.resourcePath+L;r[B.uuid].push(f(L))}}else L=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(B.url)?B.url:h.resourcePath+B.url,r[B.uuid]=f(L)}}return r},parseTextures:function(a,d){function f(C,G){if("number"===typeof C)return C;console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",C);return G[C]}var h={};if(void 0!== a)for(var r=0,u=a.length;r<u;r++){var w=a[r];void 0===w.image&&console.warn('THREE.ObjectLoader: No "image" specified for',w.uuid);void 0===d[w.image]&&console.warn("THREE.ObjectLoader: Undefined image",w.image);var B=Array.isArray(d[w.image])?new Cd(d[w.image]):new l(d[w.image]);B.needsUpdate=!0;B.uuid=w.uuid;void 0!==w.name&&(B.name=w.name);void 0!==w.mapping&&(B.mapping=f(w.mapping,Yr));void 0!==w.offset&&B.offset.fromArray(w.offset);void 0!==w.repeat&&B.repeat.fromArray(w.repeat);void 0!==w.center&& B.center.fromArray(w.center);void 0!==w.rotation&&(B.rotation=w.rotation);void 0!==w.wrap&&(B.wrapS=f(w.wrap[0],Sn),B.wrapT=f(w.wrap[1],Sn));void 0!==w.format&&(B.format=w.format);void 0!==w.type&&(B.type=w.type);void 0!==w.encoding&&(B.encoding=w.encoding);void 0!==w.minFilter&&(B.minFilter=f(w.minFilter,Tn));void 0!==w.magFilter&&(B.magFilter=f(w.magFilter,Tn));void 0!==w.anisotropy&&(B.anisotropy=w.anisotropy);void 0!==w.flipY&&(B.flipY=w.flipY);void 0!==w.premultiplyAlpha&&(B.premultiplyAlpha= w.premultiplyAlpha);void 0!==w.unpackAlignment&&(B.unpackAlignment=w.unpackAlignment);h[w.uuid]=B}return h},parseObject:function(a,d,f){function h(G){void 0===d[G]&&console.warn("THREE.ObjectLoader: Undefined geometry",G);return d[G]}function r(G){if(void 0!==G){if(Array.isArray(G)){for(var K=[],L=0,M=G.length;L<M;L++){var R=G[L];void 0===f[R]&&console.warn("THREE.ObjectLoader: Undefined material",R);K.push(f[R])}return K}void 0===f[G]&&console.warn("THREE.ObjectLoader: Undefined material",G);return f[G]}} switch(a.type){case "Scene":var u=new z;void 0!==a.background&&Number.isInteger(a.background)&&(u.background=new J(a.background));void 0!==a.fog&&("Fog"===a.fog.type?u.fog=new gi(a.fog.color,a.fog.near,a.fog.far):"FogExp2"===a.fog.type&&(u.fog=new fi(a.fog.color,a.fog.density)));break;case "PerspectiveCamera":u=new Ab(a.fov,a.aspect,a.near,a.far);void 0!==a.focus&&(u.focus=a.focus);void 0!==a.zoom&&(u.zoom=a.zoom);void 0!==a.filmGauge&&(u.filmGauge=a.filmGauge);void 0!==a.filmOffset&&(u.filmOffset= a.filmOffset);void 0!==a.view&&(u.view=Object.assign({},a.view));break;case "OrthographicCamera":u=new qh(a.left,a.right,a.top,a.bottom,a.near,a.far);void 0!==a.zoom&&(u.zoom=a.zoom);void 0!==a.view&&(u.view=Object.assign({},a.view));break;case "AmbientLight":u=new zi(a.color,a.intensity);break;case "DirectionalLight":u=new yi(a.color,a.intensity);break;case "PointLight":u=new wi(a.color,a.intensity,a.distance,a.decay);break;case "RectAreaLight":u=new Ai(a.color,a.intensity,a.width,a.height);break; case "SpotLight":u=new vi(a.color,a.intensity,a.distance,a.angle,a.penumbra,a.decay);break;case "HemisphereLight":u=new ti(a.color,a.groundColor,a.intensity);break;case "SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case "Mesh":u=h(a.geometry);var w=r(a.material);u=u.bones&&0<u.bones.length?new Qg(u,w):new Nb(u,w);void 0!==a.drawMode&&u.setDrawMode(a.drawMode);break;case "LOD":u=new Pg;break;case "Line":u=new dc(h(a.geometry),r(a.material),a.mode); break;case "LineLoop":u=new ji(h(a.geometry),r(a.material));break;case "LineSegments":u=new Eb(h(a.geometry),r(a.material));break;case "PointCloud":case "Points":u=new zf(h(a.geometry),r(a.material));break;case "Sprite":u=new Ng(r(a.material));break;case "Group":u=new qf;break;default:u=new y}u.uuid=a.uuid;void 0!==a.name&&(u.name=a.name);void 0!==a.matrix?(u.matrix.fromArray(a.matrix),void 0!==a.matrixAutoUpdate&&(u.matrixAutoUpdate=a.matrixAutoUpdate),u.matrixAutoUpdate&&u.matrix.decompose(u.position, u.quaternion,u.scale)):(void 0!==a.position&&u.position.fromArray(a.position),void 0!==a.rotation&&u.rotation.fromArray(a.rotation),void 0!==a.quaternion&&u.quaternion.fromArray(a.quaternion),void 0!==a.scale&&u.scale.fromArray(a.scale));void 0!==a.castShadow&&(u.castShadow=a.castShadow);void 0!==a.receiveShadow&&(u.receiveShadow=a.receiveShadow);a.shadow&&(void 0!==a.shadow.bias&&(u.shadow.bias=a.shadow.bias),void 0!==a.shadow.radius&&(u.shadow.radius=a.shadow.radius),void 0!==a.shadow.mapSize&& u.shadow.mapSize.fromArray(a.shadow.mapSize),void 0!==a.shadow.camera&&(u.shadow.camera=this.parseObject(a.shadow.camera)));void 0!==a.visible&&(u.visible=a.visible);void 0!==a.frustumCulled&&(u.frustumCulled=a.frustumCulled);void 0!==a.renderOrder&&(u.renderOrder=a.renderOrder);void 0!==a.userData&&(u.userData=a.userData);void 0!==a.layers&&(u.layers.mask=a.layers);if(void 0!==a.children){w=a.children;for(var B=0;B<w.length;B++)u.add(this.parseObject(w[B],d,f))}if("LOD"===a.type)for(a=a.levels,w= 0;w<a.length;w++){B=a[w];var C=u.getObjectByProperty("uuid",B.object);void 0!==C&&u.addLevel(C,B.distance)}return u}});var Yr={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Sn={RepeatWrapping:1E3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Tn={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005, LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};kk.prototype=Object.assign(Object.create(vb.prototype),{constructor:kk,setOptions:function(a){this.options=a;return this},load:function(a,d,f,h){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var r=this,u=Ue.get(a);if(void 0!==u)return r.manager.itemStart(a),setTimeout(function(){d&&d(u);r.manager.itemEnd(a)},0),u;fetch(a).then(function(w){return w.blob()}).then(function(w){return void 0=== r.options?createImageBitmap(w):createImageBitmap(w,r.options)}).then(function(w){Ue.add(a,w);d&&d(w);r.manager.itemEnd(a)}).catch(function(w){h&&h(w);r.manager.itemError(a);r.manager.itemEnd(a)});r.manager.itemStart(a)}});Object.assign(lk.prototype,{moveTo:function(a,d){this.currentPath=new Yc;this.subPaths.push(this.currentPath);this.currentPath.moveTo(a,d)},lineTo:function(a,d){this.currentPath.lineTo(a,d)},quadraticCurveTo:function(a,d,f,h){this.currentPath.quadraticCurveTo(a,d,f,h)},bezierCurveTo:function(a, d,f,h,r,u){this.currentPath.bezierCurveTo(a,d,f,h,r,u)},splineThru:function(a){this.currentPath.splineThru(a)},toShapes:function(a,d){function f(W){for(var ja=[],ha=0,ia=W.length;ha<ia;ha++){var ma=W[ha],fa=new ie;fa.curves=ma.curves;ja.push(fa)}return ja}function h(W,ja){for(var ha=ja.length,ia=!1,ma=ha-1,fa=0;fa<ha;ma=fa++){var la=ja[ma],qa=ja[fa],Ka=qa.x-la.x,La=qa.y-la.y;if(Math.abs(La)>Number.EPSILON){if(0>La&&(la=ja[fa],Ka=-Ka,qa=ja[ma],La=-La),!(W.y<la.y||W.y>qa.y))if(W.y===la.y){if(W.x=== la.x)return!0}else{ma=La*(W.x-la.x)-Ka*(W.y-la.y);if(0===ma)return!0;0>ma||(ia=!ia)}}else if(W.y===la.y&&(qa.x<=W.x&&W.x<=la.x||la.x<=W.x&&W.x<=qa.x))return!0}return ia}var r=Ed.isClockWise,u=this.subPaths;if(0===u.length)return[];if(!0===d)return f(u);d=[];if(1===u.length){var w=u[0];var B=new ie;B.curves=w.curves;d.push(B);return d}var C=!r(u[0].getPoints());C=a?!C:C;B=[];var G=[],K=[],L=0;G[L]=void 0;K[L]=[];for(var M=0,R=u.length;M<R;M++){w=u[M];var S=w.getPoints();var X=r(S);(X=a?!X:X)?(!C&& G[L]&&L++,G[L]={s:new ie,p:S},G[L].s.curves=w.curves,C&&L++,K[L]=[]):K[L].push({h:w,p:S[0]})}if(!G[0])return f(u);if(1<G.length){M=!1;a=[];r=0;for(u=G.length;r<u;r++)B[r]=[];r=0;for(u=G.length;r<u;r++)for(w=K[r],X=0;X<w.length;X++){C=w[X];L=!0;for(S=0;S<G.length;S++)h(C.p,G[S].p)&&(r!==S&&a.push({froms:r,tos:S,hole:X}),L?(L=!1,B[S].push(C)):M=!0);L&&B[r].push(C)}0<a.length&&(M||(K=B))}M=0;for(r=G.length;M<r;M++)for(B=G[M].s,d.push(B),a=K[M],u=0,w=a.length;u<w;u++)B.holes.push(a[u].h);return d}}); Object.assign(mk.prototype,{isFont:!0,generateShapes:function(a,d){void 0===d&&(d=100);var f=[];a=Ir(a,d,this.data);d=0;for(var h=a.length;d<h;d++)Array.prototype.push.apply(f,a[d].toShapes());return f}});nk.prototype=Object.assign(Object.create(vb.prototype),{constructor:nk,load:function(a,d,f,h){var r=this,u=new Jc(this.manager);u.setPath(this.path);u.load(a,function(w){try{var B=JSON.parse(w)}catch(C){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), B=JSON.parse(w.substring(65,w.length-2))}w=r.parse(B);d&&d(w)},f,h)},parse:function(a){return new mk(a)}});var ej,sk={getContext:function(){void 0===ej&&(ej=new (window.AudioContext||window.webkitAudioContext));return ej},setContext:function(a){ej=a}};Gi.prototype=Object.assign(Object.create(vb.prototype),{constructor:Gi,load:function(a,d,f,h){var r=new Jc(this.manager);r.setResponseType("arraybuffer");r.setPath(this.path);r.load(a,function(u){u=u.slice(0);sk.getContext().decodeAudioData(u,function(w){d(w)})}, f,h)}});Object.assign(Hi.prototype,{isSphericalHarmonics3:!0,set:function(a){for(var d=0;9>d;d++)this.coefficients[d].copy(a[d]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,d){var f=a.x,h=a.y;a=a.z;var r=this.coefficients;d.copy(r[0]).multiplyScalar(.282095);d.addScale(r[1],.488603*h);d.addScale(r[2],.488603*a);d.addScale(r[3],.488603*f);d.addScale(r[4],1.092548*f*h);d.addScale(r[5],1.092548*h*a);d.addScale(r[6],.315392*(3*a*a-1)); d.addScale(r[7],1.092548*f*a);d.addScale(r[8],.546274*(f*f-h*h));return d},getIrradianceAt:function(a,d){var f=a.x,h=a.y;a=a.z;var r=this.coefficients;d.copy(r[0]).multiplyScalar(.886227);d.addScale(r[1],1.023328*h);d.addScale(r[2],1.023328*a);d.addScale(r[3],1.023328*f);d.addScale(r[4],.858086*f*h);d.addScale(r[5],.858086*h*a);d.addScale(r[6],.743125*a*a-.247708);d.addScale(r[7],.858086*f*a);d.addScale(r[8],.429043*(f*f-h*h));return d},add:function(a){for(var d=0;9>d;d++)this.coefficients[d].add(a.coefficients[d]); return this},scale:function(a){for(var d=0;9>d;d++)this.coefficients[d].multiplyScalar(a);return this},lerp:function(a,d){for(var f=0;9>f;f++)this.coefficients[f].lerp(a.coefficients[f],d);return this},equals:function(a){for(var d=0;9>d;d++)if(!this.coefficients[d].equals(a.coefficients[d]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,d){void 0===d&&(d=0);for(var f=this.coefficients,h=0;9>h;h++)f[h].fromArray(a, d+3*h);return this},toArray:function(a,d){void 0===a&&(a=[]);void 0===d&&(d=0);for(var f=this.coefficients,h=0;9>h;h++)f[h].toArray(a,d+3*h);return a}});Object.assign(Hi,{getBasisAt:function(a,d){var f=a.x,h=a.y;a=a.z;d[0]=.282095;d[1]=.488603*h;d[2]=.488603*a;d[3]=.488603*f;d[4]=1.092548*f*h;d[5]=1.092548*h*a;d[6]=.315392*(3*a*a-1);d[7]=1.092548*f*a;d[8]=.546274*(f*f-h*h)}});Zc.prototype=Object.assign(Object.create(Gb.prototype),{constructor:Zc,isLightProbe:!0,copy:function(a){Gb.prototype.copy.call(this, a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return Gb.prototype.toJSON.call(this,a)}});ok.prototype=Object.assign(Object.create(Zc.prototype),{constructor:ok,isHemisphereLightProbe:!0,copy:function(a){Zc.prototype.copy.call(this,a);return this},toJSON:function(a){return Zc.prototype.toJSON.call(this,a)}});pk.prototype=Object.assign(Object.create(Zc.prototype),{constructor:pk,isAmbientLightProbe:!0,copy:function(a){Zc.prototype.copy.call(this,a);return this},toJSON:function(a){return Zc.prototype.toJSON.call(this, a)}});var Un=new t,Vn=new t;Object.assign(qn.prototype,{update:function(a){var d=this._cache;if(d.focus!==a.focus||d.fov!==a.fov||d.aspect!==a.aspect*this.aspect||d.near!==a.near||d.far!==a.far||d.zoom!==a.zoom||d.eyeSep!==this.eyeSep){d.focus=a.focus;d.fov=a.fov;d.aspect=a.aspect*this.aspect;d.near=a.near;d.far=a.far;d.zoom=a.zoom;d.eyeSep=this.eyeSep;var f=a.projectionMatrix.clone(),h=d.eyeSep/2,r=h*d.near/d.focus,u=d.near*Math.tan(bb.DEG2RAD*d.fov*.5)/d.zoom;Vn.elements[12]=-h;Un.elements[12]= h;h=-u*d.aspect+r;var w=u*d.aspect+r;f.elements[0]=2*d.near/(w-h);f.elements[8]=(w+h)/(w-h);this.cameraL.projectionMatrix.copy(f);h=-u*d.aspect-r;w=u*d.aspect-r;f.elements[0]=2*d.near/(w-h);f.elements[8]=(w+h)/(w-h);this.cameraR.projectionMatrix.copy(f)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(Vn);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(Un)}});Object.assign(qk.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now(); this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var d=("undefined"===typeof performance?Date:performance).now();a=(d-this.oldTime)/1E3;this.oldTime=d;this.elapsedTime+=a}return a}});var Ve=new k,Wn=new g,Zr=new k,We=new k;rk.prototype=Object.assign(Object.create(y.prototype), {constructor:rk,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter); this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(a){y.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var d=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(Ve,Wn,Zr);We.set(0,0,-1).applyQuaternion(Wn);if(a.positionX){var f=this.context.currentTime+this.timeDelta; a.positionX.linearRampToValueAtTime(Ve.x,f);a.positionY.linearRampToValueAtTime(Ve.y,f);a.positionZ.linearRampToValueAtTime(Ve.z,f);a.forwardX.linearRampToValueAtTime(We.x,f);a.forwardY.linearRampToValueAtTime(We.y,f);a.forwardZ.linearRampToValueAtTime(We.z,f);a.upX.linearRampToValueAtTime(d.x,f);a.upY.linearRampToValueAtTime(d.y,f);a.upZ.linearRampToValueAtTime(d.z,f)}else a.setPosition(Ve.x,Ve.y,Ve.z),a.setOrientation(We.x,We.y,We.z,d.x,d.y,d.z)}});Tf.prototype=Object.assign(Object.create(y.prototype), {constructor:Tf,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing."); else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset,this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var a=1,d=this.filters.length;a<d;a++)this.filters[a- 1].connect(this.filters[a]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var a=1,d=this.filters.length;a<d;a++)this.filters[a-1].disconnect(this.filters[a]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(a){a|| (a=[]);!0===this.isPlaying?(this.disconnect(),this.filters=a,this.connect()):this.filters=a;return this},setDetune:function(a){this.detune=a;if(void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(a){return this.setFilters(a?[a]:[])},setPlaybackRate:function(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); else return this.playbackRate=a,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.loop= a,!0===this.isPlaying&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this}});var Xe=new k,Xn=new g,$r=new k,Ye=new k;tk.prototype=Object.assign(Object.create(Tf.prototype),{constructor:tk,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(a){this.panner.refDistance=a;return this},getRolloffFactor:function(){return this.panner.rolloffFactor}, setRolloffFactor:function(a){this.panner.rolloffFactor=a;return this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel=a;return this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a;return this},setDirectionalCone:function(a,d,f){this.panner.coneInnerAngle=a;this.panner.coneOuterAngle=d;this.panner.coneOuterGain=f;return this},updateMatrixWorld:function(a){y.prototype.updateMatrixWorld.call(this, a);if(!0!==this.hasPlaybackControl||!1!==this.isPlaying)if(this.matrixWorld.decompose(Xe,Xn,$r),Ye.set(0,0,1).applyQuaternion(Xn),a=this.panner,a.positionX){var d=this.context.currentTime+this.listener.timeDelta;a.positionX.linearRampToValueAtTime(Xe.x,d);a.positionY.linearRampToValueAtTime(Xe.y,d);a.positionZ.linearRampToValueAtTime(Xe.z,d);a.orientationX.linearRampToValueAtTime(Ye.x,d);a.orientationY.linearRampToValueAtTime(Ye.y,d);a.orientationZ.linearRampToValueAtTime(Ye.z,d)}else a.setPosition(Xe.x, Xe.y,Xe.z),a.setOrientation(Ye.x,Ye.y,Ye.z)}});Object.assign(uk.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var a=0,d=this.getFrequencyData(),f=0;f<d.length;f++)a+=d[f];return a/d.length}});Object.assign(vk.prototype,{accumulate:function(a,d){var f=this.buffer,h=this.valueSize;a=a*h+h;var r=this.cumulativeWeight;if(0===r){for(r=0;r!==h;++r)f[a+r]=f[r];r=d}else r+=d,this._mixBufferRegion(f,a,0,d/r,h);this.cumulativeWeight= r},apply:function(a){var d=this.valueSize,f=this.buffer;a=a*d+d;var h=this.cumulativeWeight,r=this.binding;this.cumulativeWeight=0;1>h&&this._mixBufferRegion(f,a,3*d,1-h,d);h=d;for(var u=d+d;h!==u;++h)if(f[h]!==f[h+d]){r.setValue(f,a);break}},saveOriginalState:function(){var a=this.buffer,d=this.valueSize,f=3*d;this.binding.getValue(a,f);for(var h=d;h!==f;++h)a[h]=a[f+h%d];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, d,f,h,r){if(.5<=h)for(h=0;h!==r;++h)a[d+h]=a[f+h]},_slerp:function(a,d,f,h){g.slerpFlat(a,d,a,d,a,f,h)},_lerp:function(a,d,f,h,r){for(var u=1-h,w=0;w!==r;++w){var B=d+w;a[B]=a[B]*u+a[f+w]*h}}});var as=/[\[\]\.:\/]/g,bs="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",cs=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),ds=/(WCOD+)?/.source.replace("WCOD",bs),es=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fs=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),gs= new RegExp("^"+cs+ds+es+fs+"$"),hs=["material","materials","bones"];Object.assign(rn.prototype,{getValue:function(a,d){this.bind();var f=this._bindings[this._targetGroup.nCachedObjects_];void 0!==f&&f.getValue(a,d)},setValue:function(a,d){for(var f=this._bindings,h=this._targetGroup.nCachedObjects_,r=f.length;h!==r;++h)f[h].setValue(a,d)},bind:function(){for(var a=this._bindings,d=this._targetGroup.nCachedObjects_,f=a.length;d!==f;++d)a[d].bind()},unbind:function(){for(var a=this._bindings,d=this._targetGroup.nCachedObjects_, f=a.length;d!==f;++d)a[d].unbind()}});Object.assign(lc,{Composite:rn,create:function(a,d,f){return a&&a.isAnimationObjectGroup?new lc.Composite(a,d,f):new lc(a,d,f)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(as,"")},parseTrackName:function(a){var d=gs.exec(a);if(!d)throw Error("PropertyBinding: Cannot parse trackName: "+a);d={nodeName:d[2],objectName:d[3],objectIndex:d[4],propertyName:d[5],propertyIndex:d[6]};var f=d.nodeName&&d.nodeName.lastIndexOf(".");if(void 0!==f&&-1!== f){var h=d.nodeName.substring(f+1);-1!==hs.indexOf(h)&&(d.nodeName=d.nodeName.substring(0,f),d.objectName=h)}if(null===d.propertyName||0===d.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return d},findNode:function(a,d){if(!d||""===d||"root"===d||"."===d||-1===d||d===a.name||d===a.uuid)return a;if(a.skeleton){var f=a.skeleton.getBoneByName(d);if(void 0!==f)return f}if(a.children){var h=function(r){for(var u=0;u<r.length;u++){var w=r[u];if(w.name=== d||w.uuid===d)return w;if(w=h(w.children))return w}return null};if(a=h(a.children))return a}return null}});Object.assign(lc.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(a,d){a[d]=this.node[this.propertyName]},function(a,d){for(var f=this.resolvedProperty,h=0,r=f.length;h!==r;++h)a[d++]=f[h]},function(a,d){a[d]= this.resolvedProperty[this.propertyIndex]},function(a,d){this.resolvedProperty.toArray(a,d)}],SetterByBindingTypeAndVersioning:[[function(a,d){this.targetObject[this.propertyName]=a[d]},function(a,d){this.targetObject[this.propertyName]=a[d];this.targetObject.needsUpdate=!0},function(a,d){this.targetObject[this.propertyName]=a[d];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,d){for(var f=this.resolvedProperty,h=0,r=f.length;h!==r;++h)f[h]=a[d++]},function(a,d){for(var f=this.resolvedProperty, h=0,r=f.length;h!==r;++h)f[h]=a[d++];this.targetObject.needsUpdate=!0},function(a,d){for(var f=this.resolvedProperty,h=0,r=f.length;h!==r;++h)f[h]=a[d++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,d){this.resolvedProperty[this.propertyIndex]=a[d]},function(a,d){this.resolvedProperty[this.propertyIndex]=a[d];this.targetObject.needsUpdate=!0},function(a,d){this.resolvedProperty[this.propertyIndex]=a[d];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,d){this.resolvedProperty.fromArray(a, d)},function(a,d){this.resolvedProperty.fromArray(a,d);this.targetObject.needsUpdate=!0},function(a,d){this.resolvedProperty.fromArray(a,d);this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(a,d){this.bind();this.getValue(a,d)},setValue:function(a,d){this.bind();this.setValue(a,d)},bind:function(){var a=this.node,d=this.parsedPath,f=d.objectName,h=d.propertyName,r=d.propertyIndex;a||(this.node=a=lc.findNode(this.rootNode,d.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable; this.setValue=this._setValue_unavailable;if(a){if(f){var u=d.objectIndex;switch(f){case "materials":if(!a.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!a.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);return}a=a.skeleton.bones;for(f=0;f<a.length;f++)if(a[f].name===u){u=f;break}break;default:if(void 0===a[f]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}a=a[f]}if(void 0!==u){if(void 0===a[u]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,a);return}a=a[u]}}u=a[h];if(void 0===u)console.error("THREE.PropertyBinding: Trying to update property for track: "+d.nodeName+"."+h+" but it wasn't found.", a);else{d=this.Versioning.None;this.targetObject=a;void 0!==a.needsUpdate?d=this.Versioning.NeedsUpdate:void 0!==a.matrixWorldNeedsUpdate&&(d=this.Versioning.MatrixWorldNeedsUpdate);f=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===h){if(!a.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(a.geometry.isBufferGeometry){if(!a.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);return}for(f=0;f<this.node.geometry.morphAttributes.position.length;f++)if(a.geometry.morphAttributes.position[f].name===r){r=f;break}}else{if(!a.geometry.morphTargets){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);return}for(f=0;f<this.node.geometry.morphTargets.length;f++)if(a.geometry.morphTargets[f].name===r){r=f;break}}}f=this.BindingType.ArrayElement;this.resolvedProperty=u;this.propertyIndex=r}else void 0!== u.fromArray&&void 0!==u.toArray?(f=this.BindingType.HasFromToArray,this.resolvedProperty=u):Array.isArray(u)?(f=this.BindingType.EntireArray,this.resolvedProperty=u):this.propertyName=h;this.getValue=this.GetterByBindingType[f];this.setValue=this.SetterByBindingTypeAndVersioning[f][d]}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}}); Object.assign(lc.prototype,{_getValue_unbound:lc.prototype.getValue,_setValue_unbound:lc.prototype.setValue});Object.assign(sn.prototype,{isAnimationObjectGroup:!0,add:function(){for(var a=this._objects,d=a.length,f=this.nCachedObjects_,h=this._indicesByUUID,r=this._paths,u=this._parsedPaths,w=this._bindings,B=w.length,C=void 0,G=0,K=arguments.length;G!==K;++G){var L=arguments[G],M=L.uuid,R=h[M];if(void 0===R){R=d++;h[M]=R;a.push(L);M=0;for(var S=B;M!==S;++M)w[M].push(new lc(L,r[M],u[M]))}else if(R< f){C=a[R];var X=--f;S=a[X];h[S.uuid]=R;a[R]=S;h[M]=X;a[X]=L;M=0;for(S=B;M!==S;++M){var W=w[M],ja=W[R];W[R]=W[X];void 0===ja&&(ja=new lc(L,r[M],u[M]));W[X]=ja}}else a[R]!==C&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f},remove:function(){for(var a=this._objects,d=this.nCachedObjects_,f=this._indicesByUUID,h=this._bindings,r=h.length,u=0,w=arguments.length;u!== w;++u){var B=arguments[u],C=B.uuid,G=f[C];if(void 0!==G&&G>=d){var K=d++,L=a[K];f[L.uuid]=G;a[G]=L;f[C]=K;a[K]=B;B=0;for(C=r;B!==C;++B){L=h[B];var M=L[G];L[G]=L[K];L[K]=M}}}this.nCachedObjects_=d},uncache:function(){for(var a=this._objects,d=a.length,f=this.nCachedObjects_,h=this._indicesByUUID,r=this._bindings,u=r.length,w=0,B=arguments.length;w!==B;++w){var C=arguments[w].uuid,G=h[C];if(void 0!==G)if(delete h[C],G<f){C=--f;var K=a[C],L=--d,M=a[L];h[K.uuid]=G;a[G]=K;h[M.uuid]=C;a[C]=M;a.pop();K= 0;for(M=u;K!==M;++K){var R=r[K],S=R[L];R[G]=R[C];R[C]=S;R.pop()}}else for(L=--d,M=a[L],h[M.uuid]=G,a[G]=M,a.pop(),K=0,M=u;K!==M;++K)R=r[K],R[G]=R[L],R.pop()}this.nCachedObjects_=f},subscribe_:function(a,d){var f=this._bindingsIndicesByPath,h=f[a],r=this._bindings;if(void 0!==h)return r[h];var u=this._paths,w=this._parsedPaths,B=this._objects,C=this.nCachedObjects_,G=Array(B.length);h=r.length;f[a]=h;u.push(a);w.push(d);r.push(G);f=C;for(h=B.length;f!==h;++f)G[f]=new lc(B[f],a,d);return G},unsubscribe_:function(a){var d= this._bindingsIndicesByPath,f=d[a];if(void 0!==f){var h=this._paths,r=this._parsedPaths,u=this._bindings,w=u.length-1,B=u[w];d[a[w]]=f;u[f]=B;u.pop();r[f]=r[w];r.pop();h[f]=h[w];h.pop()}}});Object.assign(tn.prototype,{play:function(){this._mixer._activateAction(this);return this},stop:function(){this._mixer._deactivateAction(this);return this.reset()},reset:function(){this.paused=!1;this.enabled=!0;this.time=0;this._loopCount=-1;this._startTime=null;return this.stopFading().stopWarping()},isRunning:function(){return this.enabled&& !this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(a){this._startTime=a;return this},setLoop:function(a,d){this.loop=a;this.repetitions=d;return this},setEffectiveWeight:function(a){this.weight=a;this._effectiveWeight=this.enabled?a:0;return this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(a){return this._scheduleFading(a,0,1)},fadeOut:function(a){return this._scheduleFading(a, 1,0)},crossFadeFrom:function(a,d,f){a.fadeOut(d);this.fadeIn(d);if(f){f=this._clip.duration;var h=a._clip.duration,r=f/h;a.warp(1,h/f,d);this.warp(r,1,d)}return this},crossFadeTo:function(a,d,f){return a.crossFadeFrom(this,d,f)},stopFading:function(){var a=this._weightInterpolant;null!==a&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(a));return this},setEffectiveTimeScale:function(a){this.timeScale=a;this._effectiveTimeScale=this.paused?0:a;return this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale}, setDuration:function(a){this.timeScale=this._clip.duration/a;return this.stopWarping()},syncWith:function(a){this.time=a.time;this.timeScale=a.timeScale;return this.stopWarping()},halt:function(a){return this.warp(this._effectiveTimeScale,0,a)},warp:function(a,d,f){var h=this._mixer,r=h.time,u=this._timeScaleInterpolant,w=this.timeScale;null===u&&(this._timeScaleInterpolant=u=h._lendControlInterpolant());h=u.parameterPositions;u=u.sampleValues;h[0]=r;h[1]=r+f;u[0]=a/w;u[1]=d/w;return this},stopWarping:function(){var a= this._timeScaleInterpolant;null!==a&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(a));return this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(a,d,f,h){if(this.enabled){var r=this._startTime;if(null!==r){d=(a-r)*f;if(0>d||0===f)return;this._startTime=null;d*=f}d*=this._updateTimeScale(a);f=this._updateTime(d);a=this._updateWeight(a);if(0<a){d=this._interpolants; r=this._propertyBindings;for(var u=0,w=d.length;u!==w;++u)d[u].evaluate(f),r[u].accumulate(h,a)}}else this._updateWeight(a)},_updateWeight:function(a){var d=0;if(this.enabled){d=this.weight;var f=this._weightInterpolant;if(null!==f){var h=f.evaluate(a)[0];d*=h;a>f.parameterPositions[1]&&(this.stopFading(),0===h&&(this.enabled=!1))}}return this._effectiveWeight=d},_updateTimeScale:function(a){var d=0;if(!this.paused){d=this.timeScale;var f=this._timeScaleInterpolant;if(null!==f){var h=f.evaluate(a)[0]; d*=h;a>f.parameterPositions[1]&&(this.stopWarping(),0===d?this.paused=!0:this.timeScale=d)}}return this._effectiveTimeScale=d},_updateTime:function(a){var d=this.time+a,f=this._clip.duration,h=this.loop,r=this._loopCount,u=2202===h;if(0===a)return-1===r?d:u&&1===(r&1)?f-d:d;if(2200===h)a:{if(-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1)),d>=f)d=f;else if(0>d)d=0;else{this.time=d;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=d;this._mixer.dispatchEvent({type:"finished", action:this,direction:0>a?-1:1})}else{-1===r&&(0<=a?(r=0,this._setEndings(!0,0===this.repetitions,u)):this._setEndings(0===this.repetitions,!0,u));if(d>=f||0>d){h=Math.floor(d/f);d-=f*h;r+=Math.abs(h);var w=this.repetitions-r;0>=w?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=d=0<a?f:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<a?1:-1})):(1===w?(a=0>a,this._setEndings(a,!a,u)):this._setEndings(!1,!1,u),this._loopCount=r,this.time=d,this._mixer.dispatchEvent({type:"loop", action:this,loopDelta:h}))}else this.time=d;if(u&&1===(r&1))return f-d}return d},_setEndings:function(a,d,f){var h=this._interpolantSettings;f?(h.endingStart=2401,h.endingEnd=2401):(h.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,h.endingEnd=d?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,d,f){var h=this._mixer,r=h.time,u=this._weightInterpolant;null===u&&(this._weightInterpolant=u=h._lendControlInterpolant());h=u.parameterPositions;u=u.sampleValues;h[0]=r;u[0]=d;h[1]=r+a;u[1]= f;return this}});wk.prototype=Object.assign(Object.create(c.prototype),{constructor:wk,_bindAction:function(a,d){var f=a._localRoot||this._root,h=a._clip.tracks,r=h.length,u=a._propertyBindings;a=a._interpolants;var w=f.uuid,B=this._bindingsByRootAndName,C=B[w];void 0===C&&(C={},B[w]=C);for(B=0;B!==r;++B){var G=h[B],K=G.name,L=C[K];if(void 0===L){L=u[B];if(void 0!==L){null===L._cacheIndex&&(++L.referenceCount,this._addInactiveBinding(L,w,K));continue}L=new vk(lc.create(f,K,d&&d._propertyBindings[B].binding.parsedPath), G.ValueTypeName,G.getValueSize());++L.referenceCount;this._addInactiveBinding(L,w,K)}u[B]=L;a[B].resultBuffer=L.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var d=(a._localRoot||this._root).uuid,f=a._clip.uuid,h=this._actionsByClip[f];this._bindAction(a,h&&h.knownActions[0]);this._addInactiveAction(a,f,d)}d=a._propertyBindings;f=0;for(h=d.length;f!==h;++f){var r=d[f];0===r.useCount++&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(a)}}, _deactivateAction:function(a){if(this._isActiveAction(a)){for(var d=a._propertyBindings,f=0,h=d.length;f!==h;++f){var r=d[f];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length}, get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&a<this._nActiveActions},_addInactiveAction:function(a,d,f){var h=this._actions,r=this._actionsByClip,u=r[d];void 0===u?(u={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,r[d]=u):(d= u.knownActions,a._byClipCacheIndex=d.length,d.push(a));a._cacheIndex=h.length;h.push(a);u.actionByRoot[f]=a},_removeInactiveAction:function(a){var d=this._actions,f=d[d.length-1],h=a._cacheIndex;f._cacheIndex=h;d[h]=f;d.pop();a._cacheIndex=null;d=a._clip.uuid;f=this._actionsByClip;h=f[d];var r=h.knownActions,u=r[r.length-1],w=a._byClipCacheIndex;u._byClipCacheIndex=w;r[w]=u;r.pop();a._byClipCacheIndex=null;delete h.actionByRoot[(a._localRoot||this._root).uuid];0===r.length&&delete f[d];this._removeInactiveBindingsForAction(a)}, _removeInactiveBindingsForAction:function(a){a=a._propertyBindings;for(var d=0,f=a.length;d!==f;++d){var h=a[d];0===--h.referenceCount&&this._removeInactiveBinding(h)}},_lendAction:function(a){var d=this._actions,f=a._cacheIndex,h=this._nActiveActions++,r=d[h];a._cacheIndex=h;d[h]=a;r._cacheIndex=f;d[f]=r},_takeBackAction:function(a){var d=this._actions,f=a._cacheIndex,h=--this._nActiveActions,r=d[h];a._cacheIndex=h;d[h]=a;r._cacheIndex=f;d[f]=r},_addInactiveBinding:function(a,d,f){var h=this._bindingsByRootAndName, r=h[d],u=this._bindings;void 0===r&&(r={},h[d]=r);r[f]=a;a._cacheIndex=u.length;u.push(a)},_removeInactiveBinding:function(a){var d=this._bindings,f=a.binding,h=f.rootNode.uuid;f=f.path;var r=this._bindingsByRootAndName,u=r[h],w=d[d.length-1];a=a._cacheIndex;w._cacheIndex=a;d[a]=w;d.pop();delete u[f];0===Object.keys(u).length&&delete r[h]},_lendBinding:function(a){var d=this._bindings,f=a._cacheIndex,h=this._nActiveBindings++,r=d[h];a._cacheIndex=h;d[h]=a;r._cacheIndex=f;d[f]=r},_takeBackBinding:function(a){var d= this._bindings,f=a._cacheIndex,h=--this._nActiveBindings,r=d[h];a._cacheIndex=h;d[h]=a;r._cacheIndex=f;d[f]=r},_lendControlInterpolant:function(){var a=this._controlInterpolants,d=this._nActiveControlInterpolants++,f=a[d];void 0===f&&(f=new mh(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),f.__cacheIndex=d,a[d]=f);return f},_takeBackControlInterpolant:function(a){var d=this._controlInterpolants,f=a.__cacheIndex,h=--this._nActiveControlInterpolants,r=d[h];a.__cacheIndex= h;d[h]=a;r.__cacheIndex=f;d[f]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(a,d){var f=d||this._root,h=f.uuid;f="string"===typeof a?Ic.findByName(f,a):a;a=null!==f?f.uuid:a;var r=this._actionsByClip[a],u=null;if(void 0!==r){u=r.actionByRoot[h];if(void 0!==u)return u;u=r.knownActions[0];null===f&&(f=u._clip)}if(null===f)return null;d=new tn(this,f,d);this._bindAction(d,u);this._addInactiveAction(d,a,h);return d},existingAction:function(a,d){var f=d||this._root;d=f.uuid; f="string"===typeof a?Ic.findByName(f,a):a;a=this._actionsByClip[f?f.uuid:a];return void 0!==a?a.actionByRoot[d]||null:null},stopAllAction:function(){for(var a=this._actions,d=this._nActiveActions,f=this._bindings,h=this._nActiveBindings,r=this._nActiveBindings=this._nActiveActions=0;r!==d;++r)a[r].reset();for(r=0;r!==h;++r)f[r].useCount=0;return this},update:function(a){a*=this.timeScale;for(var d=this._actions,f=this._nActiveActions,h=this.time+=a,r=Math.sign(a),u=this._accuIndex^=1,w=0;w!==f;++w)d[w]._update(h, a,r,u);a=this._bindings;d=this._nActiveBindings;for(w=0;w!==d;++w)a[w].apply(u);return this},getRoot:function(){return this._root},uncacheClip:function(a){var d=this._actions;a=a.uuid;var f=this._actionsByClip,h=f[a];if(void 0!==h){h=h.knownActions;for(var r=0,u=h.length;r!==u;++r){var w=h[r];this._deactivateAction(w);var B=w._cacheIndex,C=d[d.length-1];w._cacheIndex=null;w._byClipCacheIndex=null;C._cacheIndex=B;d[B]=C;d.pop();this._removeInactiveBindingsForAction(w)}delete f[a]}},uncacheRoot:function(a){a= a.uuid;var d=this._actionsByClip;for(h in d){var f=d[h].actionByRoot[a];void 0!==f&&(this._deactivateAction(f),this._removeInactiveAction(f))}var h=this._bindingsByRootAndName[a];if(void 0!==h)for(var r in h)a=h[r],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,d){a=this.existingAction(a,d);null!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}});Ii.prototype.clone=function(){return new Ii(void 0===this.value.clone?this.value:this.value.clone())};xk.prototype= Object.assign(Object.create(Be.prototype),{constructor:xk,isInstancedInterleavedBuffer:!0,copy:function(a){Be.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this}});Object.assign(un.prototype,{linePrecision:1,set:function(a,d){this.ray.set(a,d)},setFromCamera:function(a,d){d&&d.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(d.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(d).sub(this.ray.origin).normalize(),this.camera=d):d&&d.isOrthographicCamera? (this.ray.origin.set(a.x,a.y,(d.near+d.far)/(d.near-d.far)).unproject(d),this.ray.direction.set(0,0,-1).transformDirection(d.matrixWorld),this.camera=d):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,d,f){f=f||[];yk(a,this,f,d);f.sort(vn);return f},intersectObjects:function(a,d,f){f=f||[];if(!1===Array.isArray(a))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),f;for(var h=0,r=a.length;h<r;h++)yk(a[h],this,f,d);f.sort(vn);return f}}); Object.assign(wn.prototype,{set:function(a,d,f){this.radius=a;this.phi=d;this.theta=f;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.radius=a.radius;this.phi=a.phi;this.theta=a.theta;return this},makeSafe:function(){this.phi=Math.max(1E-6,Math.min(Math.PI-1E-6,this.phi));return this},setFromVector3:function(a){return this.setFromCartesianCoords(a.x,a.y,a.z)},setFromCartesianCoords:function(a,d,f){this.radius=Math.sqrt(a*a+d*d+f*f);0===this.radius?this.phi= this.theta=0:(this.theta=Math.atan2(a,f),this.phi=Math.acos(bb.clamp(d/this.radius,-1,1)));return this}});Object.assign(xn.prototype,{set:function(a,d,f){this.radius=a;this.theta=d;this.y=f;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.radius=a.radius;this.theta=a.theta;this.y=a.y;return this},setFromVector3:function(a){return this.setFromCartesianCoords(a.x,a.y,a.z)},setFromCartesianCoords:function(a,d,f){this.radius=Math.sqrt(a*a+f*f);this.theta=Math.atan2(a, f);this.y=d;return this}});var Yn=new e;Object.assign(zk.prototype,{set:function(a,d){this.min.copy(a);this.max.copy(d);return this},setFromPoints:function(a){this.makeEmpty();for(var d=0,f=a.length;d<f;d++)this.expandByPoint(a[d]);return this},setFromCenterAndSize:function(a,d){d=Yn.copy(d).multiplyScalar(.5);this.min.copy(a).sub(d);this.max.copy(a).add(d);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this}, makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(a){void 0===a&&(console.warn("THREE.Box2: .getCenter() target is now required"),a=new e);return this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){void 0===a&&(console.warn("THREE.Box2: .getSize() target is now required"),a=new e);return this.isEmpty()?a.set(0,0):a.subVectors(this.max, this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,d){void 0===d&&(console.warn("THREE.Box2: .getParameter() target is now required"), d=new e);return d.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y?!1:!0},clampPoint:function(a,d){void 0===d&&(console.warn("THREE.Box2: .clampPoint() target is now required"),d=new e);return d.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Yn.copy(a).clamp(this.min,this.max).sub(a).length()},intersect:function(a){this.min.max(a.min); this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Zn=new k,fj=new k;Object.assign(Ak.prototype,{set:function(a,d){this.start.copy(a);this.end.copy(d);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0=== a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new k);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new k);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,d){void 0===d&&(console.warn("THREE.Line3: .at() target is now required"),d= new k);return this.delta(d).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(a,d){Zn.subVectors(a,this.start);fj.subVectors(this.end,this.start);a=fj.dot(Zn)/fj.dot(fj);d&&(a=bb.clamp(a,0,1));return a},closestPointToPoint:function(a,d,f){a=this.closestPointToPointParameter(a,d);void 0===f&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),f=new k);return this.delta(f).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});rh.prototype=Object.create(y.prototype);rh.prototype.constructor=rh;rh.prototype.isImmediateRenderObject=!0;var xd=new k,Od=new k,Xk=new q,is=["a","b","c"];sh.prototype=Object.create(Eb.prototype);sh.prototype.constructor=sh;sh.prototype.update=function(){this.object.updateMatrixWorld(!0);Xk.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,d=this.geometry.attributes.position, f=this.object.geometry;if(f&&f.isGeometry)for(var h=f.vertices,r=f.faces,u=f=0,w=r.length;u<w;u++)for(var B=r[u],C=0,G=B.vertexNormals.length;C<G;C++){var K=B.vertexNormals[C];xd.copy(h[B[is[C]]]).applyMatrix4(a);Od.copy(K).applyMatrix3(Xk).normalize().multiplyScalar(this.size).add(xd);d.setXYZ(f,xd.x,xd.y,xd.z);f+=1;d.setXYZ(f,Od.x,Od.y,Od.z);f+=1}else if(f&&f.isBufferGeometry)for(h=f.attributes.position,r=f.attributes.normal,C=f=0,G=h.count;C<G;C++)xd.set(h.getX(C),h.getY(C),h.getZ(C)).applyMatrix4(a), Od.set(r.getX(C),r.getY(C),r.getZ(C)),Od.applyMatrix3(Xk).normalize().multiplyScalar(this.size).add(xd),d.setXYZ(f,xd.x,xd.y,xd.z),f+=1,d.setXYZ(f,Od.x,Od.y,Od.z),f+=1;d.needsUpdate=!0};var $n=new k;Uf.prototype=Object.create(y.prototype);Uf.prototype.constructor=Uf;Uf.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};Uf.prototype.update=function(){this.light.updateMatrixWorld();var a=this.light.distance?this.light.distance:1E3,d=a*Math.tan(this.light.angle); this.cone.scale.set(d,d,a);$n.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt($n);void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var oe=new k,gj=new t,Yk=new t;Vf.prototype=Object.create(Eb.prototype);Vf.prototype.constructor=Vf;Vf.prototype.updateMatrixWorld=function(a){var d=this.bones,f=this.geometry,h=f.getAttribute("position");Yk.getInverse(this.root.matrixWorld);for(var r=0,u=0;r<d.length;r++){var w=d[r];w.parent&& w.parent.isBone&&(gj.multiplyMatrices(Yk,w.matrixWorld),oe.setFromMatrixPosition(gj),h.setXYZ(u,oe.x,oe.y,oe.z),gj.multiplyMatrices(Yk,w.parent.matrixWorld),oe.setFromMatrixPosition(gj),h.setXYZ(u+1,oe.x,oe.y,oe.z),u+=2)}f.getAttribute("position").needsUpdate=!0;y.prototype.updateMatrixWorld.call(this,a)};Wf.prototype=Object.create(Nb.prototype);Wf.prototype.constructor=Wf;Wf.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};Wf.prototype.update=function(){void 0!==this.color? this.material.color.set(this.color):this.material.color.copy(this.light.color)};Xf.prototype=Object.create(dc.prototype);Xf.prototype.constructor=Xf;Xf.prototype.update=function(){this.scale.set(.5*this.light.width,.5*this.light.height,1);if(void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var a=this.material.color,d=Math.max(a.r,a.g,a.b);1<d&&a.multiplyScalar(1/ d);this.children[0].material.color.copy(this.material.color)}};Xf.prototype.dispose=function(){this.geometry.dispose();this.material.dispose();this.children[0].geometry.dispose();this.children[0].material.dispose()};var js=new k,ao=new J,bo=new J;Yf.prototype=Object.create(y.prototype);Yf.prototype.constructor=Yf;Yf.prototype.dispose=function(){this.children[0].geometry.dispose();this.children[0].material.dispose()};Yf.prototype.update=function(){var a=this.children[0];if(void 0!==this.color)this.material.color.set(this.color); else{var d=a.geometry.getAttribute("color");ao.copy(this.light.color);bo.copy(this.light.groundColor);for(var f=0,h=d.count;f<h;f++){var r=f<h/2?ao:bo;d.setXYZ(f,r.r,r.g,r.b)}d.needsUpdate=!0}a.lookAt(js.setFromMatrixPosition(this.light.matrixWorld).negate())};Zf.prototype=Object.create(Nb.prototype);Zf.prototype.constructor=Zf;Zf.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};Zf.prototype.onBeforeRender=function(){this.position.copy(this.lightProbe.position);this.scale.set(1, 1,1).multiplyScalar(this.size);this.material.uniforms.intensity.value=this.lightProbe.intensity};Ji.prototype=Object.assign(Object.create(Eb.prototype),{constructor:Ji,copy:function(a){Eb.prototype.copy.call(this,a);this.geometry.copy(a.geometry);this.material.copy(a.material);return this},clone:function(){return(new this.constructor).copy(this)}});Ki.prototype=Object.create(Eb.prototype);Ki.prototype.constructor=Ki;$f.prototype=Object.create(dc.prototype);$f.prototype.constructor=$f;$f.prototype.update= function(){function a(S,X,W,ja){W=(X-S)/W;R.setXYZ(C,0,0,0);G++;for(K=S;K<X;K+=W)L=C+G,R.setXYZ(L,Math.sin(K)*f,0,Math.cos(K)*f),R.setXYZ(L+1,Math.sin(Math.min(K+W,X))*f,0,Math.cos(Math.min(K+W,X))*f),R.setXYZ(L+2,0,0,0),G+=3;M.addGroup(C,G,ja);C+=G;G=0}var d=this.audio,f=this.range,h=this.divisionsInnerAngle,r=this.divisionsOuterAngle,u=bb.degToRad(d.panner.coneInnerAngle);d=bb.degToRad(d.panner.coneOuterAngle);var w=u/2,B=d/2,C=0,G=0,K,L,M=this.geometry,R=M.attributes.position;M.clearGroups();a(-B, -w,r,0);a(-w,w,h,1);a(w,B,r,0);R.needsUpdate=!0;u===d&&(this.material[0].visible=!1)};$f.prototype.dispose=function(){this.geometry.dispose();this.material[0].dispose();this.material[1].dispose()};var Fh=new k,hj=new k,co=new q;th.prototype=Object.create(Eb.prototype);th.prototype.constructor=th;th.prototype.update=function(){this.object.updateMatrixWorld(!0);co.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,d=this.geometry.attributes.position,f=this.object.geometry,h=f.vertices; f=f.faces;for(var r=0,u=0,w=f.length;u<w;u++){var B=f[u],C=B.normal;Fh.copy(h[B.a]).add(h[B.b]).add(h[B.c]).divideScalar(3).applyMatrix4(a);hj.copy(C).applyMatrix3(co).normalize().multiplyScalar(this.size).add(Fh);d.setXYZ(r,Fh.x,Fh.y,Fh.z);r+=1;d.setXYZ(r,hj.x,hj.y,hj.z);r+=1}d.needsUpdate=!0};var eo=new k,ij=new k,fo=new k;ag.prototype=Object.create(y.prototype);ag.prototype.constructor=ag;ag.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose(); this.targetLine.material.dispose()};ag.prototype.update=function(){eo.setFromMatrixPosition(this.light.matrixWorld);ij.setFromMatrixPosition(this.light.target.matrixWorld);fo.subVectors(ij,eo);this.lightPlane.lookAt(ij);void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color));this.targetLine.lookAt(ij);this.targetLine.scale.z=fo.length()}; var Li=new k,Rb=new $b;uh.prototype=Object.create(Eb.prototype);uh.prototype.constructor=uh;uh.prototype.update=function(){var a=this.geometry,d=this.pointMap;Rb.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);Vb("c",d,a,Rb,0,0,-1);Vb("t",d,a,Rb,0,0,1);Vb("n1",d,a,Rb,-1,-1,-1);Vb("n2",d,a,Rb,1,-1,-1);Vb("n3",d,a,Rb,-1,1,-1);Vb("n4",d,a,Rb,1,1,-1);Vb("f1",d,a,Rb,-1,-1,1);Vb("f2",d,a,Rb,1,-1,1);Vb("f3",d,a,Rb,-1,1,1);Vb("f4",d,a,Rb,1,1,1);Vb("u1",d,a,Rb,.7,1.1,-1);Vb("u2",d,a,Rb,-.7, 1.1,-1);Vb("u3",d,a,Rb,0,2,-1);Vb("cf1",d,a,Rb,-1,0,1);Vb("cf2",d,a,Rb,1,0,1);Vb("cf3",d,a,Rb,0,-1,1);Vb("cf4",d,a,Rb,0,1,1);Vb("cn1",d,a,Rb,-1,0,-1);Vb("cn2",d,a,Rb,1,0,-1);Vb("cn3",d,a,Rb,0,-1,-1);Vb("cn4",d,a,Rb,0,1,-1);a.getAttribute("position").needsUpdate=!0};var jj=new A;Hd.prototype=Object.create(Eb.prototype);Hd.prototype.constructor=Hd;Hd.prototype.update=function(a){void 0!==a&&console.warn("THREE.BoxHelper: .update() has no longer arguments.");void 0!==this.object&&jj.setFromObject(this.object); if(!jj.isEmpty()){a=jj.min;var d=jj.max,f=this.geometry.attributes.position,h=f.array;h[0]=d.x;h[1]=d.y;h[2]=d.z;h[3]=a.x;h[4]=d.y;h[5]=d.z;h[6]=a.x;h[7]=a.y;h[8]=d.z;h[9]=d.x;h[10]=a.y;h[11]=d.z;h[12]=d.x;h[13]=d.y;h[14]=a.z;h[15]=a.x;h[16]=d.y;h[17]=a.z;h[18]=a.x;h[19]=a.y;h[20]=a.z;h[21]=d.x;h[22]=a.y;h[23]=a.z;f.needsUpdate=!0;this.geometry.computeBoundingSphere()}};Hd.prototype.setFromObject=function(a){this.object=a;this.update();return this};Hd.prototype.copy=function(a){Eb.prototype.copy.call(this, a);this.object=a.object;return this};Hd.prototype.clone=function(){return(new this.constructor).copy(this)};vh.prototype=Object.create(Eb.prototype);vh.prototype.constructor=vh;vh.prototype.updateMatrixWorld=function(a){var d=this.box;d.isEmpty()||(d.getCenter(this.position),d.getSize(this.scale),this.scale.multiplyScalar(.5),y.prototype.updateMatrixWorld.call(this,a))};wh.prototype=Object.create(dc.prototype);wh.prototype.constructor=wh;wh.prototype.updateMatrixWorld=function(a){var d=-this.plane.constant; 1E-8>Math.abs(d)&&(d=1E-8);this.scale.set(.5*this.size,.5*this.size,d);this.children[0].material.side=0>d?1:0;this.lookAt(this.plane.normal);y.prototype.updateMatrixWorld.call(this,a)};var go=new k,Mi,Bk;Id.prototype=Object.create(y.prototype);Id.prototype.constructor=Id;Id.prototype.setDirection=function(a){.99999<a.y?this.quaternion.set(0,0,0,1):-.99999>a.y?this.quaternion.set(1,0,0,0):(go.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(go,Math.acos(a.y)))};Id.prototype.setLength=function(a, d,f){void 0===d&&(d=.2*a);void 0===f&&(f=.2*d);this.line.scale.set(1,Math.max(0,a-d),1);this.line.updateMatrix();this.cone.scale.set(f,d,f);this.cone.position.y=a;this.cone.updateMatrix()};Id.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};Id.prototype.copy=function(a){y.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};Id.prototype.clone=function(){return(new this.constructor).copy(this)};xh.prototype=Object.create(Eb.prototype); xh.prototype.constructor=xh;Ra.create=function(a,d){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(Ra.prototype);a.prototype.constructor=a;a.prototype.getPoint=d;return a};Object.assign(Gd.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var d=new Ua,f=0,h=a.length;f<h;f++){var r=a[f];d.vertices.push(new k(r.x,r.y,r.z||0))}return d}});Object.assign(Yc.prototype,{fromPoints:function(a){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints().");this.setFromPoints(a)}});zn.prototype=Object.create(kc.prototype); An.prototype=Object.create(kc.prototype);Ck.prototype=Object.create(kc.prototype);Object.assign(Ck.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});Ji.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")}; Vf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(vb.prototype,{extractUrlBase:function(a){console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.");return Vk.extractUrlBase(a)}});Object.assign(Fi.prototype,{setTexturePath:function(a){console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().");return this.setResourcePath(a)}});Object.assign(zk.prototype, {center:function(a){console.warn("THREE.Box2: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},size:function(a){console.warn("THREE.Box2: .size() has been renamed to .getSize().");return this.getSize(a)}});Object.assign(A.prototype, {center:function(a){console.warn("THREE.Box3: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionSphere:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}, size:function(a){console.warn("THREE.Box3: .size() has been renamed to .getSize().");return this.getSize(a)}});Ak.prototype.center=function(a){console.warn("THREE.Line3: .center() has been renamed to .getCenter().");return this.getCenter(a)};Object.assign(bb,{random16:function(){console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead.");return Math.random()},nearestPowerOfTwo:function(a){console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."); return bb.floorPowerOfTwo(a)},nextPowerOfTwo:function(a){console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().");return bb.ceilPowerOfTwo(a)}});Object.assign(q.prototype,{flattenToArrayOffset:function(a,d){console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(a,d)},multiplyVector3:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(a){console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(a)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(t.prototype,{extractPosition:function(a){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."); return this.copyPosition(a)},flattenToArrayOffset:function(a,d){console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(a,d)},getPosition:function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return(new k).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."); return this.makeRotationFromQuaternion(a)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")}, rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")}, rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(a){console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(a)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(a,d,f,h,r,u){console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."); return this.makePerspective(a,d,h,f,r,u)}});cc.prototype.isIntersectionLine=function(a){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().");return this.intersectsLine(a)};g.prototype.multiplyVector3=function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)};Object.assign(E.prototype,{isIntersectionBox:function(a){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."); return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().");return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}});Object.assign(F.prototype,{area:function(){console.warn("THREE.Triangle: .area() has been renamed to .getArea().");return this.getArea()},barycoordFromPoint:function(a, d){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return this.getBarycoord(a,d)},midpoint:function(a){console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint().");return this.getMidpoint(a)},normal:function(a){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return this.getNormal(a)},plane:function(a){console.warn("THREE.Triangle: .plane() has been renamed to .getPlane().");return this.getPlane(a)}});Object.assign(F, {barycoordFromPoint:function(a,d,f,h,r){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return F.getBarycoord(a,d,f,h,r)},normal:function(a,d,f,h){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return F.getNormal(a,d,f,h)}});Object.assign(ie.prototype,{extractAllPoints:function(a){console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.");return this.extractPoints(a)},extrude:function(a){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."); return new Fe(this,a)},makeGeometry:function(a){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new Ge(this,a)}});Object.assign(e.prototype,{fromAttribute:function(a,d,f){console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,d,f)},distanceToManhattan:function(a){console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(a)}, lengthManhattan:function(){console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(k.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."); return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,d){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(d,a)},applyProjection:function(a){console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.");return this.applyMatrix4(a)}, fromAttribute:function(a,d,f){console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,d,f)},distanceToManhattan:function(a){console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(a)},lengthManhattan:function(){console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(m.prototype, {fromAttribute:function(a,d,f){console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,d,f)},lengthManhattan:function(){console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(Ua.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}); Object.assign(y.prototype,{getChildByName:function(a){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(a,d){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(d,a)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}); Object.defineProperties(y.prototype,{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=a}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}); Object.defineProperties(Pg.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Object.defineProperty(ii.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});Qg.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(Ra.prototype, "__arcLengthDivisions",{get:function(){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");return this.arcLengthDivisions},set:function(a){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");this.arcLengthDivisions=a}});Ab.prototype.setLens=function(a,d){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==d&&(this.filmGauge=d);this.setFocalLength(a)};Object.defineProperties(Gb.prototype, {onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov.");this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."); this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.");this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far.");this.shadow.camera.far=a}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}}, shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias.");this.shadow.bias=a}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.");this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=a}}});Object.defineProperties(da.prototype, {length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead.");return this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}});Object.assign(Ba.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},addDrawCall:function(a,d,f){void 0!==f&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."); console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(a,d)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().");this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(Ba.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."); return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups.");return this.groups}}});Object.assign(pd.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(Ii.prototype, {dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.");return this}}});Object.defineProperties(T.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")}, set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){console.warn("THREE.Material: .wrapRGB has been removed.");return new J}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(a){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.");this.flatShading=1===a}}});Object.defineProperties(Tc.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."); return!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Ub.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");return this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=a}}});Object.assign(Tj.prototype, {clearTarget:function(a,d,f,h){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.");this.setRenderTarget(a);this.clear(d,f,h)},animate:function(a){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop().");this.setAnimationLoop(a)},getCurrentRenderTarget:function(){console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().");return this.getRenderTarget()},getMaxAnisotropy:function(){console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."); return this.capabilities.getMaxAnisotropy()},getPrecision:function(){console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.");return this.capabilities.precision},resetGLState:function(){console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset().");return this.state.reset()},supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return this.extensions.get("OES_texture_float")}, supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."); return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."); return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(a)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}, addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")}, setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().");return this.getActiveMipmapLevel()}});Object.defineProperties(Tj.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type}, set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");this.shadowMap.type=a}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.");return this.getContext()}}}); Object.defineProperties(Vm.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}}, renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(jc.prototype,{activeCubeFace:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}}, activeMipMapLevel:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}});Object.defineProperties(p.prototype,{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");this.texture.wrapS=a}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."); return this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=a}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");return this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=a}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter}, set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=a}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");return this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset}, set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=a}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat},set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=a}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");return this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."); this.texture.format=a}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");this.texture.type=a}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."); this.texture.generateMipmaps=a}}});Object.defineProperties(Sj.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}});Tf.prototype.load=function(a){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var d=this;(new Gi).load(a,function(f){d.setBuffer(f)});return this};uk.prototype.getData=function(){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."); return this.getFrequencyData()};wc.prototype.updateCubeMap=function(a,d){console.warn("THREE.CubeCamera: .updateCubeMap() is now .update().");return this.update(a,d)};je.crossOrigin=void 0;je.loadTexture=function(a,d,f,h){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new si;r.setCrossOrigin(this.crossOrigin);a=r.load(a,f,void 0,h);d&&(a.mapping=d);return a};je.loadTextureCube=function(a,d,f,h){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead."); var r=new ri;r.setCrossOrigin(this.crossOrigin);a=r.load(a,f,void 0,h);d&&(a.mapping=d);return a};je.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};je.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};b.ACESFilmicToneMapping=5;b.AddEquation=100;b.AddOperation=2;b.AdditiveBlending=2;b.AlphaFormat=1021;b.AlwaysDepth= 1;b.AlwaysStencilFunc=519;b.AmbientLight=zi;b.AmbientLightProbe=pk;b.AnimationClip=Ic;b.AnimationLoader=gk;b.AnimationMixer=wk;b.AnimationObjectGroup=sn;b.AnimationUtils=ac;b.ArcCurve=Sf;b.ArrayCamera=Kg;b.ArrowHelper=Id;b.Audio=Tf;b.AudioAnalyser=uk;b.AudioContext=sk;b.AudioListener=rk;b.AudioLoader=Gi;b.AxesHelper=xh;b.AxisHelper=function(a){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper.");return new xh(a)};b.BackSide=1;b.BasicDepthPacking=3200;b.BasicShadowMap=0;b.BinaryTextureLoader= function(a){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.");return new qi(a)};b.Bone=Zj;b.BooleanKeyframeTrack=mi;b.BoundingBoxHelper=function(a,d){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.");return new Hd(a,d)};b.Box2=zk;b.Box3=A;b.Box3Helper=vh;b.BoxBufferGeometry=Qb;b.BoxGeometry=Cb;b.BoxHelper=Hd;b.BufferAttribute=da;b.BufferGeometry=Ba;b.BufferGeometryLoader=Ei;b.ByteType=1010;b.Cache=Ue;b.Camera=$b;b.CameraHelper= uh;b.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")};b.CanvasTexture=Rg;b.CatmullRomCurve3=kc;b.CineonToneMapping=4;b.CircleBufferGeometry=Nf;b.CircleGeometry=lh;b.ClampToEdgeWrapping=1001;b.Clock=qk;b.ClosedSplineCurve3=zn;b.Color=J;b.ColorKeyframeTrack=ni;b.CompressedTexture=Af;b.CompressedTextureLoader=hk;b.ConeBufferGeometry=kh;b.ConeGeometry=jh;b.CubeCamera=wc;b.CubeGeometry=Cb;b.CubeReflectionMapping=301;b.CubeRefractionMapping=302;b.CubeTexture=Cd;b.CubeTextureLoader= ri;b.CubeUVReflectionMapping=306;b.CubeUVRefractionMapping=307;b.CubicBezierCurve=Uc;b.CubicBezierCurve3=rd;b.CubicInterpolant=ki;b.CullFaceBack=1;b.CullFaceFront=2;b.CullFaceFrontBack=3;b.CullFaceNone=0;b.Curve=Ra;b.CurvePath=Gd;b.CustomBlending=5;b.CylinderBufferGeometry=Fd;b.CylinderGeometry=Ie;b.Cylindrical=xn;b.DataTexture=mc;b.DataTexture2DArray=nf;b.DataTexture3D=of;b.DataTextureLoader=qi;b.DecrementStencilOp=7683;b.DecrementWrapStencilOp=34056;b.DefaultLoadingManager=on;b.DepthFormat=1026; b.DepthStencilFormat=1027;b.DepthTexture=Sg;b.DirectionalLight=yi;b.DirectionalLightHelper=ag;b.DirectionalLightShadow=xi;b.DiscreteInterpolant=li;b.DodecahedronBufferGeometry=Ff;b.DodecahedronGeometry=Yg;b.DoubleSide=2;b.DstAlphaFactor=206;b.DstColorFactor=208;b.DynamicBufferAttribute=function(a,d){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.");return(new da(a,d)).setDynamic(!0)};b.EdgesGeometry=Mf;b.EdgesHelper=function(a, d){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.");return new Eb(new Mf(a.geometry),new Bb({color:void 0!==d?d:16777215}))};b.EllipseCurve=Ac;b.EqualDepth=4;b.EqualStencilFunc=514;b.EquirectangularReflectionMapping=303;b.EquirectangularRefractionMapping=304;b.Euler=v;b.EventDispatcher=c;b.ExtrudeBufferGeometry=pd;b.ExtrudeGeometry=Fe;b.Face3=V;b.Face4=function(a,d,f,h,r,u,w){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new V(a, d,f,r,u,w)};b.FaceColors=1;b.FaceNormalsHelper=th;b.FileLoader=Jc;b.FlatShading=1;b.Float32Attribute=function(a,d){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.");return new pa(a,d)};b.Float32BufferAttribute=pa;b.Float64Attribute=function(a,d){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.");return new tb(a,d)};b.Float64BufferAttribute=tb;b.FloatType=1015;b.Fog=gi;b.FogExp2=fi;b.Font=mk; b.FontLoader=nk;b.FrontFaceDirectionCCW=1;b.FrontFaceDirectionCW=0;b.FrontSide=0;b.Frustum=Gc;b.GammaEncoding=3007;b.Geometry=Ua;b.GeometryUtils={merge:function(a,d,f){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");if(d.isMesh){d.matrixAutoUpdate&&d.updateMatrix();var h=d.matrix;d=d.geometry}a.merge(d,h,f)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."); return a.center()}};b.GreaterDepth=6;b.GreaterEqualDepth=5;b.GreaterEqualStencilFunc=518;b.GreaterStencilFunc=516;b.GridHelper=Ji;b.Group=qf;b.HalfFloatType=1016;b.HemisphereLight=ti;b.HemisphereLightHelper=Yf;b.HemisphereLightProbe=ok;b.IcosahedronBufferGeometry=Ef;b.IcosahedronGeometry=Xg;b.ImageBitmapLoader=kk;b.ImageLoader=Rf;b.ImageUtils=je;b.ImmediateRenderObject=rh;b.IncrementStencilOp=7682;b.IncrementWrapStencilOp=34055;b.InstancedBufferAttribute=Di;b.InstancedBufferGeometry=Ci;b.InstancedInterleavedBuffer= xk;b.Int16Attribute=function(a,d){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.");return new ya(a,d)};b.Int16BufferAttribute=ya;b.Int32Attribute=function(a,d){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.");return new Ja(a,d)};b.Int32BufferAttribute=Ja;b.Int8Attribute=function(a,d){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.");return new va(a, d)};b.Int8BufferAttribute=va;b.IntType=1013;b.InterleavedBuffer=Be;b.InterleavedBufferAttribute=Mg;b.Interpolant=zc;b.InterpolateDiscrete=2300;b.InterpolateLinear=2301;b.InterpolateSmooth=2302;b.InvertStencilOp=5386;b.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")};b.KeepStencilOp=7680;b.KeyframeTrack=fc;b.LOD=Pg;b.LatheBufferGeometry=Lf;b.LatheGeometry=ih;b.Layers=x;b.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")}; b.LessDepth=2;b.LessEqualDepth=3;b.LessEqualStencilFunc=515;b.LessStencilFunc=513;b.Light=Gb;b.LightProbe=Zc;b.LightProbeHelper=Zf;b.LightShadow=td;b.Line=dc;b.Line3=Ak;b.LineBasicMaterial=Bb;b.LineCurve=uc;b.LineCurve3=Vc;b.LineDashedMaterial=Pe;b.LineLoop=ji;b.LinePieces=1;b.LineSegments=Eb;b.LineStrip=0;b.LinearEncoding=3E3;b.LinearFilter=1006;b.LinearInterpolant=mh;b.LinearMipMapLinearFilter=1008;b.LinearMipMapNearestFilter=1007;b.LinearMipmapLinearFilter=1008;b.LinearMipmapNearestFilter=1007; b.LinearToneMapping=1;b.Loader=vb;b.LoaderUtils=Vk;b.LoadingManager=fk;b.LogLuvEncoding=3003;b.LoopOnce=2200;b.LoopPingPong=2202;b.LoopRepeat=2201;b.LuminanceAlphaFormat=1025;b.LuminanceFormat=1024;b.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};b.Material=T;b.MaterialLoader=Bi;b.Math=bb;b.Matrix3=q;b.Matrix4=t;b.MaxEquation=104;b.Mesh=Nb;b.MeshBasicMaterial=aa;b.MeshDepthMaterial=be;b.MeshDistanceMaterial=ce;b.MeshFaceMaterial=function(a){console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."); return a};b.MeshLambertMaterial=Ne;b.MeshMatcapMaterial=Oe;b.MeshNormalMaterial=Me;b.MeshPhongMaterial=Tc;b.MeshPhysicalMaterial=Ke;b.MeshStandardMaterial=qd;b.MeshToonMaterial=Le;b.MinEquation=103;b.MirroredRepeatWrapping=1002;b.MixOperation=1;b.MultiMaterial=function(a){void 0===a&&(a=[]);console.warn("THREE.MultiMaterial has been removed. Use an Array instead.");a.isMultiMaterial=!0;a.materials=a;a.clone=function(){return a.slice()};return a};b.MultiplyBlending=4;b.MultiplyOperation=0;b.NearestFilter= 1003;b.NearestMipMapLinearFilter=1005;b.NearestMipMapNearestFilter=1004;b.NearestMipmapLinearFilter=1005;b.NearestMipmapNearestFilter=1004;b.NeverDepth=0;b.NeverStencilFunc=512;b.NoBlending=0;b.NoColors=0;b.NoToneMapping=0;b.NormalBlending=1;b.NotEqualDepth=7;b.NotEqualStencilFunc=517;b.NumberKeyframeTrack=Pf;b.Object3D=y;b.ObjectLoader=Fi;b.ObjectSpaceNormalMap=1;b.OctahedronBufferGeometry=Ce;b.OctahedronGeometry=Wg;b.OneFactor=201;b.OneMinusDstAlphaFactor=207;b.OneMinusDstColorFactor=209;b.OneMinusSrcAlphaFactor= 205;b.OneMinusSrcColorFactor=203;b.OrthographicCamera=qh;b.PCFShadowMap=1;b.PCFSoftShadowMap=2;b.ParametricBufferGeometry=Cf;b.ParametricGeometry=Tg;b.Particle=function(a){console.warn("THREE.Particle has been renamed to THREE.Sprite.");return new Ng(a)};b.ParticleBasicMaterial=function(a){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.");return new Sc(a)};b.ParticleSystem=function(a,d){console.warn("THREE.ParticleSystem has been renamed to THREE.Points.");return new zf(a, d)};b.ParticleSystemMaterial=function(a){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.");return new Sc(a)};b.Path=Yc;b.PerspectiveCamera=Ab;b.Plane=cc;b.PlaneBufferGeometry=jd;b.PlaneGeometry=Yd;b.PlaneHelper=wh;b.PointCloud=function(a,d){console.warn("THREE.PointCloud has been renamed to THREE.Points.");return new zf(a,d)};b.PointCloudMaterial=function(a){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.");return new Sc(a)};b.PointLight= wi;b.PointLightHelper=Wf;b.Points=zf;b.PointsMaterial=Sc;b.PolarGridHelper=Ki;b.PolyhedronBufferGeometry=tc;b.PolyhedronGeometry=Ug;b.PositionalAudio=tk;b.PositionalAudioHelper=$f;b.PropertyBinding=lc;b.PropertyMixer=vk;b.QuadraticBezierCurve=Wc;b.QuadraticBezierCurve3=sd;b.Quaternion=g;b.QuaternionKeyframeTrack=nh;b.QuaternionLinearInterpolant=oi;b.REVISION="108";b.RGBADepthPacking=3201;b.RGBAFormat=1023;b.RGBA_ASTC_10x10_Format=37819;b.RGBA_ASTC_10x5_Format=37816;b.RGBA_ASTC_10x6_Format=37817;b.RGBA_ASTC_10x8_Format= 37818;b.RGBA_ASTC_12x10_Format=37820;b.RGBA_ASTC_12x12_Format=37821;b.RGBA_ASTC_4x4_Format=37808;b.RGBA_ASTC_5x4_Format=37809;b.RGBA_ASTC_5x5_Format=37810;b.RGBA_ASTC_6x5_Format=37811;b.RGBA_ASTC_6x6_Format=37812;b.RGBA_ASTC_8x5_Format=37813;b.RGBA_ASTC_8x6_Format=37814;b.RGBA_ASTC_8x8_Format=37815;b.RGBA_PVRTC_2BPPV1_Format=35843;b.RGBA_PVRTC_4BPPV1_Format=35842;b.RGBA_S3TC_DXT1_Format=33777;b.RGBA_S3TC_DXT3_Format=33778;b.RGBA_S3TC_DXT5_Format=33779;b.RGBDEncoding=3006;b.RGBEEncoding=3002;b.RGBEFormat= 1023;b.RGBFormat=1022;b.RGBM16Encoding=3005;b.RGBM7Encoding=3004;b.RGB_ETC1_Format=36196;b.RGB_PVRTC_2BPPV1_Format=35841;b.RGB_PVRTC_4BPPV1_Format=35840;b.RGB_S3TC_DXT1_Format=33776;b.RawShaderMaterial=Of;b.Ray=E;b.Raycaster=un;b.RectAreaLight=Ai;b.RectAreaLightHelper=Xf;b.RedFormat=1028;b.ReinhardToneMapping=2;b.RepeatWrapping=1E3;b.ReplaceStencilOp=7681;b.ReverseSubtractEquation=102;b.RingBufferGeometry=Kf;b.RingGeometry=hh;b.Scene=z;b.SceneUtils={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}, detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};b.ShaderChunk=mb;b.ShaderLib=kd;b.ShaderMaterial=Ub;b.ShadowMaterial=Je;b.Shape=ie;b.ShapeBufferGeometry=He;b.ShapeGeometry=Ge;b.ShapePath=lk;b.ShapeUtils=Ed;b.ShortType=1011;b.Skeleton=ii;b.SkeletonHelper=Vf;b.SkinnedMesh=Qg;b.SmoothShading=2;b.Sphere=H;b.SphereBufferGeometry=he;b.SphereGeometry= gh;b.Spherical=wn;b.SphericalHarmonics3=Hi;b.SphericalReflectionMapping=305;b.Spline=Ck;b.SplineCurve=Xc;b.SplineCurve3=An;b.SpotLight=vi;b.SpotLightHelper=Uf;b.SpotLightShadow=ui;b.Sprite=Ng;b.SpriteMaterial=ge;b.SrcAlphaFactor=204;b.SrcAlphaSaturateFactor=210;b.SrcColorFactor=202;b.StereoCamera=qn;b.StringKeyframeTrack=pi;b.SubtractEquation=101;b.SubtractiveBlending=3;b.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};b.TangentSpaceNormalMap=0;b.TetrahedronBufferGeometry=Df;b.TetrahedronGeometry= Vg;b.TextBufferGeometry=Jf;b.TextGeometry=fh;b.Texture=l;b.TextureLoader=si;b.TorusBufferGeometry=Hf;b.TorusGeometry=ah;b.TorusKnotBufferGeometry=Gf;b.TorusKnotGeometry=$g;b.Triangle=F;b.TriangleFanDrawMode=2;b.TriangleStripDrawMode=1;b.TrianglesDrawMode=0;b.TubeBufferGeometry=De;b.TubeGeometry=Zg;b.UVMapping=300;b.Uint16Attribute=function(a,d){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.");return new Pa(a,d)};b.Uint16BufferAttribute=Pa;b.Uint32Attribute= function(a,d){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.");return new Oa(a,d)};b.Uint32BufferAttribute=Oa;b.Uint8Attribute=function(a,d){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.");return new Da(a,d)};b.Uint8BufferAttribute=Da;b.Uint8ClampedAttribute=function(a,d){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.");return new na(a, d)};b.Uint8ClampedBufferAttribute=na;b.Uncharted2ToneMapping=3;b.Uniform=Ii;b.UniformsLib=Na;b.UniformsUtils=Sr;b.UnsignedByteType=1009;b.UnsignedInt248Type=1020;b.UnsignedIntType=1014;b.UnsignedShort4444Type=1017;b.UnsignedShort5551Type=1018;b.UnsignedShort565Type=1019;b.UnsignedShortType=1012;b.VSMShadowMap=3;b.Vector2=e;b.Vector3=k;b.Vector4=m;b.VectorKeyframeTrack=Qf;b.Vertex=function(a,d,f){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead.");return new k(a,d,f)};b.VertexColors= 2;b.VertexNormalsHelper=sh;b.VideoTexture=ck;b.WebGLMultisampleRenderTarget=n;b.WebGLRenderTarget=p;b.WebGLRenderTargetCube=jc;b.WebGLRenderer=Tj;b.WebGLUtils=Wm;b.WireframeGeometry=Bf;b.WireframeHelper=function(a,d){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.");return new Eb(new Bf(a.geometry),new Bb({color:void 0!==d?d:16777215}))};b.WrapAroundEnding=2402;b.XHRLoader=function(a){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."); return new Jc(a)};b.ZeroCurvatureEnding=2400;b.ZeroFactor=200;b.ZeroSlopeEnding=2401;b.ZeroStencilOp=0;b.sRGBEncoding=3001;Object.defineProperty(b,"__esModule",{value:!0})}); //# sourceURL=build://tf-imports/OrbitControls.js THREE.OrbitControls=function(b,c){function e(){return 2*Math.PI/60/60*ea.autoRotateSpeed}function g(){return Math.pow(.95,ea.zoomSpeed)}function k(ka){Qb.theta-=ka}function q(ka){Qb.phi-=ka}function l(ka){ea.object.isPerspectiveCamera?Fc/=ka:ea.object.isOrthographicCamera?(ea.object.zoom=Math.max(ea.minZoom,Math.min(ea.maxZoom,ea.object.zoom*ka)),ea.object.updateProjectionMatrix(),Ub=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),ea.enableZoom= !1)}function m(ka){ea.object.isPerspectiveCamera?Fc*=ka:ea.object.isOrthographicCamera?(ea.object.zoom=Math.max(ea.minZoom,Math.min(ea.maxZoom,ea.object.zoom/ka)),ea.object.updateProjectionMatrix(),Ub=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),ea.enableZoom=!1)}function p(ka){$b.set(ka.clientX,ka.clientY)}function n(ka){Gc.set(ka.clientX,ka.clientY)}function t(ka){jc.set(ka.clientX,ka.clientY)}function v(ka){Ab.set(ka.clientX,ka.clientY); wc.subVectors(Ab,$b).multiplyScalar(ea.rotateSpeed);ka=ea.domElement===document?ea.domElement.body:ea.domElement;k(2*Math.PI*wc.x/ka.clientHeight);q(2*Math.PI*wc.y/ka.clientHeight);$b.copy(Ab);ea.update()}function x(ka){id.set(ka.clientX,ka.clientY);ze.subVectors(id,Gc);0<ze.y?l(g()):0>ze.y&&m(g());Gc.copy(id);ea.update()}function y(ka){mc.set(ka.clientX,ka.clientY);cc.subVectors(mc,jc).multiplyScalar(ea.panSpeed);Zd(cc.x,cc.y);jc.copy(mc);ea.update()}function z(){}function A(ka){0>ka.deltaY?m(g()): 0<ka.deltaY&&l(g());ea.update()}function D(ka){var Ob=!1;switch(ka.keyCode){case ea.keys.UP:Zd(0,ea.keyPanSpeed);Ob=!0;break;case ea.keys.BOTTOM:Zd(0,-ea.keyPanSpeed);Ob=!0;break;case ea.keys.LEFT:Zd(ea.keyPanSpeed,0);Ob=!0;break;case ea.keys.RIGHT:Zd(-ea.keyPanSpeed,0),Ob=!0}Ob&&(ka.preventDefault(),ea.update())}function H(ka){1==ka.touches.length?$b.set(ka.touches[0].pageX,ka.touches[0].pageY):$b.set(.5*(ka.touches[0].pageX+ka.touches[1].pageX),.5*(ka.touches[0].pageY+ka.touches[1].pageY))}function E(ka){1== ka.touches.length?jc.set(ka.touches[0].pageX,ka.touches[0].pageY):jc.set(.5*(ka.touches[0].pageX+ka.touches[1].pageX),.5*(ka.touches[0].pageY+ka.touches[1].pageY))}function F(ka){var Ob=ka.touches[0].pageX-ka.touches[1].pageX;ka=ka.touches[0].pageY-ka.touches[1].pageY;Gc.set(0,Math.sqrt(Ob*Ob+ka*ka))}function J(ka){ea.enableZoom&&F(ka);ea.enablePan&&E(ka)}function O(ka){ea.enableZoom&&F(ka);ea.enableRotate&&H(ka)}function N(ka){1==ka.touches.length?Ab.set(ka.touches[0].pageX,ka.touches[0].pageY): Ab.set(.5*(ka.touches[0].pageX+ka.touches[1].pageX),.5*(ka.touches[0].pageY+ka.touches[1].pageY));wc.subVectors(Ab,$b).multiplyScalar(ea.rotateSpeed);ka=ea.domElement===document?ea.domElement.body:ea.domElement;k(2*Math.PI*wc.x/ka.clientHeight);q(2*Math.PI*wc.y/ka.clientHeight);$b.copy(Ab)}function P(ka){1==ka.touches.length?mc.set(ka.touches[0].pageX,ka.touches[0].pageY):mc.set(.5*(ka.touches[0].pageX+ka.touches[1].pageX),.5*(ka.touches[0].pageY+ka.touches[1].pageY));cc.subVectors(mc,jc).multiplyScalar(ea.panSpeed); Zd(cc.x,cc.y);jc.copy(mc)}function V(ka){var Ob=ka.touches[0].pageX-ka.touches[1].pageX;ka=ka.touches[0].pageY-ka.touches[1].pageY;id.set(0,Math.sqrt(Ob*Ob+ka*ka));ze.set(0,Math.pow(id.y/Gc.y,ea.zoomSpeed));l(ze.y);Gc.copy(id)}function T(ka){ea.enableZoom&&V(ka);ea.enablePan&&P(ka)}function aa(ka){ea.enableZoom&&V(ka);ea.enableRotate&&N(ka)}function da(){}function va(ka){if(!1!==ea.enabled){ka.preventDefault();ea.domElement.focus?ea.domElement.focus():window.focus();switch(ka.button){case 0:switch(ea.mouseButtons.LEFT){case THREE.MOUSE.ROTATE:if(ka.ctrlKey|| ka.metaKey||ka.shiftKey){if(!1===ea.enablePan)return;t(ka);rb=kb.PAN}else{if(!1===ea.enableRotate)return;p(ka);rb=kb.ROTATE}break;case THREE.MOUSE.PAN:if(ka.ctrlKey||ka.metaKey||ka.shiftKey){if(!1===ea.enableRotate)return;p(ka);rb=kb.ROTATE}else{if(!1===ea.enablePan)return;t(ka);rb=kb.PAN}break;default:rb=kb.NONE}break;case 1:switch(ea.mouseButtons.MIDDLE){case THREE.MOUSE.DOLLY:if(!1===ea.enableZoom)return;n(ka);rb=kb.DOLLY;break;default:rb=kb.NONE}break;case 2:switch(ea.mouseButtons.RIGHT){case THREE.MOUSE.ROTATE:if(!1=== ea.enableRotate)return;p(ka);rb=kb.ROTATE;break;case THREE.MOUSE.PAN:if(!1===ea.enablePan)return;t(ka);rb=kb.PAN;break;default:rb=kb.NONE}}rb!==kb.NONE&&(document.addEventListener("mousemove",Da,!1),document.addEventListener("mouseup",na,!1),ea.dispatchEvent(Ba))}}function Da(ka){if(!1!==ea.enabled)switch(ka.preventDefault(),rb){case kb.ROTATE:if(!1===ea.enableRotate)break;v(ka);break;case kb.DOLLY:if(!1===ea.enableZoom)break;x(ka);break;case kb.PAN:!1!==ea.enablePan&&y(ka)}}function na(ka){!1!== ea.enabled&&(z(ka),document.removeEventListener("mousemove",Da,!1),document.removeEventListener("mouseup",na,!1),ea.dispatchEvent(Nb),rb=kb.NONE)}function ya(ka){!1===ea.enabled||!1===ea.enableZoom||rb!==kb.NONE&&rb!==kb.ROTATE||(ka.preventDefault(),ka.stopPropagation(),ea.dispatchEvent(Ba),A(ka),ea.dispatchEvent(Nb))}function Pa(ka){!1!==ea.enabled&&!1!==ea.enableKeys&&!1!==ea.enablePan&&D(ka)}function Ja(ka){if(!1!==ea.enabled){ka.preventDefault();switch(ka.touches.length){case 1:switch(ea.touches.ONE){case THREE.TOUCH.ROTATE:if(!1=== ea.enableRotate)return;H(ka);rb=kb.TOUCH_ROTATE;break;case THREE.TOUCH.PAN:if(!1===ea.enablePan)return;E(ka);rb=kb.TOUCH_PAN;break;default:rb=kb.NONE}break;case 2:switch(ea.touches.TWO){case THREE.TOUCH.DOLLY_PAN:if(!1===ea.enableZoom&&!1===ea.enablePan)return;J(ka);rb=kb.TOUCH_DOLLY_PAN;break;case THREE.TOUCH.DOLLY_ROTATE:if(!1===ea.enableZoom&&!1===ea.enableRotate)return;O(ka);rb=kb.TOUCH_DOLLY_ROTATE;break;default:rb=kb.NONE}break;default:rb=kb.NONE}rb!==kb.NONE&&ea.dispatchEvent(Ba)}}function Oa(ka){if(!1!== ea.enabled)switch(ka.preventDefault(),ka.stopPropagation(),rb){case kb.TOUCH_ROTATE:if(!1===ea.enableRotate)break;N(ka);ea.update();break;case kb.TOUCH_PAN:if(!1===ea.enablePan)break;P(ka);ea.update();break;case kb.TOUCH_DOLLY_PAN:if(!1===ea.enableZoom&&!1===ea.enablePan)break;T(ka);ea.update();break;case kb.TOUCH_DOLLY_ROTATE:if(!1===ea.enableZoom&&!1===ea.enableRotate)break;aa(ka);ea.update();break;default:rb=kb.NONE}}function pa(ka){!1!==ea.enabled&&(da(ka),ea.dispatchEvent(Nb),rb=kb.NONE)}function tb(ka){!1!== ea.enabled&&ka.preventDefault()}this.object=b;this.domElement=void 0!==c?c:document;this.enabled=!0;this.target=new THREE.Vector3;this.minDistance=0;this.maxDistance=Infinity;this.minZoom=0;this.maxZoom=Infinity;this.minPolarAngle=0;this.maxPolarAngle=Math.PI;this.minAzimuthAngle=-Infinity;this.maxAzimuthAngle=Infinity;this.enableDamping=!1;this.dampingFactor=.05;this.enableZoom=!0;this.zoomSpeed=1;this.enableRotate=!0;this.rotateSpeed=1;this.enablePan=!0;this.panSpeed=1;this.screenSpacePanning=!1; this.keyPanSpeed=7;this.autoRotate=!1;this.autoRotateSpeed=2;this.enableKeys=!0;this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};this.mouseButtons={LEFT:THREE.MOUSE.ROTATE,MIDDLE:THREE.MOUSE.DOLLY,RIGHT:THREE.MOUSE.PAN};this.touches={ONE:THREE.TOUCH.ROTATE,TWO:THREE.TOUCH.DOLLY_PAN};this.target0=this.target.clone();this.position0=this.object.position.clone();this.zoom0=this.object.zoom;this.getPolarAngle=function(){return Cb.phi};this.getAzimuthalAngle=function(){return Cb.theta};this.saveState=function(){ea.target0.copy(ea.target); ea.position0.copy(ea.object.position);ea.zoom0=ea.object.zoom};this.reset=function(){ea.target.copy(ea.target0);ea.object.position.copy(ea.position0);ea.object.zoom=ea.zoom0;ea.object.updateProjectionMatrix();ea.dispatchEvent(Xb);ea.update();rb=kb.NONE};this.update=function(){var ka=new THREE.Vector3,Ob=(new THREE.Quaternion).setFromUnitVectors(b.up,new THREE.Vector3(0,1,0)),Oc=Ob.clone().inverse(),Bd=new THREE.Vector3,$d=new THREE.Quaternion;return function(){var $h=ea.object.position;ka.copy($h).sub(ea.target); ka.applyQuaternion(Ob);Cb.setFromVector3(ka);ea.autoRotate&&rb===kb.NONE&&k(e());ea.enableDamping?(Cb.theta+=Qb.theta*ea.dampingFactor,Cb.phi+=Qb.phi*ea.dampingFactor):(Cb.theta+=Qb.theta,Cb.phi+=Qb.phi);Cb.theta=Math.max(ea.minAzimuthAngle,Math.min(ea.maxAzimuthAngle,Cb.theta));Cb.phi=Math.max(ea.minPolarAngle,Math.min(ea.maxPolarAngle,Cb.phi));Cb.makeSafe();Cb.radius*=Fc;Cb.radius=Math.max(ea.minDistance,Math.min(ea.maxDistance,Cb.radius));!0===ea.enableDamping?ea.target.addScaledVector(Tb,ea.dampingFactor): ea.target.add(Tb);ka.setFromSpherical(Cb);ka.applyQuaternion(Oc);$h.copy(ea.target).add(ka);ea.object.lookAt(ea.target);!0===ea.enableDamping?(Qb.theta*=1-ea.dampingFactor,Qb.phi*=1-ea.dampingFactor,Tb.multiplyScalar(1-ea.dampingFactor)):(Qb.set(0,0,0),Tb.set(0,0,0));Fc=1;return Ub||Bd.distanceToSquared(ea.object.position)>Ua||8*(1-$d.dot(ea.object.quaternion))>Ua?(ea.dispatchEvent(Xb),Bd.copy(ea.object.position),$d.copy(ea.object.quaternion),Ub=!1,!0):!1}}();this.dispose=function(){ea.domElement.removeEventListener("contextmenu", tb,!1);ea.domElement.removeEventListener("mousedown",va,!1);ea.domElement.removeEventListener("wheel",ya,!1);ea.domElement.removeEventListener("touchstart",Ja,!1);ea.domElement.removeEventListener("touchend",pa,!1);ea.domElement.removeEventListener("touchmove",Oa,!1);document.removeEventListener("mousemove",Da,!1);document.removeEventListener("mouseup",na,!1);window.removeEventListener("keydown",Pa,!1)};var ea=this,Xb={type:"change"},Ba={type:"start"},Nb={type:"end"},kb={NONE:-1,ROTATE:0,DOLLY:1, PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},rb=kb.NONE,Ua=1E-6,Cb=new THREE.Spherical,Qb=new THREE.Spherical,Fc=1,Tb=new THREE.Vector3,Ub=!1,$b=new THREE.Vector2,Ab=new THREE.Vector2,wc=new THREE.Vector2,jc=new THREE.Vector2,mc=new THREE.Vector2,cc=new THREE.Vector2,Gc=new THREE.Vector2,id=new THREE.Vector2,ze=new THREE.Vector2,Yd=function(){var ka=new THREE.Vector3;return function(Ob,Oc){ka.setFromMatrixColumn(Oc,0);ka.multiplyScalar(-Ob);Tb.add(ka)}}(),jd=function(){var ka= new THREE.Vector3;return function(Ob,Oc){!0===ea.screenSpacePanning?ka.setFromMatrixColumn(Oc,1):(ka.setFromMatrixColumn(Oc,0),ka.crossVectors(ea.object.up,ka));ka.multiplyScalar(Ob);Tb.add(ka)}}(),Zd=function(){var ka=new THREE.Vector3;return function(Ob,Oc){var Bd=ea.domElement===document?ea.domElement.body:ea.domElement;if(ea.object.isPerspectiveCamera){ka.copy(ea.object.position).sub(ea.target);var $d=ka.length();$d*=Math.tan(ea.object.fov/2*Math.PI/180);Yd(2*Ob*$d/Bd.clientHeight,ea.object.matrix); jd(2*Oc*$d/Bd.clientHeight,ea.object.matrix)}else ea.object.isOrthographicCamera?(Yd(Ob*(ea.object.right-ea.object.left)/ea.object.zoom/Bd.clientWidth,ea.object.matrix),jd(Oc*(ea.object.top-ea.object.bottom)/ea.object.zoom/Bd.clientHeight,ea.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),ea.enablePan=!1)}}();ea.domElement.addEventListener("contextmenu",tb,!1);ea.domElement.addEventListener("mousedown",va,!1);ea.domElement.addEventListener("wheel", ya,!1);ea.domElement.addEventListener("touchstart",Ja,!1);ea.domElement.addEventListener("touchend",pa,!1);ea.domElement.addEventListener("touchmove",Oa,!1);window.addEventListener("keydown",Pa,!1);this.update()};THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.OrbitControls.prototype.constructor=THREE.OrbitControls; THREE.MapControls=function(b,c){THREE.OrbitControls.call(this,b,c);this.mouseButtons.LEFT=THREE.MOUSE.PAN;this.mouseButtons.RIGHT=THREE.MOUSE.ROTATE;this.touches.ONE=THREE.TOUCH.PAN;this.touches.TWO=THREE.TOUCH.DOLLY_ROTATE};THREE.MapControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.MapControls.prototype.constructor=THREE.MapControls; //# sourceURL=build://facets-dive/lib/sprite-atlas.js class pp extends THREE.Texture{constructor(b,c,e){const g=Math.ceil(Math.sqrt(b)),k=Math.ceil(b/g),q=document.createElement("canvas");q.width=c*g;q.height=e*k;const l=q.getContext("2d");super(q);this.capacity=b;this.imageWidth=c;this.imageHeight=e;this.spriteColumns=g;this.spriteRows=k;this.canvas=q;this.context=l;this.magFilter=this.minFilter=THREE.LinearFilter;this.drawTimeout=50;this.waitTimeout=1;this.drawQueue=[];this.isDrawQueued=!1;this.lastClearTimestamp=0;this.callbackQueue=[];this.pendingImageCount= 0;this.fitter=new op({x:.125*c,y:.125*e,width:.75*c,height:.75*e})}clearQueues(){this.drawQueue=[];this.callbackQueue=[];this.pendingImageCount=0;return this.lastClearTimestamp=Date.now()}setSpriteImageData(b,c,e){this.drawQueue.push({spriteIndex:b,timestamp:Date.now(),imageData:c,callback:e});this.queueDraw()}setAtlasUrl(b,c,e){const g=this.clearQueues(),k=new Image;void 0!==c&&(k.crossOrigin=c);this.pendingImageCount++;k.onerror=()=>{this.lastClearTimestamp>g||this.pendingImageCount--};k.onload= ()=>{if(!(this.lastClearTimestamp>g)&&(this.pendingImageCount--,this.updatePropertiesToMatchImageDimensions(k.width,k.height),this.context.drawImage(k,0,0,this.canvas.width,this.canvas.height),this.needsUpdate=!0,e&&this.callbackQueue.push({callback:e,args:[k]}),this.onDrawFinished))this.onDrawFinished()};k.src=b}updatePropertiesToMatchImageDimensions(b,c){if(b!==this.imageWidth*this.spriteColumns||c!==this.imageHeight*this.spriteRows){var e=b/this.imageWidth,g=c/this.imageHeight;if(e*g<this.capacity)throw Error("Atlas image too small to accommodate atlas capacity."); if(e!==Math.round(e)||g!==Math.round(g))throw Error("Atlas image dimensions do not fit sprite image dimensions.");this.spriteColumns=e;this.spriteRows=g;this.canvas.width=b;this.canvas.height=c}}postRender(){if(!(this.drawQueue.length||0<this.pendingImageCount))for(;this.callbackQueue.length;){const {callback:b,args:c}=this.callbackQueue.shift();b.apply(null,c)}}queueDraw(){this.isDrawQueued||(this.isDrawQueued=!0,setTimeout(()=>{this.isDrawQueued&&this.workOnDrawJobs()},this.waitTimeout))}workOnDrawJobs(){this.isDrawQueued= !1;const b=Date.now(),c=b+(this.drawTimeout||Infinity);for(;this.drawQueue.length&&Date.now()<c;){const {spriteIndex:p,timestamp:n,imageData:t,image:v,callback:x}=this.drawQueue.shift();if(v){var e=this.imageWidth,g=this.imageHeight,k=p%this.spriteColumns*e,q=g*Math.floor(p/this.spriteColumns);this.context.clearRect(k,q,e,g);this.context.drawImage(v,k,q,e,g);"function"===typeof x&&this.callbackQueue.push({callback:x,args:[p]})}else if(t&&"text"===t.type){e=p%this.spriteColumns*this.imageWidth;g=this.imageHeight* Math.floor(p/this.spriteColumns);var l=e+this.imageWidth/2,m=g+this.imageHeight/2;k=this.fitter.fit(t.data+"");q=this.context;q.clearRect(e,g,this.imageWidth,this.imageHeight);q.save();q.translate(l,m);q.scale(this.imageWidth,this.imageHeight);q.beginPath();q.arc(0,0,.5,0,2*Math.PI);q.restore();q.fillStyle="#555555";q.fill();q.fillStyle="white";q.textBaseline="hanging";q.font=`${t.special?"italic":"bold"} ${k.fontSize}px ${"'Roboto Mono', 'Consolas', 'Menlo', monospace"}`;l=k.lines;for(m=0;m<l.length;m++){const y= l[m];q.fillText(y.text,e+y.x,g+y.y,y.text.length*this.fitter.settings.glyphAspectRatio*k.fontSize)}"function"===typeof x&&this.callbackQueue.push({callback:x,args:[p]})}else if(t){const y=new Image;this.pendingImageCount++;y.onload=()=>{b<this.lastClearTimestamp||(this.pendingImageCount--,this.drawQueue.unshift({spriteIndex:p,timestamp:n,image:y,callback:x}),this.queueDraw())};y.onerror=()=>{b<this.lastClearTimestamp||(this.pendingImageCount--,this.drawQueue.push({spriteIndex:p,timestamp:n,imageData:t, callback:x}),this.queueDraw())};y.src="svg"===t.type?URL.createObjectURL(new Blob([t.data],{type:"image/svg+xml;charset\x3dutf-8"})):`data:${t.type};base64,${t.data}`}}if(this.drawQueue.length||0<this.pendingImageCount)this.queueDraw();else if(this.needsUpdate=!0,this.onDrawFinished)this.onDrawFinished()}}; //# sourceURL=build://facets-dive/lib/sprite-material.js class qp extends THREE.RawShaderMaterial{constructor(b,c){super({vertexShader:"\n\n precision highp float;\n precision highp int;\n\n #define SHADER_NAME SpriteMaterial\n\n // Standard uniforms provided by THREE.js for projecting through the camera.\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform float time;\n\n uniform float spriteColumns;\n uniform float spriteRows;\n\n attribute vec3 position;\n attribute vec3 basePosition;\n\n attribute vec4 color;\n attribute vec4 baseColor;\n\n attribute float opacity;\n attribute float baseOpacity;\n\n attribute float timestamp;\n attribute float baseTimestamp;\n\n attribute float vertexIndex;\n\n attribute float textureIndex;\n attribute float baseTextureIndex;\n\n attribute float textureTimestamp;\n attribute float baseTextureTimestamp;\n\n // Computed UV coordinates into the defaultTexture based on the vertexIndex.\n varying vec2 vDefaultUv;\n\n // Computed UV coordinates into the sprite texture atlas.\n varying vec2 vSpriteUv;\n\n // Interpolated color used by the fragment shader.\n varying vec4 vColor;\n\n // Interpolated opacity used by the fragment shader.\n varying float vOpacity;\n\n // Degree of mixing between base and current texture.\n varying float vTextureMix;\n\n float applyEasing(float t) {\n return t \x3c 0.5 ? 4.0 * t * t * t :\n 4.0 * (t - 1.0) * (t - 1.0) * (t - 1.0) + 1.0;\n }\n\n void main() {\n\n // Compute default UVs. A \x3d\x3e (0,0), B \x3d\x3e (1,0), etc.\n vDefaultUv.x \x3d mod(floor((vertexIndex + 1.0) / 2.0), 2.0);\n vDefaultUv.y \x3d mod(floor(vertexIndex / 2.0), 2.0);\n\n // Determine the row and column indices for this sprite.\n float spriteIndex \x3d floor(vertexIndex / 4.0) + 0.5;\n float columnIndex \x3d floor(mod(spriteIndex, spriteColumns));\n float rowIndex \x3d spriteRows - 1.0 - floor(spriteIndex / spriteColumns);\n\n // Compute sprite UVs from row and column indices.\n vSpriteUv.x \x3d (columnIndex + vDefaultUv.x) / spriteColumns;\n vSpriteUv.y \x3d (rowIndex + vDefaultUv.y) / spriteRows;\n\n float blend \x3d applyEasing(smoothstep(baseTimestamp, timestamp, time));\n\n vTextureMix \x3d mix(baseTextureIndex, textureIndex,\n smoothstep(baseTextureTimestamp, textureTimestamp, time));\n\n vColor \x3d mix(baseColor, color, blend);\n\n vOpacity \x3d mix(baseOpacity, opacity, blend);\n\n gl_Position \x3d projectionMatrix * modelViewMatrix *\n vec4(mix(basePosition, position, vec3(blend)), 1.0);\n\n }\n\n", fragmentShader:"\n\n precision highp float;\n precision highp int;\n\n #define SHADER_NAME SpriteMaterial\n\n // Lightness that should ideally exactly match the vColor.\n #define TARGET_LIGHTNESS 0.6\n\n uniform float time;\n\n uniform sampler2D defaultTexture;\n uniform sampler2D spriteAtlas;\n\n varying vec2 vDefaultUv;\n varying vec2 vSpriteUv;\n varying vec4 vColor;\n varying float vOpacity;\n varying float vTextureMix;\n\n // Compute relative luminance from RGB.\n float rgbToL(vec3 rgb) {\n return dot(rgb, vec3(0.3, 0.59, 0.11));\n }\n\n // Apply luminance easing.\n float easeL(float l) {\n return 1.0 - (1.0 - l) * (1.0 - l) * (1.0 - l);\n }\n\n void main() {\n if (vOpacity \x3c\x3d 0.05) {\n discard;\n }\n\n // Interpolate between default texture and sprite texture.\n vec4 defaultColor \x3d\n vTextureMix \x3c 1.0 ? texture2D(defaultTexture, vDefaultUv) : vec4(0.0);\n vec4 spriteColor \x3d\n vTextureMix \x3e 0.0 ? texture2D(spriteAtlas, vSpriteUv) : vec4(0.0);\n vec4 mixedColor \x3d mix(defaultColor, spriteColor, vTextureMix);\n\n // Lightness of the mixed pixel.\n float mixedL \x3d rgbToL(mixedColor.rgb);\n\n // Using the mixed and target lightness, determine the color that's between\n // black, vColor and white.\n vec3 color \x3d mixedL \x3c TARGET_LIGHTNESS ?\n mix(vec3(0.0), vColor.rgb, easeL(mixedL / TARGET_LIGHTNESS)) :\n mix(vec3(1.0), vColor.rgb,\n easeL((1.0 - mixedL) / (1.0 - TARGET_LIGHTNESS)));\n\n vec3 finalColor \x3d mix(mixedColor.rgb, color, vColor.a);\n\n // Apply opacity.\n gl_FragColor \x3d vec4(finalColor, mixedColor.a * vOpacity);\n }\n", uniforms:{time:{type:"f",value:0},defaultTexture:{type:"t",value:b},spriteAtlas:{type:"t",value:c},spriteColumns:{type:"f",value:c?c.spriteColumns:1},spriteRows:{type:"f",value:c?c.spriteRows:1}},transparent:!0})}get time(){return this.uniforms.time.value}set time(b){this.uniforms.time.value=b}get defaultTexture(){return this.uniforms.defaultTexture.value}set defaultTexture(b){this.uniforms.defaultTexture.value=b}get spriteAtlas(){return this.uniforms.spriteAtlas.value}set spriteAtlas(b){this.uniforms.spriteAtlas.value= b}updateAtlasUniforms(){this.uniforms.spriteColumns.value=this.spriteAtlas.spriteColumns;this.uniforms.spriteRows.value=this.spriteAtlas.spriteRows}applyEasing(b){return.5>b?4*b*b*b:4*(b-1)*(b-1)*(b-1)+1}}; //# sourceURL=build://facets-dive/lib/sprite-mesh.js class rp{constructor(b,c){this._spriteMesh=b;this._spriteIndex=c}get spriteMesh(){return this._spriteMesh}get spriteIndex(){return this._spriteIndex}get x(){return this._spriteMesh.getX(this._spriteIndex)}set x(b){this._spriteMesh.setX(this._spriteIndex,b)}get y(){return this._spriteMesh.getY(this._spriteIndex)}set y(b){this._spriteMesh.setY(this._spriteIndex,b)}get z(){return this._spriteMesh.getZ(this._spriteIndex)}set z(b){this._spriteMesh.setZ(this._spriteIndex,b)}get r(){return this._spriteMesh.getR(this._spriteIndex)}set r(b){this._spriteMesh.setR(this._spriteIndex, b)}get g(){return this._spriteMesh.getG(this._spriteIndex)}set g(b){this._spriteMesh.setG(this._spriteIndex,b)}get b(){return this._spriteMesh.getB(this._spriteIndex)}set b(b){this._spriteMesh.setB(this._spriteIndex,b)}get a(){return this._spriteMesh.getA(this._spriteIndex)}set a(b){this._spriteMesh.setA(this._spriteIndex,b)}get opacity(){return this._spriteMesh.getOpacity(this._spriteIndex)}set opacity(b){this._spriteMesh.setOpacity(this._spriteIndex,b)}get timestamp(){return this._spriteMesh.getTimestamp(this._spriteIndex)}set timestamp(b){this._spriteMesh.setTimestamp(this._spriteIndex, b)}get baseX(){return this._spriteMesh.getBaseX(this._spriteIndex)}set baseX(b){this._spriteMesh.setBaseX(this._spriteIndex,b)}get baseY(){return this._spriteMesh.getBaseY(this._spriteIndex)}set baseY(b){this._spriteMesh.setBaseY(this._spriteIndex,b)}get baseZ(){return this._spriteMesh.getBaseZ(this._spriteIndex)}set baseZ(b){this._spriteMesh.setBaseZ(this._spriteIndex,b)}get baseR(){return this._spriteMesh.getBaseR(this._spriteIndex)}set baseR(b){this._spriteMesh.setBaseR(this._spriteIndex,b)}get baseG(){return this._spriteMesh.getBaseG(this._spriteIndex)}set baseG(b){this._spriteMesh.setBaseG(this._spriteIndex, b)}get baseB(){return this._spriteMesh.getBaseB(this._spriteIndex)}set baseB(b){this._spriteMesh.setBaseB(this._spriteIndex,b)}get baseA(){return this._spriteMesh.getBaseA(this._spriteIndex)}set baseA(b){this._spriteMesh.setBaseA(this._spriteIndex,b)}get baseOpacity(){return this._spriteMesh.getBaseOpacity(this._spriteIndex)}set baseOpacity(b){this._spriteMesh.setBaseOpacity(this._spriteIndex,b)}get baseTimestamp(){return this._spriteMesh.getBaseTimestamp(this._spriteIndex)}set baseTimestamp(b){this._spriteMesh.setBaseTimestamp(this._spriteIndex, b)}get textureIndex(){return this._spriteMesh.getTextureIndex(this._spriteIndex)}set textureIndex(b){this._spriteMesh.setTextureIndex(this._spriteIndex,b)}get baseTextureIndex(){return this._spriteMesh.getBaseTextureIndex(this._spriteIndex)}set baseTextureIndex(b){this._spriteMesh.setBaseTextureIndex(this._spriteIndex,b)}get textureTimestamp(){return this._spriteMesh.getTextureTimestamp(this._spriteIndex)}set textureTimestamp(b){this._spriteMesh.setTextureTimestamp(this._spriteIndex,b)}get baseTextureTimestamp(){return this._spriteMesh.getBaseTextureTimestamp(this._spriteIndex)}set baseTextureTimestamp(b){this._spriteMesh.setBaseTextureTimestamp(this._spriteIndex, b)}rebase(b){this._spriteMesh.rebase(this._spriteIndex,b)}setSpriteImageData(b,c){this._spriteMesh.setSpriteImageData(this._spriteIndex,b,c)}switchTextures(b,c){this._spriteMesh.switchTextures(this._spriteIndex,b,c)}} class sp extends THREE.Mesh{constructor(b,c=32,e=32){super();this.capacity=b;this.imageWidth=c;this.imageHeight=e;this.nextIndex=0;this.spriteWidth=this.imageWidth/this.imageHeight;this.spriteHeight=1;this.geometry=new THREE.BufferGeometry;this.positionData=new Float32Array(12*b);this.positionAttribute=new THREE.BufferAttribute(this.positionData,3);this.positionAttribute.setDynamic(!0);this.geometry.addAttribute("position",this.positionAttribute);this.basePositionData=new Float32Array(12*b);this.basePositionAttribute= new THREE.BufferAttribute(this.basePositionData,3);this.basePositionAttribute.setDynamic(!0);this.geometry.addAttribute("basePosition",this.basePositionAttribute);this.colorData=new Uint8Array(16*b);this.colorAttribute=new THREE.BufferAttribute(this.colorData,4);this.colorAttribute.normalized=!0;this.colorAttribute.setDynamic(!0);this.geometry.addAttribute("color",this.colorAttribute);this.baseColorData=new Uint8Array(16*b);this.baseColorAttribute=new THREE.BufferAttribute(this.baseColorData,4);this.baseColorAttribute.normalized= !0;this.baseColorAttribute.setDynamic(!0);this.geometry.addAttribute("baseColor",this.baseColorAttribute);this.opacityData=new Float32Array(4*b);this.opacityAttribute=new THREE.BufferAttribute(this.opacityData,1);this.opacityAttribute.setDynamic(!0);this.geometry.addAttribute("opacity",this.opacityAttribute);this.baseOpacityData=new Float32Array(4*b);this.baseOpacityAttribute=new THREE.BufferAttribute(this.baseOpacityData,1);this.baseOpacityAttribute.setDynamic(!0);this.geometry.addAttribute("baseOpacity", this.baseOpacityAttribute);this.timestampData=new Float32Array(4*b);this.timestampAttribute=new THREE.BufferAttribute(this.timestampData,1);this.timestampAttribute.setDynamic(!0);this.geometry.addAttribute("timestamp",this.timestampAttribute);this.baseTimestampData=new Float32Array(4*b);this.baseTimestampAttribute=new THREE.BufferAttribute(this.baseTimestampData,1);this.baseTimestampAttribute.setDynamic(!0);this.geometry.addAttribute("baseTimestamp",this.baseTimestampAttribute);this.faceIndexData= new Uint32Array(6*b);for(var g=0;g<b;g++){var k=6*g;const q=4*g;this.faceIndexData[k+0]=q+0;this.faceIndexData[k+1]=q+1;this.faceIndexData[k+2]=q+2;this.faceIndexData[k+3]=q+0;this.faceIndexData[k+4]=q+2;this.faceIndexData[k+5]=q+3}this.faceIndexAttribute=new THREE.BufferAttribute(this.faceIndexData,1);this.geometry.setIndex(this.faceIndexAttribute);this.textureIndexData=new Float32Array(4*b);this.textureIndexAttribute=new THREE.BufferAttribute(this.textureIndexData,1);this.textureIndexAttribute.setDynamic(!0); this.geometry.addAttribute("textureIndex",this.textureIndexAttribute);this.baseTextureIndexData=new Float32Array(4*b);this.baseTextureIndexAttribute=new THREE.BufferAttribute(this.baseTextureIndexData,1);this.baseTextureIndexAttribute.setDynamic(!0);this.geometry.addAttribute("baseTextureIndex",this.baseTextureIndexAttribute);this.textureTimestampData=new Float32Array(4*b);this.textureTimestampAttribute=new THREE.BufferAttribute(this.textureTimestampData,1);this.textureTimestampAttribute.setDynamic(!0); this.geometry.addAttribute("textureTimestamp",this.textureTimestampAttribute);this.baseTextureTimestampData=new Float32Array(4*b);this.baseTextureTimestampAttribute=new THREE.BufferAttribute(this.baseTextureTimestampData,1);this.baseTextureTimestampAttribute.setDynamic(!0);this.geometry.addAttribute("baseTextureTimestamp",this.baseTextureTimestampAttribute);g=4*b;this.vertexIndexData=new Float32Array(g);for(k=0;k<g;k++)this.vertexIndexData[k]=k;this.vertexIndexAttribute=new THREE.BufferAttribute(this.vertexIndexData, 1);this.geometry.addAttribute("vertexIndex",this.vertexIndexAttribute);this.defaultTextureCanvas=this.createDefaultTextureCanvas();this.defaultTexture=new THREE.Texture(this.defaultTextureCanvas);this.defaultTexture.minFilter=THREE.LinearFilter;this.defaultTexture.magFilter=THREE.NearestFilter;this.defaultTexture.needsUpdate=!0;this.spriteAtlas=new pp(b,c,e);this.material=new qp(this.defaultTexture,this.spriteAtlas);this.onBeforeRender=()=>{this.material.updateAtlasUniforms()};this.time=this.constructionTimestamp= Date.now();this.frustumCulled=!1}createSprite(){return new rp(this,this.nextIndex++)}get time(){return this.material.time+this.constructionTimestamp}set time(b){this.material.time=b-this.constructionTimestamp}createDefaultTextureCanvas(){const b=this.defaultTextureCanvas=document.createElement("canvas"),c=b.width=this.imageWidth,e=b.height=this.imageHeight,g=b.getContext("2d"),k=new Image;k.onload=()=>{g.drawImage(k,0,0,c,e);this.defaultTexture.needsUpdate=!0};k.src=URL.createObjectURL(new Blob(['\n\x3csvg version\x3d"1.1"\n baseProfile\x3d"full"\n width\x3d"128" height\x3d"128"\n xmlns\x3d"http://www.w3.org/2000/svg"\n xmlns:xlink\x3d"http://www.w3.org/1999/xlink"\x3e\n \x3cdefs\x3e\n \x3clinearGradient id\x3d"linearGradient3774"\x3e\n \x3cstop\n style\x3d"stop-color:#808080;stop-opacity:1;"\n offset\x3d"0" /\x3e\n \x3cstop\n style\x3d"stop-color:#555555;stop-opacity:1;"\n offset\x3d"1" /\x3e\n \x3c/linearGradient\x3e\n \x3cradialGradient\n xlink:href\x3d"#linearGradient3774"\n id\x3d"radialGradient3780"\n cx\x3d"80"\n cy\x3d"40"\n fx\x3d"80"\n fy\x3d"40"\n r\x3d"80"\n gradientUnits\x3d"userSpaceOnUse"\n spreadMethod\x3d"pad" /\x3e\n \x3c/defs\x3e\n \x3ccircle cx\x3d"50%" cy\x3d"50%" r\x3d"50%" fill\x3d"url(#radialGradient3780)" /\x3e\n\x3c/svg\x3e\n'], {type:"image/svg+xml;charset\x3dutf-8"}));return b}getX(b){return this.positionData[12*b]}setX(b,c){b*=12;this.positionData[b+0]=c;this.positionData[b+3]=c+this.spriteWidth;this.positionData[b+6]=c+this.spriteWidth;this.positionData[b+9]=c;this.positionAttribute.needsUpdate=!0}getY(b){return this.positionData[12*b+1]}setY(b,c){b*=12;this.positionData[b+1]=c;this.positionData[b+4]=c;this.positionData[b+7]=c+this.spriteHeight;this.positionData[b+10]=c+this.spriteHeight;this.positionAttribute.needsUpdate= !0}getZ(b){return this.positionData[12*b+2]}setZ(b,c){b*=12;this.positionData[b+2]=c;this.positionData[b+5]=c;this.positionData[b+8]=c;this.positionData[b+11]=c;this.positionAttribute.needsUpdate=!0}getR(b){return this.colorData[16*b]}setR(b,c){b*=16;this.colorData[b+0]=c;this.colorData[b+4]=c;this.colorData[b+8]=c;this.colorData[b+12]=c;this.colorAttribute.needsUpdate=!0}getG(b){return this.colorData[16*b+1]}setG(b,c){b*=16;this.colorData[b+1]=c;this.colorData[b+5]=c;this.colorData[b+9]=c;this.colorData[b+ 13]=c;this.colorAttribute.needsUpdate=!0}getB(b){return this.colorData[16*b+2]}setB(b,c){b*=16;this.colorData[b+2]=c;this.colorData[b+6]=c;this.colorData[b+10]=c;this.colorData[b+14]=c;this.colorAttribute.needsUpdate=!0}getA(b){return this.colorData[16*b+3]}setA(b,c){b*=16;this.colorData[b+3]=c;this.colorData[b+7]=c;this.colorData[b+11]=c;this.colorData[b+15]=c;this.colorAttribute.needsUpdate=!0}getBaseX(b){return this.basePositionData[12*b]}setBaseX(b,c){b*=12;this.basePositionData[b+0]=c;this.basePositionData[b+ 3]=c+this.spriteWidth;this.basePositionData[b+6]=c+this.spriteWidth;this.basePositionData[b+9]=c;this.basePositionAttribute.needsUpdate=!0}getBaseY(b){return this.basePositionData[12*b+1]}setBaseY(b,c){b*=12;this.basePositionData[b+1]=c;this.basePositionData[b+4]=c;this.basePositionData[b+7]=c+this.spriteHeight;this.basePositionData[b+10]=c+this.spriteHeight;this.basePositionAttribute.needsUpdate=!0}getBaseZ(b){return this.basePositionData[12*b+2]}setBaseZ(b,c){b*=12;this.basePositionData[b+2]=c; this.basePositionData[b+5]=c;this.basePositionData[b+8]=c;this.basePositionData[b+11]=c;this.basePositionAttribute.needsUpdate=!0}getBaseR(b){return this.baseColorData[16*b]}setBaseR(b,c){b*=16;this.baseColorData[b+0]=c;this.baseColorData[b+4]=c;this.baseColorData[b+8]=c;this.baseColorData[b+12]=c;this.baseColorAttribute.needsUpdate=!0}getBaseG(b){return this.baseColorData[16*b+1]}setBaseG(b,c){b*=16;this.baseColorData[b+1]=c;this.baseColorData[b+5]=c;this.baseColorData[b+9]=c;this.baseColorData[b+ 13]=c;this.baseColorAttribute.needsUpdate=!0}getBaseB(b){return this.baseColorData[16*b+2]}setBaseB(b,c){b*=16;this.baseColorData[b+2]=c;this.baseColorData[b+6]=c;this.baseColorData[b+10]=c;this.baseColorData[b+14]=c;this.baseColorAttribute.needsUpdate=!0}getBaseA(b){return this.baseColorData[16*b+3]}setBaseA(b,c){b*=16;this.baseColorData[b+3]=c;this.baseColorData[b+7]=c;this.baseColorData[b+11]=c;this.baseColorData[b+15]=c;this.baseColorAttribute.needsUpdate=!0}getOpacity(b){return this.opacityData[4* b]}setOpacity(b,c){b*=4;this.opacityData[b+0]=c;this.opacityData[b+1]=c;this.opacityData[b+2]=c;this.opacityData[b+3]=c;this.opacityAttribute.needsUpdate=!0}getBaseOpacity(b){return this.baseOpacityData[4*b]}setBaseOpacity(b,c){b*=4;this.baseOpacityData[b+0]=c;this.baseOpacityData[b+1]=c;this.baseOpacityData[b+2]=c;this.baseOpacityData[b+3]=c;this.baseOpacityAttribute.needsUpdate=!0}getTimestamp(b){return this.timestampData[4*b]+this.constructionTimestamp}setTimestamp(b,c){b*=4;c-=this.constructionTimestamp; this.timestampData[b+0]=c;this.timestampData[b+1]=c;this.timestampData[b+2]=c;this.timestampData[b+3]=c;this.timestampAttribute.needsUpdate=!0}getBaseTimestamp(b){return this.baseTimestampData[4*b]+this.constructionTimestamp}setBaseTimestamp(b,c){b*=4;c-=this.constructionTimestamp;this.baseTimestampData[b+0]=c;this.baseTimestampData[b+1]=c;this.baseTimestampData[b+2]=c;this.baseTimestampData[b+3]=c;this.baseTimestampAttribute.needsUpdate=!0}getTextureIndex(b){return this.textureIndexData[4*b]}setTextureIndex(b, c){b*=4;this.textureIndexData[b+0]=c;this.textureIndexData[b+1]=c;this.textureIndexData[b+2]=c;this.textureIndexData[b+3]=c;this.textureIndexAttribute.needsUpdate=!0}getBaseTextureIndex(b){return this.baseTextureIndexData[4*b]}setBaseTextureIndex(b,c){b*=4;this.baseTextureIndexData[b+0]=c;this.baseTextureIndexData[b+1]=c;this.baseTextureIndexData[b+2]=c;this.baseTextureIndexData[b+3]=c;this.baseTextureIndexAttribute.needsUpdate=!0}getTextureTimestamp(b){return this.textureTimestampData[4*b]+this.constructionTimestamp}setTextureTimestamp(b, c){b*=4;c-=this.constructionTimestamp;this.textureTimestampData[b+0]=c;this.textureTimestampData[b+1]=c;this.textureTimestampData[b+2]=c;this.textureTimestampData[b+3]=c;this.textureTimestampAttribute.needsUpdate=!0}getBaseTextureTimestamp(b){return this.baseTextureTimestampData[4*b]+this.constructionTimestamp}setBaseTextureTimestamp(b,c){b*=4;c-=this.constructionTimestamp;this.baseTextureTimestampData[b+0]=c;this.baseTextureTimestampData[b+1]=c;this.baseTextureTimestampData[b+2]=c;this.baseTextureTimestampData[b+ 3]=c;this.baseTextureTimestampAttribute.needsUpdate=!0}rebase(b,c){c=void 0===c?this.time:c;const e=this.getBaseTimestamp(b),g=this.getTimestamp(b),k=c>=g?1:c<=e?0:this.material.applyEasing((c-e)/(g-e)),q=(l,m)=>l*k+m*(1-k);this.setBaseX(b,q(this.getX(b),this.getBaseX(b)));this.setBaseY(b,q(this.getY(b),this.getBaseY(b)));this.setBaseZ(b,q(this.getZ(b),this.getBaseZ(b)));this.setBaseR(b,q(this.getR(b),this.getBaseR(b)));this.setBaseG(b,q(this.getG(b),this.getBaseG(b)));this.setBaseB(b,q(this.getB(b), this.getBaseB(b)));this.setBaseA(b,q(this.getA(b),this.getBaseA(b)));this.setBaseOpacity(b,q(this.getOpacity(b),this.getBaseOpacity(b)));c=c>=g?c:q(g,e);this.setBaseTimestamp(b,c)}setSpriteImageData(b,c,e){this.spriteAtlas.setSpriteImageData(b,c,e)}switchTextures(b,c,e){const g=this.getTextureIndex(b);this.setBaseTextureIndex(b,g);this.setTextureIndex(b,0===g?1:0);this.setBaseTextureTimestamp(b,c);this.setTextureTimestamp(b,e)}findSprites(b,c){const e=[];for(let g=0;g<this.capacity;g++){const k=12* g;b>=this.positionData[k+0]&&b<=this.positionData[k+6]&&c>=this.positionData[k+1]&&c<=this.positionData[k+7]&&e.push(g)}return e}}; //# sourceURL=build://facets-dive/lib/wordtree.js const tp=/\b[-'\w]+\b/g;function up(b){return`${typeof b}\u001F${b}`}function vp(b){return b.toLowerCase().match(tp)||[]} function wp(b){if(2>b.valueCount)return null;for(var c=(k,q)=>{for(let l=0;l<k.length;l++)q[k[l]]=!0},e={},g=b;g;)c(g.commonWords,e),g=g.parent;for(g=0;g<b.children.length;g++)c(b.children[g].commonWords,e);c={};for(const k in b.valueHash){const {count:q,words:l}=b.valueHash[k];for(const m in l)m in e||(c[m]=(c[m]||0)+q,c[m]===b.totalCount&&(b.commonWords.push(m),e[m]=!0,delete c[m]))}b=null;e=0;for(const k in c)c[k]>e&&(b=k,e=c[k]);return b} function xp(b){var c={parent:null,commonWords:[],level:1,order:0,totalCount:0,valueHash:{},valueCount:0,nonValueCount:0,children:[]};const e={root:c,nodeHash:{},highestLevel:1,levelHash:{1:c}};for(var g in b){if(!b.hasOwnProperty(g))continue;const {value:n,count:t,words:v}=b[g];"string"===typeof n?(c.valueHash[g]={value:n,count:t,words:v},c.valueCount+=t):c.nonValueCount+=t;c.totalCount+=t;e.nodeHash[g]=c}b=c.level;if(c.nonValueCount){b++;g={parent:c,commonWords:[],level:b,order:0,totalCount:c.nonValueCount, valueHash:{},valueCount:0,nonValueCount:c.nonValueCount,children:[]};c.nonValueCount=0;c.children.push(g);e.highestLevel=b;e.levelHash[b]=g;for(var k in e.nodeHash)k in c.valueHash||(e.nodeHash[k]=g)}c=[c];for(k=n=>n.valueCount+n.nonValueCount;100>b&&c.length;){g=0;var q=k(c[g]);for(var l=1;l<c.length;l++){const n=k(c[l]);n>q&&(g=l,q=n)}q=c[g];if(l=wp(q)){b++;g={parent:q,commonWords:[l],level:b,order:0,totalCount:0,valueHash:{},valueCount:0,nonValueCount:0,children:[]};q.children.push(g);c.push(g); for(const n in q.valueHash){if(!q.valueHash.hasOwnProperty(n))continue;const {value:t,count:v,words:x}=q.valueHash[n];x&&l in x&&(g.valueHash[n]={value:t,count:v,words:x},g.valueCount+=v,g.totalCount+=v,delete q.valueHash[n],q.valueCount-=v,e.nodeHash[n]=g,e.highestLevel=b,e.levelHash[b]=g)}}else c.splice(g,1)}let m=0;const p=n=>{n.order=++m;for(let t=0;t<n.children.length;t++)p(n.children[t])};p(e.root);return e}; //# sourceURL=build://facets-dive/lib/stats.js function yp(b){if(!b||!b.length)return[];const c={};for(let e=0;e<b.length;e++)if(b[e]){const g=Object.keys(b[e]);for(let k=0;k<g.length;k++)c[g[k]]=!0}return Object.keys(c)}const zp=b=>"number"===typeof b&&b>>0===b; class Ap{constructor(){this.uniqueCount=this.totalCount=0;this.valueHash={};this.otherCount=this.stringCount=this.integerCount=this.numberCount=0;this.stringLengthsCount=this.stringMeanLength=this.stringMaxLength=this.stringMinLength=this.numberMax=this.numberMin=null;this.stringLengthsHash={};this.totalWordCount=this.multiwordCount=0;this.wordCounts={};this.uniqueWordCount=0;this.wordTree=null}isNumeric(){return 0<this.numberCount&&null!==this.numberMin&&null!==this.numberMax&&this.numberMax>this.numberMin}isInteger(){return 0< this.numberCount&&this.integerCount===this.numberCount}addValue(b){this.totalCount++;const c=up(b);c in this.valueHash||(this.valueHash[c]={value:b,count:0},this.uniqueCount++);this.valueHash[c].count++;switch(typeof b){case "number":this.incorporateNumberValue(b);break;case "string":this.incorporateStringValue(c,b);break;default:this.otherCount++}}incorporateNumberValue(b){this.numberCount++;zp(b)&&this.integerCount++;isNaN(b)||(this.numberMin=null===this.numberMin?b:Math.min(this.numberMin,b),this.numberMax= null===this.numberMax?b:Math.max(this.numberMax,b))}incorporateStringValue(b,c){this.stringCount++;var e=c.length;e in this.stringLengthsHash||(this.stringLengthsCount=(this.stringLengthsCount||0)+1);this.stringLengthsHash[e]=(this.stringLengthsHash[e]||0)+1;this.stringMinLength=null===this.stringMinLength?e:Math.min(this.stringMinLength,e);this.stringMaxLength=null===this.stringMaxLength?e:Math.max(this.stringMaxLength,e);this.stringMeanLength=(this.stringMeanLength||0)*(this.stringCount-1)/this.stringCount+ e/this.stringCount;if(!this.valueHash[b].words){c=vp(c.toLowerCase());1<c.length&&(this.multiwordCount++,this.totalWordCount+=c.length);e=this.valueHash[b].words={};for(let g=0;g<c.length;g++){const k=c[g];e[k]=(e[k]||0)+1;k in this.wordCounts||(this.wordCounts[k]=0,this.uniqueWordCount++)}}b=this.valueHash[b].words;for(const g in b)this.wordCounts[g]=(this.wordCounts[g]||0)+1}} function Bp(b){if(!b||!b.length)return{};const c={};for(let e=0;e<b.length;e++){const g=b[e];if(null==g)continue;const k=Object.keys(g);for(let q=0;q<k.length;q++){const l=k[q],m=g[l];l in c||(c[l]=new Ap);c[l].addValue(m)}}for(const e in c)b=c[e],b.multiwordCount&&(b.wordTree=xp(b.valueHash));return c}; //# sourceURL=build://facets-dive/lib/string-format.js function Cp(b){return b.replace(/([\W_])/g,"$1\u200b")}function Dp(b){return 65>b.length?b:b.substr(0,30)+"..."+b.substr(-30)}; //# sourceURL=build://facets-dive/components/facets-dive-vis/facets-dive-vis.js /* Copyright 2018 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ const Ep={bottom:6,left:6,right:6,top:6},Fp={"\ufffcOTHER\ufffc":"other","\ufffcNO_WORDS\ufffc":"non-words","\ufffcALL_WORDS\ufffc":"other"},Gp=b=>null!==b&&b in Fp?{label:Fp[b],special:!0}:"number"!==typeof b&&"string"!==typeof b?{label:""+b,special:!0}:{label:Dp(""+b),special:!1},Hp="#4285F4 #DB4437 #F4B400 #0F9D58 #AB47BC #00ACC1 #FF7043 #9E9D24 #5C6BC0 #F06292 #00796B #C2185B".split(" "),Ip="#4285F4 #0F9D58 #00ACC1 #9E9D24 #5C6BC0 #00796B #607D8B".split(" "),Jp="#DB4437 #F4B400 #AB47BC #F06292 #AB47BC #795548 #FF7043 #C2185B".split(" "), Kp="#4285F4 #C53929 #F7CB4D #0B8043 #5E35B1 #80DEEA #FF7043 #C0CA33".split(" "),Lp={"alignment-baseline":"middle",fill:"#444444","font-size":18,"font-style":"normal","text-anchor":"middle",x:0,y:0};class Mp extends $o{} class Np{constructor(b){this.elem=b;this.endTimestamp=0;this.renderQueued=!1;this.labels=[];this.autoColorBy=!1;this.horizontalFacetInfo=this.verticalFacetInfo=null}ready(){this.layout=new kp;this.holder=this.elem.$.holder;this.elem.scopeSubtree(this.holder,!0);this.cellBackgroundSVG=d3.select(this.holder).append("svg").style("left",0).style("position","absolute").style("top",0);this.cellBackgroundSVGRoot=this.cellBackgroundSVG.append("g").attr("class","root");this.cellBackgroundLayer=this.cellBackgroundSVGRoot.append("g").attr("class", "labels");this.scene=new THREE.Scene;this.camera=new THREE.OrthographicCamera(0,100,0,100,.1,1E3);try{this.renderer=new THREE.WebGLRenderer({alpha:!0}),this.renderer.setPixelRatio(),d3.select(this.renderer.domElement).style("left",0).style("pointer-events","none").style("position","absolute").style("top",0),this.holder.appendChild(this.renderer.domElement)}catch(b){}this.zoom=d3.zoom().scaleExtent([1,500]).on("zoom",this.zoomed.bind(this));d3.select(this.elem).call(this.zoom);this.labelsAndAxesSVG= d3.select(this.holder).append("svg").style("left",0).style("position","absolute").style("top",0);this.labelsAndAxesSVGRoot=this.labelsAndAxesSVG.append("g").attr("class","root");this.labelsLayer=this.labelsAndAxesSVGRoot.append("g").attr("class","labels");this.axesLayer=this.labelsAndAxesSVGRoot.append("g").attr("class","axes");this.comparedLayer=this.labelsAndAxesSVGRoot.append("g").attr("class","comparedboxes");this.selectedLayer=this.labelsAndAxesSVGRoot.append("g").attr("class","selectedboxes"); this.labelsAndAxesSVG.on("click",this.clicked.bind(this));this.renderer||(this.labelsAndAxesSVG.style("display","none"),this.cellBackgroundSVG.style("display","none"),d3.select(this.holder).append("p").attr("class","error").style("color","darkred").html('\n \x3cstrong\x3eERROR\x3c/strong\x3e: Facets Dive requires WebGL, and it is not\n enabled in your browser. See\n \x3ca rel\x3d"noreferrer" href\x3d"http://webglreport.com/"\x3e\n WebGL Report\x3c/a\x3e for details.\n '))}zoomed(){const {x:b, y:c,k:e}=d3.event.transform,g=this.scale/e;this.camera.top*=g;this.camera.left*=g;this.camera.right*=g;this.camera.bottom*=g;this.camera.position.set(-b/e,c/e,this.camera.position.z);this.camera.updateProjectionMatrix();this.scale=e;this.transformSVG();this.updateObjectVisibility();this.queueRenderScene()}clicked(){var b=this.elem.getBoundingClientRect(),c=d3.event;b=this.spriteMesh.findSprites(this.camera.position.x+(c.clientX-b.left)/this.scale,this.camera.position.y-(c.clientY-b.top)/this.scale); var e={};if(c.ctrlKey)for(c=0;c<this.elem.selectedIndices.length;c++)e[this.elem.selectedIndices[c]]=!0;for(c=0;c<b.length;c++)e[b[c]]=!0;this.elem.set("selectedIndices",Array.from(Object.keys(e).map(g=>+g)));b=[];for(e=0;e<this.elem.selectedIndices.length;e++)b.push(this.elem.data[this.elem.selectedIndices[e]]);this.elem.set("selectedData",b)}selectedIndicesUpdated(){this.spriteMesh&&this.updateSelectedBoxes()}comparedIndicesUpdated(){if(this.spriteMesh){var b=[];for(let c=0;c<this.elem.comparedIndices.length;c++)b.push(this.elem.data[this.elem.comparedIndices[c]]); this.elem.set("comparedData",b);this.updateComparedBoxes()}}updateSelectedBoxes(){var b=this.elem.selectedIndices.map(e=>({x:this.spriteMesh.getX(e),y:this.spriteMesh.getY(e)}));b=this.selectedLayer.selectAll(".selected").data(b);var c=b.enter().append("g").classed("selected",!0).attr("transform",e=>`translate(${.5+(e.x||0)},${.5+(e.y||0)}) scale(${3})`).style("opacity",0);c.append("rect").attr("x",-.5).attr("y",-.5).attr("width",1).attr("height",1).attr("stroke","#483d06").attr("stroke-linecap", "round").attr("stroke-linejoin","round").attr("stroke-opacity",0).attr("stroke-width",.3).attr("fill-opacity",0);c.append("rect").attr("x",-.5).attr("y",-.5).attr("width",1).attr("height",1).attr("stroke","#fad411").attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-opacity",0).attr("stroke-width",.15).attr("fill-opacity",0);c=c.merge(b);c.transition().attr("transform",e=>`translate(${.5+(e.x||0)},${.5+(e.y||0)}) scale(${.8})`).style("opacity",1);c.selectAll("rect").classed("rotate", !0).attr("stroke-opacity",1);b.exit().transition().style("opacity",0).remove()}updateComparedBoxes(){var b=this.elem.comparedIndices.map(e=>({x:this.spriteMesh.getX(e),y:this.spriteMesh.getY(e)}));b=this.comparedLayer.selectAll(".compared").data(b);var c=b.enter().append("g").classed("compared",!0).attr("transform",e=>`translate(${.5+(e.x||0)},${.5+(e.y||0)}) scale(${3})`).style("opacity",0);c.append("rect").attr("x",-.5).attr("y",-.5).attr("width",1).attr("height",1).attr("stroke","#44ff44").attr("stroke-linecap", "round").attr("stroke-linejoin","round").attr("stroke-opacity",0).attr("stroke-width",.3).attr("fill-opacity",0);c.append("rect").attr("x",-.5).attr("y",-.5).attr("width",1).attr("height",1).attr("stroke","#1d6b1d").attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-opacity",0).attr("stroke-width",.15).attr("fill-opacity",0);c=c.merge(b);c.transition().attr("transform",e=>`translate(${.5+(e.x||0)},${.5+(e.y||0)}) scale(${.8})`).style("opacity",1);c.selectAll("rect").classed("rotate", !0).attr("stroke-opacity",1);b.exit().transition().style("opacity",0).remove()}fitToViewport(){const b=this.elem.getBoundingClientRect();if(b.width&&b.height){this.layout.viewport.width=b.width;this.layout.viewport.height=b.height;this.layout.padding.bottom=this.elem.scenePadding;this.layout.padding.left=this.elem.scenePadding;this.layout.padding.right=this.elem.scenePadding;this.layout.padding.top=this.elem.scenePadding;this.layout.grid={bottom:0,left:0,right:this.grid.width,top:this.grid.height}; if(this.labels.length){var c=0,e=0,g=0,k=0;this.labelsLayer.selectAll(".label").each(function(m){var p=d3.select(this).select(".current").node().getBoundingClientRect();const n=m.elementMargin||{bottom:0,left:0,right:0,top:0},t=p.height+n.top+n.bottom;p=p.width+n.left+n.right;switch(m.side){case Zo.Bottom:c=Math.max(c,t);break;case Zo.Top:k=Math.max(k,t);break;case Zo.Left:e=Math.max(e,p);break;case Zo.Right:g=Math.max(g,p);break;default:throw Error("Unrecognized Side.");}});this.layout.padding.bottom+= c;this.layout.padding.left+=e;this.layout.padding.right+=g;this.layout.padding.top+=k}this.layout.reducePaddingToFitWidth(b.width);this.layout.reducePaddingToFitHeight(b.height);this.scale=this.layout.computeScale();var {position:q,frustum:l}=this.layout.computeCamera();this.camera.left=l.left;this.camera.right=l.right;this.camera.top=l.top;this.camera.bottom=l.bottom;this.camera.position.set(q.x,q.y,100);this.camera.updateProjectionMatrix();d3.select(this.elem).call(this.zoom.transform,d3.zoomIdentity.scale(this.scale).translate(-this.camera.position.x, this.camera.position.y));this.transformSVG();this.updateObjectVisibility();this.queueRenderScene()}else setTimeout(()=>this.fitToViewport(),100)}zoomIn(){this.zoom.scaleBy(d3.select(this.elem),1.1)}zoomOut(){this.zoom.scaleBy(d3.select(this.elem),1/1.1)}transformSVG(){const b=-this.camera.position.x*this.scale,c=this.camera.position.y*this.scale;this.cellBackgroundSVGRoot.attr("transform",`translate(${b},${c}) scale(${this.scale},${-this.scale})`);this.labelsAndAxesSVGRoot.attr("transform",`translate(${b},${c}) scale(${this.scale},${-this.scale})`); this.labelsAndAxesSVGRoot.selectAll(".unscale").attr("transform",`scale(${1/this.scale})`);this.axesLayer.selectAll(".axis").select("path").attr("d",e=>e.path(this.scale)).attr("stroke-width",e=>e.strokeWidth(this.scale))}isVisible(b,c){return b.shouldBeVisible(c,this.scale,this.camera.position,this.camera)}updateObjectVisibility(){const b=this;var c=this.labelsLayer.selectAll(".label");const e=c.filter(function(k){return(void 0===k.visible||!k.visible)&&b.isVisible(k,this)}).each(k=>k.visible=!0), g=c.filter(function(k){return(void 0===k.visible||k.visible)&&!b.isVisible(k,this)}).each(k=>k.visible=!1);e.selectAll(".opacity").transition().duration(this.elem.tweenDuration).attr("opacity",1);g.selectAll(".opacity").transition().duration(this.elem.tweenDuration).attr("opacity",0);c.filter(k=>!!k.scaleDown).selectAll(".scale").attr("transform",k=>`scale(${this.scale<k.minScale?this.scale/k.minScale:1})`);c=this.axesLayer.selectAll(".axis").each(function(k){k.visible=b.isVisible(k,this)});c.filter(k=> !!k.visible).select("path").transition().duration(this.elem.tweenDuration).attr("stroke-opacity",1);c.filter(k=>!k.visible).select("path").transition().duration(this.elem.tweenDuration).attr("stroke-opacity",0)}addVerticalFacetLabels(b){this.elem.verticalFacet in this.stats&&this.grid.getColumn(this.grid.horizontalKeys[this.grid.horizontalKeys.length-1]).forEach(c=>{const e=this.verticalFacetInfo.labelingFunction(c.verticalKey),g=new Mp;g.text=e.label;g.x=c.x+c.width;g.y=c.contentY+c.innerHeight/ 2;g.side=Zo.Right;g.cell=c;g.attributes={"alignment-baseline":"middle",fill:"#666666","font-size":Lp["font-size"],"text-anchor":"start","font-style":e.special?"italic":"normal"};g.offsetPosition={x:8};g.minScale=Lp["font-size"]/(c.height+this.grid.cellMargin);g.scaleDown=!0;b.push(g)})}addHorizontalFacetLabels(b){this.elem.horizontalFacet in this.stats&&this.grid.getRow(this.grid.verticalKeys[this.grid.verticalKeys.length-1]).forEach(c=>{const e=this.horizontalFacetInfo.labelingFunction(c.horizontalKey), g=new Mp;g.text=e.label;g.x=c.contentX+c.innerWidth/2;g.y=c.y+c.height;g.side=Zo.Top;g.cell=c;g.rotate=-45;g.attributes={"alignment-baseline":"ideographic",fill:"#dd6622","font-size":Lp["font-size"],"text-anchor":"start","font-style":e.special?"italic":"normal"};g.offsetPosition={x:8,y:-8};g.minScale=Lp["font-size"]/(c.width+this.grid.cellMargin/2);g.scaleDown=!0;b.push(g)})}addVerticalPositioningLabels(b){if("scatter"===this.elem.positionMode&&this.elem.verticalPosition in this.stats){var c=this.stats[this.elem.verticalPosition], e=this.formatNumber(c.numberMin),g=this.formatNumber(c.numberMax),k=(e.length+3)/(e.length+g.length+6);this.grid.eachCell(q=>{if(q.items.length){for(var l=q.siblings.left;!(!l||l.items.length||l.siblings.above&&l.siblings.above.items.length);)l=l.siblings.left;l=l?l.contentX+l.innerWidth:-Infinity;var m=q.x+8,p=q.contentY,n=q.contentY+q.innerHeight,t=new Mp;t.id=`${q.compoundKey}-left-start`;t.text=e;t.x=q.x+8;t.y=q.y+(this.elem.horizontalPosition?8:0);t.side=Zo.Left;t.cell=q;t.rotate=-90;t.attributes= {"alignment-baseline":"ideographic",fill:"#2255aa","font-size":16,"text-anchor":"start"};t.offsetPosition={x:Ep.bottom,y:-Ep.right};t.boundingBox={bottom:p,left:l,right:m,top:p+q.innerHeight*(Math.max(k,.1)-.05)};t.elementMargin=Ep;b.push(t);t=new Mp;t.id=`${q.compoundKey}-left-end`;t.text=g;t.x=q.x+8;t.y=q.y+q.height;t.side=Zo.Left;t.cell=q;t.rotate=-90;t.attributes={"alignment-baseline":"ideographic",fill:"#2255aa","font-size":16,"text-anchor":"end"};t.offsetPosition={x:-Ep.top,y:-Ep.right};t.boundingBox= {bottom:p+q.innerHeight*(Math.min(k,.9)+.05),left:l,right:m,top:n};t.elementMargin=Ep;b.push(t)}})}}addHorizontalPositioningLabels(b){if("scatter"===this.elem.positionMode&&this.elem.horizontalPosition in this.stats){var c=this.stats[this.elem.horizontalPosition],e=this.formatNumber(c.numberMin),g=this.formatNumber(c.numberMax),k=(e.length+3)/(e.length+g.length+6);this.grid.eachCell(q=>{if(q.items.length){for(var l=q.siblings.below;!(!l||l.items.length||l.siblings.right&&l.siblings.right.items.length);)l= l.siblings.below;l=l?l.contentY+l.innerHeight:-Infinity;var m=q.contentY,p=q.contentX,n=p+q.innerWidth,t=new Mp;t.id=`${q.compoundKey}-bottom-start`;t.text=e;t.x=q.x+(this.elem.verticalPosition?8:0);t.y=q.y+8;t.side=Zo.Bottom;t.cell=q;t.attributes={"alignment-baseline":"hanging",fill:"#118844","font-size":16,"text-anchor":"start"};t.offsetPosition={x:Ep.left,y:Ep.top};t.boundingBox={bottom:l,left:p,right:p+q.innerWidth*(Math.max(k,.1)-.05),top:m};t.elementMargin=Ep;b.push(t);t=new Mp;t.id=`${q.compoundKey}-bottom-end`; t.text=g;t.x=q.x+q.width;t.y=q.y+8;t.side=Zo.Bottom;t.cell=q;t.attributes={"alignment-baseline":"hanging",fill:"#118844","font-size":16,"text-anchor":"end"};t.offsetPosition={x:-Ep.right,y:Ep.top};t.boundingBox={bottom:l,left:p+q.innerWidth*(Math.min(k,.9)+.05),right:n,top:m};t.elementMargin=Ep;b.push(t)}})}}determineLabels(){const b=[];this.addVerticalFacetLabels(b);this.addHorizontalFacetLabels(b);this.addVerticalPositioningLabels(b);this.addHorizontalPositioningLabels(b);return b}updateCellBackgrounds(){var b= this.grid.getCells().filter(c=>c.items.length);b=this.cellBackgroundLayer.selectAll(".cell").data(b,c=>c.compoundKey);b.enter().append("rect").attr("class","cell").attr("x",c=>c.contentX||0).attr("y",c=>c.contentY||0).attr("width",c=>c.innerWidth||0).attr("height",c=>c.innerHeight||0).attr("fill","#f8f8f9").attr("fill-opacity",0).merge(b).transition().duration(this.elem.tweenDuration).attr("x",c=>c.contentX||0).attr("y",c=>c.contentY||0).attr("width",c=>c.innerWidth||0).attr("height",c=>c.innerHeight|| 0).attr("fill-opacity",1);b.exit().transition().duration(this.elem.tweenDuration).remove().attr("fill-opacity",0)}updateAxes(){const b=[];"stacked"!==this.elem.positionMode&&this.grid.eachCell(g=>{if(g.items.length){if(this.elem.verticalPosition){const k=new jp(Zo.Left,g);b.push(k)}this.elem.horizontalPosition&&(g=new jp(Zo.Bottom,g),b.push(g))}});const c=this.axesLayer.selectAll(".axis").data(b,g=>g.key()),e=c.enter().append("g").attr("class","axis").attr("opacity",0);e.append("path").attr("d",g=> g.path(this.scale)).attr("stroke",g=>g.side===Zo.Left?"#2255aa":"#118844").attr("stroke-width",g=>g.strokeWidth(this.scale)).attr("stroke-opacity",0).attr("fill","none");e.merge(c).transition().duration(this.elem.tweenDuration).attr("opacity",1);e.merge(c).select("path").transition().duration(this.elem.tweenDuration).attr("d",g=>g.path(this.scale));c.exit().transition().duration(this.elem.tweenDuration).remove().attr("opacity",0)}updateLabels(){if(this.scale){this.labels=this.determineLabels();var b= this.labelsLayer.selectAll(".label").data(this.labels,q=>q.id||`${q.side}-${q.text}`);b.each(function(q){const l=d3.select(this),m=l.select(".current");q.text!==m.text()&&(m.attr("fill-opacity",0),l.select(".old").attr("fill-opacity",1).text(m.text()))}).select(".current").text(q=>q.text);var c=q=>l=>void 0===l.attributes||void 0===l.attributes[q]?Lp[q]:l.attributes[q],e=b.enter().append("g").attr("class","label").attr("transform",q=>`translate(${q.x},${q.y})`),g=e.append("g").attr("class","flip").attr("transform", "scale(1,-1)").append("g").attr("class","rotate").attr("transform",q=>"rotate("+("rotate"in q?q.rotate:0)+")").append("g").attr("class","unscale").attr("transform",`scale(${1/this.scale})`).append("g").attr("class","position").append("g").attr("class","opacity scale"),k=g.append("text").attr("class","old").attr("fill-opacity",0);g=g.append("text").attr("class","current").attr("fill-opacity",0).text(q=>q.text);for(const q in Lp)Lp.hasOwnProperty(q)&&(k.attr(q,c(q)),g.attr(q,c(q)));k=e.merge(b).transition().duration(this.elem.tweenDuration).attr("transform", q=>`translate(${q.x},${q.y})`);k.select(".rotate").attr("transform",q=>"rotate("+("rotate"in q?q.rotate:0)+")");k.filter(q=>!!q.offsetPosition).select(".position").attr("transform",q=>`translate(${q.offsetPosition.x||0},${q.offsetPosition.y||0})`);e=k.select(".old").attr("fill-opacity",0);k=k.select(".current").attr("fill-opacity",1);for(const q in Lp)Lp.hasOwnProperty(q)&&(e.attr(q,c(q)),k.attr(q,c(q)));b.exit().transition().duration(this.elem.tweenDuration).remove().select(".current").attr("fill-opacity", 0)}}dataChange(){const b=this.elem.data;if(b&&b.length){this.resizeHandler();this.stats=Bp(b);if(this.items)if(this.items.length!==b.length)this.initializeSpriteMesh(),this.updateImageFieldName();else for(let c=0;c<b.length;c++)this.items[c].data=b[c];else this.initializeSpriteMesh(),this.pickColorByField(),this.pickTextDrawingField();this.updateGridFaceting();this.updateGridItemPositions();this.updateColors()}}initializeSpriteMesh(){this.spriteMesh&&(this.scene.remove(this.spriteMesh),this.spriteMesh.spriteAtlas.clearQueues(), delete this.spriteMesh);const b=this.elem.data,c=b.length;var e=this.elem.spriteImageWidth,g=this.elem.spriteImageHeight;const k=e/g;this.spriteMesh=new sp(c,e,g);this.scene.add(this.spriteMesh);this.spriteMesh.spriteAtlas.onDrawFinished=()=>this.queueRenderScene();this.items=[];e=Math.ceil(Math.sqrt(c));g=Math.ceil(c/e);for(let q=0;q<c;q++){const l=this.spriteMesh.createSprite();l.x=e/2;l.y=g/2;l.opacity=0;l.timestamp=Date.now();l.rebase(l.timestamp);this.items.push({sprite:l,data:b[q]})}this.grid= new ip(this.items);this.grid.cellMargin=1;this.grid.itemAspectRatio=k;this.grid.itemPositionSetter=(q,l,m)=>{const p=Date.now();q.sprite.rebase(p);q.sprite.x=l;q.sprite.y=m;q.sprite.opacity=1;q.sprite.timestamp=p+this.elem.tweenDuration;this.renderUntil(q.sprite.timestamp)}}filteredDataIndicesChange(){const b=this.elem.filteredDataIndices,c=[];if(b)for(var e=0;e<b.length;e++){var g=b[e];g<this.items.length&&(c[g]=!0)}e=[];g=[];const k=Date.now(),q=k+this.elem.tweenDuration;for(let l=0;l<this.items.length;l++){const m= this.items[l];!b||c[l]?(e.push(m.data),g.push(m),m.sprite.opacity||(m.sprite.rebase(k),m.sprite.timestamp=q,m.sprite.opacity=1)):0<m.sprite.opacity&&(m.sprite.rebase(k),m.sprite.timestamp=q,m.sprite.opacity=0)}this.renderUntil(q);this.stats=Bp(e);this.grid.items=g;this.updateGridFaceting();this.updateGridItemPositions()}pickColorByField(){let b=null,c=Infinity;for(const e in this.stats)if(this.stats.hasOwnProperty(e)){const g=this.stats[e],k=Math.abs(g.uniqueCount-Hp.length);1<g.uniqueCount&&k<c&& (b=e,c=k)}isFinite(c)&&b in this.stats&&(this.autoColorBy=!0,this.elem.set("colorBy",b))}pickTextDrawingField(){let b="",c=-Infinity;for(const g in this.stats)if(this.stats.hasOwnProperty(g)){var e=this.stats[g];e=e.stringCount+e.stringLengthsCount-e.totalCount;e>c&&(b=g,c=e)}isFinite(c)&&b in this.stats&&this.elem.set("imageFieldName",b)}queueAtlasUrlChange(){this.atlasUrlChangeTimer&&clearTimeout(this.atlasUrlChangeTimer);this.atlasUrlChangeTimer=setTimeout(()=>{this.atlasUrlChangeTimer&&this.atlasUrlChange()}, 100)}atlasUrlChange(){clearTimeout(this.atlasUrlChangeTimer);delete this.atlasUrlChangeTimer;if(this.spriteMesh){var b=this.elem.atlasUrl;b&&b.length&&b!==this.lastAtlasUrl&&(this.lastAtlasUrl=b,this.resetSpritesToDefaultTexture(),this.spriteMesh.spriteAtlas.setAtlasUrl(b,this.elem.crossOrigin,()=>{const c=this.elem.data,e=Date.now(),g=e+this.elem.fadeDuration;for(let k=0;c&&k<c.length;k++)this.spriteMesh.switchTextures(k,e,g);this.renderUntil(g);this.ignoreChange=!0;this.elem.set("imageFieldName", "");delete this.ignoreChange;this.autoColorBy&&(this.autoColorBy=!1,this.elem.set("colorBy",""))}))}else requestAnimationFrame(this.atlasUrlChange.bind(this))}spriteUrlChange(){const b=this.elem.spriteUrl;if(b)if(this.spriteMesh){const c=new Image;void 0!==this.elem.crossOrigin&&(c.crossOrigin=this.elem.crossOrigin);c.onload=()=>{const e=this.spriteMesh.defaultTextureCanvas,g=e.getContext("2d");g.clearRect(0,0,e.width,e.height);g.drawImage(c,0,0,e.width,e.height);this.spriteMesh.defaultTexture.needsUpdate= !0;this.queueRenderScene()};c.src=b}else requestAnimationFrame(this.spriteUrlChange.bind(this))}updateGridStacking(){"stacked"===this.elem.positionMode&&(this.grid.computeItemPosition=fp(this.elem.verticalFacet?"middle":"bottom",this.elem.horizontalFacet?"middle":"right"))}updateGridFaceting(){if(this.grid){this.updateGridStacking();var b=this.verticalFacetInfo=this.generateFacetingInfo(this.elem.verticalFacet,this.elem.verticalBuckets,this.elem.verticalBagOfWords,!0);this.grid.verticalFacet=b.facetingFunction; this.grid.verticalKeyCompare=b.keyCompareFunction;b=this.horizontalFacetInfo=this.generateFacetingInfo(this.elem.horizontalFacet,this.elem.horizontalBuckets,this.elem.horizontalBagOfWords,!1);this.grid.horizontalFacet=b.facetingFunction;this.grid.horizontalKeyCompare=b.keyCompareFunction;this.elem.fitGridAspectRatioToViewport?(b=this.elem.getBoundingClientRect(),this.grid.targetGridAspectRatio=b&&b.width&&b.height?b.width/b.height||1:1):this.grid.targetGridAspectRatio=1;this.grid.arrange();this.updateCellBackgrounds(); this.updateAxes();this.updateLabels();this.updateSelectedBoxes();this.updateComparedBoxes();this.fitToViewport()}}updateGridItemPositions(){if(this.grid){this.updateGridStacking();var b=this.grid.cellPadding,c=hp.Tight,e=hp.Uniform,g=!1;if("stacked"===this.elem.positionMode)g=this.grid.verticalGridAlignment!==c||this.grid.horizontalGridAlignment!==c,this.grid.verticalGridAlignment=c,this.grid.horizontalGridAlignment=c,this.grid.cellPadding.top=0,this.grid.cellPadding.left=0,this.grid.cellPadding.right= 0,this.grid.cellPadding.bottom=0,this.grid.minCellAspectRatio=0,this.grid.maxCellAspectRatio=Infinity;else{this.elem.verticalPosition?(g=this.grid.verticalGridAlignment!==e,this.grid.verticalGridAlignment=e):(g=this.grid.verticalGridAlignment!==c,this.grid.verticalGridAlignment=c);this.elem.horizontalPosition?(g=g||this.grid.horizontalGridAlignment!==e,this.grid.horizontalGridAlignment=e):(g=g||this.grid.horizontalGridAlignment!==c,this.grid.horizontalGridAlignment=c);const k=this.generatePositionFunction(this.elem.horizontalPosition)|| dp,q=this.generatePositionFunction(this.elem.verticalPosition)||ep;this.grid.computeItemPosition=(l,m,p,n)=>({x:k(l,m,p,n),y:q(l,m,p,n)});c=this.elem.verticalPosition?8:0;e=this.elem.horizontalPosition?8:0;g=g||0!==b.top||c!==b.left||0!==b.right||e!==b.bottom;this.grid.cellPadding.top=0;this.grid.cellPadding.right=0;this.grid.cellPadding.left=c;this.grid.cellPadding.bottom=e;this.grid.minCellAspectRatio=1;this.grid.maxCellAspectRatio=2}g?(this.grid.arrange(),this.updateCellBackgrounds()):this.grid.positionItems(); this.updateAxes();this.updateLabels();this.updateSelectedBoxes();this.updateComparedBoxes();this.fitToViewport()}}getPaletteSource(){switch(this.elem.paletteChoice){case "warm":return Jp;case "cool":return Ip;case "assist":return Kp;default:return Hp}}updateScalarPalette(){const b=this.elem.colorBy,c=this.stats[b];var e=this.grid.items,g=d3.rgb("#A52714"),k=d3.scaleLinear();k.domain([c.numberMin,c.numberMax]).range(["white","#1C3AA9"]);const q=[];for(var l=0;l<e.length;l++){var m=e[l];m=b in m.data? m.data[b]:NaN;m="number"!==typeof m||isNaN(m)?g:d3.rgb(k(m));q.push(m)}e=this.generateFacetingInfo(b,5,!1,!1).labelingFunction;g=d3.scaleLinear();g.domain([0,4]).range(["white","#1C3AA9"]);k=[];for(l=4;0<=l;l--)m=e(l),k.push({key:l,color:g(l),content:m});(c.otherCount||c.stringCount||c.totalCount<this.grid.items.length)&&k.push({key:NaN,color:"#A52714",content:{label:"missing",special:!0}});this.elem.set("palette",k);this.grid.cellItemComparator=(p,n)=>{if(!(b in p.data||b in n.data))return 0;if(!(b in p.data))return-1;if(!(b in n.data))return 1;p=p.data[b];n=n.data[b];if(p===n)return 0;const t="number"!==typeof p||isNaN(p),v="number"!==typeof n||isNaN(n);return t&&v?0:t?-1:v?1:p-n};return q}updateCategoricalPalette(b){const c=this.elem.colorBy,e=this.stats[c],g=this.grid.items,k=Object.keys(e.valueHash);this.elem.stableColors?k.sort():k.sort((v,x)=>e.valueHash[x].count-e.valueHash[v].count);const q=Math.min(b.length,k.length),l=k.slice(0,q).reduce((v,x,y)=>{v[x]=y;return v},{}),m=d3.rgb("#F0F0F0"), p=b.map(v=>d3.rgb(v));let n=!1;const t=[];for(let v=0;v<g.length;v++){const x=up(g[v].data[c]);n=n||!(x in l);t.push(p[l[x]]||m)}b=b.slice(0,q).map((v,x)=>{x=e.valueHash[k[x]].value;return{key:x,color:v,content:{label:x+"",special:"number"!==typeof x&&"string"!==typeof x||x in Fp}}});n&&b.push({key:null,color:"#F0F0F0",content:{label:"other",special:!0}});this.elem.set("palette",b);this.grid.cellItemComparator=(v,x)=>{if(!(c in v.data||c in x.data))return 0;if(!(c in v.data))return 1;if(!(c in x.data))return-1; v=v.data[c];x=x.data[c];if(v===x)return 0;v=up(v);x=up(x);return v in l||x in l?v in l?x in l?l[v]-l[x]:-1:1:0};return t}updateColors(){if(this.grid){var b=this.elem.colorBy;if(b in this.stats){b=this.stats[b];var c=this.getPaletteSource();b=b.uniqueCount>c.length&&b.isNumeric()?this.updateScalarPalette():this.updateCategoricalPalette(c);c=this.grid.items;var e=Date.now(),g=e+this.elem.tweenDuration;for(let k=0;k<c.length;k++){const q=c[k],l=b[k];q.sprite.rebase(e);q.sprite.r=l.r;q.sprite.g=l.g;q.sprite.b= l.b;q.sprite.a=180;q.sprite.timestamp=g}this.renderUntil(g);this.updateGridItemPositionsAfterColorChange()}else this.clearColors()}}updateGridItemPositionsAfterColorChange(){"stacked"!==this.elem.positionMode&&this.elem.verticalPosition&&this.elem.horizontalPosition||this.updateGridItemPositions()}clearColors(){const b=this.grid.items,c=Date.now(),e=c+this.elem.tweenDuration;for(let g=0;g<b.length;g++){const k=b[g];k.sprite.rebase(c);k.sprite.r=0;k.sprite.g=0;k.sprite.b=0;k.sprite.a=0;k.sprite.timestamp= e}this.renderUntil(e);this.elem.set("palette",[]);this.grid.cellItemComparator&&(this.grid.cellItemComparator=null,this.updateGridItemPositionsAfterColorChange())}resetSpritesToDefaultTexture(){const b=this.grid.items;this.spriteMesh.spriteAtlas.clearQueues();const c=Date.now(),e=c+this.elem.fadeDuration;for(let g=0;g<b.length;g++){const k=b[g];0<k.sprite.textureIndex&&k.sprite.switchTextures(c,e)}this.renderUntil(e)}updateImageFieldName(){if(!this.ignoreChange&&this.grid){this.resetSpritesToDefaultTexture(); var b=this.elem.imageFieldName;if(b in this.stats){var c=this.grid.items;for(let e=0;e<c.length;e++){const {sprite:g,data:k}=c[e];g.setSpriteImageData({type:"text",data:Gp(k[b]).label},()=>{const q=Date.now();g.baseTextureTimestamp=q;g.baseTextureIndex=0;g.textureTimestamp=q+this.elem.tweenDuration;g.textureIndex=1;this.renderUntil(g.textureTimestamp)})}}else delete this.lastAtlasUrl,this.queueAtlasUrlChange()}}generatePositionFunction(b){const c=this.stats[b];if(!c||!c.isNumeric())return null;const e= c.numberMax-c.numberMin;return g=>(g.data[b]-c.numberMin)/e}generateFacetingInfo(b,c,e,g){if(!(b in this.stats))return{facetingFunction:()=>null,keyCompareFunction:()=>0,labelingFunction:Gp};const k=this.stats[b];if(k.wordTree&&1<k.wordTree.highestLevel&&e)return this.generateBagOfWordsFacetingInfo(b,c,g);if(k.uniqueCount<=c)return{facetingFunction:l=>b in l.data?l.data[b]:null,keyCompareFunction:k.isNumeric()?cp:g?bp:ap,labelingFunction:Gp};if(k.isNumeric()&&k.numberMax!==k.numberMin)return this.generateNumericFacetingInfo(b, c);e=Object.keys(k.valueHash);e.sort((l,m)=>k.valueHash[m].count-k.valueHash[l].count);const q=e.slice(0,c).reduce((l,m)=>{l[m]=!0;return l},{});return{facetingFunction:l=>{if(!(b in l.data))return null;l=l.data[b];return up(l)in q?l:"\ufffcOTHER\ufffc"},keyCompareFunction:g?bp:ap,labelingFunction:Gp}}generateBagOfWordsFacetingInfo(b,c,e){const g=this.stats[b].wordTree,k=g.levelHash;return{facetingFunction:q=>{if(!(b in q.data))return null;for(q=g.nodeHash[up(q.data[b])];q.parent&&q.level>c;)q=q.parent; return q.level},keyCompareFunction:(q,l)=>{q=k[q];l=k[l];if(void 0===q&&void 0===l)return 0;if(void 0===q)return-1;if(void 0===l)return 1;if(q.nonValueCount&&l.nonValueCount)return 0;if(q.nonValueCount)return-1;if(l.nonValueCount)return 1;l=l.order-q.order;return e?l:-l},labelingFunction:q=>{q=k[+q];if(!q.parent&&!q.commonWords.length)return{label:"other",special:!0};if(q.nonValueCount)return{label:"non-words",special:!0};let l=` ${"\u2022"} ${q.commonWords.join(" ")}`;for(let m=0;m<q.children.length;m++)if(q.children[m].level> c){l+=" \u2026";break}for(;q.parent;)q=q.parent,q.commonWords.length&&(l=` ${"\u2022"} ${q.commonWords.join(" ")} `+l);return{label:l}}}}generateNumericFacetingInfo(b,c){const e=this.stats[b],g=e.numberMax-e.numberMin;return{facetingFunction:k=>{if(!(b in k.data))return null;k=k.data[b];return"number"!==typeof k?k:isNaN(k)?k:Math.min(Math.floor(c*(k-e.numberMin)/g),c-1)},keyCompareFunction:cp,labelingFunction:k=>{if("number"!==typeof k||isNaN(+k))return Gp(k);const q=e.numberMax-e.numberMin,l=k/c* q+e.numberMin;k=(1+k)/c*q+e.numberMin;return e.isInteger()?{label:this.formatRange(Math.ceil(l),Math.floor(k))}:{label:this.formatRange(l,k)}}}}formatNumber(b){if(null===b)return"null";b=parseFloat(b.toPrecision(3));return 1E3<=Math.abs(b)?d3.format("s")(b):""+b}formatRange(b,c){return`${this.formatNumber(b)} \u2014 ${this.formatNumber(c)}`}getKeys(){return yp(this.elem.data).sort()}renderUntil(b){this.endTimestamp=Math.max(this.endTimestamp,b);this.queueRenderScene()}resizeHandler(){const b=this.elem.getBoundingClientRect(); b.width&&b.height?(this.labelsAndAxesSVG.attr("width",b.width).attr("height",b.height),this.cellBackgroundSVG.attr("width",b.width).attr("height",b.height),this.renderer&&this.renderer.setSize(b.width,b.height),this.camera.right=b.width/this.scale,this.camera.bottom=-b.height/this.scale,this.camera.updateProjectionMatrix(),this.queueRenderScene()):requestAnimationFrame(()=>this.resizeHandler())}queueRenderScene(){this.renderQueued||(this.renderQueued=!0,requestAnimationFrame(()=>{this.renderQueued&& this.renderScene()}))}renderScene(){this.renderQueued=!1;const b=Date.now();this.endTimestamp>b&&this.queueRenderScene();if(this.spriteMesh&&(this.spriteMesh.time=b,81>+THREE.REVISION&&this.spriteMesh.onBeforeRender))this.spriteMesh.onBeforeRender();this.renderer&&this.renderer.render(this.scene,this.camera);this.spriteMesh&&this.spriteMesh.spriteAtlas&&this.spriteMesh.spriteAtlas.postRender()}} Polymer({is:"facets-dive-vis",behaviors:[Polymer.IronResizableBehavior],properties:{data:{type:Array,value:null,observer:"_dataChange"},filteredDataIndices:{type:Array,value:null,observer:"_filteredDataIndicesChange"},atlasUrl:{type:String,value:null,observer:"_queueAtlasUrlChange"},spriteUrl:{type:String,value:null,observer:"_spriteUrlChange"},crossOrigin:{type:String,value:null},keys:{type:Array,value:[],notify:!0,readOnly:!0},stats:{type:Object,value:{},notify:!0,readOnly:!0},scenePadding:{type:Number, value:8},tweenDuration:{type:Number,value:600},fadeDuration:{type:Number,value:200},spriteImageWidth:{type:Number,value:64},spriteImageHeight:{type:Number,value:64},gridFacetingVerticalLabelColor:{type:String,value:"#666666"},gridFacetingHorizontalLabelColor:{type:String,value:"#dd6622"},itemPositioningVerticalLabelColor:{type:String,value:"#2255aa"},itemPositioningHorizontalLabelColor:{type:String,value:"#118844"},fitGridAspectRatioToViewport:{type:Boolean,value:!1},verticalFacet:{type:String,value:"", observer:"_updateGridFaceting"},verticalBuckets:{type:Number,value:10,observer:"_updateGridFaceting"},verticalBagOfWords:{type:Boolean,value:!1,observer:"_updateGridFaceting"},horizontalFacet:{type:String,value:"",observer:"_updateGridFaceting"},horizontalBuckets:{type:Number,value:10,observer:"_updateGridFaceting"},horizontalBagOfWords:{type:Boolean,value:!1,observer:"_updateGridFaceting"},positionMode:{type:String,value:"",observer:"_updateGridItemPositions"},verticalPosition:{type:String,value:"", observer:"_updateGridItemPositions"},horizontalPosition:{type:String,value:"",observer:"_updateGridItemPositions"},colorBy:{type:String,value:"",observer:"_updateColors",notify:!0},imageFieldName:{type:String,value:"",observer:"_updateImageFieldName",notify:!0},palette:{type:Array,value:[],notify:!0},paletteChoice:{type:String,value:"standard",observer:"_updateColors"},selectedData:{type:Array,value:[],notify:!0},selectedIndices:{type:Array,value:[],notify:!0,observer:"_selectedIndicesUpdated"},comparedData:{type:Array, value:[],notify:!0},comparedIndices:{type:Array,value:[],notify:!0,observer:"_comparedIndicesUpdated"},stableColors:{type:Boolean,value:!1,observer:"_updateColors"}},listeners:{"iron-resize":"_onIronResize"},created(){this._backing=new Np(this)},ready(){this._backing.ready()},_dataChange(b){this._backing.scene?(this._backing.dataChange(),this._setKeys(this._backing.getKeys()),this._setStats(this._backing.stats)):requestAnimationFrame(this._dataChange.bind(this,b))},_filteredDataIndicesChange(b){this._backing.scene&& this._backing.items?(this._backing.filteredDataIndicesChange(),this._setKeys(this._backing.getKeys()),this._setStats(this._backing.stats)):requestAnimationFrame(this._filteredDataIndicesChange.bind(this,b))},_queueAtlasUrlChange(){this._backing.queueAtlasUrlChange()},_spriteUrlChange(){this._backing.spriteUrlChange()},_updateGridFaceting(){this._backing.updateGridFaceting()},_updateGridItemPositions(){this._backing.updateGridItemPositions()},_updateColors(){this._backing.updateColors()},_updateImageFieldName(){this._backing.updateImageFieldName()}, _onIronResize(){this._backing.resizeHandler()},_selectedIndicesUpdated(){this._backing.selectedIndicesUpdated()},_comparedIndicesUpdated(){this._backing.comparedIndicesUpdated()},fitToViewport(){this._backing.fitToViewport()},zoomIn(){this._backing.zoomIn()},zoomOut(){this._backing.zoomOut()}}); //# sourceURL=build://facets-dive/components/facets-dive-controls/facets-dive-controls.js Polymer({is:"facets-dive-controls",properties:{atlasUrl:{type:String,value:""},keys:{type:Array,value:[]},stats:{type:Object,value:{}},verticalFacet:{type:String,value:"",notify:!0},verticalBuckets:{type:Number,value:10,notify:!0},verticalBagOfWords:{type:Boolean,value:!1,notify:!0},horizontalFacet:{type:String,value:"",notify:!0},horizontalBuckets:{type:Number,value:10,notify:!0},horizontalBagOfWords:{type:Boolean,value:!1,notify:!0},positionMode:{type:String,computed:"_getPositionMode(verticalPosition, horizontalPosition)", notify:!0},verticalPosition:{type:String,value:"",notify:!0},horizontalPosition:{type:String,value:"",notify:!0},colorBy:{type:String,value:"",notify:!0},imageFieldName:{type:String,value:"",notify:!0},palette:{type:Array,value:[]},paletteChoice:{type:String,value:"standard",notify:!0},gridFacetingVerticalLabelColor:{type:String,value:"#666666",observer:"_updateCSSVars"},gridFacetingHorizontalLabelColor:{type:String,value:"#dd6622",observer:"_updateCSSVars"},itemPositioningVerticalLabelColor:{type:String, value:"#2255aa",observer:"_updateCSSVars"},itemPositioningHorizontalLabelColor:{type:String,value:"#118844",observer:"_updateCSSVars"}},_getImageFieldNameDefaultLabel(b){return b?"(image)":"(default)"},_isModeScatter(b){return"scatter"===b},_isKeyNumeric(b){return this.stats&&b in this.stats&&this.stats[b].isNumeric()},_isKeyCategorical(b){return this.stats&&b in this.stats&&!this.stats[b].isNumeric()},_updateCSSVars(){this.updateStyles({"--grid-faceting-vertical-label-color":this.gridFacetingVerticalLabelColor, "--grid-faceting-horizontal-label-color":this.gridFacetingHorizontalLabelColor,"--item-positioning-vertical-label-color":this.itemPositioningVerticalLabelColor,"--item-positioning-horizontal-label-color":this.itemPositioningHorizontalLabelColor})},_breakUpAndTruncate(b){return Cp(Dp(""+b))},_maxBuckets(b,c){const e=this.stats?this.stats[b]:null;return e?c&&this._hasWordTree(b)?Math.min(100,e.wordTree.highestLevel):Math.min(100,e.uniqueCount+1):100},_hasWordTree(b){b=this.stats?this.stats[b]:null; return!!b&&!!b.wordTree&&1<b.wordTree.highestLevel},_getPositionMode(b,c){return""==b&&""==c?"stacked":"scatter"},_openOverflow(){this.$.overflowmenu.positionElement=this.$.overflowbtn;this.$.overflowmenu.open()},_shouldShowOverflowMenu(b,c,e){return this._isKeyCategorical(b)||this._hasWordTree(c)||this._hasWordTree(e)}}); //# sourceURL=build://facets-dive/lib/info-renderers.js const Op=(b,c)=>{const e=document.createElement("dl");for(const k in b)if(b.hasOwnProperty(k)){var g=document.createElement("dt");g.textContent=k;e.appendChild(g);g=document.createElement("dd");g.textContent=b[k];e.appendChild(g)}c.appendChild(e)}; //# sourceURL=build://facets-dive/components/facets-dive-info-card/facets-dive-info-card.js Polymer({is:"facets-dive-info-card",properties:{infoRenderer:{type:Object},selectedData:{type:Array,value:[],observer:"_updateSelected"}},ready(){this.scopeSubtree(this.$.holder,!0)},_updateSelected(b){this.$.holder.innerHTML="";if(b){var c=this.infoRenderer||Op;for(let e=0;e<b.length;e++){const g=b[e],k=document.createElement("div");k.style.width="100%";this.$.holder.appendChild(k);c(g,k)}}}}); //# sourceURL=build://paper-tooltip/paper-tooltip.html.js Polymer({is:"paper-tooltip",hostAttributes:{role:"tooltip",tabindex:-1},properties:{for:{type:String,observer:"_findTarget"},manualMode:{type:Boolean,value:!1,observer:"_manualModeChanged"},position:{type:String,value:"bottom"},fitToVisibleBounds:{type:Boolean,value:!1},offset:{type:Number,value:14},marginTop:{type:Number,value:14},animationDelay:{type:Number,value:500,observer:"_delayChange"},animationEntry:{type:String,value:""},animationExit:{type:String,value:""},animationConfig:{type:Object, value:function(){return{entry:[{name:"fade-in-animation",node:this,timing:{delay:0}}],exit:[{name:"fade-out-animation",node:this}]}}},_showing:{type:Boolean,value:!1}},listeners:{webkitAnimationEnd:"_onAnimationEnd"},get target(){var b=Polymer.dom(this).parentNode,c=Polymer.dom(this).getOwnerRoot();return this.for?Polymer.dom(c).querySelector("#"+this.for):b.nodeType==Node.DOCUMENT_FRAGMENT_NODE?c.host:b},attached:function(){this._findTarget()},detached:function(){this.manualMode||this._removeListeners()}, playAnimation:function(b){"entry"===b?this.show():"exit"===b&&this.hide()},cancelAnimation:function(){this.$.tooltip.classList.add("cancel-animation")},show:function(){if(!this._showing){if(""===Polymer.dom(this).textContent.trim()){for(var b=!0,c=Polymer.dom(this).getEffectiveChildNodes(),e=0;e<c.length;e++)if(""!==c[e].textContent.trim()){b=!1;break}if(b)return}this._showing=!0;this.$.tooltip.classList.remove("hidden");this.$.tooltip.classList.remove("cancel-animation");this.$.tooltip.classList.remove(this._getAnimationType("exit")); this.updatePosition();this._animationPlaying=!0;this.$.tooltip.classList.add(this._getAnimationType("entry"))}},hide:function(){this._showing&&(this._animationPlaying?(this._showing=!1,this._cancelAnimation()):(this._onAnimationFinish(),this._showing=!1,this._animationPlaying=!0))},updatePosition:function(){if(this._target&&this.offsetParent){var b=this.offset;14!=this.marginTop&&14==this.offset&&(b=this.marginTop);var c=this.offsetParent.getBoundingClientRect(),e=this._target.getBoundingClientRect(), g=this.getBoundingClientRect(),k=(e.width-g.width)/2,q=(e.height-g.height)/2,l=e.left-c.left,m=e.top-c.top;switch(this.position){case "top":var p=l+k;var n=m-g.height-b;break;case "bottom":p=l+k;n=m+e.height+b;break;case "left":p=l-g.width-b;n=m+q;break;case "right":p=l+e.width+b,n=m+q}this.fitToVisibleBounds?(c.left+p+g.width>window.innerWidth?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,p)+"px",this.style.right="auto"),c.top+n+g.height>window.innerHeight?(this.style.bottom= c.height+"px",this.style.top="auto"):(this.style.top=Math.max(-c.top,n)+"px",this.style.bottom="auto")):(this.style.left=p+"px",this.style.top=n+"px")}},_addListeners:function(){this._target&&(this.listen(this._target,"mouseenter","show"),this.listen(this._target,"focus","show"),this.listen(this._target,"mouseleave","hide"),this.listen(this._target,"blur","hide"),this.listen(this._target,"tap","hide"));this.listen(this.$.tooltip,"animationend","_onAnimationEnd");this.listen(this,"mouseenter","hide")}, _findTarget:function(){this.manualMode||this._removeListeners();this._target=this.target;this.manualMode||this._addListeners()},_delayChange:function(b){500!==b&&this.updateStyles({"--paper-tooltip-delay-in":b+"ms"})},_manualModeChanged:function(){this.manualMode?this._removeListeners():this._addListeners()},_cancelAnimation:function(){this.$.tooltip.classList.remove(this._getAnimationType("entry"));this.$.tooltip.classList.remove(this._getAnimationType("exit"));this.$.tooltip.classList.remove("cancel-animation"); this.$.tooltip.classList.add("hidden")},_onAnimationFinish:function(){this._showing&&(this.$.tooltip.classList.remove(this._getAnimationType("entry")),this.$.tooltip.classList.remove("cancel-animation"),this.$.tooltip.classList.add(this._getAnimationType("exit")))},_onAnimationEnd:function(){this._animationPlaying=!1;this._showing||(this.$.tooltip.classList.remove(this._getAnimationType("exit")),this.$.tooltip.classList.add("hidden"))},_getAnimationType:function(b){if("entry"===b&&""!==this.animationEntry)return this.animationEntry; if("exit"===b&&""!==this.animationExit)return this.animationExit;if(this.animationConfig[b]&&"string"===typeof this.animationConfig[b][0].name){if(this.animationConfig[b][0].timing&&this.animationConfig[b][0].timing.delay&&0!==this.animationConfig[b][0].timing.delay){var c=this.animationConfig[b][0].timing.delay;"entry"===b?this.updateStyles({"--paper-tooltip-delay-in":c+"ms"}):"exit"===b&&this.updateStyles({"--paper-tooltip-delay-out":c+"ms"})}return this.animationConfig[b][0].name}},_removeListeners:function(){this._target&& (this.unlisten(this._target,"mouseenter","show"),this.unlisten(this._target,"focus","show"),this.unlisten(this._target,"mouseleave","hide"),this.unlisten(this._target,"blur","hide"),this.unlisten(this._target,"tap","hide"));this.unlisten(this.$.tooltip,"animationend","_onAnimationEnd");this.unlisten(this,"mouseenter","hide")}}); //# sourceURL=build://facets-dive/components/facets-dive-legend/facets-dive-legend.js Polymer({is:"facets-dive-legend",properties:{colorBy:{type:String,value:"",observer:"_open"},palette:{type:Array,value:[]},_opened:{type:Boolean,value:!1}},_breakUpAndTruncate(b){return Cp(Dp(""+b))},_anyColor(){return!!(this.colorBy&&this.palette&&this.palette.length)},_specialClass(b){return b?"special":""},_open(){this._opened=!0},_toggleOpened(){this._opened=!this._opened},_getIcon(b){return b?"expand-less":"expand-more"}}); //# sourceURL=build://facets-dive/components/facets-dive/facets-dive.js Polymer({is:"facets-dive",properties:{data:{type:Array,value:null,notify:!0},filteredDataIndices:{type:Array,value:null},_keys:{type:Array,value:[]},stats:{type:Object,value:{},notify:!0},atlasUrl:{type:String,value:null,notify:!0},spriteUrl:{type:String,value:null,notify:!0},crossOrigin:{type:String,value:null,notify:!0},spriteImageWidth:{type:Number,value:64},spriteImageHeight:{type:Number,value:64},gridFacetingVerticalLabelColor:{type:String,value:"#666666"},gridFacetingHorizontalLabelColor:{type:String, value:"#dd6622"},itemPositioningVerticalLabelColor:{type:String,value:"#2255aa"},itemPositioningHorizontalLabelColor:{type:String,value:"#118844"},fitGridAspectRatioToViewport:{type:Boolean,value:!1},verticalFacet:{type:String,value:"",notify:!0},verticalBuckets:{type:Number,value:10,notify:!0},verticalBagOfWords:{type:Boolean,value:!1,notify:!0},horizontalFacet:{type:String,value:"",notify:!0},horizontalBuckets:{type:Number,value:10,notify:!0},horizontalBagOfWords:{type:Boolean,value:!1,notify:!0}, positionMode:{type:String,value:"stacked",notify:!0},verticalPosition:{type:String,value:"",notify:!0},horizontalPosition:{type:String,value:"",notify:!0},colorBy:{type:String,value:"",notify:!0},imageFieldName:{type:String,value:"",notify:!0},_palette:{type:Array,value:[]},paletteChoice:{type:String,value:"standard",notify:!0},selectedData:{type:Array,value:[],notify:!0},selectedIndices:{type:Array,value:[],notify:!0},comparedData:{type:Array,value:[],notify:!0},comparedIndices:{type:Array,value:[], notify:!0},height:{type:Number,value:null,observer:"_updateHeight"},infoRenderer:{type:Object},hideInfoCard:{type:Boolean,value:!1},stableColors:{type:Boolean,value:!1}},ready(){const b=this.$;b.fitButton.onclick=()=>b.vis.fitToViewport();b.zoomInButton.onclick=()=>b.vis.zoomIn();b.zoomOutButton.onclick=()=>b.vis.zoomOut();this.hideInfoCard&&(b.vis.style.right="0");this._updateHeight()},_updateHeight(){null!==this.height&&(this.style.height="number"===typeof this.height?this.height+"px":this.height)}}); //# sourceURL=build://facets-overview/common/feature_statistics_generator.js class Pp{constructor(){this.vals=[];this.counts=[]}}function Qp(b){const c=new Bl;b.forEach(e=>{const g=Rp(e.data);g.setName(e.name);c.getDatasetsList().push(g)});return c} function Rp(b){const c={};if(null==b)return new Fl;b.forEach((e,g)=>{if(null!=e){var k=Object.keys(e),q={};for(let l=0;l<k.length;l++){const m=k[l],p=e[m];q[m]=!0;m in c||(c[m]=new Pp,c[m].missing=g,c[m].counts=[]);"number"===typeof p||"string"===typeof p?(c[m].vals.push(p),c[m].counts.push(1)):p instanceof Array&&(c[m].counts.push(p.length),c[m].vals.push(...p))}Object.keys(c).forEach(l=>{l in q||(c[l].missing+=1)})}});Object.keys(c).forEach(e=>{let g=0,k=0,q=!1;c[e].vals.forEach(l=>{"string"=== typeof l?g+=1:(k+=1,q=q||!Sp(l))});c[e].type=k>g?q?1:0:2});return Tp(c,b.length)}function Sp(b){return b===+b&&b===(b|0)}function Tp(b,c){const e=new Fl;e.setNumExamples(c);for(const g in b){if(!b.hasOwnProperty(g))continue;const k=new Hl;e.getFeaturesList().push(k);const q=b[g];k.setName(g);k.setType(q.type);1===q.type||0===q.type?k.setNumStats(Up(q.vals,q.counts,c,q.missing)):2===q.type&&k.setStringStats(Vp(q.vals,q.counts,c,q.missing))}return e} function Up(b,c,e,g){const k=new Nl;k.setCommonStats(Wp(c,e,g));let q=0,l=0,m=0;c=b.filter(v=>"number"===typeof v&&!isNaN(v)).map(v=>+v).sort((v,x)=>v-x);0<c.length&&(k.setMin(c[0]),k.setMax(c[c.length-1]),e=Math.floor(c.length/2),k.setMedian(0!==c.length%2?c[e]:(c[e]+c[e-1])/2));c.forEach(v=>{0===v&&(m+=1);q+=v;l+=v*v});1<c.length&&k.setStdDev(Math.sqrt((l-q*q/c.length)/(c.length-1)));k.setMean(q/b.length);k.setNumZeros(m);b=c.filter(v=>Infinity!==v&&-Infinity!==v);e=c.filter(v=>Infinity===v).length; g=c.filter(v=>-Infinity===v).length;var p=b[0];const n=b[b.length-1];p=d3.range(p,n,(n-p)/10);p=d3.histogram().thresholds(p)(b);let t=k.addHistograms();t.setType(0);p.forEach(v=>{const x=t.addBuckets();x.setSampleCount(v.length);x.setLowValue(v.x0);x.setHighValue(v.x1)});p=t.getBucketsList();c.length&&-Infinity===c[0]&&(p[0].setLowValue(-Infinity),p[0].setSampleCount(p[0].getSampleCount()+g));c.length&&Infinity===c[c.length-1]&&(p[p.length-1].setHighValue(Infinity),p[p.length-1].setSampleCount(p[p.length- 1].getSampleCount()+e));t=k.addHistograms();Xp(t,b);return k}function Xp(b,c){var e=[0,10,20,30,40,50,60,70,80,90,100];const g=e.length-1;e=e.map(q=>Yp(c,q));b.setType(1);const k=c.length/g;for(let q=0;q<g;q++){const l=b.addBuckets();l.setSampleCount(k);l.setLowValue(e[q]);l.setHighValue(e[q+1])}}function Yp(b,c){if(0===b.length)return NaN;c=c/100*(b.length-1);const e=Math.floor(c);return e===c?b[c]:b[e]+(b[e+1]-b[e])*(c-e)} function Vp(b,c,e,g){const k=new Pl;k.setCommonStats(Wp(c,e,g));let q=0;const l={};b.forEach(n=>{n=String(n);l[n]=(l[n]||0)+1;q+=n.length});0<b.length&&k.setAvgLength(q/b.length);b=[];for(var m in l)l.hasOwnProperty(m)&&b.push({str:m,count:l[m]});k.setUnique(b.length);b=b.sort((n,t)=>t.count-n.count);const p=new bm;k.setRankHistogram(p);b.length&&(m=k.addTopValues(),m.setValue(b[0].str),m.setFrequency(b[0].count));b.forEach((n,t)=>{const v=p.addBuckets();v.setSampleCount(n.count);v.setLowRank(t); v.setHighRank(t);v.setLabel(n.str)});return k}function Wp(b,c,e){const g=new Yl;let k=Infinity,q=0,l=0;b.forEach(m=>{m<k&&(k=m);m>q&&(q=m);l+=m});g.setNumNonMissing(c-e);g.setNumMissing(e);g.setMinNumValues(k);g.setMaxNumValues(q);0<b.length&&g.setAvgNumValues(l/b.length);c=new Zl;g.setNumValuesHistogram(c);Xp(c,b);return g}; //# sourceURL=build://facets-overview/common/utils.js class Zp{}class ks{constructor(b,c,e,g,k,q,l,m){this.histMap={};this.name=b;c&&(this.histMap[ls(!1,"Standard")]=c);e&&(this.histMap[ls(!0,"Standard")]=e);g&&(this.histMap[ls(!1,"Quantiles")]=g);k&&(this.histMap[ls(!0,"Quantiles")]=k);q&&(this.histMap[ls(!1,"Value list length")]=q);l&&(this.histMap[ls(!1,"Feature list length")]=l);m&&Object.keys(m).forEach(p=>this.histMap[p]=m[p])}} class ms{constructor(b,c,e,g){this.name=b;this.stringValue=c;this.lowNumValue=e;this.highNumValue=g}clear(){this.highNumValue=this.lowNumValue=this.stringValue=this.name=void 0}equals(b){return b?this.name===b.name&&this.stringValue===b.stringValue&&this.lowNumValue===b.lowNumValue&&this.highNumValue===b.highNumValue:!1}} function ns(b){const c=os(b);if(0===c)return 0;const e=b.reduce((g,k)=>{k=+k.getSampleCount()||0;if(0===k)return g;k/=c;return g-k*Math.log(k)},0);return 0===e?0:e/Math.log(b.length)}function ps(b,c){return isFinite(b)&&-1===b.toString().indexOf("e")?+(Math.round(Number(b+"e+"+c))+"e-"+c):b}function qs(b,c,e){return(b=b.histMap[ls(c,e)])?b.getBucketsList():[]}function ls(b,c){c=null==c?"Standard":c;b&&(c="weighted"+c);return c} function os(b){return b.map(c=>c.getSampleCount()).reduce((c,e)=>(+e||0)+c,0)}function rs(b){return b.map(c=>os(qs(c,!1)))}function ss(b){const c=[];b.forEach(e=>{e.forEach(g=>{g=ts(g.getLabel());-1===c.indexOf(g)&&c.push(g)})});return c}function ts(b){return null==b||""===b?"\u00a0":b}function us(b){return 0===b.length||isNaN(+b)?b:'"'+b+'"'}function vs(b){return null==b?0:"inf"===b?Infinity:"-inf"===b?-Infinity:+b} function ws(b){let c=0;var e=0;const g=xs(b);b&&b.getNumStats()&&(b=b.getNumStats(),c+=vs(b.getNumZeros()));g&&(e=vs(g.getNumMissing()),c+=e,e=vs(g.getNumNonMissing())+e);return 0===e?1:c/e} function ys(b){const c=b.map(y=>qs(y,!1));var e=null;for(var g=0;g<c.length;g++)if(0<c[g].length){e=c[g][0];break}if(!e)return 0;g=rs(b);for(var k=0;k<g.length;k++)if(0===g[k])return Infinity;k=0;if(e instanceof dm){e=ss(c);for(var q=1;q<b.length;q++){var l=c[0],m=c[q],p=0;for(var n=0;n<e.length;n++){var t=e[n],v=0;let y=0;for(var x=0;x<l.length;x++)if(l[x].getLabel()===t){v=l[x].getSampleCount()?l[x].getSampleCount():0;break}for(x=0;x<m.length;x++)if(m[x].getLabel()===t){y=m[x].getSampleCount()? m[x].getSampleCount():0;break}p=zs(p,v,g[0],y,g[q])}k=Math.max(k,p)}}else for(e=1;e<b.length;e++){q=c[0];l=c[e];m=0;p=Math.max(q.length,l.length);for(n=0;n<p;n++)t=n<q.length&&q[n].getSampleCount()?q[n].getSampleCount():0,v=n<l.length&&l[n].getSampleCount()?l[n].getSampleCount():0,m=zs(m,t,g[0],v,g[e]);k=Math.max(k,m)}return k}function zs(b,c,e,g,k){const q=c/e-g/k;c=c/(e*e)+g/(k*k);return b+(c?q*q/c:0)}function As(b,c){return c===b?c.toLocaleString():b.toLocaleString()+"/"+c.toLocaleString()} function Bs(b){return null!=b.getNumStats()} function Cs(b){b.getDatasetsList().forEach(c=>{c.getFeaturesList().forEach(e=>{var g=e.getPath();null!=g&&(g=g.getStepList(),null!=g&&e.setName(g.join("/")));g=[];if(e.getStringStats()){const k=e.getStringStats().getRankHistogram();k&&g.push(k);(e=e.getStringStats().getTopValuesList())&&e.forEach(q=>{const l=q.getDeprecatedFreq();l&&!q.getFrequency()&&q.setFrequency(l)})}else e.getNumStats()&&(e=e.getNumStats().getHistogramsList())&&(g=g.concat(e));g.forEach(k=>{(k=k.getBucketsList())&&k.forEach(q=> {const l=q.getDeprecatedCount();l&&!q.getSampleCount()&&q.setSampleCount(l)})})})});return b} function Ds(b){let c=!0;b.getDatasetsList().forEach(e=>{e.getFeaturesList().forEach(g=>{let k=[];if(g.getStringStats()){const q=g.getStringStats().getRankHistogram();q&&k.push(q);(g=g.getStringStats().getTopValuesList())&&g.forEach(l=>{l.getDeprecatedFreq()&&!l.getFrequency()&&(c=!1)})}else g.getNumStats()&&(g=g.getNumStats().getHistogramsList())&&(k=k.concat(g));k.forEach(q=>{(q=q.getBucketsList())&&q.forEach(l=>{l.getDeprecatedCount()&&!l.getSampleCount()&&(c=!1)})})})});return c} function Es(b){for(let c=0;c<b.getDatasetsList().length;c++){const e=b.getDatasetsList()[c];for(let g=0;g<e.getFeaturesList().length;g++){const k=e.getFeaturesList()[g];if(k.getStringStats()){if(k.getStringStats().getWeightedStringStats())return!0}else if(k.getNumStats()&&k.getNumStats().getWeightedNumericStats())return!0}}return!1} function Fs(b){for(let c=0;c<b.getDatasetsList().length;c++){const e=b.getDatasetsList()[c];for(let g=0;g<e.getFeaturesList().length;g++){const k=e.getFeaturesList()[g].getCustomStatsList();if(null!=k&&0<k.length)return!0}}return!1}function Gs(b){for(let e=0;e<b.getDatasetsList().length;e++){const g=b.getDatasetsList()[e];for(let k=0;k<g.getFeaturesList().length;k++){var c=g.getFeaturesList()[k];if((c=xs(c))&&c.getFeatureListLengthHistogram())return!0}}return!1} function Hs(b){if(!b)return!1;for(let c=0;c<b.length;c++)if(b[c].histMap[ls(!0,"Standard")])return!0;return!1}function Is(b){if(!b)return!1;for(let c=0;c<b.length;c++)if(b[c].histMap.Quantiles)return!0;return!1}function Js(b){if(!b)return!1;for(let c=0;c<b.length;c++)if(b[c].histMap["Value list length"])return!0;return!1}function Ks(b){return b?b.getNumNonMissing()*b.getAvgNumValues():0} function Ls(b){switch(b){case 0:return"int";case 1:return"fixed-length ints";case 2:return"variable-length ints";case 3:return"float";case 4:return"fixed-length floats";case 5:return"variable-length floats";case 6:return"string";case 7:return"fixed-length strings";case 8:return"variable-length strings";case 9:return"bytes";case 10:return"fixed-length bytes";case 11:return"variable-length bytes";case 12:return"struct";case 13:return"fixed-length struct";case 14:return"variable-length struct";default:return"unknown"}} function Ms(b,c){return 15===b?c:16<=b||15===c?b:3<=b&&5>=b&&3<=c&&5>=c||0<=b&&2>=b&&0<=c&&2>=c||6<=b&&8>=b&&6<=c&&8>=c||9<=b&&11>=b&&9<=c&&11>=c||12<=b&&14>=b&&12<=c&&14>=c?Math.max(b,c):16}function Ns(b,c){var e=15;if(null!=c&&0!==c.getNumNonMissing()){let g=e=!1;c.getMinNumValues()===c.getMaxNumValues()&&(1===c.getMinNumValues()?e=!0:g=!0);e=1===b?e?3:g?4:5:0===b?e?0:g?1:2:2===b?e?6:g?7:8:3===b?e?9:g?10:11:e?12:g?13:14}return e}class Os{}class Ps{}class Qs{} function Rs(b){let c=0,e=0;for(var g=0;g<b.length;g++)b[g].rawBuckets.length>c&&(c=b[g].rawBuckets.length,e=g);g=[];for(let k=0;k<c;k++){const q=new Qs;q.value=b[e].rawBuckets[k].getLabel();q.counts=[];for(let l=0;l<b.length;l++)b[l].rawBuckets.length<=k?q.counts.push(0):q.counts.push(b[l].rawBuckets[k].getSampleCount());g.push(q)}return g} function Ss(b,c){const e=[];for(let g=0;g<c.length;g++){const k=new Qs,q=c[g];k.value=q;k.counts=[];for(let l=0;l<b.length;l++){const m=b[l].rawBuckets;let p=-1;for(let n=0;n<m.length;n++)if(m[n].getLabel()===q){p=n;break}-1===p?k.counts.push(0):k.counts.push(m[p].getSampleCount())}e.push(k)}return e}var Ts;(function(b){b[b.HISTOGRAM=0]="HISTOGRAM";b[b.BAR_CHART=1]="BAR_CHART";b[b.CUMDIST_CHART=2]="CUMDIST_CHART"})(Ts||(Ts={})); function Us(b){return"Quantiles"===b||"Value list length"===b||"Feature list length"===b}function Vs(b,c,e){let g=!0,k=0;b.forEach(q=>{q.histMap[c]&&(q=q.histMap[c].getBucketsList(),k=Math.max(k,q.length),q.forEach(l=>{l.getLowValue||(g=!1)}))});return g?Ts.HISTOGRAM:k>e?Ts.CUMDIST_CHART:Ts.BAR_CHART} class Ws{constructor(b,c,e){this.str=b;this.cssClass=c;this.fullStr=e;this.fullStr||(this.fullStr=b)}append(b,c){c&&(this.str+=c,this.fullStr+=c);this.str+=b.str;this.fullStr+=b.fullStr;this.cssClass+=b.cssClass}}function Xs(b){const c=Math.abs(b);return(.01>c&&0<c||1E4<c)&&isFinite(b)?d3.format(".3s")(b).replace(/G$/,"B"):b.toLocaleString()}function Ys(b,c){const e=Xs(ps(vs(b),1E6<Math.abs(b)?0:2));c=Zs(b,c,void 0);return new Ws(e,c,b.toLocaleString([],{maximumFractionDigits:9}))} function $s(b,c,e){b=vs(b);b=null!=b&&c?b/c:0;c=.999999<b&&1>b?"~100%":1E-6>b&&0<b?"~0%":ps(100*b,2)+"%";e=Zs(b,!1,e);return new Ws(c,e,100*b+"%")}function at(b,c,e){const g=Xs(b);c=Zs(b,c,e);return new Ws(g,c,b.toLocaleString())}function bt(b,c){b=us(ts(b));c=Zs(b,c,void 0);return new Ws(b,c)}function Zs(b,c,e){c=c?"data-weighted ":"";if(e&&e(b)||"number"===typeof b&&!isFinite(b))c+="data-error ";return c} function ct(b,c,e){const g=[];g.push(bt("count"));g.push(bt("missing"));b?(g.push(bt("mean",c)),g.push(bt("std dev",c)),g.push(bt("zeros")),g.push(bt("min")),g.push(bt("median",c)),g.push(bt("max"))):(g.push(bt("unique")),g.push(bt("top",c)),g.push(bt("freq top",c)),g.push(bt("avg str len")));e&&g.push(new Ws("custom","data-custom "));return g} function xs(b){return b?b.getNumStats()?b.getNumStats().getCommonStats():b.getStringStats()?b.getStringStats().getCommonStats():b.getBytesStats()?b.getBytesStats().getCommonStats():b.getStructStats()?b.getStructStats().getCommonStats():null:null}function dt(b){const c=[];b?(c.push(at(b.getNumNonMissing(),!1,e=>0>=e)),c.push($s(b.getNumMissing(),vs(b.getNumNonMissing())+vs(b.getNumMissing()),e=>.02<e))):(c.push(at(0,!1,e=>0>=e)),c.push($s(1,1,e=>.02<e)));return c} function et(b,c,e){const g=[];if(b)(e=e?b.getWeightedNumericStats():null)?(g.push(Ys(e.getMean(),!0)),g.push(Ys(e.getStdDev(),!0))):(g.push(Ys(b.getMean())),g.push(Ys(b.getStdDev()))),g.push($s(b.getNumZeros(),Ks(c),k=>.1<k)),c=ft(b),g.push(Ys(c?NaN:b.getMin())),e?g.push(Ys(e.getMedian(),!0)):g.push(Ys(b.getMedian())),g.push(Ys(c?NaN:b.getMax()));else for(b=0;6>b;b++)g.push(bt("-"));return g} function ft(b){if(!b)return!1;b=b.getHistogramsList();for(let c=0;c<b.length;c++)if(0<b[c].getNumNan())return!0;return!1}function gt(b,c){const e=[];if(b){c=c?b.getWeightedStringStats():null;e.push(at(b.getUnique()));const g=c?c.getTopValuesList():b.getTopValuesList();g&&0<g.length?(e.push(bt(g[0].getValue(),!!c)),e.push(Ys(g[0].getFrequency(),!!c))):(e.push(bt("-")),e.push(bt("-")));e.push(Ys(b.getAvgLength()))}else for(b=0;4>b;b++)e.push(bt("-"));return e} function ht(b){const c=[];if(b)c.push(at(b.getUnique())),c.push(bt("-")),c.push(bt("-")),c.push(Ys(b.getAvgNumBytes()));else for(b=0;4>b;b++)c.push(bt("-"));return c}function it(b){const c=[];if(b&&0<b.length){const e=new Ws("","data-custom ");b.forEach(g=>{if(!g.getHistogram()&&!g.getRankHistogram()){var k=g.getName();""!==e.str&&(k="\n"+k);e.append(bt(k));g.getStr()?e.append(bt(g.getStr()),": "):e.append(Ys(g.getNum()),": ")}});c.push(e)}else c.push(new Ws("-","data-custom "));return c} function jt(b,c,e){if(!b)return[];const g=xs(b);let k=dt(g);k=b.getNumStats()?k.concat(et(b.getNumStats(),g,c)):b.getStringStats()?k.concat(gt(b.getStringStats(),c)):k.concat(ht(b.getBytesStats()));e&&(k=k.concat(it(b.getCustomStatsList())));return k} function kt(b){const c=b.map(()=>0);b.forEach((e,g)=>{e.forEach(k=>{c[g]+=vs(k.getSampleCount())})});return b.map((e,g)=>e.map(k=>{if(k instanceof am){var q=new am;q.setSampleCount(k.getSampleCount()/c[g]);q.setLowValue(k.getLowValue());q.setHighValue(k.getHighValue());return q}q=new dm;q.setSampleCount(k.getSampleCount()/c[g]);q.setLowRank(k.getLowRank());q.setHighRank(k.getHighRank());q.setLabel(k.getLabel());return q}))}; //# sourceURL=build://facets-overview/common/overview_data_model.js class lt{constructor(b){this.data=b;this.colorScale=new Plottable.Scales.Color;this.colorScale.domain(b.getDatasetsList().map(c=>c.getName()));this.colorScale.range("#4285F4 #F09300 #0F9D58 #9C27B0 #607D8B #0B8043 #757575".split(" "));if(!Ds(b))throw Error("input proto has not been cleaned");this.featuresBySpec=this.makeFeatureBySpecList()}makeFeatureBySpecList(){const b=[];for(let c=0;16>c;c++)b[c]=[];this.getUniqueFeatures().forEach(c=>{const e=this.getFeatureSpecForFeature(c.getName());b[e].push(c.getName())}); return b}getNonEmptyFeatureSpecLists(){const b=[];for(let c=0;16>c;c++)if(0!==this.featuresBySpec[c].length){const e=new Os;e.features=this.featuresBySpec[c];e.spec=c;b.push(e)}return b}getFeatureSpecForFeature(b){const c=this.getDatasetNames();let e=15;for(let k=0;k<c.length;k++){var g=this.getFeature(b,c[k]);g=null==g?15:Ns(g.getType(),this.getFeatureCommonStats(b,c[k]));e=Ms(e,g)}16===e&&(e=15);return e}getDatasetFeatureStatistics(){return this.data}getColorScale(){return this.colorScale}getDatasetNames(){return this.data? this.data.getDatasetsList().map(b=>b.getName()):[]}getDataset(b){if(!this.data)return null;for(const c of this.data.getDatasetsList())if(c.getName()===b)return c;return null}getFeature(b,c){if(!b||!this.data)return null;c=this.getDataset(c);if(!c)return null;for(const e of c.getFeaturesList())if(e.getName()===b)return e;return null}getExtraHistogramNames(b){if(!this.data)return[];b=b.map(e=>e.getName());const c={};for(const e of this.data.getDatasetsList())for(const g of e.getFeaturesList())if(-1!== b.indexOf(g.getName())&&(g.getCustomStatsList()&&g.getCustomStatsList().forEach(k=>{if(k.getHistogram()||k.getRankHistogram())c[k.getName()]=!0}),g.getNumStats())){const k=g.getNumStats().getHistogramsList();if(k)for(let q=0;q<k.length;q++){const l=k[q];l.getName()&&(c[l.getName()]=!0)}}return Object.keys(c)}getFeatureCommonStats(b,c){b=this.getFeature(b,c);return null==b?null:xs(b)}getFeatureNames(b){return b&&this.data?(b=this.getDataset(b))?b.getFeaturesList().map(c=>c.getName()):[]:null}getFeatureIndex(b, c){if(!this.data)return null;b=this.getDataset(b);if(!b)return null;let e=0;for(const g of b.getFeaturesList()){if(g.getName()===c)return e;++e}return null}getUniqueFeatures(){if(!this.data)return[];const b={};for(const c of this.data.getDatasetsList())for(const e of c.getFeaturesList())b[e.getName()]=e;return Object.keys(b).map(c=>b[c])}getNumUniqueFeaturesByType(b){return this.getUniqueFeatures().filter(c=>Bs(c)===b).length}featureHasSingleValue(b){if(!b)return!1;if(b.getStringStats()){var c=b.getStringStats().getUnique(); return 1===vs(c)}return b.getBytesStats()?(c=b.getBytesStats().getUnique(),1===vs(c)):b.getNumStats()?(c=b.getNumStats().getMin(),b=b.getNumStats().getMax(),null==c&&null==b?!1:vs(c)===vs(b)):!1}featureAcrossAllDatasetsHasSingleValue(b){if(!b||!this.data)return!1;for(const c of this.data.getDatasetsList())for(const e of c.getFeaturesList())if(b===e.getName()&&!this.featureHasSingleValue(e))return!1;return!0}getFeatureSingleValue(b){if(null==b)return"\x3cnull\x3e";if(b.getStringStats())return b=b.getStringStats().getTopValuesList(), null==b||0===b.length?"\x3cnull\x3e":b[0].getValue();if(b.getBytesStats())return 0===b.getBytesStats().getUnique()?"\x3cnull\x3e":"\x3cbinary data\x3e";if(b.getNumStats()){const c=b.getNumStats().getMin();if(c)return vs(c).toString();if(b=b.getNumStats().getMax())return vs(b).toString()}return"\x3cunknown type\x3e"}getDatasetHistogramsForFeature(b){const c=[];if(this.data)for(const q of this.data.getDatasetsList()){const l=q.getName();let m=null,p=null,n=null,t=null,v=null,x=null;const y={};for(const z of q.getFeaturesList())if(z.getName()=== b){var e=this.getFeatureCommonStats(b,l);e&&(v=e.getNumValuesHistogram(),x=e.getFeatureListLengthHistogram());z.getCustomStatsList()&&z.getCustomStatsList().forEach(A=>{A.getHistogram()?y[A.getName()]=A.getHistogram():A.getRankHistogram()&&(y[A.getName()]=A.getRankHistogram())});if(z.getNumStats()){if(e=z.getNumStats().getHistogramsList())for(var g=0;g<e.length;g++){var k=e[g];k.getName()?y[k.getName()]=k:0===k.getType()?m=k:n=k}if(z.getNumStats().getWeightedNumericStats()&&(e=z.getNumStats().getWeightedNumericStats().getHistogramsList()))for(g= 0;g<e.length;g++)k=e[g],0===k.getType()?p=k:t=k}else z.getStringStats()&&(m=z.getStringStats().getRankHistogram(),z.getStringStats().getWeightedStringStats()&&(p=z.getStringStats().getWeightedStringStats().getRankHistogram()));break}c.push(new ks(l,m,p,n,t,v,x,y))}return c}doesContainWeightedStats(){null==this.containsWeightedStats&&(this.containsWeightedStats=Es(this.data));return this.containsWeightedStats}doesContainCustomStats(){null==this.containsCustomStats&&(this.containsCustomStats=Fs(this.data)); return this.containsCustomStats}doesContainFeatureListLengthData(){null==this.containsFeatureListLengthData&&(this.containsFeatureListLengthData=Gs(this.data));return this.containsFeatureListLengthData}getChartAlpha(){return 2<=this.getDatasetNames().length?.4:1}getChartColorString(b){b=this.getColorScale().scale(this.getDatasetNames()[b]);const c=this.getChartAlpha();return b.replace("rgb","rgba").replace(")",", "+c+")")}}; //# sourceURL=build://facets-overview/common/plottable_helpers.js (function(b){function c(p){const n=[];for(;p&&p instanceof HTMLElement;)if(n.push(p),p.assignedSlot)p=p.assignedSlot;else if(p.parentElement)p=p.parentElement;else{const t=p.parentNode;p=t instanceof DocumentFragment?t.host:t!==p?t:null}return n}function e(p){var n=c(p);p=g;let t=null;for(const x of n){n=Plottable.Utils.DOM.getElementTransform(x);if(null!=n){var v=x.clientWidth/2;const y=x.clientHeight/2;p=Plottable.Utils.Math.multiplyTranslate(p,[v,y]);p=Plottable.Utils.Math.multiplyMatrix(p,Plottable.Utils.Math.invertMatrix(n)); p=Plottable.Utils.Math.multiplyTranslate(p,[-v,-y])}n=x.scrollLeft;v=x.scrollTop;if(null===t||x===t)n-=x.offsetLeft+x.clientLeft,v-=x.offsetTop+x.clientTop,t=x.offsetParent;p=Plottable.Utils.Math.multiplyTranslate(p,[n,v])}return p}const g=[1,0,0,1,0,0];class k extends Plottable.Utils.Translator{computePosition(p,n){p={x:p,y:n};n=e(this._rootElement);return null==n?p:Plottable.Utils.Math.applyTransform(n,p)}}class q extends Plottable.Dispatchers.Mouse{constructor(p){super(p);this._eventTarget=p.root().rootElement().node(); this._translator=new k(p.root().rootElement().node())}static getDispatcher(p){const n=p.root().rootElement();let t=n[q._DISPATCHER_KEY];t||(t=new q(p),n[q._DISPATCHER_KEY]=t);return t}}class l extends Plottable.Dispatchers.Touch{constructor(p){super(p);this._eventTarget=p.root().rootElement().node();this._translator=new k(p.root().rootElement().node())}static getDispatcher(p){const n=p.root().rootElement();let t=n[l._DISPATCHER_KEY];t||(t=new l(p),n[l._DISPATCHER_KEY]=t);return t}}class m extends Plottable.Interactions.Pointer{_anchor(){this._isAnchored= !0;this._mouseDispatcher=q.getDispatcher(this._componentAttachedTo);this._mouseDispatcher.onMouseMove(this._mouseMoveCallback);this._touchDispatcher=l.getDispatcher(this._componentAttachedTo);this._touchDispatcher.onTouchStart(this._touchStartCallback)}}b.PointerInteraction=m})(window.plottable_helpers||(window.plottable_helpers={})); //# sourceURL=build://iron-scroll-target-behavior/iron-scroll-target-behavior.html.js Polymer.IronScrollTargetBehavior={properties:{scrollTarget:{type:HTMLElement,value:function(){return this._defaultScrollTarget}}},observers:["_scrollTargetChanged(scrollTarget, isAttached)"],_shouldHaveListener:!0,_scrollTargetChanged:function(b,c){this._oldScrollTarget&&(this._toggleScrollListener(!1,this._oldScrollTarget),this._oldScrollTarget=null);c&&("document"===b?this.scrollTarget=this._doc:"string"===typeof b?this.scrollTarget=(c=this.domHost)&&c.$?c.$[b]:Polymer.dom(this.ownerDocument).querySelector("#"+ b):this._isValidScrollTarget()&&(this._oldScrollTarget=b,this._toggleScrollListener(this._shouldHaveListener,b)))},_scrollHandler:function(){},get _defaultScrollTarget(){return this._doc},get _doc(){return this.ownerDocument.documentElement},get _scrollTop(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.pageYOffset:this.scrollTarget.scrollTop:0},get _scrollLeft(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.pageXOffset:this.scrollTarget.scrollLeft: 0},set _scrollTop(b){this.scrollTarget===this._doc?window.scrollTo(window.pageXOffset,b):this._isValidScrollTarget()&&(this.scrollTarget.scrollTop=b)},set _scrollLeft(b){this.scrollTarget===this._doc?window.scrollTo(b,window.pageYOffset):this._isValidScrollTarget()&&(this.scrollTarget.scrollLeft=b)},scroll:function(b,c){this.scrollTarget===this._doc?window.scrollTo(b,c):this._isValidScrollTarget()&&(this.scrollTarget.scrollLeft=b,this.scrollTarget.scrollTop=c)},get _scrollTargetWidth(){return this._isValidScrollTarget()? this.scrollTarget===this._doc?window.innerWidth:this.scrollTarget.offsetWidth:0},get _scrollTargetHeight(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.innerHeight:this.scrollTarget.offsetHeight:0},_isValidScrollTarget:function(){return this.scrollTarget instanceof HTMLElement},_toggleScrollListener:function(b,c){c=c===this._doc?window:c;b?this._boundScrollHandler||(this._boundScrollHandler=this._scrollHandler.bind(this),c.addEventListener("scroll",this._boundScrollHandler)): this._boundScrollHandler&&(c.removeEventListener("scroll",this._boundScrollHandler),this._boundScrollHandler=null)},toggleScrollListener:function(b){this._shouldHaveListener=b;this._toggleScrollListener(b,this.scrollTarget)}}; //# sourceURL=build://iron-list/iron-list.html.js (function(){var b=navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/),c=b&&8<=b[1],e=null!=Polymer.flush,g=e?Polymer.Async.animationFrame:0,k=e?Polymer.Async.idlePeriod:1,q=e?Polymer.Async.microTask:2;Polymer.OptionalMutableDataBehavior||(Polymer.OptionalMutableDataBehavior={});Polymer({is:"iron-list",properties:{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},selectedAs:{type:String,value:"selected"},grid:{type:Boolean,value:!1,reflectToAttribute:!0, observer:"_gridChanged"},selectionEnabled:{type:Boolean,value:!1},selectedItem:{type:Object,notify:!0},selectedItems:{type:Object,notify:!0},multiSelection:{type:Boolean,value:!1},scrollOffset:{type:Number,value:0}},observers:["_itemsChanged(items.*)","_selectionEnabledChanged(selectionEnabled)","_multiSelectionChanged(multiSelection)","_setOverflow(scrollTarget, scrollOffset)"],behaviors:[Polymer.Templatizer,Polymer.IronResizableBehavior,Polymer.IronScrollTargetBehavior,Polymer.OptionalMutableDataBehavior], _ratio:.5,_scrollerPaddingTop:0,_scrollPosition:0,_physicalSize:0,_physicalAverage:0,_physicalAverageCount:0,_physicalTop:0,_virtualCount:0,_estScrollHeight:0,_scrollHeight:0,_viewportHeight:0,_viewportWidth:0,_physicalItems:null,_physicalSizes:null,_firstVisibleIndexVal:null,_collection:null,_lastVisibleIndexVal:null,_maxPages:2,_focusedItem:null,_focusedVirtualIndex:-1,_focusedPhysicalIndex:-1,_offscreenFocusedItem:null,_focusBackfillItem:null,_itemsPerRow:1,_itemWidth:0,_rowHeight:0,_templateCost:0, _parentModel:!0,get _physicalBottom(){return this._physicalTop+this._physicalSize},get _scrollBottom(){return this._scrollPosition+this._viewportHeight},get _virtualEnd(){return this._virtualStart+this._physicalCount-1},get _hiddenContentSize(){return(this.grid?this._physicalRows*this._rowHeight:this._physicalSize)-this._viewportHeight},get _itemsParent(){return Polymer.dom(Polymer.dom(this._userTemplate).parentNode)},get _maxScrollTop(){return this._estScrollHeight-this._viewportHeight+this._scrollOffset}, get _maxVirtualStart(){var l=this._convertIndexToCompleteRow(this._virtualCount);return Math.max(0,l-this._physicalCount)},set _virtualStart(l){l=this._clamp(l,0,this._maxVirtualStart);this.grid&&(l-=l%this._itemsPerRow);this._virtualStartVal=l},get _virtualStart(){return this._virtualStartVal||0},set _physicalStart(l){l%=this._physicalCount;0>l&&(l=this._physicalCount+l);this.grid&&(l-=l%this._itemsPerRow);this._physicalStartVal=l},get _physicalStart(){return this._physicalStartVal||0},get _physicalEnd(){return(this._physicalStart+ this._physicalCount-1)%this._physicalCount},set _physicalCount(l){this._physicalCountVal=l},get _physicalCount(){return this._physicalCountVal||0},get _optPhysicalSize(){return 0===this._viewportHeight?Infinity:this._viewportHeight*this._maxPages},get _isVisible(){return!(!this.offsetWidth&&!this.offsetHeight)},get firstVisibleIndex(){var l=this._firstVisibleIndexVal;if(null==l){var m=this._physicalTop+this._scrollOffset;this._firstVisibleIndexVal=l=this._iterateItems(function(p,n){m+=this._getPhysicalSizeIncrement(p); if(m>this._scrollPosition)return this.grid?n-n%this._itemsPerRow:n;if(this.grid&&this._virtualCount-1===n)return n-n%this._itemsPerRow})||0}return l},get lastVisibleIndex(){var l=this._lastVisibleIndexVal;if(null==l){if(this.grid)l=Math.min(this._virtualCount,this.firstVisibleIndex+this._estRowsInView*this._itemsPerRow-1);else{var m=this._physicalTop+this._scrollOffset;this._iterateItems(function(p,n){m<this._scrollBottom&&(l=n);m+=this._getPhysicalSizeIncrement(p)})}this._lastVisibleIndexVal=l}return l}, get _defaultScrollTarget(){return this},get _virtualRowCount(){return Math.ceil(this._virtualCount/this._itemsPerRow)},get _estRowsInView(){return Math.ceil(this._viewportHeight/this._rowHeight)},get _physicalRows(){return Math.ceil(this._physicalCount/this._itemsPerRow)},get _scrollOffset(){return this._scrollerPaddingTop+this.scrollOffset},ready:function(){this.addEventListener("focus",this._didFocus.bind(this),!0)},attached:function(){this._debounce("_render",this._render,g);this.listen(this,"iron-resize", "_resizeHandler");this.listen(this,"keydown","_keydownHandler")},detached:function(){this.unlisten(this,"iron-resize","_resizeHandler");this.unlisten(this,"keydown","_keydownHandler")},_setOverflow:function(l){this.style.webkitOverflowScrolling=l===this?"touch":"";this.style.overflowY=l===this?"auto":"";this._firstVisibleIndexVal=this._lastVisibleIndexVal=null;this._debounce("_render",this._render,g)},updateViewportBoundaries:function(){var l=window.getComputedStyle(this);this._scrollerPaddingTop= this.scrollTarget===this?0:parseInt(l["padding-top"],10);this._isRTL="rtl"===l.direction;this._viewportWidth=this.$.items.offsetWidth;this._viewportHeight=this._scrollTargetHeight;this.grid&&this._updateGridMetrics()},_scrollHandler:function(){var l=Math.max(0,Math.min(this._maxScrollTop,this._scrollTop)),m=l-this._scrollPosition,p=0<=m;this._scrollPosition=l;this._lastVisibleIndexVal=this._firstVisibleIndexVal=null;Math.abs(m)>this._physicalSize&&0<this._physicalSize?(m-=this._scrollOffset,p=Math.round(m/ this._physicalAverage)*this._itemsPerRow,this._virtualStart+=p,this._physicalStart+=p,this._physicalTop=Math.floor(this._virtualStart/this._itemsPerRow)*this._physicalAverage,this._update()):0<this._physicalCount&&(l=this._getReusables(p),p?(this._physicalTop=l.physicalTop,this._virtualStart+=l.indexes.length,this._physicalStart+=l.indexes.length):(this._virtualStart-=l.indexes.length,this._physicalStart-=l.indexes.length),this._update(l.indexes,p?null:l.indexes),this._debounce("_increasePoolIfNeeded", this._increasePoolIfNeeded.bind(this,0),q))},_getReusables:function(l){var m=[],p=this._hiddenContentSize*this._ratio,n=this._virtualStart,t=this._virtualEnd,v=this._physicalCount,x=this._physicalTop+this._scrollOffset;var y=this._physicalBottom+this._scrollOffset;var z=this._scrollTop,A=this._scrollBottom;if(l){var D=this._physicalStart;y=z-x}else D=this._physicalEnd,y-=A;for(;;){var H=this._getPhysicalSizeIncrement(D);y-=H;if(m.length>=v||y<=p)break;if(l){if(t+m.length+1>=this._virtualCount)break; if(x+H>=z-this._scrollOffset)break;m.push(D);x+=H;D=(D+1)%v}else{if(0>=n-m.length)break;if(x+this._physicalSize-H<=A)break;m.push(D);x-=H;D=0===D?v-1:D-1}}return{indexes:m,physicalTop:x-this._scrollOffset}},_update:function(l,m){if(!(l&&0===l.length||0===this._physicalCount)){this._manageFocus();this._assignModels(l);this._updateMetrics(l);if(m)for(;m.length;)l=m.pop(),this._physicalTop-=this._getPhysicalSizeIncrement(l);this._positionItems();this._updateScrollerSize()}},_createPool:function(l){this._ensureTemplatized(); var m,p=Array(l);for(m=0;m<l;m++){var n=this.stamp(null);p[m]=n.root.querySelector("*");this._itemsParent.appendChild(n.root)}return p},_isClientFull:function(){return 0!=this._scrollBottom&&this._physicalBottom-1>=this._scrollBottom&&this._physicalTop<=this._scrollPosition},_increasePoolIfNeeded:function(l){l=this._clamp(this._physicalCount+l,3,this._virtualCount-this._virtualStart);l=this._convertIndexToCompleteRow(l);if(this.grid){var m=l%this._itemsPerRow;m&&l-m<=this._physicalCount&&(l+=this._itemsPerRow); l-=m}l-=this._physicalCount;m=Math.round(.5*this._physicalCount);if(!(0>l)){if(0<l){m=window.performance.now();[].push.apply(this._physicalItems,this._createPool(l));for(var p=0;p<l;p++)this._physicalSizes.push(0);this._physicalCount+=l;this._physicalStart>this._physicalEnd&&this._isIndexRendered(this._focusedVirtualIndex)&&this._getPhysicalIndex(this._focusedVirtualIndex)<this._physicalEnd&&(this._physicalStart+=l);this._update();this._templateCost=(window.performance.now()-m)/l;m=Math.round(.5* this._physicalCount)}this._virtualEnd>=this._virtualCount-1||0===m||(this._isClientFull()?this._physicalSize<this._optPhysicalSize&&this._debounce("_increasePoolIfNeeded",this._increasePoolIfNeeded.bind(this,this._clamp(Math.round(50/this._templateCost),1,m)),k):this._debounce("_increasePoolIfNeeded",this._increasePoolIfNeeded.bind(this,m),q))}},_render:function(){if(this.isAttached&&this._isVisible)if(0!==this._physicalCount){var l=this._getReusables(!0);this._physicalTop=l.physicalTop;this._virtualStart+= l.indexes.length;this._physicalStart+=l.indexes.length;this._update(l.indexes);this._update();this._increasePoolIfNeeded(0)}else 0<this._virtualCount&&(this.updateViewportBoundaries(),this._increasePoolIfNeeded(3))},_ensureTemplatized:function(){if(!this.ctor){(this._userTemplate=this.queryEffectiveChildren("template"))||console.warn("iron-list requires a template to be provided in light-dom");var l={__key__:!0};l[this.as]=!0;l[this.indexAs]=!0;l[this.selectedAs]=!0;l.tabIndex=!0;this._instanceProps= l;this.templatize(this._userTemplate,this.mutableData)}},_gridChanged:function(l,m){"undefined"!==typeof m&&(this.notifyResize(),Polymer.flush?Polymer.flush():Polymer.dom.flush(),l&&this._updateGridMetrics())},_itemsChanged:function(l){if("items"===l.path)this._physicalTop=this._virtualStart=0,this._virtualCount=this.items?this.items.length:0,this._collection=this.items&&Polymer.Collection?Polymer.Collection.get(this.items):null,this._physicalIndexForKey={},this._lastVisibleIndexVal=this._firstVisibleIndexVal= null,this._physicalCount=this._physicalCount||0,this._physicalItems=this._physicalItems||[],this._physicalSizes=this._physicalSizes||[],this._physicalStart=0,this._scrollTop>this._scrollOffset&&this._resetScrollPosition(0),this._removeFocusedItem(),this._debounce("_render",this._render,g);else if("items.splices"===l.path){this._adjustVirtualIndex(l.value.indexSplices);this._virtualCount=this.items?this.items.length:0;if(l.value.indexSplices.some(function(p){return 0<p.addedCount||0<p.removed.length})){var m= this._getActiveElement();this.contains(m)&&m.blur()}l=l.value.indexSplices.some(function(p){return p.index+p.addedCount>=this._virtualStart&&p.index<=this._virtualEnd},this);this._isClientFull()&&!l||this._debounce("_render",this._render,g)}else"items.length"!==l.path&&this._forwardItemPath(l.path,l.value)},_forwardItemPath:function(l,m){l=l.slice(6);var p=l.indexOf(".");-1===p&&(p=l.length);var n,t=this.modelForElement(this._offscreenFocusedItem);if(e){var v=parseInt(l.substring(0,p),10);if(n=this._isIndexRendered(v)){var x= this._getPhysicalIndex(v);var y=this.modelForElement(this._physicalItems[x])}else t&&(y=t);if(!y||y[this.indexAs]!==v)return}else if(v=l.substring(0,p),t&&t.__key__===v)y=t;else if(x=this._physicalIndexForKey[v],y=this.modelForElement(this._physicalItems[x]),!y||y.__key__!==v)return;l=l.substring(p+1);l=this.as+(l?"."+l:"");e?y._setPendingPropertyOrPath(l,m,!1,!0):y.notifyPath(l,m,!0);y._flushProperties&&y._flushProperties(!0);n&&(this._updateMetrics([x]),this._positionItems(),this._updateScrollerSize())}, _adjustVirtualIndex:function(l){l.forEach(function(m){m.removed.forEach(this._removeItem,this);m.index<this._virtualStart&&(m=Math.max(m.addedCount-m.removed.length,m.index-this._virtualStart),this._virtualStart+=m,0<=this._focusedVirtualIndex&&(this._focusedVirtualIndex+=m))},this)},_removeItem:function(l){this.$.selector.deselect(l);this._focusedItem&&this.modelForElement(this._focusedItem)[this.as]===l&&this._removeFocusedItem()},_iterateItems:function(l,m){var p,n;if(2===arguments.length&&m)for(n= 0;n<m.length;n++){var t=m[n];var v=this._computeVidx(t);if(null!=(p=l.call(this,t,v)))return p}else{t=this._physicalStart;for(v=this._virtualStart;t<this._physicalCount;t++,v++)if(null!=(p=l.call(this,t,v)))return p;for(t=0;t<this._physicalStart;t++,v++)if(null!=(p=l.call(this,t,v)))return p}},_computeVidx:function(l){return l>=this._physicalStart?this._virtualStart+(l-this._physicalStart):this._virtualStart+(this._physicalCount-this._physicalStart)+l},_assignModels:function(l){this._iterateItems(function(m, p){var n=this._physicalItems[m],t=this.items&&this.items[p];if(null!=t){var v=this.modelForElement(n);v.__key__=this._collection?this._collection.getKey(t):null;this._forwardProperty(v,this.as,t);this._forwardProperty(v,this.selectedAs,this.$.selector.isSelected(t));this._forwardProperty(v,this.indexAs,p);this._forwardProperty(v,"tabIndex",this._focusedVirtualIndex===p?0:-1);this._physicalIndexForKey[v.__key__]=m;v._flushProperties&&v._flushProperties(!0);n.removeAttribute("hidden")}else n.setAttribute("hidden", "")},l)},_updateMetrics:function(l){Polymer.flush?Polymer.flush():Polymer.dom.flush();var m=0,p=0,n=this._physicalAverageCount,t=this._physicalAverage;this._iterateItems(function(v){p+=this._physicalSizes[v];this._physicalSizes[v]=this._physicalItems[v].offsetHeight;m+=this._physicalSizes[v];this._physicalAverageCount+=this._physicalSizes[v]?1:0},l);this.grid?(this._updateGridMetrics(),this._physicalSize=Math.ceil(this._physicalCount/this._itemsPerRow)*this._rowHeight):(p=1===this._itemsPerRow?p: Math.ceil(this._physicalCount/this._itemsPerRow)*this._rowHeight,this._physicalSize=this._physicalSize+m-p,this._itemsPerRow=1);this._physicalAverageCount!==n&&(this._physicalAverage=Math.round((t*n+m)/this._physicalAverageCount))},_updateGridMetrics:function(){this._itemWidth=0<this._physicalCount?this._physicalItems[0].getBoundingClientRect().width:200;this._rowHeight=0<this._physicalCount?this._physicalItems[0].offsetHeight:200;this._itemsPerRow=this._itemWidth?Math.floor(this._viewportWidth/this._itemWidth): this._itemsPerRow},_positionItems:function(){this._adjustScrollPosition();var l=this._physicalTop;if(this.grid){var m=(this._viewportWidth-this._itemsPerRow*this._itemWidth)/2;this._iterateItems(function(p,n){var t=Math.floor(n%this._itemsPerRow*this._itemWidth+m);this._isRTL&&(t*=-1);this.translate3d(t+"px",l+"px",0,this._physicalItems[p]);this._shouldRenderNextRow(n)&&(l+=this._rowHeight)})}else this._iterateItems(function(p){this.translate3d(0,l+"px",0,this._physicalItems[p]);l+=this._physicalSizes[p]})}, _getPhysicalSizeIncrement:function(l){return this.grid?this._computeVidx(l)%this._itemsPerRow!==this._itemsPerRow-1?0:this._rowHeight:this._physicalSizes[l]},_shouldRenderNextRow:function(l){return l%this._itemsPerRow===this._itemsPerRow-1},_adjustScrollPosition:function(){var l=0===this._virtualStart?this._physicalTop:Math.min(this._scrollPosition+this._physicalTop,0);if(0!==l){this._physicalTop-=l;var m=this._scrollTop;!c&&0<m&&this._resetScrollPosition(m-l)}},_resetScrollPosition:function(l){this.scrollTarget&& 0<=l&&(this._scrollPosition=this._scrollTop=l)},_updateScrollerSize:function(l){this._estScrollHeight=this.grid?this._virtualRowCount*this._rowHeight:this._physicalBottom+Math.max(this._virtualCount-this._physicalCount-this._virtualStart,0)*this._physicalAverage;if((l=(l=(l=l||0===this._scrollHeight)||this._scrollPosition>=this._estScrollHeight-this._physicalSize)||this.grid&&this.$.items.style.height<this._estScrollHeight)||Math.abs(this._estScrollHeight-this._scrollHeight)>=this._viewportHeight)this.$.items.style.height= this._estScrollHeight+"px",this._scrollHeight=this._estScrollHeight},scrollToItem:function(l){return this.scrollToIndex(this.items.indexOf(l))},scrollToIndex:function(l){if(!("number"!==typeof l||0>l||l>this.items.length-1)&&(Polymer.flush?Polymer.flush():Polymer.dom.flush(),0!==this._physicalCount)){l=this._clamp(l,0,this._virtualCount-1);if(!this._isIndexRendered(l)||l>=this._maxVirtualStart)this._virtualStart=this.grid?l-2*this._itemsPerRow:l-1;this._manageFocus();this._assignModels();this._updateMetrics(); this._physicalTop=Math.floor(this._virtualStart/this._itemsPerRow)*this._physicalAverage;for(var m=this._physicalStart,p=this._virtualStart,n=0,t=this._hiddenContentSize;p<l&&n<=t;)n+=this._getPhysicalSizeIncrement(m),m=(m+1)%this._physicalCount,p++;this._updateScrollerSize(!0);this._positionItems();this._resetScrollPosition(this._physicalTop+this._scrollOffset+n);this._increasePoolIfNeeded(0);this._lastVisibleIndexVal=this._firstVisibleIndexVal=null}},_resetAverage:function(){this._physicalAverageCount= this._physicalAverage=0},_resizeHandler:function(){this._debounce("_render",function(){this._lastVisibleIndexVal=this._firstVisibleIndexVal=null;this.updateViewportBoundaries();this._isVisible?(this.toggleScrollListener(!0),this._resetAverage(),this._render()):this.toggleScrollListener(!1)},g)},selectItem:function(l){return this.selectIndex(this.items.indexOf(l))},selectIndex:function(l){if(!(0>l||l>=this._virtualCount)){!this.multiSelection&&this.selectedItem&&this.clearSelection();if(this._isIndexRendered(l)){var m= this.modelForElement(this._physicalItems[this._getPhysicalIndex(l)]);m&&(m[this.selectedAs]=!0);this.updateSizeForIndex(l)}this.$.selector.selectIndex?this.$.selector.selectIndex(l):this.$.selector.select(this.items[l])}},deselectItem:function(l){return this.deselectIndex(this.items.indexOf(l))},deselectIndex:function(l){0>l||l>=this._virtualCount||(this._isIndexRendered(l)&&(this.modelForElement(this._physicalItems[this._getPhysicalIndex(l)])[this.selectedAs]=!1,this.updateSizeForIndex(l)),this.$.selector.deselectIndex? this.$.selector.deselectIndex(l):this.$.selector.deselect(this.items[l]))},toggleSelectionForItem:function(l){return this.toggleSelectionForIndex(this.items.indexOf(l))},toggleSelectionForIndex:function(l){(this.$.selector.isIndexSelected?this.$.selector.isIndexSelected(l):this.$.selector.isSelected(this.items[l]))?this.deselectIndex(l):this.selectIndex(l)},clearSelection:function(){this._iterateItems(function(l){this.modelForElement(this._physicalItems[l])[this.selectedAs]=!1});this.$.selector.clearSelection()}, _selectionEnabledChanged:function(l){(l?this.listen:this.unlisten).call(this,this,"tap","_selectionHandler")},_selectionHandler:function(l){var m=this.modelForElement(l.target);if(m){var p=Polymer.dom(l).path[0];l=this._getActiveElement();var n=this._physicalItems[this._getPhysicalIndex(m[this.indexAs])];if("input"!==p.localName&&"button"!==p.localName&&"select"!==p.localName){p=m.tabIndex;m.tabIndex=-100;var t=l?l.tabIndex:-1;m.tabIndex=p;l&&n!==l&&n.contains(l)&&-100!==t||this.toggleSelectionForItem(m[this.as])}}}, _multiSelectionChanged:function(l){this.clearSelection();this.$.selector.multi=l},updateSizeForItem:function(l){return this.updateSizeForIndex(this.items.indexOf(l))},updateSizeForIndex:function(l){if(!this._isIndexRendered(l))return null;this._updateMetrics([this._getPhysicalIndex(l)]);this._positionItems();return null},_manageFocus:function(){var l=this._focusedVirtualIndex;0<=l&&l<this._virtualCount?this._isIndexRendered(l)?this._restoreFocusedItem():this._createFocusBackfillItem():0<this._virtualCount&& 0<this._physicalCount&&(this._focusedPhysicalIndex=this._physicalStart,this._focusedVirtualIndex=this._virtualStart,this._focusedItem=this._physicalItems[this._physicalStart])},_convertIndexToCompleteRow:function(l){this._itemsPerRow=this._itemsPerRow||1;return this.grid?Math.ceil(l/this._itemsPerRow)*this._itemsPerRow:l},_isIndexRendered:function(l){return l>=this._virtualStart&&l<=this._virtualEnd},_isIndexVisible:function(l){return l>=this.firstVisibleIndex&&l<=this.lastVisibleIndex},_getPhysicalIndex:function(l){return e? (this._physicalStart+(l-this._virtualStart))%this._physicalCount:this._physicalIndexForKey[this._collection.getKey(this.items[l])]},focusItem:function(l){this._focusPhysicalItem(l)},_focusPhysicalItem:function(l){if(!(0>l||l>=this._virtualCount)){this._restoreFocusedItem();this._isIndexRendered(l)||this.scrollToIndex(l);var m=this._physicalItems[this._getPhysicalIndex(l)],p=this.modelForElement(m),n;p.tabIndex=-100;-100===m.tabIndex&&(n=m);n||(n=Polymer.dom(m).querySelector('[tabindex\x3d"-100"]')); p.tabIndex=0;this._focusedVirtualIndex=l;n&&n.focus()}},_removeFocusedItem:function(){this._offscreenFocusedItem&&this._itemsParent.removeChild(this._offscreenFocusedItem);this._focusedItem=this._focusBackfillItem=this._offscreenFocusedItem=null;this._focusedPhysicalIndex=this._focusedVirtualIndex=-1},_createFocusBackfillItem:function(){var l=this._focusedPhysicalIndex;if(!(this._offscreenFocusedItem||0>this._focusedVirtualIndex)){if(!this._focusBackfillItem){var m=this.stamp(null);this._focusBackfillItem= m.root.querySelector("*");this._itemsParent.appendChild(m.root)}this._offscreenFocusedItem=this._physicalItems[l];this.modelForElement(this._offscreenFocusedItem).tabIndex=0;this._physicalItems[l]=this._focusBackfillItem;this._focusedPhysicalIndex=l;this.translate3d(0,"-10000px",0,this._offscreenFocusedItem)}},_restoreFocusedItem:function(){if(this._offscreenFocusedItem&&!(0>this._focusedVirtualIndex)){this._assignModels();var l=this._focusedPhysicalIndex=this._getPhysicalIndex(this._focusedVirtualIndex), m=this._physicalItems[l];if(m){var p=this.modelForElement(m),n=this.modelForElement(this._offscreenFocusedItem);p[this.as]===n[this.as]?(this._focusBackfillItem=m,p.tabIndex=-1,this._physicalItems[l]=this._offscreenFocusedItem,this.translate3d(0,"-10000px",0,this._focusBackfillItem)):(this._removeFocusedItem(),this._focusBackfillItem=null);this._offscreenFocusedItem=null}}},_didFocus:function(l){l=this.modelForElement(l.target);var m=this.modelForElement(this._focusedItem),p=null!==this._offscreenFocusedItem, n=this._focusedVirtualIndex;l&&(m===l?this._isIndexVisible(n)||this.scrollToIndex(n):(this._restoreFocusedItem(),m&&(m.tabIndex=-1),l.tabIndex=0,this._focusedVirtualIndex=n=l[this.indexAs],this._focusedPhysicalIndex=this._getPhysicalIndex(n),this._focusedItem=this._physicalItems[this._focusedPhysicalIndex],p&&!this._offscreenFocusedItem&&this._update()))},_keydownHandler:function(l){switch(l.keyCode){case 40:this._focusedVirtualIndex<this._virtualCount-1&&l.preventDefault();this._focusPhysicalItem(this._focusedVirtualIndex+ (this.grid?this._itemsPerRow:1));break;case 39:this.grid&&this._focusPhysicalItem(this._focusedVirtualIndex+(this._isRTL?-1:1));break;case 38:0<this._focusedVirtualIndex&&l.preventDefault();this._focusPhysicalItem(this._focusedVirtualIndex-(this.grid?this._itemsPerRow:1));break;case 37:this.grid&&this._focusPhysicalItem(this._focusedVirtualIndex+(this._isRTL?1:-1));break;case 13:this._focusPhysicalItem(this._focusedVirtualIndex),this.selectionEnabled&&this._selectionHandler(l)}},_clamp:function(l, m,p){return Math.min(p,Math.max(m,l))},_debounce:function(l,m,p){e?(this._debouncers=this._debouncers||{},this._debouncers[l]=Polymer.Debouncer.debounce(this._debouncers[l],p,m.bind(this)),Polymer.enqueueDebouncer(this._debouncers[l])):Polymer.dom.addDebouncer(this.debounce(l,m))},_forwardProperty:function(l,m,p){e?l._setPendingProperty(m,p):l[m]=p},_forwardHostPropV2:function(l,m){(this._physicalItems||[]).concat([this._offscreenFocusedItem,this._focusBackfillItem]).forEach(function(p){p&&this.modelForElement(p).forwardHostProp(l, m)},this)},_notifyInstancePropV2:function(l,m,p){Polymer.Path.matches(this.as,m)&&(l=l[this.indexAs],m==this.as&&(this.items[l]=p),this.notifyPath(Polymer.Path.translate(this.as,"items."+l,m),p))},_getStampedChildren:function(){return this._physicalItems},_forwardInstancePath:function(l,m,p){0===m.indexOf(this.as+".")&&this.notifyPath("items."+l.__key__+"."+m.slice(this.as.length+1),p)},_forwardParentPath:function(l,m){(this._physicalItems||[]).concat([this._offscreenFocusedItem,this._focusBackfillItem]).forEach(function(p){p&& this.modelForElement(p).notifyPath(l,m,!0)},this)},_forwardParentProp:function(l,m){(this._physicalItems||[]).concat([this._offscreenFocusedItem,this._focusBackfillItem]).forEach(function(p){p&&(this.modelForElement(p)[l]=m)},this)},_getActiveElement:function(){var l=this._itemsParent.node.domHost;return Polymer.dom(l?l.root:document).activeElement}})})(); //# sourceURL=build://facets-overview/components/facets-overview-row-stats/facets-overview-row-stats.js Polymer({is:"facets-overview-row-stats",properties:{stats:Object,showWeighted:Boolean,hasCustom:Boolean,dataModel:Object,datasetIndex:Number,compareMode:Boolean,_entries:{type:Array,computed:"_getEntries(stats, showWeighted, hasCustom)"}},observers:["_colorLegendBox(dataModel, datasetIndex, compareMode)"],_getEntries:function(b,c,e){return jt(b,c,e)},_colorLegendBox:function(b,c,e){const g=d3.select(this.shadowRoot.querySelector("#legend-box"));2>b.getDatasetNames().length&&!e?g.style("visibility", "hidden"):(g.style("visibility",null),g.style("background-color",b.getChartColorString(c)))}}); //# sourceURL=build://facets-overview/components/facets-overview-row-legend/facets-overview-row-legend.js Polymer({is:"facets-overview-row-legend",properties:{numeric:Boolean,showWeighted:Boolean,hasCustom:Boolean,dataModel:Object,_entries:{type:Array,computed:"_getEntries(numeric, showWeighted, hasCustom)"}},_getEntries:function(b,c,e){return ct(b,c,e)}}); //# sourceURL=build://facets-overview/components/facets-overview-chart/facets-overview-chart.js Polymer({is:"facets-overview-chart",properties:{data:{type:Object,observer:"_updateData"},dataModel:Object,feature:String,_maxBucketsForBarChart:{type:Number,value:10,readOnly:!0},_chartAlpha:{type:Number,value:1},logScale:Boolean,showWeighted:Boolean,showPercentage:Boolean,chartSelection:{type:Number,observer:"_updateChartSelection"},selection:{type:Object,observer:"_updateSelectionVisibility",notify:!0},expandChart:Boolean,_selectionElem:Object,_minBarHeightRatio:{type:Number,value:.01,readOnly:!0}, _onClick:Object,_onClickFunction:Object,_onPointer:Object,_onPointerEnterFunction:Object,_onPointerExitFunction:Object,_tableData:Array,_showTable:{type:Boolean,value:!1},_chartType:Object,_chartClass:{type:String,computed:"_getChartClass(_showTable)"},_chartSvgClass:{type:String,computed:"_getChartSvgClass(expandChart)"},_xAxisSvgClass:{type:String,computed:"_getXAxisSvgClass(expandChart)"},_tableDataClass:{type:String,computed:"_getTableDataClass(expandChart)"}},observers:["_render(data, logScale, showWeighted, chartSelection, _showTable, expandChart, showPercentage, dataModel)"], _updateData(){this._showTable=!1},_updateChartSelection(){this._showTable=!1},_hasWeightedHistogram(b){return Hs(b)},_hasQuantiles(b){return Is(b)},_isStringChart(b,c){return(b===Ts.CUMDIST_CHART||b===Ts.BAR_CHART)&&"Value list length"!==c&&"Feature list length"!==c},_disableLogCheckbox(b,c){return b||"Standard"!==c},_render(b,c,e,g,k,q,l,m){this._onPointer&&(this._onPointer.offPointerMove(this._onPointerEnterFunction),this._onPointer.offPointerMove(this._onPointerExitFunction));this._onClick&&this._onClick.offClick(this._onClickFunction); b&&(this._chartAlpha=m.getChartAlpha(),k=b.map(p=>this._getBuckets(p,e,g)),this._chartType=Vs(b,g,this._maxBucketsForBarChart),b=b.map(p=>p.name),"Value list length"===g||"Feature list length"===g||"Quantiles"===g?this._renderQuantileChart(k,b,c):this._chartType===Ts.HISTOGRAM?this._renderHistogramChart(k,b,c,l):this._chartType===Ts.CUMDIST_CHART?this._renderCdfChart(k,b,c):this._renderBarChart(k,b,c,l))},_renderHistogramChart(b,c,e,g){const k=[],q=new Plottable.Plots.Rectangle;let l=Infinity,m=-Infinity, p=0;g&&(b=kt(b));b.forEach((x,y)=>{x.forEach(z=>{const A=vs(z.getLowValue()),D=vs(z.getHighValue());z=vs(z.getSampleCount());A<l&&(l=A);D>m&&(m=D);z>p&&(p=z);isFinite(A)&&isFinite(D)&&k.push(D-A)});q.addDataset(new Plottable.Dataset(x,{name:c[y]}))});let n=0<k.length?k.reduce(function(x,y){return x+y})/k.length:0;0===n&&(n=1);g=[];isFinite(l)&&(g.push(l),isFinite(m)&&g.push(m));b=new Plottable.Scales.Linear;0<g.length&&b.domain(g);g=this._getScale(e).domain([0]);const t=new Plottable.Axes.Numeric(b, "bottom"),v=new Plottable.Axes.Numeric(g,"left");v.formatter(this._chartAxisScaleFormatter());t.formatter(this._chartAxisScaleFormatter());q.x(x=>{let y=vs(x.getLowValue());if(-Infinity===y||y===x.getHighValue())x=vs(x.getHighValue()),isFinite(x)?y=x-n:(y=0,-Infinity===x&&(y-=n));return y},b).x2(x=>{let y=vs(x.getHighValue());if(Infinity===y||y===x.getLowValue())x=vs(x.getLowValue()),isFinite(x)?y=x+n:(y=0,Infinity===x&&(y+=n));return y}).y(()=>0,g).y2(x=>this._getCountWithFloor(x,p,e));q.attr("fill", (x,y,z)=>z.metadata().name,this.dataModel.getColorScale()).attr("opacity",this._chartAlpha);this._renderChart(q,t,v,null,null,x=>q.entitiesAt(x),x=>ps(vs(x.getLowValue()),2).toLocaleString()+"-"+ps(vs(x.getHighValue()),2).toLocaleString()+": "+vs(x.getSampleCount()).toLocaleString(),x=>new ms(this.feature,void 0,vs(x.getLowValue()),vs(x.getHighValue())),x=>x.append("rect").attr("stroke","black").attr("fill","none").attr("stroke-width","1px"),(x,y)=>x.attr("x",y.position.x-y.selection._groups[0][0].width.baseVal.value/ 2).attr("y",y.position.y-y.selection._groups[0][0].height.baseVal.value/2).attr("width",y.selection._groups[0][0].width.baseVal.value).attr("height",y.selection._groups[0][0].height.baseVal.value))},_renderQuantileChart(b,c,e){const g=new Plottable.Plots.Line,k=new Plottable.Plots.Scatter;let q=Infinity,l=-Infinity;b.forEach((n,t)=>{const v=[],x=n.length;n.forEach((y,z)=>{var A=vs(y.getLowValue());const D=vs(y.getHighValue());A<q&&(q=A);D>l&&(l=D);A=new Zp;A.bucket=y;A.datasetIndex=t;A.quantile=100* z/x;v.push(A)});if(0<n.length){const y=new am;y.setLowValue(n[n.length-1].getHighValue());y.setHighValue(n[n.length-1].getHighValue());y.setSampleCount(n[n.length-1].getSampleCount());n=new Zp;n.bucket=y;n.datasetIndex=t;n.quantile=100;v.push(n)}g.addDataset(new Plottable.Dataset(v,{name:c[t]}));k.addDataset(new Plottable.Dataset(v,{name:c[t]}))});const m=isFinite(q)&&isFinite(l)?l===q?1:(l-q)/10:0;var p=[];isFinite(q)&&(p.push(q-m),isFinite(l)&&p.push(l+m));e=this._getScale(e);0<p.length&&e.domain(p); p=this._getScale(!1).domain([-b.length+.5,1]);b=new Plottable.Axes.Numeric(e,"bottom");b.formatter(this._chartAxisScaleFormatter());g.x(n=>vs(n.bucket.getLowValue()),e).y(n=>-1*n.datasetIndex,p);k.x(n=>vs(n.bucket.getLowValue()),e).y(n=>-n.datasetIndex,p).size(n=>50===n.quantile?15:8).symbol(()=>Plottable.SymbolFactories.cross());g.attr("stroke","gray").attr("opacity",this._chartAlpha);k.attr("fill",(n,t,v)=>v.metadata().name,this.dataModel.getColorScale()).attr("opacity",this._chartAlpha);p=new Plottable.Components.Group([g, k]);this._renderChart(p,b,null,null,null,n=>k.entitiesAt(n),n=>n.quantile+"%: "+ps(vs(n.bucket.getLowValue()),2).toLocaleString(),n=>new ms(this.feature,void 0,vs(n.bucket.getLowValue()),vs(n.bucket.getHighValue())),n=>n.append("circle").attr("r",3).attr("stroke","black").attr("fill","none").attr("stroke-width","1px"),(n,t)=>n.attr("cx",t.position.x).attr("cy",t.position.y))},_renderBarChart(b,c,e,g){const k=ss(b),q=new Plottable.Scales.Linear;var l=new Plottable.Scales.Category;const m=this._getScale(e); l.domain(k);l=new Plottable.Axes.Category(l,"bottom");const p=new Plottable.Axes.Numeric(m,"left");p.formatter(this._chartAxisScaleFormatter());g&&(b=kt(b));let n=0;g=b.map((v,x)=>{v.forEach(z=>{z=vs(z.getSampleCount());z>n&&(n=z)});const y=new Ps;y.name=c[x];y.rawBuckets=v;return y});this._tableData=Ss(g,k);const t=new Plottable.Plots.Bar;b.forEach((v,x)=>t.addDataset(new Plottable.Dataset(v,{name:c[x]})));t.x(v=>k.indexOf(ts(v.getLabel())),q).y(v=>this._getCountWithFloor(v,n,e),m);t.attr("fill", (v,x,y)=>y.metadata().name,this.dataModel.getColorScale()).attr("opacity",this._chartAlpha);this._renderChart(t,l,p,null,null,v=>t.entitiesAt(v),v=>ts(v.getLabel())+": "+vs(v.getSampleCount()).toLocaleString(),v=>new ms(this.feature,v.getLabel()),v=>v.append("rect").attr("stroke","black").attr("fill","none").attr("stroke-width","1px"),(v,x)=>v.attr("x",x.position.x-x.selection._groups[0][0].width.baseVal.value/2).attr("y",x.position.y).attr("width",x.selection._groups[0][0].width.baseVal.value).attr("height", x.selection._groups[0][0].height.baseVal.value))},_renderCdfChart(b,c,e){const g=c.map(t=>{t=this.dataModel.getFeatureCommonStats(this.feature,t);return null!=t?t.getNumNonMissing()*t.getAvgNumValues():0}),k=ss(b),q={};k.forEach((t,v)=>{q[t]=v});const l=(new Plottable.Scales.Linear).domain([0]);e=this._getScale(e).domain([0]);const m=new Plottable.Axes.Numeric(l,"bottom"),p=new Plottable.Axes.Numeric(e,"left"),n=new Plottable.Plots.Line;b=b.map((t,v)=>{const x=[],y=[],z=[];let A=-1;t.forEach(D=>{D= D.cloneMessage();z.push(D)});0<v&&z.sort((D,H)=>q[ts(D.getLabel())]-q[ts(H.getLabel())]);z.forEach((D,H)=>{const E=q[ts(D.getLabel())];for(var F=A+1;F<E;F++){var J=new dm;J.setLabel(k[F]);J.setLowRank(F);J.setHighRank(F);0===x.length?J.setSampleCount(0):J.setSampleCount(x[x.length-1].getSampleCount());x.push(J);J=new dm;J.setLabel(k[F]);J.setLowRank(F);J.setHighRank(F);J.setSampleCount(0);y.push(J)}A=E;F=D.clone();y.push(F);0===H?D.setSampleCount(vs(D.getSampleCount())/g[v]):(H=0<E?E-1:H-1,D.setSampleCount(vs(D.getSampleCount())/ g[v]+vs(x[H].getSampleCount())));D.setLowRank(E);D.setHighRank(E);x.push(D)});t=new Ps;t.name=c[v];t.percBuckets=x;t.rawBuckets=y;return t});this._tableData=Rs(b);for(const t of b)n.addDataset(new Plottable.Dataset(t.percBuckets,{name:t.name}));n.x(t=>vs(t.getLowRank()),l).y(t=>vs(t.getSampleCount()),e);n.attr("stroke",(t,v,x)=>x.metadata().name,this.dataModel.getColorScale()).attr("opacity",this._chartAlpha);this._renderChart(n,m,p,null,null,t=>n.entitiesAt(t),t=>ts(t.getLabel())+": "+ps(vs(t.getSampleCount()), 4).toLocaleString(),t=>new ms(this.feature,t.getLabel()),t=>t.append("circle").attr("r",3).attr("stroke","black").attr("fill","none").attr("stroke-width","1px"),(t,v)=>t.attr("cx",v.position.x).attr("cy",v.position.y))},_renderChart(b,c,e,g,k,q,l,m,p,n){if(!this._showTable){var t=new Plottable.Components.Table([[k,e,b],[null,null,null]]),v=new Plottable.Components.Table([[null,null],[null,c]]);Plottable.RenderController.renderPolicy();var x=d3.select(this.$.chart),y=d3.select(this.$.xaxis),z=d3.select(this.$.tooltip); this.async(()=>{x.selectAll(".component").remove();y.selectAll(".component").remove();t.renderTo(this.$.chart);this._selectionElem=p(b.foreground());this._updateSelectionVisibility(this.selection);x.on("mouseenter",()=>{this._onPointer=new plottable_helpers.PointerInteraction;this._onPointerEnterFunction=A=>{A=q(A);0<A.length&&(A=A.map(D=>null==D.dataset.metadata().name||1===this.dataModel.getDatasetNames().length?l(D.datum):D.dataset.metadata().name+": "+l(D.datum)).join("\n"),z.text(A),z.style("opacity", "1"))};this._onPointer.onPointerMove(this._onPointerEnterFunction);this._onPointerExitFunction=function(){z.style("opacity","0")};this._onPointer.onPointerExit(this._onPointerExitFunction);this._onPointer.attachTo(b);if("Value list length"!==this.chartSelection){this._onClick=new Plottable.Interactions.Click;const A=this;this._onClickFunction=D=>{D=q(D);0<D.length&&(n(A._selectionElem,D[0]),D=m(D[0].datum),A._setSelection(D))};this._onClick.onClick(this._onClickFunction);this._onClick.attachTo(b)}}).on("mouseleave", ()=>{this._onPointer.detachFrom();this._onClick.detachFrom()});null!=e&&v.columnPadding(t.componentAt(1).width()+(t.componentAt(0)?t.componentAt(0).width():0));v.renderTo(this.$.xaxis)})}},_setSelection(b){b.equals(this.selection)&&b.clear();this.selection=b;this.fire("feature-select",{selection:b})},_getBuckets(b,c,e){return qs(b,c,e)},_getScale(b){return b?new Plottable.Scales.ModifiedLog:new Plottable.Scales.Linear},_chartAxisScaleFormatter(){const b=Plottable.Formatters.shortScale();return c=> 1E3>Math.abs(c)?String(c):b(c)},_getCountWithFloor(b,c,e){b=vs(b.getSampleCount());!e&&0<b&&b/c<this._minBarHeightRatio&&(b=c*this._minBarHeightRatio);return b},_updateSelectionVisibility(b){this._selectionElem&&this._selectionElem.style("display",null==b||b.name!==this.feature?"none":"inline")},_toggleShowTable(){this._showTable=!this._showTable},_getChartClass(b){return b?"hidechart":"showchart"},_getShowTableButtonText(b){return b?"show chart":"show raw data"},_getChartSvgClass(b){return b?"chart-big": "chart-small"},_getXAxisSvgClass(b){return b?"xaxis-big":"xaxis-small"},_getTableDataClass(b){return b?"data-list-big":"data-list-small"},_rowClick(b){this._setSelection(new ms(this.feature,b.currentTarget.dataValue))},_getEntryRowValue(b){return b.value},_getEntryRowClass(b,c){let e="dialog-row";null!=c&&c.name===this.feature&&c.stringValue===b.value&&(e+=" selected");return e},_getCountCellClass(b){return"dailog-row-entry count-cell"+(b?" weighted-cell":"")}}); //# sourceURL=build://facets-overview/components/facets-overview-table/facets-overview-table.js Polymer({is:"facets-overview-table",properties:{dataModel:{type:Object,observer:"_handleResize"},features:{type:Array,observer:"_handleResize"},featureSliceSelection:{type:Object,notify:!0},numeric:{type:Boolean,value:!1},compareMode:{type:Boolean,value:!1},_logScale:{type:Boolean,value:!1},_expandCharts:{type:Boolean,value:!1,observer:"_handleResize"},_showWeighted:{type:Boolean,value:!1},_showPercentage:{type:Boolean,value:!1},_chartSelection:{type:String,value:"Standard"},_enableLogScale:{type:Boolean, value:!0},_chartSelectionTypes:{type:Array,computed:"_computeChartSelectionTypes(numeric, dataModel, features)"},_maxHeight:{type:Number,value:800,readOnly:!0},_expandedRowHeight:{type:Number,value:330,readOnly:!0},_rowHeight:{type:Number,value:100,readOnly:!0}},_handleResize(){const b=this.shadowRoot.querySelector("iron-list");b&&this._expandedRowHeight&&this._rowHeight&&this._maxHeight&&this.features&&(b.style.height=Math.min((this.features?this.features.length:0)*(this._expandCharts?this._expandedRowHeight: this._rowHeight),this._maxHeight)+"px",b.fire("iron-resize"))},_computeChartSelectionTypes(b,c,e){const g=["Standard"];b&&g.push("Quantiles");0!==e.length&&Js(this._getChartData(c,e[0]))&&g.push("Value list length");c.doesContainFeatureListLengthData()&&g.push("Feature list length");return g.concat(c.getExtraHistogramNames(e))},attached(){setTimeout(()=>{this._handleResize()},1E3)},_chartSelectionHasQuantiles(b){return Us(b)},_getTitle(b){return b?"Numeric":"Categorical"},_getFeatureName(b){return b.getName()}, _hasCustomStats(b){return null==b?!1:b.doesContainCustomStats()},_hasMultipleDatasets(b){return null==b?!1:1<b.getDatasetNames().length},_getAllCustomStats(b,c){const e=[],g={};b.getDatasetFeatureStatistics().getDatasetsList().forEach(k=>{const q=b.getFeatureIndex(k.getName(),c.getName());null!=q&&(k=k.getFeaturesList()[q].getCustomStatsList())&&k.forEach(l=>{g[l.getName()]||(g[l.getName()]=!0,e.push(l))})});return e},_getDatasets(b){return b?b.getDatasetFeatureStatistics().getDatasetsList():null}, _getStats(b,c,e){return b&&c&&e?b.getFeature(e.getName(),c.getName()):null},_getChartData(b,c){return b&&c?b.getDatasetHistogramsForFeature(c.getName()):[]},_getFeatureCountText(b,c,e){b=b?b.getNumUniqueFeaturesByType(c):0;return As(e.length,b)},_hasWeightedHistogram(b){return 0===b.length?!1:Hs(this._getChartData(this.dataModel,b[0]))},_getChartClass(b){let c="chart-column ";b||(c+="table-cell ");return c},_getTableWrapperClass(b){return b&&0!==b.length?"":"hidden"},_getTableRowClass(b){return b? "numeric-row":"categorical-row"}}); //# sourceURL=build://iron-validator-behavior/iron-validator-behavior.html.js Polymer.IronValidatorBehavior={ready:function(){new Polymer.IronMeta({type:"validator",key:this.is||this.constructor.is,value:this})},validate:function(){}}; //# sourceURL=build://facets-overview/components/facets-overview/facets-overview-filter-validator.html.js Polymer({is:"facets-overview-filter-validator",behaviors:[Polymer.IronValidatorBehavior],validate:function(b){try{return new RegExp(b),!0}catch(c){return!1}}}); //# sourceURL=build://facets-overview/components/facets-overview/facets-overview.js Polymer({is:"facets-overview",properties:{searchString:{type:String,notify:!0},_sortOptions:Array,_reverseOrder:Boolean,_sortOrder:{type:Number,value:0},protoInput:{type:Object,observer:"_update"},featureSliceSelection:{type:Object,notify:!0},compareMode:{type:Boolean,value:!1},_dataModel:{type:Object,value:null},_featureSpecArray:{type:Array,computed:"_getFeatureSpecArray(_dataModel)"},_featureSpecCheckboxes:Array},_getFeatureSpecArray(b){if(!b)return[];const c=[];for(let e=0;16>e;e++)c.push(!0); this._featureSpecCheckboxes=c;return b.getNonEmptyFeatureSpecLists()},_getSpecCheckboxText(b){return Ls(b.spec)+"("+b.features.length+")"},_getSpecCheckboxId(b){return String(b.spec)},_featureSpecCheck(b){if(b){const c=[],e=+b.target.id;for(let g=0;16>g;g++)e===g?c.push(b.target.checked):c.push(this._featureSpecCheckboxes[g]);this._featureSpecCheckboxes=c}},_convertInputToProto(b){if(!b||b.constructor===Object&&0===Object.keys(b).length)return null;if(b instanceof Uint8Array)return gm(b);if("string"=== typeof b||b instanceof String){b=atob(b);const c=new Uint8Array(b.length);for(let e=0;e<b.length;e++)c[e]=b.charCodeAt(e);return gm(c)}return b.constructor===Object&&"function"===typeof Bl.fromObject?Bl.fromObject(b):b},_update(){this.featureSliceSelection=null;let b;{const g=this._convertInputToProto(this.protoInput);if(!g){this._dataModel=null;return}b=new lt(Cs(g))}this.set("_sortOptions",[{name:"Feature order",map:{}},{name:"Non-uniformity",map:{}},{name:"Alphabetical",map:{}},{name:"Amount missing/zero", map:{}}]);const c=b.getDatasetFeatureStatistics().getDatasetsList(),e=1<c.length;e&&this.push("_sortOptions",{name:"Distribution distance",map:{}});b.getUniqueFeatures().forEach((g,k)=>{this._sortOptions[0].map[g.getName()]=k;k=b.getDatasetHistogramsForFeature(g.getName());this._sortOptions[1].map[g.getName()]=k.reduce((q,l)=>{l=l.histMap.Standard?ns(l.histMap.Standard.getBucketsList()):1;return Math.min(q,l)},1);this._sortOptions[2].map[g.getName()]=g.getName();this._sortOptions[3].map[g.getName()]= c.reduce((q,l)=>{l=this._getStats(b,l,g);l=-1*ws(l);return Math.min(q,l)},0);e&&(this._sortOptions[4].map[g.getName()]=-1*ys(k))},this);this._dataModel=b},_getStats(b,c,e){return b&&c&&e?b.getFeature(e.getName(),c.getName()):null},_getSortFunction(b,c){const e=this._sortOptions[b].map,g=c?-1:1;return(k,q)=>{k=e[k.getName()];q=e[q.getName()];return"undefined"==typeof k||"undefined"==typeof q?0:g*(k<q?-1:1)}},_getFilter(b){if(b)try{const c=new RegExp(b,"i");return e=>c.test(e.getName())}catch(c){return null}else return null}, _getNumericFeatureListItems(b,c,e,g,k){return this._getFeatureListItems(b,c,e,g,k,!0)},_getNonNumericFeatureListItems(b,c,e,g,k){return this._getFeatureListItems(b,c,e,g,k,!1)},_getFeatureListItems(b,c,e,g,k,q){if(!b)return[];const l=this._getFilter(c);c=b.getUniqueFeatures();c=l?c.filter(m=>l(m)&&k[b.getFeatureSpecForFeature(m.getName())]):c.filter(m=>k[b.getFeatureSpecForFeature(m.getName())]);c=c.filter(m=>q?Bs(m):!Bs(m));return c.slice().sort(this._getSortFunction(e,g))},_getControlsWrapperClass(b){return!b|| 1>=b.getUniqueFeatures().length?"hidden":""},_getDatasetName(b,c){return b.getDatasetNames()[c]},_getLegendBoxStyle(b,c){return"background-color:"+b.getChartColorString(c)},_getDatasets(b){return b?b.getDatasetFeatureStatistics().getDatasetsList():null},_hasMultipleDatasets(b){return null==b?!1:1<b.getDatasetNames().length},getStatsProto(b){return Qp(b)}}); //# sourceURL=build://wit-dashboard/wit-dashboard.html.js const mt=d3.interpolateRgb;function nt(b){b&&b.parentElement&&b.parentElement.removeChild(b)}function ot(b){return JSON.parse(JSON.stringify(b))} (function(){Polymer({is:"wit-dashboard",properties:{_requestManager:{type:Object,value:()=>new Qo.RequestManager},_canceller:{type:Object,value:()=>new Qo.Canceller},examplesPath:{type:String},modelName:{type:String,observer:"modelNameChanged_"},parsedModelNames:{type:String},inferenceAddress:{type:String},modelType:{type:String},modelSignature:{type:String},modelVersion:{type:String},maxExamples:{type:Number},labelVocabPath:{type:String},maxInferenceEntriesPerRun:Number,numPrimaryBuckets:{type:Number, value:2,observer:"breakdownFeatureSelected_"},numSecondaryBuckets:{type:Number,value:2,observer:"breakdownFeatureSelected_"},inferences:{type:Object,observer:"newInferences_",value:()=>({})},extraOutputs:{type:Object,observer:"newExtraOutputs_"},attributions:{type:Object,value:{indices:[],attributions:[]},observer:"newAttributions_"},allAttributions_:{type:Array,value:()=>[]},meanAttributions_:{type:Array,value:()=>[]},facetedMeanAttributions_:{type:Object,value:()=>{}},minAttribution:{type:Number, value:0},maxAttribution:{type:Number,value:0},attributionColorScale:Object,examplesAndInferences:{type:Array,value:()=>[],observer:"computeSelectedExampleAndInference"},selectedExampleAndInference:{type:Object},counterfactualExampleAndInference:{type:Object},visdata:{type:Array,value:()=>[]},selected:{type:Array,value:()=>[],observer:"computeSelectedExampleAndInference"},comparedIndices:{type:Array,value:()=>[]},labelVocab:{type:Array,value:()=>[]},updatedExample:{type:Boolean,value:!1},imageFeatureName:{type:String, value:"image/encoded",readonly:!0},stats:Object,selectedBreakdownFeature:{type:String,value:"",observer:"breakdownFeatureSelected_"},selectedSecondBreakdownFeature:{type:String,value:"",observer:"breakdownFeatureSelected_"},customDistanceFunctionSet:{type:Boolean,value:!1,observer:"customDistanceFunctionSetChanged_"},selectedLabelFeature:{type:String,value:"",observer:"labelFeatureSelected_"},nearestCounterfactualModelIndex:{type:Number,value:0},nearestCounterfactualValueIndex:{type:Number,value:0}, attributionModelIndex:{type:Number,value:0,observer:"setAttributions"},inferenceStats_:{type:Array,value:()=>[]},aucs_:{type:Object,value:()=>{}},featureValueThresholds:{type:Array,value:()=>[],observer:"featureValueThresholdsChanged_"},featureValueThresholdsIndexMap:Object,defaultInferenceLabel:{type:Number,value:0,observer:"refreshInferences_"},overallThresholds:{type:Array,value:()=>[]},sideTabSelected:{type:Number,value:0,observer:"sideTabSelectedChanged_"},local:{type:Boolean,value:!1,observer:"localChanged_"}, localAtlasUrl:String,partialDepPlotEligibleFeatures:{type:Array,value:()=>[],observer:"partialDepPlotEligibleFeaturesSet"},partialDepPlotPendingFeatures:{type:Array,value:()=>[]},exampleDisplayMode:{type:String,value:"stacked"},featureSearchValue:String,incorrectPredCostRatio:{type:Number,value:1,observer:"costRatioChanged_"},multiClass:{type:Boolean},sequenceExamples:{type:Boolean},samplingOdds:{type:Number},usePredictApi:{type:Boolean},predictOutputTensor:{type:String},predictInputTensor:{type:String}, axisPrecision:{type:Number,value:2},distanceStats_:{type:Object},facetDistSwitch:{type:String,value:"L1"},distanceValueSwitch:{type:String,value:"values"},facetDistFeatureName:{type:String},facetDistFeatureNames:{type:Array,value:()=>[]},facetDistSetting:{type:String,value:"colorBy"},exampleStatusStr:{type:String,value:"No datapoints loaded yet"},selectedExampleNum:{type:Number,value:"",observer:"selectedExampleInputChanged_"},selectedExampleMax:Number,openedContextTools:{type:Boolean,value:!0},openedPerformance:{type:Boolean, value:!0},openedTrueLabel:{type:Boolean,value:!0},openedExplorer:{type:Boolean,value:!0},openedInferenceResults:{type:Boolean,value:!0},regressionEntries_:{type:Array},nearestCounterfactualDist:{type:String,value:"L1"},minCounterfactualValueDist:Number,maxCounterfactualValueDist:Number,visMode:{type:String,value:"dive",observer:"visModeChanged_"},optimizationSelected:{type:String,value:"custom",observer:"optimizationSelectedChanged_"},compareTitle:{type:String,value:"Attribution value(s)"},attribution:{type:Object, value:()=>({})},globalPdPlots:{type:Boolean,value:!0},numModels:{type:Number,readOnly:!0},showNearestCounterfactual:{type:Boolean,value:!1},selectedFeatureSort:{type:String,value:"Count",observer:"selectedFeatureSortChanged_"},pdPlotColors:{type:Array,value:()=>[d3.color("rgb(31, 119, 180)"),d3.color("rgb(255, 127, 14)"),d3.color("rgb(44, 160, 44)"),d3.color("rgb(214, 39, 40)"),d3.color("rgb(148, 103, 189)"),d3.color("rgb(140, 86, 75)"),d3.color("rgb(227, 119, 194)"),d3.color("rgb(127, 127, 127)"), d3.color("rgb(188, 189, 34)"),d3.color("rgb(23, 190, 207)")]},pdPlotTransparentColors:{type:Array,value:()=>[d3.color("rgba(31, 119, 180, 0.3)"),d3.color("rgba(255, 127, 14, 0.3)"),d3.color("rgba(44, 160, 44, 0.3)"),d3.color("rgba(214, 39, 40, 0.3)"),d3.color("rgba(148, 103, 189, 0.3)"),d3.color("rgba(140, 86, 75, 0.3)"),d3.color("rgba(227, 119, 194, 0.3)"),d3.color("rgba(127, 127, 127, 0.3)"),d3.color("rgba(188, 189, 34, 0.3)"),d3.color("rgba(23, 190, 207, 0.3)")]},rocCurveColors:{type:Array,value:()=> [d3.color("rgb(18, 181, 206)"),d3.color("rgb(250, 120, 23)")]},rocCurveLineColors:{type:Array,value:()=>[d3.color("rgba(18, 181, 206, 0.6)"),d3.color("rgba(250, 120, 23, 0.6)")]},confMatrixColors:{type:Array,value:()=>[d3.color("rgb(18, 181, 206)"),d3.color("rgb(250, 120, 23)")]},allConfMatrixLabels:{type:Array,value:()=>[]},loadingBarHidden_:{type:Boolean,value:!0},isSortingEligibleFeatures:{type:Boolean,value:!1},exampleFeatureSortOrder:{type:String,value:"attribution"},featureBucketEdges_:{type:Object, value:()=>({})},attributionTextColorFunction:{type:Object,value:()=>function(b,c,e){b=(b-c)/(e-c);return(0>c&&0<e?.3>b||.7<b:0>this.minSal?.6>b:.4<b)?"#fff":"#3c4043"}}},observers:["setFacetDistFeatureName(facetDistSwitch, selected, distanceValueSwitch, attributionModelIndex)","nearestCounterfactualStatusChanged_(showNearestCounterfactual, nearestCounterfactualModelIndex, nearestCounterfactualDist, minCounterfactualValueDist, nearestCounterfactualValueIndex, attributionModelIndex)"],reload:function(){}, openDialog:function(b){b.stopPropagation();b.target.parentElement.querySelector("paper-dialog").open()},ready:function(){const b=d3.select(this.$.side),c=d3.select(this.$.center),e=this.$.resizer,g=this,k=d3.drag().on("drag",()=>{let q=d3.mouse(e.parentNode.parentNode)[0]/e.parentNode.parentNode.offsetWidth*100;q=Math.max(q,20);c.style("width",100-q+"%");b.style("width",q+"%");g.$.dive.$.vis._updateGridFaceting();g.$.dive.$.vis._onIronResize()});d3.select(e).call(k)},attached:function(){this._requestManager.request(Qo.getRouter().pluginsListing()).then(b=> {"whatif"in b?this.$.initialDialog.closeDialog():(this.$.inferencesettings.close(),this.$.initialDialog.openNoTensorFlowDialog())})},settingsClicked_:function(){this.$.inferencesettings.toggle()},localChanged_:function(){this.local&&this.closeSettings_()},modelNameChanged_:function(){this.parsedModelNames=this.modelName.split(",").map(b=>b.trim());for(let b=0;b<this.parsedModelNames.length;b++){const c=this.parsedModelNames[b];for(let e=b+1;e<this.parsedModelNames.length;e++)this.parsedModelNames[e]== c&&(this.parsedModelNames[b]=c+" "+(b+1),this.parsedModelNames[e]=c+" "+(e+1))}},closeSettings_:function(){this.$.inferencesettings.close()},showDistanceClicked_:function(){this.$.distancedialog.toggle()},customDistanceFunctionSetChanged_:function(){this.facetDistSwitch=this.customDistanceFunctionSet?this.nearestCounterfactualDist="Custom":this.nearestCounterfactualDist="L1"},requestAddDistanceMetric:function(){const b=this.selected[0],c={callbackParams:{featureName:this.facetDistFeatureName},distanceParams:{}}; if(this.local&&this.customDistanceFunctionSet)this.requestDistanceWithCallback(b,1,c);else{const e=[],g="L2"==this.facetDistSwitch,k="values"==this.distanceValueSwitch;for(let q=0;q<this.visdata.length;q++)e.push(this.getDist(this.visdata[b],this.visdata[q],g,k));this.finalizeAddDistanceMetric(b,e,c.callbackParams)}},invokeCustomDistanceCallback:function(b){switch(b.funId){case 0:this.finalizeClosestCounterfactual(b.exInd,b.distances,b.params);break;case 1:this.finalizeAddDistanceMetric(b.exInd,b.distances, b.params)}},finalizeAddDistanceMetric:function(b,c,e){b=e.featureName;this.facetDistFeatureNames.push(b);for(e=0;e<this.visdata.length;e++)this.visdata[e][b]=c[e];this.refreshDive_();"colorBy"==this.facetDistSetting?this.$.dive.colorBy=b:"verticalFacet"==this.facetDistSetting?this.$.dive.verticalFacet=b:"horizontalFacet"==this.facetDistSetting?this.$.dive.horizontalFacet=b:"verticalPosition"==this.facetDistSetting?this.$.dive.verticalPosition=b:"horizontalPosition"==this.facetDistSetting&&(this.$.dive.horizontalPosition= b)},setFacetDistFeatureName:function(b,c,e,g){this.facetDistFeatureName=" "+b+("values"===e?"":1===this.numModels?" attributions":" attributions for model "+this.getModelName_(g))+" distance to datapoint "+c[0]},nearestCounterfactualStatusChanged_:function(b){b?(this.findClosestCounterfactual_(),this.compareTitle="Counterfactual value(s)"):(this.compareTitle="Attribution value(s)",this.comparedIndices=[],this.counterfactualExampleAndInference=null,this.refreshSelectedDatapoint_())},refreshSelectedDatapoint_:function(){const b= this.selectedExampleAndInference;this.selectedExampleAndInference=null;this.selectedExampleAndInference=b},isSameInferenceClass_:function(b,c){return this.isRegression_(this.modelType)?Math.abs(b-c)<this.minCounterfactualValueDist:b===c},adjustMaxCounterfactualValueDist_:function(b,c){this.maxCounterfactualValueDist=Math.max(this.stats[c].numberMax-this.visdata[b][c],this.visdata[b][c]-this.stats[c].numberMin)},adjustMinCounterfactualValueDist_:function(){const b=this.distanceStats_[this.strWithModelName_(" Inference value", this.nearestCounterfactualModelIndex)];this.minCounterfactualValueDist=b?b.stdDev:0},finalizeClosestCounterfactual:function(b,c){const e=this.strWithModelName_(" Inference value",this.nearestCounterfactualModelIndex);this.isRegression_(this.modelType)&&this.adjustMaxCounterfactualValueDist_(b,e);let g=Number.POSITIVE_INFINITY,k=-1;for(let q=0;q<this.visdata.length;q++){if(q===b||this.isSameInferenceClass_(this.visdata[b][e],this.visdata[q][e]))continue;let l=c[q];l<g&&(g=l,k=q)}-1!=k&&(this.comparedIndices= [k],this.counterfactualExampleAndInference=this.examplesAndInferences[k])},findClosestCounterfactual_:function(){const b=this.selected[0];if(this.local&&this.customDistanceFunctionSet)this.requestDistanceWithCallback(b,0,{callbackParams:{},distanceParams:{}});else{var c=this.strWithModelName_(" Inference value",this.nearestCounterfactualModelIndex);this.isRegression_(this.modelType)&&this.adjustMaxCounterfactualValueDist_(b,c);var e=Number.POSITIVE_INFINITY,g=-1;for(let k=0;k<this.visdata.length;k++){if(k=== b||this.isSameInferenceClass_(this.visdata[b][c],this.visdata[k][c]))continue;let q=this.getDist(this.visdata[b],this.visdata[k],"L2"==this.nearestCounterfactualDist,0==this.nearestCounterfactualValueIndex);q<e&&(e=q,g=k)}-1!=g&&(this.comparedIndices=[g],this.counterfactualExampleAndInference=this.examplesAndInferences[g],this.compareTitle="Counterfactual value(s)")}},requestDistanceWithCallback:function(b,c,e){this.fire("compute-custom-distance",{index:b,callback:c,params:e})},getDist:function(b, c,e,g){let k=0;const q=[...new Set([...Object.keys(b),...Object.keys(c)])];for(let m=0;m<q.length;m++){var l=q[m];if(this.isComputedKeyStr_(l)||l==this.selectedLabelFeature||!this.distanceStats_[l].isNumeric&&this.stats[l].uniqueCount==this.examplesAndInferences.length)continue;if(g&&this.isAttributionKeyStr_(l)||!g&&!this.isAttributionKeyStr_(l))continue;if(1<this.numModels&&!g&&!l.endsWith(this.getModelName_(this.attributionModelIndex)))continue;let p=b[l],n=c[l];Array.isArray(p)||(p=[p]);Array.isArray(n)|| (n=[n]);const t=Math.max(p.length,n.length);let v=0;for(let x=0;x<t;x++)v=this.distanceStats_[l].isNumeric?v+this.getNumericDist(p[x],n[x],this.distanceStats_[l]):v+this.getCategoricalDist(p[x],n[x],this.distanceStats_[l]);l=v/t;e&&(l*=l);k+=l}return k},getNumericDist:function(b,c,e){return null==b||null==c?1:e.stdDev?Math.abs((b-c)/e.stdDev):0},getCategoricalDist:function(b,c,e){return null==b||null==c?1:b==c?0:e.probSameValue},visModeChanged_:function(b){"dive"==b?this.hidePartialDependencePlots_(): this.showPartialDependencePlots_()},hidePartialDependencePlots_:function(){this.$.partialplotholder.style.display="none"},showPartialDependencePlots_:function(){this.$.partialplotholder.style.display="flex";requestAnimationFrame(()=>this.populatePdTabs())},areTherePdPlotFeatures_:function(b){return b&&0<b.length},selectedIndicesChanged_:function(b){this.selected=b.detail.value;this.setAttributions();this.selectedDataUpdated_();this.showNearestCounterfactual&&0!=this.selected.length?this.findClosestCounterfactual_(): this.comparedIndices=[]},selectNextDatapoint_:function(){this.$.dive.selectedIndices=[(this.selected[0]+1)%this.visdata.length]},selectPrevDatapoint_:function(){this.$.dive.selectedIndices=[((this.selected[0]-1)%this.visdata.length+this.visdata.length)%this.visdata.length]},selectedExampleInputChanged_:function(b){null!=b&&""!=b&&(b=+b,isNaN(b)||0>b||b>=this.visdata.length||(this.$.dive.selectedIndices=[b]))},setExampleCollapsed_:function(){this.exampleDisplayMode="grid";this.$$("#viewer").expandedFeatures= {};this.$$("#viewer").expandAllFeatures=!1;this.$$("#viewer").refreshExampleViewer()},setExampleShow_:function(){this.exampleDisplayMode="grid";this.$$("#viewer").expandAllFeatures=!0},setExampleExpanded_:function(){this.exampleDisplayMode="stacked";this.$$("#viewer").expandAllFeatures=!0},statsChanged_:function(b){this.stats=b.detail.value},isBinaryClassification_:function(b,c){return"classification"==b&&!c},isMultiClass_:function(b,c){return"classification"==b&&c},isRegression_:function(b){return"regression"== b},shouldShowFeatureDropdown_:function(b){return b&&0<Object.keys(b).length},shouldShowSecondFeatureDropdown_:function(b){return""!=b},shouldShowLabelDropdown_:function(b){return b&&0<Object.keys(b).length},shouldHideModelSelector_:function(b){return!(b&&1<b.length)},shouldHideCounterfactualValueSelector_:function(b,c){return!this.hasAttributions_(b)||c},shouldShowOverallPerfCharts_:function(b,c,e){return""!=b&&""==c&&null!=e},shouldShowOverallPerfAttributionCharts_:function(b,c,e,g){return this.shouldShowOverallPerfCharts_(b, c,e)||this.hasAttributions_(g)},shouldShowFeaturePerfCharts_:function(b,c,e){return""!=b&&""!=c&&null!=e},shouldShowFeaturePerfAttributionCharts_:function(b,c,e,g){return this.shouldShowFeaturePerfCharts_(b,c,e)||this.hasAttributions_(g)},shouldShowCostRatio_:function(b,c,e){return""!=b&&this.isBinaryClassification_(c,e)},shouldShowAttributionMetrics_:function(b){return null!=b&&0<b.length},arePartialDependencePlotsEnabled_:function(b,c,e){return this.hasSelected(b)&&this.areExamplesEditable_(c,e)}, hasSelected:function(b){return null!=b},getFeatureList_:function(b){b=Object.keys(b).filter(c=>!this.isComputedKeyStr_(c)).sort();b.push("");return b},strStartsWith_:function(b,c){return 0==b.lastIndexOf(c,0)},getModelName_:function(b){return this.parsedModelNames[b]},strWithModelName_:function(b,c){return 1<this.numModels?b+" "+this.getModelName_(c):b},attributionStrWithModelName_:function(b,c){return this.hasMultipleModelAttributions_(this.attributions)?b+" "+this.getModelName_(c):b},updateNumberOfModels:function(){this._setNumModels(this.modelName.split(",").length); this.selectedSecondBreakdownFeature=this.selectedBreakdownFeature=this.selectedLabelFeature="";const b=[];for(let c=0;c<this.numModels;c++)b.push({threshold:.5});this.set("overallThresholds",b);this.shouldDisableInferButton_(this.examplesAndInferences,this.modelName,this.inferenceAddress,this.updatedExample)||this.inferClicked_()},isComputedKeyStr_:function(b){return this.strStartsWith_(b," Inference value")||this.strStartsWith_(b," Inference label")||this.strStartsWith_(b," Inference correct")|| this.strStartsWith_(b," Inference error")||this.strStartsWith_(b," Inference score")||this.strStartsWith_(b," Inference absolute error")||this.strStartsWith_(b," Inference squared error")||" Datapoint ID"==b||-1!=this.facetDistFeatureNames.indexOf(b)},isAttributionKeyStr_:function(b){return this.strStartsWith_(b,"attributions__")},getSliceKey_:function(b,c,e){function g(q){if(q&&void 0===b[q])return"?";const l=k[q];if(l)for(let m=1;m<l.length;m++)if(b[q]<l[m]||b[q]===l[m]&&m===l.length-1)return"["+ l[m-1]+", "+l[m]+(m<l.length-1?")":"]");return b[q]}const k=this.featureBucketEdges_;return this.createCombinedValueString_(g(c),g(e))},breakdownFeatureSelected_:function(){this.resetOptimizationSelected_();""==this.selectedBreakdownFeature&&(this.selectedSecondBreakdownFeature="");this.calculateBucketEdges_(this.selectedBreakdownFeature,this.numPrimaryBuckets);this.calculateBucketEdges_(this.selectedSecondBreakdownFeature,this.numSecondaryBuckets);const b=[],c={};this.visdata.forEach(e=>{const g= this.getSliceKey_(e,this.selectedBreakdownFeature);e=this.getSliceKey_(e,this.selectedSecondBreakdownFeature);const k=this.createCombinedValueString_(g,e);k in c||(b.push({value:g,value2:e,threshold:ot(this.overallThresholds),opened:!1}),c[k]=b.length-1)});this.set("featureValueThresholds",b);this.refreshInferences_(!1)},featureValueThresholdsChanged_:function(b){const c={};for(let e=0;e<b.length;e++)c[this.createCombinedValueString_(b[e].value,b[e].value2)]=e;this.featureValueThresholdsIndexMap= c},labelFeatureSelected_:function(){requestAnimationFrame(()=>{this.updateInferenceStats_(!0);this.refreshDive_()})},sideTabSelectedChanged_:function(b){if(1==b)requestAnimationFrame(()=>{this.updateInferenceStats_(!0)});else if(2==b){b=this.$.overview.querySelectorAll("facets-overview-table");for(let c=0;c<b.length;c++)b[c]._handleResize()}},updateInferenceStats_:function(b){if(this.inferenceStats_&&this.visdata&&""!=this.selectedLabelFeature&&0!=this.examplesAndInferences.length&&null!=this.examplesAndInferences[0].inferences&& this.examplesAndInferences[0].inferences[0].length==this.numModels&&(this.inferenceStats_.length==this.numModels||b)){if(b){var c=[],e=[];for(var g=0;g<this.numModels;g++){var k={};if(this.isBinaryClassification_(this.modelType,this.multiClass)){k.thresholds=[];for(var q=0;101>q;q++)k.thresholds.push({TP:0,FP:0,FN:0,TN:0});k.faceted={};for(q=0;q<this.examplesAndInferences.length;q++){var l=this.visdata[q],m=null;if(""!=this.selectedBreakdownFeature){m=this.getSliceKey_(l,this.selectedBreakdownFeature, this.selectedSecondBreakdownFeature);if(!k.faceted[m]){k.faceted[m]={thresholds:[]};for(var p=0;101>p;p++)k.faceted[m].thresholds.push({TP:0,FP:0,FN:0,TN:0})}m=k.faceted[m].thresholds}p=this.getClassificationBestNonZero(q,g);for(var n=0;100>=n&&!(n>100*p.score);n++)+l[this.selectedLabelFeature]==+p.label?(k.thresholds[n].TP+=1,m&&(m[n].TP+=1)):(k.thresholds[n].FP+=1,m&&(m[n].FP+=1));for(;100>=n;n++)null==l[this.selectedLabelFeature]||0==+l[this.selectedLabelFeature]?(k.thresholds[n].TN+=1,m&&(m[n].TN+= 1)):(k.thresholds[n].FN+=1,m&&(m[n].FN+=1))}this.allConfMatrixLabels=[];this.calcThresholdStats(k.thresholds);for(var t in k.faceted)k.faceted.hasOwnProperty(t)&&this.calcThresholdStats(k.faceted[t].thresholds)}else if(this.isMultiClass_(this.modelType,this.multiClass)){k.results={};k.faceted={};q=new Set;for(l=0;l<this.examplesAndInferences.length;l++){m=this.visdata[l];p=null;""!=this.selectedBreakdownFeature&&(p=this.getSliceKey_(m,this.selectedBreakdownFeature,this.selectedSecondBreakdownFeature), k.faceted[p]||(k.faceted[p]={results:{}}),p=k.faceted[p].results);var v=k.results[m[this.selectedLabelFeature]];v||(k.results[m[this.selectedLabelFeature]]={},v=k.results[m[this.selectedLabelFeature]]);n=this.strWithModelName_(" Inference value",g);var x=v[m[n]];q.add(String(m[n]));q.add(String(m[this.selectedLabelFeature]));v[m[n]]=null==x?1:v[m[n]]+1;p&&(v=p[m[this.selectedLabelFeature]],v||(p[m[this.selectedLabelFeature]]={},v=p[m[this.selectedLabelFeature]]),v[m[n]]=null==v[m[n]]?1:v[m[n]]+1)}this.allConfMatrixLabels= Array.from(q.values());q={};for(l=0;l<this.examplesAndInferences.length;l++)for(p=this.examplesAndInferences[l],m=this.visdata[l][this.selectedLabelFeature].toString(),p=p.inferences[p.inferences.length-1][g],n=""!=this.selectedBreakdownFeature?this.getSliceKey_(this.visdata[l],this.selectedBreakdownFeature,this.selectedSecondBreakdownFeature):"",(n in q)||(q[n]={}),v=0;v<p.length;v++){x=p[v].label;if(!(x in q[n])){q[n][x]=[];for(var y=0;100>=y;y++)q[n][x].push({TP:0,FP:0,FN:0,TN:0})}y=100*p[v].score; let F="";for(let J=0;100>=J;J++)F=x===m?y>J?"TP":"FN":y>J?"FP":"TN",q[n][x][J][F]+=1}Object.values(q).forEach(F=>Object.values(F).forEach(this.calcThresholdStats));k.allThresholds=q}else{k.results={errors:[]};k.faceted={};for(q=0;q<this.examplesAndInferences.length;q++)m=this.visdata[q],l=null,""!=this.selectedBreakdownFeature&&(p=this.getSliceKey_(m,this.selectedBreakdownFeature,this.selectedSecondBreakdownFeature),l=k.faceted[p],l||(k.faceted[p]={results:{errors:[]}},l=k.faceted[p])),m=m[this.strWithModelName_(" Inference value", g)]-m[this.selectedLabelFeature],k.results.errors.push(m),l&&l.results.errors.push(m);e.push(this.fillInRegressionStats(k.results,this.formatChartKey("All datapoints",g,this.numModels)));for(var z in k.faceted)e.push(this.fillInRegressionStats(k.faceted[z].results,this.formatChartKey(z,g,this.numModels)))}c.push(k)}const A=[...Array(this.numModels)].map(()=>({})),D={};this.allAttributions_.forEach((F,J)=>{for(let O=0;O<F.length;O++){if(null==F[O])continue;let N=null;if(""!=this.selectedBreakdownFeature){const P= this.getSliceKey_(this.visdata[J],this.selectedBreakdownFeature,this.selectedSecondBreakdownFeature);D[P]||(D[P]=[...Array(this.numModels)].map(()=>({})));N=D[P]}Object.keys(F[O]).forEach(P=>{P in A[O]||(A[O][P]=[]);A[O][P]=A[O][P].concat(F[O][P]);null!=N&&(P in N[O]||(N[O][P]=[]),N[O][P]=N[O][P].concat(F[O][P]))})}});const H=[...Array(this.numModels)].map(()=>[]),E={};for(let F=0;F<A.length;F++)Object.keys(A[F]).forEach(J=>{var O=A[F][J];O=O.reduce((N,P)=>N+P)/O.length;H[F].push({key:J,mean:O})}), H[F].sort((J,O)=>O.mean-J.mean);g=Object.keys(D);0<g.length&&g.forEach(F=>{E[F]=[...Array(this.numModels)].map(()=>[]);const J=D[F];for(let O=0;O<J.length;O++)Object.keys(J[O]).forEach(N=>{var P=J[O][N];P=P.reduce((V,T)=>V+T)/P.length;E[F][O].push({key:N,mean:P})}),E[F][O].sort((N,P)=>P.mean-N.mean)});this.meanAttributions_=H;this.facetedMeanAttributions_=E;e=this.sortRegressionEntries(e);this.regressionEntries_=[];this.regressionEntries_=e;this.inferenceStats_=c}c=this.featureValueThresholds;this.featureValueThresholds= [];this.featureValueThresholds=this.sortFeatureValues(c);if(this.isBinaryClassification_(this.modelType,this.multiClass)){for(c=0;c<this.featureValueThresholds.length;c++){e=[];g=[];k=this.featureValueThresholds[c].threshold;for(t=0;t<k.length;t++)e.push(this.inferenceStats_[t].faceted[this.createCombinedValueString_(this.featureValueThresholds[c].value,this.featureValueThresholds[c].value2)]),g.push(k[t].threshold);this.plotChart(this.$$("#"+this.getRocChartId(c)),e,g,b,!0);this.plotChart(this.$$("#"+ this.getPrChartId(c)),e,g,b,!1)}c=[];e=[];for(g=0;g<this.inferenceStats_.length;g++)c.push(this.inferenceStats_[g]),e.push(this.overallThresholds[g].threshold);this.plotChart(this.$$("#rocchart"),c,e,b,!0);this.plotChart(this.$$("#prchart"),c,e,b,!1)}else if(this.isMultiClass_(this.modelType,this.multiClass))for(e=(c=0<this.featureValueThresholds.length)?this.featureValueThresholds.map(A=>this.createCombinedValueString_(A.value,A.value2)):[""],g=0;g<e.length;g++)for(k=e[g],t=0;t<this.allConfMatrixLabels.length;t++){z= this.allConfMatrixLabels[t];q=[];l=[];m=c?this.featureValueThresholds[g].threshold:this.overallThresholds;for(p=0;p<this.inferenceStats_.length;p++)q.push({thresholds:this.inferenceStats_[p].allThresholds[k][z]}),l.push(m[p].threshold);this.plotChart(this.$$("#"+this.getRocChartLabelId(t,c?g:"")),q,l,b,!0);this.plotChart(this.$$("#"+this.getPrChartLabelId(t,c?g:"")),q,l,b,!1)}this.updateCorrectness_()}},sortFeatureValues:function(b){const c=this.inferenceStats_[0];b=b.filter(e=>this.isRegression_(this.modelType)? 0<this.getRegressionCount(c,e):this.isBinaryClassification_(this.modelType,this.multiClass)?0<this.getBinaryClassificationCount(c,e):0<this.getMulticlassClassificationCount(c,e));return b.sort((e,g)=>{if("Count"==this.selectedFeatureSort)return this.isRegression_(this.modelType)?this.getRegressionCount(c,g)-this.getRegressionCount(c,e):this.isBinaryClassification_(this.modelType,this.multiClass)?this.getBinaryClassificationCount(c,g)-this.getBinaryClassificationCount(c,e):this.getMulticlassClassificationCount(c, g)-this.getMulticlassClassificationCount(c,e);if("Alphabetical"==this.selectedFeatureSort)return e=this.getPrintableValue_(e),g=this.getPrintableValue_(g),"["===e[0]&&"["===g[0]?Number.parseFloat(e.substring(1))-Number.parseFloat(g.substring(1)):e.localeCompare(g);if("Accuracy"==this.selectedFeatureSort)return this.isBinaryClassification_(this.modelType,this.multiClass)?+this.getAccuracyModelIndex(this.inferenceStats_,g.threshold,0,g)-+this.getAccuracyModelIndex(this.inferenceStats_,e.threshold,0, e):+this.getMultiClassAccuracyModelIndex(this.inferenceStats_,0,g)-+this.getMultiClassAccuracyModelIndex(this.inferenceStats_,0,e);if("False positives"==this.selectedFeatureSort)return+this.getFPModelIndex(this.inferenceStats_,g.threshold,0,g)-+this.getFPModelIndex(this.inferenceStats_,e.threshold,0,e);if("False negatives"==this.selectedFeatureSort)return this.getFNModelIndex(+this.inferenceStats_,g.threshold,0,g)-+this.getFNModelIndex(this.inferenceStats_,e.threshold,0,e)})},sortRegressionEntries:function(b){return b.sort((c, e)=>{if("Count"==this.selectedFeatureSort)return e.count-c.count;if("Alphabetical"==this.selectedFeatureSort)return"["===c.name[0]&&"["===e.name[0]?Number.parseFloat(c.name.substring(1))-Number.parseFloat(e.name.substring(1)):c.name.localeCompare(e.name);if("Mean error"==this.selectedFeatureSort)return e.meanError-c.meanError;if("Mean absolute error"==this.selectedFeatureSort)return e.meanAbsError-c.meanAbsError;if("Mean squared error"==this.selectedFeatureSort)return e.meanSquaredError-c.meanSquaredError; if("Median error"==this.selectedFeatureSort)return e.medianError-c.medianError;if("Median absolute error"==this.selectedFeatureSort)return e.medianAbsError-c.medianAbsError;if("Median squared error"==this.selectedFeatureSort)return e.medianSquaredError-c.medianSquaredError})},fillInRegressionStats:function(b,c){function e(l){return l.reduce((m,p)=>m+p,0)/l.length}function g(l){if(0==l.length)return NaN;l=l.sort((p,n)=>p-n);const m=l.length/2;return 1==l.length?l[0]:0==l.length%2?l[m]:(l[Math.floor(m)]+ l[Math.ceil(m)])/2}const k=b.errors.map(l=>Math.abs(l)),q=b.errors.map(l=>l*l);return{name:c,meanError:e(b.errors),meanAbsError:e(k),meanSquaredError:e(q),medianError:g(b.errors),medianAbsError:g(k),medianSquaredError:g(q),count:b.errors.length}},plotChart:function(b,c,e,g,k){if(c&&c[0]&&b){var q=[],l=[],m=k?"FPR":"TPR",p=k?"TPR":"PPV",n=k?"FPR":"Recall",t=k?"TPR":"Precision",v=[];for(let x=0;x<c.length;x++){let y=null;const z=c[x].thresholds.map((A,D)=>{.5>D-100*e[x]&&(y={step:A[m],scalar:A[p],threshold:D/ 100});return{step:A[m],scalar:A[p],threshold:D/100}}).reverse();v.push(z);b.setSeriesData(this.strWithModelName_("Threshold set",x),[y]);g&&(b.setSeriesData(this.strWithModelName_("ROC",x),z),q.push(this.strWithModelName_("ROC",x)),q.push(this.strWithModelName_("Threshold set",x)),l.push(this.rocCurveLineColors[x]),l.push(this.rocCurveColors[x]))}if(g){const x=d3.format(".2f");b.xAxisFormatter=d3.format(".2f");const y=d3.format(",.1");g=[{title:"Threshold",evaluate:function(z){return x(z.datum.threshold)}}, {title:t,evaluate:function(z){return k?y(z.datum.scalar):x(z.datum.scalar)}},{title:n,evaluate:function(z){return k?y(z.datum.step):x(z.datum.step)}}];1<c.length&&g.push({title:"Model",evaluate:function(z){z=z.dataset.metadata().name.split(" ");return z[z.length-1]}});b.tooltipColumns=g;b.colorScale=(new Plottable.Scales.Color).range(l);b.colorScale.domain(q);b.setVisibleSeries(q)}0<v.length&&this.updateAucs_(b.id,v)}},updateAucs_(b,c){const e={};Object.keys(this.aucs_||{}).forEach(g=>{e[g]=this.aucs_[g]}); c.forEach((g,k)=>{e[[b,k].join(":")]=this.calculateAreaUnderCurve(g)});this.aucs_=e},calculateAreaUnderCurve(b){let c=0,e=b[0];for(let g=1;g<b.length;g++){let k=b[g].step-e.step;c+=k*Math.min(b[g].scalar,e.scalar)+k*(b[g].scalar-e.scalar)/2;e=b[g]}return c},getRocChartTitleOverall:function(){return this.formattedChartTitleWithAucs_("ROC curve","rocchart")},getRocChartTitleForSlice:function(b,c){return this.formattedChartTitleWithAucs_("ROC curve",this.getRocChartId(c))},getRocChartTitleForLabel:function(b, c,e){b=this.getRocChartLabelId(c,e);c=this.getLabel(c);return this.formattedChartTitleWithAucs_(`ROC curve for ${c}`,b)},getPrChartTitleOverall:function(){return this.formattedChartTitleWithAucs_("PR curve","prchart")},getPrChartTitleForSlice:function(b,c){return this.formattedChartTitleWithAucs_("PR curve",this.getPrChartId(c))},getPrChartTitleForLabel(b,c,e){b=this.getPrChartLabelId(c,e);c=this.getLabel(c);return this.formattedChartTitleWithAucs_(`PR curve for ${c}`,b)},formattedChartTitleWithAucs_(b, c){if(!this.aucs_||0===this.numModels)return b;if(1===this.numModels)return`${b} (AUC: ${this.formattedAucForModel_(c,0)})`;let e=[];for(let g=0;g<this.numModels;g++)e.push(this.formattedAucForModel_(c,g));return`${b} (AUCs: ${e.join(", ")})`},formattedAucForModel_(b,c){return(b=this.aucs_[[b,c].join(":")])&&b.toFixed?b.toFixed(2):0},describeRocChart(){return"\n A receiver operating characteristic (ROC) curve plots the true\n positive rate (TPR) against the false positive rate (FPR) at\n various classification thresholds.\n "}, describeRocAuc(){return"\n Area under the curve (AUC) summarizes model performance across\n all thresholds, and ROC-AUC represents the probability that a\n random positive example will have a higher score than a random\n negative example.\n "},describePrChart(){return"\n A precision-recall (PR) curve plots precision against recall at\n various classification thresholds.\n "},describePrAuc(){return"\n Area under the curve (AUC) summarizes performance across all\n thresholds, and PR-AUC typically corresponds to the average\n precision.\n "}, calcThresholdStats:function(b){for(let c=0;c<b.length;c++)b[c].TPR=0<b[c].TP+b[c].FN?b[c].TP/(b[c].TP+b[c].FN):0,b[c].FPR=0<b[c].FP+b[c].TN?b[c].FP/(b[c].FP+b[c].TN):0,b[c].PPV=0<b[c].TP+b[c].FP?b[c].TP/(b[c].TP+b[c].FP):0},optimizationSelectedChanged_:function(b){"custom"!=b&&("unaware"==b?this.optimizeThresholdClicked_():"group"==b?this.optimizeFacetedThresholdsClicked_():"demoparity"==b?this.demoParityClicked_():"equalacc"==b?this.equalAccClicked_():"equalopp"==b&&this.equalOppoClicked_(),this.updateInferenceStats_(!0))}, costRatioChanged_:function(){this.resetOptimizationSelected_()},resetOptimizationSelected_:function(){const b=this.$$("#customthresh");null!=b&&b.click()},optimizeThresholdClicked_:function(){for(let b=0;b<this.inferenceStats_.length;b++){const c=this.findOptimalThreshold_(this.inferenceStats_[b].thresholds);this.set("overallThresholds."+b+".threshold",c);if(this.featureValueThresholds)for(let e=0;e<this.featureValueThresholds.length;e++)this.set("featureValueThresholds."+e+".threshold."+b+".threshold", c)}},optimizeFacetedThresholdsClicked_:function(){for(let b=0;b<this.inferenceStats_.length;b++){const c=Object.keys(this.inferenceStats_[b].faceted);for(let e=0;e<c.length;e++)this.set("featureValueThresholds."+e+".threshold."+b+".threshold",this.findOptimalThreshold_(this.inferenceStats_[b].faceted[c[e]].thresholds))}},findOptimalThreshold_:function(b){let c=Number.POSITIVE_INFINITY,e=0;for(let g=0;g<b.length;g++){const k=this.getCost(b[g]);k<=c&&(c=k,e=g)}return e/100},equalOppoClicked_:function(){this.getBestThresholdsByFairnessMeasure_(b=> b.TP/(b.TP+b.FN))},equalAccClicked_:function(){this.getBestThresholdsByFairnessMeasure_(b=>(b.TP+b.TN)/(b.TP+b.FP+b.TN+b.FN))},demoParityClicked_:function(){this.getBestThresholdsByFairnessMeasure_(b=>(b.TP+b.FP)/(b.TP+b.FP+b.TN+b.FN))},getBestThresholdsByFairnessMeasure_:function(b){for(let e=0;e<this.inferenceStats_.length;e++){var c=Number.POSITIVE_INFINITY;let g=null;const k=this.inferenceStats_[e],q=Object.keys(k.faceted),l=k.faceted[q[0]].thresholds;for(let m=0;m<l.length;m++){const p=b(l[m]), n=[m];let t=this.getCost(l[m]);for(let v=1;v<q.length;v++){const x=k.faceted[q[v]].thresholds,y=this.thresholdClosestToMeasure(x,p,b);n.push(y);t+=this.getCost(x[y])}t<=c&&(c=t,g=n)}for(c=0;c<q.length;c++)this.set("featureValueThresholds."+this.featureValueThresholdsIndexMap[q[c]]+".threshold."+e+".threshold",g[c]/100)}},getCost:function(b){return b.FP*this.incorrectPredCostRatio+b.FN},thresholdClosestToMeasure:function(b,c,e){let g=Number.POSITIVE_INFINITY,k=0;for(let l=0;l<b.length;l++){var q=e(b[l]); q=Math.abs(q-c);q<=g&&(k=l,g=q)}return k},getClassificationBestNonZero:function(b,c){let e=0;const g=this.examplesAndInferences[b].inferences.length-1;for(let k=0;k<this.examplesAndInferences[b].inferences[g][c].length;k++)if(0!==+this.examplesAndInferences[b].inferences[g][c][k].label){e=k;break}return this.examplesAndInferences[b].inferences[g][c][e]},getConfusionCountsModelIndex:function(b,c,e,g){return this.overallThresholds.length!=this.numModels||this.inferenceStats_.length!=this.numModels? {}:this.getConfusionCounts(this.inferenceStats_[e],c[e].threshold,g)},getTotalEntriesInConfCounts:function(b){if(null==b)return 0;let c=0;const e=Object.keys(b);for(let g=0;g<e.length;g++){const k=b[e[g]],q=Object.keys(k);for(let l=0;l<q.length;l++)c+=k[q[l]]}return c},getFPModelIndex:function(b,c,e,g){b=this.getConfusionCountsModelIndex(b,c,e,g);if(0==Object.keys(b).length)return null;c=b.No.Yes;return d3.format(",.1f")(c/this.getTotalEntriesInConfCounts(b)*100)},getFNModelIndex:function(b,c,e,g){b= this.getConfusionCountsModelIndex(b,c,e,g);if(0==Object.keys(b).length)return 0;c=b.Yes.No;return d3.format(",.1f")(c/this.getTotalEntriesInConfCounts(b)*100)},getAccuracyModelIndex:function(b,c,e,g){b=this.getConfusionCountsModelIndex(b,c,e,g);if(0==Object.keys(b).length)return 0;c=b.Yes.Yes+b.No.No;return d3.format(",.1f")(c/this.getTotalEntriesInConfCounts(b)*100)},getF1ModelIndex:function(b,c,e,g){const k=d3.format(",.2f");e=this.getConfusionCountsModelIndex(b,c,e,g);if(0==Object.keys(e).length)return 0; b=e.Yes.Yes;c=e.No.Yes;e=e.Yes.No;if(0==b)return 0!=c||0!=e?k(0):k(1);c=b/(b+c);b/=b+e;return k(2*c*b/(c+b))},getFeatureValueCount:function(b,c,e){return this.getTotalEntriesInConfCounts(this.getConfusionCountsModelIndex(b,c,0,e))},getConfusionMatrixLabel:function(b,c){return 2>c?"":this.getModelName_(b)},getConfusionMatrixColor:function(b){return this.confMatrixColors[b]},getConfusionCounts(b,c,e){let g=null,k=null;null!=e&&(g=e.value,k=e.value2);return{No:{No:this.getConfMatrixValue(b,c,"TN",g, k),Yes:this.getConfMatrixValue(b,c,"FP",g,k)},Yes:{No:this.getConfMatrixValue(b,c,"FN",g,k),Yes:this.getConfMatrixValue(b,c,"TP",g,k)}}},getConfMatrixValue:function(b,c,e,g,k){c=Math.floor(100*c);if(!b.thresholds)return 0;if(null===g)return b.thresholds[c][e];g=this.createCombinedValueString_(g,k);return null==b.faceted[g]?0:b.faceted[g].thresholds[c][e]},getMultiClassConfMatrix:function(b,c,e){if(0==b.length)return{};if(null==e)return b[c].results;e=this.getPrintableValue_(e);return null==b[c].faceted[e]? {}:b[c].faceted[e].results},getMultiClassFeatureValueCount:function(b,c){return this.getTotalEntriesInConfCounts(this.getMultiClassConfMatrix(b,0,c))},getMultiClassAccuracyModelIndex:function(b,c,e){b=this.getMultiClassConfMatrix(b,c,e);if(null==b)return null;c=0;e=Object.keys(b);for(let g=0;g<e.length;g++){const k=b[e[g]],q=Object.keys(k);for(let l=0;l<q.length;l++)e[g]==q[l]&&(c+=k[q[l]])}return d3.format(",.1f")(c/this.getTotalEntriesInConfCounts(b)*100)},getInferenceStat:function(b,c,e,g){b=c? b.faceted[this.getPrintableValue_(c)]:b;if(!b)return null;e=e(b);return g?g(e):e},getRegressionMean:function(b,c){return this.getInferenceStat(b,c,e=>e.results.mean,d3.format(".3f"))},getRegressionAbsMean:function(b,c){return this.getInferenceStat(b,c,e=>e.results.absMean,d3.format(".3f"))},getRegressionSquaredMean:function(b,c){return this.getInferenceStat(b,c,e=>e.results.squaredMean,d3.format(".3f"))},getRegressionCount:function(b,c){b=this.getInferenceStat(b,c,e=>e.results.errors.length,null); return null==b?0:b},getBinaryClassificationCount:function(b,c){return this.getInferenceStat(b,c,e=>Object.values(e.thresholds[0]).reduce((g,k)=>g+k),null)},getMulticlassClassificationCount:function(b,c){return this.getInferenceStat(b,c,e=>Object.values(e.results).reduce((g,k)=>{let q=0;const l=Object.keys(k);for(let m=0;m<l.length;m++)q+=k[l[m]];return g+q},0),null)},getRocChartId:function(b){return"rocchart"+b},getRocChartLabelId:function(b,c){return this.getRocChartId(c)+"-"+b},getLabel:function(b){return this.labelVocab[b]|| b},getPrChartId:function(b){return"prchart"+b},getPrChartLabelId:function(b,c){return this.getPrChartId(c)+"-"+b},getPrintableValue_:function(b){let c;c=b.value||0===b.value?String(b.value):"\x3cfeature value missing\x3e";if(""==this.selectedSecondBreakdownFeature)return c;c+="/";return c=b.value2||0===b.value2?c+b.value2:c+"\x3cfeature value missing\x3e"},getFeatureName_:function(b){return 0===b.length?"\x3cnone\x3e":b},getLabeledModelName_:function(b){return"Model: "+b},getClassName_:function(b){return 0=== b.length?"\x3cnone\x3e":b},shouldShowOverallThresholder_:function(b){return 0===b.length},computeSelectedExampleAndInference:function(){this.counterfactualExampleAndInference=null;this.selected&&this.examplesAndInferences?(this.selectedExampleAndInference=0<this.selected.length?this.examplesAndInferences[this.selected[0]]:null,null==this.selectedExampleAndInference?this.globalPdPlots=!0:(this.globalPdPlots=!1,"dive"!=this.visMode&&this.showPartialDependencePlots_())):this.selectedExampleAndInference= null},setAttributions:function(){if(this.selected&&0!=this.selected.length){var b={},c=this.visdata[this.selected[0]],e=this.attributionStrWithModelName_("",this.attributionModelIndex);e=new RegExp("attributions__(.*)"+e);for(let k in c){var g=e.exec(k);if(g){g=new RegExp("^(features__)?"+g[1]+"$");for(let q in c)if(g.test(q)){b[q]=c[k];break}}}this.attribution=b}},shouldDisableGetExamplesButton_:function(b){return 0==b.length},shouldDisableInferButton_:function(b,c,e,g){return 0==b.length||0==c.length|| 0==e.length||!g},areExamplesEditable_:function(b,c){return 0!=b.length&&0!=c.length},newInferences_:function(){this.loadingBarHidden_=!0;this.updateInferences_(!0);requestAnimationFrame(()=>this.updateInferenceStats_(!0))},refreshInferencesNoRegen_:function(){this.refreshInferences_(!0);requestAnimationFrame(()=>this.updateInferenceStats_(!0))},refreshInferences_:function(b){this.updateInferences_(!1);requestAnimationFrame(()=>this.updateInferenceStats_(!b))},updateInferences_:function(b){if(this.examplesAndInferences&& this.inferences.indices&&0!=this.inferences.indices.length&&this.inferences.results.length==this.numModels){var c={},e=!!this.inferences.results[0].classificationResult;for(let l=0;l<this.inferences.indices.length;l++)if(e){c[this.inferences.indices[l]]=[];for(var g=0;g<this.inferences.results.length;g++){const m=this.inferences.results[g].classificationResult;for(let p=0;p<m.classifications[l].classes.length;p++)if(""==m.classifications[l].classes[p].label&&(m.classifications[l].classes[p].label= p.toString()),null!=this.labelVocab&&0<this.labelVocab.length){const n=this.labelVocab.indexOf(m.classifications[l].classes[p].label);-1!==n&&(m.classifications[l].classes[p].label=n.toString())}c[this.inferences.indices[l]][g]=m.classifications[l].classes.sort((p,n)=>n.score-p.score)}}else for(c[this.inferences.indices[l]]=[],g=0;g<this.inferences.results.length;g++)c[this.inferences.indices[l]][g]=[{label:"",score:this.inferences.results[g].regressionResult.regressions[l].value}];this.set("examplesAndInferences", this.examplesAndInferences.map(function(l,m){let p=l.inferences?l.inferences:[];c[m]&&b&&(p=p.concat([c[m]]));return{example:l.example,inferences:p,changed:l.changed,orig:l.orig}}));var k=this,q=!1;this.visdata.forEach(function(l,m){if(e)k.setItemInferenceValue(l,m,k.selectedBreakdownFeature,k.selectedSecondBreakdownFeature);else for(var p=0;p<k.numModels;p++)l[k.strWithModelName_(" Inference value",p)]=k.examplesAndInferences[m].inferences[k.examplesAndInferences[m].inferences.length-1][p][0].score; if(e&&0<k.labelVocab.length){for(p=0;p<k.examplesAndInferences[m].inferences.length;p++)for(let n=0;n<k.examplesAndInferences[m].inferences[p].length;n++)for(let t=0;t<k.examplesAndInferences[m].inferences[p][n].length;t++)k.examplesAndInferences[m].inferences[p][n][t].vocabLabel=k.labelVocab[k.examplesAndInferences[m].inferences[p][n][t].label];for(m=0;m<k.numModels;m++)l[k.strWithModelName_(" Inference label",m)]=k.labelVocab[l[k.strWithModelName_(" Inference value",m)]];q=!0}});this.updateCorrectness_(); this.refreshDive_();this.inferences.indices.length==this.examplesAndInferences.length&&(this.$.dive.colorBy=q?this.strWithModelName_(" Inference label",0):this.strWithModelName_(" Inference value",0),this.isRegression_(this.modelType)?(this.$.dive.horizontalPosition=this.strWithModelName_(" Inference value",0),1<this.numModels&&(this.$.dive.verticalPosition=this.strWithModelName_(" Inference value",1))):this.isBinaryClassification_(this.modelType,this.multiClass)&&(1==this.numModels?this.$.dive.verticalPosition= this.strWithModelName_(" Inference score",0):(this.$.dive.horizontalPosition=this.strWithModelName_(" Inference score",0),this.$.dive.verticalPosition=this.strWithModelName_(" Inference score",1))));this.updatedExample=!1}},hasAttributions_:function(b){return null!=b&&0!=Object.keys(b.attributions).length&&null!=b.attributions[0]},hasMultipleModelAttributions_:function(b){return null!=b&&1<Object.keys(b.attributions).length&&null!=b.attributions[0]&&null!=b.attributions[1]},newExtraOutputs_:function(b){var c= [];for(var e=0;e<b.extra.length;e++)null!=b.extra[e]&&"attributions"in b.extra[e]&&c.push(b.extra[e].attributions);0<c.length&&(this.attributions={indices:b.indices,attributions:c});for(c=0;c<b.indices.length;c++){e=b.indices[c];const q=Object.assign({},this.visdata[e]);for(let l=0;l<b.extra.length;l++){if(null==b.extra[l])continue;const m=Object.keys(b.extra[l]);for(let p=0;p<m.length;p++){var g=m[p];if("attributions"==g)continue;let n=b.extra[l][g][c];g=this.strWithModelName_(g,l);q[g]=n;Array.isArray(n)|| (n=[n]);const t=0<n.length&&("string"==typeof n[0]||n[0]instanceof String);var k=JSON.stringify(this.examplesAndInferences[e].example);k=JSON.parse(k);k.features.feature[g]=t?{bytesList:{value:n}}:{floatList:{value:n}};this.examplesAndInferences[e].example=k}}this.set(`visdata.${e}`,q)}this.refreshDive_();this.computeSelectedExampleAndInference();this.refreshSelectedDatapoint_()},newAttributions_:function(b){if(this.hasAttributions_(b)){if(this.allAttributions_.length<this.visdata.length){var c=[...Array(this.visdata.length- this.allAttributions_.length)].map(()=>[...Array(this.numModels)].map(()=>({})));this.allAttributions_=this.allAttributions_.concat(c)}for(c=0;c<b.indices.length;c++){const g=b.indices[c],k=Object.assign({},this.visdata[g]);for(let q=0;q<b.attributions.length;q++){const l=null==b.attributions[q]?{}:b.attributions[q][c],m=Object.keys(l);for(let p=0;p<m.length;p++){var e=this.attributionStrWithModelName_("attributions__"+m[p],q);k[e]=l[m[p]];e=Array.isArray(k[e])?k[e]:[k[e]];this.allAttributions_[g][q][m[p]]= e;for(let n=0;n<e.length;n++)e[n]>this.maxAttribution&&(this.maxAttribution=e[n]),e[n]<this.minAttribution&&(this.minAttribution=e[n])}}this.set(`visdata.${g}`,k)}0>this.minAttribution&&this.maxAttribution>Math.abs(this.minAttribution)?this.minAttribution=-1*this.maxAttribution:0<this.maxAttribution&&Math.abs(this.minAttribution)>this.maxAttribution&&(this.maxAttribution=-1*this.minAttribution);this.setAttributions();this.createAttributionLegend();this.refreshDive_()}},createAttributionLegend:function(){var b= [],c=[];0>this.minAttribution&&(b.push(this.minAttribution),c.push("#943A43"),b.push(this.minAttribution/5),c.push("#C7696E"));b.push(0);c.push("#FFD8C3");0<this.maxAttribution&&(b.push(this.maxAttribution/5),c.push("#6A9EA7"),b.push(this.maxAttribution),c.push("#3D7078"));this.attributionColorScale=d3.scaleLinear().domain(b).interpolate(mt).clamp(!0).range(c);var e=Polymer.dom(this.root).querySelector("#attributionLegend");d3.select(e).selectAll("*").remove();e=d3.select(e).append("g");const g=e.append("defs").append("linearGradient").attr("id", "vzexampleviewergradient").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%").attr("spreadMethod","pad"),k=[];5==c.length?(k.push(this.minAttribution/2),k.push(0),k.push(this.maxAttribution/2)):0>this.minAttribution?(k.push(this.minAttribution/4*3),k.push(this.minAttribution/2),k.push(this.minAttribution/4)):(k.push(this.maxAttribution/4),k.push(this.maxAttribution/2),k.push(this.maxAttribution/4*3));const q=b[0],l=b[b.length-1]-q;b=b.map(m=>Math.round((m-q)/l*100)+"%");d3.zip(b,c).forEach(m=> {g.append("stop").attr("offset",m[0]).attr("stop-color",m[1]).attr("stop-opacity",1)});e.append("rect").attr("x1",0).attr("y1",0).attr("width",160).attr("height",8).style("fill","url(#vzexampleviewergradient)");c=d3.scaleLinear().domain([this.minAttribution,this.maxAttribution]).range([0,160]);c=d3.axisBottom(c).tickValues(k).tickSize(4).tickFormat(d3.format(".1f"));e.append("g").attr("class","legend axis").attr("transform","translate(0,8)").style("font","9px").call(c)},setItemInferenceValue:function(b, c,e){var g=this.examplesAndInferences[c].inferences.length-1;if(this.multiClass)for(e=0;e<this.numModels;e++)b[this.strWithModelName_(" Inference value",e)]=this.examplesAndInferences[c].inferences[g][e][0].label;else for(g=this.overallThresholds,0!==e.length&&(g=this.getSliceKey_(b,this.selectedBreakdownFeature,this.selectedSecondBreakdownFeature),g=this.featureValueThresholds[this.featureValueThresholdsIndexMap[g]].threshold),e=0;e<this.numModels;e++){const k=this.getClassificationBestNonZero(c, e);b[this.strWithModelName_(" Inference score",e)]=k.score;b[this.strWithModelName_(" Inference value",e)]=k.score>=g[e].threshold?k.label:this.defaultInferenceLabel.toString()}},createCombinedValueString_:function(b,c){b=void 0===b||null===b?"":b;return void 0===c||null===c||""===c?b:b+"/"+c},updateCorrectness_:function(){if(this.selectedLabelFeature&&this.examplesAndInferences)for(let b=0;b<this.examplesAndInferences.length;b++){const c=this.visdata[b];for(let e=0;e<this.numModels;e++)"classification"== this.modelType?c[this.strWithModelName_(" Inference correct",e)]=c[this.selectedLabelFeature]==c[this.strWithModelName_(" Inference value",e)]?"correct":"incorrect":(c[this.strWithModelName_(" Inference error",e)]=c[this.strWithModelName_(" Inference value",e)]-c[this.selectedLabelFeature],c[this.strWithModelName_(" Inference absolute error",e)]=Math.abs(c[this.strWithModelName_(" Inference error",e)]),c[this.strWithModelName_(" Inference squared error",e)]=c[this.strWithModelName_(" Inference error", e)]*c[this.strWithModelName_(" Inference error",e)])}},inferClicked_:function(){const b={inference_address:this.inferenceAddress,model_name:this.modelName,model_type:this.modelType,model_version:this.modelVersion,model_signature:this.modelSignature,label_vocab_path:this.labelVocabPath,use_predict:this.usePredictApi,predict_output_tensor:this.predictOutputTensor,predict_input_tensor:this.predictInputTensor};this.loadingBarHidden_=!1;if(!this.local){let c=[],e=[];const g=this.makeUrl_("infer",b),k= q=>{null!=q.value.vocab&&(this.labelVocab=JSON.parse(q.value.vocab));c.push(JSON.parse(q.value.inferences));e.push(JSON.parse(q.value.extraOutputs));if(-1===q.value.next){this.loadingBarHidden_=!0;q=this.combineInferences_(c);const l=this.combineExtraOutputs_(e);this.inferences=q;this.extraOutputs={indices:q.indices,extra:l}}else q=this.makeUrl_("infer",{start_example:q.value.next,model_type:this.modelType}),this.makeAsyncRequest_(q,k,null,"Model inference")};this.makeAsyncRequest_(g,k,null,"Model inference")}this.fire("infer-examples", b)},combineInferences_:function(b){for(let c=1;c<b.length;c++){b[0].indices=b[0].indices.concat(b[c].indices);for(let e=0;e<b[0].results.length;e++)"classification"==this.modelType?b[0].results[e].classificationResult.classifications=b[0].results[e].classificationResult.classifications.concat(b[c].results[e].classificationResult.classifications):b[0].results[e].regressionResult.regressions=b[0].results[e].regressionResult.regressions.concat(b[c].results[e].regressionResult.regressions)}return b[0]}, combineExtraOutputs_:function(b){for(let c=1;c<b.length;c++)for(let e=0;e<b[0].length;e++){if(null==b[c][e])continue;const g=Object.keys(b[c][e]);for(let k=0;k<g.length;k++){const q=g[k];b[0][e][q]=b[0][e][q].concat(b[c][e][q])}}return b[0]},exampleChange_:function(b){var c=0==this.selected.length?0:this.selected[0];this.set("selectedExampleAndInference.changed",!0);this.updateExample_(JSON.stringify(b.target.json),c);this.$$("#"+this.getInferenceHolderId_()).inference=null;this.visdata[c]=this.exampleToDataPoint_(b.target.json, c);this.showNearestCounterfactual=!1;this.refreshDive_();this.updatedExample=!0;this.selectedDataUpdated_()},refreshDiveImpl_:function(){var b=this.visdata;this.visdata=[];this.visdata=b;this.selectedExampleMax=this.visdata.length-1;this.$.overview.protoInput=this.$.overview.getStatsProto([{name:"",data:b}]);this.calculateDistanceStats_(this.$.overview.protoInput.toObject());this.isRegression_(this.modelType)&&this.adjustMinCounterfactualValueDist_();b=this.$.dive.selectedData;this.$.dive.selectedData= [];this.$.dive.selectedData=b;this.updateSprite()},refreshDive_:function(){this.debounce("refreshDiveDebounce",()=>this.refreshDiveImpl_(),500)},calculateDistanceStats_:function(b){this.distanceStats_={};for(let c=0;c<b.datasetsList[0].featuresList.length;c++){const e=b.datasetsList[0].featuresList[c],g=e.name;this.distanceStats_[g]={isNumeric:null!=e.numStats};if(this.distanceStats_[g].isNumeric)this.distanceStats_[g].stdDev=e.numStats.stdDev;else{let k=0;const q=e.stringStats.rankHistogram.bucketsList; for(let l=0;l<q.length;l++){const m=q[l].sampleCount/e.stringStats.commonStats.numNonMissing;k+=m*m}this.distanceStats_[g].probSameValue=k}}},isNumericFeature_:function(b){return b&&this.distanceStats_&&this.distanceStats_[b]&&this.distanceStats_[b].isNumeric},calculateBucketEdges_:function(b,c){function e(p){const n=-Math.floor(Math.log10(l))+1;return Math.round(p*Math.pow(10,n))/Math.pow(10,n)}if(!this.isNumericFeature_(b)||this.stats[b].uniqueCount<=c||this.featureBucketEdges_[b]&&this.featureBucketEdges_[b].length== c+1)delete this.featureBucketEdges_[b];else{var g=this.stats[b].numberMin,k=this.stats[b].numberMax,q=(k-g)/c,l=this.distanceStats_[b].stdDev,m=[];m.push(g);for(let p=1;p<c;p++)m.push(e(g+p*q));m.push(k);this.featureBucketEdges_[b]=m}},updateExample_:function(b,c){this.fire("update-example",{example:b,index:c});if(!this.local){var e=this.makeUrl_("update_example",null);this.makeAsyncRequest_(e,null,{example:b,index:c},"Datapoint update")}},getInferenceHolderId_:function(){return"inference_"},makeUrl_:function(b, c){"/"===b[0]&&(b=b.slice(1));null==c&&(c={});return Qo.addParams(b,c)},showToast_:function(b){var c=document.createElement("paper-toast");c.duration=1E4;document.body.appendChild(c);c.text=b;c.show();console.error(b)},handleError:function(b){this.showToast_(b);this.exampleStatusStr=b;this.loadingBarHidden_=!0;this.isSortingEligibleFeatures=!1},makeAsyncRequest_:function(b,c,e,g,k){k=void 0===k?()=>{}:k;const q=this._canceller.cancellable(l=>{l.cancelled||(l.value&&l.value.error?(this.handleError(l.value.error), null!=k&&k()):c&&c(l))});this._requestManager.request(b,e).then(q).catch(l=>{this.handleError(`${g} failed: ${l.req.responseText}`);null!=k&&k()})},dataPointValueFromFeature_:function(b,c){let e=null;b.int64List?e=b.int64List.value:b.floatList?e=b.floatList.value:b.bytesList&&b.bytesList.value&&(e=b.bytesList.value.map(g=>{if(1E5<g.length)return"ERROR: string not decoded due to length";try{return atob(g)}catch(k){return console.error("Error decoding string: "+k),"ERROR: error decoding string"}})); return c&&e&&1==e.length?(b=e[0],isNaN(b)?b:Number(b)):e},exampleToDataPoint_:function(b,c){const e={};var g=b.features||b.context,k=g&&"feature"in g?Object.keys(g.feature):[];for(var q in k){var l=k[+q];if(l!=this.imageFeatureName){var m=this.dataPointValueFromFeature_(g.feature[l],!0);null!=m&&(e[l]=m)}}g="featureLists"in b?Object.keys(b.featureLists.featureList):[];for(const p in g){k=g[+p];q=b.featureLists.featureList[k].feature;l=[];for(m=0;m<q.length;m++){const n=this.dataPointValueFromFeature_(q[m], !1);n&&(l=l.concat(n))}e[k]=l}e[" Datapoint ID"]=c;return e},getExamplesAndCloseSettings_:function(){this.settingsClicked_();this.updateNumberOfModels();this.getExamples_()},showModelNumbers_:function(){return 1>=this.numModels},updateExampleContents:function(b,c){this.exampleStatusStr=b.length+" datapoints loaded";this.$.noexamples.style.display="none";this.loadingBarHidden_=!0;this.examplesAndInferences=b.map(function(g){return{example:JSON.parse(g),changed:!1,orig:JSON.parse(g)}});this.updatedExample= !0;const e=this;this.visdata=this.examplesAndInferences.map(function(g,k){return e.exampleToDataPoint_(g.example,k)});this.$.dive.atlasUrl="";this.$.dive.imageFieldName="";this.hasSprite=c;this.refreshDive_();this.shouldDisableInferButton_(this.examplesAndInferences,this.modelName,this.inferenceAddress,this.updatedExample)||this.inferClicked_();this.setInferenceFromExampleData()},setInferenceFromExampleData:function(){if(0<this.visdata.length)if(null!=this.visdata[0].predictions__probabilities){var b= {},c=Array.apply(null,{length:this.visdata.length}).map(Number.call,Number);b.indices=c;b.results=[{classificationResult:{classifications:[]}}];for(var e=0;e<c.length;e++)b.results[0].classificationResult.classifications[e]={classes:[{label:"0",score:this.visdata[e].predictions__probabilities[0]},{label:"1",score:this.visdata[e].predictions__probabilities[1]}]};this.inferences=b}else if(null!=this.visdata[0].predictions){b={};c=Array.apply(null,{length:this.visdata.length}).map(Number.call,Number); b.indices=c;b.results=[{regressionResult:{regressions:[]}}];for(e=0;e<c.length;e++)b.results[0].regressionResult.regressions[e]={value:this.visdata[e].predictions};this.inferences=b}},getExamples_:function(){let b=[],c=null;const e=this.makeUrl_("examples_from_path",{examples_path:this.examplesPath,max_examples:this.maxExamples,sampling_odds:this.samplingOdds,sequence_examples:this.sequenceExamples}),g=k=>{b=b.concat(k.value.examples);null!=k.value.sprite&&(c=k.value.sprite);-1===k.value.next?this.updateExampleContents(b, c):(k=this.makeUrl_("examples_from_path",{start_example:k.value.next}),this.makeAsyncRequest_(k,g,null,"Datapoint load"))};this.exampleStatusStr="Loading datapoints...";this.makeAsyncRequest_(e,g,null,"Datapoint load");this.loadingBarHidden_=!1},updateSprite:function(){this.hasSprite&&(this.$.dive.atlasUrl=null,this.$.dive.atlasUrl=this.local?this.localAtlasUrl:this.makeUrl_("sprite",{}))},selectedDataUpdated_:function(){this.selectedExampleNum=0<this.selected.length?this.selected[0]:"";this.visdata&& 0<this.visdata.length&&(this.partialDepPlotPendingFeatures=[])},copyDatapoint_:function(){var b=JSON.stringify(this.selectedExampleAndInference.example);b={example:JSON.parse(b),changed:!1,orig:JSON.parse(b)};this.examplesAndInferences.push(b);this.selectedExampleAndInference=b;this.visdata.push(this.exampleToDataPoint_(b.example,this.visdata.length));b=this.selected[0];this.showNearestCounterfactual=!1;this.selected[0]=this.visdata.length-1;this.selectedDataUpdated_();this.updatedExample=!0;this.fire("duplicate-example", {index:b});this.local?this.refreshDive_():(b=this.makeUrl_("duplicate_example",{index:b}),this.makeAsyncRequest_(b,()=>{this.refreshDive_()},null,"Datapoint duplication"))},deleteDatapointDialog_:function(){this.$.deletedialog.open()},deleteDatapoint_:function(){var b=this.selected[0];this.examplesAndInferences.splice(b,1);this.visdata.splice(b,1);for(let c=b;c<this.visdata.length;c++)this.visdata[c][" Datapoint ID"]=c;this.comparedIndices=[];this.selected=[];this.selectedDataUpdated_();this.fire("delete-example", {index:b});this.$.dive.selectedIndices=[];this.local?this.refreshDive_():(b=this.makeUrl_("delete_example",{index:b}),this.makeAsyncRequest_(b,()=>{this.refreshDive_()},null,"Datapoint delete"))},shouldDisableReset_:function(b){return!b},resetDatapoint_:function(){this.set("selectedExampleAndInference.example",{});requestAnimationFrame(()=>{this.selectedExampleAndInference.changed=!1;const b=JSON.stringify(this.selectedExampleAndInference.orig);this.set("selectedExampleAndInference.example",JSON.parse(b)); this.visdata[this.selected[0]]=this.exampleToDataPoint_(this.selectedExampleAndInference.example,this.selected[0]);this.updatedExample=!0;this.updateExample_(b,this.selected[0]);this.refreshDive_()})},addChart:function(b,c,e){let g,k=e;if(this.isMultiClass_(this.modelType,this.multiClass)){k=[];for(let l=0;l<e.length;l++){let m={};if(Object.keys(e[l]).length>Number(this.maxInferenceEntriesPerRun)){var q=this.examplesAndInferences[this.selected&&0<this.selected.length?this.selected[0]:0];q=q.inferences[q.inferences.length- 1][l].slice(0,this.maxInferenceEntriesPerRun);for(let p=0;p<q.length;p++){const n=q[p].label;m[n]=e[l][n]}}else m=e[l];k.push(m)}}"numeric"==b?g=this.makeLineChart(c,k):"categorical"==b?g=this.makeBarChart(c,k):console.error("Unknown chartType: "+b);b=this.featureContainerByName(c).querySelector(".tf-category-pane-content");Polymer.dom(b).appendChild(g);c=this.partialDepPlotPendingFeatures.indexOf(c);-1<c&&this.partialDepPlotPendingFeatures.splice(c,1)},getSimpleAxisFormatter:function(b){return Plottable.Formatters.general(b)}, makeBarChart:function(b,c){function e(t,v){return{x:t.step==v?t.step+" - original value":t.step,y:t.scalar}}function g(t,v,x){return{x:t.step==v?t.step+" - original value":t.step,scalar:t.scalar,y:x}}let k="";var q=c[0];!this.globalPdPlots&&(b=this.createPdEntryForCurrentValue(b,q,0))&&(k=b.step);const l={},m={};_.forEach(c,(t,v)=>{_.forEach(t,(x,y)=>{m[this.formatChartKey(y,v,c.length)]=_.map(x,z=>e(z,k)).sort((z,A)=>A.y-z.y);this.isBinaryClassification_(this.modelType,this.multiClass)&&(l[this.formatChartKey(y, v,c.length)]=_.map(x,z=>g(z,k,this.overallThresholds[v].threshold)).sort((z,A)=>A.scalar-z.scalar))})});const p=To.multiscaleFormatter(To.Y_TOOLTIP_FORMATTER_PRECISION);q=[{title:"Inference value",evaluate:t=>{t=this.splitChartKey(t.key,c.length).label;if(!isNaN(t)&&0<t.length&&this.labelVocab){const v=+t;v<this.labelVocab.length&&0<=v&&(t+=" ("+this.labelVocab[v]+")")}return t}},{title:"Feature value",evaluate:t=>t.value.x},{title:"Score",evaluate:t=>p(t.value.y)}];2<=c.length&&q.push({title:"Model", evaluate:t=>this.splitChartKey(t.key,c.length).model});b=document.createElement("div");b.classList.add("pd-holder");const n=document.createElement("vz-bar-chart");n.colorScale=(new Plottable.Scales.Color).range(this.pdPlotColors);n.linesColorScale=(new Plottable.Scales.Color).range(this.pdPlotTransparentColors);n.data=m;n.lines=l;n.tooltipColumns=q;b.appendChild(n);q=document.createElement("div");q.classList.add("pd-y-label");q.innerText=this.isRegression_(this.modelType)?"Inference value":"Inference score"; b.appendChild(q);return b},splitChartKey:function(b,c){let e=b,g="";2<=c&&(c=b.indexOf("(model"),e=b.substring(0,c),g=b.substring(c+7,b.lastIndexOf(")")));return{label:e,model:g}},formatChartKey:function(b,c,e){return 1==e?b:b+" (model "+this.getModelName_(c)+")"},makeLineChart:function(b,c){function e(x){return Number.isNaN(x)?"NaN":m(x)}const g=document.createElement("div");g.classList.add("pd-holder");const k=document.createElement("vz-line-chart2"),q=[];var l=[];const m=To.multiscaleFormatter(To.Y_TOOLTIP_FORMATTER_PRECISION); "classification"==this.modelType&&(k.defaultYRange=[0,1]);var p=[{title:"Inference value",evaluate:x=>{x=this.splitChartKey(x.dataset.metadata().name,c.length).label;if(!isNaN(x)&&0<x.length&&this.labelVocab){const y=+x;y<this.labelVocab.length&&0<=y&&(x+=" ("+this.labelVocab[y]+")")}return x}},{title:"Feature value",evaluate:x=>e(x.datum.step)},{title:"Score",evaluate:x=>e(x.datum.scalar)}];2<=c.length&&p.push({title:"Model",evaluate:x=>this.splitChartKey(x.dataset.metadata().name,c.length).model}); k.tooltipColumns=p;const n=[];let t=0;for(let x=0;x<c.length;x++){const y=c[x];p=_.keys(y);t=x*p.length;p.forEach(z=>{q.push(this.pdPlotColors[t++]);const A=this.formatChartKey(z,x,c.length);k.setSeriesData(A,y[z]);n.push(A)});t=x*p.length;if(!this.globalPdPlots&&(p=this.createPdEntryForCurrentValue(b,y,x))){var v=this.formatChartKey(_.keys(y)[0]+" - original value ",x,c.length);k.setSeriesData(v,[p]);n.push(v);q.push(this.pdPlotColors[t].brighter())}this.isBinaryClassification_(this.modelType,this.multiClass)&& (p=this.formatChartKey("classification threshold",x,c.length),v=_.keys(c[0]),1<v.length&&this.labelVocab&&1<this.labelVocab.length&&(v=[this.labelVocab[1]]),v=c[0][v].map(z=>({step:z.step,scalar:this.overallThresholds[x].threshold})),q.push(this.pdPlotTransparentColors[t]),k.setSeriesData(p,v),l.push(p),n.push(p))}k.colorScale=(new Plottable.Scales.Color).range(q);k.xAxisFormatter=this.getSimpleAxisFormatter(this.axisPrecision);k.yAxisFormatter=this.getSimpleAxisFormatter(this.axisPrecision);k.seriesWithoutTooltips= l;k.colorScale.domain(n);k.setVisibleSeries(n);g.appendChild(k);l=document.createElement("div");l.classList.add("pd-y-label");l.innerText=this.isRegression_(this.modelType)?"Inference value":"Inference score";g.appendChild(l);l=document.createElement("div");l.classList.add("pd-x-label");l.innerText=b;g.appendChild(l);return g},createPdEntryForCurrentValue:function(b,c,e){c=_.keys(c);var g=c[0];this.labelVocab&&1<this.labelVocab.length&&-1!==c.indexOf(this.labelVocab[1])&&(g=[1]);const k=g.indexOf("index"); c=+g;var q=0;-1<k&&(c=+g.substring(0,g.indexOf(" ")),q=+g.substring(k+6,g.indexOf(")")));b=this.visdata[this.selected[0]][b];Array.isArray(b)&&(b=b[q]);e=this.selectedExampleAndInference.inferences[this.selectedExampleAndInference.inferences.length-1][e];g=-1;for(q=0;q<e.length;q++)if(e[q].label==c.toString()||""==e[q].label){g=e[q].score;break}return-1==g?null:{step:b,scalar:g}},deletePdPlotProgress:function(b){b=this.featureContainerByName(b).querySelectorAll("paper-progress");for(let c=0;c<b.length;c++)nt(b[c])}, makeChartForFeature:function(b,c,e){this.deletePdPlotProgress(c);e.forEach(g=>this.addChart(b,c,g))},getInferenceVisualization:function(b,c){c={feature_name:b,inference_address:this.inferenceAddress,model_name:this.modelName,model_type:this.modelType,model_version:this.modelVersion,model_signature:this.modelSignature,x_min:this.getUniqueByEvent(c,".x-min").value,x_max:this.getUniqueByEvent(c,".x-max").value,feature_index_pattern:this.getUniqueByEvent(c,".feature-index-pattern").value,example_index:this.globalPdPlots? -1:this.selected[0],use_predict:this.usePredictApi,predict_output_tensor:this.predictOutputTensor,predict_input_tensor:this.predictInputTensor};this.local?this.fire("infer-mutants",c):(c=this.makeUrl_("infer_mutants",c),this.makeAsyncRequest_(c,(g=>this.makeChartForFeature(g.value.chartType,b,g.value.data)).bind(this),null,"Plot creation",(()=>this.handleChartErrorForFeature(b)).bind(this)));c=this.featureContainerByName(b).querySelector(".tf-category-pane-content");const e=document.createElement("paper-progress"); e.setAttribute("indeterminate",!0);e.setAttribute("class","pdplot-progress");Polymer.dom(c).appendChild(e)},handleChartErrorForFeature:function(b){const c=this.partialDepPlotPendingFeatures.indexOf(b);-1<c&&this.partialDepPlotPendingFeatures.splice(c,1);this.deletePdPlotProgress(b)},shouldHideFeatureIndicesSelector:function(b,c){return!c||0==c.length||!this.visdata||this.visdata.length<=c[0]?!0:!Array.isArray(this.visdata[c[0]][b])},shouldHidePdInputContainer:function(b,c){return this.shouldHideFeatureIndicesSelector(b.name, c)&&b.samples?!0:!1},featureContainerByName:function(b){return this.$$('[data-feature-name\x3d"'+b+'"]')},featureContainerByEvent:function(b){for(b=b.target;!b.classList.contains("feature-container");)b=b.parentNode;return b},getUniqueByEvent(b,c){return this.featureContainerByEvent(b).querySelector(c)},partialDepPlotEligibleFeaturesSet:function(b){this.isSortingEligibleFeatures=!1;b&&0!=b.length&&setTimeout(()=>{this.$$(".pd-entry-container").hidden&&this.$$(".tf-category-pane").click()},100)},categoryPaneClicked:function(b){const c= this.featureContainerByEvent(b);c.querySelector(".pd-entry-container").hasAttribute("hidden")?(this.drawPdCharts_(b),this.showPdElement_(c)):this.hidePdElement_(c)},drawPdCharts_:function(b){const c=b.model.get("item").name;-1<this.partialDepPlotPendingFeatures.indexOf(c)||(this.partialDepPlotPendingFeatures.push(c),this.getInferenceVisualization(c,b))},clearPdElementCharts_:function(b){b.querySelectorAll(".pd-holder").forEach(function(c){nt(c)})},hidePdElement_:function(b){var c=b.querySelector(".pd-entry-container"); this.clearPdElementCharts_(c);c.setAttribute("hidden",!0);c=b.querySelector(".pd-row-arrow");c.classList.remove("normal-icon");c.classList.add("rotated-icon");b=b.querySelector(".perf-table-entry");b.classList.add("perf-table-row");b.classList.remove("perf-table-row-expanded")},showPdElement_:function(b){b.querySelector(".pd-entry-container").removeAttribute("hidden");const c=b.querySelector(".pd-row-arrow");c.classList.add("normal-icon");c.classList.remove("rotated-icon");b=b.querySelector(".perf-table-entry"); b.classList.remove("perf-table-row");b.classList.add("perf-table-row-expanded")},hideAllPdElements_:function(){const b=Polymer.dom(this.root).querySelectorAll(".feature-container");for(let c=0;c<b.length;c++)this.hidePdElement_(b[c])},pdInputChanged:function(b){const c={target:b.target,model:b.model};this.debounce("pdInputChangedDebounce",()=>this.pdInputChangedImpl(c),500)},pdInputChangedImpl:function(b){this.clearPdElementCharts_(this.getUniqueByEvent(b,".tf-category-pane-content"));this.drawPdCharts_(b)}, populatePdTabs:function(){this.hideAllPdElements_();if(this.local)this.fire("get-eligible-features");else{const b=this.makeUrl_("eligible_features",{});this.makeAsyncRequest_(b,c=>{this.set("partialDepPlotEligibleFeatures",c.value)},null,"Plot setup")}},sortPdFeatures_:function(){this.hideAllPdElements_();var b={example_index:this.globalPdPlots?-1:this.selected[0],inference_address:this.inferenceAddress,model_name:this.modelName,model_type:this.modelType,model_version:this.modelVersion,model_signature:this.modelSignature, use_predict:this.usePredictApi,predict_output_tensor:this.predictOutputTensor,predict_input_tensor:this.predictInputTensor};this.isSortingEligibleFeatures=!0;this.local?(b.features=this.partialDepPlotEligibleFeatures,this.fire("sort-eligible-features",b)):(b=this.makeUrl_("sort_eligible_features",b),this.makeAsyncRequest_(b,c=>{this.set("partialDepPlotEligibleFeatures",c.value)},null,"Plot ordering",(()=>{this.isSortingEligibleFeatures=!1}).bind(this)))},shouldDisableSortFeaturesButton:function(b, c){return c||null==b||0==b.length},toggleTrueLabelSetup:function(){this.$.collapsetruelabel.toggle()},toggleExplorerSetup:function(){this.$$("#collapseexplorer").toggle()},toggleContextTools:function(){this.$.collapsecontexttools.toggle()},togglePerformance:function(){this.$.collapseperformance.toggle()},toggleInferenceResults:function(){this.$$("#collapseinference").toggle()},getExpandCollapseIcon:function(b){return b?"expand-less":"expand-more"},getExpandCollapsePerfIconClass:function(b){return b? "normal-icon":"rotated-icon"},getPerfTableRowClass:function(b){return b?"perf-table-row-expanded":"perf-table-row"},getPerfTableModelClass:function(b){return 2>b?"perf-table-model-single":"perf-table-model"},getDatapointEditorTitle:function(b,c){return this.getSectionTitle("Edit",b,c)},getInferTitle:function(b,c){return this.getSectionTitle("Infer",b,c)},getSectionTitle:function(b,c,e){null!=c&&""!==c&&(b=null!=e&&0<e.length?b+(" - Datapoints "+c+" and "+e[0]):b+(" - Datapoint "+c));return b},togglePerfRow:function(b){for(b= b.target;null!=b&&!b.dataset.index;)b=b.parentNode;null!=b&&(b=b.dataset.index,this.set("featureValueThresholds."+b+".opened",!this.featureValueThresholds[b].opened),this.featureValueThresholds[b].opened&&requestAnimationFrame(()=>this.updateInferenceStats_(!0)))},getPerformanceTabTitle:function(b,c){return this.isBinaryClassification_(b,c)?"Performance \x26 Fairness":"Performance"},getPerfTableTitle:function(b,c,e,g){let k=this.getPrintableOptimizationName(e);if(null==b||0==b.length)return"custom"== e?"Explore overall performance":k;null!=c&&0!=c.length&&(b+="/"+c);return k+" for "+g.length+" values of "+b},getNoThresholdPerfTableTitle:function(b,c,e){if(null==b||0==b.length)return"Explore overall performance";null!=c&&0!=c.length&&(b+="/"+c);return b+" ("+e.length+" values)"},getPrintableOptimizationName:function(b){return"custom"==b?"Custom thresholds":"unaware"==b?"Optimal single threshold":"demoparity"==b?"Demographic parity thresholds":"equalopp"==b?"Equal opportunity thresholds":"equalacc"== b?"Equal accuracy thresholds":"Optimal group thresholds"},getFeatureSortBy:function(b,c){let e=["Count","Alphabetical"];return e=this.isBinaryClassification_(b,c)?e.concat(["Accuracy","False positives","False negatives"]):this.isMultiClass_(b,c)?e.concat(["Accuracy"]):e.concat("Mean error;Median error;Mean absolute error;Median absolute error;Mean squared error;Median squared error".split(";"))},selectedFeatureSortChanged_:function(){var b=this.featureValueThresholds;this.featureValueThresholds=[]; this.featureValueThresholds=this.sortFeatureValues(b);null!=this.regressionEntries_&&(b=this.regressionEntries_,this.regressionEntries_=[],this.regressionEntries_=this.sortRegressionEntries(b))},getSliderClass:function(b){return"slider "+(0==b?"slider-model-one":"slider-model-two")},formatError:function(b){return d3.format(".3f")(b)},expandAllPerformance:function(){if(null!=this.featureValueThresholds){for(let b=0;b<this.featureValueThresholds.length;b++)this.set("featureValueThresholds."+b+".opened", !0);requestAnimationFrame(()=>this.updateInferenceStats_(!0))}},collapseAllPerformance:function(){if(null!=this.featureValueThresholds)for(let b=0;b<this.featureValueThresholds.length;b++)this.set("featureValueThresholds."+b+".opened",!1)},getPerfTableEntryClass:function(b){let c="perf-table-entry perf-table-row ";"interestingness"in b&&0==b.interestingness&&(c+="perf-table-entry-trivial");return c},getFacetedAttributions:function(b,c){return b[this.getPrintableValue_(c)]},getRegressionAttributions:function(b){return"All datapoints"=== b?this.meanAttributions_:this.facetedMeanAttributions_[b]}});So.registerDashboard()})();