xxxxxxxxxx
173
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ml5=e():t.ml5=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=967)}([function(t,e,n){"use strict";n.r(e),function(t,r,i,o){n.d(e,"AdadeltaOptimizer",function(){return wl}),n.d(e,"AdagradOptimizer",function(){return xl}),n.d(e,"AdamOptimizer",function(){return _l}),n.d(e,"AdamaxOptimizer",function(){return kl}),n.d(e,"DataStorage",function(){return Hr}),n.d(e,"ENV",function(){return h}),n.d(e,"Environment",function(){return f}),n.d(e,"KernelBackend",function(){return $r}),n.d(e,"MomentumOptimizer",function(){return El}),n.d(e,"Optimizer",function(){return yl}),n.d(e,"RMSPropOptimizer",function(){return Ol}),n.d(e,"Rank",function(){return gt}),n.d(e,"Reduction",function(){return Iu}),n.d(e,"SGDOptimizer",function(){return Sl}),n.d(e,"Tensor",function(){return pt}),n.d(e,"TensorBuffer",function(){return lt}),n.d(e,"Variable",function(){return mt}),n.d(e,"abs",function(){return Lo}),n.d(e,"acos",function(){return Bo}),n.d(e,"acosh",function(){return Uo}),n.d(e,"add",function(){return Is}),n.d(e,"addN",function(){return Ds}),n.d(e,"addStrict",function(){return js}),n.d(e,"all",function(){return cs}),n.d(e,"any",function(){return ls}),n.d(e,"argMax",function(){return fs}),n.d(e,"argMin",function(){return ds}),n.d(e,"asin",function(){return Wo}),n.d(e,"asinh",function(){return qo}),n.d(e,"atan",function(){return Vo}),n.d(e,"atan2",function(){return Rs}),n.d(e,"atanh",function(){return Ho}),n.d(e,"avgPool",function(){return es}),n.d(e,"backend",function(){return Ke}),n.d(e,"backend_util",function(){return ci}),n.d(e,"basicLSTMCell",function(){return vu}),n.d(e,"batchNorm",function(){return Na}),n.d(e,"batchNorm2d",function(){return Ta}),n.d(e,"batchNorm3d",function(){return Ia}),n.d(e,"batchNorm4d",function(){return Da}),n.d(e,"batchNormalization",function(){return Ma}),n.d(e,"batchNormalization2d",function(){return Oa}),n.d(e,"batchNormalization3d",function(){return Aa}),n.d(e,"batchNormalization4d",function(){return Ca}),n.d(e,"batchToSpaceND",function(){return Jn}),n.d(e,"browser",function(){return al}),n.d(e,"buffer",function(){return Xn}),n.d(e,"cast",function(){return Zn}),n.d(e,"ceil",function(){return $o}),n.d(e,"clipByValue",function(){return Go}),n.d(e,"clone",function(){return Qn}),n.d(e,"complex",function(){return hn}),n.d(e,"concat",function(){return In}),n.d(e,"concat1d",function(){return Dn}),n.d(e,"concat2d",function(){return jn}),n.d(e,"concat3d",function(){return Rn}),n.d(e,"concat4d",function(){return Fn}),n.d(e,"conv1d",function(){return Pa}),n.d(e,"conv2d",function(){return za}),n.d(e,"conv2dDerFilter",function(){return Ba}),n.d(e,"conv2dTranspose",function(){return qa}),n.d(e,"conv3d",function(){return La}),n.d(e,"cos",function(){return Ko}),n.d(e,"cosh",function(){return Xo}),n.d(e,"cumsum",function(){return tr}),n.d(e,"customGrad",function(){return Ur}),n.d(e,"deprecationWarn",function(){return De}),n.d(e,"depthToSpace",function(){return er}),n.d(e,"depthwiseConv2d",function(){return Ua}),n.d(e,"disableDeprecationWarnings",function(){return Ie}),n.d(e,"dispose",function(){return ze}),n.d(e,"disposeVariables",function(){return je}),n.d(e,"div",function(){return Fs}),n.d(e,"divStrict",function(){return Ps}),n.d(e,"dot",function(){return Ha}),n.d(e,"dropout",function(){return Nu}),n.d(e,"elu",function(){return ou}),n.d(e,"enableDebugMode",function(){return Te}),n.d(e,"enableProdMode",function(){return Ne}),n.d(e,"environment",function(){return m}),n.d(e,"equal",function(){return ws}),n.d(e,"equalStrict",function(){return xs}),n.d(e,"erf",function(){return Yo}),n.d(e,"exp",function(){return Jo}),n.d(e,"expandDims",function(){return nr}),n.d(e,"expm1",function(){return Zo}),n.d(e,"eye",function(){return rr}),n.d(e,"fft",function(){return ku}),n.d(e,"fill",function(){return An}),n.d(e,"findBackend",function(){return He}),n.d(e,"findBackendFactory",function(){return $e}),n.d(e,"floor",function(){return Qo}),n.d(e,"floorDiv",function(){return zs}),n.d(e,"frame",function(){return Ru}),n.d(e,"fused",function(){return ic}),n.d(e,"gather",function(){return mu}),n.d(e,"gatherND",function(){return Mu}),n.d(e,"getBackend",function(){return qe}),n.d(e,"grad",function(){return Fr}),n.d(e,"grads",function(){return Pr}),n.d(e,"greater",function(){return _s}),n.d(e,"greaterEqual",function(){return ks}),n.d(e,"greaterEqualStrict",function(){return Ss}),n.d(e,"greaterStrict",function(){return Es}),n.d(e,"hammingWindow",function(){return ju}),n.d(e,"hannWindow",function(){return Du}),n.d(e,"ifft",function(){return Su}),n.d(e,"imag",function(){return mn}),n.d(e,"image",function(){return nc}),n.d(e,"io",function(){return nl}),n.d(e,"irfft",function(){return Ou}),n.d(e,"isFinite",function(){return fa}),n.d(e,"isInf",function(){return la}),n.d(e,"isNaN",function(){return ca}),n.d(e,"keep",function(){return Le}),n.d(e,"leakyRelu",function(){return au}),n.d(e,"less",function(){return Os}),n.d(e,"lessEqual",function(){return As}),n.d(e,"lessEqualStrict",function(){return Cs}),n.d(e,"lessStrict",function(){return Ms}),n.d(e,"linalg",function(){return Yu}),n.d(e,"linspace",function(){return Cn}),n.d(e,"localResponseNormalization",function(){return fu}),n.d(e,"log",function(){return ta}),n.d(e,"log1p",function(){return ea}),n.d(e,"logSigmoid",function(){return na}),n.d(e,"logSoftmax",function(){return Vr}),n.d(e,"logSumExp",function(){return hs}),n.d(e,"logicalAnd",function(){return Qs}),n.d(e,"logicalNot",function(){return tu}),n.d(e,"logicalOr",function(){return eu}),n.d(e,"logicalXor",function(){return nu}),n.d(e,"losses",function(){return $u}),n.d(e,"matMul",function(){return Va}),n.d(e,"math",function(){return il}),n.d(e,"max",function(){return ps}),n.d(e,"maxPool",function(){return ts}),n.d(e,"maximum",function(){return Ls}),n.d(e,"maximumStrict",function(){return Bs}),n.d(e,"mean",function(){return ms}),n.d(e,"memory",function(){return Re}),n.d(e,"min",function(){return gs}),n.d(e,"minimum",function(){return Us}),n.d(e,"minimumStrict",function(){return Ws}),n.d(e,"mod",function(){return qs}),n.d(e,"modStrict",function(){return Vs}),n.d(e,"moments",function(){return vs}),n.d(e,"movingAverage",function(){return yu}),n.d(e,"mul",function(){return Hs}),n.d(e,"mulStrict",function(){return $s}),n.d(e,"multiRNNCell",function(){return bu}),n.d(e,"multinomial",function(){return ir}),n.d(e,"neg",function(){return ra}),n.d(e,"nextFrame",function(){return Nl}),n.d(e,"norm",function(){return du}),n.d(e,"notEqual",function(){return Ns}),n.d(e,"notEqualStrict",function(){return Ts}),n.d(e,"oneHot",function(){return or}),n.d(e,"ones",function(){return En}),n.d(e,"onesLike",function(){return Nn}),n.d(e,"op",function(){return dn}),n.d(e,"outerProduct",function(){return $a}),n.d(e,"pad",function(){return ar}),n.d(e,"pad1d",function(){return sr}),n.d(e,"pad2d",function(){return ur}),n.d(e,"pad3d",function(){return cr}),n.d(e,"pad4d",function(){return lr}),n.d(e,"pool",function(){return ns}),n.d(e,"pow",function(){return Gs}),n.d(e,"powStrict",function(){return Ks}),n.d(e,"prelu",function(){return su}),n.d(e,"print",function(){return Yn}),n.d(e,"prod",function(){return ys}),n.d(e,"profile",function(){return Fe}),n.d(e,"rand",function(){return fr}),n.d(e,"randomNormal",function(){return dr}),n.d(e,"randomUniform",function(){return hr}),n.d(e,"range",function(){return Mn}),n.d(e,"ready",function(){return We}),n.d(e,"real",function(){return pn}),n.d(e,"reciprocal",function(){return ia}),n.d(e,"registerBackend",function(){return Ge}),n.d(e,"relu",function(){return uu}),n.d(e,"removeBackend",function(){return Ve}),n.d(e,"reshape",function(){return pr}),n.d(e,"reverse",function(){return Ga}),n.d(e,"reverse1d",function(){return Ka}),n.d(e,"reverse2d",function(){return Xa}),n.d(e,"reverse3d",function(){return Ya}),n.d(e,"reverse4d",function(){return Ja}),n.d(e,"rfft",function(){return Eu}),n.d(e,"round",function(){return oa}),n.d(e,"rsqrt",function(){return aa}),n.d(e,"scalar",function(){return bn}),n.d(e,"scatterND",function(){return _u}),n.d(e,"selu",function(){return cu}),n.d(e,"separableConv2d",function(){return Wa}),n.d(e,"serialization",function(){return ll}),n.d(e,"setBackend",function(){return Ue}),n.d(e,"setPlatform",function(){return Xe}),n.d(e,"setdiff1dAsync",function(){return xr}),n.d(e,"sigmoid",function(){return sa}),n.d(e,"sign",function(){return ua}),n.d(e,"signal",function(){return Fu}),n.d(e,"sin",function(){return da}),n.d(e,"sinh",function(){return ha}),n.d(e,"slice",function(){return rs}),n.d(e,"slice1d",function(){return is}),n.d(e,"slice2d",function(){return os}),n.d(e,"slice3d",function(){return as}),n.d(e,"slice4d",function(){return ss}),n.d(e,"softmax",function(){return qr}),n.d(e,"softplus",function(){return pa}),n.d(e,"spaceToBatchND",function(){return mr}),n.d(e,"sparseToDense",function(){return Cu}),n.d(e,"spectral",function(){return Au}),n.d(e,"split",function(){return Pn}),n.d(e,"sqrt",function(){return ma}),n.d(e,"square",function(){return ga}),n.d(e,"squaredDifference",function(){return Xs}),n.d(e,"squaredDifferenceStrict",function(){return Ys}),n.d(e,"squeeze",function(){return gr}),n.d(e,"stack",function(){return vr}),n.d(e,"step",function(){return va}),n.d(e,"stridedSlice",function(){return wu}),n.d(e,"sub",function(){return Js}),n.d(e,"subStrict",function(){return Zs}),n.d(e,"sum",function(){return bs}),n.d(e,"tan",function(){return ba}),n.d(e,"tanh",function(){return ya}),n.d(e,"tensor",function(){return gn}),n.d(e,"tensor1d",function(){return yn}),n.d(e,"tensor2d",function(){return wn}),n.d(e,"tensor3d",function(){return xn}),n.d(e,"tensor4d",function(){return _n}),n.d(e,"tensor5d",function(){return kn}),n.d(e,"tensor6d",function(){return Sn}),n.d(e,"tensor_util",function(){return Mt}),n.d(e,"test_util",function(){return gl}),n.d(e,"tidy",function(){return Pe}),n.d(e,"tile",function(){return br}),n.d(e,"time",function(){return Be}),n.d(e,"topk",function(){return xu}),n.d(e,"train",function(){return Cl}),n.d(e,"transpose",function(){return lu}),n.d(e,"truncatedNormal",function(){return yr}),n.d(e,"unsortedSegmentSum",function(){return gu}),n.d(e,"unstack",function(){return wr}),n.d(e,"util",function(){return rt}),n.d(e,"valueAndGrad",function(){return zr}),n.d(e,"valueAndGrads",function(){return Lr}),n.d(e,"variable",function(){return xt}),n.d(e,"variableGrads",function(){return Br}),n.d(e,"version_core",function(){return vl}),n.d(e,"webgl",function(){return bl}),n.d(e,"where",function(){return ru}),n.d(e,"whereAsync",function(){return iu}),n.d(e,"zeros",function(){return On}),n.d(e,"zerosLike",function(){return Tn});
/**
* @license
* Copyright 2019 Google LLC. 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.
* =============================================================================
*/
var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function c(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function l(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var f=function(){function t(t){this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return t.prototype.setPlatform=function(t,e){null!=this.platform&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+e+"."),this.platformName=t,this.platform=e},t.prototype.registerFlag=function(t,e,n){if(this.flagRegistry[t]={evaluationFn:e,setHook:n},null!=this.urlFlags[t]){var r=this.urlFlags[t];console.warn("Setting feature override from URL "+t+": "+r+"."),this.set(t,r)}},t.prototype.get=function(t){return t in this.flags?this.flags[t]:(this.flags[t]=this.evaluateFlag(t),this.flags[t])},t.prototype.getNumber=function(t){return this.get(t)},t.prototype.getBool=function(t){return this.get(t)},t.prototype.getFlags=function(){return this.flags},Object.defineProperty(t.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),t.prototype.set=function(t,e){if(null==this.flagRegistry[t])throw new Error("Cannot set flag "+t+" as it has not been registered.");this.flags[t]=e,null!=this.flagRegistry[t].setHook&&this.flagRegistry[t].setHook(e)},t.prototype.evaluateFlag=function(t){if(null==this.flagRegistry[t])throw new Error("Cannot evaluate flag '"+t+"': no evaluation function found.");return this.flagRegistry[t].evaluationFn()},t.prototype.setFlags=function(t){this.flags=Object.assign({},t)},t.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},t.prototype.populateURLFlags=function(){var t=this;if(void 0!==this.global&&void 0!==this.global.location&&void 0!==this.global.location.search){var e=d(this.global.location.search);"tfjsflags"in e&&e.tfjsflags.split(",").forEach(function(e){var n=e.split(":"),r=n[0],i=n[1];t.urlFlags[r]=function(t,e){if("true"===(e=e.toLowerCase())||"false"===e)return"true"===e;if(""+ +e===e)return+e;throw new Error("Could not parse value flag value "+e+" for flag "+t+".")}(r,i)})}},t}();function d(t){var e={};return t.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return function(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}(e,n[0],n[1]),n.join("=")}),e}var h=null;function p(t){h=t}var m=Object.freeze({Environment:f,getQueryParams:d,get ENV(){return h},setEnvironmentGlobal:p});function g(t){for(var e=t.length,n=0,r=0;e>0;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function v(t,e,n){return Math.max(t,Math.min(e,n))}function b(t){return t%2==0?t:t+1}function y(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return e}function w(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function x(t,e,n){void 0===n&&(n=""),w(E(t,e),function(){return n+" Shapes "+t+" and "+e+" must match"})}function _(t){w(null!=t,function(){return"The input to the tensor constructor must be a non-null value."})}function k(t,e){if(void 0===e&&(e=[]),null==e&&(e=[]),Array.isArray(t)||B(t))for(var n=0;n<t.length;++n)k(t[n],e);else e.push(t);return e}function S(t){if(0===t.length)return 1;for(var e=t[0],n=1;n<t.length;n++)e*=t[n];return e}function E(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function O(t){return t%1==0}function A(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)}function C(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}function M(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function N(t,e,n){return void 0===e&&(e=function(t){return 0}),new Promise(function(r,i){var o=0,a=function(){if(t())r();else{var s=e(++o);null!=n&&o>=n?i():setTimeout(a,s)}};a()})}function T(t,e){for(var n=1,r=-1,i=0;i<t.length;++i)if(t[i]>=0)n*=t[i];else if(-1===t[i]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+i);r=i}else if(t[i]<0)throw Error("Shapes can not be < 0. Found "+t[i]+" at dim "+i);if(-1===r){if(e>0&&e!==n)throw Error("Size("+e+") must match the product of shape "+t);return t}if(0===n)throw Error("Cannot infer the missing size in ["+t+"] when there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+e+" / "+n);var o=t.slice();return o[r]=e/n,o}function I(t,e){var n=e.length;return w((t=null==t?e.map(function(t,e){return e}):[].concat(t)).every(function(t){return t>=-n&&t<n}),function(){return"All values in axis param must be in range [-"+n+", "+n+") but got axis "+t}),w(t.every(function(t){return O(t)}),function(){return"All values in axis param must be integers but got axis "+t}),t.map(function(t){return t<0?n+t:t})}function D(t,e){for(var n=[],r=[],i=null==e?null:I(e,t).sort(),o=0,a=0;a<t.length;++a){if(null!=i){if(i[o]===a&&1!==t[a])throw new Error("Can't squeeze axis "+a+" since its dim '"+t[a]+"' is not 1");(null==i[o]||i[o]>a)&&1===t[a]&&(n.push(t[a]),r.push(a)),i[o]<=a&&o++}1!==t[a]&&(n.push(t[a]),r.push(a))}return{newShape:n,keptDims:r}}function j(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n}function R(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n}function F(t,e,n){if("float32"===e)for(var r=0;r<t.length;r++){var i=t[r];if(isNaN(i)||!isFinite(i))throw Error("The result of the '"+n+"' is "+i+".")}}function P(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type "+e+" being uploaded contains "+r+".")}}function z(t){return"bool"===t||"complex64"===t||"float32"===t||"int32"===t||"string"===t}function L(t,e){return!("complex64"===e||"float32"===e&&"complex64"!==t||"int32"===e&&"float32"!==t&&"complex64"!==t||"bool"===e&&"bool"===t)}function B(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function U(t){if("float32"===t||"int32"===t)return 4;if("complex64"===t)return 8;if("bool"===t)return 1;throw new Error("Unknown dtype "+t)}function W(t){if(null==t)return 0;var e=0;return t.forEach(function(t){return e+=2*t.length}),e}function q(t){return"string"==typeof t||t instanceof String}function V(t){return"boolean"==typeof t}function H(t){return"number"==typeof t}function $(t){return Array.isArray(t)?$(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array?"int32":H(t)?"float32":q(t)?"string":V(t)?"bool":"float32"}function G(t){return!!(t&&t.constructor&&t.call&&t.apply)}function K(t,e){for(var n=e;n<t;++n)if(t%n==0)return n;return t}function X(t){var e=t.length;if(e<2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var r=e-3;r>=0;--r)n[r]=n[r+1]*t[r+1];return n}function Y(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=k(t)),n&&P(t,e),function(t,e){return t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e}(t,e))return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e){for(var r=new Uint8Array(t.length),i=0;i<r.length;++i)0!==Math.round(t[i])&&(r[i]=1);return r}throw new Error("Unknown data type "+e)}function J(t,e){if(0===t.length)return e[0];var n=t.reduce(function(t,e){return t*e});if(0===n)return[];if(n!==e.length)throw new Error("["+t+"] does not match the input size.");return function t(e,n,r){var i=new Array;if(1===n.length)for(var o=n[0],a=0;a<o;a++)i[a]=r[e+a];else{o=n[0];var s=n.slice(1),u=s.reduce(function(t,e){return t*e});for(a=0;a<o;a++)i[a]=t(e+a*u,s,r)}return i}(0,t,e)}function Z(t,e){for(var n=Q(t,e),r=0;r<n.length;r++)n[r]=1;return n}function Q(t,e){if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e)return new Uint8Array(t);throw new Error("Unknown data type "+e)}function tt(){if("undefined"!=typeof performance)return performance.now();if(void 0!==t){var e=t.hrtime();return 1e3*e[0]+e[1]/1e6}throw new Error("Cannot measure time in this environment. You should run tf.js in the browser or in Node.js")}function et(t){t.forEach(function(e){w(Number.isInteger(e)&&e>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+t+"]."})})}function nt(t,e){return h.platform.fetch(t,e)}var rt=Object.freeze({shuffle:g,clamp:v,nearestLargerEven:b,sum:y,randUniform:function(t,e){var n=Math.random();return e*n+(1-n)*t},distSquared:function(t,e){for(var n=0,r=0;r<t.length;r++){var i=Number(t[r])-Number(e[r]);n+=i*i}return n},assert:w,assertShapesMatch:x,assertNonNull:_,flatten:k,sizeFromShape:S,isScalarShape:function(t){return 0===t.length},arraysEqual:E,isInt:O,tanh:A,sizeToSquarishShape:C,createShuffledIndices:function(t){for(var e=new Uint32Array(t),n=0;n<t;++n)e[n]=n;return g(e),e},rightPad:M,repeatedTry:N,inferFromImplicitShape:T,parseAxisParam:I,squeezeShape:D,getTypedArrayFromDType:j,getArrayFromDType:R,checkComputationForErrors:F,checkConversionForErrors:P,isValidDtype:z,hasEncodingLoss:L,isTypedArray:B,bytesPerElement:U,bytesFromStringArray:W,isString:q,isBoolean:V,isNumber:H,inferDtype:$,isFunction:G,nearestDivisor:K,computeStrides:X,toTypedArray:Y,toNestedArray:J,makeOnesTypedArray:Z,makeZerosTypedArray:Q,now:tt,assertNonNegativeIntegerDimensions:et,fetch:nt}),it=function(){function t(t,e){this.backendTimer=t,this.logger=e,null==e&&(this.logger=new ot)}return t.prototype.profileKernel=function(t,e){var n,r=this,i=this.backendTimer.time(function(){n=e()});return(Array.isArray(n)?n:[n]).forEach(function(e){var n=e.dataSync();F(n,e.dtype,t),i.then(function(i){var o="";null!=i.getExtraProfileInfo&&(o=i.getExtraProfileInfo()),r.logger.logKernelProfile(t,e,n,i.kernelMs,o)})}),n},t}(),ot=function(){function t(){}return t.prototype.logKernelProfile=function(t,e,n,r,i){var o=M(r+"ms",9),a=M(t,25),s=e.rank,u=e.size,c=M(e.shape.toString(),14);console.log("%c"+a+"\t%c"+o+"\t%c"+s+"D "+c+"\t%c"+u+"\t%c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green")},t}(),at=7;function st(t,e,n){return M(Array.isArray(t)?parseFloat(t[0].toFixed(at))+" + "+parseFloat(t[1].toFixed(at))+"j":q(t)?"'"+t+"'":"bool"===n?ut(t):parseFloat(t.toFixed(at)).toString(),e)}function ut(t){return 0===t?"false":"true"}function ct(t){for(var e=[],n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}var lt=function(){function t(t,e,n){var r=this;if(this.dtype=e,this.shape=t.slice(),this.size=S(t),null!=n){var i=n.length;w(i===this.size,function(){return"Length of values '"+i+"' does not match the size inferred by the shape '"+r.size+"'."})}if("complex64"===e)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||R(e,this.size),this.strides=X(t)}return t.prototype.set=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];0===n.length&&(n=[0]),w(n.length===this.rank,function(){return"The number of provided coordinates ("+n.length+") must match the rank ("+e.rank+")"});var i=this.locToIndex(n);this.values[i]=t},t.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];0===t.length&&(t=[0]);for(var n=0,r=0,i=t;r<i.length;r++){var o=i[r];if(o<0||o>=this.shape[n]){var a="Requested out of range element at "+t+". Buffer shape="+this.shape;throw new Error(a)}n++}for(var s=t[t.length-1],u=0;u<t.length-1;++u)s+=this.strides[u]*t[u];return this.values[s]},t.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e},t.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.toTensor=function(){return pt.make(this.shape,{values:this.values},this.dtype)},t}(),ft=null,dt=null,ht=null,pt=function(){function t(t,e,n,r,i){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=S(t),this.strides=X(t),this.dataId=null!=r?r:{},this.id=ft().nextTensorId(),this.rankType=this.rank<5?this.rank.toString():"higher",ft().registerTensor(this,i),null!=n&&ft().write(i,this.dataId,n)}return t.make=function(e,n,r,i){return new t(e,r,n.values,n.dataId,i)},t.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},t.prototype.asScalar=function(){return this.throwIfDisposed(),w(1===this.size,function(){return"The array must have only 1 element."}),this.reshape([])},t.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},t.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},t.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},t.prototype.as4D=function(t,e,n,r){return this.throwIfDisposed(),this.reshape([t,e,n,r])},t.prototype.as5D=function(t,e,n,r,i){return this.throwIfDisposed(),this.reshape([t,e,n,r,i])},t.prototype.asType=function(t){return this.throwIfDisposed(),dt.cast(this,t)},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.buffer=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,dt.buffer(this.shape,this.dtype,t)]}})})},t.prototype.bufferSync=function(){return dt.buffer(this.shape,this.dtype,this.dataSync())},t.prototype.array=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,J(this.shape,t)]}})})},t.prototype.arraySync=function(){return J(this.shape,this.dataSync())},t.prototype.data=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return this.throwIfDisposed(),[2,ft().read(this.dataId)]})})},t.prototype.dataSync=function(){return this.throwIfDisposed(),ft().readSync(this.dataId)},t.prototype.dispose=function(){this.isDisposed||(ft().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),t.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},t.prototype.toFloat=function(){return this.asType("float32")},t.prototype.toInt=function(){return this.asType("int32")},t.prototype.toBool=function(){return this.asType("bool")},t.prototype.print=function(t){return void 0===t&&(t=!1),dt.print(this,t)},t.prototype.reshape=function(t){return this.throwIfDisposed(),dt.reshape(this,t)},t.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},t.prototype.expandDims=function(t){return void 0===t&&(t=0),dt.expandDims(this,t)},t.prototype.cumsum=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=!1),void 0===n&&(n=!1),dt.cumsum(this,t,e,n)},t.prototype.squeeze=function(t){return this.throwIfDisposed(),dt.squeeze(this,t)},t.prototype.clone=function(){return this.throwIfDisposed(),dt.clone(this)},t.prototype.oneHot=function(t,e,n){return this.throwIfDisposed(),dt.oneHot(this,t,e,n)},t.prototype.toString=function(t){return void 0===t&&(t=!1),function(t,e,n,r){var i=X(e),o=function(t,e,n,r){var i=S(e),o=r[r.length-1],a=new Array(o).fill(0),s=e.length,u="complex64"===n?ct(t):t;if(s>1)for(var c=0;c<i/o;c++)for(var l=c*o,f=0;f<o;f++)a[f]=Math.max(a[f],st(u[l+f],0,n).length);return a}(t,e,n,i),a=e.length,s=function t(e,n,r,i,o,a){void 0===a&&(a=!0);var s="complex64"===r?2:1,u=n[0],c=n.length;if(0===c)return"complex64"===r?[st(ct(e)[0],0,r)]:"bool"===r?[ut(e[0])]:[e[0].toString()];if(1===c){if(u>20){var l=3*s,f=Array.from(e.slice(0,l)),d=Array.from(e.slice(u-3*s,u));return"complex64"===r&&(f=ct(f),d=ct(d)),["["+f.map(function(t,e){return st(t,o[e],r)}).join(", ")+", ..., "+d.map(function(t,e){return st(t,o[u-3+e],r)}).join(", ")+"]"]}return["["+("complex64"===r?ct(e):Array.from(e)).map(function(t,e){return st(t,o[e],r)}).join(", ")+"]"]}var h=n.slice(1),p=i.slice(1),m=i[0]*s,g=[];if(u>20){for(var v=0;v<3;v++){var b=(y=v*m)+m;g.push.apply(g,t(e.slice(y,b),h,r,p,o,!1))}for(g.push("..."),v=u-3;v<u;v++)b=(y=v*m)+m,g.push.apply(g,t(e.slice(y,b),h,r,p,o,v===u-1))}else for(v=0;v<u;v++){var y;b=(y=v*m)+m,g.push.apply(g,t(e.slice(y,b),h,r,p,o,v===u-1))}var w=2===c?",":"";for(g[0]="["+g[0]+w,v=1;v<g.length-1;v++)g[v]=" "+g[v]+w;var x=",\n";for(v=2;v<c;v++)x+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(a?"":x),g}(t,e,n,i,o),u=["Tensor"];return r&&(u.push(" dtype: "+n),u.push(" rank: "+a),u.push(" shape: ["+e+"]"),u.push(" values:")),u.push(s.map(function(t){return" "+t}).join("\n")),u.join("\n")}(this.dataSync(),this.shape,this.dtype,t)},t.prototype.tile=function(t){return this.throwIfDisposed(),dt.tile(this,t)},t.prototype.gather=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),dt.gather(this,t,e)},t.prototype.matMul=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),this.throwIfDisposed(),dt.matMul(this,t,e,n)},t.prototype.dot=function(t){return this.throwIfDisposed(),dt.dot(this,t)},t.prototype.norm=function(t,e,n){return void 0===t&&(t="euclidean"),void 0===e&&(e=null),void 0===n&&(n=!1),this.throwIfDisposed(),dt.norm(this,t,e,n)},t.prototype.slice=function(t,e){return this.throwIfDisposed(),dt.slice(this,t,e)},t.prototype.reverse=function(t){return this.throwIfDisposed(),dt.reverse(this,t)},t.prototype.concat=function(e,n){return void 0===n&&(n=0),this.throwIfDisposed(),e instanceof t&&(e=[e]),dt.concat([this].concat(e),n)},t.prototype.split=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),dt.split(this,t,e)},t.prototype.stack=function(t,e){return void 0===e&&(e=0),dt.stack([this,t],e)},t.prototype.unstack=function(t){return void 0===t&&(t=0),dt.unstack(this,t)},t.prototype.pad=function(t,e){return void 0===e&&(e=0),dt.pad(this,t,e)},t.prototype.batchNormalization=function(t,e,n,r,i){return void 0===n&&(n=.001),ht("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(t,e,i,r,n)},t.prototype.batchNorm=function(t,e,n,r,i){return void 0===i&&(i=.001),this.throwIfDisposed(),dt.batchNorm(this,t,e,n,r,i)},t.prototype.all=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.all(this,t,e)},t.prototype.any=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.any(this,t,e)},t.prototype.logSumExp=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.logSumExp(this,t,e)},t.prototype.sum=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.sum(this,t,e)},t.prototype.prod=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.prod(this,t,e)},t.prototype.mean=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.mean(this,t,e)},t.prototype.min=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.min(this,t,e)},t.prototype.max=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),dt.max(this,t,e)},t.prototype.argMin=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),dt.argMin(this,t)},t.prototype.argMax=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),dt.argMax(this,t)},t.prototype.cast=function(t){return this.throwIfDisposed(),dt.cast(this,t)},t.prototype.add=function(t){return this.throwIfDisposed(),dt.add(this,t)},t.prototype.addStrict=function(t){return this.throwIfDisposed(),dt.addStrict(this,t)},t.prototype.atan2=function(t){return this.throwIfDisposed(),dt.atan2(this,t)},t.prototype.sub=function(t){return this.throwIfDisposed(),dt.sub(this,t)},t.prototype.subStrict=function(t){return this.throwIfDisposed(),dt.subStrict(this,t)},t.prototype.pow=function(t){return this.throwIfDisposed(),dt.pow(this,t)},t.prototype.powStrict=function(t){return this.throwIfDisposed(),dt.powStrict(this,t)},t.prototype.mul=function(t){return this.throwIfDisposed(),dt.mul(this,t)},t.prototype.mulStrict=function(t){return this.throwIfDisposed(),dt.mulStrict(this,t)},t.prototype.div=function(t){return this.throwIfDisposed(),dt.div(this,t)},t.prototype.floorDiv=function(t){return this.throwIfDisposed(),dt.floorDiv(this,t)},t.prototype.divStrict=function(t){return this.throwIfDisposed(),dt.divStrict(this,t)},t.prototype.minimum=function(t){return this.throwIfDisposed(),dt.minimum(this,t)},t.prototype.minimumStrict=function(t){return this.throwIfDisposed(),dt.minimumStrict(this,t)},t.prototype.maximum=function(t){return this.throwIfDisposed(),dt.maximum(this,t)},t.prototype.maximumStrict=function(t){return this.throwIfDisposed(),dt.maximumStrict(this,t)},t.prototype.mod=function(t){return this.throwIfDisposed(),dt.mod(this,t)},t.prototype.modStrict=function(t){return this.throwIfDisposed(),dt.modStrict(this,t)},t.prototype.squaredDifference=function(t){return this.throwIfDisposed(),dt.squaredDifference(this,t)},t.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),dt.squaredDifferenceStrict(this,t)},t.prototype.transpose=function(t){return this.throwIfDisposed(),dt.transpose(this,t)},t.prototype.notEqual=function(t){return this.throwIfDisposed(),dt.notEqual(this,t)},t.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),dt.notEqualStrict(this,t)},t.prototype.less=function(t){return this.throwIfDisposed(),dt.less(this,t)},t.prototype.lessStrict=function(t){return this.throwIfDisposed(),dt.lessStrict(this,t)},t.prototype.equal=function(t){return this.throwIfDisposed(),dt.equal(this,t)},t.prototype.equalStrict=function(t){return this.throwIfDisposed(),dt.equalStrict(this,t)},t.prototype.lessEqual=function(t){return this.throwIfDisposed(),dt.lessEqual(this,t)},t.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),dt.lessEqualStrict(this,t)},t.prototype.greater=function(t){return this.throwIfDisposed(),dt.greater(this,t)},t.prototype.greaterStrict=function(t){return this.throwIfDisposed(),dt.greaterStrict(this,t)},t.prototype.greaterEqual=function(t){return this.throwIfDisposed(),dt.greaterEqual(this,t)},t.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),dt.greaterEqualStrict(this,t)},t.prototype.logicalAnd=function(t){return this.throwIfDisposed(),dt.logicalAnd(this,t)},t.prototype.logicalOr=function(t){return this.throwIfDisposed(),dt.logicalOr(this,t)},t.prototype.logicalNot=function(){return this.throwIfDisposed(),dt.logicalNot(this)},t.prototype.logicalXor=function(t){return this.throwIfDisposed(),dt.logicalXor(this,t)},t.prototype.where=function(t,e){return this.throwIfDisposed(),dt.where(t,this,e)},t.prototype.neg=function(){return this.throwIfDisposed(),dt.neg(this)},t.prototype.ceil=function(){return this.throwIfDisposed(),dt.ceil(this)},t.prototype.floor=function(){return this.throwIfDisposed(),dt.floor(this)},t.prototype.sign=function(){return this.throwIfDisposed(),dt.sign(this)},t.prototype.isNaN=function(){return this.throwIfDisposed(),dt.isNaN(this)},t.prototype.isInf=function(){return this.throwIfDisposed(),dt.isInf(this)},t.prototype.isFinite=function(){return this.throwIfDisposed(),dt.isFinite(this)},t.prototype.exp=function(){return this.throwIfDisposed(),dt.exp(this)},t.prototype.expm1=function(){return this.throwIfDisposed(),dt.expm1(this)},t.prototype.log=function(){return this.throwIfDisposed(),dt.log(this)},t.prototype.log1p=function(){return this.throwIfDisposed(),dt.log1p(this)},t.prototype.sqrt=function(){return this.throwIfDisposed(),dt.sqrt(this)},t.prototype.rsqrt=function(){return this.throwIfDisposed(),dt.rsqrt(this)},t.prototype.square=function(){return this.throwIfDisposed(),dt.square(this)},t.prototype.reciprocal=function(){return this.throwIfDisposed(),dt.reciprocal(this)},t.prototype.abs=function(){return this.throwIfDisposed(),dt.abs(this)},t.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),dt.clipByValue(this,t,e)},t.prototype.relu=function(){return this.throwIfDisposed(),dt.relu(this)},t.prototype.elu=function(){return this.throwIfDisposed(),dt.elu(this)},t.prototype.selu=function(){return this.throwIfDisposed(),dt.selu(this)},t.prototype.leakyRelu=function(t){return void 0===t&&(t=.2),this.throwIfDisposed(),dt.leakyRelu(this,t)},t.prototype.prelu=function(t){return this.throwIfDisposed(),dt.prelu(this,t)},t.prototype.sigmoid=function(){return this.throwIfDisposed(),dt.sigmoid(this)},t.prototype.logSigmoid=function(){return this.throwIfDisposed(),dt.logSigmoid(this)},t.prototype.softplus=function(){return this.throwIfDisposed(),dt.softplus(this)},t.prototype.zerosLike=function(){return this.throwIfDisposed(),dt.zerosLike(this)},t.prototype.onesLike=function(){return this.throwIfDisposed(),dt.onesLike(this)},t.prototype.sin=function(){return this.throwIfDisposed(),dt.sin(this)},t.prototype.cos=function(){return this.throwIfDisposed(),dt.cos(this)},t.prototype.tan=function(){return this.throwIfDisposed(),dt.tan(this)},t.prototype.asin=function(){return this.throwIfDisposed(),dt.asin(this)},t.prototype.acos=function(){return this.throwIfDisposed(),dt.acos(this)},t.prototype.atan=function(){return this.throwIfDisposed(),dt.atan(this)},t.prototype.sinh=function(){return this.throwIfDisposed(),dt.sinh(this)},t.prototype.cosh=function(){return this.throwIfDisposed(),dt.cosh(this)},t.prototype.tanh=function(){return this.throwIfDisposed(),dt.tanh(this)},t.prototype.asinh=function(){return this.throwIfDisposed(),dt.asinh(this)},t.prototype.acosh=function(){return this.throwIfDisposed(),dt.acosh(this)},t.prototype.atanh=function(){return this.throwIfDisposed(),dt.atanh(this)},t.prototype.erf=function(){return this.throwIfDisposed(),dt.erf(this)},t.prototype.round=function(){return this.throwIfDisposed(),dt.round(this)},t.prototype.step=function(t){return void 0===t&&(t=0),this.throwIfDisposed(),dt.step(this,t)},t.prototype.softmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),dt.softmax(this,t)},t.prototype.logSoftmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),dt.logSoftmax(this,t)},t.prototype.resizeBilinear=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),dt.image.resizeBilinear(this,t,e)},t.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),dt.image.resizeNearestNeighbor(this,t,e)},t.prototype.conv1d=function(t,e,n,r,i,o){return void 0===r&&(r="NWC"),void 0===i&&(i=1),this.throwIfDisposed(),dt.conv1d(this,t,e,n,r,i,o)},t.prototype.conv2d=function(t,e,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),dt.conv2d(this,t,e,n,r,i,o)},t.prototype.conv2dTranspose=function(t,e,n,r,i){return this.throwIfDisposed(),dt.conv2dTranspose(this,t,e,n,r,i)},t.prototype.depthwiseConv2D=function(t,e,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),dt.depthwiseConv2d(this,t,e,n,r,i,o)},t.prototype.separableConv2d=function(t,e,n,r,i,o){return void 0===i&&(i=[1,1]),void 0===o&&(o="NHWC"),this.throwIfDisposed(),dt.separableConv2d(this,t,e,n,r,i,o)},t.prototype.avgPool=function(t,e,n,r){return this.throwIfDisposed(),dt.avgPool(this,t,e,n,r)},t.prototype.maxPool=function(t,e,n,r){return this.throwIfDisposed(),dt.maxPool(this,t,e,n,r)},t.prototype.localResponseNormalization=function(t,e,n,r){return void 0===t&&(t=5),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=.5),dt.localResponseNormalization(this,t,e,n,r)},t.prototype.pool=function(t,e,n,r,i){return this.throwIfDisposed(),dt.pool(this,t,e,n,r,i)},t.prototype.variable=function(t,e,n){return void 0===t&&(t=!0),this.throwIfDisposed(),mt.variable(this,t,e,n)},t.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),dt.unsortedSegmentSum(this,t,e)},t.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),dt.batchToSpaceND(this,t,e)},t.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),dt.spaceToBatchND(this,t,e)},t.prototype.topk=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!0),this.throwIfDisposed(),dt.topk(this,t,e)},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s){return void 0===r&&(r=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),this.throwIfDisposed(),dt.stridedSlice(this,t,e,n,r,i,o,a,s)},t.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),dt.depthToSpace(this,t,e)},t.prototype.fft=function(){return this.throwIfDisposed(),dt.spectral.fft(this)},t.prototype.ifft=function(){return this.throwIfDisposed(),dt.spectral.ifft(this)},t.prototype.rfft=function(){return this.throwIfDisposed(),dt.spectral.rfft(this)},t.prototype.irfft=function(){return this.throwIfDisposed(),dt.spectral.irfft(this)},t}();Object.defineProperty(pt,Symbol.hasInstance,{value:function(t){return!!t&&null!=t.dataId&&null!=t.shape&&null!=t.dtype}});var mt=function(t){function e(e,n,r){void 0===n&&(n=!0);var i=t.call(this,e.shape,e.dtype,null,e.dataId)||this;i.trainable=n,i.name=r,null==i.name&&(i.name=ft().nextVariableId().toString());try{ft().registerVariable(i)}catch(t){throw ft().disposeTensor(i),t}return i}return s(e,t),e.variable=function(t,n,r,i){return void 0===n&&(n=!0),null!=i&&i!==t.dtype&&(t=t.asType(i)),new e(t,n,r)},e.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error("dtype of the new value ("+t.dtype+") and previous value ("+this.dtype+") must match");if(!E(t.shape,this.shape))throw new Error("shape of the new value ("+t.shape+") and previous value ("+this.shape+") must match");ft().disposeTensor(this),this.dataId=t.dataId,ft().registerTensor(this)},e.prototype.dispose=function(){ft().disposeVariable(this),this.isDisposedInternal=!0},e}(pt);Object.defineProperty(mt,Symbol.hasInstance,{value:function(t){return t instanceof pt&&null!=t.assign&&t.assign instanceof Function}});var gt,vt,bt,yt,wt,xt=mt.variable;!function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"}(gt||(gt={})),function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"}(vt||(vt={})),function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"}(bt||(bt={})),function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"}(yt||(yt={})),function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"}(wt||(wt={}));var _t={float32:yt,int32:vt,bool:bt,complex64:wt};function kt(t,e){if("string"===t||"string"===e){if("string"===t&&"string"===e)return"string";throw new Error("Can not upcast "+t+" with "+e)}return _t[t][e]}function St(t){return kt(t,"int32")}function Et(t,e){if(t.dtype===e.dtype)return[t,e];var n=kt(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function Ot(t,e){w(t.dtype===e.dtype,function(){return"The dtypes of the first("+t.dtype+") and second("+e.dtype+") input must match"})}function At(t){var e=[];return function t(e,n,r){if(null!=e)if(e instanceof pt)n.push(e);else if(i=e,Array.isArray(i)||"object"==typeof i){var i,o=e;for(var a in o){var s=o[a];r.has(s)||(r.add(s),t(s,n,r))}}}(t,e,new Set),e}var Ct,Mt=Object.freeze({makeTypesMatch:Et,assertTypesMatch:Ot,isTensorInList:function(t,e){for(var n=0;n<e.length;n++)if(e[n].id===t.id)return!0;return!1},getTensorsInContainer:At}),Nt=function(){function t(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return t.prototype.dispose=function(){for(var t in this.registeredVariables)this.registeredVariables[t].dispose()},t}(),Tt=function(){function t(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Nt}return t.prototype.ready=function(){return c(this,void 0,void 0,function(){var t,e,n;return l(this,function(r){switch(r.label){case 0:if(null!=this.pendingBackendInit)return[2,this.pendingBackendInit.then(function(){})];if(null!=this.backendInstance)return[2];t=this.getSortedBackends(),e=0,r.label=1;case 1:return e<t.length?(n=t[e],[4,this.initializeBackend(n).success]):[3,5];case 2:return r.sent()?[4,this.setBackend(n)]:[3,4];case 3:return r.sent(),[2];case 4:return e++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(t.prototype,"backend",{get:function(){if(null!=this.pendingBackendInit)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() before calling other methods");if(null==this.backendInstance){var t=this.initializeBackendsAndReturnBest(),e=t.name;if(t.asyncInit)throw new Error("The highest priority backend '"+e+"' has not yet been initialized. Make sure to await tf.ready() before calling other methods");this.setBackend(e)}return this.backendInstance},enumerable:!0,configurable:!0}),t.prototype.backendNames=function(){return Object.keys(this.registryFactory)},t.prototype.findBackend=function(t){if(!(t in this.registry)){if(!(t in this.registryFactory))return null;if(this.initializeBackend(t).asyncInit)return null}return this.registry[t]},t.prototype.findBackendFactory=function(t){return t in this.registryFactory?this.registryFactory[t].factory:null},t.prototype.registerBackend=function(t,e,n){return void 0===n&&(n=1),t in this.registryFactory?(console.warn(t+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[t]={factory:e,priority:n},!0)},t.prototype.setBackend=function(t){return c(this,void 0,void 0,function(){var e,n,r;return l(this,function(i){switch(i.label){case 0:if(null==this.registryFactory[t])throw new Error("Backend name '"+t+"' not found in registry");return this.backendName=t,null!=this.registry[t]?[3,4]:(this.backendInstance=null,e=this.initializeBackend(t),n=e.success,e.asyncInit?[4,n]:[3,2]);case 1:return r=i.sent(),[3,3];case 2:r=n,i.label=3;case 3:if(!r)return[2,!1];i.label=4;case 4:return this.backendInstance=this.registry[t],this.profiler=new it(this.backendInstance),[2,!0]}})})},t.prototype.initializeBackend=function(t){var e=this,n=It.registryFactory[t];if(null==n)throw new Error("Cannot initialize backend "+t+", no registration found.");try{var r=n.factory();if(Promise.resolve(r)===r){var i=++this.pendingBackendInitId,o=r.then(function(n){return!(i<e.pendingBackendInitId||(e.registry[t]=n,e.pendingBackendInit=null,0))}).catch(function(n){return!(i<e.pendingBackendInitId||(e.pendingBackendInit=null,console.warn("Initialization of backend "+t+" failed"),console.warn(n.stack||n.message),1))});return this.pendingBackendInit=o,{success:o,asyncInit:!0}}return this.registry[t]=r,{success:!0,asyncInit:!1}}catch(e){return console.warn("Initialization of backend "+t+" failed"),console.warn(e.stack||e.message),{success:!1,asyncInit:!1}}},t.prototype.removeBackend=function(t){if(!(t in this.registryFactory))throw new Error(t+" backend not found in registry");this.backendName===t&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,t in this.registry&&(this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t],this.backendName===t&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},t.prototype.getSortedBackends=function(){var t=this;if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(e,n){return t.registryFactory[n].priority-t.registryFactory[e].priority})},t.prototype.initializeBackendsAndReturnBest=function(){for(var t=this.getSortedBackends(),e=0;e<t.length;e++){var n=t[e],r=this.initializeBackend(n),i=r.success,o=r.asyncInit;if(o||i)return{name:n,asyncInit:o}}throw new Error("Could not initialize any backends, all backend initializations failed.")},t.prototype.moveData=function(t,e){this.write(t,e,this.readSync(e))},t.prototype.tidy=function(t,e){var n,r=this,i=null;if(null==e){if("function"!=typeof t)throw new Error("Please provide a function to tidy()");e=t}else{if("string"!=typeof t&&!(t instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof e)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");i=t}return this.scopedRun(function(){return r.startScope(i)},function(){return r.endScope(n)},function(){return(n=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n})},t.prototype.scopedRun=function(t,e,n){t();try{var r=n();return e(),r}catch(t){throw e(),t}},t.prototype.nextTensorId=function(){return t.nextTensorId++},t.prototype.nextVariableId=function(){return t.nextVariableId++},t.prototype.clone=function(t){var e=pt.make(t.shape,{dataId:t.dataId},t.dtype);return this.addTapeNode([t],e,function(t){return[t.toFloat()]}),e},t.prototype.runKernel=function(t,e,n){var r,i=this,o=[],a=this.isTapeOn(),s=null!=this.state.activeScope?this.state.activeScope.name:"",u=function(t){a&&(o=t.map(function(t){return i.keep(i.clone(t))}))},c=this.state.numBytes,l=this.state.numTensors;if(this.scopedRun(function(){return i.state.kernelDepth++},function(){return i.state.kernelDepth--},function(){r=i.ENV.getBool("DEBUG")?i.profiler.profileKernel(s,function(){return t(i.backend,u)}):t(i.backend,u)}),a){var f={id:this.state.nextTapeNodeId++,name:s,inputs:e,outputs:Array.isArray(r)?r:[r],saved:o};null!=n&&(f.gradient=function(t){return n(t,o)}),this.state.activeTape.push(f)}return this.state.profiling&&this.state.activeProfile.kernels.push({name:s,bytesAdded:this.state.numBytes-c,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-l,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map(function(t){return e[t].shape}),outputShape:Array.isArray(r)?r.map(function(t){return t.shape}):r.shape}),r},t.prototype.registerTensor=function(t,e){var n=this.state.tensorInfo.has(t.dataId)?this.state.tensorInfo.get(t.dataId).refCount:0;if(this.state.numTensors++,"string"===t.dtype&&this.state.numStringTensors++,0===n){this.state.numDataBuffers++;var r=0;"complex64"!==t.dtype&&"string"!==t.dtype&&(r=t.size*U(t.dtype)),this.state.tensorInfo.set(t.dataId,{backend:null!=e?e:this.backend,dtype:t.dtype,shape:t.shape,bytes:r,refCount:0}),this.state.numBytes+=r,null!=e?e.register(t.dataId,t.shape,t.dtype):this.backend.register(t.dataId,t.shape,t.dtype)}this.state.tensorInfo.get(t.dataId).refCount++,t instanceof mt||this.track(t)},t.prototype.registerVariable=function(t){if(null!=this.state.registeredVariables[t.name])throw new Error("Variable with name "+t.name+" was already registered");this.state.registeredVariables[t.name]=t},t.prototype.disposeTensor=function(t){if(this.state.tensorInfo.has(t.dataId)){this.state.numTensors--,"string"===t.dtype&&this.state.numStringTensors--;var e=this.state.tensorInfo.get(t.dataId);e.refCount<=1?("complex64"!==t.dtype&&(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(t.dataId),this.state.tensorInfo.delete(t.dataId)):this.state.tensorInfo.get(t.dataId).refCount--}},t.prototype.disposeVariables=function(){for(var t in this.state.registeredVariables){var e=this.state.registeredVariables[t];this.disposeVariable(e)}},t.prototype.disposeVariable=function(t){this.disposeTensor(t),null!=this.state.registeredVariables[t.name]&&delete this.state.registeredVariables[t.name]},t.prototype.memory=function(){var t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,null==t.reasons&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t},t.prototype.profile=function(t){return c(this,void 0,void 0,function(){var e,n;return l(this,function(r){return this.state.profiling=!0,e=this.state.numBytes,n=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(t){return t.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n,[2,this.state.activeProfile]})})},t.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&0===this.state.kernelDepth},t.prototype.addTapeNode=function(t,e,n){var r={};t.forEach(function(t,e){r[e]=t});var i={id:this.state.nextTapeNodeId++,name:this.state.activeScope.name,inputs:r,outputs:[e],gradient:function(t){var e={};return n(t).forEach(function(t,n){e[n]=function(){return t}}),e}};this.state.activeTape.push(i)},t.prototype.keep=function(t){return t.kept=!0,t},t.prototype.startTape=function(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++},t.prototype.endTape=function(){this.state.gradientDepth--},t.prototype.startScope=function(t){var e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e},t.prototype.endScope=function(t){for(var e=this,n=At(t),r=new Set(n.map(function(t){return t.id})),i=0;i<this.state.activeScope.track.length;i++){var o=this.state.activeScope.track[i];o.kept||r.has(o.id)||o.dispose()}var a=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach(function(t){t.kept||t.scopeId!==a.id||e.track(t)})},t.prototype.gradients=function(t,e,n,r){var i=this;if(void 0===r&&(r=!1),w(e.length>0,function(){return"gradients() received an empty list of xs."}),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '"+n.dtype+"'");var o=this.scopedRun(function(){return i.startTape()},function(){return i.endTape()},function(){return i.tidy("forward",t)});w(o instanceof pt,function(){return"The result y returned by f() must be a tensor."});var a=function(t,e,n){for(var r={},i={},o=0;o<e.length;o++)r[e[o].id]=!0;for(o=0;o<t.length;o++){var a=(p=t[o]).inputs;for(var s in a){for(var u=a[s],c=!1,l=0;l<e.length;l++)if(r[u.id]){p.outputs.forEach(function(t){return r[t.id]=!0}),c=!0,i[p.id]=!0;break}if(c)break}}var f={};f[n.id]=!0;var d={};for(o=t.length-1;o>=0;o--)for(a=(p=t[o]).inputs,l=0;l<p.outputs.length;l++)if(f[p.outputs[l].id]){for(var s in a)f[a[s].id]=!0,d[p.id]=!0;break}var h=[];for(o=0;o<t.length;o++){var p;if(i[(p=t[o]).id]&&d[p.id]){var m={};for(var s in p.inputs){var g=p.inputs[s];r[g.id]&&(m[s]=g)}var v=Object.assign({},p);v.inputs=m,v.outputs=p.outputs,h.push(v)}}return h}(this.state.activeTape,e,o);if(!r&&0===a.length&&e.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var t,r,s={};s[o.id]=null==n?(r=Z(S(t=o.shape),"float32"),pt.make(t,{values:r})):n,function(t,e,n){for(var r=function(r){var i=e[r],o=[];if(i.outputs.forEach(function(e){var n=t[e.id];if(null!=n)o.push(n);else{var r=pt.make(e.shape,{values:Q(e.size,e.dtype)},e.dtype);o.push(r)}}),null==i.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+i.name+".");var a=i.gradient(1===i.outputs.length?o[0]:o),s=function(e){if(!(e in a))throw new Error("Cannot backprop through input "+e+". Available gradients found: "+Object.keys(a)+".");var r=n(function(){return a[e]()});if("float32"!==r.dtype)throw new Error("Error in gradient for op "+i.name+". The gradient of input "+e+" must have 'float32' dtype, but has '"+r.dtype+"'");var o=i.inputs[e];if(!E(r.shape,o.shape))throw new Error("Error in gradient for op "+i.name+". The gradient of input '"+e+"' has shape '"+r.shape+"', which does not match the shape of the input '"+o.shape+"'");if(null==t[o.id])t[o.id]=r;else{var s=t[o.id];t[o.id]=s.add(r),s.dispose()}};for(var u in i.inputs)s(u)},i=e.length-1;i>=0;i--)r(i)}(s,a,function(t){return i.tidy(t)});var u=e.map(function(t){return s[t.id]});return 0===i.state.gradientDepth&&(i.state.activeTape.forEach(function(t){for(var e in t.saved)t.saved[e].dispose()}),i.state.activeTape=null),{value:o,grads:u}})},t.prototype.customGrad=function(t){var e=this;return w(G(t),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];w(r.every(function(t){return t instanceof pt}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var o={};return r.forEach(function(t,e){o[e]=t}),e.runKernel(function(e,i){return w((n=t.apply(void 0,r.concat([i]))).value instanceof pt,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),w(G(n.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),n.value},o,function(t,e){var i=n.gradFunc(t,e),o=Array.isArray(i)?i:[i];w(o.length===r.length,function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."}),w(o.every(function(t){return t instanceof pt}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var a={};return o.forEach(function(t,e){a[e]=function(){return t}}),a})}},t.prototype.write=function(t,e,n){var r=this.state.tensorInfo.get(e),i=r.backend;if(t=t||this.backend,"string"===r.dtype){var o=W(n);this.state.numBytes+=o-r.bytes,r.bytes=o}t!==i&&(i.disposeData(e),r.backend=t,t.register(e,r.shape,r.dtype)),t.write(e,n)},t.prototype.readSync=function(t){return this.state.tensorInfo.get(t).backend.readSync(t)},t.prototype.read=function(t){return this.state.tensorInfo.get(t).backend.read(t)},t.prototype.fromPixels=function(t,e){return this.backend.fromPixels(t,e)},t.prototype.time=function(t){return c(this,void 0,void 0,function(){var e,n;return l(this,function(r){switch(r.label){case 0:return e=tt(),[4,this.backend.time(t)];case 1:return(n=r.sent()).wallMs=tt()-e,[2,n]}})})},t.prototype.track=function(t){return null!=this.state.activeScope&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t},Object.defineProperty(t.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),t.prototype.reset=function(){for(var t in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Nt,this.registry)this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},t.nextTensorId=0,t.nextVariableId=0,t}(),It=function(){var e=function(){if(null==Ct){var e=void 0;if("undefined"!=typeof window)e=window;else if(void 0!==r)e=r;else if(void 0!==t)e=t;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}Ct=e}return Ct}();if(null==e._tfengine){var n=new f(e);e._tfengine=new Tt(n)}return p(e._tfengine.ENV),ft=function(){return e._tfengine},e._tfengine}();function Dt(){return"undefined"!=typeof window||"undefined"!=typeof WorkerGlobalScope}h.registerFlag("DEBUG",function(){return!1},function(t){t&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),h.registerFlag("IS_BROWSER",function(){return Dt()}),h.registerFlag("IS_NODE",function(){return void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node}),h.registerFlag("IS_CHROME",function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}),h.registerFlag("PROD",function(){return!1}),h.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",function(){return h.getBool("DEBUG")}),h.registerFlag("DEPRECATION_WARNINGS_ENABLED",function(){return!0}),h.registerFlag("IS_TEST",function(){return!1});var jt={},Rt={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Ft(t,e){jt[t]=e}function Pt(t){t in jt||(jt[t]=function(t){if(1!==t&&2!==t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var e=function(t){if("undefined"!=typeof OffscreenCanvas&&2===t)return new OffscreenCanvas(300,150);if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(t);return e.addEventListener("webglcontextlost",function(e){e.preventDefault(),delete jt[t]},!1),1===t?e.getContext("webgl",Rt)||e.getContext("experimental-webgl",Rt):e.getContext("webgl2",Rt)}(t));var e=jt[t];return e.isContextLost()?(delete jt[t],Pt(t)):(e.disable(e.DEPTH_TEST),e.disable(e.STENCIL_TEST),e.disable(e.BLEND),e.disable(e.DITHER),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SAMPLE_COVERAGE),e.enable(e.SCISSOR_TEST),e.enable(e.CULL_FACE),e.cullFace(e.BACK),jt[t])}function zt(t,e,n){var r=n();return e&&function(t){var e=t.getError();if(e!==t.NO_ERROR)throw new Error("WebGL Error: "+Wt(t,e))}(t),r}var Lt=5.96e-8,Bt=65504;function Ut(t){return!!(h.getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===t||Lt<Math.abs(t)&&Math.abs(t)<Bt)}function Wt(t,e){switch(e){case t.NO_ERROR:return"NO_ERROR";case t.INVALID_ENUM:return"INVALID_ENUM";case t.INVALID_VALUE:return"INVALID_VALUE";case t.INVALID_OPERATION:return"INVALID_OPERATION";case t.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case t.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case t.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+e}}function qt(t,e,n){return de(t,e,function(){return t.getExtension(n)},'Extension "'+n+'" not supported on this browser.')}function Vt(t,e,n){var r=de(t,e,function(){return t.createShader(t.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(zt(t,e,function(){return t.shaderSource(r,n)}),zt(t,e,function(){return t.compileShader(r)}),!1===t.getShaderParameter(r,t.COMPILE_STATUS))throw console.log(t.getShaderInfoLog(r)),new Error("Failed to compile vertex shader.");return r}function Ht(t,e,n){var r=de(t,e,function(){return t.createShader(t.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(zt(t,e,function(){return t.shaderSource(r,n)}),zt(t,e,function(){return t.compileShader(r)}),!1===t.getShaderParameter(r,t.COMPILE_STATUS))throw function(t,e){var n=Kt.exec(e);if(null==n)return console.log("Couldn't parse line number in error: "+e),void console.log(t);for(var r=+n[1],i=t.split("\n"),o=i.length.toString().length+2,a=i.map(function(t,e){return M((e+1).toString(),o)+t}),s=0,u=0;u<a.length;u++)s=Math.max(a[u].length,s);var c=a.slice(0,r-1),l=a.slice(r-1,r),f=a.slice(r);console.log(c.join("\n")),console.log(e.split("\n")[0]),console.log("%c "+M(l[0],s),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(f.join("\n"))}(n,t.getShaderInfoLog(r)),new Error("Failed to compile fragment shader.");return r}var $t,Gt,Kt=/ERROR: [0-9]+:([0-9]+):/g;function Xt(t,e){return de(t,e,function(){return t.createProgram()},"Unable to create WebGLProgram.")}function Yt(t,e,n){if(zt(t,e,function(){return t.linkProgram(n)}),!1===t.getProgramParameter(n,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error("Failed to link vertex and fragment shaders.")}function Jt(t,e,n){if(zt(t,e,function(){return t.validateProgram(n)}),!1===t.getProgramParameter(n,t.VALIDATE_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error("Shader program validation failed.")}function Zt(t,e,n){var r=de(t,e,function(){return t.createBuffer()},"Unable to create WebGLBuffer");return zt(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),zt(t,e,function(){return t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW)}),r}function Qt(t,e,n){var r=de(t,e,function(){return t.createBuffer()},"Unable to create WebGLBuffer");return zt(t,e,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,r)}),zt(t,e,function(){return t.bufferData(t.ELEMENT_ARRAY_BUFFER,n,t.STATIC_DRAW)}),r}function te(t,e){return de(t,e,function(){return t.createTexture()},"Unable to create WebGLTexture.")}function ee(t,e){var n=h.getNumber("WEBGL_MAX_TEXTURE_SIZE");if(t<=0||e<=0){var r="["+t+"x"+e+"]";throw new Error("Requested texture size "+r+" is invalid.")}if(t>n||e>n)throw r="["+t+"x"+e+"]",new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU ["+n+"x"+n+"].")}function ne(t,e){return de(t,e,function(){return t.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function re(t,e,n,r,i,o,a,s){var u=t.getAttribLocation(n,r);return-1!==u&&(zt(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,i)}),zt(t,e,function(){return t.vertexAttribPointer(u,o,t.FLOAT,!1,a,s)}),zt(t,e,function(){return t.enableVertexAttribArray(u)}),!0)}function ie(t,e,n,r){he(t,r),zt(t,e,function(){return t.activeTexture(t.TEXTURE0+r)}),zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)})}function oe(t,e,n,r){return de(t,e,function(){return t.getUniformLocation(n,r)},'uniform "'+r+'" not present in program.')}function ae(t,e,n){return t.getUniformLocation(e,n)}function se(t,e,n,r,i,o){zt(t,e,function(){return ie(t,e,r,o)}),zt(t,e,function(){return t.uniform1i(i,o)})}function ue(t,e,n,r){zt(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,r)}),zt(t,e,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)})}function ce(t,e,n){zt(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,n)}),zt(t,e,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0)})}function le(t){var e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+fe(t,e))}function fe(t,e){switch(e){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case t.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+e}}function de(t,e,n,r){var i=zt(t,e,function(){return n()});if(null==i)throw new Error(r);return i}function he(t,e){var n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=e+t.TEXTURE0;if(r<t.TEXTURE0||r>n)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function pe(t,e){return void 0===e&&(e=2),S(t.slice(0,t.length-e))}function me(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]}function ge(t){var e=[1,1,1];return 0===t.length||1===t.length&&1===t[0]||(e=[pe(t)].concat(me(t))),e}function ve(t,e){var n;void 0===e&&(e=!1);var r=h.getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e&&(r*=2,1===(t=t.map(function(e,n){return n>=t.length-2?b(t[n]):t[n]})).length&&(t=[2,t[0]])),2!==t.length){var i=D(t);t=i.newShape}var o=S(t);if(t.length<=1&&o<=r)return[1,o];if(2===t.length&&t[0]<=r&&t[1]<=r)return t;if(3===t.length&&t[0]*t[1]<=r&&t[2]<=r)return[t[0]*t[1],t[2]];if(3===t.length&&t[0]<=r&&t[1]*t[2]<=r)return[t[0],t[1]*t[2]];if(4===t.length&&t[0]*t[1]*t[2]<=r&&t[3]<=r)return[t[0]*t[1]*t[2],t[3]];if(4===t.length&&t[0]<=r&&t[1]*t[2]*t[3]<=r)return[t[0],t[1]*t[2]*t[3]];if(e){var a=pe(t),s=2,u=2;return t.length&&(s=(n=me(t))[0],u=n[1]),C(o=a*(s/2)*(u/2)).map(function(t){return 2*t})}return C(o)}function be(t){return t%2==0}function ye(t,e){if(E(t=t.slice(-2),e=e.slice(-2)))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],r=e.slice(-1)[0];if(n===r)return!0;if(be(n)&&be(r)&&(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&&be(t[0])&&be(e[0])}function we(t){if(null==$t){var e=Pt(t);$t=e.getParameter(e.MAX_TEXTURE_SIZE)}return $t}function xe(t){if(null==Gt){var e=Pt(t);Gt=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,Gt)}function _e(t){if(0===t)return 0;var e=Pt(t);return ke(e,"EXT_disjoint_timer_query_webgl2")&&2===t?2:ke(e,"EXT_disjoint_timer_query")?1:0}function ke(t,e){return null!=t.getExtension(e)}function Se(t){try{if(null!=Pt(t))return!0}catch(t){return!1}return!1}function Ee(t){if(0===t)return!1;var e=Pt(t);if(1===t){if(!ke(e,"OES_texture_float"))return!1}else if(!ke(e,"EXT_color_buffer_float"))return!1;return Ae(e,t)}function Oe(t){if(0===t)return!1;var e=Pt(t);if(1===t){if(!ke(e,"OES_texture_float"))return!1;if(!ke(e,"WEBGL_color_buffer_float"))return!1}else if(!ke(e,"EXT_color_buffer_float"))return!1;return Ae(e,t)}function Ae(t,e){var n=t.createFramebuffer(),r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);var i=2===e?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,i,1,1,0,t.RGBA,t.FLOAT,null),t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(n),o}function Ce(t){return 2===t&&null!=Pt(t).fenceSync}var Me=Object.freeze({callAndCheck:zt,canBeRepresented:Ut,getWebGLErrorMessage:Wt,getExtensionOrThrow:qt,createVertexShader:Vt,createFragmentShader:Ht,createProgram:Xt,linkProgram:Yt,validateProgram:Jt,createStaticVertexBuffer:Zt,createStaticIndexBuffer:Qt,getNumChannels:function(){return 2===h.getNumber("WEBGL_VERSION")?1:4},createTexture:te,validateTextureSize:ee,createFramebuffer:ne,bindVertexBufferToProgramAttribute:re,bindTextureUnit:ie,unbindTextureUnit:function(t,e,n){he(t,n),zt(t,e,function(){return t.activeTexture(t.TEXTURE0+n)}),zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:oe,getProgramUniformLocation:ae,bindTextureToProgramUniformSampler:se,bindCanvasToFramebuffer:function(t,e){zt(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),zt(t,e,function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)}),zt(t,e,function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)})},bindColorTextureToFramebuffer:ue,unbindColorTextureFromFramebuffer:ce,validateFramebuffer:le,getFramebufferErrorMessage:fe,getBatchDim:pe,getRowsCols:me,getShapeAs3D:ge,getTextureShapeFromLogicalShape:ve,isReshapeFree:ye,get MAX_TEXTURE_SIZE(){return $t},get MAX_TEXTURES_IN_SHADER(){return Gt},getWebGLMaxTextureSize:we,getMaxTexturesInShader:xe,getWebGLDisjointQueryTimerVersion:_e,isWebGLVersionEnabled:Se,isRenderToFloatTextureEnabled:Ee,isDownloadFloatTextureEnabled:Oe,isWebGLFenceEnabled:Ce});function Ne(){h.set("PROD",!0)}function Te(){h.set("DEBUG",!0)}function Ie(){h.set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function De(t){h.getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(t+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function je(){It.disposeVariables()}function Re(){return It.memory()}function Fe(t){return It.profile(t)}function Pe(t,e){return It.tidy(t,e)}function ze(t){At(t).forEach(function(t){return t.dispose()})}function Le(t){return It.keep(t)}function Be(t){return It.time(t)}function Ue(t){return It.setBackend(t)}function We(){return It.ready()}function qe(){return It.backendName}function Ve(t){It.removeBackend(t)}function He(t){return It.findBackend(t)}function $e(t){return It.findBackendFactory(t)}function Ge(t,e,n){return void 0===n&&(n=1),It.registerBackend(t,e,n)}function Ke(){return It.backend}function Xe(t,e){h.setPlatform(t,e)}function Ye(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];h.getBool("IS_TEST")||console.warn.apply(console,t)}function Je(t){var e=t;if(B(t))return[t.length];if(!Array.isArray(t))return[];for(var n=[];Array.isArray(e)||B(e);)n.push(e.length),e=e[0];return Array.isArray(t)&&h.getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function t(e,n,r){if(r=r||[],Array.isArray(e)||B(e)){w(n.length>0,function(){return"Element arr["+r.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"}),w(e.length===n[0],function(){return"Element arr["+r.join("][")+"] should have "+n[0]+" elements, but has "+e.length+" elements"});for(var i=n.slice(1),o=0;o<e.length;++o)t(e[o],i,r.concat(o))}else w(0===n.length,function(){return"Element arr["+r.join("][")+"] is a primitive, but should be an array/TypedArray of "+n[0]+" elements"})}(t,n,[]),n}function Ze(t,e,n,r){if(null!=t&&("numeric"!==t&&t!==e||"numeric"===t&&"string"===e))throw new Error("Argument '"+n+"' passed to '"+r+"' must be "+t+" tensor, but got "+e+" tensor")}function Qe(t,e,n,r){if(void 0===r&&(r="numeric"),t instanceof pt)return Ze(r,t.dtype,e,n),t;var i=$(t);if("string"!==i&&["bool","int32","float32"].indexOf(r)>=0&&(i=r),Ze(r,i,e,n),null==t||!B(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t){var o=null==t?"null":t.constructor.name;throw new Error("Argument '"+e+"' passed to '"+n+"' must be a Tensor or TensorLike, but got '"+o+"'")}var a=Je(t);B(t)||Array.isArray(t)||(t=[t]);var s="string"!==i?Y(t,i,h.getBool("DEBUG")):k(t);return pt.make(a,{values:s},i)}function tn(t,e,n,r){if(void 0===r&&(r="numeric"),!Array.isArray(t))throw new Error("Argument "+e+" passed to "+n+" must be a `Tensor[]` or `TensorLike[]`");return t.map(function(t,r){return Qe(t,e+"["+r+"]",n)},r)}function en(t,e){for(var n=0;n<t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function nn(t,e,n){for(var r=t.length+e.length,i=[],o=0,a=0,s=0;s<r;s++)-1===n.indexOf(s)?i.push(t[o++]):i.push(e[a++]);return i}function rn(t,e){for(var n=[],r=t.length,i=0;i<r;i++)-1===e.indexOf(i)&&n.push(t[i]);return[n,e.map(function(e){return t[e]})]}function on(t,e){return nn(t,e.map(function(t){return 1}),e)}function an(t,e,n){w(en(e,n),function(){return t+" supports only inner-most axes for now. Got axes "+e+" and rank-"+n+" input."})}function sn(t,e){if(en(t,e))return null;for(var n=[],r=0;r<e;++r)-1===t.indexOf(r)&&n.push(r);return t.forEach(function(t){return n.push(t)}),n}function un(t){return t.map(function(t,e){return[e,t]}).sort(function(t,e){return t[1]-e[1]}).map(function(t){return t[0]})}function cn(t,e){for(var n=[],r=e-t;r<e;++r)n.push(r);return n}function ln(t,e){var n=t[0].length;t.forEach(function(t,e){w(t.length===n,function(){return"Error in concat"+n+"D: rank of tensors["+e+"] must be the same as the rank of the rest ("+n+")"})}),w(e>=0&&e<n,function(){return"Error in concat"+n+"D: axis must be between 0 and "+(n-1)+"."});var r=t[0];t.forEach(function(t,i){for(var o=0;o<n;o++)w(o===e||t[o]===r[o],function(){return"Error in concat"+n+"D: Shape of tensors["+i+"] ("+t+") does not match the shape of the rest ("+r+") along the non-concatenated axis "+i+"."})})}function fn(t,e){for(var n=t[0].slice(),r=1;r<t.length;r++)n[e]+=t[r][e];return n}function dn(t){var e=Object.keys(t);if(1!==e.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+e.length+" keys.");var n=e[0],r=t[n];n.endsWith("_")&&(n=n.substring(0,n.length-1));var i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];It.startScope(n);try{var i=r.apply(void 0,t);return i instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),It.endScope(i),i}catch(t){throw It.endScope(null),t}};return Object.defineProperty(i,"name",{value:n,configurable:!0}),i}h.registerFlag("HAS_WEBGL",function(){return h.getNumber("WEBGL_VERSION")>0}),h.registerFlag("WEBGL_VERSION",function(){return Se(2)?2:Se(1)?1:0}),h.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return 2===h.get("WEBGL_VERSION")}),h.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),h.registerFlag("WEBGL_PACK",function(){return h.getBool("HAS_WEBGL")}),h.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_PACK_CLIP",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),h.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_PACK_REDUCE",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_LAZILY_UNPACK",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_CONV_IM2COL",function(){return h.getBool("WEBGL_PACK")}),h.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return we(h.getNumber("WEBGL_VERSION"))}),h.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return xe(h.getNumber("WEBGL_VERSION"))}),h.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var t=h.getNumber("WEBGL_VERSION");return 0===t?0:_e(t)}),h.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(t=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))));var t}),h.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return Ee(h.getNumber("WEBGL_VERSION"))}),h.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return Oe(h.getNumber("WEBGL_VERSION"))}),h.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return Ce(h.getNumber("WEBGL_VERSION"))}),h.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return h.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),ht=De;var hn=dn({complex_:function(t,e){var n=Qe(t,"real","complex"),r=Qe(e,"imag","complex");return x(n.shape,r.shape,"real and imag shapes, "+n.shape+" and "+r.shape+", must match in call to tf.complex()."),It.runKernel(function(t){return t.complex(n,r)},{$real:n,$imag:r})}}),pn=dn({real_:function(t){var e=Qe(t,"input","real");return It.runKernel(function(t){return t.real(e)},{$input:e})}}),mn=dn({imag_:function(t){var e=Qe(t,"input","imag");return It.runKernel(function(t){return t.imag(e)},{$input:e})}});function gn(t,e,n){return vn(t,e,Je(t),n)}function vn(t,e,n,r){if(null==r&&(r=$(t)),"complex64"===r)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!B(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=e){et(e);var i=S(e),o=S(n);w(i===o,function(){return"Based on the provided shape, ["+e+"], the tensor should have "+i+" values but has "+o});for(var a=0;a<n.length;++a){var s=n[a],u=a!==n.length-1||s!==S(e.slice(a));w(n[a]===e[a]||!u,function(){return"Error creating a new Tensor. Inferred shape ("+n+") does not match the provided shape ("+e+"). "})}}return B(t)||Array.isArray(t)||(t=[t]),e=e||n,t="string"!==r?Y(t,r,h.getBool("DEBUG")):k(t),pt.make(e,{values:t},r)}function bn(t,e){if((B(t)||Array.isArray(t))&&"complex64"!==e)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");return vn(t,[],[],e)}function yn(t,e){_(t);var n=Je(t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return vn(t,null,n,e)}function wn(t,e,n){if(_(t),null!=e&&2!==e.length)throw new Error("tensor2d() requires shape to have two numbers");var r=Je(t);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return vn(t,e,r,n)}function xn(t,e,n){if(_(t),null!=e&&3!==e.length)throw new Error("tensor3d() requires shape to have three numbers");var r=Je(t);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return vn(t,e,r,n)}function _n(t,e,n){if(_(t),null!=e&&4!==e.length)throw new Error("tensor4d() requires shape to have four numbers");var r=Je(t);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return vn(t,e,r,n)}function kn(t,e,n){if(_(t),null!=e&&5!==e.length)throw new Error("tensor5d() requires shape to have five numbers");var r=Je(t);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return vn(t,e,r,n)}function Sn(t,e,n){if(_(t),null!=e&&6!==e.length)throw new Error("tensor6d() requires shape to have six numbers");var r=Je(t);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return vn(t,e=e||r,r,n)}function En(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=En(t,"float32"),r=On(t,"float32");return hn(n,r)}var i=Z(S(t),e);return pt.make(t,{values:i},e)}function On(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=On(t,"float32"),r=On(t,"float32");return hn(n,r)}var i=Q(S(t),e);return pt.make(t,{values:i},e)}function An(t,e,n){return It.runKernel(function(r){return r.fill(t,e,n)},{})}function Cn(t,e,n){if(n<=0)throw new Error("The number of values should be positive.");return It.runKernel(function(r){return r.linspace(t,e,n)},{})}function Mn(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r="float32"),0===n)throw new Error("Cannot have a step of zero");if(t===e||t<e&&n<0||e<t&&n>1)return On([0],r);var i=Q(Math.abs(Math.ceil((e-t)/n)),r);e<t&&1===n&&(n=-1),i[0]=t;for(var o=1;o<i.length;o++)i[o]=i[o-1]+n;return yn(i,r)}var Nn=dn({onesLike_:function(t){var e=Qe(t,"x","onesLike");if("complex64"===e.dtype){var n=Nn(pn(e)),r=Tn(mn(e));return hn(n,r)}return It.runKernel(function(t){return t.onesLike(e)},{$x:e},function(t,e){return{$x:function(){return Tn(t)}}})}}),Tn=dn({zerosLike_:function(t){var e=Qe(t,"x","zerosLike");return It.runKernel(function(t){return t.zerosLike(e)},{$x:e},function(t,e){return{$x:function(){return Tn(t)}}})}}),In=dn({concat_:function(t,e){void 0===e&&(e=0),w(t.length>=1,function(){return"Pass at least one tensor to concat"});var n=tn(t,"tensors","concat");e=I(e,n[0].shape)[0];var r=fn(n.map(function(t){return t.shape}),e);if(0===S(r))return gn([],r);if(1===(n=n.filter(function(t){return t.size>0})).length)return n[0];var i=n.map(function(t){return t.shape});ln(i,e);var o=n;return It.runKernel(function(t){return t.concat(n,e)},o,function(t){var n=i.map(function(t){return t[e]});return Pn(t,n,e).map(function(t){return function(){return t}})})}}),Dn=dn({concat1d_:function(t){return In(t,0)}}),jn=dn({concat2d_:function(t,e){return In(t,e)}}),Rn=dn({concat3d_:function(t,e){return In(t,e)}}),Fn=dn({concat4d_:function(t,e){return In(t,e)}}),Pn=dn({split_:function(t,e,n){void 0===n&&(n=0);var r,i=Qe(t,"x","split");return n=I(n,i.shape)[0],"number"==typeof e?(w(i.shape[n]%e==0,function(){return"Number of splits must evenly divide the axis."}),r=new Array(e).fill(i.shape[n]/e)):(w(i.shape[n]===e.reduce(function(t,e){return t+e}),function(){return"The sum of sizes must match the size of the axis dimension."}),r=e),It.runKernel(function(t){return t.split(i,r,n)},{$x:i},function(t){return{$x:function(){return In(t,n)}}})}});function zn(t,e){return t(e={exports:{}},e.exports),e.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r||"undefined"!=typeof self&&self;var Ln=zn(function(t){!function(t,e,n){function r(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function i(t,e){var n=new function(t){var e,n=this,r=(e=4022871197,function(t){t=t.toString();for(var n=0;n<t.length;n++){var r=.02519603282416938*(e+=t.charCodeAt(n));r-=e=r>>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)});n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(t),n.s0<0&&(n.s0+=1),n.s1-=r(t),n.s1<0&&(n.s1+=1),n.s2-=r(t),n.s2<0&&(n.s2+=1),r=null}(t),i=e&&e.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.alea=i}(0,t)}),Bn=zn(function(t){!function(t,e,n){function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function i(t,e){var n=new function(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),e.next()}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xor128=i}(0,t)}),Un=zn(function(t){!function(t,e,n){function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function i(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),r==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xorwow=i}(0,t)}),Wn=zn(function(t){!function(t,e,n){function r(t,e){return e.x=t.x.slice(),e.i=t.i,e}function i(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.x,i=e.i;return t=r[i],n=(t^=t>>>7)^t<<24,n^=(t=r[i+1&7])^t>>>10,n^=(t=r[i+3&7])^t>>>3,n^=(t=r[i+4&7])^t<<7,t=r[i+7&7],n^=(t^=t<<13)^t<<9,r[i]=n,e.i=i+1&7,n},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n<e.length;++n)r[7&n]=r[7&n]<<15^e.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],t.x=r,t.i=0,n=256;n>0;--n)t.next()}(e,t)}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&(i.x&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xorshift7=i}(0,t)}),qn=zn(function(t){!function(t,e,n){function r(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function i(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.w,i=e.X,o=e.i;return e.w=r=r+1640531527|0,n=i[o+34&127],t=i[o=o+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=i[o]=n^t,e.i=o,n+(r^r>>>16)|0},function(t,e){var n,r,i,o,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),i=0,o=-32;o<u;++o)e&&(r^=e.charCodeAt((o+32)%e.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(e&&e.length||0)]=-1),i=127,o=512;o>0;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;t.w=a,t.X=s,t.i=i}(e,t)}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&(i.X&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xor4096=i}(0,t)}),Vn=zn(function(t){!function(t,e,n){function r(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function i(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,r=e.d,i=e.a;return t=t<<25^t>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-r|0,e.d=r<<16^n>>>16^i,e.a=i-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var r=0;r<n.length+20;r++)e.b^=0|n.charCodeAt(r),e.next()}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.tychei=i}(0,t)}),Hn=zn(function(t){!function(e,r){var i,o=this,a=256,s=6,u="random",c=r.pow(a,s),l=r.pow(2,52),f=2*l,d=a-1;function h(t,n,d){var h=[],b=g(function t(e,n){var r,i=[],o=typeof e;if(n&&"object"==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:"string"==o?e:e+"\0"}((n=1==n?{entropy:!0}:n||{}).entropy?[t,v(e)]:null==t?function(){try{var t;return i&&(t=i.randomBytes)?t=t(a):(t=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(t)),v(t)}catch(t){var n=o.navigator,r=n&&n.plugins;return[+new Date,o,r,o.screen,v(e)]}}():t,3),h),y=new p(h),w=function(){for(var t=y.g(s),e=c,n=0;t<l;)t=(t+n)*a,e*=a,n=y.g(1);for(;t>=f;)t/=2,e/=2,n>>>=1;return(t+n)/e};return w.int32=function(){return 0|y.g(4)},w.quick=function(){return y.g(4)/4294967296},w.double=w,g(v(y.S),e),(n.pass||d||function(t,e,n,i){return i&&(i.S&&m(i,y),t.state=function(){return m(y,{})}),n?(r[u]=t,e):t})(w,b,"global"in n?n.global:this==r,n.state)}function p(t){var e,n=t.length,r=this,i=0,o=r.i=r.j=0,s=r.S=[];for(n||(t=[n++]);i<a;)s[i]=i++;for(i=0;i<a;i++)s[i]=s[o=d&o+t[i%n]+(e=s[i])],s[o]=e;(r.g=function(t){for(var e,n=0,i=r.i,o=r.j,s=r.S;t--;)e=s[i=d&i+1],n=n*a+s[d&(s[i]=s[o=d&o+e])+(s[o]=e)];return r.i=i,r.j=o,n})(a)}function m(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function g(t,e){for(var n,r=t+"",i=0;i<r.length;)e[d&i]=d&(n^=19*e[d&i])+r.charCodeAt(i++);return v(e)}function v(t){return String.fromCharCode.apply(0,t)}if(r["seed"+u]=h,g(r.random(),e),t.exports){t.exports=h;try{i=n(355)}catch(t){}}}([],Math)});Hn.alea=Ln,Hn.xor128=Bn,Hn.xorwow=Un,Hn.xorshift7=Wn,Hn.xor4096=qn,Hn.tychei=Vn;var $n=Hn.alea,Gn=function(){function t(t,e,n,r,i){this.mean=t,this.stdDev=e,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var o=i||Math.random();this.random=$n(o.toString())}return t.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var t=this.nextVal;return this.nextVal=NaN,t}for(var e,n,r=!1;!r;){var i=void 0,o=void 0,a=void 0;do{a=(i=2*this.random()-1)*i+(o=2*this.random()-1)*o}while(a>=1||0===a);var s=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*i*s,n=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(e)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(e)},t.prototype.convertValue=function(t){return null==this.dtype||"float32"===this.dtype?t:Math.round(t)},t.prototype.isValidTruncated=function(t){return t<=this.upper&&t>=this.lower},t}(),Kn=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=1);var i=this;if(this.canReturnFloat=function(){return null==i.dtype||"float32"===i.dtype},this.min=t,this.range=e-t,this.dtype=n,null==r&&(r=Math.random()),"number"==typeof r&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between "+t+" - "+e+" <= 1 and dtype is not float");this.random=$n(r)}return t.prototype.convertValue=function(t){return this.canReturnFloat()?t:Math.round(t)},t.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},t}();function Xn(t,e,n){return void 0===e&&(e="float32"),e=e||"float32",et(t),new lt(t,e,n)}function Yn(t,e){void 0===e&&(e=!1),console.log(t.toString(e))}var Jn=dn({batchToSpaceND_:function(t,e,n){var r=Qe(t,"x","batchToSpaceND"),i=e.reduce(function(t,e){return t*e});return w(r.rank>=1+e.length,function(){return"input rank is "+r.rank+" but should be > than blockShape.length "+e.length}),w(n.length===e.length,function(){return"crops.length is "+n.length+" but should be equal to blockShape.length "+e.length}),w(r.shape[0]%i==0,function(){return"input tensor batch is "+r.shape[0]+" but is not divisible by the product of the elements of blockShape "+e.join(" * ")+" === "+i}),It.runKernel(function(t){return t.batchToSpaceND(r,e,n)},{$x:r},function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}})}}),Zn=dn({cast_:function(t,e){var n=Qe(t,"x","cast");if(!z(e))throw new Error("Failed to cast to unknown dtype "+e);if("string"===e&&"string"!==n.dtype||"string"!==e&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");return It.runKernel(function(t){return t.cast(n,e)},{$x:n},function(t){return{$x:function(){return t.clone()}}})}}),Qn=dn({clone_:function(t){var e=Qe(t,"x","clone",null);return It.runKernel(function(t){return pt.make(e.shape,{dataId:e.dataId},e.dtype)},{$x:e},function(t){return{$x:function(){return t.toFloat()}}})}}),tr=dn({cumsum_:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var i=Qe(t,"x","cumsum"),o=sn([e|=0],i.rank),a=i;null!=o&&(a=i.transpose(o));var s=cn(1,i.rank)[0],u=It.runKernel(function(t){return t.cumsum(a,s,n,r)},{permutedX:a},function(t){return{permutedX:function(){return t.cumsum(e,n,!r)}}});return null!=o&&(u=u.transpose(o)),u}}),er=dn({depthToSpace_:function(t,e,n){void 0===n&&(n="NHWC");var r=Qe(t,"x","depthToSpace"),i="NHWC"===n?r.shape[1]:r.shape[2],o="NHWC"===n?r.shape[2]:r.shape[3],a="NHWC"===n?r.shape[3]:r.shape[1];return w(i*e>=0,function(){return"Negative dimension size caused by overflow when multiplying\n "+i+" and "+e+" for depthToSpace with input shape\n "+r.shape}),w(o*e>=0,function(){return"Negative dimension size caused by overflow when multiplying\n "+o+" and "+e+" for depthToSpace with input shape\n "+r.shape}),w(a%(e*e)==0,function(){return"Dimension size must be evenly divisible by "+e*e+" but is "+a+" for depthToSpace with input shape "+r.shape}),It.runKernel(function(t){return t.depthToSpace(r,e,n)},{$x:r})}}),nr=dn({expandDims_:function(t,e){void 0===e&&(e=0);var n=Qe(t,"x","expandDims",null);w(e<=n.rank,function(){return"Axis must be <= rank of the tensor"});var r=n.shape.slice();return e<0&&(w(-(n.rank+1)<=e,function(){return"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"}),e=n.rank+e+1),r.splice(e,0,1),pr(n,r)}}),rr=dn({eye_:function(t,e,n,r){void 0===r&&(r="float32"),null==e&&(e=t);for(var i=Xn([t,e],r),o=t<=e?t:e,a=0;a<o;++a)i.set(1,a,a);var s=i.toTensor().as2D(t,e);if(null==n)return s;if(1===n.length)return br(nr(s,0),[n[0],1,1]);if(2===n.length)return br(nr(nr(s,0),0),[n[0],n[1],1,1]);if(3===n.length)return br(nr(nr(nr(s,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+n.length+"D.")}}),ir=dn({multinomial_:function(t,e,n,r){void 0===r&&(r=!1);var i=Qe(t,"logits","multinomial"),o=i.size,a=i.rank;if(o<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+o+".");if(a>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+a);n=n||Math.random();var s=1===a?i.as2D(1,-1):i,u=It.runKernel(function(t){return t.multinomial(s,r,e,n)},{logits2D:s});return 1===a?u.as1D():u}}),or=dn({oneHot_:function(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r=0),e<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+e);var i=Qe(t,"indices","oneHot","int32"),o=i.shape.concat([e]);return i=i.flatten(),It.runKernel(function(t){return t.oneHot(i,e,n,r)},{$indices:i},function(t){return{$indices:function(){return On(i.shape,"float32")}}}).reshape(o)}}),ar=dn({pad_:function(t,e,n){void 0===n&&(n=0);var r=Qe(t,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var i=e.map(function(t){return t[0]});return It.runKernel(function(t){return t.pad(r,e,n)},{$x:r},function(t){return{$x:function(){return t.slice(i,r.shape)}}})}}),sr=dn({pad1d_:function(t,e,n){return void 0===n&&(n=0),w(2===e.length,function(){return"Invalid number of paddings. Must be length of 2."}),ar(t,[e],n)}}),ur=dn({pad2d_:function(t,e,n){return void 0===n&&(n=0),w(2===e.length&&2===e[0].length&&2===e[1].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),ar(t,e,n)}}),cr=dn({pad3d_:function(t,e,n){return void 0===n&&(n=0),w(3===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),ar(t,e,n)}}),lr=dn({pad4d_:function(t,e,n){return void 0===n&&(n=0),w(4===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length&&2===e[3].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),ar(t,e,n)}}),fr=dn({rand_:function(t,e,n){var r=S(t),i=null;if(null==n||"float32"===n)i=new Float32Array(r);else if("int32"===n)i=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type "+n);i=new Uint8Array(r)}for(var o=0;o<r;o++)i[o]=e();return pt.make(t,{values:i},n)}}),dr=dn({randomNormal_:function(t,e,n,r,i){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var o=new Gn(e,n,r,!1,i),a=Xn(t,r),s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),hr=dn({randomUniform_:function(t,e,n,r,i){void 0===e&&(e=0),void 0===n&&(n=1),void 0===r&&(r="float32");for(var o=Xn(t,r),a=new Kn(e,n,null,i),s=0;s<o.values.length;s++)o.values[s]=a.nextValue();return o.toTensor()}}),pr=dn({reshape_:function(t,e){var n=Qe(t,"x","reshape",null);return e=T(e,n.size),w(n.size===S(e),function(){return"new shape and old shape must have the same number of elements."}),It.runKernel(function(t){return t.reshape(n,e)},{$x:n},function(t){return{$x:function(){return t.reshape(n.shape)}}})}}),mr=dn({spaceToBatchND_:function(t,e,n){var r=Qe(t,"x","spaceToBatchND");return w(r.rank>=1+e.length,function(){return"input rank "+r.rank+" should be > than [blockShape] "+e.length}),w(n.length===e.length,function(){return"paddings.shape[0] "+n.length+" must be equal to [blockShape] "+e.length}),w(r.shape.reduce(function(t,r,i){return i>0&&i<=e.length?t&&(r+n[i-1][0]+n[i-1][1])%e[i-1]==0:t},!0),function(){return"input spatial dimensions "+r.shape.slice(1)+" with paddings "+n.toString()+" must be divisible by blockShapes "+e.toString()}),It.runKernel(function(t){return t.spaceToBatchND(r,e,n)},{$x:r},function(t){return{$x:function(){return t.batchToSpaceND(e,n)}}})}}),gr=dn({squeeze_:function(t,e){var n=Qe(t,"x","squeeze");return pr(n,D(n.shape,e).newShape)}}),vr=dn({stack_:function(t,e){void 0===e&&(e=0);var n=tn(t,"tensors","stack");if(w(n.length>=1,function(){return"Pass at least one tensor to tf.stack"}),1===n.length)return n[0].expandDims(e);var r=n[0].rank,i=n[0].shape,o=n[0].dtype;w(e<=r,function(){return"Axis must be <= rank of the tensor"}),n.forEach(function(t){x(i,t.shape,"All tensors passed to stack must have matching shapes")}),n.forEach(function(t){w(o===t.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var a=n.map(function(t){return t.expandDims(e)});return In(a,e)}}),br=dn({tile_:function(t,e){var n=Qe(t,"x","tile",null);return w(n.rank===e.length,function(){return"Error in transpose: rank of input "+n.rank+" must match length of reps "+e+"."}),It.runKernel(function(t,r){var i=t.tile(n,e);return r([n]),i},{$x:n},function(t,n){var r=n[0];return{$x:function(){var n=Tn(r);if(1===r.rank)for(var i=0;i<e[0];++i)n=n.add(t.slice([i*r.shape[0]],[r.shape[0]]));else if(2===r.rank)for(i=0;i<e[0];++i)for(var o=0;o<e[1];++o)n=n.add(t.slice([i*r.shape[0],o*r.shape[1]],[r.shape[0],r.shape[1]]));else if(3===r.rank)for(i=0;i<e[0];++i)for(o=0;o<e[1];++o)for(var a=0;a<e[2];++a)n=n.add(t.slice([i*r.shape[0],o*r.shape[1],a*r.shape[2]],[r.shape[0],r.shape[1],r.shape[2]]));else{if(4!==r.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+r.rank+" tensors yet.");for(i=0;i<e[0];++i)for(o=0;o<e[1];++o)for(a=0;a<e[2];++a)for(var s=0;s<e[3];++s)n=n.add(t.slice([i*r.shape[0],o*r.shape[1],a*r.shape[2],s*r.shape[3]],[r.shape[0],r.shape[1],r.shape[2],r.shape[3]]))}return n}}})}}),yr=dn({truncatedNormal_:function(t,e,n,r,i){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var o=new Gn(e,n,r,!0,i),a=Xn(t,r),s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),wr=dn({unstack_:function(t,e){void 0===e&&(e=0),e=e||0;var n=Qe(t,"x","unstack");return w(e>=-n.shape.length&&e<n.shape.length,function(){return"Axis = "+e+" is not in [-"+n.shape.length+", "+n.shape.length+")"}),e<0&&(e+=n.shape.length),It.runKernel(function(t){return t.unstack(n,e)},{$x:n},function(t){return{$x:function(){return vr(t,e)}}})}}),xr=function(t,e){return c(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,f,d;return l(this,function(l){switch(l.label){case 0:return n=Qe(t,"x","setdiff1d"),r=Qe(e,"y","setdiff1d"),w(n.dtype===r.dtype,function(){return"x and y should have the same dtype, but got x ("+n.dtype+") and y ("+r.dtype+")."}),w(1===n.rank,function(){return"x should be 1D tensor, but got x ("+n.shape+")."}),w(1===r.rank,function(){return"y should be 1D tensor, but got y ("+r.shape+")."}),[4,n.data()];case 1:return i=l.sent(),[4,r.data()];case 2:for(o=l.sent(),a=new Set(o),s=0,f=0;f<i.length;f++)a.has(i[f])||s++;for(u=new lt([s],n.dtype),c=new lt([s],"int32"),f=0,d=0;f<i.length;f++)a.has(i[f])||(u.values[d]=i[f],c.values[d]=f,d++);return[2,[u.toTensor(),c.toTensor()]]}})})};function _r(t,e,n,r){void 0===r&&(r=!0);var i=[];if(r)(i=i.concat(e.slice(0))).push(t[0]/n),i=i.concat(t.slice(1));else{i=i.concat(t[0]);for(var o=e.length,a=0;a<o;++a)i=i.concat([t[a+1]/e[a],e[a]]);i=i.concat(t.slice(o+1))}return i}function kr(t,e,n){void 0===n&&(n=!0);var r=[];if(n){r.push(e);for(var i=e+1;i<t;++i)i<=2*e?(r.push(i),r.push(i-(e+1))):r.push(i)}else{var o=[],a=[];for(i=1;i<t;++i)i>=2*e+1||i%2==1?a.push(i):o.push(i);r.push.apply(r,o),r.push(0),r.push.apply(r,a)}return r}function Sr(t,e,n,r){void 0===r&&(r=!0);var i=[];r?i.push(t[0]/n):i.push(t[0]*n);for(var o=1;o<t.length;++o)o<=e.length?r?i.push(e[o-1]*t[o]):i.push(t[o]/e[o-1]):i.push(t[o]);return i}function Er(t,e){for(var n=[0],r=0;r<e;++r)n.push(t[r][0]);return n}function Or(t,e,n){for(var r=t.slice(0,1),i=0;i<n;++i)r.push(t[i+1]-e[i][0]-e[i][1]);return r}function Ar(t,e){if(t.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+t.rank+".");if(e.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if("int32"!==e.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+e.dtype+".");if(e.shape[e.rank-1]>t.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+e.shape[e.rank-1]+" vs. "+t.rank);if(0===t.size)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+t.shape+".");for(var n=e.shape,r=n[n.length-1],i=1,o=0;o<n.length-1;++o)i*=n[o];var a=t.shape,s=n.slice();s.pop();var u=1;for(o=r;o<t.rank;++o)u*=a[o],s.push(a[o]);var c=X(t.shape).map(function(t){return t/u}).concat([1]).slice(0,r);return[s,i,u,c]}var Cr=30;function Mr(t){return t<=Cr?t:K(t,Math.floor(Math.sqrt(t)))}function Nr(t,e,n){for(var r=e.rank>1?e.shape[e.rank-1]:1,i=n.length,o=1,a=r;a<i;++a)o*=n[a];var s=r<1?1:r;return{sliceRank:r,numUpdates:e.size/s,sliceSize:o,strides:X(n.slice(0,r)).concat([1]),outputSize:S(n)}}function Tr(t,e,n,r,i,o,a,s,u){if(void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),0!==a)throw new Error("ellipsis mask is not yet supported");if(0!==s)throw new Error("new axis mask is not yet supported");for(var c=[],l=[],f=[],d=0;d<t.length;d++)c[d]=Ir(i,e,r,t,d),l[d]=Dr(o,n,r,t,d),u&1<<d&&(l[d]=c[d]+1,f.push(d));var h=new Array(t.length).fill(0);return h=h.map(function(t,e){for(var n=0,i=r[e]||1,o=c[e];!(i>0?o>=l[e]:o<=l[e]);o+=i)n+=1;return n}),[c,h,f]}function Ir(t,e,n,r,i){var o=e[i],a=n[i]||1;(t&1<<i||null==o)&&(o=a>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var s=r[i];return o<0&&(o+=s),v(0,o,s-1)}function Dr(t,e,n,r,i){var o=e[i],a=n[i]||1;(t&1<<i||null==o)&&(o=a>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var s=r[i];return o<0&&(o+=s),a>0?v(0,o,s):v(-1,o,s-1)}function jr(t,e,n){for(var r=n.length,i=0;i<n.length;i++)if(n[i]>1){r=i;break}for(i=r+1;i<n.length;i++)if(e[i]>0||n[i]!==t[i])return!1;return!0}function Rr(t,e){for(var n=t.length>0?t[t.length-1]:1,r=0;r<t.length-1;r++)n+=t[r]*e[r];return n}function Fr(t){return w(G(t),function(){return"The f passed in grad(f) must be a function"}),function(e,n){var r=Qe(e,"x","tf.grad",null),i=null!=n?Qe(n,"dy","tf.grad"):null;return It.tidy(function(){var e=It.gradients(function(){return t(r)},[r],i),n=e.value,o=e.grads;return null!=i&&x(n.shape,i.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Wr(o),o[0]})}}function Pr(t){return w(G(t),function(){return"The f passed in grads(f) must be a function"}),function(e,n){w(Array.isArray(e),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var r=tn(e,"args","tf.grads",null),i=null!=n?Qe(n,"dy","tf.grads"):null;return It.tidy(function(){var e=It.gradients(function(){return t.apply(void 0,r)},r,i),n=e.value,o=e.grads;return null!=i&&x(n.shape,i.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Wr(o),o})}}function zr(t){return w(G(t),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(e,n){w(e instanceof pt,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),w(null==n||n instanceof pt,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var r=It.gradients(function(){return t(e)},[e],n),i=r.grads,o=r.value;return Wr(i),{grad:i[0],value:o}}}function Lr(t){return w(G(t),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(e,n){w(Array.isArray(e)&&e.every(function(t){return t instanceof pt}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),w(null==n||n instanceof pt,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var r=It.gradients(function(){return t.apply(void 0,e)},e,n);return null!=n&&x(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Wr(r.grads),r}}function Br(t,e){w(G(t),function(){return"The f passed in variableGrads(f) must be a function"}),w(null==e||Array.isArray(e)&&e.every(function(t){return t instanceof mt}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var n=null!=e;if(!n)for(var r in e=[],It.registeredVariables)e.push(It.registeredVariables[r]);var i=n?e.filter(function(t){return!t.trainable}):null,o=e.length;w((e=e.filter(function(t){return t.trainable})).length>0,function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+o+" variables is trainable."});var a=It.gradients(t,e,null,!0),s=a.value,u=a.grads;w(u.some(function(t){return null!=t}),function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."}),w(0===s.rank,function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+s.rank+" tensor"});var c={};return e.forEach(function(t,e){null!=u[e]&&(c[t.name]=u[e])}),null!=i&&i.forEach(function(t){return c[t.name]=null}),{value:s,grads:c}}function Ur(t){return It.customGrad(t)}function Wr(t){if(t.filter(function(t){return null==t}).length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.")}var qr=dn({softmax_:function(t,e){void 0===e&&(e=-1);var n=Qe(t,"logits","softmax");if(-1===e&&(e=n.rank-1),e!==n.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and dim was "+e);return Ur(function(t,n){var r=t.logSumExp([e],!0),i=t.toFloat().sub(r).exp();return n([i]),{value:i,gradFunc:function(t,n){var r=n[0],i=t.mul(r);return i.sub(i.sum([e],!0).mul(r))}}})(n)}}),Vr=dn({logSoftmax_:function(t,e){void 0===e&&(e=-1);var n=Qe(t,"logits","logSoftmax");if(-1===e&&(e=n.rank-1),e!==n.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and axis was "+e);return Ur(function(t,n){var r=t.max(e,!0),i=t.sub(r),o=i.toFloat().sub(i.exp().sum(e,!0).log());return n([o]),{value:o,gradFunc:function(t,n){var r=n[0].exp();return t.sub(t.sum(e,!0).mul(r))}}})(n)}}),Hr=function(){function t(t,e){this.backend=t,this.dataMover=e,this.data=new WeakMap}return t.prototype.get=function(t){return this.data.has(t)||this.dataMover.moveData(this.backend,t),this.data.get(t)},t.prototype.set=function(t,e){this.data.set(t,e)},t.prototype.has=function(t){return this.data.has(t)},t.prototype.delete=function(t){return this.data.delete(t)},t}(),$r=function(){function t(){}return t.prototype.time=function(t){throw new Error("Not yet implemented.")},t.prototype.read=function(t){throw new Error("Not yet implemented.")},t.prototype.readSync=function(t){throw new Error("Not yet implemented.")},t.prototype.disposeData=function(t){throw new Error("Not yet implemented.")},t.prototype.write=function(t,e){throw new Error("Not yet implemented.")},t.prototype.fromPixels=function(t,e){throw new Error("Not yet implemented.")},t.prototype.register=function(t,e,n){throw new Error("Not yet implemented.")},t.prototype.memory=function(){throw new Error("Not yet implemented.")},t.prototype.floatPrecision=function(){throw new Error("Not yet implemented")},t.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},t.prototype.batchMatMul=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){throw new Error("Not yet implemented")},t.prototype.slice=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){throw new Error("Not yet implemented")},t.prototype.unstack=function(t,e){throw new Error("Not yet implemented")},t.prototype.reverse=function(t,e){throw new Error("Not yet implemented")},t.prototype.concat=function(t,e){throw new Error("Not yet implemented")},t.prototype.neg=function(t){throw new Error("Not yet implemented")},t.prototype.add=function(t,e){throw new Error("Not yet implemented")},t.prototype.addN=function(t){throw new Error("Not yet implemented")},t.prototype.subtract=function(t,e){throw new Error("Not yet implemented")},t.prototype.multiply=function(t,e){throw new Error("Not yet implemented")},t.prototype.realDivide=function(t,e){throw new Error("Not yet implemented")},t.prototype.floorDiv=function(t,e){throw new Error("Not yet implemented")},t.prototype.sum=function(t,e){throw new Error("Not yet implemented")},t.prototype.prod=function(t,e){throw new Error("Not yet implemented")},t.prototype.unsortedSegmentSum=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.argMin=function(t,e){throw new Error("Not yet implemented")},t.prototype.argMax=function(t,e){throw new Error("Not yet implemented")},t.prototype.equal=function(t,e){throw new Error("Not yet implemented")},t.prototype.notEqual=function(t,e){throw new Error("Not yet implemented")},t.prototype.less=function(t,e){throw new Error("Not yet implemented")},t.prototype.lessEqual=function(t,e){throw new Error("Not yet implemented")},t.prototype.greater=function(t,e){throw new Error("Not yet implemented")},t.prototype.greaterEqual=function(t,e){throw new Error("Not yet implemented")},t.prototype.logicalNot=function(t){throw new Error("Not yet implemented")},t.prototype.logicalAnd=function(t,e){throw new Error("Not yet implemented")},t.prototype.logicalOr=function(t,e){throw new Error("Not yet implemented")},t.prototype.where=function(t){throw new Error("Not yet implemented")},t.prototype.select=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.topk=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.min=function(t,e){throw new Error("Not yet implemented")},t.prototype.minimum=function(t,e){throw new Error("Not yet implemented")},t.prototype.mod=function(t,e){throw new Error("Not yet implemented")},t.prototype.max=function(t,e){throw new Error("Not yet implemented")},t.prototype.maximum=function(t,e){throw new Error("Not yet implemented")},t.prototype.all=function(t,e){throw new Error("Not yet implemented")},t.prototype.any=function(t,e){throw new Error("Not yet implemented")},t.prototype.squaredDifference=function(t,e){throw new Error("Not yet implemented")},t.prototype.ceil=function(t){throw new Error("Not yet implemented")},t.prototype.floor=function(t){throw new Error("Not yet implemented")},t.prototype.round=function(t){throw new Error("Not yet implemented")},t.prototype.sign=function(t){throw new Error("Not yet implemented")},t.prototype.isNaN=function(t){throw new Error("Not yet implemented")},t.prototype.isInf=function(t){throw new Error("Not yet implemented")},t.prototype.isFinite=function(t){throw new Error("Not yet implemented")},t.prototype.pow=function(t,e){throw new Error("Not yet implemented")},t.prototype.exp=function(t){throw new Error("Not yet implemented")},t.prototype.expm1=function(t){throw new Error("Not yet implemented")},t.prototype.log=function(t){throw new Error("Not yet implemented")},t.prototype.log1p=function(t){throw new Error("Not yet implemented")},t.prototype.sqrt=function(t){throw new Error("Not yet implemented")},t.prototype.rsqrt=function(t){throw new Error("Not yet implemented")},t.prototype.square=function(t){throw new Error("Not yet implemented")},t.prototype.reciprocal=function(t){throw new Error("Not yet implemented")},t.prototype.relu=function(t){throw new Error("Not yet implemented")},t.prototype.prelu=function(t,e){throw new Error("Not yet implemented")},t.prototype.elu=function(t){throw new Error("Not yet implemented")},t.prototype.eluDer=function(t,e){throw new Error("Not yet implemented")},t.prototype.selu=function(t){throw new Error("Not yet implemented")},t.prototype.int=function(t){throw new Error("Not yet implemented")},t.prototype.clip=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.abs=function(t){throw new Error("Not yet implemented")},t.prototype.complexAbs=function(t){throw new Error("Not yet implemented")},t.prototype.sigmoid=function(t){throw new Error("Not yet implemented")},t.prototype.softplus=function(t){throw new Error("Not yet implemented")},t.prototype.sin=function(t){throw new Error("Not yet implemented")},t.prototype.cos=function(t){throw new Error("Not yet implemented")},t.prototype.tan=function(t){throw new Error("Not yet implemented")},t.prototype.asin=function(t){throw new Error("Not yet implemented")},t.prototype.acos=function(t){throw new Error("Not yet implemented")},t.prototype.atan=function(t){throw new Error("Not yet implemented")},t.prototype.atan2=function(t,e){throw new Error("Not yet implemented")},t.prototype.sinh=function(t){throw new Error("Not yet implemented")},t.prototype.cosh=function(t){throw new Error("Not yet implemented")},t.prototype.tanh=function(t){throw new Error("Not yet implemented")},t.prototype.asinh=function(t){throw new Error("Not yet implemented")},t.prototype.acosh=function(t){throw new Error("Not yet implemented")},t.prototype.atanh=function(t){throw new Error("Not yet implemented")},t.prototype.erf=function(t){throw new Error("Not yet implemented")},t.prototype.step=function(t,e){throw new Error("Not yet implemented")},t.prototype.conv2d=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.conv2dDerInput=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.conv2dDerFilter=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.depthwiseConv2D=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.depthwiseConv2DDerInput=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.conv3d=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.conv3dDerInput=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.conv3dDerFilter=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.maxPool=function(t,e){throw new Error("Not yet implemented")},t.prototype.maxPoolBackprop=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.avgPool=function(t,e){throw new Error("Not yet implemented")},t.prototype.avgPoolBackprop=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.reshape=function(t,e){throw new Error("Not yet implemented")},t.prototype.cast=function(t,e){throw new Error("Not yet implemented")},t.prototype.tile=function(t,e){throw new Error("Not yet implemented")},t.prototype.pad=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.transpose=function(t,e){throw new Error("Not yet implemented")},t.prototype.gather=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.gatherND=function(t,e){throw new Error("Not yet implemented")},t.prototype.scatterND=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.batchToSpaceND=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.spaceToBatchND=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.resizeBilinear=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.resizeBilinearBackprop=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.resizeNearestNeighbor=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.batchNormalization=function(t,e,n,r,i,o){throw new Error("Not yet implemented")},t.prototype.localResponseNormalization4D=function(t,e,n,r,i){throw new Error("Not yet implemented")},t.prototype.LRNGrad=function(t,e,n,r,i,o,a){throw new Error("Not yet implemented")},t.prototype.multinomial=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.oneHot=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.cumsum=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.nonMaxSuppression=function(t,e,n,r,i){throw new Error("Not yet implemented")},t.prototype.fft=function(t){throw new Error("Not yet implemented")},t.prototype.ifft=function(t){throw new Error("Not yet implemented")},t.prototype.complex=function(t,e){throw new Error("Not yet implemented")},t.prototype.real=function(t){throw new Error("Not yet implemented")},t.prototype.imag=function(t){throw new Error("Not yet implemented")},t.prototype.cropAndResize=function(t,e,n,r,i,o){throw new Error("Not yet implemented")},t.prototype.depthToSpace=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.split=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.sparseToDense=function(t,e,n,r){throw new Error("Not yet implemented")},t.prototype.fill=function(t,e,n){throw new Error("Not yet implemented.")},t.prototype.onesLike=function(t){throw new Error("Not yet implemented")},t.prototype.zerosLike=function(t){throw new Error("Not yet implemented")},t.prototype.linspace=function(t,e,n){throw new Error("Not yet implemented")},t.prototype.dispose=function(){throw new Error("Not yet implemented")},t}();function Gr(t,e){for(var n=t.length,r=[],i=0;i<n;i++){var o=n-1-i,a=t[o]||1;(e[e.length-1-i]||1)>1&&1===a&&r.unshift(o)}return r}function Kr(t,e){for(var n=[],r=0;r<e.length;r++){var i=t[t.length-r-1],o=e.length-r-1,a=e[o];(null==i||1===i&&a>1)&&n.unshift(o)}return n}function Xr(t,e){for(var n=[],r=Math.max(t.length,e.length),i=0;i<r;i++){var o=t[t.length-i-1];null==o&&(o=1);var a=e[e.length-i-1];if(null==a&&(a=1),1===o)n.unshift(a);else if(1===a)n.unshift(o);else{if(o!==a)throw Error("Operands could not be broadcast together with shapes "+t+" and "+e+".");n.unshift(o)}}return n}function Yr(t,e,n,r,i,o,a){void 0===a&&(a="channelsLast");var s,u=ti(e),c=u[0],l=u[1];if("channelsLast"===a)s=[c,l,t[3],t[3]];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);s=[c,l,t[1],t[1]]}return Jr(t,s,n,r,i,o,!1,a)}function Jr(t,e,n,r,i,o,a,s){void 0===a&&(a=!1),void 0===s&&(s="channelsLast");var u=[-1,-1,-1,-1],c=u[0],l=u[1],f=u[2],d=u[3];if("channelsLast"===s)c=t[0],l=t[1],f=t[2],d=t[3];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);c=t[0],d=t[1],l=t[2],f=t[3]}var h,p=e[0],m=e[1],g=e[3],v=ti(n),b=v[0],y=v[1],x=ti(r),_=x[0],k=x[1],S=ni(p,_),E=ni(m,k),A=function(t,e,n,r,i,o,a,s){var u,c,l;if("number"==typeof t){u={top:t,bottom:t,left:t,right:t,type:0===t?"VALID":"NUMBER"};var f=function(t,e,n,r,i,o){null==i&&(i=Qr(t,e,r));var a=t[1],s=ri((t[0]-e+2*i)/r+1,o);w(O(s),function(){return"The output # of rows ("+s+") must be an integer. Change the stride and/or zero pad parameters"});var u=ri((a-e+2*i)/r+1,o);return w(O(u),function(){return"The output # of columns ("+u+") must be an integer. Change the stride and/or zero pad parameters"}),[s,u,1]}([e,n,1],o,0,r,t,s);c=f[0],l=f[1]}else if("same"===t){c=Math.ceil(e/r),l=Math.ceil(n/i);var d=Math.max(0,(c-1)*r+o-e),h=Math.max(0,(l-1)*i+a-n),p=Math.floor(d/2),m=d-p,g=Math.floor(h/2);u={top:p,bottom:m,left:g,right:h-g,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((e-o+1)/r),l=Math.ceil((n-a+1)/i)}return{padInfo:u,outHeight:c,outWidth:l}}(i,l,f,b,y,S,E,o),C=A.padInfo,M=A.outHeight,N=A.outWidth,T=a?g*d:g;return"channelsFirst"===s?h=[c,T,M,N]:"channelsLast"===s&&(h=[c,M,N,T]),{batchSize:c,dataFormat:s,inHeight:l,inWidth:f,inChannels:d,outHeight:M,outWidth:N,outChannels:T,padInfo:C,strideHeight:b,strideWidth:y,filterHeight:p,filterWidth:m,effectiveFilterHeight:S,effectiveFilterWidth:E,dilationHeight:_,dilationWidth:k,inShape:t,outShape:h,filterShape:e}}function Zr(t,e,n,r,i,o,a){void 0===o&&(o=!1),void 0===a&&(a="channelsLast");var s=[-1,-1,-1,-1,-1],u=s[0],c=s[1],l=s[2],f=s[3],d=s[4];if("channelsLast"===a)u=t[0],c=t[1],l=t[2],f=t[3],d=t[4];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);u=t[0],d=t[1],c=t[2],l=t[3],f=t[4]}var h,p=e[0],m=e[1],g=e[2],v=e[4],b=ei(n),y=b[0],w=b[1],x=b[2],_=ei(r),k=_[0],S=_[1],E=_[2],O=function(t,e,n,r,i,o,a,s,u,c){var l,f,d,h;if("same"===t){var p=((f=Math.ceil(e/i))-1)*i+s-e,m=((d=Math.ceil(n/o))-1)*o+u-n,g=((h=Math.ceil(r/a))-1)*a+c-r,v=Math.floor(p/2),b=p-v,y=Math.floor(m/2),w=m-y,x=Math.floor(g/2);l={top:y,bottom:w,left:x,right:g-x,front:v,back:b,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);l={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},f=Math.ceil((e-s+1)/i),d=Math.ceil((n-u+1)/o),h=Math.ceil((r-c+1)/a)}return{padInfo:l,outDepth:f,outHeight:d,outWidth:h}}(i,c,l,f,y,w,x,ni(p,k),ni(m,S),ni(g,E)),A=O.padInfo,C=O.outDepth,M=O.outHeight,N=O.outWidth,T=o?v*d:v;return"channelsFirst"===a?h=[u,T,C,M,N]:"channelsLast"===a&&(h=[u,C,M,N,T]),{batchSize:u,dataFormat:a,inDepth:c,inHeight:l,inWidth:f,inChannels:d,outDepth:C,outHeight:M,outWidth:N,outChannels:T,padInfo:A,strideDepth:y,strideHeight:w,strideWidth:x,filterDepth:p,filterHeight:m,filterWidth:g,dilationDepth:k,dilationHeight:S,dilationWidth:E,inShape:t,outShape:h,filterShape:e}}function Qr(t,e,n,r){void 0===r&&(r=1);var i=ni(e,r);return Math.floor((t[0]*(n-1)-n+i)/2)}function ti(t){return"number"==typeof t?[t,t]:t}function ei(t){return"number"==typeof t?[t,t,t]:t}function ni(t,e){return e<=1?t:t+(t-1)*(e-1)}function ri(t,e){if(!e)return t;switch(e){case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"floor":return Math.floor(t);default:throw new Error("Unknown roundingMode "+e)}}function ii(t){var e=ti(t),n=e[0],r=e[1];return 1===n&&1===r}function oi(t,e){return ii(t)||ii(e)}function ai(t,e,n){if("complex64"===e){if("complex64"===t.dtype)return t.clone();var r=On(t.shape),i=t.toFloat(),o=n.complex(i,r);return r.dispose(),i.dispose(),o}if(!L(t.dtype,e))return pt.make(t.shape,{dataId:t.dataId},e);if("complex64"===t.dtype){var a=n.real(t);return o=a.cast(e),a.dispose(),o}if("int32"===e)return n.int(t);if("bool"===e){var s=bn(0,t.dtype);return o=n.notEqual(t,s),s.dispose(),o}throw new Error("Error in Cast: failed to cast "+t.dtype+" to "+e)}function si(t,e){return pt.make(e,{dataId:t.dataId},t.dtype)}function ui(t,e,n){var r=(e-t)/(n-1),i=Q(n,"float32");i[0]=t;for(var o=1;o<i.length;o++)i[o]=i[o-1]+r;return yn(i,"float32")}var ci=Object.freeze({castTensor:ai,reshapeTensor:si,linspaceImpl:ui,upcastType:kt,axesAreInnerMostDims:en,combineLocations:nn,computeOutAndReduceShapes:rn,expandShapeToKeepDim:on,assertAxesAreInnerMostDims:an,getAxesPermutation:sn,getUndoAxesPermutation:un,getInnerMostAxes:cn,getBroadcastDims:Gr,getReductionAxes:Kr,assertAndGetBroadcastShape:Xr,assertParamsConsistent:ln,computeOutShape:fn,computePool2DInfo:Yr,computeConv2DInfo:Jr,computeConv3DInfo:Zr,computeDefaultPad:Qr,tupleValuesAreOne:ii,eitherStridesOrDilationsAreOne:oi});function li(t,e){if(t.length!==e.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+t.length+", imag: "+e.length+".");for(var n=new Float32Array(2*t.length),r=0;r<n.length;r+=2)n[r]=t[r/2],n[r+1]=e[r/2];return n}function fi(t,e){return{real:t[2*e],imag:t[2*e+1]}}function di(t,e,n,r){t[2*r]=e,t[2*r+1]=n}function hi(t,e,n){var r=(n?2:-2)*Math.PI*(t/e);return{real:Math.cos(r),imag:Math.sin(r)}}function pi(t,e,n,r,i){for(var o=Array.from(e).map(function(t,e){return{score:t,boxIndex:e}}).filter(function(t){return t.score>i}).sort(function(t,e){return e.score-t.score}),a=[],s=0;s<o.length;s++){var u=o[s],c=u.score,l=u.boxIndex;if(c<i)break;for(var f=!1,d=a.length-1;d>=0;--d)if(mi(t,l,a[d])>=r){f=!0;break}if(!f&&(a.push(l),a.length>=n))break}return yn(a,"int32")}function mi(t,e,n){var r=t.subarray(4*e,4*e+4),i=t.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),a=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(i[0],i[2]),l=Math.min(i[1],i[3]),f=Math.max(i[0],i[2]),d=Math.max(i[1],i[3]),h=(s-o)*(u-a),p=(f-c)*(d-l);if(h<=0||p<=0)return 0;var m=Math.max(o,c),g=Math.max(a,l),v=Math.min(s,f),b=Math.min(u,d),y=Math.max(v-m,0)*Math.max(b-g,0);return y/(h+p-y)}function gi(t,e,n){var r=new Array(t.rank).fill(0),i=t.shape.slice();return e.map(function(e){i[n]=e;var o=t.slice(r,i);return r[n]+=e,o})}function vi(t,e){for(var n=new Array(t.rank),r=0;r<n.length;r++)n[r]=t.shape[r]*e[r];var i=Xn(n,t.dtype);for(r=0;r<i.values.length;++r){for(var o=i.indexToLoc(r),a=new Array(t.rank),s=0;s<a.length;s++)a[s]=o[s]%t.shape[s];var u=t.locToIndex(a);i.values[r]=t.values[u]}return i.toTensor()}function bi(t,e,n,r,i){for(var o=e[e.length-1],a=[t.length/o,o],s=a[0],u=a[1],c=j(n,s*r),l=j("int32",s*r),f=0;f<s;f++){for(var d=f*u,h=t.subarray(d,d+u),p=[],m=0;m<h.length;m++)p.push({value:h[m],index:m});p.sort(function(t,e){return e.value-t.value});var g=f*r,v=c.subarray(g,g+r),b=l.subarray(g,g+r);for(m=0;m<r;m++)v[m]=p[m].value,b[m]=p[m].index}var y=e.slice();return y[y.length-1]=r,[gn(c,y,n),gn(l,y,"int32")]}function yi(t,e){for(var n=[],r=0;r<e.length;r++)e[r]&&n.push(r);var i=Xn(t,"int32"),o=Xn([n.length,t.length],"int32");for(r=0;r<n.length;r++){var a=i.indexToLoc(n[r]),s=r*t.length;o.values.set(a,s)}return o.toTensor()}function wi(t,e){return["x","y","z","w","u","v"].slice(0,e).map(function(e){return t+"."+e})}function xi(t,e){return 1===e?[t]:wi(t,e)}function _i(){var t,e,n,r,i,o,a,s,u,c;return 2===h.getNumber("WEBGL_VERSION")?(t="#version 300 es",e="in",n="out",r="in",i="texture",o="outputColor",a="out vec4 outputColor;",s="\n bool isnan_custom(float val) {\n return (val > 0. || val < 0. || val == 0.) ? false : true;\n }\n ",u="\n const float INFINITY = uintBitsToFloat(uint(0x7f800000));\n ",c="\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "):(t="",e="attribute",n="varying",r="varying",i="texture2D",o="gl_FragColor",a="",s="\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n ",u="\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n ",c="\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "),{version:t,attribute:e,varyingVs:n,varyingFs:r,texture2D:i,output:o,defineOutput:a,defineSpecialNaN:s,defineSpecialInf:u,defineRound:c}}function ki(t,e,n){void 0===n&&(n="index");var r=X(e);return r.map(function(e,i){return"int "+t[i]+" = "+n+" / "+e+"; "+(i===r.length-1?"int "+t[i+1]+" = "+n+" - "+t[i]+" * "+e:"index -= "+t[i]+" * "+e)+";"}).join("")}function Si(t){var e=X(t).map(function(t){return t.toString()});return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * "+e[0]+" + coords.y * "+e[1]+" + coords.z;\n }\n"}var Ei="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n";var Oi="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Ai="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Ci="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Mi="\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n";function Ni(t){return"offset"+t}function Ti(t){var e=t.name,n=S(t.shapeInfo.logicalShape);return n<2?"return "+e+";":"\n for (int i = 0; i < "+n+"; i++) {\n if (i == index) {\n return "+e+"[i];\n }\n }\n "}function Ii(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error("GPU for rank "+t+" is not yet supported")}function Di(t,e){var n=JSON.parse(JSON.stringify(t));return n.shapeInfo.logicalShape=e,n}function ji(t,e){return e.map(function(e){return t[e]}).join(", ")}var Ri=function(t,e,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Xr(e,n),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n "+t+"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n "},Fi="return a + b;",Pi="return a - b;",zi="return a * b;",Li=function(t,e,n){this.variableNames=["A","B"],this.outputShape=Xr(e,n),this.userCode="\n float binaryOperation(float a, float b) {\n "+t+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},Bi=function(t,e,n,r){void 0===r&&(r=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.usesPackedTextures=!0,this.outputShape=Xr(e,n);var i=this.outputShape.length,o="";if(r)if(0===i||1===S(this.outputShape))o="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else if(o="\n "+Ii(i)+" coords = getOutputCoords();\n ",1===i)o+="\n result.y = (coords + 1) >= "+this.outputShape[0]+" ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ";else{var a=xi("coords",i);o+="\n bool nextRowOutOfBounds =\n ("+a[i-2]+" + 1) >= "+this.outputShape[i-2]+";\n bool nextColOutOfBounds =\n ("+a[i-1]+" + 1) >= "+this.outputShape[i-1]+";\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n "}this.userCode="\n vec4 binaryOperation(vec4 a, vec4 b) {\n "+t+"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n "+o+"\n\n setOutput(result);\n }\n "},Ui=function(){function t(t){this.variableNames=["A"],this.outputShape=t,this.userCode="\n uniform float min;\n uniform float max;\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, min, max));\n }\n "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,i){null==n.minLoc&&(n.minLoc=r.getUniformLocationNoThrow(i,"min"),n.maxLoc=r.getUniformLocationNoThrow(i,"max")),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}(),Wi=function(){function t(t){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t,this.userCode="\n uniform float min;\n uniform float max;\n\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(min), vec4(max)));\n }\n "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,i){null==n.minLoc&&(n.minLoc=r.getUniformLocationNoThrow(i,"min"),n.maxLoc=r.getUniformLocationNoThrow(i,"max")),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}();function qi(t,e){if(1===t)return""+e;if(2===t)return e+".y";if(3===t)return e+".z";if(4===t)return e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}var Vi,Hi,$i=function(){function t(t,e,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = "+this.getHeightCoordString()+";\n int w = "+this.getWidthCoordString()+";\n int d = "+this.getDepthCoordString()+";\n\n int in_h = h / "+e+";\n int offset_h = imod(h, "+e+");\n int in_w = w / "+e+";\n int offset_w = imod(w, "+e+");\n int offset_d = (offset_h * "+e+" + offset_w) *\n "+this.getOutputDepthSize()+";\n int in_d = d + offset_d;\n\n float result = "+this.getInputSamplingString()+";\n setOutput(result);\n }\n "}return t.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},t.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},t.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},t.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},t.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},t}(),Gi=function(t,e,n){this.variableNames=["real","imag"];var r=e[1];this.outputShape=e;var i=n?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,o=n?r+".0":"1.0";this.userCode="\n const float exponentMultiplier = "+i+";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n "+t+"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float("+r+");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < "+r+"; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / "+o+";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n "},Ki=function(){function t(t,e){this.outputShape=[],this.variableNames=["x"],this.outputShape=t,this.userCode="\n uniform float value;\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.valueLoc&&(e.valueLoc=n.getUniformLocationNoThrow(r,"value")),n.gl.uniform1f(e.valueLoc,t)}},t}();function Xi(t,e){return[e,t]}function Yi(t){var e=S(t);return C(Math.ceil(e/4))}function Ji(t,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(t/2))]}function Zi(t,e){var n=_i();return Vt(t,e,n.version+"\n precision highp float;\n "+n.attribute+" vec3 clipSpacePos;\n "+n.attribute+" vec2 uv;\n "+n.varyingVs+" vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function Qi(t,e){return Zt(t,e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function to(t,e){return Qt(t,e,new Uint16Array([0,1,2,2,1,3]))}function eo(t,e){var n,r,i,o,a,s,u,c,l=t;return 2===h.getNumber("WEBGL_VERSION")?(n=l.R32F,r=l.R16F,i=l.RGBA16F,o=l.RGBA32F,a=l.RED,s=4,u=1,c=l.HALF_FLOAT):(n=t.RGBA,r=t.RGBA,i=t.RGBA,o=l.RGBA,a=t.RGBA,s=4,u=4,c=null!=e?e.HALF_FLOAT_OES:null),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:i,internalFormatPackedFloat:o,textureFormatFloat:a,downloadTextureFormat:t.RGBA,downloadUnpackNumChannels:s,defaultNumChannels:u,textureTypeHalfFloat:c}}function no(t,e,n,r,i,o,a){ee(n,r);var s=te(t,e),u=t.TEXTURE_2D;return zt(t,e,function(){return t.bindTexture(u,s)}),zt(t,e,function(){return t.texParameteri(u,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)}),zt(t,e,function(){return t.texParameteri(u,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}),zt(t,e,function(){return t.texParameteri(u,t.TEXTURE_MIN_FILTER,t.NEAREST)}),zt(t,e,function(){return t.texParameteri(u,t.TEXTURE_MAG_FILTER,t.NEAREST)}),zt(t,e,function(){return t.texImage2D(u,0,i,n,r,0,o,a,null)}),zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)}),s}function ro(t,e,n,r,i){var o=Xi(n,r);return no(t,e,o[0],o[1],i.internalFormatFloat,i.textureFormatFloat,t.FLOAT)}function io(t,e,n,r,i){var o=Xi(n,r);return no(t,e,o[0],o[1],i.internalFormatHalfFloat,i.textureFormatFloat,i.textureTypeHalfFloat)}function oo(t,e,n,r,i){var o=Xi(n,r);return no(t,e,o[0],o[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)}function ao(t,e,n,r,i){var o=Ji(n,r);return no(t,e,o[0],o[1],i.internalFormatPackedFloat,t.RGBA,t.FLOAT)}function so(t,e,n,r,i){var o=Ji(n,r);return no(t,e,o[0],o[1],i.internalFormatPackedHalfFloat,t.RGBA,i.textureTypeHalfFloat)}function uo(t,e,n,r){return zt(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),re(t,e,n,"clipSpacePos",r,3,20,0)&&re(t,e,n,"uv",r,2,20,12)}function co(t,e,n,r,i,o,a){var s,u,c;zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),o instanceof Uint8Array?(s=new Uint8Array(r*i*4),u=t.UNSIGNED_BYTE,c=t.RGBA):(s=new Float32Array(r*i*4),u=t.FLOAT,c=a.internalFormatPackedFloat),s.set(o),zt(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,c,r,i,0,t.RGBA,u,s)}),zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function lo(t,e,n,r){zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),r.data instanceof Uint8Array?zt(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r.width,r.height,0,t.RGBA,t.UNSIGNED_BYTE,r.data)}):zt(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r)}),zt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function fo(t,e,n,r,i){var o=t.createBuffer();zt(t,e,function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,o)});var a=16*n*r;return zt(t,e,function(){return t.bufferData(t.PIXEL_PACK_BUFFER,a,t.STREAM_READ)}),zt(t,e,function(){return t.readPixels(0,0,r,n,t.RGBA,t.FLOAT,0)}),zt(t,e,function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}),o}function ho(t,e,n){var r=t,i=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,e),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,i),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),i}function po(t,e,n,r,i){var o=Xi(n,r),a=o[0],s=o[1],u=new Uint8Array(n*r*4);return zt(t,e,function(){return t.readPixels(0,0,a,s,i.downloadTextureFormat,t.UNSIGNED_BYTE,u)}),new Float32Array(u.buffer)}function mo(t,e,n,r,i,o,a,s){var u=t,c=new Float32Array(function(t,e){var n=Ji(o,a);return n[0]*n[1]*4}());return u.bindBuffer(u.PIXEL_PACK_BUFFER,e),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,c),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),c}function go(t,e,n,r){var i=new Float32Array(n*r*4);return zt(t,e,function(){return t.readPixels(0,0,r,n,t.RGBA,t.FLOAT,i)}),i}!function(t){t[t.RENDER=0]="RENDER",t[t.UPLOAD=1]="UPLOAD",t[t.PIXELS=2]="PIXELS",t[t.DOWNLOAD=3]="DOWNLOAD"}(Vi||(Vi={})),function(t){t[t.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",t[t.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",t[t.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",t[t.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",t[t.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(Hi||(Hi={}));var vo=Object.freeze({createVertexShader:Zi,createVertexBuffer:Qi,createIndexBuffer:to,getTextureConfig:eo,createFloat32MatrixTexture:ro,createFloat16MatrixTexture:io,createUnsignedBytesMatrixTexture:oo,createPackedMatrixTexture:ao,createFloat16PackedMatrixTexture:so,bindVertexProgramAttributeStreams:uo,uploadDenseMatrixToTexture:co,uploadPixelDataToTexture:lo,createBufferFromOutputTexture:fo,downloadFloat32MatrixFromBuffer:ho,downloadByteEncodedFloatMatrixFromOutputTexture:po,downloadPackedMatrixFromBuffer:mo,downloadMatrixFromPackedOutputTexture:go}),bo=function(){function t(t){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=h.getNumber("WEBGL_VERSION");null!=t?(this.gl=t,Ft(e,t)):this.gl=Pt(e),1===h.getNumber("WEBGL_VERSION")?(this.textureFloatExtension=qt(this.gl,this.debug,"OES_texture_float"),this.colorBufferFloatExtension=this.gl.getExtension("WEBGL_color_buffer_float"),h.getBool("WEBGL_RENDER_FLOAT32_ENABLED")||(this.textureHalfFloatExtension=qt(this.gl,this.debug,"OES_texture_half_float"),this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float"))):this.colorBufferFloatExtension=qt(this.gl,this.debug,"EXT_color_buffer_float"),this.vertexBuffer=Qi(this.gl,this.debug),this.indexBuffer=to(this.gl,this.debug),this.framebuffer=ne(this.gl,this.debug),this.textureConfig=eo(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(t.prototype,"debug",{get:function(){return h.getBool("DEBUG")},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){var t=this;if(!this.disposed){null!=this.program&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),null!=this.outputTexture&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var e=this.gl;zt(e,this.debug,function(){return e.finish()}),zt(e,this.debug,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),zt(e,this.debug,function(){return e.deleteFramebuffer(t.framebuffer)}),zt(e,this.debug,function(){return e.bindBuffer(e.ARRAY_BUFFER,null)}),zt(e,this.debug,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}),zt(e,this.debug,function(){return e.deleteBuffer(t.indexBuffer)}),this.disposed=!0}},t.prototype.createFloat32MatrixTexture=function(t,e){return this.throwIfDisposed(),ro(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createFloat16MatrixTexture=function(t,e){return this.throwIfDisposed(),io(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createUnsignedBytesMatrixTexture=function(t,e){return this.throwIfDisposed(),oo(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.uploadPixelDataToTexture=function(t,e){this.throwIfDisposed(),lo(this.gl,this.debug,t,e)},t.prototype.uploadDenseMatrixToTexture=function(t,e,n,r){this.throwIfDisposed(),co(this.gl,this.debug,t,e,n,r,this.textureConfig)},t.prototype.createFloat16PackedMatrixTexture=function(t,e){return this.throwIfDisposed(),so(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createPackedMatrixTexture=function(t,e){return this.throwIfDisposed(),ao(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.deleteMatrixTexture=function(t){var e=this;this.throwIfDisposed(),this.outputTexture===t&&(ce(this.gl,this.debug,this.framebuffer),this.outputTexture=null),zt(this.gl,this.debug,function(){return e.gl.deleteTexture(t)})},t.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,function(){return po(r.gl,r.debug,e,n,r.textureConfig)})},t.prototype.downloadPackedMatrixFromBuffer=function(t,e,n,r,i,o){return mo(this.gl,t,0,0,0,i,o,this.textureConfig)},t.prototype.downloadFloat32MatrixFromBuffer=function(t,e){return ho(this.gl,t,e)},t.prototype.createBufferFromTexture=function(t,e,n){this.bindTextureToFrameBuffer(t);var r=fo(this.gl,this.debug,e,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},t.prototype.createAndWaitForFence=function(){var t=this.createFence(this.gl);return this.pollFence(t)},t.prototype.createFence=function(t){var e,n,r=this;if(h.getBool("WEBGL_FENCE_API_ENABLED")){var i=t,o=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);t.flush(),n=function(){var t=i.clientWaitSync(o,0,0);return t===i.ALREADY_SIGNALED||t===i.CONDITION_SATISFIED},e=o}else h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(e,h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return!0};return{query:e,isFencePassed:n}},t.prototype.downloadMatrixFromPackedTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,function(){return go(r.gl,r.debug,e,n)})},t.prototype.createProgram=function(t){this.throwIfDisposed();var e=this.gl,n=Ht(e,this.debug,t),r=Zi(e,this.debug),i=Xt(e,this.debug);return zt(e,this.debug,function(){return e.attachShader(i,r)}),zt(e,this.debug,function(){return e.attachShader(i,n)}),Yt(e,this.debug,i),this.debug&&Jt(e,this.debug,i),this.vertexAttrsAreBound||(this.setProgram(i),this.vertexAttrsAreBound=uo(e,this.debug,this.program,this.vertexBuffer)),i},t.prototype.deleteProgram=function(t){var e=this;this.throwIfDisposed(),t===this.program&&(this.program=null),null!=t&&zt(this.gl,this.debug,function(){return e.gl.deleteProgram(t)})},t.prototype.setProgram=function(t){var e=this;this.throwIfDisposed(),this.program=t,null!=this.program&&this.debug&&Jt(this.gl,this.debug,this.program),zt(this.gl,this.debug,function(){return e.gl.useProgram(t)})},t.prototype.getUniformLocation=function(t,e,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?oe(this.gl,this.debug,t,e):ae(this.gl,t,e)},t.prototype.getAttributeLocation=function(t,e){var n=this;return this.throwIfDisposed(),zt(this.gl,this.debug,function(){return n.gl.getAttribLocation(t,e)})},t.prototype.getUniformLocationNoThrow=function(t,e){return this.throwIfDisposed(),this.gl.getUniformLocation(t,e)},t.prototype.setInputMatrixTexture=function(t,e,n){this.throwIfDisposed(),this.throwIfNoProgram(),se(this.gl,this.debug,this.program,t,e,n)},t.prototype.setOutputMatrixTexture=function(t,e,n){this.setOutputMatrixTextureDriver(t,n,e)},t.prototype.setOutputPackedMatrixTexture=function(t,e,n){this.throwIfDisposed();var r=Ji(e,n),i=r[0],o=r[1];this.setOutputMatrixTextureDriver(t,i,o)},t.prototype.setOutputMatrixWriteRegion=function(t,e,n,r){this.setOutputMatrixWriteRegionDriver(n,t,r,e)},t.prototype.setOutputPackedMatrixWriteRegion=function(t,e,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},t.prototype.debugValidate=function(){null!=this.program&&Jt(this.gl,this.debug,this.program),le(this.gl)},t.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var t=this.gl;this.debug&&this.debugValidate(),zt(t,this.debug,function(){return t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)})},t.prototype.blockUntilAllProgramsCompleted=function(){var t=this;this.throwIfDisposed(),zt(this.gl,this.debug,function(){return t.gl.finish()})},t.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=qt(this.gl,this.debug,2===h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},t.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},t.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},t.prototype.beginQuery=function(){if(2===h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.gl,e=this.getQueryTimerExtensionWebGL2(),n=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),i=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),i},t.prototype.endQuery=function(){if(2!==h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.getQueryTimerExtensionWebGL1();t.endQueryEXT(t.TIME_ELAPSED_EXT)}else{var e=this.gl,n=this.getQueryTimerExtensionWebGL2();e.endQuery(n.TIME_ELAPSED_EXT)}},t.prototype.waitForQueryAndGetTime=function(t){return c(this,void 0,void 0,function(){var e=this;return l(this,function(n){switch(n.label){case 0:return[4,N(function(){return e.disposed||e.isQueryAvailable(t,h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return n.sent(),[2,this.getQueryTime(t,h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},t.prototype.getQueryTime=function(t,e){if(0===e)return null;if(2===e){var n=this.gl;return n.getQueryParameter(t,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(t,r.QUERY_RESULT_EXT)/1e6},t.prototype.isQueryAvailable=function(t,e){if(0===e)return!0;if(2===e){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),i=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint}return i=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(t,r.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint},t.prototype.pollFence=function(t){var e=this;return new Promise(function(n){e.addItemToPoll(function(){return t.isFencePassed()},function(){return n()})})},t.prototype.pollItems=function(){for(var t=function(t){for(var e=0;e<t.length&&t[e]();++e);return e-1}(this.itemsToPoll.map(function(t){return t.isDoneFn})),e=0;e<=t;++e)(0,this.itemsToPoll[e].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(t+1)},t.prototype.addItemToPoll=function(t,e){var n=this;this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length>1||N(function(){return n.pollItems(),0===n.itemsToPoll.length})},t.prototype.bindTextureToFrameBuffer=function(t){this.throwIfDisposed(),ue(this.gl,this.debug,t,this.framebuffer),this.debug&&le(this.gl)},t.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(ue(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&le(this.gl)):ce(this.gl,this.debug,this.framebuffer)},t.prototype.downloadMatrixDriver=function(t,e){this.bindTextureToFrameBuffer(t);var n=e();return this.unbindTextureToFrameBuffer(),n},t.prototype.setOutputMatrixTextureDriver=function(t,e,n){this.throwIfDisposed();var r=this.gl;ue(r,this.debug,t,this.framebuffer),this.debug&&le(r),this.outputTexture=t,zt(r,this.debug,function(){return r.viewport(0,0,e,n)}),zt(r,this.debug,function(){return r.scissor(0,0,e,n)})},t.prototype.setOutputMatrixWriteRegionDriver=function(t,e,n,r){var i=this;this.throwIfDisposed(),zt(this.gl,this.debug,function(){return i.gl.scissor(t,e,n,r)})},t.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},t.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},t}();function yo(t,e){if(t.length!==e.length)throw Error("Binary was compiled with "+t.length+" inputs, but was executed with "+e.length+" inputs");t.forEach(function(t,n){var r=t.logicalShape,i=e[n],o=i.shape;if(!E(r,o))throw Error("Binary was compiled with different shapes than the current args. Shapes "+r+" and "+o+" must match");if(!t.isUniform||!i.isUniform){var a=t.texShape,s=i.isUniform?null:i.texData.texShape;if(!E(a,s))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+a+" and "+s+" must match")}})}var wo=function(t,e,n,r,i,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=null),this.variableNames=["matrixA","matrixB"],this.usesPackedTextures=!0,this.outputShape=e;var a=n?t[1]:t[2],s=Math.ceil(a/2),u=n?"i * 2, rc.y":"rc.y, i * 2",c=r?"rc.z, i * 2":"i * 2, rc.z",l=n?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],f=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],d="",h="";o&&(d="vec4 activation(vec4 x) {\n "+o+"\n }",h="result = activation(result);");var p=i?"result += getBiasAtOutCoords();":"";i&&this.variableNames.push("bias"),this.userCode="\n "+d+"\n\n const float sharedDimension = "+s+".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < "+s+"; i++) {\n vec4 a = getMatrixA(rc.x, "+u+");\n vec4 b = getMatrixB(rc.x, "+c+");\n\n result += ("+l[0]+" * "+f[0]+") + ("+l[1]+" * "+f[1]+");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n "+p+"\n\n "+h+"\n\n setOutput(result);\n }\n "},xo=function(){function t(t,e,n){this.variableNames=["probs"],this.outputShape=[t,n],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(e-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(e-1)+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.seedLoc&&(e.seedLoc=n.getUniformLocation(r,"seed")),n.gl.uniform1f(e.seedLoc,t)}},t}(),_o=function(t,e,n){if(this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var r=t.filterWidth,i=t.strideHeight,o=t.strideWidth,a=t.dilationHeight,s=t.dilationWidth,u=t.effectiveFilterHeight,c=t.effectiveFilterWidth,l=t.padInfo.top,f=t.padInfo.left;this.outputShape=t.outShape;var d="avg"===e,h="0.0";if(d||(h="-1.0 / 1e-20"),n)this.userCode="\n const ivec2 strides = ivec2("+i+", "+o+");\n const ivec2 pads = ivec2("+l+", "+f+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < "+u+";\n wR += "+a+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+c+";\n wC += "+s+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = wR * "+c+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var p=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(p="avgValue / count");var m=4*Math.floor(r/4),g=r%4,v="\n if ("+d+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+i+", "+o+");\n const ivec2 pads = ivec2("+l+", "+f+");\n const float initializationValue = "+h+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+h+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+u+";\n wR += "+a+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+m+"; wC += 4) {\n int xC = xCCorner + wC * "+s+";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n getValue(batch, xR, xC + 2 * "+s+", d),\n getValue(batch, xR, xC + 3 * "+s+", d)\n );\n\n "+v+"\n }\n\n int xC = xCCorner + "+m+";\n if ("+(1===g)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+v+"\n } else if ("+(2===g)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n initializationValue,\n initializationValue\n );\n\n "+v+"\n } else if ("+(3===g)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n getValue(batch, xR, xC + 2 * "+s+", d),\n initializationValue\n );\n\n "+v+"\n }\n }\n setOutput("+p+");\n }\n "}},ko=function(t,e,n,r,i,o,a){void 0===a&&(a=!0),this.variableNames=["updates","indices","defaultValue"],this.outputShape=o;var s=Ii(i.length),u=Ii(o.length),c="";1===n?c="i":2===n&&(c="i, j");var l="getIndices("+c+")",f="";1===r?f="i":2===r&&(f="i, coords[1]");var d="getUpdates("+f+")",h=e>1?"strides[j]":"strides";this.userCode="\n "+s+" strides = "+s+"("+i+");\n\n void main() {\n "+u+" coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < "+t+"; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < "+e+"; j++) {\n int index = round("+l+");\n flattenedIndex += index * "+h+";\n }\n if (flattenedIndex == coords[0]) {\n sum += "+d+";\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n "},So=function(){function t(t){this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var e,n=Ii(this.rank),r="uniform int start["+this.rank+"];",i=function(t){if(1===t)return"sourceLoc";if(t<=6)return Eo.slice(0,t).map(function(t){return"sourceLoc."+t}).join(",");throw Error("Slicing for rank "+t+" is not yet supported")}(this.rank);e="\n "+n+" sourceLoc;\n "+n+" coords = getOutputCoords();\n "+t.map(function(t,e){return"sourceLoc."+Eo[e]+" = start["+e+"] + coords."+Eo[e]+";"}).join("\n")+"\n ",this.userCode="\n "+r+"\n void main() {\n "+e+"\n setOutput(getSource("+i+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,r){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(r,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),Eo=["x","y","z","w","u","v"],Oo=function(){function t(t){this.variableNames=["source"],this.usesPackedTextures=!0,this.outputShape=t,this.rank=t.length;var e=Ii(this.rank),n=xi("coords",this.rank),r=xi("sourceLoc",this.rank),i=1===this.rank?"sourceLoc":"vec2("+r.slice(-2).join()+")",o="getChannel(getSource("+r.join()+"), "+i+")",a="\n result.x = "+o+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.y = "+o+";\n --"+r[this.rank-1]+";\n }\n ",s=1===this.rank?"":"\n --"+n[this.rank-1]+";\n if (++"+n[this.rank-2]+" < "+t[this.rank-2]+") {\n ++"+r[this.rank-2]+";\n result.z = "+o+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.w = "+o+";\n }\n }\n ",u=this.rank<=4?"sourceLoc = coords +\n "+e+"("+t.map(function(t,e){return"start["+e+"]"}).join()+");":t.map(function(t,e){return r[e]+" = "+n[e]+" + start["+e+"];"}).join("\n");this.userCode="\n uniform int start["+this.rank+"];\n void main() {\n "+e+" coords = getOutputCoords();\n "+e+" sourceLoc;\n "+u+" \n vec4 result = vec4(0.);\n "+a+"\n "+s+"\n setOutput(result);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,r){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(r,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),Ao=function(){function t(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return t.prototype.acquireTexture=function(t,e,n){var r,i=Co(e,n),o=Mo(t,i,n);if(o in this.freeTextures||(this.freeTextures[o]=[]),o in this.usedTextures||(this.usedTextures[o]=[]),this.freeTextures[o].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var a=this.freeTextures[o].shift();return this.usedTextures[o].push(a),a}return this.numUsedTextures++,this.log(),i===Hi.PACKED_2X2_FLOAT32?r=this.gpgpu.createPackedMatrixTexture(t[0],t[1]):i===Hi.PACKED_2X2_FLOAT16?r=this.gpgpu.createFloat16PackedMatrixTexture(t[0],t[1]):i===Hi.UNPACKED_FLOAT32?r=this.gpgpu.createFloat32MatrixTexture(t[0],t[1]):i===Hi.UNPACKED_FLOAT16?r=this.gpgpu.createFloat16MatrixTexture(t[0],t[1]):i===Hi.PACKED_4X1_UNSIGNED_BYTE&&(r=this.gpgpu.createUnsignedBytesMatrixTexture(t[0],t[1])),this.usedTextures[o].push(r),r},t.prototype.releaseTexture=function(t,e,n,r){if(null!=this.freeTextures){var i=Mo(e,Co(n,r),r);i in this.freeTextures||(this.freeTextures[i]=[]),this.freeTextures[i].push(t),this.numFreeTextures++,this.numUsedTextures--;var o=this.usedTextures[i],a=o.indexOf(t);if(a<0)throw new Error("Cannot release a texture that was never provided by this texture manager");o.splice(a,1),this.log()}},t.prototype.log=function(){if(this.logEnabled){var t=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+t+")")}},t.prototype.getNumUsedTextures=function(){return this.numUsedTextures},t.prototype.getNumFreeTextures=function(){return this.numFreeTextures},t.prototype.dispose=function(){var t=this;if(null!=this.freeTextures){for(var e in this.freeTextures)this.freeTextures[e].forEach(function(e){t.gpgpu.deleteMatrixTexture(e)});for(var e in this.usedTextures)this.usedTextures[e].forEach(function(e){t.gpgpu.deleteMatrixTexture(e)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},t}();function Co(t,e){if(t===Vi.UPLOAD)return Hi.PACKED_2X2_FLOAT32;if(t===Vi.RENDER||null==t)return e?h.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?Hi.PACKED_2X2_FLOAT32:Hi.PACKED_2X2_FLOAT16:h.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?Hi.UNPACKED_FLOAT32:Hi.UNPACKED_FLOAT16;if(t===Vi.DOWNLOAD||t===Vi.PIXELS)return Hi.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+t)}function Mo(t,e,n){return t[0]+"_"+t[1]+"_"+e+"_"+n}var No=function(t,e){this.variableNames=["A"],this.outputShape=t,this.userCode="\n float unaryOperation(float x) {\n "+e+"\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n "},To="if (isnan(x)) return x;",Io=To+"\n return (x < 0.0) ? 0.0 : x;\n",Do="return exp(x);",jo="\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",Ro=function(t,e){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t,this.userCode="\n vec4 unaryOperation(vec4 x) {\n "+e+"\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Fo={},Po=600,zo=function(){function t(t){if(this.gpgpu=t,this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.warnedAboutMemory=!1,this.disposed=!1,!h.getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(null==t){var e=Pt(h.getNumber("WEBGL_VERSION"));this.binaryCache=(n=h.getNumber("WEBGL_VERSION"))in Fo?Fo[n]:(Fo[n]={},Fo[n]),this.gpgpu=new bo(e),this.canvas=e.canvas,this.gpgpuCreatedLocally=!0}else this.binaryCache={},this.gpgpuCreatedLocally=!1,this.canvas=t.gl.canvas;var n;this.textureManager=new Ao(this.gpgpu),this.numMBBeforeWarning=null==h.global.screen?1024:h.global.screen.height*h.global.screen.width*window.devicePixelRatio*Po/1024/1024,this.texData=new Hr(this,It)}return t.prototype.register=function(t,e,n){if(this.texData.has(t))throw new Error("Data buffer is already registered");this.texData.set(t,{shape:e,dtype:n})},t.prototype.fromPixels=function(t,e){if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n=[t.height,t.width],r=[t.height,t.width,e];if(h.getBool("IS_BROWSER")){if(!(t instanceof HTMLVideoElement||t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData||t.data instanceof Uint8Array))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData or {data: Uint32Array, width: number, height: number}, but was "+t.constructor.name);if(t instanceof HTMLVideoElement){if(null==this.fromPixels2DContext){if("complete"!==document.readyState)throw new Error("The DOM is not ready yet. Please call tf.browser.fromPixels() once the DOM is ready. One way to do that is to add an event listener for `DOMContentLoaded` on the document object");this.fromPixels2DContext=document.createElement("canvas").getContext("2d")}this.fromPixels2DContext.canvas.width=t.width,this.fromPixels2DContext.canvas.height=t.height,this.fromPixels2DContext.drawImage(t,0,0,t.width,t.height),t=this.fromPixels2DContext.canvas}}var i,o,a=this.makeTensorHandle(n,"int32");if(this.texData.get(a.dataId).usage=Vi.PIXELS,this.gpgpu.uploadPixelDataToTexture(this.getTexture(a.dataId),t),h.getBool("WEBGL_PACK")){i=new function(t){this.variableNames=["A"];var e=_i(),n=t[0],r=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+r+".0, "+n+".0);\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n "+e.output+" = result;\n }\n "}(r);var s=this.makePackedTensor(i.outputShape,a.dtype);o=this.compileAndRun(i,[a],s)}else i=new function(t){this.variableNames=["A"];var e=_i(),n=t[0],r=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+r+".0, "+n+".0);\n\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n "}(r),o=this.compileAndRun(i,[a]);return this.disposeData(a.dataId),o},t.prototype.makeTensorHandle=function(t,e){var n={};return this.register(n,t,e),{dataId:n,shape:t,dtype:e}},t.prototype.write=function(t,e){if(null==e)throw new Error("MathBackendWebGL.write(): values can not be null");if(h.getBool("DEBUG"))for(var n=0;n<e.length;n++){var r=e[n];if(!Ut(r))throw Error("The value "+r+" cannot be represented on this device.")}var i=this.texData.get(t);if("complex64"===i.dtype)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.releaseGPUData(t),i.usage=Vi.UPLOAD,i.values=e},t.prototype.readSync=function(t){var e=this.texData.get(t),n=e.values,r=e.dtype,i=e.complexTensors,o=e.slice,a=e.shape;if(null!=o){var s=new No(a,"return x;"),u=this.compileAndRun(s,[{dataId:t,shape:a,dtype:r}]),c=this.readSync(u.dataId);return u.dispose(),c}if(null!=n)return this.convertAndCacheOnCPU(t);if("string"===r)return n;var l,f,d=null!=this.activeTimers;return d&&(l=performance.now()),f="complex64"===r?li(i.real.dataSync(),i.imag.dataSync()):this.getValuesFromTexture(t),d&&(this.downloadWaitMs+=performance.now()-l),this.convertAndCacheOnCPU(t,f)},t.prototype.read=function(t){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,f,d,p,m,g,v,b,y,w,x,_,k;return l(this,function(l){switch(l.label){case 0:if(this.pendingRead.has(t))return n=this.pendingRead.get(t),[2,new Promise(function(t){return n.push(t)})];if(r=this.texData.get(t),i=r.values,o=r.shape,a=r.slice,s=r.dtype,u=r.complexTensors,null!=a)return c=new No(o,"return x;"),f=this.compileAndRun(c,[{dataId:t,shape:o,dtype:s}]),d=this.read(f.dataId),f.dispose(),[2,d];if(null!=i)return[2,this.convertAndCacheOnCPU(t)];if(!h.getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===h.getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return p=null,"complex64"!==s&&h.get("WEBGL_BUFFER_SUPPORTED")&&(m=this.decode(t),t=m.dataId,g=this.texData.get(m.dataId),p=(e=this.gpgpu).createBufferFromTexture.apply(e,[g.texture].concat(Yi(o)))),this.pendingRead.set(t,[]),"complex64"===s?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:l.sent(),l.label=2;case 2:return"complex64"!==s?[3,4]:[4,Promise.all([u.real.data(),u.imag.data()])];case 3:return b=l.sent(),y=b[0],w=b[1],v=li(y,w),[3,5];case 4:null==p?v=this.getValuesFromTexture(t):(x=S(o),v=this.gpgpu.downloadFloat32MatrixFromBuffer(p,x),this.disposeData(t)),l.label=5;case 5:return _=this.convertAndCacheOnCPU(t,v),k=this.pendingRead.get(t),this.pendingRead.delete(t),k.forEach(function(t){return t(_)}),this.pendingDisposal.has(t)&&(this.pendingDisposal.delete(t),this.disposeData(t)),[2,_]}})})},t.prototype.getValuesFromTexture=function(t){var e,n=this,r=this.texData.get(t),i=r.shape,o=r.dtype,a=r.isPacked,s=S(i);if(h.getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var u=this.decode(t),c=this.texData.get(u.dataId),l=(e=this.gpgpu).downloadMatrixFromPackedTexture.apply(e,[c.texture].concat(Yi(i))).subarray(0,s);return this.disposeData(u.dataId),l}var f=h.getBool("WEBGL_PACK")&&!0===a,d=f?ge(i):i,p=this.makeTensorHandle(d,"float32");p.size=S(i),this.texData.get(p.dataId).usage=Vi.DOWNLOAD;var m=Pe(function(){var e=f?new function(t){this.variableNames=["A"],this.usesPackedTextures=!0;var e=_i();this.outputShape=t,this.userCode="\n "+Ei+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n "+e.output+" = encode_float(x);\n }\n "}(d):new function(t){this.variableNames=["A"];var e=_i();this.outputShape=t,this.userCode="\n "+Ei+"\n\n void main() {\n float x = getAAtOutCoords();\n "+e.output+" = encode_float(x);\n }\n "}(d);return n.compileAndRun(e,[{shape:d,dtype:o,dataId:t}],p,null)}),g=this.texData.get(m.dataId),v=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(g.texture,g.texShape[0],g.texShape[1]).subarray(0,s);return this.disposeData(p.dataId),v},t.prototype.time=function(t){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return l(this,function(u){switch(u.label){case 0:return e=this.activeTimers,n=[],r=!1,null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,t(),i=k(this.activeTimers.map(function(t){return t.query})).filter(function(t){return null!=t}),o=k(this.activeTimers.map(function(t){return t.name})).filter(function(t){return null!=t}),this.activeTimers=e,r&&(this.programTimersStack=null),[4,Promise.all(i)];case 1:return a=u.sent(),s={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:y(a),getExtraProfileInfo:function(){return a.map(function(t,e){return{name:o[e],ms:t}}).map(function(t){return t.name+": "+t.ms}).join(", ")},wallMs:null},this.uploadWaitMs=0,this.downloadWaitMs=0,[2,s]}})})},t.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},t.prototype.startTimer=function(){return h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},t.prototype.endTimer=function(t){return h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(this.gpgpu.endQuery(),t):(t.endMs=performance.now(),t)},t.prototype.getQueryTime=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){return h.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?[2,this.gpgpu.waitForQueryAndGetTime(t)]:[2,(e=t).endMs-e.startMs]})})},t.prototype.disposeData=function(t){if(!this.pendingDisposal.has(t))if(this.pendingRead.has(t))this.pendingDisposal.add(t);else if(this.texData.has(t)){this.releaseGPUData(t);var e=this.texData.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.texData.delete(t)}},t.prototype.releaseGPUData=function(t){var e=this.texData.get(t),n=e.texture,r=e.dtype,i=e.texShape,o=e.usage,a=e.isPacked,s=e.slice,u=s&&s.origDataId||t,c=this.dataRefCount.get(u);c>1?this.dataRefCount.set(u,c-1):(this.dataRefCount.delete(u),null!=n&&(this.numBytesInGPU-=this.computeBytes(i,r),this.textureManager.releaseTexture(n,i,o,a)));var l=this.texData.get(t);l.texture=null,l.texShape=null,l.isPacked=!1,l.slice=null},t.prototype.getTexture=function(t){return this.uploadToGPU(t),this.texData.get(t).texture},t.prototype.getCPUBackend=function(){return h.getBool("WEBGL_CPU_FORWARD")?(null==this.cpuBackend&&(this.cpuBackend=It.findBackend("cpu")),this.cpuBackend):null},t.prototype.shouldExecuteOnCPU=function(t,e){var n=this;return void 0===e&&(e=128),null!=this.getCPUBackend()&&t.every(function(t){return null==n.texData.get(t.dataId).texture&&t.size<e})},t.prototype.getGPGPUContext=function(){return this.gpgpu},t.prototype.complex=function(t,e){var n=this.makeOutputArray(t.shape,"complex64");return this.texData.get(n.dataId).complexTensors={real:It.keep(t.clone()),imag:It.keep(e.clone())},n},t.prototype.real=function(t){return this.texData.get(t.dataId).complexTensors.real.clone()},t.prototype.imag=function(t){return this.texData.get(t.dataId).complexTensors.imag.clone()},t.prototype.slice=function(t,e,n){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.slice(t,e,n);if(0===S(n))return gn([],n,t.dtype);var r=this.texData.get(t.dataId).isPacked,i=jr(t.shape,e,n);if(r||!i){var o=h.getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Oo(n):new So(n),a=o.getCustomSetupFunc(e);return this.compileAndRun(o,[t],null,a)}return this.uploadToGPU(t.dataId),this.shallowSlice(t,e,n)},t.prototype.shallowSlice=function(t,e,n){var r=this.texData.get(t.dataId),i=pt.make(n,{},t.dtype,this),o=this.texData.get(i.dataId);Object.assign(o,r),o.shape=n,o.dtype=t.dtype;var a=Rr(e,t.strides);r.slice&&(a+=r.slice.flatOffset),o.slice={flatOffset:a,origDataId:r.slice&&r.slice.origDataId||t.dataId};var s=this.dataRefCount.get(o.slice.origDataId)||1;return this.dataRefCount.set(o.slice.origDataId,s+1),i},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.stridedSlice(t,e,n,r,i,o,a,s,u);var c=Tr(t.shape,e,n,r,i,o,a,s,u),l=c[0],f=c[1],d=c[2],h=f.filter(function(t,e){return-1===d.indexOf(e)});if(h.some(function(t){return 0===t}))return gn([],h);var p=new function(t,e,n,r){this.variableNames=["x"];var i=n.filter(function(t,e){return-1===r.indexOf(e)});this.outputShape=i;var o=n.length,a=Ii(n.length),s=Ii(i.length),u="";if(1===o)u="coords * strides + begin";else{var c=0;u=n.map(function(t,e){return-1===r.indexOf(e)?(c++,1===i.length?"coords * strides["+e+"] + begin["+e+"]":"coords["+(c-1)+"] * strides["+e+"] + begin["+e+"]"):"begin["+e+"]"}).join(",")}this.userCode="\n "+a+" begin = "+a+"("+t+");\n "+a+" strides = "+a+"("+e+");\n\n void main() {\n "+s+" coords = getOutputCoords();\n setOutput(getX("+u+"));\n }\n "}(l,r,f,d);return this.compileAndRun(p,[t])},t.prototype.reverse=function(t,e){var n=h.getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(t,e){this.variableNames=["x"],this.usesPackedTextures=!0;var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");this.outputShape=t;var r=xi("rc",n),i=r[n-1]+" + 1 < "+this.outputShape[n-1],o=r[n-2]+" + 1 < "+this.outputShape[n-2],a=Ii(n);function s(n){var r=t.map(function(r,i){return function(n,r){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - "+r[n]+" - 1":""+r[n]}(i,n)});return"getChannel(getX("+r.join(",")+"), vec2("+r.slice(-2).join(",")+"))"}this.userCode=1===n?"\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX("+t[0]+" - rc - 1),\n "+t[0]+" - rc - 1);\n if("+i+"){\n result.g = getChannel(getX("+t[0]+" - (rc + 1) - 1),\n "+t[0]+" - (rc + 1) - 1);\n }\n setOutput(result);\n }\n ":"\n void main() {\n "+a+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = "+s(r.slice())+";\n if("+i+"){\n result.g = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",s(t)}(r.slice())+";\n }\n if("+o+") {\n result.b = "+function(t){return t[n-2]="("+t[n-2]+" + 1)",s(t)}(r.slice())+";\n if("+i+") {\n result.a = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",t[n-2]="("+t[n-2]+" + 1)",s(t)}(r.slice())+";\n }\n }\n setOutput(result);\n }\n "}(t.shape,e):new function(t,e){this.variableNames=["x"];var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=t,1!==n){var r=t.map(function(n,r){return function(n){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(r)}).join(","),i=Ii(n);this.userCode="\n void main() {\n "+i+" coords = getOutputCoords();\n setOutput(getX("+r+"));\n }\n "}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+t[0]+" - coord - 1));\n }\n "}(t.shape,e);return this.compileAndRun(n,[t])},t.prototype.concat=function(t,e){if(this.shouldExecuteOnCPU(t))return this.cpuBackend.concat(t,e);if(1===t.length)return t[0];if(t.length>h.getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var n=Math.floor(t.length/2),r=this.concat(t.slice(0,n),e),i=this.concat(t.slice(n),e);return this.concat([r,i],e)}if(h.getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&t[0].rank>1){var o=new function(t,e){this.usesPackedTextures=!0,this.outputShape=[],this.outputShape=fn(t,e);var n=this.outputShape,r=n.length,i=Ii(r),o=xi("coords",r),a=["x","y","z","w","u","v"].slice(0,r);this.variableNames=t.map(function(t,e){return"T"+e});var s=new Array(t.length-1);s[0]=t[0][e];for(var u=1;u<s.length;u++)s[u]=s[u-1]+t[u][e];var c=a[e],l="vec2("+a.slice(-2).join()+")",f=a.join(),d="if ("+c+" < "+s[0]+")\n return getChannel(getT0("+f+"), "+l+");";for(u=1;u<s.length;u++){var h=s[u-1];d+="\n else if ("+c+" < "+s[u]+") {\n "+c+" -= "+h+";\n return getChannel(getT"+u+"("+f+"), "+l+");\n }"}var p=s.length;d+="\n else {\n "+c+" -= "+s[s.length-1]+";\n return getChannel(getT"+p+"("+f+"), "+l+");\n }",this.userCode="\n float getValue("+a.map(function(t){return"int "+t})+") {\n "+d+"\n }\n\n void main() {\n "+i+" coords = getOutputCoords();\n vec4 result = vec4(getValue("+o+"), 0., 0., 0.);\n if (++"+o[r-1]+" < "+n[r-1]+") {\n result.g = getValue("+o+");\n }\n if (++"+o[r-2]+" < "+n[r-2]+") {\n result.a = getValue("+o+");\n }\n if ("+o[r-2]+" < "+n[r-2]+" &&\n --"+o[r-1]+" < "+n[r-1]+") {\n result.b = getValue("+o+");\n }\n setOutput(result);\n }\n "}(t.map(function(t){return t.shape}),e);return this.compileAndRun(o,t)}var a=fn(t.map(function(t){return t.shape}),e),s=t.map(function(t){return t.as2D(-1,S(t.shape.slice(e)))}),u=new function(t){this.outputShape=[],this.outputShape=fn(t,1),this.variableNames=t.map(function(t,e){return"T"+e});var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n<e.length;n++)e[n]=e[n-1]+t[n][1];var r=["if (yC < "+e[0]+") setOutput(getT0(yR, yC));"];for(n=1;n<e.length;n++){var i=e[n-1];r.push("else if (yC < "+e[n]+") setOutput(getT"+n+"(yR, yC-"+i+"));")}var o=e.length,a=e[e.length-1];r.push("else setOutput(getT"+o+"(yR, yC-"+a+"));"),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n "+r.join("\n ")+"\n }\n "}(s.map(function(t){return t.shape}));return this.compileAndRun(u,s).reshape(a)},t.prototype.neg=function(t){var e=new No(t.shape,"return -x;");return this.compileAndRun(e,[t])},t.prototype.batchMatMul=function(t,e,n,r){var i=n?t.shape[2]:t.shape[1],o=r?e.shape[1]:e.shape[2],a=n?t.shape[1]:t.shape[2],s=t.shape[0];if((1===i||1===o)&&a>1e3){n&&(t=t.transpose([0,2,1])),r&&(e=e.transpose([0,2,1]));var u=1===o?t:t.as3D(s,a,1),c=1===o?2:1,l=1===o?e.as3D(s,1,a):e;return this.multiply(u,l).sum(c,!0)}var f=kt(t.dtype,e.dtype),d=new wo(t.shape,[s,i,o],n,r),h=this.makePackedTensor(d.outputShape,f);return this.compileAndRun(d,[t,e],h)},t.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){var a=n?t.shape[2]:t.shape[1],s=r?e.shape[1]:e.shape[2],u=t.shape[0],c=kt(t.dtype,e.dtype),l=new wo(t.shape,[u,a,s],n,r,!!i,o?function(t,e){if(void 0===e&&(e=!1),"linear"===t)return"return x;";if("relu"===t)return e?jo:Io;throw new Error("Activation "+t+" has not been implemented for the WebGL backend.")}(o,!0):null),f=this.makePackedTensor(l.outputShape,c),d=[t,e];return i&&d.push(i),this.compileAndRun(l,d,f)},t.prototype.multiply=function(t,e){if("complex64"===t.dtype){var n=this.texData.get(t.dataId),r=this.texData.get(e.dataId),i=new Ri("return areal * breal - aimag * bimag;",t.shape,e.shape),o=new Ri("return areal * bimag + aimag * breal;",t.shape,e.shape),a=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag),this.makeComplexComponentTensorHandle(e,r.complexTensors.real),this.makeComplexComponentTensorHandle(e,r.complexTensors.imag)],s=this.compileAndRun(i,a),u=this.compileAndRun(o,a),c=this.complex(s,u);return s.dispose(),u.dispose(),c}if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.multiply(t,e);if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,zi,t.dtype);var l=new Li(zi,t.shape,e.shape),f=this.makeOutputArray(l.outputShape,t.dtype);return this.compileAndRun(l,[t,e],f)},t.prototype.batchNormalization=function(t,e,n,r,i,o){var a=[t,e,n],s=null;null!=o&&(s=o.shape,a.push(o));var u=null;if(null!=i&&(u=i.shape,a.push(i)),h.getBool("WEBGL_PACK_NORMALIZATION")){var c=new function(t,e,n,r,i,o){this.usesPackedTextures=!0,this.variableNames=["x","mean","variance"],Xr(t,e),Xr(t,n);var a="vec4(0.0)";null!=r&&(Xr(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="vec4(1.0)";null!=i&&(Xr(t,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n vec4 offset = "+a+";\n vec4 scale = "+s+";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4("+o+"));\n\n setOutput((x - mean) * inv + offset);\n }\n "}(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(c,a)}var l=new function(t,e,n,r,i,o){this.outputShape=[],this.variableNames=["x","mean","variance"],Xr(t,e),Xr(t,n);var a="0.0";null!=r&&(Xr(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="1.0";null!=i&&(Xr(t,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+a+";\n float scale = "+s+";\n float inv = scale * inversesqrt(variance + float("+o+"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n "}(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(l,a)},t.prototype.localResponseNormalization4D=function(t,e,n,r,i){var o=h.getBool("WEBGL_PACK_NORMALIZATION")?new function(t,e,n,r,i){this.variableNames=["x"],this.outputShape=[],this.usesPackedTextures=!0;var o,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";o=.5===i?"inversesqrt("+u+")":1===i?"1.0/("+u+")":"exp(log("+u+") * float(-"+i+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < "+this.outputShape[3]+";\n bool hasNextRow = c < "+this.outputShape[2]+";\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - "+a+";\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - "+a+"; j <= "+a+"; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2("+s+"));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * "+o+";\n setOutput(result);\n }\n "}(t.shape,e,n,r,i):new function(t,e,n,r,i){this.variableNames=["x"],this.outputShape=[];var o,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";o=.5===i?"inversesqrt("+u+")":1===i?"1.0/("+u+")":"exp(log("+u+") * float(-"+i+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -"+a+"; j <= "+a+"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= "+s+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+o+";\n setOutput(val);\n }\n "}(t.shape,e,n,r,i);return this.compileAndRun(o,[t])},t.prototype.LRNGrad=function(t,e,n,r,i,o,a){var s=new function(t,e,n,r,i){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=r,this.beta=i,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < "+this.depth+"; ++d) {\n int depthBegin = int(max(0.0, float(d - "+e+")));\n int depthEnd = int(min(float("+this.depth+"),\n float(d + "+e+" + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = "+this.depth+";\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float("+r+") * norm + float("+n+");\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float("+r+")\n * float("+i+")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * "+i+");\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n "}(e.shape,r,i,o,a);return this.compileAndRun(s,[e,n,t])},t.prototype.tile=function(t,e){if("string"===t.dtype)return vi(Xn(t.shape,t.dtype,this.readSync(t.dataId)),e);var n=new function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[r]*e[r];this.outputShape=n,this.rank=n.length;var i=Ii(this.rank),o=function(t){var e=t.length;if(e>5)throw Error("Tile for rank "+e+" is not yet supported");if(1===e)return"imod(resRC, "+t[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],i=0;i<t.length;i++)r.push("imod("+n[i]+", "+t[i]+")");return r.join()}(t);this.userCode="\n void main() {\n "+i+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "}(t.shape,e);return this.compileAndRun(n,[t])},t.prototype.pad=function(t,e,n){var r=h.getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(t,e,n){this.variableNames=["x"],this.usesPackedTextures=!0,this.outputShape=e.map(function(e,n){return e[0]+t[n]+e[1]});for(var r=t.length,i=Ii(r),o=e.map(function(t){return t[0]}).join(","),a=e.map(function(e,n){return e[0]+t[n]}).join(","),s=xi("rc",r),u=xi("source",r),c=s[r-1]+" < "+this.outputShape[r-1],l=1===r?"source":"vec2("+u.slice(-2).join()+")",f=[i+" rc = outputLoc;",s[r-1]+" += 1;\n if("+c+") {\n ",1===r?"":"}\n rc = outputLoc;\n "+s[r-2]+" += 1;\n if("+s[r-2]+" < "+this.outputShape[r-2]+") {",1===r?"":" "+s[r-1]+" += 1;\n if("+c+") {"],d=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",h="",p=0,m=1===r?2:4;p<m;p++)h+="\n "+f[p]+"\n if ("+d+") {\n result["+p+"] = float("+n+");\n } else {\n "+i+" source = rc - start;\n result["+p+"] = getChannel(getX("+u.join()+"), "+l+");\n }\n ";h+=1===r?"} ":"}}",this.userCode="\n const "+i+" start = "+i+"("+o+");\n const "+i+" end = "+i+"("+a+");\n\n void main() {\n "+i+" outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n "+h+"\n setOutput(result);\n }\n "}(t.shape,e,n):new function(t,e,n){this.variableNames=["x"],this.outputShape=e.map(function(e,n){return e[0]+t[n]+e[1]});var r=t.length,i=Ii(r),o=e.map(function(t){return t[0]}).join(","),a=e.map(function(e,n){return e[0]+t[n]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n "+i+" start = "+i+"("+o+");\n "+i+" end = "+i+"("+a+");\n\n void main() {\n "+i+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+n+"));\n } else {\n "+i+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+o+";\n int end = "+a+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+n+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n "}(t.shape,e,n);return this.compileAndRun(r,[t])},t.prototype.transpose=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.transpose(t,e);var n=h.getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(t,e){this.variableNames=["A"],this.usesPackedTextures=!0;for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[e[r]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var i=Ii(this.rank),o=wi("rc",this.rank),a=new Array(this.rank);for(r=0;r<e.length;r++)a[e[r]]=o[r];var s="vec2("+a.slice(-2).join()+")",u="++"+o[this.rank-1]+" < "+n[this.rank-1],c="getChannel(getA("+a.join()+"), "+s+")";this.userCode="\n void main() {\n "+i+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = "+c+";\n if("+u+") {\n result[1] = "+c+";\n }\n --"+o[this.rank-1]+";\n if(++"+o[this.rank-2]+" < "+n[this.rank-2]+") {\n result[2] = "+c+";\n if("+u+") {\n result[3] = "+c+";\n }\n } \n setOutput(result);\n }\n "}(t.shape,e):new function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[e[r]];this.outputShape=n,this.rank=n.length;var i=Ii(this.rank),o=function(t){var e=t.length;if(e>6)throw Error("Transpose for rank "+e+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(e),i=0;i<t.length;i++)r[t[i]]=n[i];return r.join()}(e);this.userCode="\n void main() {\n "+i+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "}(t.shape,e);return this.compileAndRun(n,[t])},t.prototype.gather=function(t,e,n){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.gather(t,e,n);var r=new function(t,e,n){this.variableNames=["A","indices"];var r=t.slice();r[n]=e,this.outputShape=r,this.rank=r.length;var i=Ii(this.rank),o=function(t,e){var n=t.length;if(n>4)throw Error("Gather for rank "+n+" is not yet supported");if(1===n)return"int(getIndices(resRC))";for(var r=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],o=0;o<t.length;o++)o===e?i.push("int(getIndices("+r[o]+"))"):i.push(""+r[o]);return i.join()}(t,n);this.userCode="\n void main() {\n "+i+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "}(t.shape,e.size,n);return this.compileAndRun(r,[t,e])},t.prototype.batchToSpaceND=function(t,e,n){w(t.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var r=e.reduce(function(t,e){return t*e}),i=_r(t.shape,e,r),o=kr(i.length,e.length),a=Sr(t.shape,e,r),s=Er(n,e.length),u=Or(a,n,e.length);return t.reshape(i).transpose(o).reshape(a).slice(s,u)},t.prototype.spaceToBatchND=function(t,e,n){w(t.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var r=e.reduce(function(t,e){return t*e}),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;o<t.shape.length;++o)i.push([0,0]);var a=t.pad(i),s=_r(a.shape,e,r,!1),u=kr(s.length,e.length,!1),c=Sr(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},t.prototype.reduce=function(t,e,n){var r=t.shape[0],i=t.shape[1],o=new function(t,e){this.variableNames=["x"];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=Math.ceil(i/n);this.outputShape=[r,o];var a="0.0",s="";"prod"===e?a="1.0":"min"===e?(a="1.0 / 1e-20",s="min"):"max"===e&&(a="-1.0 / 1e-20",s="max");var u=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===e?u="sumValue":"prod"===e?u="prodValue":"all"===e?u="allValue":"any"===e&&(u="anyValue");var c=4*Math.floor(n/4),l=n%4,f="\n if ("+("sum"===e)+") {\n sumValue += dot(values, ones);\n } else if ("+("prod"===e)+") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = "+s+"(values, minMaxValue);\n }\n ",d="vec4";"all"===e?(a="1.0",f="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",d="bvec4"):"any"===e&&(a="0.0",f="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",d="bvec4");var h="";i%n>0&&(h="\n if (inIdx < 0 || inIdx >= "+i+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+a+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+h+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n vec4 minMaxValue = vec4("+a+");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+c+"; i += 4) {\n int inIdx = inOffset + i;\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+f+"\n }\n\n int inIdx = inOffset + "+c+";\n if ("+(1===l)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(2===l)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(3===l)+") {\n "+d+" values = "+d+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+f+"\n }\n setOutput("+u+");\n }\n "}({windowSize:Mr(i),inSize:i,batchSize:r},e),a=o.outputShape,s=a[0],u=a[1],c=this.makeOutputArray([s,u],n);return this.compileAndRun(o,[t],c),1===c.shape[1]?c:this.reduce(c,e,n)},t.prototype.argReduce=function(t,e,n){void 0===n&&(n=null);var r=t.shape[0],i=t.shape[1];null!=n&&(r=n.shape[0],i=n.shape[1]);var o=new function(t,e,n){this.variableNames=["A"];var r=t.windowSize,i=t.batchSize,o=t.inSize,a=Math.ceil(o/r);n||this.variableNames.push("bestIndicesA"),this.outputShape=[i,a];var s="max"===e?">":"<",u=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+r+";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < "+r+"; i++) {\n int inIdx = "+u+";\n float candidate = getA(batch, inIdx);\n if (candidate "+s+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n "}({windowSize:Mr(i),inSize:i,batchSize:r},e,null==n),a=o.outputShape,s=a[0],u=a[1],c=this.makeOutputArray([s,u],"int32"),l=[t];return null!=n&&l.push(n),this.compileAndRun(o,l,c),1===c.shape[1]?c:this.argReduce(t,e,c)},t.prototype.argReducePacked=function(t,e,n){void 0===n&&(n=null);var r=null!=n?n.shape:t.shape,i=new function(t,e,n,r){this.variableNames=["A"],this.usesPackedTextures=!0,w(t.length>2,function(){return"Packed arg"+(n.charAt(0).toUpperCase()+n.slice(1))+" supports only inputs with rank above 2."});var i=t[t.length-1],o=Math.ceil(i/e);this.outputShape=t.slice(0,-1),o>1&&this.outputShape.push(o),r||this.variableNames.push("bestIndicesA");var a,s,u=this.outputShape,c=u.length,l=Ii(c),f=xi("coords",c);if(1===o){var d=Ii(s=c+1);a="\n "+d+" sourceLocR = "+d+"("+f.join()+", 0);\n ++"+f[c-1]+";\n "+d+" sourceLocG = "+d+"("+f.join()+", 0);\n ++"+f[c-2]+";\n "+d+" sourceLocA = "+d+"("+f.join()+", 0);\n --"+f[c-1]+";\n "+d+" sourceLocB = "+d+"("+f.join()+", 0);\n --"+f[c-2]+";"}else s=c,a="\n "+l+" sourceLocR = coords;\n ++"+f[c-1]+";\n "+l+" sourceLocG = coords;\n ++"+f[c-2]+";\n "+l+" sourceLocA = coords;\n --"+f[c-1]+";\n "+l+" sourceLocB = coords;\n --"+f[c-2]+";";var h=["x","y","z","w","u","v"].slice(0,s),p="."+h[s-1],m=h.map(function(t){return"int "+t}),g=xi("sourceLocR",s-1).concat("inIdx.r"),v=xi("sourceLocG",s-1).concat("inIdx.g"),b=xi("sourceLocB",s-1).concat("inIdx.b"),y=xi("sourceLocA",s-1).concat("inIdx.a"),x="max"===n?"greaterThan":"lessThan",_=r?"":"\n inIdx = round(vec4(getBestIndicesAChannel("+g.join()+"),\n getBestIndicesAChannel("+v.join()+"),\n getBestIndicesAChannel("+b.join()+"),\n getBestIndicesAChannel("+y.join()+")));",k="vec4(\n getAChannel("+g.join()+"),\n hasNextCol ? getAChannel("+v.join()+") : 0.,\n hasNextRow ? getAChannel("+b.join()+") : 0.,\n hasNextRow && hasNextCol ? getAChannel("+y.join()+") : 0.)",S=r?"":"\n float getBestIndicesAChannel("+m.join()+") {\n return getChannel(getBestIndicesA("+h.join()+"),\n vec2("+h.slice(-2).join()+"));\n }";this.userCode="\n float getAChannel("+m.join()+") {\n return getChannel(getA("+h.join()+"),\n vec2("+h.slice(-2).join()+"));\n }\n "+S+"\n void main() {\n "+l+" coords = getOutputCoords();\n bool hasNextCol = "+f[c-1]+" < "+(u[c-1]-1)+";\n bool hasNextRow = "+f[c-2]+" < "+(u[c-2]-1)+";\n "+a+"\n ivec4 srcIdx = ivec4(sourceLocR"+p+", sourceLocG"+p+",\n sourceLocB"+p+", sourceLocA"+p+") * "+e+";\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = "+k+";\n\n for (int i = 0; i < "+e+"; i++) {\n inIdx = srcIdx;\n "+_+"\n vec4 candidate = "+k+";\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4("+x+"(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n "}(r,Mr(r[r.length-1]),e,null==n),o=this.makePackedTensor(i.outputShape,"int32"),a=null==n?[t]:[t,n];return this.compileAndRun(i,a,o),o.rank===t.rank?this.argReducePacked(t,e,o):o},t.prototype.sum=function(t,e){an("sum",e,t.rank);var n=rn(t.shape,e),r=n[0],i=S(n[1]),o=t.as2D(-1,i),a=St(t.dtype);return this.reduce(o,"sum",a).reshape(r)},t.prototype.prod=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.prod(t,e);var n=rn(t.shape,e),r=n[0],i=S(n[1]),o=t.as2D(-1,i),a=St(t.dtype);return this.reduce(o,"prod",a).reshape(r)},t.prototype.unsortedSegmentSum=function(t,e,n){var r=0,i=sn([r],t.rank),o=t;null!=i&&(o=t.transpose(i),r=cn(1,t.rank)[0]);var a=function(t,e,n){for(var r=[],i=t.length,o=0;o<i;o++)o!==e?r.push(t[o]):r.push(n);return r}(o.shape,r,n),s=S([o.shape[r]]),u=o.as2D(-1,s),c=St(t.dtype),l=this.segOpCompute(u,"unsortedSegmentSum",e,c,n).reshape(a);return null!=i&&(l=l.transpose(un(i))),l},t.prototype.segOpCompute=function(t,e,n,r,i){var o=t.shape[0],a=t.shape[1],s=function(t,e){var n,r=!1;for(t<=Cr?(n=t,r=!0):n=K(t,Math.floor(Math.sqrt(t)));!r;)n>e||n===t?r=!0:n=K(t,n+1);return n}(a,i),u=new function(t,e){this.variableNames=["x","segmentIds"];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=t.numSegments,a=o*Math.ceil(i/n);this.outputShape=[r,a];var s=4*Math.floor(n/4),u=n%4,c="\n sumValue += dot(values, segFilter);\n ",l="";i%n>0&&(l="\n if (inIdx < 0 || inIdx >= "+i+") {\n return initializationValue;\n }\n ");var f="";i%n>0&&(f="\n if (inIdx < 0 || inIdx >= "+i+") {\n return -1.0;\n }\n "),this.userCode="\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n "+l+"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n "+f+"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n "+o+")) * float("+n+"));\n int currentSeg = int(mod(float(outIdx), float("+o+")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < "+s+"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n "+c+"\n }\n\n int inIdx = inOffset + "+s+";\n if ("+(1===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n "+c+"\n } else if ("+(2===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n "+c+"\n } else if ("+(3===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n "+c+"\n }\n setOutput(sumValue);\n }\n "}({windowSize:s,inSize:a,batchSize:o,numSegments:i},e),c=u.outputShape,l=c[0],f=c[1],d=this.makeOutputArray([l,f],r);return this.compileAndRun(u,[t,n],d),d.shape[1]===i?d:(n=Mn(0,i).tile([a/s]),this.segOpCompute(d,e,n,r,i))},t.prototype.argMinMaxReduce=function(t,e,n){var r=[e];if(an("arg"+n.charAt(0).toUpperCase()+n.slice(1),r,t.rank),!h.getBool("WEBGL_PACK_REDUCE")||t.rank<=2){var i=rn(t.shape,r),o=i[0],a=S(i[1]),s=t.as2D(-1,a);return this.argReduce(s,n).reshape(o)}return this.argReducePacked(t,n)},t.prototype.argMin=function(t,e){return this.argMinMaxReduce(t,e,"min")},t.prototype.argMax=function(t,e){return this.argMinMaxReduce(t,e,"max")},t.prototype.cumsum=function(t,e,n,r){if(e!==t.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(t.rank-1)+" but got axis="+e);var i=new function(t,e,n){this.variableNames=["x"],this.outputShape=t;var r=t.length,i=t[t.length-1],o=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+i+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+Ii(r)+" coords = getOutputCoords();\n int end = "+qi(r,"coords")+";\n float val = 0.0;\n for (int i = "+i+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+o+" end) {\n continue;\n }\n if (idx == end && "+e+") {\n continue;\n }\n "+qi(r,"coords")+" = idx;\n val += getX("+function(t,e){if(1===t)return""+e;if(2===t)return e+".x, "+e+".y";if(3===t)return e+".x, "+e+".y, "+e+".z";if(4===t)return e+".x, "+e+".y, "+e+".z, "+e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}(r,"coords")+");\n }\n setOutput(val);\n }\n "}(t.shape,n,r);return this.compileAndRun(i,[t])},t.prototype.equal=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(equal(a, b));\n","bool");var n=new Li("return float(a == b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.notEqual=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(notEqual(a, b));\n","bool");var n=new Li("return float(a != b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.less=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.less(t,e);if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThan(a, b));\n","bool");var n=new Li("return float(a < b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.lessEqual=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThanEqual(a, b));\n","bool");var n=new Li("return float(a <= b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.greater=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.greater(t,e);if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThan(a, b));\n","bool");var n=new Li("return float(a > b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.greaterEqual=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThanEqual(a, b));\n","bool");var n=new Li("return float(a >= b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.logicalNot=function(t){var e=new No(t.shape,"return float(!(x >= 1.0));");return this.compileAndRun(e,[t])},t.prototype.logicalAnd=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n","bool");var n=new Li("return float(a >= 1.0 && b >= 1.0);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.logicalOr=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n","bool");var n=new Li("return float(a >= 1.0 || b >= 1.0);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.select=function(t,e,n){var r=new function(t,e,n){var r,i;if(this.variableNames=["c","a","b"],this.outputShape=e,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)i="resRC",r="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[],s=[],u=0;u<e.length;u++)s.push(""+o[u]),u<t&&a.push(""+o[u]);r=a.join(),i=s.join()}var c=Ii(n);this.userCode="\n void main() {\n "+c+" resRC = getOutputCoords();\n float cVal = getC("+r+");\n if (cVal >= 1.0) {\n setOutput(getA("+i+"));\n } else {\n setOutput(getB("+i+"));\n }\n }\n "}(t.rank,e.shape,e.rank),i=this.makeOutputArray(r.outputShape,kt(e.dtype,n.dtype));return this.compileAndRun(r,[t,e,n],i)},t.prototype.where=function(t){Ye("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var e=t.dataSync();return yi(t.shape,e)},t.prototype.topk=function(t,e,n){return bi(t.dataSync(),t.shape,t.dtype,e)},t.prototype.min=function(t,e){an("min",e,t.rank);var n=rn(t.shape,e),r=n[0],i=S(n[1]),o=t.as2D(-1,i);return this.reduce(o,"min",o.dtype).reshape(r)},t.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("\n vec4 result = vec4(min(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Li("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return min(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.mod=function(t,e){var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("\n vec4 result = mod(a, b);\n vec4 isNaN = vec4(equal(b, vec4(0.0)));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Li("if (b == 0.0) return NAN;\n return mod(a, b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.max=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.max(t,e);an("max",e,t.rank);var n=rn(t.shape,e),r=n[0],i=S(n[1]),o=t.as2D(-1,i);return this.reduce(o,"max",o.dtype).reshape(r)},t.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("\n vec4 result = vec4(max(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Li("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return max(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.all=function(t,e){an("all",e,t.rank);var n=rn(t.shape,e),r=n[0],i=S(n[1]),o=t.as2D(-1,i);return this.reduce(o,"all",o.dtype).reshape(r)},t.prototype.any=function(t,e){an("any",e,t.rank);var n=rn(t.shape,e),r=n[0],i=S(n[1]),o=t.as2D(-1,i);return this.reduce(o,"any",o.dtype).reshape(r)},t.prototype.squaredDifference=function(t,e){var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("return (a - b) * (a - b);",t.shape,e.shape):new Li("return (a - b) * (a - b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.realDivide=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(b.x == 0.0) {\n result.x = NAN;\n } else if(a.x == b.x) {\n result.x = 1.;\n }\n if(b.y == 0.0) {\n result.y = NAN;\n } else if(a.y == b.y) {\n result.y = 1.;\n }\n if(b.z == 0.0) {\n result.z = NAN;\n } else if(a.z == b.z) {\n result.z = 1.;\n }\n if(b.w == 0.0) {\n result.w = NAN;\n } else if(a.w == b.w) {\n result.w = 1.;\n }\n \n return result;\n","float32",!0);var n=new Li("\nif (b == 0.0) {\n return NAN;\n} \nif (a == b) {\n return 1.0;\n};\nreturn a / b;",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[t,e],r)},t.prototype.floorDiv=function(t,e){if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n","int32");var n=new Li("\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"int32");return this.compileAndRun(n,[t,e],r)},t.prototype.add=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Fi);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.add(t,e);var n=kt(t.dtype,e.dtype);if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Fi,n);var r=new Li(Fi,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],i)},t.prototype.packedBinaryOp=function(t,e,n,r,i){void 0===i&&(i=!1);var o=new Bi(n,t.shape,e.shape,i),a=this.makePackedTensor(o.outputShape,r);return this.compileAndRun(o,[t,e],a)},t.prototype.complexSeparableBinaryOp=function(t,e,n){var r=this,i=this.texData.get(t.dataId),o=this.texData.get(e.dataId),a=[[i.complexTensors.real,o.complexTensors.real],[i.complexTensors.imag,o.complexTensors.imag]].map(function(i){var o=i[0],a=i[1],s=r.makeComplexComponentTensorHandle(t,o),u=r.makeComplexComponentTensorHandle(e,a),c=new Li(n,t.shape,e.shape),l=r.makeOutputArray(c.outputShape,kt(o.dtype,a.dtype));return r.compileAndRun(c,[s,u],l)}),s=a[0],u=a[1],c=this.complex(s,u);return s.dispose(),u.dispose(),c},t.prototype.makeComplexComponentTensorHandle=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},t.prototype.addN=function(t){if(1===t.length)return t[0];if(t.length>h.get("WEBGL_MAX_TEXTURES_IN_SHADER")){var e=Math.floor(t.length/2),n=this.addN(t.slice(0,e)),r=this.addN(t.slice(e));return this.addN([n,r])}var i=t.map(function(t){return t.dtype}).reduce(function(t,e){return kt(t,e)}),o=t.map(function(t){return t.shape}),a=h.getBool("WEBGL_PACK"),s=a?new function(t,e){this.outputShape=[],this.usesPackedTextures=!0,this.outputShape=t,this.variableNames=e.map(function(t,e){return"T"+e});var n=[];this.variableNames.forEach(function(t){n.push("vec4 v"+t+" = get"+t+"AtOutCoords();")});var r=this.variableNames.map(function(t){return"v"+t}).join(" + ");this.userCode="\n void main() {\n "+n.join("\n ")+"\n\n vec4 result = "+r+";\n setOutput(result);\n }\n "}(t[0].shape,o):new function(t,e){this.outputShape=[],this.outputShape=t,this.variableNames=e.map(function(t,e){return"T"+e});var n=[];this.variableNames.forEach(function(t){n.push("float v"+t+" = get"+t+"AtOutCoords();")});var r=this.variableNames.map(function(t){return"v"+t}).join(" + ");this.userCode="\n void main() {\n "+n.join("\n ")+"\n\n float result = "+r+";\n setOutput(result);\n }\n "}(t[0].shape,o),u=a?this.makePackedTensor(s.outputShape,i):this.makeOutputArray(s.outputShape,i);return this.compileAndRun(s,t,u)},t.prototype.subtract=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Pi);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.subtract(t,e);var n=kt(t.dtype,e.dtype);if(h.getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Pi,t.dtype);var r=new Li(Pi,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],i)},t.prototype.pow=function(t,e){var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS"),r=n?new Bi("\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Li("\nif(a < 0.0 && floor(b) < b){\n return NAN;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",t.shape,e.shape),i=kt(t.dtype,e.dtype),o=n?this.makePackedTensor(r.outputShape,i):this.makeOutputArray(r.outputShape,i);return this.compileAndRun(r,[t,e],o)},t.prototype.ceil=function(t){var e=new No(t.shape,"return ceil(x);");return this.compileAndRun(e,[t])},t.prototype.floor=function(t){var e=new No(t.shape,"return floor(x);");return this.compileAndRun(e,[t])},t.prototype.sign=function(t){var e=new No(t.shape,"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n");return this.compileAndRun(e,[t])},t.prototype.isNaN=function(t){var e=new No(t.shape,"return float(isnan(x));"),n=this.makeOutputArray(e.outputShape,"bool");return this.compileAndRun(e,[t],n)},t.prototype.isInf=function(t){var e=new No(t.shape,"return float(isinf(x));"),n=this.makeOutputArray(e.outputShape,"bool");return this.compileAndRun(e,[t],n)},t.prototype.isFinite=function(t){var e=new No(t.shape,"return float(!isnan(x) && !isinf(x));"),n=this.makeOutputArray(e.outputShape,"bool");return this.compileAndRun(e,[t],n)},t.prototype.round=function(t){var e=new No(t.shape,"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n");return this.compileAndRun(e,[t])},t.prototype.exp=function(t){var e;return e=h.getBool("WEBGL_PACK")?new Ro(t.shape,Do):new No(t.shape,Do),this.compileAndRun(e,[t])},t.prototype.expm1=function(t){var e=new No(t.shape,"return exp(x) - 1.0;");return this.compileAndRun(e,[t])},t.prototype.log=function(t){var e;return e=h.getBool("WEBGL_PACK")?new Ro(t.shape,"\n vec4 result = log(x);\n vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n result.r = isNaN.r == 1.0 ? NAN : result.r;\n result.g = isNaN.g == 1.0 ? NAN : result.g;\n result.b = isNaN.b == 1.0 ? NAN : result.b;\n result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n return result;\n"):new No(t.shape,"if (x < 0.0) return NAN;\n return log(x);"),this.compileAndRun(e,[t])},t.prototype.log1p=function(t){var e=new No(t.shape,"return log(1.0 + x);");return this.compileAndRun(e,[t])},t.prototype.sqrt=function(t){var e=new No(t.shape,"return sqrt(x);");return this.compileAndRun(e,[t])},t.prototype.rsqrt=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.rsqrt(t);var e=new No(t.shape,"return inversesqrt(x);");return this.compileAndRun(e,[t])},t.prototype.square=function(t){var e=new No(t.shape,"return x * x;");return this.compileAndRun(e,[t])},t.prototype.reciprocal=function(t){var e=new No(t.shape,"return 1.0 / x;");return this.compileAndRun(e,[t])},t.prototype.relu=function(t){var e;return e=h.getBool("WEBGL_PACK")?new Ro(t.shape,jo):new No(t.shape,Io),this.compileAndRun(e,[t])},t.prototype.prelu=function(t,e){var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n",t.shape,e.shape):new Li("return (a < 0.) ? b * a : a;",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.elu=function(t){var e=new No(t.shape,"return (x >= 0.0) ? x : (exp(x) - 1.0);");return this.compileAndRun(e,[t])},t.prototype.eluDer=function(t,e){var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",t.shape,e.shape):new Li("return (b >= 1.0) ? a : a * (b + 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.selu=function(t){var e=new No(t.shape,"\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = 1.7580993408473768;\n float scale = 1.0507009873554805;\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n");return this.compileAndRun(e,[t])},t.prototype.int=function(t){var e=new No(t.shape,"return float(int(x));"),n=this.makeOutputArray(e.outputShape,"int32");return this.compileAndRun(e,[t],n)},t.prototype.clip=function(t,e,n){var r,i=(r=h.getBool("WEBGL_PACK_CLIP")?new Wi(t.shape):new Ui(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(r,[t],null,i)},t.prototype.abs=function(t){var e=new No(t.shape,"return abs(x);");return this.compileAndRun(e,[t])},t.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new function(t){this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "}(t.shape),r=[this.makeComplexComponentTensorHandle(t,e.complexTensors.real),this.makeComplexComponentTensorHandle(t,e.complexTensors.imag)];return this.compileAndRun(n,r)},t.prototype.sigmoid=function(t){var e=new No(t.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(e,[t])},t.prototype.softplus=function(t){var e=new No(t.shape,"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n");return this.compileAndRun(e,[t])},t.prototype.sin=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n return sin(x);\n");return this.compileAndRun(e,[t])},t.prototype.cos=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n return cos(x);\n");return this.compileAndRun(e,[t])},t.prototype.tan=function(t){var e=new No(t.shape,"return tan(x);");return this.compileAndRun(e,[t])},t.prototype.asin=function(t){var e=new No(t.shape,"return asin(x);");return this.compileAndRun(e,[t])},t.prototype.acos=function(t){var e=new No(t.shape,"return acos(x);");return this.compileAndRun(e,[t])},t.prototype.atan=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n return atan(x);\n");return this.compileAndRun(e,[t])},t.prototype.atan2=function(t,e){var n=h.getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Bi("\n vec4 result = atan(a, b);\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Li("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return atan(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.sinh=function(t){var e=new No(t.shape,"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},t.prototype.cosh=function(t){var e=new No(t.shape,"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},t.prototype.tanh=function(t){var e=new No(t.shape,"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(e,[t])},t.prototype.asinh=function(t){var e=new No(t.shape,"return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(e,[t])},t.prototype.acosh=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));");return this.compileAndRun(e,[t])},t.prototype.atanh=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;");return this.compileAndRun(e,[t])},t.prototype.erf=function(t){var e=new No(t.shape,'\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = 0.3275911;\n float a1 = 0.254829592;\n float a2 = -0.284496736;\n float a3 = 1.421413741;\n float a4 = -1.453152027;\n float a5 = 1.061405429;\n\n float t = 1.0 / (1.0 + p * x);\n return 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);\n');return this.compileAndRun(e,[t])},t.prototype.step=function(t,e){var n=new No(t.shape,function(t){return void 0===t&&(t=0),To+"\n return x > 0.0 ? 1.0 : float("+t+");\n "}(e));return this.compileAndRun(n,[t])},t.prototype.conv2dByMatMul=function(t,e,n){var r=t.shape,i=this.texData.get(t.dataId),o=n.inChannels,a=r[0]*r[1]*r[2],s=n.outChannels,u=(1===a||1===s)&&o>1e3,c=r[2]%2!=0&&!!i.isPacked;if(u||!h.getBool("WEBGL_LAZILY_UNPACK")||!h.getBool("WEBGL_PACK_BINARY_OPERATIONS")||!c){var l=this.reshape(t,[1,r[0]*r[1]*r[2],n.inChannels]),f=this.reshape(e,[1,n.inChannels,n.outChannels]);return this.reshape(this.batchMatMul(l,f,!1,!1),n.outShape)}var d=pt.make([1,r[0]*r[1]*(r[2]+1),n.inChannels],{dataId:t.dataId},t.dtype,this),p=i.shape;i.shape=i.shape.slice(),i.shape[i.shape.length-2]++,w(ye(i.shape,d.shape),function(){return"packed reshape "+i.shape+" to "+d.shape+" isn't free"});var m=this.reshape(e,[1,n.inChannels,n.outChannels]),g=this.batchMatMul(d,m,!1,!1),v=this.texData.get(g.dataId);return w(v.isPacked,function(){return"batchMatMul result is expected to be packed"}),i.shape=p,v.shape=n.outShape,pt.make(n.outShape,{dataId:g.dataId},g.dtype,this)},t.prototype.conv2dWithIm2Row=function(t,e,n){var r=n.filterWidth,i=n.filterHeight,o=n.inChannels,a=n.outWidth,s=n.outHeight,u=r*i*o,c=s*a,l=[u,c],f=t.squeeze([0]),d=e.reshape([1,u,-1]),h=new function(t,e,n){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t;var r=n.filterWidth,i=n.inChannels,o=n.strideWidth,a=n.strideHeight,s=n.padInfo,u=n.outWidth,c=n.dilationWidth,l=n.dilationHeight,f=s.left,d=s.top,h=i*r,p=_i();this.userCode="\n void main() {\n ivec2 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n int blockIndex = rc.y + col;\n int pos = rc.x + row;\n\n if(blockIndex >= "+t[1]+" || pos >= "+t[0]+") continue;\n\n int offsetY = int(blockIndex / ("+u+")) * "+a+" - "+d+";\n int d0 = offsetY + "+l+" * (pos / "+h+");\n\n if(d0 >= "+e[0]+" || d0 < 0) continue;\n\n int offsetX = int(mod(float(blockIndex), "+u+".) * "+o+". - "+f+".);\n int d1 = offsetX + "+c+" * (int(mod(float(pos), "+h+".) / "+i+".));\n\n if(d1 >= "+e[1]+" || d1 < 0) continue;\n\n vec2 innerDims = vec2(d1, int(mod(float(pos), "+i+".)));\n result[row * 2 + col] = getChannel(getA(d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n\n "+p.output+" = result;\n }\n "}(l,f.shape,n),p=this.compileAndRun(h,[f]).reshape([1,l[0],l[1]]),m=new wo(p.shape,[1,c,n.outChannels],!0,!1);return this.compileAndRun(m,[p,d]).reshape([1,s,a,n.outChannels])},t.prototype.conv2d=function(t,e,n){if(1===n.filterHeight&&1===n.filterWidth&&1===n.dilationHeight&&1===n.dilationWidth&&1===n.strideHeight&&1===n.strideWidth&&("SAME"===n.padInfo.type||"VALID"===n.padInfo.type))return this.conv2dByMatMul(t,e,n);if(h.getBool("WEBGL_CONV_IM2COL")&&1===t.shape[0])return this.conv2dWithIm2Row(t,e,n);var r=new function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.top,n=t.padInfo.left,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.filterHeight,u=t.filterWidth,c=4*Math.floor(t.inChannels/4),l=t.inChannels%4;this.userCode="\n const ivec2 strides = ivec2("+r+", "+i+");\n const ivec2 pads = ivec2("+e+", "+n+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+"; wR++) {\n int xR = xRCorner + wR * "+o+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+u+"; wC++) {\n int xC = xCCorner + wC * "+a+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+c+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===l)+") {\n dotProd +=\n getX(batch, xR, xC, "+c+") *\n getW(wR, wC, "+c+", d2);\n } else if ("+(2===l)+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+c+"),\n getX(batch, xR, xC, "+c+" + 1)\n );\n vec2 wValues = vec2(\n getW(wR, wC, "+c+", d2),\n getW(wR, wC, "+c+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===l)+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+c+"),\n getX(batch, xR, xC, "+c+" + 1),\n getX(batch, xR, xC, "+c+" + 2)\n );\n vec3 wValues = vec3(\n getW(wR, wC, "+c+", d2),\n getW(wR, wC, "+c+" + 1, d2),\n getW(wR, wC, "+c+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.conv2dDerInput=function(t,e,n){var r=new function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left;this.userCode="\n const ivec2 pads = ivec2("+o+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.conv2dDerFilter=function(t,e,n){var r=new function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+i+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.depthwiseConv2D=function(t,e,n){var r;return h.getBool("WEBGL_PACK_DEPTHWISECONV")&&n.strideWidth<=2&&n.outChannels/n.inChannels==1?(r=new function(t){this.variableNames=["x","W"],this.usesPackedTextures=!0,this.outputShape=t.outShape;for(var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,l=t.filterWidth,f=l,d="int xR; int xC; int xCOffset;",h=0;h<c;h++)for(var p=0;p<l;p++)d+="\n vec4 xTexelR"+h+"C"+2*p+" = vec4(0.);\n vec4 wR"+h+"C"+p+" = vec4(0.);\n vec4 xR"+h+"C"+p+" = vec4(0.);";for(h=0;h<c;h++)for(var m=0;m<f;m++){if(d+="\n xR = xRCorner + "+h*s+";\n xC = xCCorner + "+(p=2*m)*u+";\n ",1===a){if(p<l&&(d+=i%2==1?"\n xCOffset = xC + 1;\n if(xR >= 0 && xR < "+e+" && xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+h+"C"+p+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+h+"C"+p+" = vec4(0.);\n }\n\n xCOffset = xC + 1 - 2;\n if(xR >= 0 && xR < "+e+" && xCOffset >= 0 && xCOffset < "+n+") {\n vec4 previous = getX(batch, xR, xCOffset, d1);\n xR"+h+"C"+p+" = vec4(previous.zw, xTexelR"+h+"C"+p+".xy);\n } else {\n xR"+h+"C"+p+" = vec4(0, 0, xTexelR"+h+"C"+p+".xy);\n }\n ":"\n if(xR >= 0 && xR < "+e+" && xC >= 0 && xC < "+n+") {\n xTexelR"+h+"C"+p+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+h+"C"+p+" = vec4(0.);\n }\n\n xR"+h+"C"+p+" = xTexelR"+h+"C"+p+";\n ",p+1<l)){var g=i%2==0?b(u):u;u%2==0&&i%2==1||u%2!=0&&i%2!=1?(d+="\n xCOffset = xC + "+i%2+" + "+g+";\n\n if(xR >= 0 && xR < "+e+" &&\n xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+h+"C"+(p+2)+" = getX(batch, xR, xCOffset, d1);\n }\n ",u>1&&(d+="\n xCOffset -= 2;\n if(xR >= 0 && xR < "+e+" &&\n xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+h+"C"+p+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+h+"C"+p+" = vec4(0.);\n }\n "),d+="\n xR"+h+"C"+(p+1)+" = vec4(\n xTexelR"+h+"C"+p+".zw, xTexelR"+h+"C"+(p+2)+".xy);\n "):d+="\n xCOffset = xC + "+g+";\n\n if(xR >= 0 && xR < "+e+" &&\n xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+h+"C"+(p+2)+" = getX(batch, xR, xCOffset, d1);\n }\n\n xR"+h+"C"+(p+1)+" = xTexelR"+h+"C"+(p+2)+";\n "}}else p<l&&(d+="\n if(xR >= 0 && xR < "+e+") {\n ",i%2==1?(d+="\n xCOffset = xC + 1 - "+a+";\n if(xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+h+"C"+p+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+h+"C"+p+" = vec4(0.);\n }\n\n if(xC + 1 >= 0 && xC + 1 < "+n+") {\n xTexelR"+h+"C"+(p+2)+" = getX(batch, xR, xC + 1, d1);\n } else {\n xTexelR"+h+"C"+(p+2)+" = vec4(0.);\n }\n\n xR"+h+"C"+p+" = vec4(\n xTexelR"+h+"C"+p+".zw, xTexelR"+h+"C"+(p+2)+".zw);\n ",p+1<l&&(d+="\n vec4 final = vec4(0.);\n xCOffset = xC + 1 + "+a+";\n if(xCOffset >= 0 && xCOffset < "+n+") {\n final = getX(batch, xR, xCOffset, d1);\n }\n xR"+h+"C"+(p+1)+" = vec4(xTexelR"+h+"C"+(p+2)+".xy, final.xy);\n ")):(d+="\n if(xC >= 0 && xC < "+n+") {\n xTexelR"+h+"C"+p+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+h+"C"+p+" = vec4(0.);\n }\n\n xCOffset = xC + "+a+";\n if(xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+h+"C"+(p+2)+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+h+"C"+(p+2)+" = vec4(0.);\n }\n\n xR"+h+"C"+p+" = vec4(\n xTexelR"+h+"C"+p+".xy, xTexelR"+h+"C"+(p+2)+".xy);\n ",p+1<l&&(d+="\n xR"+h+"C"+(p+1)+" = vec4(\n xTexelR"+h+"C"+p+".zw, xTexelR"+h+"C"+(p+2)+".zw);\n ")),d+="}");p<l&&(d+="\n vec4 wTexelR"+h+"C"+p+" = getW("+h+", "+p+", d1, q);\n wR"+h+"C"+p+" = vec4(wTexelR"+h+"C"+p+".xz, wTexelR"+h+"C"+p+".xz);\n ",p+1<l&&(d+="\n vec4 wTexelR"+h+"C"+(p+1)+" = getW("+h+", "+(p+1)+", d1, q);\n wR"+h+"C"+(p+1)+" =\n vec4(wTexelR"+h+"C"+(p+1)+".xz, wTexelR"+h+"C"+(p+1)+".xz);"))}for(h=0;h<c;h++)for(p=0;p<l;p++)d+="result += xR"+h+"C"+p+" * wR"+h+"C"+p+";";this.userCode="\n const ivec2 strides = ivec2("+o+", "+a+");\n const ivec2 pads = ivec2("+r+", "+i+");\n\n void main() {\n\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2;\n int q = 0;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n vec4 result = vec4(0.);\n\n "+d+"\n\n setOutput(result);\n }\n "}(n),this.compileAndRun(r,[t,e],this.makePackedTensor(n.outShape,t.dtype))):(r=new function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,l=t.filterWidth,f=t.outChannels/t.inChannels;this.userCode="\n const ivec2 strides = ivec2("+o+", "+a+");\n const ivec2 pads = ivec2("+r+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / "+f+";\n int q = d2 - d1 * "+f+";\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TODO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < "+c+"; wR++) {\n int xR = xRCorner + wR * "+s+";\n\n if (xR < 0 || xR >= "+e+") {\n continue;\n }\n\n for (int wC = 0; wC < "+l+"; wC++) {\n int xC = xCCorner + wC * "+u+";\n\n if (xC < 0 || xC >= "+n+") {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n setOutput(dotProd);\n }\n "}(n),this.compileAndRun(r,[t,e]))},t.prototype.depthwiseConv2DDerInput=function(t,e,n){var r=new function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left,s=t.outChannels/t.inChannels;this.userCode="\n const ivec2 pads = ivec2("+o+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n // TODO: Vec4 over the channelMul\n for (int dm = 0; dm < "+s+"; dm++) {\n int d2 = d1 * "+s+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){var r=new function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.outChannels/t.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+o+" + dm;\n\n float dotProd = 0.0;\n\n // TODO: Vec4 over the batch size\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+i+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.conv3d=function(t,e,n){var r=new function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,r=t.padInfo.left,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterDepth,f=t.filterHeight,d=t.filterWidth,h=4*Math.floor(t.inChannels/4),p=t.inChannels%4;this.userCode="\n const ivec3 strides = ivec3("+i+", "+o+", "+a+");\n const ivec3 pads = ivec3("+e+", "+n+", "+r+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < "+l+"; wF++) {\n int xF = xFCorner + wF * "+s+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+f+"; wR++) {\n int xR = xRCorner + wR * "+u+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+d+"; wC++) {\n int xC = xCCorner + wC * "+c+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+h+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===p)+") {\n dotProd +=\n getX(batch, xF, xR, xC, "+h+") *\n getW(wF, wR, wC, "+h+", d2);\n } else if ("+(2===p)+") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, "+h+"),\n getX(batch, xF, xR, xC, "+h+" + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, "+h+", d2),\n getW(wF, wR, wC, "+h+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===p)+") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, "+h+"),\n getX(batch, xF, xR, xC, "+h+" + 1),\n getX(batch, xF, xR, xC, "+h+" + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, "+h+", d2),\n getW(wF, wR, wC, "+h+" + 1, d2),\n getW(wF, wR, wC, "+h+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.conv3dDerInput=function(t,e,n){var r=new function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=e-1-t.padInfo.front,u=n-1-t.padInfo.top,c=r-1-t.padInfo.left;this.userCode="\n const ivec3 pads = ivec3("+s+", "+u+", "+c+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < "+e+"; wF++) {\n float dyF = float(dyFCorner + wF) / "+i+".0;\n\n if (dyF < 0.0 || dyF >= "+t.outDepth+".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = "+e+" - 1 - wF;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+o+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+n+" - 1 - wR;\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+r+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.conv3dDerFilter=function(t,e,n){var r=new function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,i=t.padInfo.front,o=t.padInfo.top,a=t.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yF = 0; yF < "+t.outDepth+"; yF++) {\n int xF = wF + yF * "+e+" - "+i+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+n+" - "+o+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+r+" - "+a+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(r,[t,e])},t.prototype.maxPool=function(t,e){var n=new _o(e,"max",!1),r=this.makeOutputArray(n.outputShape,t.dtype);return this.compileAndRun(n,[t],r)},t.prototype.avgPool=function(t,e){var n=new _o(e,"avg",!1),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[t],r)},t.prototype.maxPoolBackprop=function(t,e,n,r){var i=new _o(r,"max",!0),o=this.compileAndRun(i,[e]),a=new function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,r=t.dilationHeight,i=t.effectiveFilterHeight,o=t.effectiveFilterWidth,a=i-1-t.padInfo.top,s=o-1-t.padInfo.left,u=i*o-1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+i+";\n wR += "+r+") {\n float dyR = float(dyRCorner + wR) / "+e+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+o+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+n+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+u+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+o+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "}(r),s=this.makeOutputArray(a.outputShape,e.dtype),u=this.compileAndRun(a,[t,o],s);return o.dispose(),u},t.prototype.avgPoolBackprop=function(t,e,n){var r=new function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterHeight,u=t.effectiveFilterWidth,c=s-1-t.padInfo.top,l=u-1-t.padInfo.left,f=1/(e*n);this.userCode="\n const ivec2 pads = ivec2("+c+", "+l+");\n const float avgMultiplier = float("+f+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+";\n wR += "+o+") {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+u+";\n wC+= "+a+") {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n "}(n),i=this.makeOutputArray(r.outputShape,e.dtype);return this.compileAndRun(r,[t],i)},t.prototype.cast=function(t,e){return ai(t,e,this)},t.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o<t.rank;o++)o!==e&&(r[i++]=t.shape[o]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(o=0;o<u.length;o++)a[e]=o,u[o]=this.slice(t,a,s).reshape(r);return u},t.prototype.reshape=function(t,e){var n=this.texData.get(t.dataId);return!n.isPacked||ye(t.shape,e)||null!==n.texture&&ye(n.shape,e)?si(t,e):this.packedReshape(t,e)},t.prototype.resizeBilinear=function(t,e,n,r){var i=h.getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new function(t,e,n,r){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&e>1?o-1:o,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n];this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+",\n "+u[1]/c[1]+");\n const vec3 inputShapeRC = vec3("+o+".0, "+a+".0,\n "+a+".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n \n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < "+(s-1)+"; \n bool hasNextRow = coords.z < "+(n-1)+";\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n "}(t.shape,e,n,r):new function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&e>1?o-1:o,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n];this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+a+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n "}(t.shape,e,n,r);return this.compileAndRun(i,[t])},t.prototype.resizeBilinearBackprop=function(t,e,n){var r=new function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&s>1?i-1:i,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],d=c[1]/l[1],h=1/f,p=1/d,m=2*Math.ceil(h)+2,g=2*Math.ceil(p)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+f+");\n const float widthScale = float("+d+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+p+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(i-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(o-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "}(t,e,n);return this.compileAndRun(r,[t])},t.prototype.resizeNearestNeighbor=function(t,e,n,r){var i=new function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&e>1?o-1:o,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n],l=r?"0.5":"0.0";this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+a+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+l+")));\n\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n "}(t.shape,e,n,r);return this.compileAndRun(i,[t])},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){var r=new function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&s>1?i-1:i,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],d=c[1]/l[1],h=1/f,p=1/d,m=2*Math.ceil(h)+2,g=2*Math.ceil(p)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+f+");\n const float widthScale = float("+d+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+p+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float sourceFracRow =\n float("+c[0]+") *\n (float(dyR) / float("+l[0]+"));\n\n float sourceFracCol =\n float("+c[1]+") *\n (float(dyC) / float("+l[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+i+") - 1),\n "+n+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+o+") - 1),\n "+n+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "}(t,e,n);return this.compileAndRun(r,[t])},t.prototype.multinomial=function(t,e,n,r){var i=e?t:qr(t),o=i.shape[0],a=i.shape[1],s=new xo(o,a,n),u=this.makeOutputArray(s.outputShape,"int32"),c=s.getCustomSetupFunc(r);return this.compileAndRun(s,[i],u,c)},t.prototype.oneHot=function(t,e,n,r){var i=new function(t,e,n,r){this.variableNames=["indices"],this.outputShape=[t,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+r+"), float("+n+"),\n float(index == coords.y)));\n }\n "}(t.size,e,n,r);return this.compileAndRun(i,[t])},t.prototype.nonMaxSuppression=function(t,e,n,r,i){return Ye("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),pi(t.dataSync(),e.dataSync(),n,r,i)},t.prototype.cropAndResize=function(t,e,n,r,i,o){var a=new function(t,e,n,r,i){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var o=t[0],a=t[1],s=t[2],u=t[3],c=e[0],l=n[0],f=n[1];this.outputShape=[c,l,f,u];var d="bilinear"===r?1:0,h=[a-1+".0",s-1+".0"],p=h[0],m=h[1],g=l>1?[""+(a-1)/(l-1),"(y2-y1) * height_ratio","y1*"+p+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+p],v=g[0],b=g[1],y=g[2],w=f>1?[""+(s-1)/(f-1),"(x2-x1) * width_ratio","x1*"+m+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+m],x=w[0],_=w[1],k=w[2];this.userCode="\n const float height_ratio = float("+v+");\n const float width_ratio = float("+x+");\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= "+o+") {\n return;\n }\n\n float height_scale = "+b+";\n float width_scale = "+_+";\n\n float in_y = "+y+";\n if( in_y < 0.0 || in_y > "+p+" ) {\n setOutput(float("+i+"));\n return;\n }\n float in_x = "+k+";\n if( in_x < 0.0 || in_x > "+m+" ) {\n setOutput(float("+i+"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if("+d+" == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n "}(t.shape,e.shape,r,i,o);return this.compileAndRun(a,[t,e,n])},t.prototype.depthToSpace=function(t,e,n){w(e>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+e});var r=t.shape[0],i="NHWC"===n?t.shape[1]:t.shape[2],o="NHWC"===n?t.shape[2]:t.shape[3],a="NHWC"===n?t.shape[3]:t.shape[1],s=i*e,u=o*e,c=a/(e*e),l=new $i("NHWC"===n?[r,s,u,c]:[r,c,s,u],e,n);return this.compileAndRun(l,[t])},t.prototype.split=function(t,e,n){return gi(t,e,n)},t.prototype.scatterND=function(t,e,n){var r=Nr(0,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=[u/a,a],l=t.reshape([o,i]),f=e.reshape([o,a]);if(0===u)return si(gn([]),n);var d=bn(0),h=new ko(o,i,l.rank,f.rank,s,c);return this.compileAndRun(h,[f,l,d]).reshape(n)},t.prototype.sparseToDense=function(t,e,n,r){var i=Nr(0,t,n),o=i.sliceRank,a=i.numUpdates,s=i.strides,u=i.outputSize,c=new ko(a,o,t.rank,e.rank,s,[u,1],!1);return this.compileAndRun(c,[e,t,r]).reshape(n)},t.prototype.fft=function(t){return this.fftImpl(t,!1)},t.prototype.ifft=function(t){return this.fftImpl(t,!0)},t.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),r=new Gi("return real * expR - imag * expI;",t.shape,e),i=new Gi("return real * expI + imag * expR;",t.shape,e),o=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag)],a=this.compileAndRun(r,o),s=this.compileAndRun(i,o),u=this.complex(a,s).as2D(t.shape[0],t.shape[1]);return a.dispose(),s.dispose(),u},t.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=Ar(t,e),o=i[0],a=i[1],s=i[2],u=i[3],c=e.reshape([a,r]),l=t.reshape([t.size/s,s]),f=new function(t,e,n){this.sliceDim=t,this.strides=e,this.variableNames=["x","indices"],this.outputShape=n;var r=Ii(e.length),i=Ii(n.length),o=this.sliceDim>1?"strides[j]":"strides";this.userCode="\n "+r+" strides = "+r+"("+this.strides+");\n void main() {\n "+i+" coords = getOutputCoords();\n int flattenIndex = 0;\n for (int j = 0; j < "+this.sliceDim+"; j++) {\n int index = round(getIndices(coords[0], j));\n flattenIndex += index * "+o+";\n }\n setOutput(getX(flattenIndex, coords[1]));\n }\n "}(r,u,[a,s]);return this.compileAndRun(f,[l,c]).reshape(o)},t.prototype.fill=function(t,e,n){if("string"===(n=n||$(e))){var r=R(n,S(t));return r.fill(e),pt.make(t,{values:r},n)}var i=new Ki(t,e),o=i.getCustomSetupFunc(e),a=this.makeOutputArray(t,n);return this.compileAndRun(i,[],a,o)},t.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported under string dtype");return this.fill(t.shape,1,t.dtype)},t.prototype.zerosLike=function(t){return this.fill(t.shape,"string"===t.dtype?"":0,t.dtype)},t.prototype.linspace=function(t,e,n){return ui(t,e,n)},t.prototype.makeOutputArray=function(t,e){return pt.make(t,{},e,this)},t.prototype.makePackedTensor=function(t,e){var n=pt.make(t,{},e,this);return this.texData.get(n.dataId).isPacked=!0,n},t.prototype.unpackTensor=function(t){var e=new function(t){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t;var e=t.length,n=xi("rc",e),r=Ii(e),i=function(t,e){if(1===t)return"rc";for(var n="",r=0;r<t;r++)n+=e[r],r<t-1&&(n+=",");return n}(e,n),o=n.slice(-2),a=e<=1?"rc":"vec2("+o.join(",")+")";this.userCode="\n void main() {\n "+r+" rc = getOutputCoords();\n vec4 packedInput = getA("+i+");\n\n setOutput(getChannel(packedInput, "+a+"));\n }\n "}(t.shape);return this.compileAndRun(e,[t],pt.make(e.outputShape,{},t.dtype,this))},t.prototype.packTensor=function(t){var e=new function(t){this.variableNames=["A"],this.outputShape=t;var e=t.length;if(0===e)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{var n=xi("rc",e),r=Ii(e),i=function(t,e,n){if(1===t)return"rc > "+e[0];for(var r="",i=t-2;i<t;i++)r+=n[i]+" >= "+e[i],i<t-1&&(r+="||");return r}(e,t,n),o=function(t,e,n,r){if(1===t)return"";var i=r.slice(-2);return"\n int r = "+i[0]+";\n int c = "+i[1]+";\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= "+e+";\n bool rEdge = rp1 >= "+n+";\n "}(e,t[t.length-1],t[t.length-2],n),a=function(t,e){var n=t.length,r=function(t,e){for(var n=[],r=0;r<=1;r++)for(var i=0;i<=1;i++){for(var o=(0===r?"r":"rp1")+", "+(0===i?"c":"cp1"),a=2;a<t;a++)o=e[e.length-1-a]+","+o;n.push(o)}return n}(n,e);return 1===n?"getA(rc),\n rc + 1 >= "+t[0]+" ? 0. : getA(rc + 1),\n 0, 0":"getA("+r[0]+"),\n cEdge ? 0. : getA("+r[1]+"),\n rEdge ? 0. : getA("+r[2]+"),\n rEdge || cEdge ? 0. : getA("+r[3]+")"}(t,n);this.userCode="\n void main() {\n "+r+" rc = getOutputCoords();\n\n if("+i+") {\n setOutput(vec4(0));\n } else {\n "+o+"\n\n setOutput(vec4("+a+"));\n }\n }\n "}}(t.shape);return this.compileAndRun(e,[t],this.makePackedTensor(t.shape,t.dtype),null,!0)},t.prototype.packedReshape=function(t,e){var n=t.reshape([pe(t.shape)].concat(me(t.shape))),r=new function(t,e){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t;for(var n="",r=0;r<4;r++){var i="thisRC = rc;";r%2==1&&(i+="thisRC.z += 1;"),r>1&&(i+="thisRC.y += 1;"),n+="\n "+i+"\n "+(r>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+"\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result["+r+"] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n "+(r>0?"}":"")+"\n "}this.userCode="\n \n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n "+ki(["r","c","d"],e)+"\n return ivec3(r, c, d);\n }\n \n "+Si(t)+"\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = "+t[1]+";\n int cols = "+t[2]+";\n\n "+n+"\n\n setOutput(result);\n }\n "}([pe(e)].concat(me(e)),n.shape);return this.compileAndRun(r,[n]).reshape(e)},t.prototype.decode=function(t){var e,n=this.texData.get(t),r=n.isPacked,i=n.shape,o=n.dtype,a=ge(i),s=Yi(i),u=this.makeTensorHandle(i,"float32");return this.texData.get(u.dataId).isPacked=!0,this.texData.get(u.dataId).dtype=o,this.texData.get(u.dataId).texShape=s.map(function(t){return 2*t}),e=r?new function(t,e){this.variableNames=["A"],this.usesPackedTextures=!0;var n=_i();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+ki(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[1]+" + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n "+n.output+" = result;\n }\n "}(a,s):new function(t,e){this.variableNames=["A"];var n=_i();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+ki(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[1]+" + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n "+n.output+" = result;\n }\n "}(a,s),this.compileAndRun(e,[{shape:a,dtype:o,dataId:t}],u,null,!0),u},t.prototype.compileAndRun=function(t,e,n,r,i){var o=this;if(void 0===i&&(i=!1),null==n&&(n=t.usesPackedTextures?this.makePackedTensor(t.outputShape,e[0].dtype):this.makeOutputArray(t.outputShape,e[0].dtype)),0===n.size)return this.texData.get(n.dataId).values=j(n.dtype,0),n;var a=e.map(function(e){if("complex64"===e.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var n=o.texData.get(e.dataId);if(null==n.texture){if(!t.usesPackedTextures&&S(e.shape)<=h.getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:e.shape,texData:null,isUniform:!0,uniformValues:n.values};t.usesPackedTextures&&(n.isPacked=!0,n.shape=e.shape)}else if(!!n.isPacked!=!!t.usesPackedTextures)e=n.isPacked?o.unpackTensor(e):o.packTensor(e),n=o.texData.get(e.dataId);else if(n.isPacked&&!ye(n.shape,e.shape)){var r=e,i=e.shape;e.shape=n.shape,e=o.packedReshape(e,i),n=o.texData.get(e.dataId),r.shape=i}return o.uploadToGPU(e.dataId),{shape:e.shape,texData:n,isUniform:!1}});this.uploadToGPU(n.dataId);var s,u={shape:n.shape,texData:this.texData.get(n.dataId),isUniform:!1},c=function(t,e,n){var r="";a.concat(n).forEach(function(t){var e=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0,n=t.isUniform?"uniform":t.texData.texShape;r+=t.shape+"_"+n+"_"+e});var i=t.userCode;return t.constructor.name+"_"+r+"_"+i}(t,0,u),l=this.getAndSaveBinary(c,function(){return function(t,e,n,r){var i=e.userCode,o=n.map(function(t,n){var r={logicalShape:t.shape,texShape:t.isUniform?null:t.texData.texShape,isUniform:t.isUniform,isPacked:!t.isUniform&&t.texData.isPacked,flatOffset:null};return null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0&&(r.flatOffset=t.texData.slice.flatOffset),{name:e.variableNames[n],shapeInfo:r}}),a=o.map(function(t){return t.shapeInfo}),s={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},u=function(t,e,n,r){var i=[];t.forEach(function(t){var e=S(t.shapeInfo.logicalShape);t.shapeInfo.isUniform?i.push("uniform float "+t.name+(e>1?"["+e+"]":"")+";"):(i.push("uniform sampler2D "+t.name+";"),i.push("uniform int offset"+t.name+";"))});var o,a,s=i.join("\n"),u=t.map(function(t){return function(t,e,n){void 0===n&&(n=!1);var r="";r+=n?function t(e){var n;switch(e.shapeInfo.logicalShape.length){case 0:return"\n vec4 get"+(n=e.name).charAt(0).toUpperCase()+n.slice(1)+"() {\n return "+_i().texture2D+"("+n+", halfCR);\n }\n ";case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1),r=t.shapeInfo.texShape,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],o=_i();return"\n vec4 "+n+"(int index) {\n vec2 uv = packedUVfrom1D(\n "+i[0]+", "+i[1]+", index);\n return "+o.texture2D+"("+e+", uv);\n }\n "}(e);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t.shapeInfo.texShape,o=i[0],a=i[1],s=_i();if(null!=i&&E(e,i))return"\n vec4 "+r+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+a+".0, "+o+".0);\n\n return "+s.texture2D+"("+n+", uv);\n }\n ";var u=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];return"\n vec4 "+r+"(int row, int col) {\n vec2 uv = packedUVfrom2D("+Math.ceil(e[1]/2)+", "+u[0]+", "+u[1]+", row, col);\n return "+s.texture2D+"("+n+", uv);\n }\n "}(e);case 3:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=e.shapeInfo.texShape,a=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)];if(1===n[0]){var s=Di(e,n.slice(1));return"\n "+t(s)+"\n vec4 "+i+"(int b, int row, int col) {\n return "+i+"("+ji(["b","row","col"],[1,2])+");\n }\n "}var u=a[0],c=a[1],l=Math.ceil(n[2]/2);return"\n vec4 "+i+"(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n "+u+", "+c+", "+l*Math.ceil(n[1]/2)+", "+l+", b, row, col);\n return "+_i().texture2D+"("+r+", uv);\n }\n "}(e);default:return function(t){for(var e=t.shapeInfo.logicalShape,n=e.length,r=t.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=t.shapeInfo.texShape,a=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)],s=a[0],u=a[1],c=Math.ceil(e[n-1]/2),l=c*Math.ceil(e[n-2]/2),f="int b, int row, int col",d="b * "+l+" + (row / 2) * "+c+" + (col / 2)",h=2;h<n-1;h++)f="int b"+h+", "+f,d="b"+h+" * "+(l*=e[n-h-1])+" + "+d;return"\n vec4 "+i+"("+f+") {\n int index = "+d+";\n int texR = index / "+u+";\n int texC = index - texR * "+u+";\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+u+", "+s+");\n return "+_i().texture2D+"("+r+", uv);\n }\n "}(e)}}(t):function t(e){var n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"float "+n+"() {return "+e+";}";var r=t.shapeInfo.texShape,i=r[0],o=r[1];if(1===i&&1===o)return"\n float "+n+"() {\n return sampleTexture("+e+", halfCR);\n }\n ";var a=t.shapeInfo.texShape;return"\n float "+n+"() {\n vec2 uv = uvFromFlat("+a[0]+", "+a[1]+", "+Ni(e)+");\n return sampleTexture("+e+", uv);\n }\n "}(e);case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"\n float "+n+"(int index) {\n "+Ti(t)+"\n }\n ";var r=t.shapeInfo.texShape,i=r[0],o=r[1];if(1===o&&1===i)return"\n float "+n+"(int index) {\n return sampleTexture("+e+", halfCR);\n }\n ";var a=Ni(e);return 1===o?"\n float "+n+"(int index) {\n vec2 uv = vec2(0.5, (float(index + "+a+") + 0.5) / "+i+".0);\n return sampleTexture("+e+", uv);\n }\n ":1===i?"\n float "+n+"(int index) {\n vec2 uv = vec2((float(index + "+a+") + 0.5) / "+o+".0, 0.5);\n return sampleTexture("+e+", uv);\n }\n ":"\n float "+n+"(int index) {\n vec2 uv = uvFromFlat("+i+", "+o+", index + "+a+");\n return sampleTexture("+e+", uv);\n }\n "}(e);case 2:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=e.shapeInfo.texShape;if(null!=o&&E(n,o)){var a=o[0];return"\n float "+i+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+o[1]+".0, "+a+".0);\n return sampleTexture("+r+", uv);\n }\n "}var s=D(n),u=s.newShape,c=s.keptDims,l=u;if(l.length<n.length){var f=Di(e,l);return"\n "+t(f)+"\n float "+i+"(int row, int col) {\n return "+i+"("+ji(["row","col"],c)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+i+"(int row, int col) {\n int index = round(dot(vec2(row, col), vec2("+n[1]+", 1)));\n "+Ti(e)+"\n }\n ";var d=o[0],h=o[1],p=Ni(r);return 1===h?"\n float "+i+"(int row, int col) {\n float index = dot(vec3(row, col, "+p+"), vec3("+n[1]+", 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / "+d+".0);\n return sampleTexture("+r+", uv);\n }\n ":1===d?"\n float "+i+"(int row, int col) {\n float index = dot(vec3(row, col, "+p+"), vec3("+n[1]+", 1, 1));\n vec2 uv = vec2((index + 0.5) / "+h+".0, 0.5);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+i+"(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+n[1]+" + col + "+p+";\n vec2 uv = uvFromFlat("+d+", "+h+", index);\n return sampleTexture("+r+", uv);\n }\n"}(e);case 3:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=n[1]*n[2],a=n[2],s=D(n),u=s.newShape,c=s.keptDims,l=u;if(l.length<n.length){var f=Di(e,l);return"\n "+t(f)+"\n float "+i+"(int row, int col, int depth) {\n return "+i+"("+ji(["row","col","depth"],c)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+i+"(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3("+o+", "+a+", 1)));\n "+Ti(e)+"\n }\n ";var d=e.shapeInfo.texShape,h=d[0],p=d[1],m=e.shapeInfo.flatOffset;return p===o&&null==m?"\n float "+i+"(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2("+a+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+p+".0, "+h+".0);\n return sampleTexture("+r+", uv);\n }\n ":p===a&&null==m?"\n float "+i+"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2("+n[1]+", 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+p+".0, "+h+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+i+"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+o+" + col * "+a+" + depth + "+Ni(r)+";\n vec2 uv = uvFromFlat("+h+", "+p+", index);\n return sampleTexture("+r+", uv);\n }\n "}(e);case 4:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=n[3],a=n[2]*o,s=n[1]*a,u=D(n),c=u.newShape,l=u.keptDims;if(c.length<n.length){var f=Di(e,c);return"\n "+t(f)+"\n float "+i+"(int row, int col, int depth, int depth2) {\n return "+i+"("+ji(["row","col","depth","depth2"],l)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+i+"(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4("+s+", "+a+", "+o+", 1)));\n "+Ti(e)+"\n }\n ";var d=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,p=h[0],m=h[1];return m===s&&null==d?"\n float "+i+"(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3("+a+", "+o+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m+".0, "+p+".0);\n return sampleTexture("+r+", uv);\n }\n ":m===o&&null==d?"\n float "+i+"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3("+n[1]*n[2]+", "+n[2]+", 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m+".0, "+p+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+i+"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+s+" + col * "+a+" +\n depth * "+o+" + depth2;\n vec2 uv = uvFromFlat("+p+", "+m+", index + "+Ni(r)+");\n return sampleTexture("+r+", uv);\n }\n "}(e);case 5:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=n[4],a=n[3]*o,s=n[2]*a,u=n[1]*s,c=D(n),l=c.newShape,f=c.keptDims;if(l.length<n.length){var d=Di(e,l);return"\n "+t(d)+"\n float "+i+"(int row, int col, int depth, int depth2, int depth3) {\n return "+i+"("+ji(["row","col","depth","depth2","depth3"],f)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+i+"(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4("+u+", "+s+", "+a+", "+o+")) +\n depth3;\n "+Ti(e)+"\n }\n ";var h=e.shapeInfo.flatOffset,p=e.shapeInfo.texShape,m=p[0],g=p[1];return g===u&&null==h?"\n float "+i+"(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4("+s+", "+a+", "+o+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+g+".0, "+m+".0);\n return sampleTexture("+r+", uv);\n }\n ":g===o&&null==h?"\n float "+i+"(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4("+n[1]*n[2]*n[3]+",\n "+n[2]*n[3]+", "+n[3]+", 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+g+".0, "+m+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+i+"(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+u+" + col * "+s+" + depth * "+a+" +\n depth2 * "+o+" + depth3 + "+Ni(r)+";\n vec2 uv = uvFromFlat("+m+", "+g+", index);\n return sampleTexture("+r+", uv);\n }\n "}(e);case 6:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=D(n),a=o.newShape,s=o.keptDims;if(a.length<n.length){var u=Di(e,a);return"\n "+t(u)+"\n float "+i+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return "+i+"("+ji(["row","col","depth","depth2","depth3","depth4"],s)+");\n }\n "}var c=n[5],l=n[4]*c,f=n[3]*l,d=n[2]*f,h=n[1]*d;if(e.shapeInfo.isUniform)return"\n float "+i+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4("+h+", "+d+", "+f+", "+l+")) +\n dot(\n vec2(depth3, depth4),\n vec2("+c+", 1)));\n "+Ti(e)+"\n }\n ";var p=e.shapeInfo.flatOffset,m=e.shapeInfo.texShape,g=m[0],v=m[1];return v===h&&null==p?"\n float "+i+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4("+d+", "+f+", "+l+", "+c+")) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+v+".0, "+g+".0);\n return sampleTexture("+r+", uv);\n }\n ":v===c&&null==p?"\n float "+i+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4("+n[1]*n[2]*n[3]*n[4]+",\n "+n[2]*n[3]*n[4]+",\n "+n[3]*n[4]+",\n "+n[4]+")) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+v+".0, "+g+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+i+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+h+" + col * "+d+" + depth * "+f+" +\n depth2 * "+l+" + depth3 * "+c+" + depth4 + "+Ni(r)+";\n vec2 uv = uvFromFlat("+g+", "+v+", index);\n return sampleTexture("+r+", uv);\n }\n "}(e);default:throw new Error(n.length+"-D input sampling is not yet supported")}}(t);var i=t.shapeInfo.logicalShape,o=e.logicalShape;return i.length<=o.length&&(r+=n?function(t,e){var n,r,i=t.name,o=i.charAt(0).toUpperCase()+i.slice(1),a="get"+o+"AtOutCoords",s=t.shapeInfo.logicalShape.length,u=e.logicalShape.length,c=Gr(t.shapeInfo.logicalShape,e.logicalShape),l=Ii(u),f=u-s,d=["x","y","z","w","u","v"];n=0===s?"":u<2&&c.length>=1?"coords = 0;":c.map(function(t){return"coords."+d[t+f]+" = 0;"}).join("\n"),r=u<2&&s>0?"coords":t.shapeInfo.logicalShape.map(function(t,e){return"coords."+d[e+f]}).join(", ");var h="return outputValue;",p=1===S(t.shapeInfo.logicalShape),m=1===S(e.logicalShape);if(1!==s||p||m){if(p&&!m)h=1===u?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(c.length){var g=s-2,v=s-1;c.indexOf(g)>-1&&c.indexOf(v)>-1?h="return vec4(outputValue.x);":c.indexOf(g)>-1?h="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":c.indexOf(v)>-1&&(h="return vec4(outputValue.xx, outputValue.zz);")}}else h="\n return vec4(outputValue.xy, outputValue.xy);\n ";return"\n vec4 "+a+"() {\n "+l+" coords = getOutputCoords();\n "+n+"\n vec4 outputValue = get"+o+"("+r+");\n "+h+"\n }\n "}(t,e):function(t,e){var n=t.name,r=n.charAt(0).toUpperCase()+n.slice(1),i="get"+r+"AtOutCoords",o=e.texShape,a=t.shapeInfo.texShape,s=t.shapeInfo.logicalShape.length,u=e.logicalShape.length;if(!t.shapeInfo.isUniform&&s===u&&null==t.shapeInfo.flatOffset&&E(a,o))return"\n float "+i+"() {\n return sampleTexture("+n+", resultUV);\n }\n ";var c=Ii(u),l=Gr(t.shapeInfo.logicalShape,e.logicalShape),f=u-s,d=["x","y","z","w","u","v"];return"\n float "+i+"() {\n "+c+" coords = getOutputCoords();\n "+(0===s?"":u<2&&l.length>=1?"coords = 0;":l.map(function(t){return"coords."+d[t+f]+" = 0;"}).join("\n"))+"\n return get"+r+"("+(u<2&&s>0?"coords":t.shapeInfo.logicalShape.map(function(t,e){return"coords."+d[e+f]}).join(", "))+");\n }\n "}(t,e)),r}(t,e,r)}).join("\n"),c=e.texShape,l=_i(),f="\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return "+l.texture2D+"(textureSampler, uv).r;\n }\n ",d=function(t){return t.version+"\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n "+t.varyingFs+" vec2 resultUV;\n "+t.defineOutput+"\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n #define isnan(value) isnan_custom(value)\n "+t.defineSpecialNaN+"\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n\n "+t.defineSpecialInf+"\n "+t.defineRound+"\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n "+Oi+"\n "+Ai+"\n "+Ci+"\n "}(l);return e.isPacked?(o=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return 1===n[0]?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * "+n[1]+".0);\n }\n ":1===n[1]?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * "+n[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n return 2 * (resTexRC.x * "+n[1]+" + resTexRC.y);\n }\n "}(0,e);case 2:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(E(t,e))return"\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2("+n[0]+", "+n[1]+"));\n }\n ";var r=Math.ceil(t[1]/2);return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n int r = 2 * (index / "+r+");\n int c = imod(index, "+r+") * 2;\n\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=t,r=e,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],a=(o=Math.ceil(n[2]/2))*Math.ceil(n[1]/2),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+i[0]+", "+i[1]+"));\n int index = resTexRC.x * "+i[1]+" + resTexRC.y;\n\n int b = index / "+a+";\n index -= b * "+a+";\n\n int r = 2 * (index / "+o+");\n int c = imod(index, "+o+") * 2;\n\n return ivec3(b, r, c);\n }\n ";default:return function(t,e){for(var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],r=Math.ceil(t[t.length-1]/2),i=r*Math.ceil(t[t.length-2]/2),o=i,a="",s="b, r, c",u=2;u<t.length-1;u++)a="\n int b"+u+" = index / "+(o*=t[t.length-u-1])+";\n index -= b"+u+" * "+o+";\n "+a,s="b"+u+", "+s;return"\n ivec"+t.length+" getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n\n "+a+"\n\n int b = index / "+i+";\n index -= b * "+i+";\n\n int r = 2 * (index / "+r+");\n int c = imod(index, "+r+") * 2;\n\n return ivec"+t.length+"("+s+");\n }\n "}(t,e)}var n,r,i,o,a}(e.logicalShape,c),a="\n void setOutput(vec4 val) {\n "+l.output+" = val;\n }\n "):(o=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){return 1===e[0]?"\n int getOutputCoords() {\n return int(resultUV.x * "+e[1]+".0);\n }\n ":1===e[1]?"\n int getOutputCoords() {\n return int(resultUV.y * "+e[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n return resTexRC.x * "+e[1]+" + resTexRC.y;\n }\n "}(0,e);case 2:return function(t,e){return E(t,e)?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2("+e[0]+", "+e[1]+"));\n }\n ":1===t[1]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n return ivec2(index, 0);\n }\n ":1===t[0]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n int r = index / "+t[1]+";\n int c = index - r * "+t[1]+";\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=e,r=ki(["r","c","d"],t),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n "+r+"\n return ivec3(r, c, d);\n }\n ";case 4:return function(t,e){var n=ki(["r","c","d","d2"],t);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n "+n+"\n return ivec4(r, c, d, d2);\n }\n "}(t,e);case 5:return function(t,e){var n=ki(["r","c","d","d2","d3"],t);return"\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2("+e[0]+",\n "+e[1]+"));\n\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n "+n+"\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n "}(t,e);case 6:return function(t,e){var n=ki(["r","c","d","d2","d3","d4"],t);return"\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n "+n+"\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n "}(t,e);default:throw new Error(t.length+"-D output sampling is not yet supported")}var n,r}(e.logicalShape,c),a="\n void setOutput(float val) {\n "+l.output+" = vec4(val, 0, 0, 0);\n }\n "),r&&(d+=Mi),[d,f,a,s,o,u,n].join("\n")}(o,s,i,e.usesPackedTextures),c=t.createProgram(u),l=null,f=t.getUniformLocation(c,"NAN",!1);1===h.getNumber("WEBGL_VERSION")&&(l=t.getUniformLocation(c,"INFINITY",!1));for(var d={},p=0;p<e.variableNames.length;p++){var m=e.variableNames[p];d[m]=t.getUniformLocation(c,m,!1),d["offset"+m]=t.getUniformLocation(c,"offset"+m,!1)}return{program:e,source:u,webGLProgram:c,uniformLocations:d,inShapeInfos:a,outShapeInfo:s,infLoc:l,nanLoc:f}}(o.gpgpu,t,a,u)}),f=null!=this.activeTimers;return f&&(s=this.startTimer()),function(t,e,n,r,i){yo(e.inShapeInfos,n),yo([e.outShapeInfo],[r]);var o=r.texData.texture,a=r.texData.texShape;r.texData.isPacked?t.setOutputPackedMatrixTexture(o,a[0],a[1]):t.setOutputMatrixTexture(o,a[0],a[1]),t.setProgram(e.webGLProgram),1===h.getNumber("WEBGL_VERSION")&&null!==e.infLoc&&t.gl.uniform1f(e.infLoc,1/0),null!==e.nanLoc&&t.gl.uniform1f(e.nanLoc,NaN),n.forEach(function(n,r){var i=e.program.variableNames[r],o=e.uniformLocations[i],a=e.uniformLocations["offset"+i];if(null!=o)if(n.isUniform)if(S(n.shape)<2)t.gl.uniform1f(o,n.uniformValues[0]);else{var s=n.uniformValues;s instanceof Float32Array||(s=new Float32Array(s)),t.gl.uniform1fv(o,s)}else null!=n.texData.slice&&null!=a&&t.gl.uniform1i(a,n.texData.slice.flatOffset),t.setInputMatrixTexture(n.texData.texture,o,r)}),null!=i&&i(t,e.webGLProgram),t.executeProgram()}(this.gpgpu,l,a,u,r),f&&(s=this.endTimer(s),this.activeTimers.push({name:t.constructor.name,query:this.getQueryTime(s)})),!h.getBool("WEBGL_LAZILY_UNPACK")&&this.texData.get(n.dataId).isPacked&&!1===i?this.unpackTensor(n):n},t.prototype.getAndSaveBinary=function(t,e){return t in this.binaryCache||(this.binaryCache[t]=e()),this.binaryCache[t]},t.prototype.getTextureManager=function(){return this.textureManager},t.prototype.dispose=function(){this.disposed||(this.textureManager.dispose(),null!=this.canvas&&null!=this.canvas.remove?this.canvas.remove():this.canvas=null,null!=this.fromPixels2DContext&&null!=this.fromPixels2DContext.canvas.remove&&this.fromPixels2DContext.canvas.remove(),this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},t.prototype.floatPrecision=function(){var t=this;return null==this.floatPrecisionValue&&(this.floatPrecisionValue=Pe(function(){var e=h.getBool("DEBUG");h.set("DEBUG",!1);var n=t.abs(bn(1e-8)).dataSync()[0];return h.set("DEBUG",e),n>0?32:16})),this.floatPrecisionValue},t.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},t.prototype.uploadToGPU=function(t){var e,n=this.texData.get(t),r=n.shape,i=n.dtype,o=n.values,a=n.texture,s=n.usage,u=n.isPacked;if(null==a){var c,l=null!=this.activeTimers;l&&(c=performance.now());var f=n.texShape;if(null==f&&(f=ve(r,u),n.texShape=f),null!=o){var d=ge(r),h=void 0,p=f[1],m=f[0],g=o instanceof Uint8Array;u?(p=(e=Ji(f[0],f[1]))[0],h=new function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"];var r=_i(),i=e[0],o=e[1];this.outputShape=t;var a="",s="result";n&&(s="floor(result * 255. + 0.5)");for(var u=0;u<=1;u++)for(var c=0;c<=1;c++){var l=2*u+c;a+="\n localCoords = coords;\n if(localCoords[2] + "+c+" < "+t[2]+") {\n localCoords[2] += "+c+";\n if(localCoords[1] + "+u+" < "+t[1]+") {\n localCoords[1] += "+u+";\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n \n flatIndex /= 4;\n r = flatIndex / "+o+";\n c = imod(flatIndex, "+o+");\n uv = (vec2(c, r) + halfCR) / vec2("+o+".0, "+i+".0);\n values = "+r.texture2D+"(A, uv);\n\n if(offset == 0) {\n result["+l+"] = values[0];\n } else if(offset == 1) {\n result["+l+"] = values[1];\n } else if(offset == 2) {\n result["+l+"] = values[2];\n } else {\n result["+l+"] = values[3];\n }\n }\n }\n "}this.userCode="\n "+Si(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n \n "+a+"\n\n "+r.output+" = "+s+";\n }\n "}(d,[m=e[1],p],g)):h=new function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"];var r=_i(),i=e[0],o=e[1];this.outputShape=t;var a="result";n&&(a="floor(result * 255. + 0.5)"),this.userCode="\n "+Si(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n int flatIndex = getFlatIndex(coords);\n int offset = imod(flatIndex, 4);\n\n flatIndex /= 4;\n int r = flatIndex / "+o+";\n int c = imod(flatIndex, "+o+");\n vec2 uv = (vec2(c, r) + halfCR) / vec2("+o+".0, "+i+".0);\n vec4 values = "+r.texture2D+"(A, uv);\n\n float result;\n\n if(offset == 0) {\n result = values[0];\n } else if(offset == 1) {\n result = values[1];\n } else if(offset == 2) {\n result = values[2];\n } else {\n result = values[3];\n }\n\n "+r.output+" = vec4("+a+", 0., 0., 0.);\n }\n "}(d,[m,p],g);var v=this.makeTensorHandle([m,p],i);this.texData.get(v.dataId).usage=g?Vi.PIXELS:Vi.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(v.dataId),p,m,o);var b=this.makeTensorHandle(h.outputShape,v.dtype);b.size=S(h.outputShape),this.texData.get(b.dataId).isPacked=u,this.compileAndRun(h,[v],b);var y=this.texData.get(b.dataId);n.texture=y.texture,n.texShape=y.texShape,n.isPacked=y.isPacked,n.usage=y.usage,this.disposeData(v.dataId),this.texData.delete(b.dataId),n.values=null,l&&(this.uploadWaitMs+=performance.now()-c)}else{var w=this.acquireTexture(f,s,i,u);n.texture=w}}},t.prototype.convertAndCacheOnCPU=function(t,e){var n=this.texData.get(t),r=n.dtype;return this.releaseGPUData(t),null!=e&&(n.values=function(t,e){if("float32"===e||"complex64"===e)return t;if("int32"===e||"bool"===e){for(var n="int32"===e?new Int32Array(t.length):new Uint8Array(t.length),r=0;r<n.length;++r)n[r]=Math.round(t[r]);return n}throw new Error("Unknown dtype "+e)}(e,r)),n.values},t.prototype.acquireTexture=function(t,e,n,r){if(this.numBytesInGPU+=this.computeBytes(t,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var i=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+i+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(t,e,r)},t.prototype.computeBytes=function(t,e){return t[0]*t[1]*U(e)},t}();Dt()&&It.registerBackend("webgl",function(){return new zo},2);var Lo=dn({abs_:function(t){var e=Qe(t,"x","abs");return"complex64"===e.dtype?It.runKernel(function(t){return t.complexAbs(e)},{$x:e}):It.runKernel(function(t,n){var r=t.abs(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.toFloat().step(-1))}}})}}),Bo=dn({acos_:function(t){var e=Qe(t,"x","acos");return It.runKernel(function(t,n){var r=t.acos(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(bn(1).sub(n.toFloat().square()).sqrt()).neg()}}})}}),Uo=dn({acosh_:function(t){var e=Qe(t,"x","acosh");return It.runKernel(function(t,n){var r=t.acosh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(n.toFloat().square().sub(1).sqrt())}}})}}),Wo=dn({asin_:function(t){var e=Qe(t,"x","asin");return It.runKernel(function(t,n){var r=t.asin(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(bn(1).sub(n.toFloat().square()).sqrt())}}})}}),qo=dn({asinh_:function(t){var e=Qe(t,"x","asinh");return It.runKernel(function(t,n){var r=t.asinh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(bn(1).add(n.toFloat().square()).sqrt())}}})}}),Vo=dn({atan_:function(t){var e=Qe(t,"x","atan");return It.runKernel(function(t,n){var r=t.atan(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().square().add(1))}}})}}),Ho=dn({atanh_:function(t){var e=Qe(t,"x","atanh");return It.runKernel(function(t,n){var r=t.atanh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(bn(1).sub(n.toFloat().square()))}}})}}),$o=dn({ceil_:function(t){var e=Qe(t,"x","ceil");return It.runKernel(function(t){return t.ceil(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),Go=dn({clipByValue_:function(t,e,n){var r=Qe(t,"x","clipByValue");return w(e<=n,function(){return"Error in clip: min ("+e+") must be less than or equal to max ("+n+")."}),It.runKernel(function(t,i){var o=t.clip(r,e,n);return i([r]),o},{$x:r},function(t,r){var i=r[0];return{$x:function(){return t.where(i.greaterEqual(e).logicalAnd(i.lessEqual(n)),Tn(t))}}})}}),Ko=dn({cos_:function(t){var e=Qe(t,"x","cos");return It.runKernel(function(t,n){var r=t.cos(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().sin().neg().mul(t)}}})}}),Xo=dn({cosh_:function(t){var e=Qe(t,"x","cosh");return It.runKernel(function(t,n){var r=t.cosh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().sinh().mulStrict(t)}}})}}),Yo=dn({erf_:function(t){var e=Qe(t,"x","erf");return w("int32"===e.dtype||"float32"===e.dtype,function(){return"Input dtype must be `int32` or `float32`."}),"int32"===e.dtype&&(e=e.toFloat()),It.runKernel(function(t,n){var r=t.erf(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),Jo=dn({exp_:function(t){var e=Qe(t,"x","exp");return It.runKernel(function(t,n){var r=t.exp(e);return n([r]),r},{$x:e},function(t,e){return{$x:function(){return t.mulStrict(e[0])}}})}}),Zo=dn({expm1_:function(t){var e=Qe(t,"x","expm1");return It.runKernel(function(t,n){var r=t.expm1(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.exp())}}})}}),Qo=dn({floor_:function(t){var e=Qe(t,"x","floor");return It.runKernel(function(t){return t.floor(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),ta=dn({log_:function(t){var e=Qe(t,"x","log");return It.runKernel(function(t,n){var r=t.log(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat())}}})}}),ea=dn({log1p_:function(t){var e=Qe(t,"x","log1p");return It.runKernel(function(t,n){var r=t.log1p(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.add(1))}}})}}),na=dn({logSigmoid_:function(t){var e=Qe(t,"x","logSigmoid");return It.runKernel(function(t,n){var r=t.softplus(e.neg()).neg();return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.neg().sigmoid())}}})}}),ra=dn({neg_:function(t){var e=Qe(t,"x","neg");return It.runKernel(function(t){return t.neg(e)},{$x:e},function(t){return{$x:function(){return t.neg()}}})}}),ia=dn({reciprocal_:function(t){var e=Qe(t,"x","reciprocal");return It.runKernel(function(t,n){var r=t.reciprocal(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.square().neg())}}})}}),oa=dn({round_:function(t){var e=Qe(t,"x","round");return It.runKernel(function(t){return t.round(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),aa=dn({rsqrt_:function(t){var e=Qe(t,"x","rsqrt");return It.runKernel(function(t,n){var r=t.rsqrt(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.pow(1.5).mul(2)).neg()}}})}}),sa=dn({sigmoid_:function(t){var e=Qe(t,"x","sigmoid");return It.runKernel(function(t,n){var r=t.sigmoid(e);return n([r]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.mul(bn(1).sub(n)))}}})}}),ua=dn({sign_:function(t){var e=Qe(t,"x","sign");return It.runKernel(function(t){return t.sign(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),ca=dn({isNaN_:function(t){var e=Qe(t,"x","isNaN");return It.runKernel(function(t){return t.isNaN(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),la=dn({isInf_:function(t){var e=Qe(t,"x","isInf");return It.runKernel(function(t){return t.isInf(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),fa=dn({isFinite_:function(t){var e=Qe(t,"x","isFinite");return It.runKernel(function(t){return t.isFinite(e)},{$x:e},function(t){return{$x:function(){return Tn(t)}}})}}),da=dn({sin_:function(t){var e=Qe(t,"x","sin");return It.runKernel(function(t,n){var r=t.sin(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().cos().mul(t)}}})}}),ha=dn({sinh_:function(t){var e=Qe(t,"x","sinh");return It.runKernel(function(t,n){var r=t.sinh(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().cosh().mulStrict(t)}}})}}),pa=dn({softplus_:function(t){var e=Qe(t,"x","softplus");return It.runKernel(function(t,n){var r=t.softplus(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.sigmoid())}}})}}),ma=dn({sqrt_:function(t){var e=Qe(t,"x","sqrt");return It.runKernel(function(t,n){var r=t.sqrt(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().sqrt().mul(2))}}})}}),ga=dn({square_:function(t){var e=Qe(t,"x","square");return It.runKernel(function(t,n){return n([e]),t.square(e)},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.toFloat().mul(2))}}})}}),va=dn({step_:function(t,e){void 0===e&&(e=0);var n=Qe(t,"x","step");return It.runKernel(function(t){return t.step(n,e)},{$x:n},function(t){return{$x:function(){return Tn(t)}}})}}),ba=dn({tan_:function(t){var e=Qe(t,"x","tan");return It.runKernel(function(t,n){var r=t.tan(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.cos().square())}}})}}),ya=dn({tanh_:function(t){var e=Qe(t,"x","tanh");return It.runKernel(function(t,n){var r=t.tanh(e);return n([r]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return bn(1).sub(n.square()).mulStrict(t)}}})}});function wa(t,e,n,r,i,o){var a,s,u=Qe(t,"x","batchNorm"),c=Qe(e,"mean","batchNorm"),l=Qe(n,"variance","batchNorm");return null!=i&&(a=Qe(i,"scale","batchNorm")),null!=r&&(s=Qe(r,"offset","batchNorm")),w(2===u.rank,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),w(2===c.rank||1===c.rank,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+c.rank+"."}),w(2===l.rank||1===l.rank,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+l.rank+"."}),null!=a&&w(2===a.rank||1===a.rank,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+a.rank+"."}),null!=s&&w(2===s.rank||1===s.rank,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."}),ka(u,c,l,s,a,o)}function xa(t,e,n,r,i,o){var a,s,u=Qe(t,"x","batchNorm"),c=Qe(e,"mean","batchNorm"),l=Qe(n,"variance","batchNorm");return null!=i&&(a=Qe(i,"scale","batchNorm")),null!=r&&(s=Qe(r,"offset","batchNorm")),w(3===u.rank,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),w(3===c.rank||1===c.rank,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+c.rank+"."}),w(3===l.rank||1===l.rank,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+l.rank+"."}),null!=a&&w(3===a.rank||1===a.rank,function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+a.rank+"."}),null!=s&&w(3===s.rank||1===s.rank,function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."}),ka(u,c,l,s,a,o)}function _a(t,e,n,r,i,o){var a,s,u=Qe(t,"x","batchNorm"),c=Qe(e,"mean","batchNorm"),l=Qe(n,"variance","batchNorm");return null!=i&&(a=Qe(i,"scale","batchNorm")),null!=r&&(s=Qe(r,"offset","batchNorm")),w(4===u.rank,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."}),w(4===c.rank||1===c.rank,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+c.rank+"."}),w(4===l.rank||1===l.rank,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+l.rank+"."}),null!=a&&w(4===a.rank||1===a.rank,function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+a.rank+"."}),null!=s&&w(4===s.rank||1===s.rank,function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."}),ka(u,c,l,s,a,o)}function ka(t,e,n,r,i,o){null==o&&(o=.001);var a,s,u,c=Qe(t,"x","batchNorm"),l=Qe(e,"mean","batchNorm"),f=Qe(n,"variance","batchNorm");return null!=i&&(a=Qe(i,"scale","batchNorm")),null!=r&&(s=Qe(r,"offset","batchNorm")),w(l.rank===f.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),w(null==s||l.rank===s.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),w(null==a||l.rank===a.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}),u=0===c.rank||1===c.rank?c.as4D(1,1,1,c.size):2===c.rank?c.as4D(1,1,c.shape[0],c.shape[1]):3===c.rank?c.as4D(1,c.shape[0],c.shape[1],c.shape[2]):c,It.runKernel(function(t,e){var n=t.batchNormalization(u,Sa(l),Sa(f),o,Sa(a),Sa(s));return e([c,l,f,a]),n},{$x:c,$mean:l,$variance:f,$scale:a,$offset:s},function(t,e){var n=e,r=n[0],i=n[1],a=n[2],s=n[3],c=null==s?bn(1):s,l=Kr(i.shape,u.shape),f=[];if(1===i.rank){for(var d=0;d<u.shape.length-1;++d)f.push(u.shape[d]);f.push(1)}var h=r.sub(i),p=t.mul(c),m=aa(a.add(bn(o))),g=m.mul(m).mul(m).mul(bn(-.5));return{$x:function(){return 1===i.rank?t.mul(br(m.as4D(1,1,1,i.shape[0]),f)).mul(c).reshape(r.shape):t.mul(m).mul(c).reshape(r.shape)},$mean:function(){var t=m.mul(bn(-1)).mul(p);return 1===i.rank&&(t=t.sum(l)),t.reshape(i.shape)},$variance:function(){var t=g.mul(h).mul(p);return 1===i.rank&&(t=t.sum(l)),t.reshape(i.shape)},$scale:function(){var e=h.mul(m),n=t.mul(e);return 1===i.rank&&(n=n.sum(l)),n.reshape(i.shape)},$offset:function(){var e=t;return 1===i.rank&&(e=e.sum(l)),e.reshape(i.shape)}}}).reshape(c.shape)}function Sa(t){return null==t?null:0===t.rank?t.as1D():1===t.rank?t:2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}function Ea(){De("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var Oa=dn({batchNormalization2d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Ea(),wa(t,e,n,o,i,r)}}),Aa=dn({batchNormalization3d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Ea(),xa(t,e,n,o,i,r)}}),Ca=dn({batchNormalization4d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Ea(),_a(t,e,n,o,i,r)}}),Ma=dn({batchNormalization_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Ea(),ka(t,e,n,o,i,r)}}),Na=dn({batchNorm_:ka}),Ta=dn({batchNorm2d_:wa}),Ia=dn({batchNorm3d_:xa}),Da=dn({batchNorm4d_:_a});function ja(t,e,n,r,i,o){w(t.length===e.rank,function(){return"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match"});var a=t,s=e,u=!1;3===e.rank&&(u=!0,s=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]),a=[1,t[0],t[1],t[2]]);var c=a[3],l=s.shape[3];w(4===a.length,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+a.length+"."}),w(4===s.rank,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+s.rank}),w(4===n.rank,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank}),w(c===n.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+c+") must match input depth for filter "+n.shape[2]+"."}),w(l===n.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+l+") must match output depth for filter "+n.shape[3]+"."}),null!=o&&w(O(i),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+"."});var f=Jr(a,n.shape,r,1,i,o),d=It.runKernel(function(t,e){var r=t.conv2dDerInput(s,n,f);return e([n,s]),r},{dy4D:s,filter:n},function(t,e){var n=e[0],a=e[1];return{dy4D:function(){return za(t,n,r,i,"NHWC",1,o)},filter:function(){return Ba(t,a,n.shape,r,i,o)}}});return u?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}function Ra(t,e,n,r,i,o){var a=t;3===t.rank&&(a=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var s=e;3===s.rank&&(s=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),w(4===a.rank,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+a.shape+"."}),w(4===s.rank,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+s.shape+"."}),w(4===n.length,function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."}),w(a.shape[3]===n[2],function(){return"Error in conv2dDerFilter: depth of input "+a.shape[3]+") must match input depth in filter ("+n[2]+"."}),w(s.shape[3]===n[3],function(){return"Error in conv2dDerFilter: depth of dy ("+s.shape[3]+") must match output depth for filter ("+n[3]+")."}),null!=o&&w(O(i),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+"."});var u=Jr(a.shape,n,r,1,i,o);return It.runKernel(function(t){return t.conv2dDerFilter(a,s,u)},{x4D:a,dy4D:s})}function Fa(t){var e=function(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}(t),n=e[0],r=e[1],i=e[2];return 1===n&&1===r&&1===i}var Pa=dn({conv1d_:function(t,e,n,r,i,o,a){void 0===i&&(i="NWC"),void 0===o&&(o=1);var s=Qe(t,"x","conv1d"),u=Qe(e,"filter","conv1d"),c=s,l=!1;2===s.rank&&(l=!0,c=s.as3D(1,s.shape[0],s.shape[1])),w(3===c.rank,function(){return"Error in conv1d: input must be rank 3, but got rank "+c.rank+"."}),w(3===u.rank,function(){return"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."}),null!=a&&w(O(r),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."}),w(c.shape[2]===u.shape[1],function(){return"Error in conv1d: depth of input ("+c.shape[2]+") must match input depth for filter "+u.shape[1]+"."}),w(oi(n,o),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+o+"'"}),w("NWC"===i,function(){return"Error in conv1d: got dataFormat of "+i+" but only NWC is currently supported."});var f=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),d=c.as4D(c.shape[0],1,c.shape[1],c.shape[2]),h=za(d,f,[1,n],r,"NHWC",[1,o],a);return l?h.as2D(h.shape[2],h.shape[3]):h.as3D(h.shape[0],h.shape[2],h.shape[3])}}),za=dn({conv2d_:function(t,e,n,r,i,o,a){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1]);var s=Qe(t,"x","conv2d"),u=Qe(e,"filter","conv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),w(4===c.rank,function(){return"Error in conv2d: input must be rank 4, but got rank "+c.rank+"."}),w(4===u.rank,function(){return"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."}),null!=a&&w(O(r),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."}),w(c.shape[3]===u.shape[2],function(){return"Error in conv2d: depth of input ("+c.shape[3]+") must match input depth for filter "+u.shape[2]+"."}),w(oi(n,o),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"}),w("NHWC"===i,function(){return"Error in conv2d: got dataFormat of "+i+" but only NHWC is currently supported."});var f=Jr(c.shape,u.shape,n,o,r,a),d=It.runKernel(function(t,e){var n=t.conv2d(c,u,f);return e([u,c]),n},{x:c,$filter:u},function(t,e){var i=e,a=i[0],s=i[1];return w(ii(o),function(){return"Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+o+"'"}),{x:function(){return ja(s.shape,t,a,n,r)},$filter:function(){return Ra(s,t,a.shape,n,r)}}});return l?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}}),La=dn({conv3d_:function(t,e,n,r,i,o){void 0===i&&(i="NDHWC"),void 0===o&&(o=[1,1,1]);var a=Qe(t,"x","conv3d"),s=Qe(e,"filter","conv3d"),u=a,c=!1;4===a.rank&&(c=!0,u=a.as5D(1,a.shape[0],a.shape[1],a.shape[2],a.shape[3])),w(5===u.rank,function(){return"Error in conv3d: input must be rank 5, but got rank "+u.rank+"."}),w(5===s.rank,function(){return"Error in conv3d: filter must be rank 5, but got rank "+s.rank+"."}),w(u.shape[4]===s.shape[3],function(){return"Error in conv3d: depth of input ("+u.shape[4]+") must match input depth for filter "+s.shape[3]+"."}),w(function(t,e){return Fa(n)||Fa(e)}(0,o),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"}),w("NDHWC"===i,function(){return"Error in conv3d: got dataFormat of "+i+" but only NDHWC is currently supported."});var l=Zr(u.shape,s.shape,n,o,r),f=It.runKernel(function(t,e){var n=t.conv3d(u,s,l);return e([u,s]),n},{x:u,$filter:s},function(t,e){w(Fa(o),function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+o+"'"});var i=e[0],a=e[1];return{x:function(){return function(t,e,n,r,i){w(t.length===e.rank,function(){return"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match"});var o=t,a=e,s=!1;4===e.rank&&(s=!0,a=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]),o=[1,t[0],t[1],t[2],t[3]]);var u=o[4],c=a.shape[4];w(5===o.length,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+o.length+"."}),w(5===a.rank,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+a.rank}),w(5===n.rank,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+n.rank}),w(u===n.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+u+") must match input depth for filter "+n.shape[3]+"."}),w(c===n.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+c+") must match output depth for filter "+n.shape[4]+"."});var l=Zr(o,n.shape,r,1,i),f=It.runKernel(function(t){return t.conv3dDerInput(a,n,l)},{dy5D:a});return s?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}(i.shape,t,a,n,r)},$filter:function(){return function(t,e,n,r,i){var o=t;4===t.rank&&(o=t.as5D(1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]));var a=e;4===a.rank&&(a=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3])),w(5===o.rank,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+o.shape+"."}),w(5===a.rank,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+a.shape+"."}),w(5===n.length,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+n+"."}),w(o.shape[4]===n[3],function(){return"Error in conv3dDerFilter: depth of input "+o.shape[4]+") must match input depth in filter ("+n[3]+"."}),w(a.shape[4]===n[4],function(){return"Error in conv3dDerFilter: depth of dy ("+a.shape[4]+") must match output depth for filter ("+n[4]+")."});var s=Zr(o.shape,n,r,1,i);return It.runKernel(function(t){return t.conv3dDerFilter(o,a,s)},{x5D:o,dy5D:a})}(i,t,a.shape,n,r)}}});return c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),Ba=dn({conv2dDerFilter_:Ra}),Ua=dn({depthwiseConv2d_:function(t,e,n,r,i,o,a){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1]);var s=Qe(t,"x","depthwiseConv2d"),u=Qe(e,"filter","depthwiseConv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),w(4===c.rank,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+c.rank+"."}),w(4===u.rank,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."}),w(c.shape[3]===u.shape[2],function(){return"Error in depthwiseConv2d: number of input channels ("+c.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."}),null==o&&(o=[1,1]),w(oi(n,o),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"}),null!=a&&w(O(r),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."});var f=Jr(c.shape,u.shape,n,o,r,a,!0),d=It.runKernel(function(t,e){var n=t.depthwiseConv2D(c,u,f);return e([c,u]),n},{x:c,$filter:u},function(t,e){w(ii(o),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+o+"'"});var n=e[0],r=e[1];return{x:function(){return function(t,e,n,r){var i=e,o=!1;3===e.rank&&(o=!0,i=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var a=It.runKernel(function(t){return t.depthwiseConv2DDerInput(i,n,r)},{dy4D:i});return o?a.as3D(a.shape[1],a.shape[2],a.shape[3]):a}(n.shape,t,r,f)},$filter:function(){return function(t,e,n,r){var i=t;3===t.rank&&(i=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var o=e;return 3===o.rank&&(o=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),It.runKernel(function(t){return t.depthwiseConv2DDerFilter(i,o,r)},{x4D:i,dy4D:o})}(n,t,r.shape,f)}}});return l?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}}),Wa=dn({separableConv2d_:function(t,e,n,r,i,o,a){void 0===o&&(o=[1,1]),void 0===a&&(a="NHWC");var s=Qe(t,"x","separableConv2d"),u=Qe(e,"depthwiseFilter","separableConv2d"),c=Qe(n,"pointwiseFilter","separableConv2d"),l=s,f=!1;if(3===s.rank&&(f=!0,l=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),"NCHW"===a)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");w(4===l.rank,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+l.rank+"."}),w(4===u.rank,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."}),w(4===c.rank,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."}),w(1===c.shape[0],function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+c.shape[0]+"."}),w(1===c.shape[1],function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+c.shape[1]+"."});var d=u.shape[2],h=u.shape[3];w(c.shape[2]===d*h,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+d*h+", but got "+c.shape[2]+"."});var p=Ua(l,u,r,i,a,o),m=za(p,c,1,"valid",a);return f?m.as3D(m.shape[1],m.shape[2],m.shape[3]):m}}),qa=dn({conv2dTranspose_:function(t,e,n,r,i,o){return ja(n,Qe(t,"x","conv2dTranspose"),Qe(e,"filter","conv2dTranspose"),r,i,o)}}),Va=dn({matMul_:function(t,e,n,r){var i;void 0===n&&(n=!1),void 0===r&&(r=!1);var o=Qe(t,"a","matMul"),a=Qe(e,"b","matMul");i=Et(o,a),o=i[0],a=i[1];var s=n?o.shape[o.rank-2]:o.shape[o.rank-1],u=r?a.shape[a.rank-1]:a.shape[a.rank-2],c=n?o.shape[o.rank-1]:o.shape[o.rank-2],l=r?a.shape[a.rank-2]:a.shape[a.rank-1],f=o.shape.slice(0,-2),d=a.shape.slice(0,-2),h=S(f),p=S(d);w(o.rank>=2&&a.rank>=2&&o.rank===a.rank,function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+o.rank+" and "+a.rank+"."}),w(E(f,d),function(){return"Error in matMul: outer dimensions ("+f+") and ("+d+") of Tensors with shapes "+o.shape+" and "+a.shape+" must match."}),w(s===u,function(){return"Error in matMul: inner shapes ("+s+") and ("+u+") of Tensors with shapes "+o.shape+" and "+a.shape+" and transposeA="+n+" and transposeB="+r+" must match."});var m=o.shape.slice(0,-2).concat([c,l]),g=n?o.as3D(h,s,c):o.as3D(h,c,s),v=r?a.as3D(p,l,u):a.as3D(p,u,l);return It.runKernel(function(t,e){var i=t.batchMatMul(g,v,n,r);return e([g,v]),i},{$a:g,$b:v},function(t,e){var i=e,o=i[0],a=i[1];return n||r?!n&&r?{$a:function(){return t.matMul(a,!1,!1)},$b:function(){return t.matMul(o,!0,!1)}}:n&&!r?{$a:function(){return a.matMul(t,!1,!0)},$b:function(){return o.matMul(t,!1,!1)}}:{$a:function(){return a.matMul(t,!0,!0)},$b:function(){return t.matMul(o,!0,!0)}}:{$a:function(){return t.matMul(a,!1,!0)},$b:function(){return o.matMul(t,!0,!1)}}}).reshape(m)}}),Ha=dn({dot_:function(t,e){var n=Qe(t,"t1","dot"),r=Qe(e,"t2","dot");w(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+n.rank+" and "+r.rank+"."});var i=1===n.rank?n.size:n.shape[1],o=1===r.rank?r.size:r.shape[0];return w(i===o,function(){return"Error in dot: inner dimensions of inputs must match, but got "+i+" and "+o+"."}),1===n.rank&&1===r.rank?n.as2D(1,-1).matMul(r.as2D(-1,1)).asScalar():1===n.rank&&2===r.rank?n.as2D(1,-1).matMul(r.as2D(r.shape[0],r.shape[1])).as1D():2===n.rank&&1===r.rank?n.matMul(r.as2D(-1,1)).as1D():n.matMul(r.as2D(r.shape[0],r.shape[1]))}}),$a=dn({outerProduct_:function(t,e){var n=Qe(t,"v1","outerProduct"),r=Qe(e,"v2","outerProduct");return w(1===n.rank&&1===r.rank,function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+n.rank+" and "+r.rank+"."}),n.as2D(-1,1).matMul(r.as2D(1,-1))}}),Ga=dn({reverse_:function(t,e){var n=Qe(t,"x","reverse");if(0===n.rank)return n.clone();var r=I(e,n.shape);return It.runKernel(function(t){return t.reverse(n,r)},{$x:n},function(t){return{$x:function(){return t.reverse(r)}}}).reshapeAs(n)}}),Ka=dn({reverse1d_:function(t){var e=Qe(t,"x","reverse");return w(1===e.rank,function(){return"Error in reverse1D: x must be rank 1 but got rank "+e.rank+"."}),Ga(e,0)}}),Xa=dn({reverse2d_:function(t,e){var n=Qe(t,"x","reverse");return w(2===n.rank,function(){return"Error in reverse2D: x must be rank 2 but got rank "+n.rank+"."}),Ga(n,e)}}),Ya=dn({reverse3d_:function(t,e){var n=Qe(t,"x","reverse");return w(3===n.rank,function(){return"Error in reverse3D: x must be rank 3 but got rank "+n.rank+"."}),Ga(n,e)}}),Ja=dn({reverse4d_:function(t,e){var n=Qe(t,"x","reverse");return w(4===n.rank,function(){return"Error in reverse4D: x must be rank 4 but got rank "+n.rank+"."}),Ga(n,e)}});function Za(t,e,n,r,i,o){var a=Qe(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),null==r&&(r=[1,1]),w(4===s.rank,function(){return"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."}),w(oi(n,r),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'"}),null!=o&&w(O(i),function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+"."});var c=Yr(s.shape,e,n,r,i,o),l=It.runKernel(function(t,e){var n=t.maxPool(s,c);return e([s,n]),n},{x:s},function(t,o){var a=o[0],s=o[1];return{x:function(){return function(t,e,n,r,i,o,a,s){var u=Qe(t,"dy","maxPoolBackprop"),c=Qe(e,"input","maxPoolBackprop"),l=Qe(n,"output","maxPoolBackprop");w(c.rank===u.rank,function(){return"Rank of input ("+c.rank+") does not match rank of dy ("+u.rank+")"}),null==o&&(o=[1,1]),w(oi(i,o),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+o+"'"}),w(4===u.rank,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."}),w(4===c.rank,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+c.rank+"."});var f=Yr(c.shape,r,i,o,a,void 0);return It.runKernel(function(t){return t.maxPoolBackprop(u,c,l,f)},{$dy:u,$input:c})}(t,a,s,e,n,r,i)}}});return u?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}function Qa(t,e,n,r,i,o){var a=Qe(t,"x","avgPool","float32");null==r&&(r=[1,1]),w(oi(n,r),function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'"});var s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),w(4===s.rank,function(){return"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."}),null!=o&&w(O(i),function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+"."});var c=Yr(s.shape,e,n,r,i,o),l=It.runKernel(function(t){return t.avgPool(s,c)},{x:s},function(t){return{x:function(){return function(t,e,n,r,i,o){var a=Qe(t,"dy","avgPoolBackprop"),s=Qe(e,"input","avgPoolBackprop");w(s.rank===a.rank,function(){return"Rank of input ("+s.rank+") does not match rank of dy ("+a.rank+")"}),null==i&&(i=[1,1]),w(oi(r,i),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+i+"'"});var u=s,c=a,l=!1;3===s.rank&&(l=!0,u=s.as4D(1,s.shape[0],s.shape[1],s.shape[2]),c=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),w(4===c.rank,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+c.rank+"."}),w(4===u.rank,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+u.rank+"."});var f=Yr(u.shape,n,r,i,o),d=It.runKernel(function(t){return t.avgPoolBackprop(c,u,f)},{dy4D:c,input4D:u});return l?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}(t,s,e,n,r,i)}}});return l=l.cast(a.dtype),u?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}var ts=dn({maxPool_:function(t,e,n,r,i){return Za(t,e,n,1,r,i)}}),es=dn({avgPool_:function(t,e,n,r,i){return Qa(t,e,n,1,r,i)}}),ns=dn({pool_:function(t,e,n,r,i,o){null==i&&(i=[1,1]),null==o&&(o=1),0===r&&(r="valid");var a=Qe(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),w(oi(o,i),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+o+" and dilations '"+i+"'"});var c,l=Yr(s.shape,e,o,i,r),f=[l.dilationHeight,l.dilationWidth];c="same"===r?function(t,e){var n=t.map(function(t,n){return t+(t-1)*(e[n]-1)}).map(function(t){return t-1}),r=n.map(function(t){return Math.floor(t/2)}),i=n.map(function(t,e){return t-r[e]});return n.map(function(t,e){return[r[e],i[e]]})}([l.filterHeight,l.filterWidth],f):[[0,0],[0,0]];var d=1===f[0]&&1===f[1],h=function(t,e,n){var r=n.map(function(t){return t[0]}),i=n.map(function(t){return t[1]}),o=t.concat(r,i),a=e.map(function(t,e){return(t-o[e]%t)%t}),s=i.map(function(t,e){return t+a[e]});return[e.map(function(t,e){return[r[e],s[e]]}),e.map(function(t,e){return[0,a[e]]})]}([l.inHeight,l.inWidth],f,c),p=h[0],m=h[1],g=d?r:"valid",v=d?s:mr(s,f,p),b=("avg"===n?function(){return Qa(v,e,o,1,g)}:function(){return Za(v,e,o,1,g)})(),y=d?b:Jn(b,f,m);return u?y.as3D(y.shape[1],y.shape[2],y.shape[3]):y}}),rs=dn({slice_:function(t,e,n){var r,i,o=Qe(t,"x","slice");if(0===o.rank)throw new Error("Slicing scalar is not possible");r="number"==typeof e?[e].concat(new Array(o.rank-1).fill(0)):e.length<o.rank?e.concat(new Array(o.rank-e.length).fill(0)):e.slice(),i=(i=null==n?new Array(o.rank).fill(-1):"number"==typeof n?[n].concat(new Array(o.rank-1).fill(-1)):n.length<o.rank?n.concat(new Array(o.rank-n.length).fill(-1)):n).map(function(t,e){return t>=0?t:(w(-1===t,function(){return"Bad value in size"}),o.shape[e]-r[e])}),function(t,e,n){w(t.rank===e.length,function(){return"Error in slice"+t.rank+"D: Length of begin "+e+" must match the rank of the array ("+t.rank+")."}),w(t.rank===n.length,function(){return"Error in slice"+t.rank+"D: Length of size "+n+" must match the rank of the array ("+t.rank+")."});for(var r=function(r){w(e[r]+n[r]<=t.shape[r],function(){return"Error in slice"+t.rank+"D: begin["+r+"] + size["+r+"] ("+(e[r]+n[r])+") would overflow input.shape["+r+"] ("+t.shape[r]+")"})},i=0;i<t.rank;++i)r(i)}(o,r,i);var a=o.shape;return It.runKernel(function(t){return t.slice(o,r,i)},{$x:o},function(t){for(var e=[],n=0;n<t.rank;n++)e.push([r[n],a[n]-r[n]-i[n]]);return{$x:function(){return t.pad(e)}}})}}),is=dn({slice1d_:function(t,e,n){var r=Qe(t,"x","slice1d");return w(1===r.rank,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+r.rank+" tensor"}),rs(r,[e],[n])}}),os=dn({slice2d_:function(t,e,n){var r=Qe(t,"x","slice2d");return w(2===r.rank,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+r.rank+" tensor"}),rs(r,e,n)}}),as=dn({slice3d_:function(t,e,n){var r=Qe(t,"x","slice3d");return w(3===r.rank,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+r.rank+" tensor"}),rs(r,e,n)}}),ss=dn({slice4d_:function(t,e,n){var r=Qe(t,"x","slice4d");return w(4===r.rank,function(){return"slice4d expects a rank-4 tensor, but got a rank-"+r.rank+" tensor"}),rs(r,e,n)}});function us(t,e,n,r,i){return e.rank<n.rank&&(e=e.reshape(on(e.shape,r))),t.rank<n.rank&&(t=t.reshape(on(t.shape,r))),{$x:function(){var r=t.mul(n.equal(e).cast(t.dtype));return null==i?r:r.transpose(i)}}}var cs=dn({all_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","all","bool"),i=I(e,r.shape),o=i,a=sn(o,r.rank);null!=a&&(r=r.transpose(a),o=cn(o.length,r.rank));var s=It.runKernel(function(t){return t.all(r,o)},{$x:r});if(n){var u=on(s.shape,i);return s.reshape(u)}return s}}),ls=dn({any_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","any","bool"),i=I(e,r.shape),o=i,a=sn(o,r.rank);null!=a&&(r=r.transpose(a),o=cn(o.length,r.rank));var s=It.runKernel(function(t){return t.any(r,o)},{$x:r});if(n){var u=on(s.shape,i);return s.reshape(u)}return s}}),fs=dn({argMax_:function(t,e){void 0===e&&(e=0);var n=Qe(t,"x","argMax");null==e&&(e=0);var r=I(e,n.shape),i=sn(r,n.rank);return null!=i&&(n=n.transpose(i),r=cn(r.length,n.rank)),It.runKernel(function(t,e){var i=t.argMax(n,r[0]);return e([n]),i},{$x:n},function(t,e){var n=e[0];return{$x:function(){return Tn(n)}}})}}),ds=dn({argMin_:function(t,e){void 0===e&&(e=0);var n=Qe(t,"x","argMin");null==e&&(e=0);var r=I(e,n.shape),i=sn(r,n.rank);return null!=i&&(n=n.transpose(i),r=cn(r.length,n.rank)),It.runKernel(function(t,e){var i=t.argMin(n,r[0]);return e([n]),i},{$x:n},function(t,e){var n=e[0];return{$x:function(){return Tn(n)}}})}}),hs=dn({logSumExp_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","logSumExp"),i=I(e,r.shape),o=r.max(i,!0),a=r.sub(o).exp().sum(i).log(),s=o.reshape(a.shape).add(a);if(n){var u=on(s.shape,i);return s.reshape(u)}return s}}),ps=dn({max_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","max"),i=r,o=I(e,r.shape),a=o,s=sn(a,r.rank);null!=s&&(r=r.transpose(s),a=cn(a.length,r.rank));var u=It.runKernel(function(t,e){var n=t.max(r,a);return e([i,n]),n},{$x:r},function(t,e){return us(t,e[1],e[0],o,s)});if(n){var c=on(u.shape,o);u=u.reshape(c)}return u}}),ms=dn({mean_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","mean"),i=I(e,r.shape),o=S(rn(r.shape,i)[1]);return Ur(function(t){var r=bn(o);return{value:(r.dtype===t.dtype?t:t.cast(r.dtype)).div(r).sum(e,n),gradFunc:function(e){var n=t.shape.slice();return i.forEach(function(t){n[t]=1}),e.reshape(n).mul(En(t.shape,"float32")).div(o)}}})(r)}}),gs=dn({min_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","min"),i=r,o=I(e,r.shape),a=o,s=sn(a,r.rank);null!=s&&(r=r.transpose(s),a=cn(a.length,r.rank));var u=It.runKernel(function(t,e){var n=t.min(r,a);return e([i,n]),n},{$x:r},function(t,e){return us(t,e[1],e[0],o,s)});if(n){var c=on(u.shape,o);u=u.reshape(c)}return u}}),vs=dn({moments_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=I(e,(t=Qe(t,"x","moments")).shape),i=t.mean(r,n),o=i.shape;return n||(o=on(i.shape,r)),{mean:i,variance:t.toFloat().sub(i.reshape(o)).square().mean(r,n)}}}),bs=dn({sum_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","sum");"bool"===r.dtype&&(r=r.toInt());var i=I(e,r.shape);return Ur(function(t){var e=sn(i,t.rank),r=i,o=t;null!=e&&(o=t.transpose(e),r=cn(r.length,t.rank));var a=It.runKernel(function(t){return t.sum(o,r)},{permutedX:o});if(n){var s=on(a.shape,i);a=a.reshape(s)}return{value:a,gradFunc:function(e){var n=t.shape.slice();return i.forEach(function(t){n[t]=1}),e.reshape(n).mul(En(t.shape,"float32"))}}})(r)}}),ys=dn({prod_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Qe(t,"x","prod");"bool"===r.dtype&&(r=r.toInt());var i=I(e,r.shape),o=sn(i,r.rank),a=i,s=r;null!=o&&(s=r.transpose(o),a=cn(a.length,r.rank));var u=It.runKernel(function(t){return t.prod(s,a)},{permutedX:s});if(n){var c=on(u.shape,i);u=u.reshape(c)}return u}}),ws=dn({equal_:function(t,e){var n,r=Qe(t,"a","equal"),i=Qe(e,"b","equal");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t){return t.equal(r,i)},{$a:r,$b:i})}}),xs=dn({equalStrict_:function(t,e){var n=Qe(t,"a","equalStrict"),r=Qe(e,"b","equalStrict");return x(n.shape,r.shape,"Error in equalStrict: "),n.equal(r)}}),_s=dn({greater_:function(t,e){var n,r=Qe(t,"a","greater"),i=Qe(e,"b","greater");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t){return t.greater(r,i)},{$a:r,$b:i})}}),ks=dn({greaterEqual_:function(t,e){var n,r=Qe(t,"a","greaterEqual"),i=Qe(e,"b","greaterEqual");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t,e){var n=t.greaterEqual(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){return Tn(n)},$b:function(){return Tn(r)}}})}}),Ss=dn({greaterEqualStrict_:function(t,e){var n=Qe(t,"a","greaterEqualStrict"),r=Qe(e,"b","greaterEqualStrict");return x(n.shape,r.shape,"Error in greaterEqualStrict: "),n.greaterEqual(r)}}),Es=dn({greaterStrict_:function(t,e){var n=Qe(t,"a","greaterStrict"),r=Qe(e,"b","greaterStrict");return x(n.shape,r.shape,"Error in greaterStrict: "),n.greater(r)}}),Os=dn({less_:function(t,e){var n,r=Qe(t,"a","less"),i=Qe(e,"b","less");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t){return t.less(r,i)},{$a:r,$b:i})}}),As=dn({lessEqual_:function(t,e){var n,r=Qe(t,"a","lessEqual"),i=Qe(e,"b","lessEqual");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t){return t.lessEqual(r,i)},{$a:r,$b:i})}}),Cs=dn({lessEqualStrict_:function(t,e){var n=Qe(t,"a","lessEqualStrict"),r=Qe(e,"b","lessEqualStrict");return x(n.shape,r.shape,"Error in lessEqualStrict: "),n.lessEqual(r)}}),Ms=dn({lessStrict_:function(t,e){var n=Qe(t,"a","lessStrict"),r=Qe(e,"b","lessStrict");return x(n.shape,r.shape,"Error in lessStrict: "),n.less(r)}}),Ns=dn({notEqual_:function(t,e){var n,r=Qe(t,"a","notEqual"),i=Qe(e,"b","notEqual");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t){return t.notEqual(r,i)},{$a:r,$b:i})}}),Ts=dn({notEqualStrict_:function(t,e){var n=Qe(t,"a","notEqualStrict"),r=Qe(e,"b","notEqualStrict");return x(n.shape,r.shape,"Error in notEqualStrict: "),n.notEqual(r)}}),Is=dn({add_:function(t,e){var n,r=Qe(t,"a","add"),i=Qe(e,"b","add");n=Et(r,i),r=n[0],i=n[1];var o=Xr(r.shape,i.shape);return It.runKernel(function(t){return t.add(r,i)},{$a:r,$b:i},function(t){return{$a:function(){var e=t,n=Kr(r.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)},$b:function(){var e=t,n=Kr(i.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(i.shape)}}})}}),Ds=dn({addN_:function(t){w(Array.isArray(t),function(){return"The argument passed to tf.addN() must be a list of tensors"}),w(t.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+t.length});var e=t.map(function(t,e){return Qe(t,"tensors"+e,"addN")}),n=e[0];e.forEach(function(t){if(t.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),e.forEach(function(t){if(!E(t.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var r=e;return It.runKernel(function(t){return t.addN(e)},r,function(t){var n={};return e.forEach(function(e,r){n[r]=function(){return t.clone()}}),n})}}),js=dn({addStrict_:function(t,e){var n=Qe(t,"a","addStrict"),r=Qe(e,"b","addStrict");return x(n.shape,r.shape,"Error in addStrict: "),n.add(r)}}),Rs=dn({atan2_:function(t,e){var n,r=Qe(t,"a","atan2"),i=Qe(e,"b","atan2");n=Et(r,i),r=n[0],i=n[1];var o=Xr(r.shape,i.shape);return It.runKernel(function(t,e){var n=t.atan2(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=Is(n.square(),r.square()),i=t.mul(r.div(e)),a=Kr(n.shape,o);return a.length>0&&(i=i.sum(a)),i.reshape(n.shape)},$b:function(){var e=Is(n.square(),r.square()),i=ra(t.mul(n.div(e))),a=Kr(r.shape,o);return a.length>0&&(i=i.sum(a)),i.reshape(r.shape)}}})}}),Fs=dn({div_:function(t,e){var n,r=Qe(t,"a","div"),i=Qe(e,"b","div");if(n=Et(r,i),r=n[0],i=n[1],"int32"===r.dtype&&"int32"===i.dtype)return zs(r,i);var o=Xr(r.shape,i.shape);return It.runKernel(function(t,e){var n=t.realDivide(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=t.div(r.toFloat()),i=Kr(n.shape,o);return i.length>0?e.sum(i).reshape(n.shape):e},$b:function(){var e=t.mul(n.toFloat()),i=Kr(r.shape,o);i.length>0&&(e=e.sum(i).reshape(r.shape));var a=r.square();return e.div(a.toFloat()).neg()}}})}}),Ps=dn({divStrict_:function(t,e){var n=Qe(t,"a","div"),r=Qe(e,"b","div");return x(n.shape,r.shape,"Error in divideStrict: "),n.div(r)}}),zs=dn({floorDiv_:function(t,e){var n,r=Qe(t,"a","floorDiv"),i=Qe(e,"b","floorDiv");n=Et(r,i),r=n[0],i=n[1];var o=Xr(r.shape,i.shape);return It.runKernel(function(t,e){var n=t.floorDiv(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=t.div(r.toFloat()),i=Kr(n.shape,o);return i.length>0?e.sum(i).reshape(n.shape):e},$b:function(){var e=t.mul(n.toFloat()),i=Kr(r.shape,o);i.length>0&&(e=e.sum(i).reshape(r.shape));var a=r.square();return e.div(a.toFloat()).neg()}}})}}),Ls=dn({maximum_:function(t,e){var n,r=Qe(t,"a","maximum"),i=Qe(e,"b","maximum");return n=Et(r,i),r=n[0],i=n[1],"bool"===r.dtype&&(r=r.toInt(),i=i.toInt()),Xr(r.shape,i.shape),It.runKernel(function(t,e){var n=t.maximum(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){return t.mul(n.greaterEqual(r).toFloat())},$b:function(){return t.mul(n.less(r).toFloat())}}})}}),Bs=dn({maximumStrict_:function(t,e){var n=Qe(t,"a","maximumStrict"),r=Qe(e,"b","maximumStrict");return x(n.shape,r.shape,"Error in maximumStrict: "),n.maximum(r)}}),Us=dn({minimum_:function(t,e){var n,r=Qe(t,"a","minimum"),i=Qe(e,"b","minimum");return n=Et(r,i),r=n[0],i=n[1],"bool"===r.dtype&&(r=r.toInt(),i=i.toInt()),Xr(r.shape,i.shape),It.runKernel(function(t,e){var n=t.minimum(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){return t.mul(n.lessEqual(r).toFloat())},$b:function(){return t.mul(n.greater(r).toFloat())}}})}}),Ws=dn({minimumStrict_:function(t,e){var n=Qe(t,"a","minimumStrict"),r=Qe(e,"b","minimumStrict");return x(n.shape,r.shape,"Error in minimumStrict: "),n.minimum(r)}}),qs=dn({mod_:function(t,e){var n,r=Qe(t,"a","mod"),i=Qe(e,"b","mod");n=Et(r,i),r=n[0],i=n[1];var o=Xr(r.shape,i.shape);return It.runKernel(function(t,e){var n=t.mod(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=Kr(n.shape,o);return e.length>0?t.sum(e).reshape(n.shape):t},$b:function(){var e=t.mul(n.div(r).floor().neg()),i=Kr(r.shape,o);return i.length>0?e.sum(i).reshape(r.shape):e}}})}}),Vs=dn({modStrict_:function(t,e){var n=Qe(t,"a","modStrict"),r=Qe(e,"b","modStrict");return x(n.shape,r.shape,"Error in modStrict: "),n.mod(r)}}),Hs=dn({mul_:function(t,e){var n,r=Qe(t,"a","mul"),i=Qe(e,"b","mul");n=Et(r,i),r=n[0],i=n[1];var o=Xr(r.shape,i.shape);return It.runKernel(function(t,e){var n=t.multiply(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=t.mul(r.toFloat()),i=Kr(n.shape,o);return i.length>0?e.sum(i).reshape(n.shape):e},$b:function(){var e=t.mul(n.toFloat()),i=Kr(r.shape,o);return i.length>0?e.sum(i).reshape(r.shape):e}}})}}),$s=dn({mulStrict_:function(t,e){var n=Qe(t,"a","mul"),r=Qe(e,"b","mul");return x(n.shape,r.shape,"Error in multiplyStrict: "),n.mul(r)}}),Gs=dn({pow_:function(t,e){var n=Qe(t,"base","pow"),r=Qe(e,"exp","pow"),i=Xr(n.shape,r.shape);return t=n.cast(kt(n.dtype,r.dtype)),e=r.cast(kt(n.dtype,r.dtype)),It.runKernel(function(t,e){var i=t.pow(n,r);return e([n,r,i]),i},{$base:n,$exp:r},function(t,e){var n=e[0],r=e[1],o=e[2];return{$base:function(){var e=r.toFloat(),o=t.mul(e.mul(n.pow(e.sub(bn(1))))),a=Kr(n.shape,i);return a.length>0&&(o=o.sum(a)),o.reshape(n.shape)},$exp:function(){var e=n.greater(0),a=n.log().where(e,Tn(n)),s=t.mul(o.mul(a)),u=Kr(r.shape,i);return u.length>0&&(s=s.sum(u)),s.reshape(r.shape)}}})}}),Ks=dn({powStrict_:function(t,e){return x(t.shape,e.shape,"Error in powStrict: "),t.pow(e)}}),Xs=dn({squaredDifference_:function(t,e){var n,r=Qe(t,"a","squaredDifference"),i=Qe(e,"b","squaredDifference");return n=Et(r,i),r=n[0],i=n[1],Xr(r.shape,i.shape),It.runKernel(function(t,e){var n=t.squaredDifference(r,i);return e([r,i]),n},{$a:r,$b:i},function(t,e){var n=e[0],r=e[1],i=bn(2);return{$a:function(){return t.mul(n.sub(r).mul(i))},$b:function(){return t.mul(r.sub(n).mul(i))}}})}}),Ys=dn({squaredDifferenceStrict_:function(t,e){var n=Qe(t,"a","squaredDifferenceStrict"),r=Qe(e,"b","squaredDifferenceStrict");return x(n.shape,r.shape,"Error in squaredDifferenceStrict: "),n.squaredDifference(r)}}),Js=dn({sub_:function(t,e){var n,r=Qe(t,"a","sub"),i=Qe(e,"b","sub");n=Et(r,i),r=n[0],i=n[1];var o=Xr(r.shape,i.shape);return It.runKernel(function(t){return t.subtract(r,i)},{$a:r,$b:i},function(t){return{$a:function(){var e=t,n=Kr(r.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)},$b:function(){var e=t,n=Kr(i.shape,o);return n.length>0&&(e=e.sum(n)),e.neg().reshape(i.shape)}}})}}),Zs=dn({subStrict_:function(t,e){var n=Qe(t,"a","subStrict"),r=Qe(e,"b","subStrict");return x(n.shape,r.shape,"Error in subStrict: "),n.sub(r)}}),Qs=dn({logicalAnd_:function(t,e){var n=Qe(t,"a","logicalAnd","bool"),r=Qe(e,"b","logicalAnd","bool");return Xr(n.shape,r.shape),It.runKernel(function(t){return t.logicalAnd(n,r)},{$a:n,$b:r})}}),tu=dn({logicalNot_:function(t){var e=Qe(t,"x","logicalNot","bool");return It.runKernel(function(t){return t.logicalNot(e)},{$x:e})}}),eu=dn({logicalOr_:function(t,e){var n=Qe(t,"a","logicalOr","bool"),r=Qe(e,"b","logicalOr","bool");return Xr(n.shape,r.shape),It.runKernel(function(t){return t.logicalOr(n,r)},{$a:n,$b:r})}}),nu=dn({logicalXor_:function(t,e){var n=Qe(t,"a","logicalXor","bool"),r=Qe(e,"b","logicalXor","bool");return Xr(n.shape,r.shape),eu(t,e).logicalAnd(Qs(t,e).logicalNot())}}),ru=dn({where_:function(t,e,n){var r=Qe(e,"a","where"),i=Qe(n,"b","where"),o=Qe(t,"condition","where","bool");return x(r.shape,i.shape,"Error in where: "),1===o.rank?w(o.shape[0]===r.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):x(o.shape,i.shape,"Error in where: "),It.runKernel(function(t,e){var n=t.select(o,r,i);return e([o]),n},{$condition:o,$a:r,$b:i},function(t,e){var n=e[0];return{$condition:function(){return Tn(n).toFloat()},$a:function(){return t.mul(n.cast(t.dtype))},$b:function(){return t.mul(n.logicalNot().cast(t.dtype))}}})}}),iu=function(t){return c(this,void 0,void 0,function(){var e,n,r;return l(this,function(i){switch(i.label){case 0:return[4,(e=Qe(t,"condition","whereAsync","bool")).data()];case 1:return n=i.sent(),r=yi(e.shape,n),t!==e&&e.dispose(),[2,r]}})})},ou=dn({elu_:function(t){var e=Qe(t,"x","elu");return It.runKernel(function(t,n){var r=t.elu(e);return n([r]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return It.runKernel(function(e){return e.eluDer(t,n)},{dy:t,y:n})}}})}}),au=dn({leakyRelu_:function(t,e){void 0===e&&(e=.2);var n=Qe(t,"x","leakyRelu");return Ls(bn(e).mul(n),n)}}),su=dn({prelu_:function(t,e){var n=Qe(t,"x","prelu"),r=Qe(e,"alpha","prelu");return It.runKernel(function(t,e){var i=t.prelu(n,r);return e([n,r]),i},{$x:n,$alpha:r},function(t,e){var n=e[0],r=e[1],i=n.greater(0);return{$x:function(){return ru(i,t,t.mul(r))},$alpha:function(){var e=ru(i,Tn(t),t.mul(n)),o=Kr(r.shape,t.shape);return o.length>0&&(e=e.sum(o)),e.reshape(r.shape)}}})}}),uu=dn({relu_:function(t){var e=Qe(t,"x","relu");return"bool"===e.dtype?e.toInt():It.runKernel(function(t,n){var r=t.relu(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mulStrict(n.step().toFloat())}}})}}),cu=dn({selu_:function(t){var e=Qe(t,"x","selu");return It.runKernel(function(t,n){var r=t.selu(e);return n([e]),r},{$x:e},function(t,e){var n=e[0];return{$x:function(){var e=n.greater(bn(0)),r=bn(1.7580993408473768),i=bn(1.0507009873554805),o=t.mul(i),a=t.mul(r).mul(n.toFloat().exp());return ru(e,o,a)}}})}}),lu=dn({transpose_:function(t,e){var n=Qe(t,"x","transpose");return null==e&&(e=n.shape.map(function(t,e){return e}).reverse()),w(n.rank===e.length,function(){return"Error in transpose: rank of input "+n.rank+" must match length of perm "+e+"."}),e.forEach(function(t){w(t>=0&&t<n.rank,function(){return"All entries in 'perm' must be between 0 and "+(n.rank-1)+" but got "+e})}),n.rank<=1?n.clone():It.runKernel(function(t){return t.transpose(n,e)},{$x:n},function(t){var n=un(e);return{$x:function(){return t.transpose(n)}}})}}),fu=dn({localResponseNormalization_:function(t,e,n,r,i){void 0===e&&(e=5),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=.5);var o=Qe(t,"x","localResponseNormalization");w(4===o.rank||3===o.rank,function(){return"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank "+o.rank+"."}),w(O(e),function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+e+"."});var a=o,s=!1;3===o.rank&&(s=!0,a=o.as4D(1,o.shape[0],o.shape[1],o.shape[2]));var u=It.runKernel(function(t,o){var s=t.localResponseNormalization4D(a,e,n,r,i);return o([a,s]),s},{x4D:a},function(t,o){var a=o[0],s=o[1];return{x4D:function(){return It.runKernel(function(o){return o.LRNGrad(t,a,s,e,n,r,i)},{})}}});return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),du=dn({norm_:function(t,e,n,r){void 0===e&&(e="euclidean"),void 0===n&&(n=null),void 0===r&&(r=!1);var i=function t(e,n,r){if(void 0===r&&(r=null),0===e.rank)return e.abs();if(1!==e.rank&&null===r)return t(e.reshape([-1]),n,r);if(1===e.rank||"number"==typeof r||Array.isArray(r)&&1===r.length){if(1===n)return e.abs().sum(r);if(n===1/0)return e.abs().max(r);if(n===-1/0)return e.abs().min(r);if("euclidean"===n||2===n)return e.abs().pow(bn(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(Array.isArray(r)&&2===r.length){if(1===n)return e.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return e.abs().sum(r[1]).max(r[0]);if(n===-1/0)return e.abs().sum(r[1]).min(r[0]);if("fro"===n||"euclidean"===n)return e.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+r)}(t=Qe(t,"x","norm"),e,n),o=i.shape;if(r){var a=I(n,t.shape);o=on(i.shape,a)}return i.reshape(o)}});function hu(t,e){for(var n=[],r=t;r<e;++r)n.push(r);return n}function pu(t){for(var e=[],n=0;n<t.length;++n)for(var r=0;r<t[n].length;++r)e.push(t[n][r]);return e}var mu=dn({gather_:function(t,e,n){void 0===n&&(n=0);var r=Qe(t,"x","gather"),i=Qe(e,"indices","gather","int32");n=I(n,r.shape)[0];var o=function(t,e,n){for(var r=t.shape[n],i=[],o=1,a=1,s=0;s<n;s++)i.push(t.shape[s]),o*=t.shape[s];for(s=0;s<e.rank;s++)i.push(e.shape[s]);for(s=n+1;s<t.rank;s++)i.push(t.shape[s]),a*=t.shape[s];return{batchSize:o,sliceSize:a,dimSize:r,outputShape:i}}(r,i,n);return It.runKernel(function(t,e){var o=t.gather(r,i.flatten(),n);return e([i]),o},{$x:r},function(t,e){var i=e[0];return{$x:function(){var e=r.shape,o=i.size,a=e.slice(0,n),s=a.length,u=e.slice(n,e.length).slice(1),c=u.length,l=hu(0,s),f=hu(s+1,s+1+c),d=pu([a,[o],u]),h=t.reshape(d),p=i.reshape([o]),m=pu([[s],l,f]),g=h.transpose(m),v=gu(g,p,r.shape[n]),b=un(m);return v.transpose(b)}}}).reshape(o.outputShape)}}),gu=dn({unsortedSegmentSum_:function(t,e,n){var r=Qe(t,"x","unsortedSegmentSum"),i=Qe(e,"segmentIds","unsortedSegmentSum","int32");return w(O(n),function(){return"numSegments must be of dtype int"}),It.runKernel(function(t,e){var o=t.unsortedSegmentSum(r,i,n);return e([i]),o},{$x:r},function(t,e){var n=e[0];return{$x:function(){return function(t,e){for(var n=Ls(e,Tn(e)),r=mu(t,n),i=ks(e,bn(0,"int32")),o=r.rank-i.rank,a=0;a<o;++a)i=nr(i,a+1);i=Qs(i,En(r.shape,"bool"));var s=Tn(r);return ru(i,r,s)}(t,n)}}})}}),vu=dn({basicLSTMCell_:function(t,e,n,r,i,o){var a=Qe(t,"forgetBias","basicLSTMCell"),s=Qe(e,"lstmKernel","basicLSTMCell"),u=Qe(n,"lstmBias","basicLSTMCell"),c=Qe(r,"data","basicLSTMCell"),l=Qe(i,"c","basicLSTMCell"),f=Qe(o,"h","basicLSTMCell"),d=c.concat(f,1).matMul(s).add(u),h=d.shape[0],p=d.shape[1]/4,m=[h,p],g=d.slice([0,0],m),v=d.slice([0,p],m),b=d.slice([0,2*p],m),y=d.slice([0,3*p],m),w=g.sigmoid().mulStrict(v.tanh()).addStrict(l.mulStrict(a.add(b).sigmoid()));return[w,w.tanh().mulStrict(y.sigmoid())]}}),bu=dn({multiRNNCell_:function(t,e,n,r){for(var i=Qe(e,"data","multiRNNCell"),o=tn(n,"c","multiRNNCell"),a=tn(r,"h","multiRNNCell"),s=i,u=[],c=0;c<t.length;c++){var l=t[c](s,o[c],a[c]);u.push(l[0]),u.push(l[1]),s=l[1]}var f=[],d=[];for(c=0;c<u.length;c+=2)f.push(u[c]),d.push(u[c+1]);return[f,d]}}),yu=dn({movingAverage_:function(t,e,n,r,i){void 0===i&&(i=!0);var o=Qe(t,"v","movingAverage"),a=Qe(e,"x","movingAverage"),s=Qe(n,"decay","movingAverage");Ot(o,a),w(E(o.shape,a.shape),function(){return"Shape mismatch in v and x"});var u=bn(1),c=u.sub(s),l=a.sub(o).mul(c);if(i){w(null!=r,function(){return"When using zeroDebias: true, step is required."});var f=Qe(r,"step","movingAverage");l=l.div(u.sub(Gs(s,f)))}return o.add(l)}}),wu=dn({stridedSlice_:function(t,e,n,r,i,o,a,s,u){if(void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),0!==a)throw new Error("ellipsis mask is not yet supported");if(0!==s)throw new Error("new axis mask is not yet supported");var c=Qe(t,"x","stridedSlice");if(r.every(function(t){return 1===t})){var l=Tr(c.shape,e,n,r,i,o,a,s,u),f=l[0],d=l[1],h=l[2],p=d.filter(function(t,e){return-1===h.indexOf(e)});return rs(c,f,d).reshape(p)}return It.runKernel(function(t){return t.stridedSlice(c,e,n,r,i,o,a,s,u)},{$x:c})}}),xu=dn({topk_:function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!0);var r=Qe(t,"x","topk");if(0===r.rank)throw new Error("topk() expects the input to be of rank 1 or higher");var i=r.shape[r.shape.length-1];if(e>i)throw new Error("'k' passed to topk() must be <= the last dimension ("+i+") but got "+e);var o=It.runKernel(function(t){return t.topk(r,e,n)},{$x:r});return{values:o[0],indices:o[1]}}}),_u=dn({scatterND_:function(t,e,n){var r=Qe(t,"indices","scatterND","int32"),i=Qe(e,"updates","scatterND");return function(t,e,n){if(e.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if(t.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher, but the rank was "+t.rank+".");if("int32"!==e.dtype)throw new Error("The dtype of 'indices' should be int32, but got dtype: "+e.dtype);if(n.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: "+n);if(0===n.length){if(0===e.size)throw new Error("Indices specified for empty output. indices shape: "+e.shape);if(0===t.size)throw new Error("Updates specified for empty output. updates shape: "+t.shape)}!function(t,e,n){var r=e.rank>1?e.shape[e.rank-1]:1,i=e.rank>1?e.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+n.shape+", indices.shape: "+e.shape+", shape: "+t+", sliceDim: "+r+", and batchDim: "+i+".";if(n.rank<i)throw new Error(o+" update.rank < "+i+". ");if(t.length<r+(n.rank-i))throw new Error(o+" Output shape length < "+(r+(n.rank-i)));if(n.rank!==i+t.length-r)throw new Error(o+" update.rank != "+(i+t.length-r));for(var a=0;a<i;++a)if(n.shape[a]!==e.shape[a])throw new Error(o+" updates.shape["+a+"] ("+n.shape[a]+") != indices.shape["+a+"] ("+e.shape[a]+").");for(a=0;a<n.rank-i;++a)if(n.shape[a+i]!==t[a+r])throw new Error(o+" updates.shape["+(a+i)+"] ("+n.shape[a+i]+") != shape["+(a+i)+"] ("+t[a+i]+")")}(n,e,t)}(i,r,n),It.runKernel(function(t){return t.scatterND(r,i,n)},{$indices:r,$updates:i})}}),ku=dn({fft_:function(t){w("complex64"===t.dtype,function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+t.dtype+"."});var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return It.runKernel(function(t){return t.fft(r)},{input:t}).reshape(t.shape)}}),Su=dn({ifft_:function(t){w("complex64"===t.dtype,function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+t.dtype+"."});var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return It.runKernel(function(t){return t.ifft(r)},{input:t}).reshape(t.shape)}}),Eu=dn({rfft_:function(t,e){w("float32"===t.dtype,function(){return"The dtype for rfft() must be real value but got "+t.dtype});var n,r=t.shape[t.shape.length-1],i=t.size/r;if(null!=e&&e<r){var o=t.shape.map(function(t){return 0}),a=t.shape.map(function(t){return t});a[t.shape.length-1]=e,n=t.slice(o,a),r=e}else if(null!=e&&e>r){var s=t.shape.map(function(t){return t});s[t.shape.length-1]=e-r,n=t.concat(On(s),t.shape.length-1),r=e}else n=t;var u=n.zerosLike(),c=hn(n,u).as2D(i,r),l=ku(c),f=Math.floor(r/2)+1,d=pn(l),h=mn(l),p=d.split([f,r-f],d.shape.length-1),m=h.split([f,r-f],h.shape.length-1),g=n.shape.slice();return g[n.shape.length-1]=f,hn(p[0],m[0]).reshape(g)}}),Ou=dn({irfft_:function(t){var e=t.shape[t.shape.length-1],n=t.size/e;if(e<=2){var r=t.as2D(n,e),i=Su(r);return pn(i)}var o=[n,2*(e-1)],a=pn(t).as2D(n,e),s=mn(t).as2D(n,e),u=a.slice([0,1],[n,e-2]).reverse(1),c=s.slice([0,1],[n,e-2]).reverse(1).mul(bn(-1)),l=a.concat(u,1),f=s.concat(c,1);return r=hn(l,f).as2D(o[0],o[1]),i=Su(r),pn(i)}}),Au=Object.freeze({fft:ku,ifft:Su,rfft:Eu,irfft:Ou}),Cu=dn({sparseToDense_:function(t,e,n,r){void 0===r&&(r=0);var i=Qe(t,"sparseIndices","sparseToDense","int32"),o=Qe(e,"sparseValues","sparseToDense"),a=Qe(r,"defaultValue","sparseToDense",o.dtype);return function(t,e,n,r){if("int32"!==t.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+t.dtype+".");if(t.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+t.shape+".");var i=t.rank>0?t.shape[0]:1,o=t.rank>1?t.shape[1]:1;if(n.length!==o)throw new Error("outputShape has incorrect number of elements:, "+n.length+", should be: "+o+".");var a=e.size;if(0!==e.rank&&(1!==e.rank||a!==i))throw new Error("sparseValues has incorrect shape "+e.shape+", should be [] or ["+i+"]");if(e.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(i,o,n,a),It.runKernel(function(t){return t.sparseToDense(i,o,n,a)},{$sparseIndices:i,$sparseValues:o,$defaultValue:a})}}),Mu=dn({gatherND_:function(t,e){var n=Qe(e,"indices","gatherND","int32"),r=Qe(t,"x","gatherND");return It.runKernel(function(t){return t.gatherND(r,n)},{$x:r,$indices:n})}}),Nu=dn({dropout_:function(t,e,n,r){if(null!=n&&!E(t.shape,n))throw new Error("Non-default noise shape is not implemented yet: "+JSON.stringify(n));var i=hr(t.shape,0,1,"float32",r).greater(e);return i=i.div(Js(1,e)),t.mul(i)}});function Tu(t,e,n){for(var r=1-t%2,i=new Float32Array(t),o=0;o<t;++o){var a=2*Math.PI*o/(t+r-1);i[o]=e-n*Math.cos(a)}return yn(i,"float32")}var Iu,Du=dn({hannWindow_:function(t){return Tu(t,.5,.5)}}),ju=dn({hammingWindow_:function(t){return Tu(t,.54,.46)}}),Ru=dn({frame_:function(t,e,n,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);for(var o=0,a=[];o+e<=t.size;)a.push(rs(t,o,e)),o+=n;if(r){var s=o+e-t.size,u=In([rs(t,o,e-s),An([s],i)]);a.push(u)}return 0===a.length?wn([],[0,e]):In(a).as2D(a.length,e)}}),Fu=Object.freeze({hannWindow:Du,hammingWindow:ju,frame:Ru});!function(t){t[t.NONE=0]="NONE",t[t.MEAN=1]="MEAN",t[t.SUM=2]="SUM",t[t.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(Iu||(Iu={}));var Pu=dn({absoluteDifference_:function(t,e,n,r){void 0===r&&(r=Iu.SUM_BY_NONZERO_WEIGHTS);var i=Qe(t,"labels","absoluteDifference"),o=Qe(e,"predictions","absoluteDifference"),a=null;null!=n&&(a=Qe(n,"weights","absoluteDifference")),x(i.shape,o.shape,"Error in absoluteDifference: ");var s=i.sub(o).abs();return zu(s,a,r)}}),zu=dn({computeWeightedLoss_:function(t,e,n){void 0===n&&(n=Iu.SUM_BY_NONZERO_WEIGHTS);var r=Qe(t,"losses","computeWeightedLoss"),i=null;null!=e&&(i=Qe(e,"weights","computeWeightedLoss"));var o=null==i?r:r.mul(i);if(n===Iu.NONE)return o;if(n===Iu.SUM)return o.sum();if(n===Iu.MEAN){if(null==i)return o.mean();var a=r.size/i.size,s=o.sum().div(i.sum());return a>1?s.div(bn(a)):s}if(n===Iu.SUM_BY_NONZERO_WEIGHTS){if(null==i)return o.sum().div(bn(r.size));var u=i.mul(En(r.shape)).notEqual(bn(0)).sum().toFloat();return o.sum().div(u)}throw Error("Unknown reduction: "+n)}}),Lu=dn({cosineDistance_:function(t,e,n,r,i){void 0===i&&(i=Iu.SUM_BY_NONZERO_WEIGHTS);var o=Qe(t,"labels","cosineDistance"),a=Qe(e,"predictions","cosineDistance"),s=null;null!=r&&(s=Qe(r,"weights","cosineDistance")),x(o.shape,a.shape,"Error in cosineDistance: ");var u=bn(1).sub(o.mul(a).sum(n,!0));return zu(u,s,i)}}),Bu=dn({hingeLoss_:function(t,e,n,r){void 0===r&&(r=Iu.SUM_BY_NONZERO_WEIGHTS);var i=Qe(t,"labels","hingeLoss"),o=Qe(e,"predictions","hingeLoss"),a=null;null!=n&&(a=Qe(n,"weights","hingeLoss")),x(i.shape,o.shape,"Error in hingeLoss: ");var s=bn(1);i=bn(2).mul(i).sub(s);var u=s.sub(i.mul(o)).relu();return zu(u,a,r)}}),Uu=dn({huberLoss_:function(t,e,n,r,i){void 0===r&&(r=1),void 0===i&&(i=Iu.SUM_BY_NONZERO_WEIGHTS);var o=Qe(t,"labels","huberLoss"),a=Qe(e,"predictions","huberLoss"),s=null;null!=n&&(s=Qe(n,"weights","huberLoss")),x(o.shape,a.shape,"Error in huberLoss: ");var u=bn(r),c=a.sub(o).abs(),l=Us(c,u),f=c.sub(l),d=bn(.5).mul(l.square()).add(u.mul(f));return zu(d,s,i)}}),Wu=dn({logLoss_:function(t,e,n,r,i){void 0===r&&(r=1e-7),void 0===i&&(i=Iu.SUM_BY_NONZERO_WEIGHTS);var o=Qe(t,"labels","logLoss"),a=Qe(e,"predictions","logLoss"),s=null;null!=n&&(s=Qe(n,"weights","logLoss")),x(o.shape,a.shape,"Error in logLoss: ");var u=bn(1),c=bn(r),l=o.mul(a.add(c).log()).neg().sub(u.sub(o).mul(u.sub(a).add(c).log()));return zu(l,s,i)}}),qu=dn({meanSquaredError_:function(t,e,n,r){void 0===r&&(r=Iu.SUM_BY_NONZERO_WEIGHTS);var i=Qe(t,"labels","meanSquaredError"),o=Qe(e,"predictions","meanSquaredError"),a=null;null!=n&&(a=Qe(n,"weights","meanSquaredError")),x(i.shape,o.shape,"Error in meanSquaredError: ");var s=i.squaredDifference(o);return zu(s,a,r)}}),Vu=dn({sigmoidCrossEntropy_:function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=Iu.SUM_BY_NONZERO_WEIGHTS);var o=Qe(t,"multiClassLabels","sigmoidCrossEntropy"),a=Qe(e,"logits","sigmoidCrossEntropy"),s=null;if(null!=n&&(s=Qe(n,"weights","sigmoidCrossEntropy")),x(o.shape,a.shape,"Error in sigmoidCrossEntropy: "),r>0){var u=bn(r),c=bn(1),l=bn(.5);o=o.mul(c.sub(u)).add(l.mul(u))}var f=function(t,e){var n=Qe(t,"labels","sigmoidCrossEntropyWithLogits"),r=Qe(e,"logits","sigmoidCrossEntropyWithLogits");x(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var i=r.relu(),o=r.mul(n),a=r.abs().neg().exp().log1p();return i.sub(o).add(a)}(o,a);return zu(f,s,i)}}),Hu=dn({softmaxCrossEntropy_:function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=Iu.SUM_BY_NONZERO_WEIGHTS);var o=Qe(t,"onehotLabels","softmaxCrossEntropy"),a=Qe(e,"logits","softmaxCrossEntropy"),s=null;if(null!=n&&(s=Qe(n,"weights","softmaxCrossEntropy")),x(o.shape,a.shape,"Error in softmaxCrossEntropy: "),r>0){var u=bn(r),c=bn(1),l=bn(o.shape[1]);o=o.mul(c.sub(u)).add(u.div(l))}var f=function(t,e,n){if(void 0===n&&(n=-1),-1===n&&(n=e.rank-1),n!==e.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+e.rank+" and dim was "+n);return Ur(function(t,e,r){var i=e.logSumExp([n],!0),o=e.toFloat().sub(i);return r([t,o]),{value:o.mul(t).neg().sum([n]),gradFunc:function(t,e){var r=e[0],i=e[1],o=on(t.shape,[n]);return[t.reshape(o).mul(r.toFloat().sub(i.exp())),t.reshape(o).mul(i.exp().sub(r.toFloat()))]}}})(t,e)}(o,a);return zu(f,s,i)}}),$u=Object.freeze({get Reduction(){return Iu},absoluteDifference:Pu,computeWeightedLoss:zu,cosineDistance:Lu,hingeLoss:Bu,huberLoss:Uu,logLoss:Wu,meanSquaredError:qu,sigmoidCrossEntropy:Vu,softmaxCrossEntropy:Hu});function Gu(t,e){return void 0===e&&(e=!1),It.tidy(function(){if(2!==t.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+t.shape.length+"D Tensor.");for(var n=t.shape[0],r=t.shape[1],i=rr(n),o=t.clone(),a=wn([[1]],[1,1]),s=a.clone(),u=n>=r?r:n,c=function(t){var e,u=o,c=s,l=i;e=It.tidy(function(){var e=o.slice([t,t],[n-t,1]),u=e.norm(),c=o.slice([t,t],[1,1]),l=c.sign().neg(),f=c.sub(l.mul(u)),d=e.div(f);s=1===d.shape[0]?a.clone():a.concat(d.slice([1,0],[d.shape[0]-1,d.shape[1]]),0);var h=l.matMul(f).div(u).neg(),p=o.slice([t,0],[n-t,r]),m=h.mul(s);o=0===t?p.sub(m.matMul(s.transpose().matMul(p))):o.slice([0,0],[t,r]).concat(p.sub(m.matMul(s.transpose().matMul(p))),0);var g=i.slice([0,t],[n,i.shape[1]-t]);return i=0===t?g.sub(g.matMul(s).matMul(m.transpose())):i.slice([0,0],[n,t]).concat(g.sub(g.matMul(s).matMul(m.transpose())),1),[s,o,i]}),s=e[0],o=e[1],i=e[2],ze([u,c,l])},l=0;l<u;++l)c(l);return!e&&n>r&&(i=i.slice([0,0],[n,r]),o=o.slice([0,0],[r,r])),[i,o]})}var Ku=dn({gramSchmidt_:function(t){var e;if(Array.isArray(t)){e=!1,w(null!=t&&t.length>0,function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"});for(var n=t[0].shape[0],r=function(e){w(t[e].shape[0]===n,function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+t[e].shape[0]+" vs. "+n+")"})},i=1;i<t.length;++i)r(i)}else e=!0,t=Pn(t,t.shape[0],0).map(function(t){return gr(t,[0])});w(t.length<=t[0].shape[0],function(){return"Gram-Schmidt: Number of vectors ("+t.length+") exceeds number of dimensions ("+t[0].shape[0]+")."});var o=[],a=t,s=function(t){o.push(It.tidy(function(){var e=a[t];if(t>0)for(var n=0;n<t;++n){var r=bs(o[n].mulStrict(e)).mul(o[n]);e=e.sub(r)}return e.div(du(e,"euclidean"))}))};for(i=0;i<t.length;++i)s(i);return e?vr(o,0):o}}),Xu=dn({qr_:function(t,e){if(void 0===e&&(e=!1),t.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+t.rank);if(2===t.rank)return Gu(t,e);var n=t.shape.slice(0,t.shape.length-2).reduce(function(t,e){return t*e}),r=[],i=[];return wr(t.reshape([n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0).forEach(function(t){var n=Gu(t,e),o=n[0],a=n[1];r.push(o),i.push(a)}),[vr(r,0).reshape(t.shape),vr(i,0).reshape(t.shape)]}}),Yu=Object.freeze({gramSchmidt:Ku,qr:Xu});function Ju(t,e,n,r,i){null==r&&(r=.5),null==i&&(i=Number.NEGATIVE_INFINITY);var o=t.shape[0];return n=Math.min(n,o),w(0<=r&&r<=1,function(){return"iouThreshold must be in [0, 1], but was '"+r+"'"}),w(2===t.rank,function(){return"boxes must be a 2D tensor, but was of rank '"+t.rank+"'"}),w(4===t.shape[1],function(){return"boxes must have 4 columns, but 2nd dimension was "+t.shape[1]}),w(1===e.rank,function(){return"scores must be a 1D tensor"}),w(e.shape[0]===o,function(){return"scores has incompatible shape with boxes. Expected "+o+", but was "+e.shape[0]}),{maxOutputSize:n,iouThreshold:r,scoreThreshold:i}}var Zu=dn({resizeBilinear_:function(t,e,n){void 0===n&&(n=!1);var r=Qe(t,"images","resizeBilinear");w(3===r.rank||4===r.rank,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+r.rank+"."}),w(2===e.length,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+e+"."});var i=r,o=!1;3===r.rank&&(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=It.runKernel(function(t,e){return e([i]),t.resizeBilinear(i,a,s,n)},{batchImages:i},function(t,e){return{batchImages:function(){return It.runKernel(function(r){return r.resizeBilinearBackprop(t,e[0],n)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Qu=dn({resizeNearestNeighbor_:function(t,e,n){void 0===n&&(n=!1);var r=Qe(t,"images","resizeNearestNeighbor");w(3===r.rank||4===r.rank,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+r.rank+"."}),w(2===e.length,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+e+"."}),w("float32"===r.dtype||"int32"===r.dtype,function(){return"`images` must have `int32` or `float32` as dtype"});var i=r,o=!1;3===r.rank&&(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=It.runKernel(function(t,e){return e([i]),t.resizeNearestNeighbor(i,a,s,n)},{batchImages:i},function(t,e){return{batchImages:function(){return It.runKernel(function(r){return r.resizeNearestNeighborBackprop(t,e[0],n)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),tc=dn({nonMaxSuppression_:function(t,e,n,r,i){void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY);var o=Qe(t,"boxes","nonMaxSuppression"),a=Qe(e,"scores","nonMaxSuppression"),s=Ju(o,a,n,r,i);return n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold,It.runKernel(function(t){return t.nonMaxSuppression(o,a,n,r,i)},{$boxes:o})}}),ec=dn({cropAndResize_:function(t,e,n,r,i,o){var a=Qe(t,"image","cropAndResize","float32"),s=Qe(e,"boxes","cropAndResize","float32"),u=Qe(n,"boxInd","cropAndResize","int32");i=i||"bilinear",o=o||0;var c=s.shape[0];return w(4===a.rank,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+a.rank+"."}),w(2===s.rank&&4===s.shape[1],function(){return"Error in cropAndResize: boxes must be have size ["+c+",4] but had shape "+s.shape+"."}),w(1===u.rank&&u.shape[0]===c,function(){return"Error in cropAndResize: boxInd must be have size ["+c+"] but had shape "+s.shape+"."}),w(2===r.length,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."}),w(r[0]>=1&&r[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+r}),w("bilinear"===i||"nearest"===i,function(){return"method must be bilinear or nearest, but was "+i}),It.runKernel(function(t,e){return t.cropAndResize(a,s,u,r,i,o)},{$image:a,$boxes:s})}}),nc=Object.freeze({resizeBilinear:Zu,resizeNearestNeighbor:Qu,nonMaxSuppression:tc,nonMaxSuppressionAsync:function(t,e,n,r,i){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),c(this,void 0,void 0,function(){var o,a,s,u,c,f;return l(this,function(l){switch(l.label){case 0:return o=Qe(t,"boxes","nonMaxSuppressionAsync"),a=Qe(e,"scores","nonMaxSuppressionAsync"),s=Ju(o,a,n,r,i),n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold,[4,o.data()];case 1:return u=l.sent(),[4,a.data()];case 2:return c=l.sent(),f=pi(u,c,n,r,i),o!==t&&o.dispose(),a!==e&&a.dispose(),[2,f]}})})},cropAndResize:ec}),rc=dn({matMul_:function(t,e,n,r,i,o){var a;void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o="linear");var s=Qe(t,"a","fused matMul"),u=Qe(e,"b","fused matMul");a=Et(s,u),s=a[0],u=a[1];var c=n?s.shape[s.rank-2]:s.shape[s.rank-1],l=r?u.shape[u.rank-1]:u.shape[u.rank-2],f=n?s.shape[s.rank-1]:s.shape[s.rank-2],d=r?u.shape[u.rank-2]:u.shape[u.rank-1],h=s.shape.slice(0,-2),p=u.shape.slice(0,-2),m=S(h),g=S(p);w(s.rank>=2&&u.rank>=2&&s.rank===u.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+s.rank+" and "+u.rank+"."}),w(E(h,p),function(){return"Error in fused matMul: outer dimensions ("+h+") and ("+p+") of Tensors with shapes "+s.shape+" and "+u.shape+" must match."}),w(c===l,function(){return"Error in fused matMul: inner shapes ("+c+") and ("+l+") of Tensors with shapes "+s.shape+" and "+u.shape+" and transposeA="+n+" and transposeB="+r+" must match."});var v,b=s.shape.slice(0,-2).concat([f,d]),y=n?s.as3D(m,c,f):s.as3D(m,f,c),x=r?u.as3D(g,d,l):u.as3D(g,l,d);null!=i&&Xr(b,(v=Et(v=Qe(i,"bias","fused matMul"),s)[0]).shape);var _={$a:y,$b:x};return null!=i&&(_.$bias=v),It.runKernel(function(t,e){var i=t.fusedBatchMatMul(y,x,n,r,v,o);return e([y,x,i]),i},_,function(t,e){var a,s=e[0],u=e[1],c=e[2];if(null==o||"linear"===o)a=t;else{if("relu"!==o)throw new Error("Gradient for activation "+o+" has not been implemented yet.");a=t.mul(c.step())}var l={};return null!=i&&(l={$bias:function(){var t=a,e=Kr(v.shape,a.shape);return e.length>0&&(t=t.sum(e)),t.reshape(v.shape)}}),n||r?!n&&r?Object.assign({$a:function(){return a.matMul(u,!1,!1)},$b:function(){return a.matMul(s,!0,!1)}},l):n&&!r?Object.assign({$a:function(){return u.matMul(a,!1,!0)},$b:function(){return s.matMul(a,!1,!1)}},l):Object.assign({$a:function(){return u.matMul(a,!0,!0)},$b:function(){return a.matMul(s,!0,!0)}},l):Object.assign({$a:function(){return a.matMul(u,!1,!0)},$b:function(){return s.matMul(a,!0,!1)}},l)}).reshape(b)}}),ic=Object.freeze({matMul:rc}),oc=Object.freeze({image:nc,linalg:Yu,losses:$u,spectral:Au,fused:ic,signal:Fu,op:dn,batchNormalization2d:Oa,batchNormalization3d:Aa,batchNormalization4d:Ca,batchNormalization:Ma,batchNorm:Na,batchNorm2d:Ta,batchNorm3d:Ia,batchNorm4d:Da,complex:hn,real:pn,imag:mn,concat:In,concat1d:Dn,concat2d:jn,concat3d:Rn,concat4d:Fn,split:Pn,conv1d:Pa,conv2d:za,conv3d:La,conv2dDerFilter:Ba,depthwiseConv2d:Ua,separableConv2d:Wa,conv2dTranspose:qa,matMul:Va,dot:Ha,outerProduct:$a,reverse:Ga,reverse1d:Ka,reverse2d:Xa,reverse3d:Ya,reverse4d:Ja,maxPool:ts,avgPool:es,pool:ns,slice:rs,slice1d:is,slice2d:os,slice3d:as,slice4d:ss,abs:Lo,acos:Bo,acosh:Uo,asin:Wo,asinh:qo,atan:Vo,atanh:Ho,ceil:$o,clipByValue:Go,cos:Ko,cosh:Xo,erf:Yo,exp:Jo,expm1:Zo,floor:Qo,log:ta,log1p:ea,logSigmoid:na,neg:ra,reciprocal:ia,round:oa,rsqrt:aa,sigmoid:sa,sign:ua,isNaN:ca,isInf:la,isFinite:fa,sin:da,sinh:ha,softplus:pa,sqrt:ma,square:ga,step:va,tan:ba,tanh:ya,all:cs,any:ls,argMax:fs,argMin:ds,logSumExp:hs,max:ps,mean:ms,min:gs,moments:vs,sum:bs,prod:ys,equal:ws,equalStrict:xs,greater:_s,greaterEqual:ks,greaterEqualStrict:Ss,greaterStrict:Es,less:Os,lessEqual:As,lessEqualStrict:Cs,lessStrict:Ms,notEqual:Ns,notEqualStrict:Ts,add:Is,addN:Ds,addStrict:js,atan2:Rs,div:Fs,divStrict:Ps,floorDiv:zs,maximum:Ls,maximumStrict:Bs,minimum:Us,minimumStrict:Ws,mod:qs,modStrict:Vs,mul:Hs,mulStrict:$s,pow:Gs,powStrict:Ks,squaredDifference:Xs,squaredDifferenceStrict:Ys,sub:Js,subStrict:Zs,elu:ou,leakyRelu:au,prelu:su,relu:uu,selu:cu,logicalAnd:Qs,logicalNot:tu,logicalOr:eu,logicalXor:nu,where:ru,whereAsync:iu,buffer:Xn,print:Yn,batchToSpaceND:Jn,cast:Zn,clone:Qn,cumsum:tr,depthToSpace:er,expandDims:nr,eye:rr,multinomial:ir,oneHot:or,pad:ar,pad1d:sr,pad2d:ur,pad3d:cr,pad4d:lr,rand:fr,randomNormal:dr,randomUniform:hr,reshape:pr,spaceToBatchND:mr,squeeze:gr,stack:vr,tile:br,truncatedNormal:yr,unstack:wr,setdiff1dAsync:xr,fill:An,linspace:Cn,ones:En,range:Mn,scalar:bn,tensor:gn,tensor1d:yn,tensor2d:wn,tensor3d:xn,tensor4d:_n,tensor5d:kn,tensor6d:Sn,zeros:On,onesLike:Nn,zerosLike:Tn,transpose:lu,softmax:qr,logSoftmax:Vr,localResponseNormalization:fu,norm:du,gather:mu,unsortedSegmentSum:gu,basicLSTMCell:vu,multiRNNCell:bu,movingAverage:yu,stridedSlice:wu,topk:xu,scatterND:_u,fft:ku,ifft:Su,rfft:Eu,irfft:Ou,sparseToDense:Cu,gatherND:Mu,dropout:Nu,hannWindow:Du,hammingWindow:ju,frame:Ru}),ac=function(){function t(){if(this.blockSize=48,this.firstUse=!0,h.get("IS_BROWSER")){var t=function(){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(300,150);if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}();this.fromPixels2DContext=t.getContext("2d")}this.data=new Hr(this,It)}return t.prototype.register=function(t,e,n){if(this.firstUse&&(this.firstUse=!1,h.get("IS_NODE")&&Ye("\n============================\nHi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.\n============================\n")),this.data.has(t))throw new Error("Data buffer is already registered");this.data.set(t,{dtype:n})},t.prototype.write=function(t,e){if(null==e)throw new Error("MathBackendCPU.write(): values can not be null");this.data.get(t).values=e},t.prototype.fromPixels=function(t,e){if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n,r;if(h.get("IS_NODE")&&null==t.getContext)throw new Error("When running in node, pixels must be an HTMLCanvasElement like the one returned by the `canvas` npm package");if(null!=t.getContext)n=t.getContext("2d").getImageData(0,0,t.width,t.height).data;else if(t instanceof ImageData||t.data instanceof Uint8Array)n=t.data;else{if(!(t instanceof HTMLImageElement||t instanceof HTMLVideoElement))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData or {data: Uint32Array, width: number, height: number}, but was "+t.constructor.name);if(null==this.fromPixels2DContext)throw new Error("Can't read pixels from HTMLImageElement outside the browser.");this.fromPixels2DContext.canvas.width=t.width,this.fromPixels2DContext.canvas.height=t.height,this.fromPixels2DContext.drawImage(t,0,0,t.width,t.height),n=this.fromPixels2DContext.getImageData(0,0,t.width,t.height).data}if(4===e)r=new Int32Array(n);else{var i=t.width*t.height;r=new Int32Array(i*e);for(var o=0;o<i;o++)for(var a=0;a<e;++a)r[o*e+a]=n[4*o+a]}return xn(r,[t.height,t.width,e],"int32")},t.prototype.read=function(t){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.readSync(t)]})})},t.prototype.readSync=function(t){var e=this.data.get(t),n=e.dtype,r=e.complexTensors;return"complex64"===n?li(this.readSync(r.real.dataId),this.readSync(r.imag.dataId)):this.data.get(t).values},t.prototype.bufferSync=function(t){return Xn(t.shape,t.dtype,this.readSync(t.dataId))},t.prototype.disposeData=function(t){if(this.data.has(t)){var e=this.data.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.data.delete(t)}},t.prototype.time=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){return e=tt(),t(),[2,{kernelMs:tt()-e}]})})},t.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},t.prototype.complex=function(t,e){var n=pt.make(t.shape,{},"complex64");return this.data.get(n.dataId).complexTensors={real:It.keep(t.clone()),imag:It.keep(e.clone())},n},t.prototype.real=function(t){return this.data.get(t.dataId).complexTensors.real.clone()},t.prototype.imag=function(t){return this.data.get(t.dataId).complexTensors.imag.clone()},t.prototype.assertNotComplex=function(t,e){Array.isArray(t)||(t=[t]),t.forEach(function(t){null!=t&&w("complex64"!==t.dtype,function(){return e+" does not support complex64 tensors."})})},t.prototype.slice=function(t,e,n){if(this.assertNotComplex(t,"slice"),jr(t.shape,e,n)){var r=Rr(e,t.strides),i=S(n);return gn(this.readSync(t.dataId).subarray(r,r+i),n,t.dtype)}for(var o=Xn(n,t.dtype),a=this.bufferSync(t),s=0;s<o.size;++s){var u=o.indexToLoc(s).map(function(t,n){return t+e[n]});o.values[s]=a.get.apply(a,u)}return o.toTensor()},t.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){this.assertNotComplex(t,"stridedSlice");var c=Tr(t.shape,e,n,r,i,o,a,s,u),l=c[0],f=c[1],d=c[2],h=f.filter(function(t,e){return-1===d.indexOf(e)});if(h.some(function(t){return 0===t}))return gn([],h);for(var p=Xn(f,t.dtype),m=this.bufferSync(t),g=0;g<p.size;g++){for(var v=p.indexToLoc(g),b=new Array(v.length),y=0;y<b.length;y++)b[y]=v[y]*r[y]+l[y];p.set.apply(p,[m.get.apply(m,b)].concat(v))}return p.toTensor().reshape(h)},t.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o<t.rank;o++)o!==e&&(r[i++]=t.shape[o]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(o=0;o<u.length;o++)a[e]=o,u[o]=this.slice(t,a,s).reshape(r);return u},t.prototype.reverse=function(t,e){this.assertNotComplex(t,"reverse");for(var n=Xn(t.shape,t.dtype),r=this.bufferSync(t),i=function(i){var o=n.indexToLoc(i),a=o.slice();e.forEach(function(e){return a[e]=t.shape[e]-1-a[e]}),n.set.apply(n,[r.get.apply(r,a)].concat(o))},o=0;o<n.size;o++)i(o);return n.toTensor()},t.prototype.concat=function(t,e){var n=this;this.assertNotComplex(t,"concat");var r=t.map(function(t){var n=S(t.shape.slice(e));return t.as2D(-1,n)}),i=fn(r.map(function(t){return t.shape}),1),o=Xn(i,t[0].dtype).values;if(1===r[0].shape[0]){var a=0;r.forEach(function(t){o.set(n.readSync(t.dataId),a),a+=t.size})}else{var s=0;r.forEach(function(t){for(var e=n.readSync(t.dataId),r=0,a=0;a<t.shape[0];++a)for(var u=a*i[1]+s,c=0;c<t.shape[1];++c)o[u+c]=e[r++];s+=t.shape[1]})}var u=fn(t.map(function(t){return t.shape}),e);return gn(o,u,t[0].dtype)},t.prototype.neg=function(t){return this.assertNotComplex(t,"neg"),this.multiply(bn(-1),t)},t.prototype.add=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,r){return{real:t+n,imag:e+r}}):this.broadcastedBinaryOp(t,e,kt(t.dtype,e.dtype),function(t,e){return t+e})},t.prototype.addN=function(t){var e=this;this.assertNotComplex(t,"addN");for(var n=t.map(function(t){return e.readSync(t.dataId)}),r=Xn(t[0].shape,t[0].dtype),i=r.values,o=0;o<t.length;o++)for(var a=n[o],s=0;s<i.length;s++)i[s]+=a[s];return r.toTensor()},t.prototype.subtract=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,r){return{real:t-n,imag:e-r}}):this.broadcastedBinaryOp(t,e,kt(t.dtype,e.dtype),function(t,e){return t-e})},t.prototype.pow=function(t,e){return this.assertNotComplex([t,e],"pow"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.pow(t,e)})},t.prototype.batchMatMul=function(t,e,n,r){this.assertNotComplex([t,e],"matMul");for(var i=n?t.shape[1]:t.shape[2],o=n?t.shape[2]:t.shape[1],a=r?e.shape[1]:e.shape[2],s=t.shape[0],u=this.readSync(t.dataId),c=this.readSync(e.dataId),l=n?[t.strides[0],1,t.strides[1]]:[t.strides[0],t.strides[1],1],f=l[0],d=l[1],h=l[2],p=r?[1,e.strides[1],e.strides[0]]:[e.strides[1],1,e.strides[0]],m=p[0],g=p[1],v=p[2],b=o*a,y=Xn([s,o,a],t.dtype),w=y.values,x=this.blockSize,_=0;_<s;_++)for(var k=0;k<o;k+=x)for(var S=0;S<a;S+=x)for(var E=0;E<i;E+=x)for(var O=Math.min(k+x,o),A=Math.min(S+x,a),C=Math.min(E+x,i),M=k;M<O;M++)for(var N=S;N<A;N++){for(var T=0,I=E;I<C;I++)T+=u[_*f+M*d+I*h]*c[I*m+N*g+_*v];w[_*b+(M*a+N)]+=T}return y.toTensor()},t.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){var a=this.batchMatMul(t,e,n,r);return i&&(a=this.add(a,i)),o&&(a=function(t,e,n){if("linear"===e)return t.linear(n);if("relu"===e)return t.relu(n);throw new Error("Activation "+e+" has not been implemented for the CPU backend.")}(this,o,a)),a},t.prototype.multiply=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,r){return{real:t*n-e*r,imag:t*r+e*n}}):this.broadcastedBinaryOp(t,e,kt(t.dtype,e.dtype),function(t,e){return t*e})},t.prototype.realDivide=function(t,e){return this.assertNotComplex([t,e],"realDivide"),this.broadcastedBinaryOp(t,e,"float32",function(t,e){return t/e})},t.prototype.floorDiv=function(t,e){return this.assertNotComplex([t,e],"floorDiv"),this.broadcastedBinaryOp(t,e,"int32",function(t,e){return Math.floor(t/e)})},t.prototype.sum=function(t,e){this.assertNotComplex(t,"sum"),an("sum",e,t.rank);for(var n=rn(t.shape,e),r=n[0],i=n[1],o=On(r,kt(t.dtype,"int32")),a=S(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=0,d=0;d<a;++d)f+=u[l+d];s[c]=f}return o},t.prototype.prod=function(t,e){this.assertNotComplex(t,"sum");for(var n=rn(t.shape,e),r=n[0],i=n[1],o=On(r,kt(t.dtype,"int32")),a=S(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=1,d=0;d<a;++d)f*=u[l+d];s[c]=f}return o},t.prototype.unsortedSegmentSum=function(t,e,n){this.assertNotComplex(t,"unsortedSegmentSum");for(var r=[],i=t.rank-e.rank,o=0;o<i;++o)e=e.expandDims(o+1);for(o=0;o<n;++o){var a=bn(o,"int32"),s=ws(a,e).asType("float32").mul(t).sum(0);r.push(s)}return vr(r)},t.prototype.argMin=function(t,e){this.assertNotComplex(t,"argMin");var n=[e];an("argMin",n,t.rank);for(var r=rn(t.shape,n),i=r[0],o=r[1],a=On(i,"int32"),s=S(o),u=this.readSync(a.dataId),c=this.readSync(t.dataId),l=0;l<u.length;++l){for(var f=l*s,d=c[f],h=0,p=0;p<s;++p){var m=c[f+p];m<d&&(d=m,h=p)}u[l]=h}return a},t.prototype.argMax=function(t,e){this.assertNotComplex(t,"argMax");var n=[e];an("argMax",n,t.rank);for(var r=rn(t.shape,n),i=r[0],o=r[1],a=On(i,"int32"),s=S(o),u=this.readSync(a.dataId),c=this.readSync(t.dataId),l=0;l<u.length;++l){for(var f=l*s,d=c[f],h=0,p=0;p<s;++p){var m=c[f+p];m>d&&(d=m,h=p)}u[l]=h}return a},t.prototype.cumsum=function(t,e,n,r){if(this.assertNotComplex(t,"cumsum"),e!==t.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(t.rank-1)+" but got axis="+e);for(var i=kt(t.dtype,"int32"),o=On(t.shape,i),a=this.readSync(o.dataId),s=this.readSync(t.dataId),u=t.shape[t.rank-1],c=r?function(t,e){return t+u-e-1}:function(t,e){return t+e},l=0;l<s.length;l+=u)for(var f=0;f<u;f++){var d=c(l,f);if(0===f)a[d]=n?0:s[d];else{var h=c(l,f-1);a[d]=n?s[h]+a[h]:s[d]+a[h]}}return o},t.prototype.equal=function(t,e){return this.assertNotComplex([t,e],"equal"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t===e?1:0})},t.prototype.notEqual=function(t,e){return this.assertNotComplex([t,e],"notEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t!==e?1:0})},t.prototype.less=function(t,e){return this.assertNotComplex([t,e],"less"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t<e?1:0})},t.prototype.lessEqual=function(t,e){return this.assertNotComplex([t,e],"lessEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t<=e?1:0})},t.prototype.greater=function(t,e){return this.assertNotComplex([t,e],"greater"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t>e?1:0})},t.prototype.greaterEqual=function(t,e){return this.assertNotComplex([t,e],"greaterEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t>=e?1:0})},t.prototype.logicalNot=function(t){this.assertNotComplex(t,"logicalNot");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e[r]?0:1;return pt.make(t.shape,{values:n},"bool")},t.prototype.logicalAnd=function(t,e){return this.assertNotComplex([t,e],"logicalAnd"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t&&e})},t.prototype.logicalOr=function(t,e){return this.assertNotComplex([t,e],"logicalOr"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t||e})},t.prototype.select=function(t,e,n){this.assertNotComplex([t,e,n],"select");for(var r=this.readSync(t.dataId),i=this.readSync(e.dataId),o=this.readSync(n.dataId),a=On(e.shape,kt(e.dtype,n.dtype)),s=this.readSync(a.dataId),u=0,c=0===t.rank||t.rank>1||1===e.rank?1:e.shape[1],l=0;l<r.length;l++)for(var f=0;f<c;f++)1===r[l]?s[u++]=i[l]:s[u++]=o[l];return a},t.prototype.where=function(t){this.assertNotComplex([t],"where");var e=this.readSync(t.dataId);return yi(t.shape,e)},t.prototype.topk=function(t,e,n){return this.assertNotComplex(t,"topk"),bi(this.readSync(t.dataId),t.shape,t.dtype,e)},t.prototype.min=function(t,e){this.assertNotComplex(t,"min"),an("min",e,t.rank);for(var n=rn(t.shape,e),r=n[0],i=n[1],o=On(r,t.dtype),a=S(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],d=0;d<a;++d){var h=u[l+d];h<f&&(f=h)}s[c]=f}return o},t.prototype.minimum=function(t,e){return this.assertNotComplex([t,e],"minimum"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.min(t,e)})},t.prototype.mod=function(t,e){return this.assertNotComplex([t,e],"mod"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t%e;return t<0&&e<0||t>=0&&e>=0?n:(n+e)%e})},t.prototype.max=function(t,e){this.assertNotComplex(t,"max"),an("max",e,t.rank);for(var n=rn(t.shape,e),r=n[0],i=n[1],o=On(r,t.dtype),a=S(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],d=0;d<a;++d){var h=u[l+d];h>f&&(f=h)}s[c]=f}return o},t.prototype.maximum=function(t,e){return this.assertNotComplex([t,e],"maximum"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.max(t,e)})},t.prototype.all=function(t,e){this.assertNotComplex(t,"all"),an("all",e,t.rank);for(var n=rn(t.shape,e),r=n[0],i=n[1],o=On(r,t.dtype),a=S(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],d=0;d<a;++d){var h=u[l+d];f=f&&h}s[c]=f}return o},t.prototype.any=function(t,e){this.assertNotComplex(t,"any"),an("any",e,t.rank);for(var n=rn(t.shape,e),r=n[0],i=n[1],o=On(r,t.dtype),a=S(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],d=0;d<a;++d){var h=u[l+d];f=f||h}s[c]=f}return o},t.prototype.squaredDifference=function(t,e){return this.assertNotComplex([t,e],"squaredDifference"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t-e;return n*n})},t.prototype.ceil=function(t){this.assertNotComplex(t,"ceil");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.ceil(e[r]);return pt.make(t.shape,{values:n})},t.prototype.floor=function(t){this.assertNotComplex(t,"floor");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.floor(e[r]);return pt.make(t.shape,{values:n})},t.prototype.sign=function(t){this.assertNotComplex(t,"x");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)e[r]<0?n[r]=-1:e[r]>0?n[r]=1:n[r]=0;return pt.make(t.shape,{values:n})},t.prototype.isNaN=function(t){this.assertNotComplex(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)Number.isNaN(e[r])&&(n[r]=1);return pt.make(t.shape,{values:n},"bool")},t.prototype.isInf=function(t){this.assertNotComplex(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)Math.abs(e[r])===1/0&&(n[r]=1);return pt.make(t.shape,{values:n},"bool")},t.prototype.isFinite=function(t){this.assertNotComplex(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)Number.isFinite(e[r])&&(n[r]=1);return pt.make(t.shape,{values:n},"bool")},t.prototype.round=function(t){this.assertNotComplex(t,"round");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=Math.floor(e[r]);e[r]-i<.5?n[r]=Math.floor(e[r]):e[r]-i>.5?n[r]=Math.ceil(e[r]):n[r]=i%2==0?i:i+1}return pt.make(t.shape,{values:n})},t.prototype.exp=function(t){this.assertNotComplex(t,"exp");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.exp(e[r]);return pt.make(t.shape,{values:n})},t.prototype.expm1=function(t){this.assertNotComplex(t,"expm1");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.expm1(e[r]);return pt.make(t.shape,{values:n})},t.prototype.log=function(t){this.assertNotComplex(t,"log");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=Math.log(i)}return pt.make(t.shape,{values:n})},t.prototype.log1p=function(t){this.assertNotComplex(t,"log1p");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=Math.log1p(i)}return pt.make(t.shape,{values:n})},t.prototype.sqrt=function(t){this.assertNotComplex(t,"sqrt");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=Math.sqrt(i)}return pt.make(t.shape,{values:n})},t.prototype.rsqrt=function(t){this.assertNotComplex(t,"rsqrt");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=1/Math.sqrt(i)}return pt.make(t.shape,{values:n})},t.prototype.square=function(t){this.assertNotComplex(t,"square");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=i*i}return pt.make(t.shape,{values:n})},t.prototype.reciprocal=function(t){this.assertNotComplex(t,"reciprocal");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=1/e[r];return pt.make(t.shape,{values:n})},t.prototype.linear=function(t){return t},t.prototype.relu=function(t){this.assertNotComplex(t,"relu");for(var e=On(t.shape,t.dtype),n=this.readSync(e.dataId),r=this.readSync(t.dataId),i=0;i<r.length;++i)n[i]=Math.max(0,r[i]);return e},t.prototype.prelu=function(t,e){return this.assertNotComplex([t,e],"prelu"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return t<0?e*t:t})},t.prototype.elu=function(t){this.assertNotComplex(t,"elu");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r){var i=n[r];e[r]=i>=0?i:Math.exp(i)-1}return pt.make(t.shape,{values:e})},t.prototype.eluDer=function(t,e){this.assertNotComplex([t,e],"eluDer");for(var n=new Float32Array(e.size),r=this.readSync(e.dataId),i=this.readSync(t.dataId),o=0;o<r.length;++o){var a=r[o];n[o]=a>=1?i[o]:i[o]*(a+1)}return pt.make(e.shape,{values:n})},t.prototype.selu=function(t){this.assertNotComplex(t,"selu");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r){var i=n[r];e[r]=i>=0?1.0507009873554805*i:1.7580993408473768*(Math.exp(i)-1)}return pt.make(t.shape,{values:e})},t.prototype.clip=function(t,e,n){this.assertNotComplex(t,"clip");for(var r=new Float32Array(t.size),i=this.readSync(t.dataId),o=0;o<i.length;++o){var a=i[o];r[o]=a>n?n:a<e?e:a}return pt.make(t.shape,{values:r})},t.prototype.abs=function(t){for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.abs(n[r]);return pt.make(t.shape,{values:e})},t.prototype.complexAbs=function(t){for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<t.size;++r){var i=n[2*r],o=n[2*r+1];e[r]=Math.hypot(i,o)}return pt.make(t.shape,{values:e})},t.prototype.int=function(t){this.assertNotComplex(t,"int");for(var e=new Int32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=n[r];return pt.make(t.shape,{values:e},"int32")},t.prototype.sigmoid=function(t){this.assertNotComplex(t,"sigmoid");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=1/(1+Math.exp(-n[r]));return pt.make(t.shape,{values:e})},t.prototype.softplus=function(t){this.assertNotComplex(t,"softplus");for(var e=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(t.size),r=this.readSync(t.dataId),i=0;i<r.length;++i){var o,a=r[i]>-e,s=r[i]<e,u=Math.exp(r[i]);o=s?u:a?r[i]:Math.log(1+u),n[i]=o}return pt.make(t.shape,{values:n})},t.prototype.sin=function(t){this.assertNotComplex(t,"sin");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.sin(n[r]);return pt.make(t.shape,{values:e})},t.prototype.cos=function(t){this.assertNotComplex(t,"cos");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.cos(n[r]);return pt.make(t.shape,{values:e})},t.prototype.tan=function(t){this.assertNotComplex(t,"tan");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.tan(n[r]);return pt.make(t.shape,{values:e})},t.prototype.asin=function(t){this.assertNotComplex(t,"asin");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.asin(n[r]);return pt.make(t.shape,{values:e})},t.prototype.acos=function(t){this.assertNotComplex(t,"acos");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.acos(n[r]);return pt.make(t.shape,{values:e})},t.prototype.atan=function(t){this.assertNotComplex(t,"atan");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.atan(n[r]);return pt.make(t.shape,{values:e})},t.prototype.atan2=function(t,e){return this.assertNotComplex([t,e],"atan2"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.atan2(t,e)})},t.prototype.sinh=function(t){this.assertNotComplex(t,"sinh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.sinh(n[r]);return pt.make(t.shape,{values:e})},t.prototype.cosh=function(t){this.assertNotComplex(t,"cosh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.cosh(n[r]);return pt.make(t.shape,{values:e})},t.prototype.tanh=function(t){this.assertNotComplex(t,"tanh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=A(n[r]);return pt.make(t.shape,{values:e})},t.prototype.asinh=function(t){this.assertNotComplex(t,"asinh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.asinh(n[r]);return pt.make(t.shape,{values:e})},t.prototype.acosh=function(t){this.assertNotComplex(t,"acosh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.acosh(n[r]);return pt.make(t.shape,{values:e})},t.prototype.atanh=function(t){this.assertNotComplex(t,"atanh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.atanh(n[r]);return pt.make(t.shape,{values:e})},t.prototype.erf=function(t){this.assertNotComplex(t,"erf");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r){var i=n[r],o=1/(1+.3275911*i);e[r]=1-((((1.061405429*o-1.453152027)*o+1.421413741)*o-.284496736)*o+.254829592)*o*Math.exp(-i*i)}return pt.make(t.shape,{values:e})},t.prototype.step=function(t,e){void 0===e&&(e=0),this.assertNotComplex(t,"step");for(var n=new Float32Array(t.size),r=this.readSync(t.dataId),i=0;i<r.length;++i){var o=r[i];isNaN(o)?n[i]=NaN:n[i]=o>0?1:e}return pt.make(t.shape,{values:n})},t.prototype.conv2d=function(t,e,n){this.assertNotComplex([t,e],"conv2d");for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=Xn(n.outShape,t.dtype),l=this.readSync(t.dataId),f=this.readSync(e.dataId),d=c.values,h=0;h<n.batchSize;++h)for(var p=h*t.strides[0],m=h*c.strides[0],g=0;g<n.outHeight;++g)for(var v=m+g*c.strides[1],b=g*n.strideHeight-u,y=0;y<r;y++){var w=b+y*o;if(!(w<0||w>=n.inHeight))for(var x=y*e.strides[0],_=p+w*t.strides[1],k=0;k<n.outWidth;++k)for(var S=v+k*n.outChannels,E=k*n.strideWidth-s,O=0;O<i;O++){var A=E+O*a;if(!(A<0||A>=n.inWidth))for(var C=x+O*e.strides[1],M=_+A*n.inChannels,N=C,T=0;T<n.inChannels;++T){for(var I=l[M+T],D=0;D<n.outChannels;++D)d[S+D]+=I*f[N+D];N+=n.outChannels}}}return c.toTensor()},t.prototype.conv3d=function(t,e,n){for(var r=n.filterDepth,i=n.filterHeight,o=n.filterWidth,a=n.dilationDepth,s=n.dilationHeight,u=n.dilationWidth,c=n.padInfo.front,l=n.padInfo.left,f=n.padInfo.top,d=Xn(n.outShape,t.dtype),h=this.readSync(t.dataId),p=this.readSync(e.dataId),m=d.values,g=0;g<n.batchSize;++g)for(var v=g*t.strides[0],b=g*d.strides[0],y=0;y<n.outDepth;++y)for(var w=b+y*d.strides[1],x=y*n.strideDepth-c,_=0;_<r;_++){var k=x+_*a;if(!(k<0||k>=n.inDepth))for(var S=_*e.strides[0],E=v+k*t.strides[1],O=0;O<n.outHeight;++O)for(var A=w+O*d.strides[2],C=O*n.strideHeight-f,M=0;M<i;M++){var N=C+M*s;if(!(N<0||N>=n.inHeight))for(var T=S+M*e.strides[1],I=E+N*t.strides[2],D=0;D<n.outWidth;++D)for(var j=A+D*n.outChannels,R=D*n.strideWidth-l,F=0;F<o;F++){var P=R+F*u;if(!(P<0||P>=n.inWidth))for(var z=T+F*e.strides[2],L=I+P*n.inChannels,B=z,U=0;U<n.inChannels;++U){for(var W=h[L+U],q=0;q<n.outChannels;++q)m[j+q]+=W*p[B+q];B+=n.outChannels}}}}return d.toTensor()},t.prototype.conv2dDerInput=function(t,e,n){this.assertNotComplex([t,e],"conv2dDerInput");for(var r=Xn(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=this.readSync(t.dataId),l=t.strides,f=l[0],d=l[1],h=l[2],p=this.readSync(e.dataId),m=e.strides,g=m[0],v=m[1],b=m[2],y=n.batchSize,w=n.filterHeight,x=n.filterWidth,_=n.inChannels,k=n.inHeight,S=n.inWidth,E=n.outChannels,O=n.outHeight,A=n.outWidth,C=n.strideHeight,M=n.strideWidth,N=w-1-n.padInfo.top,T=x-1-n.padInfo.left,I=0;I<y;++I)for(var D=0;D<_;++D)for(var j=0;j<k;++j)for(var R=j-N,F=Math.max(0,Math.ceil(R/C)),P=Math.min(O,(w+R)/C),z=0;z<S;++z){for(var L=z-T,B=Math.max(0,Math.ceil(L/M)),U=Math.min(A,(x+L)/M),W=0,q=F;q<P;++q)for(var V=q*C-R,H=B;H<U;++H)for(var $=f*I+d*q+h*H,G=g*(w-1-V)+v*(x-1-(H*M-L))+b*D,K=0;K<E;++K)W+=c[$+K]*p[G+K];i[a*I+s*j+u*z+D]=W}return r.toTensor()},t.prototype.conv3dDerInput=function(t,e,n){for(var r=Xn(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=o[3],l=this.readSync(t.dataId),f=t.strides,d=f[0],h=f[1],p=f[2],m=f[3],g=this.readSync(e.dataId),v=e.strides,b=v[0],y=v[1],w=v[2],x=v[3],_=n.batchSize,k=n.filterDepth,S=n.filterHeight,E=n.filterWidth,O=n.inChannels,A=n.inDepth,C=n.inHeight,M=n.inWidth,N=n.outChannels,T=n.outDepth,I=n.outHeight,D=n.outWidth,j=n.strideDepth,R=n.strideHeight,F=n.strideWidth,P=k-1-n.padInfo.front,z=S-1-n.padInfo.top,L=E-1-n.padInfo.left,B=0;B<_;++B)for(var U=0;U<O;++U)for(var W=0;W<A;++W)for(var q=W-P,V=Math.max(0,Math.ceil(q/j)),H=Math.min(T,(k+q)/j),$=0;$<C;++$)for(var G=$-z,K=Math.max(0,Math.ceil(G/R)),X=Math.min(I,(S+G)/R),Y=0;Y<M;++Y){for(var J=Y-L,Z=Math.max(0,Math.ceil(J/F)),Q=Math.min(D,(E+J)/F),tt=0,et=V;et<H;++et)for(var nt=et*j-q,rt=K;rt<X;++rt)for(var it=rt*R-G,ot=Z;ot<Q;++ot)for(var at=d*B+h*et+p*rt+m*ot,st=b*(k-1-nt)+y*(S-1-it)+w*(E-1-(ot*F-J))+x*U,ut=0;ut<N;++ut)tt+=l[at+ut]*g[st+ut];i[a*B+s*W+u*$+c*Y+U]=tt}return r.toTensor()},t.prototype.conv2dDerFilter=function(t,e,n){this.assertNotComplex([t,e],"conv2dDerFilter");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=Xn(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=this.bufferSync(t),f=this.bufferSync(e),d=0;d<o;++d)for(var h=Math.max(0,Math.ceil((c-d)/r)),p=Math.min(n.outHeight,(n.inHeight+c-d)/r),m=0;m<a;++m)for(var g=Math.max(0,Math.ceil((u-m)/i)),v=Math.min(n.outWidth,(n.inWidth+u-m)/i),b=0;b<n.inChannels;++b)for(var y=0;y<n.outChannels;++y){for(var w=0,x=0;x<n.batchSize;++x)for(var _=h;_<p;++_)for(var k=d+_*r-c,S=g;S<v;++S){var E=m+S*i-u;w+=l.get(x,k,E,b)*f.get(x,_,S,y)}s.set(w,d,m,b,y)}return s.toTensor()},t.prototype.conv3dDerFilter=function(t,e,n){for(var r=n.strideDepth,i=n.strideHeight,o=n.strideWidth,a=n.filterDepth,s=n.filterHeight,u=n.filterWidth,c=Xn(n.filterShape,"float32"),l=c.values,f=c.strides,d=f[0],h=f[1],p=f[2],m=f[3],g=this.readSync(e.dataId),v=e.strides,b=v[0],y=v[1],w=v[2],x=v[3],_=this.readSync(t.dataId),k=t.strides,S=k[0],E=k[1],O=k[2],A=k[3],C=n.padInfo.front,M=n.padInfo.left,N=n.padInfo.top,T=0;T<a;++T)for(var I=Math.max(0,Math.ceil((C-T)/r)),D=Math.min(n.outDepth,(n.inDepth+C-T)/r),j=T*d,R=0;R<s;++R)for(var F=Math.max(0,Math.ceil((N-R)/i)),P=Math.min(n.outHeight,(n.inHeight+N-R)/i),z=R*h+j,L=0;L<u;++L)for(var B=Math.max(0,Math.ceil((M-L)/o)),U=Math.min(n.outWidth,(n.inWidth+M-L)/o),W=L*p+z,q=0;q<n.inChannels;++q)for(var V=q*m+W,H=0;H<n.outChannels;++H){for(var $=0,G=0;G<n.batchSize;++G)for(var K=G*S,X=G*b,Y=I;Y<D;++Y)for(var J=(T+Y*r-C)*E+K,Z=Y*y+X,Q=F;Q<P;++Q)for(var tt=(R+Q*i-N)*O+J,et=Q*w+Z,nt=B;nt<U;++nt){var rt=nt*x+et;$+=_[(L+nt*o-M)*A+tt+q]*g[rt+H]}l[V+H]=$}return c.toTensor()},t.prototype.depthwiseConv2D=function(t,e,n){this.assertNotComplex([t,e],"depthwiseConv2D");for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=n.outChannels/n.inChannels,l=Xn(n.outShape,t.dtype),f=this.readSync(t.dataId),d=this.readSync(e.dataId),h=l.values,p=0;p<n.batchSize;++p)for(var m=p*t.strides[0],g=p*l.strides[0],v=0;v<n.outHeight;++v)for(var b=g+v*l.strides[1],y=v*n.strideHeight-s,w=0;w<r;++w){var x=y+w*o;if(!(x<0||x>=n.inHeight))for(var _=w*e.strides[0],k=m+x*t.strides[1],S=0;S<n.outWidth;++S)for(var E=b+S*l.strides[2],O=S*n.strideWidth-u,A=0;A<i;++A){var C=O+A*a;if(!(C<0||C>=n.inWidth))for(var M=_+A*e.strides[1],N=k+C*n.inChannels,T=E,I=M,D=0;D<n.inChannels;++D){for(var j=f[N+D],R=0;R<c;++R)h[T+R]+=j*d[I+R];T+=c,I+=c}}}return l.toTensor()},t.prototype.depthwiseConv2DDerInput=function(t,e,n){this.assertNotComplex([t,e],"depthwiseConv2DDerInput");for(var r=Xn(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=this.readSync(t.dataId),l=t.strides,f=l[0],d=l[1],h=l[2],p=this.readSync(e.dataId),m=e.strides,g=m[0],v=m[1],b=m[2],y=n.batchSize,w=n.filterHeight,x=n.filterWidth,_=n.inChannels,k=n.inHeight,S=n.inWidth,E=n.outChannels,O=n.outHeight,A=n.outWidth,C=n.strideHeight,M=n.strideWidth,N=w-1-n.padInfo.top,T=x-1-n.padInfo.left,I=E/_,D=0;D<y;++D)for(var j=0;j<_;++j)for(var R=0;R<k;++R)for(var F=R-N,P=Math.max(0,Math.ceil(F/C)),z=Math.min(O,(w+F)/C),L=0;L<S;++L){for(var B=L-T,U=Math.max(0,Math.ceil(B/M)),W=Math.min(A,(x+B)/M),q=0,V=P;V<z;++V)for(var H=V*C-F,$=U;$<W;++$)for(var G=f*D+d*V+h*$,K=g*(w-1-H)+v*(x-1-($*M-B))+b*j,X=0;X<I;++X)q+=c[G+(j*I+X)]*p[K+X];i[a*D+s*R+u*L+j]=q}return r.toTensor()},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){this.assertNotComplex([t,e],"depthwiseConv2DDerFilter");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=Xn(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=n.outChannels/n.inChannels,f=this.bufferSync(t),d=this.bufferSync(e),h=0;h<o;++h)for(var p=Math.max(0,Math.ceil((c-h)/r)),m=Math.min(n.outHeight,(n.inHeight+c-h)/r),g=0;g<a;++g)for(var v=Math.max(0,Math.ceil((u-g)/i)),b=Math.min(n.outWidth,(n.inWidth+u-g)/i),y=0;y<n.outChannels;++y){for(var w=Math.trunc(y/l),x=y%l,_=0,k=0;k<n.batchSize;++k)for(var S=p;S<m;++S)for(var E=h+S*r-c,O=v;O<b;++O){var A=g+O*i-u;_+=f.get(k,E,A,w)*d.get(k,S,O,y)}s.set(_,h,g,w,x)}return s.toTensor()},t.prototype.tile=function(t,e){return this.assertNotComplex(t,"tile"),vi(this.bufferSync(t),e)},t.prototype.pad=function(t,e,n){this.assertNotComplex(t,"pad");var r=e.map(function(e,n){return e[0]+t.shape[n]+e[1]}),i=e.map(function(t){return t[0]}),o=this.bufferSync(t),a=Xn(r,t.dtype);0!==n&&a.values.fill(n);for(var s=0;s<t.size;s++){var u=o.indexToLoc(s),c=u.map(function(t,e){return t+i[e]});a.set.apply(a,[o.get.apply(o,u)].concat(c))}return a.toTensor()},t.prototype.transpose=function(t,e){this.assertNotComplex(t,"transpose");for(var n=new Array(t.rank),r=0;r<n.length;r++)n[r]=t.shape[e[r]];var i=this.readSync(t.dataId),o=Xn(n,t.dtype),a=this.bufferSync(t);for(r=0;r<t.size;++r){for(var s=a.indexToLoc(r),u=new Array(s.length),c=0;c<u.length;c++)u[c]=s[e[c]];var l=o.locToIndex(u);o.values[l]=i[r]}return o.toTensor()},t.prototype.gather=function(t,e,n){this.assertNotComplex([t,e],"gather");var r=t.shape.slice(),i=this.readSync(e.dataId);r[n]=i.length;for(var o=Xn(r,t.dtype),a=this.bufferSync(t),s=0;s<o.size;++s){var u=o.indexToLoc(s),c=u.slice();c[n]=i[u[n]];var l=a.locToIndex(c);o.values[s]=a.values[l]}return o.toTensor()},t.prototype.batchToSpaceND=function(t,e,n){this.assertNotComplex([t],"batchToSpaceND");var r=e.reduce(function(t,e){return t*e}),i=_r(t.shape,e,r),o=kr(i.length,e.length),a=Sr(t.shape,e,r),s=Er(n,e.length),u=Or(a,n,e.length);return t.reshape(i).transpose(o).reshape(a).slice(s,u)},t.prototype.spaceToBatchND=function(t,e,n){this.assertNotComplex([t],"spaceToBatchND");var r=e.reduce(function(t,e){return t*e}),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;o<t.shape.length;++o)i.push([0,0]);var a=t.pad(i),s=_r(a.shape,e,r,!1),u=kr(s.length,e.length,!1),c=Sr(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},t.prototype.pool=function(t,e,n){this.assertNotComplex(t,"pool");for(var r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=e.padInfo.top,l=e.padInfo.left,f="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,d=this.readSync(t.dataId),h=Xn(e.outShape,t.dtype),p=h.values,m=e.outShape[1]*e.outShape[2]*e.outShape[3],g=e.outShape[2]*e.outShape[3],v=e.outShape[3],b=0;b<e.batchSize;++b)for(var y=b*m,w=b*t.strides[0],x=0;x<e.inChannels;++x)for(var _=0;_<e.outHeight;++_)for(var k=_*r-c,S=Math.max(0,k),E=Math.min(e.inHeight,s+k),O=y+_*g,A=0;A<e.outWidth;++A){for(var C=A*i-l,M=Math.max(0,C),N=Math.min(e.inWidth,u+C),T=f,I=0,D=0,j=S;j<E;j+=o){for(var R=w+j*t.strides[1],F=M;F<N;F+=a){var P=d[R+F*t.strides[2]+x];"max"===n&&P>T?T=P:"avg"===n&&(I+=P,D++)}if(isNaN(T))break}p[O+A*v+x]="avg"===n?I/D:T}return h.toTensor()},t.prototype.maxPool=function(t,e){return this.pool(t,e,"max")},t.prototype.maxPoolPositions=function(t,e){for(var n=Xn(e.outShape,"int32"),r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=e.padInfo.top,l=e.padInfo.left,f=this.bufferSync(t),d=0;d<e.batchSize;++d)for(var h=0;h<e.inChannels;++h)for(var p=0;p<e.outHeight;++p){for(var m=p*r-c,g=m;g<0;)g+=o;for(var v=Math.min(e.inHeight,s+m),b=0;b<e.outWidth;++b){for(var y=b*i-l,w=y;w<0;)w+=a;for(var x=Math.min(e.inWidth,u+y),_=Number.NEGATIVE_INFINITY,k=-1,S=g;S<v;S+=o)for(var E=S-m,O=w;O<x;O+=a){var A=O-y,C=f.get(d,S,O,h);C>_&&(_=C,k=E*u+A)}n.set(k,d,p,b,h)}}return n.toTensor()},t.prototype.maxPoolBackprop=function(t,e,n,r){this.assertNotComplex([e,n],"maxPoolBackprop");for(var i=this.maxPoolPositions(e,r),o=r.strideHeight,a=r.strideWidth,s=r.dilationHeight,u=r.dilationWidth,c=r.effectiveFilterHeight,l=r.effectiveFilterWidth,f=l-1-r.padInfo.left,d=c-1-r.padInfo.top,h=Xn(e.shape,"float32"),p=this.bufferSync(i),m=this.bufferSync(t),g=0;g<r.batchSize;++g)for(var v=0;v<r.inChannels;++v)for(var b=0;b<r.inHeight;++b)for(var y=0;y<r.inWidth;++y){for(var w=b-d,x=y-f,_=0,k=0;k<c;k+=s){var S=(w+k)/o;if(!(S<0||S>=r.outHeight||Math.floor(S)!==S))for(var E=0;E<l;E+=u){var O=(x+E)/a;if(!(O<0||O>=r.outWidth||Math.floor(O)!==O)){var A=c*l-1-p.get(g,S,O,v)===k*l+E?1:0;0!==A&&(_+=m.get(g,S,O,v)*A)}}}h.set(_,g,b,y,v)}return h.toTensor()},t.prototype.avgPoolBackprop=function(t,e,n){this.assertNotComplex([t,e],"avgPoolBackprop");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=n.dilationHeight,u=n.dilationWidth,c=n.effectiveFilterHeight,l=n.effectiveFilterWidth,f=l-1-n.padInfo.left,d=c-1-n.padInfo.top,h=Xn(e.shape,"float32"),p=1/(o*a),m=this.bufferSync(t),g=0;g<n.batchSize;++g)for(var v=0;v<n.inChannels;++v)for(var b=0;b<n.inHeight;++b)for(var y=0;y<n.inWidth;++y){for(var w=b-d,x=y-f,_=0,k=0;k<c;k+=s){var S=(w+k)/r;if(!(S<0||S>=n.outHeight||Math.floor(S)!==S))for(var E=0;E<l;E+=u){var O=(x+E)/i;O<0||O>=n.outWidth||Math.floor(O)!==O||(_+=m.get(g,S,O,v))}}h.set(_*p,g,b,y,v)}return h.toTensor()},t.prototype.cast=function(t,e){return ai(t,e,this)},t.prototype.reshape=function(t,e){return si(t,e)},t.prototype.avgPool=function(t,e){return this.assertNotComplex(t,"avgPool"),this.pool(t,e,"avg").toFloat()},t.prototype.resizeBilinear=function(t,e,n,r){this.assertNotComplex(t,"resizeBilinear");for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=this.readSync(t.dataId),l=new Float32Array(S([o,e,n,u])),f=[r&&e>1?a-1:a,r&&n>1?s-1:s],d=[r&&e>1?e-1:e,r&&n>1?n-1:n],h=0,p=f[0]/d[0],m=f[1]/d[1],g=0;g<o;g++)for(var v=0;v<e;v++)for(var b=p*v,y=Math.floor(b),w=b-y,x=Math.min(a-1,Math.ceil(b)),_=g*t.strides[0]+y*t.strides[1],k=g*t.strides[0]+x*t.strides[1],E=0;E<n;E++)for(var O=m*E,A=Math.floor(O),C=O-A,M=Math.min(s-1,Math.ceil(O)),N=_+A*t.strides[2],T=k+A*t.strides[2],I=_+ +M*t.strides[2],D=k+M*t.strides[2],j=0;j<u;j++){var R=c[N+j],F=c[T+j],P=R+(c[I+j]-R)*C,z=P+(F+(c[D+j]-F)*C-P)*w;l[h++]=z}return gn(l,[o,e,n,u])},t.prototype.resizeBilinearBackprop=function(t,e,n){this.assertNotComplex([t,e],"resizeBilinearBackprop");for(var r=e.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=t.shape,c=u[1],l=u[2],f=new Float32Array(i*o*a*s),d=[n&&c>1?o-1:o,n&&l>1?a-1:a],h=[n&&c>1?c-1:c,n&&l>1?l-1:l],p=d[0]/h[0],m=d[1]/h[1],g=this.readSync(t.dataId),v=0,b=0;b<i;b++)for(var y=b*e.strides[0],w=0;w<c;w++)for(var x=w*p,_=Math.floor(x),k=Math.min(Math.ceil(x),o-1),S=y+_*e.strides[1],E=y+k*e.strides[1],O=x-_,A=1-O,C=0;C<l;C++)for(var M=C*m,N=Math.floor(M),T=Math.min(Math.ceil(M),a-1),I=M-N,D=1-I,j=S+N*e.strides[2],R=S+T*e.strides[2],F=E+N*e.strides[2],P=E+T*e.strides[2],z=A*D,L=A*I,B=O*D,U=O*I,W=0;W<s;W++){var q=g[v++];f[j+W]+=q*z,f[R+W]+=q*L,f[F+W]+=q*B,f[P+W]+=q*U}return _n(f,[i,a,o,s],e.dtype)},t.prototype.resizeNearestNeighbor=function(t,e,n,r){this.assertNotComplex(t,"resizeNearestNeighbor");for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=this.readSync(t.dataId),l=new Float32Array(o*e*n*u),f=[r&&e>1?a-1:a,r&&n>1?s-1:s],d=[r&&e>1?e-1:e,r&&n>1?n-1:n],h=f[0]/d[0],p=f[1]/d[1],m=0,g=0;g<o;g++)for(var v=g*t.strides[0],b=0;b<e;b++)for(var y=h*b,w=v+Math.min(a-1,r?Math.round(y):Math.floor(y))*t.strides[1],x=0;x<n;x++)for(var _=p*x,k=w+Math.min(s-1,r?Math.round(_):Math.floor(_))*t.strides[2],S=0;S<u;S++){var E=c[k+S];l[m++]=E}return gn(l,[o,e,n,u],t.dtype)},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){this.assertNotComplex([t,e],"resizeNearestNeighborBackprop");for(var r=e.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=t.shape,c=u[1],l=u[2],f=new Float32Array(i*o*a*s),d=this.readSync(t.dataId),h=[n&&c>1?o-1:o,n&&l>1?a-1:a],p=[n&&c>1?c-1:c,n&&l>1?l-1:l],m=h[0]/p[0],g=h[1]/p[1],v=1/m,b=1/g,y=2*Math.ceil(v)+2,w=2*Math.ceil(b)+2,x=0;x<i;x++)for(var _=x*e.strides[0],k=0;k<o;k++)for(var S=_+k*e.strides[1],E=Math.floor(k*v),O=Math.floor(E-y/2),A=0;A<a;A++)for(var C=S+A*e.strides[2],M=Math.floor(A*b),N=Math.floor(M-w/2),T=0;T<s;T++){for(var I=0,D=0;D<y;D++){var j=D+O;if(!(j<0||j>=c)){var R=_+j*t.strides[1],F=j*m;if(k===Math.min(o-1,n?Math.round(F):Math.floor(F)))for(var P=0;P<w;P++){var z=P+N;if(!(z<0||z>=l)){var L=R+z*t.strides[2],B=z*g;A===Math.min(a-1,n?Math.round(B):Math.floor(B))&&(I+=d[L+T])}}}}f[C+T]=I}return _n(f,e.shape,e.dtype)},t.prototype.batchNormalization=function(t,e,n,r,i,o){this.assertNotComplex([t,e,n,i,o],"batchNorm");for(var a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=this.readSync(n.dataId),c=i?this.readSync(i.dataId):new Float32Array([1]),l=o?this.readSync(o.dataId):new Float32Array([0]),f=new Float32Array(a.length),d=l.length,h=c.length,p=u.length,m=s.length,g=0,v=0,b=0,y=0,w=0;w<a.length;++w)f[w]=l[g++]+(a[w]-s[v++])*c[b++]/Math.sqrt(u[y++]+r),g>=d&&(g=0),v>=m&&(v=0),b>=h&&(b=0),y>=p&&(y=0);return _n(f,t.shape)},t.prototype.localResponseNormalization4D=function(t,e,n,r,i){this.assertNotComplex(t,"localResponseNormalization4D");var o=t.shape[3],a=o-1,s=this.readSync(t.dataId),u=t.size,c=new Float32Array(u);function l(t){for(var n=t%o,r=t-n+Math.max(0,n-e),i=t-n+Math.min(n+e,a),u=0;r<=i;r++){var c=s[r];u+=c*c}return u}for(var f=0;f<u;f++){var d=l(f),h=s[f]*Math.pow(n+r*d,-i);c[f]=h}return _n(c,t.shape)},t.prototype.LRNGrad=function(t,e,n,r,i,o,a){this.assertNotComplex(t,"LRNGrad");for(var s=t.shape[3],u=this.readSync(t.dataId),c=this.readSync(e.dataId),l=this.readSync(n.dataId),f=new Float32Array(t.size),d=t.size,h=0;h<d;h++){for(var p=h%s,m=h-p+Math.max(0,p-r),g=h-p+Math.min(s,p+r+1),v=0,b=m;b<g;b++)v+=Math.pow(c[b],2);for(v=o*v+i,b=m;b<g;b++){var y=-2*o*a*c[b]*l[h]/v;h===b&&(y+=Math.pow(v,-a)),y*=u[h],f[b]+=y}}return _n(f,t.shape)},t.prototype.multinomial=function(t,e,n,r){this.assertNotComplex(t,"multinomial");for(var i=e?t:qr(t),o=i.shape[0],a=i.shape[1],s=On([o,n],"int32"),u=this.readSync(s.dataId),c=this.readSync(i.dataId),l=0;l<o;++l){var f=l*a,d=new Float32Array(a-1);d[0]=c[f];for(var h=1;h<d.length;++h)d[h]=d[h-1]+c[f+h];for(var p=$n(r.toString()),m=l*n,g=0;g<n;++g){var v=p();u[m+g]=d.length;for(var b=0;b<d.length;b++)if(v<d[b]){u[m+g]=b;break}}}return s},t.prototype.oneHot=function(t,e,n,r){this.assertNotComplex(t,"oneHot");var i=new Float32Array(t.size*e);i.fill(r);for(var o=this.readSync(t.dataId),a=0;a<t.size;++a)o[a]>=0&&o[a]<e&&(i[a*e+o[a]]=n);return wn(i,[t.size,e],"int32")},t.prototype.nonMaxSuppression=function(t,e,n,r,i){return this.assertNotComplex(t,"nonMaxSuppression"),pi(this.readSync(t.dataId),this.readSync(e.dataId),n,r,i)},t.prototype.fft=function(t){return this.fftBatch(t,!1)},t.prototype.ifft=function(t){return this.fftBatch(t,!0)},t.prototype.fftBatch=function(t,e){for(var n=t.shape[0],r=t.shape[1],i=Xn(t.shape,"float32"),o=Xn(t.shape,"float32"),a=pn(t).as2D(n,r),s=mn(t).as2D(n,r),u=0;u<n;u++)for(var c=a.slice([u,0],[1,r]),l=s.slice([u,0],[1,r]),f=hn(c,l),d=this.readSync(this.fftImpl(f,e).dataId),h=0;h<r;h++){var p=fi(d,h);i.values[u*r+h]=p.real,o.values[u*r+h]=p.imag}return hn(i.toTensor(),o.toTensor()).as2D(n,r)},t.prototype.fftImpl=function(t,e){var n=t.as1D(),r=n.size;if(this.isExponentOf2(r)){var i=this.fftRadix2(n,r,e).as2D(t.shape[0],t.shape[1]);return e&&(i=hn(pn(i).div(bn(r)),mn(i).div(bn(r)))),i}var o=this.readSync(t.dataId),a=function(t){for(var e=new Float32Array(t.length/2),n=new Float32Array(t.length/2),r=0;r<t.length;r+=2)e[r/2]=t[r],n[r/2]=t[r+1];return{real:e,imag:n}}(this.fourierTransformByMatmul(o,r,e));return hn(a.real,a.imag).as2D(t.shape[0],t.shape[1])},t.prototype.isExponentOf2=function(t){return 0==(t&t-1)},t.prototype.fftRadix2=function(t,e,n){if(1===e)return t;var r=this.readSync(t.dataId),i=e/2,o=function(t){for(var e=Math.ceil(t.length/4),n=new Float32Array(e),r=new Float32Array(e),i=0;i<t.length;i+=4)n[Math.floor(i/4)]=t[i],r[Math.floor(i/4)]=t[i+1];return{real:n,imag:r}}(r),a=hn(o.real,o.imag).as1D(),s=function(t){for(var e=Math.floor(t.length/4),n=new Float32Array(e),r=new Float32Array(e),i=2;i<t.length;i+=4)n[Math.floor(i/4)]=t[i],r[Math.floor(i/4)]=t[i+1];return{real:n,imag:r}}(r),u=hn(s.real,s.imag).as1D();a=this.fftRadix2(a,i,n),u=this.fftRadix2(u,i,n);var c=function(t,e){for(var n=new Float32Array(t/2),r=new Float32Array(t/2),i=0;i<Math.ceil(t/2);i++){var o=(e?2:-2)*Math.PI*(i/t);n[i]=Math.cos(o),r[i]=Math.sin(o)}return{real:n,imag:r}}(e,n),l=hn(c.real,c.imag).mul(u),f=a.add(l),d=a.sub(l),h=pn(f).concat(pn(d)),p=mn(f).concat(mn(d));return hn(h,p).as1D()},t.prototype.fourierTransformByMatmul=function(t,e,n){for(var r=new Float32Array(2*e),i=0;i<e;i++){for(var o=0,a=0,s=0;s<e;s++){var u=hi(i*s,e,n),c=fi(t,s);o+=c.real*u.real-c.imag*u.imag,a+=c.real*u.imag+c.imag*u.real}n&&(o/=e,a/=e),di(r,o,a,i)}return r},t.prototype.depthToSpace=function(t,e,n){w("NHWC"===n,function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+n}),w(e>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+e});for(var r=t.shape[0],i=t.shape[1],o=t.shape[2],a=t.shape[3],s=i*e,u=o*e,c=a/(e*e),l=this.readSync(t.dataId),f=new Float32Array(r*s*u*c),d=0,h=0;h<r;++h)for(var p=0;p<s;++p)for(var m=Math.floor(p/e),g=p%e,v=0;v<u;++v)for(var b=Math.floor(v/e),y=(g*e+v%e)*c,x=0;x<c;++x){var _=x+y+a*(b+o*(m+i*h));f[d++]=l[_]}return _n(f,[r,s,u,c])},t.prototype.broadcastedBinaryOp=function(t,e,n,r){var i=Xr(t.shape,e.shape),o=Xn(i,n),a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=Gr(t.shape,i),c=Gr(e.shape,i),l=o.values;if(u.length+c.length===0)for(var f=0;f<l.length;++f)l[f]=r(a[f%a.length],s[f%s.length]);else{var d=this.bufferSync(t),h=this.bufferSync(e),p=function(n){var i=o.indexToLoc(n),f=i.slice(-t.rank);u.forEach(function(t){return f[t]=0});var p=d.locToIndex(f),m=i.slice(-e.rank);c.forEach(function(t){return m[t]=0});var g=h.locToIndex(m);l[n]=r(a[p],s[g])};for(f=0;f<l.length;++f)p(f)}return o.toTensor()},t.prototype.broadcastedBinaryComplexOp=function(t,e,n){var r=Xr(t.shape,e.shape),i=Xn(r,"float32"),o=Xn(r,"float32"),a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=Gr(t.shape,r),c=Gr(e.shape,r),l=i.values,f=o.values;if(u.length+c.length===0)for(var d=0;d<l.length;d++){var h=d%a.length,p=d%s.length,m=n(a[2*h],a[2*h+1],s[2*p],s[2*p+1]);l[d]=m.real,f[d]=m.imag}else{var g=this.bufferSync(this.data.get(t.dataId).complexTensors.real),v=this.bufferSync(this.data.get(e.dataId).complexTensors.real),b=function(r){var o=i.indexToLoc(r),d=o.slice(-t.rank);u.forEach(function(t){return d[t]=0});var h=g.locToIndex(d),p=o.slice(-e.rank);c.forEach(function(t){return p[t]=0});var m=v.locToIndex(p),b=n(a[2*h],a[2*h+1],s[2*m],s[2*m+1]);l[r]=b.real,f[r]=b.imag};for(d=0;d<l.length;d++)b(d)}return this.complex(i.toTensor(),o.toTensor())},t.prototype.split=function(t,e,n){return gi(t,e,n)},t.prototype.dispose=function(){},t.prototype.floatPrecision=function(){return 32},t.prototype.epsilon=function(){return 1e-7},t.prototype.cropAndResize=function(t,e,n,r,i,o){for(var a=t.shape,s=a[0],u=a[1],c=a[2],l=a[3],f=e.shape[0],d=r[0],h=r[1],p=Xn([f,d,h,l],t.dtype),m=this.readSync(e.dataId),g=this.readSync(n.dataId),v=this.readSync(t.dataId),b=t.strides,y=p.strides,w=0;w<f;w++){var x=4*w,_=m[x],k=m[x+1],S=m[x+2],E=m[x+3],O=g[w];if(!(O>=s))for(var A=d>1?(S-_)*(u-1)/(d-1):0,C=h>1?(E-k)*(c-1)/(h-1):0,M=0;M<d;M++){var N=d>1?_*(u-1)+M*A:.5*(_+S)*(u-1);if(N<0||N>u-1)for(var T=0;T<h;T++)for(var I=0;I<l;I++){var D=I+T*y[2]+M*y[1]+w*y[0];p.values[D]=o}else if("bilinear"===i){var j=Math.floor(N),R=Math.ceil(N),F=N-j;for(T=0;T<h;T++)if((H=h>1?k*(c-1)+T*C:.5*(k+E)*(c-1))<0||H>c-1)for(I=0;I<l;I++)D=I+T*y[2]+M*y[1]+w*y[0],p.values[D]=o;else{var P=Math.floor(H),z=Math.ceil(H),L=H-P;for(I=0;I<l;I++){var B=v[D=I+P*b[2]+j*b[1]+O*b[0]],U=v[D=I+z*b[2]+j*b[1]+O*b[0]],W=v[D=I+P*b[2]+R*b[1]+O*b[0]],q=B+(U-B)*L,V=W+(v[D=I+z*b[2]+R*b[1]+O*b[0]]-W)*L;D=I+T*y[2]+M*y[1]+w*y[0],p.values[D]=q+(V-q)*F}}}else for(T=0;T<h;++T){var H;if((H=h>1?k*(c-1)+T*C:.5*(k+E)*(c-1))<0||H>c-1)for(I=0;I<l;I++)D=I+T*y[2]+M*y[1]+w*y[0],p.values[D]=o;else{var $=Math.round(H),G=Math.round(N);for(I=0;I<l;I++){var K=I+$*b[2]+G*b[1]+O*b[0],X=I+T*y[2]+M*y[1]+w*y[0];p.values[X]=v[K]}}}}}return p.toTensor()},t.prototype.sparseToDense=function(t,e,n,r){var i=Nr(0,t,n),o=i.sliceRank,a=i.numUpdates,s=i.sliceSize,u=i.strides,c=i.outputSize;return this.scatter(t,e,n,c,s,a,o,u,r,!1)},t.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=Ar(t,e),o=i[0],a=i[1],s=i[2],u=i[3];if(0===a)return gn([],o,t.dtype);for(var c=new lt([a,s],t.dtype),l=this.readSync(e.dataId),f=this.readSync(t.dataId),d=0;d<a;d++){for(var h=[],p=0,m=0;m<r;m++){var g=l[d*r+m];p+=g*u[m],h.push(g)}if(p<0||p>=t.size/s)throw new Error("Invalid indices: "+h+" does not index into "+t.shape);for(var v=0;v<s;v++)c.values[d*s+v]=f[p*s+v]}return c.toTensor().reshape(o)},t.prototype.scatterND=function(t,e,n){var r=Nr(0,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=bn(0);return this.scatter(t,e,n,u,a,o,i,s,c,!0)},t.prototype.fill=function(t,e,n){var r=R(n=n||$(e),S(t));return r.fill(e),pt.make(t,{values:r},n)},t.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported for string tensors");return this.fill(t.shape,1,t.dtype)},t.prototype.zerosLike=function(t){var e=R(t.dtype,S(t.shape));return pt.make(t.shape,{values:e},t.dtype)},t.prototype.linspace=function(t,e,n){return ui(t,e,n)},t.prototype.scatter=function(t,e,n,r,i,o,a,s,u,c){var l=[r/i,i],f=this.readSync(t.dataId),d=this.readSync(e.dataId);if(0===r)return gn([],n,e.dtype);var h=new lt(l,e.dtype);h.values.fill(this.readSync(u.dataId)[0]);for(var p=0;p<o;p++){for(var m=[],g=0,v=0;v<a;v++){var b=f[p*a+v];m.push(b),g+=b*s[v]}if(g<0||g>=r/i)throw new Error("Invalid indices: "+m+" does not index into "+n);for(var y=0;y<i;y++)c?h.values[g*i+y]+=d[p*i+y]:h.values[g*i+y]=0===e.rank?d[0]:d[p*i+y]}return h.toTensor().reshape(n)},t}();It.registerBackend("cpu",function(){return new ac},1);var sc=function(){function t(){this.textEncoder=new TextEncoder,this.textDecoder=new TextDecoder}return t.prototype.encodeUTF8=function(t){return this.textEncoder.encode(t)},t.prototype.decodeUTF8=function(t){return this.textDecoder.decode(t)},t.prototype.fetch=function(t,e){return fetch(t,e)},t}();h.get("IS_BROWSER")&&h.setPlatform("browser",new sc);var uc,cc=function(){function t(){var t=n(674);this.textEncoder=new t.TextEncoder,this.textDecoder=new t.TextDecoder}return t.prototype.encodeUTF8=function(t){return this.textEncoder.encode(t)},t.prototype.decodeUTF8=function(t){return 0===t.length?"":this.textDecoder.decode(t)},t.prototype.fetch=function(t,e){return null!=h.global.fetch?h.global.fetch(t,e):(null==uc&&(uc=n(675)),uc(t,e))},t}();h.get("IS_NODE")&&h.setPlatform("node",new cc);var lc={float32:4,int32:4,uint16:2,uint8:1,bool:1};function fc(t,e){for(var n={},r=0,i=function(e){var i=e.name,o=e.dtype,a=e.shape,s=S(a),u=void 0;if("quantization"in e){var c=e.quantization;if("uint8"!==c.dtype&&"uint16"!==c.dtype)throw new Error("Weight "+e.name+" has unknown quantization dtype "+c.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var l=lc[c.dtype],f=t.slice(r,r+s*l),d="uint8"===c.dtype?new Uint8Array(f):new Uint16Array(f);if("float32"===o)u=Float32Array.from(d,function(t){return t*c.scale+c.min});else{if("int32"!==o)throw new Error("Unsupported dtype in weight '"+i+"': "+o);u=Int32Array.from(d,function(t){return Math.round(t*c.scale+c.min)})}r+=s*l}else if("string"===o){var p=e,m=new Uint8Array(t.slice(r,r+p.byteLength));u=h.platform.decodeUTF8(m).split(p.delimiter),r+=p.byteLength}else{var g=lc[o];if(f=t.slice(r,r+s*g),"float32"===o)u=new Float32Array(f);else if("int32"===o)u=new Int32Array(f);else{if("bool"!==o)throw new Error("Unsupported dtype in weight '"+i+"': "+o);u=new Uint8Array(f)}r+=s*g}n[i]=gn(u,a,o)},o=0,a=e;o<a.length;o++)i(a[o]);return n}var dc=void 0!==i&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function hc(t){return dc?i.byteLength(t):new Blob([t]).size}function pc(t){var e=0;t.forEach(function(t){e+=t.byteLength});var n=new Uint8Array(e),r=0;return t.forEach(function(t){n.set(new Uint8Array(t),r),r+=t.byteLength}),n.buffer}function mc(t){for(t=t.trim();t.endsWith("/");)t=t.slice(0,t.length-1);var e=t.split("/");return e[e.length-1]}function gc(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==t.modelTopology?0:hc(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:hc(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}}var vc=function(){function t(){this.saveRouters=[],this.loadRouters=[]}return t.getInstance=function(){return null==t.instance&&(t.instance=new t),t.instance},t.registerSaveRouter=function(e){t.getInstance().saveRouters.push(e)},t.registerLoadRouter=function(e){t.getInstance().loadRouters.push(e)},t.getSaveHandlers=function(e){return t.getHandlers(e,"save")},t.getLoadHandlers=function(e,n){return t.getHandlers(e,"load",n)},t.getHandlers=function(e,n,r){var i=[];return("load"===n?t.getInstance().loadRouters:t.getInstance().saveRouters).forEach(function(t){var n=t(e,r);null!==n&&i.push(n)}),i},t}(),bc="://",yc=function(){function t(){this.managers={}}return t.getInstance=function(){return null==t.instance&&(t.instance=new t),t.instance},t.registerManager=function(e,n){w(null!=e,function(){return"scheme must not be undefined or null."}),e.endsWith(bc)&&(e=e.slice(0,e.indexOf(bc))),w(e.length>0,function(){return"scheme must not be an empty string."});var r=t.getInstance();w(null==r.managers[e],function(){return"A model store manager is already registered for scheme '"+e+"'."}),r.managers[e]=n},t.getManager=function(t){var e=this.getInstance().managers[t];if(null==e)throw new Error("Cannot find model manager for scheme '"+t+"'");return e},t.getSchemes=function(){return Object.keys(this.getInstance().managers)},t}();function wc(t){if(-1===t.indexOf(bc))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+yc.getSchemes().join(","));return{scheme:t.split(bc)[0],path:t.split(bc)[1]}}function xc(t,e,n){return void 0===n&&(n=!1),c(this,void 0,void 0,function(){var r,i,o,a,s,u,c,f,d;return l(this,function(l){switch(l.label){case 0:return w(t!==e,function(){return"Old path and new path are the same: '"+t+"'"}),w((r=vc.getLoadHandlers(t)).length>0,function(){return"Copying failed because no load handler is found for source URL "+t+"."}),w(r.length<2,function(){return"Copying failed because more than one ("+r.length+") load handlers for source URL "+t+"."}),i=r[0],w((o=vc.getSaveHandlers(e)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+e+"."}),w(o.length<2,function(){return"Copying failed because more than one ("+r.length+") save handlers for destination URL "+e+"."}),a=o[0],s=wc(t).scheme,u=wc(t).path,c=s===wc(t).scheme,[4,i.load()];case 1:return f=l.sent(),n&&c?[4,yc.getManager(s).removeModel(u)]:[3,3];case 2:l.sent(),l.label=3;case 3:return[4,a.save(f)];case 4:return d=l.sent(),!n||c?[3,6]:[4,yc.getManager(s).removeModel(u)];case 5:l.sent(),l.label=6;case 6:return[2,d.modelArtifactsInfo]}})})}var _c="models_store",kc="model_info_store";function Sc(){if(!h.getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var t=window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error("The current browser does not appear to support IndexedDB.");return e}function Ec(t){var e=t.result;e.createObjectStore(_c,{keyPath:"modelPath"}),e.createObjectStore(kc,{keyPath:"modelPath"})}var Oc=function(){function t(t){if(this.indexedDB=Sc(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}return t.prototype.save=function(t){return c(this,void 0,void 0,function(){return l(this,function(e){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,t)]})})},t.prototype.load=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.databaseAction(this.modelPath)]})})},t.prototype.databaseAction=function(t,e){var n=this;return new Promise(function(t,r){var i=n.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return Ec(i)},i.onsuccess=function(){var o=i.result;if(null==e){var a=o.transaction(_c,"readonly"),s=a.objectStore(_c).get(n.modelPath);s.onsuccess=function(){if(null==s.result)return o.close(),r(new Error("Cannot find model with path '"+n.modelPath+"' in IndexedDB."));t(s.result.modelArtifacts)},s.onerror=function(t){return o.close(),r(s.error)},a.oncomplete=function(){return o.close()}}else{var u,c=gc(e),l=o.transaction(kc,"readwrite"),f=l.objectStore(kc),d=f.put({modelPath:n.modelPath,modelArtifactsInfo:c});d.onsuccess=function(){var i=(u=o.transaction(_c,"readwrite")).objectStore(_c).put({modelPath:n.modelPath,modelArtifacts:e,modelArtifactsInfo:c});i.onsuccess=function(){return t({modelArtifactsInfo:c})},i.onerror=function(t){var e=(f=l.objectStore(kc)).delete(n.modelPath);e.onsuccess=function(){return o.close(),r(i.error)},e.onerror=function(t){return o.close(),r(i.error)}}},d.onerror=function(t){return o.close(),r(d.error)},l.oncomplete=function(){null==u?o.close():u.oncomplete=function(){return o.close()}}}},i.onerror=function(t){return r(i.error)}})},t.URL_SCHEME="indexeddb://",t}(),Ac=function(t){return h.getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Oc.URL_SCHEME)?(e=t.slice(Oc.URL_SCHEME.length),new Oc(e)):null;var e};vc.registerSaveRouter(Ac),vc.registerLoadRouter(Ac);var Cc=function(){function t(){this.indexedDB=Sc()}return t.prototype.listModels=function(){return c(this,void 0,void 0,function(){var t=this;return l(this,function(e){return[2,new Promise(function(e,n){var r=t.indexedDB.open("tensorflowjs",1);r.onupgradeneeded=function(){return Ec(r)},r.onsuccess=function(){var t=r.result,i=t.transaction(kc,"readonly"),o=i.objectStore(kc).getAll();o.onsuccess=function(){for(var t={},n=0,r=o.result;n<r.length;n++){var i=r[n];t[i.modelPath]=i.modelArtifactsInfo}e(t)},o.onerror=function(e){return t.close(),n(o.error)},i.oncomplete=function(){return t.close()}},r.onerror=function(t){return n(r.error)}})]})})},t.prototype.removeModel=function(t){return c(this,void 0,void 0,function(){var e=this;return l(this,function(n){var r;return t=(r=t).startsWith(Oc.URL_SCHEME)?r.slice(Oc.URL_SCHEME.length):r,[2,new Promise(function(n,r){var i=e.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return Ec(i)},i.onsuccess=function(){var e,o=i.result,a=o.transaction(kc,"readwrite"),s=a.objectStore(kc),u=s.get(t);u.onsuccess=function(){if(null==u.result)return o.close(),r(new Error("Cannot find model with path '"+t+"' in IndexedDB."));var i=s.delete(t),a=function(){var i=(e=o.transaction(_c,"readwrite")).objectStore(_c).delete(t);i.onsuccess=function(){return n(u.result.modelArtifactsInfo)},i.onerror=function(t){return r(u.error)}};i.onsuccess=a,i.onerror=function(t){return a(),o.close(),r(u.error)}},u.onerror=function(t){return o.close(),r(u.error)},a.oncomplete=function(){null==e?o.close():e.oncomplete=function(){return o.close()}}},i.onerror=function(t){return r(i.error)}})]})})},t}();if(h.getBool("IS_BROWSER"))try{yc.registerManager(Oc.URL_SCHEME,new Cc)}catch(a){}var Mc="/",Nc="tensorflowjs_models",Tc="info",Ic="model_topology",Dc="weight_specs",jc="weight_data",Rc="model_metadata";function Fc(t){return{info:[Nc,t,Tc].join(Mc),topology:[Nc,t,Ic].join(Mc),weightSpecs:[Nc,t,Dc].join(Mc),weightData:[Nc,t,jc].join(Mc),modelMetadata:[Nc,t,Rc].join(Mc)}}function Pc(t){var e=t.split(Mc);if(e.length<3)throw new Error("Invalid key format: "+t);return e.slice(1,e.length-1).join(Mc)}var zc=function(){function t(t){if(!h.getBool("IS_BROWSER")||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==t||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=Fc(this.modelPath)}return t.prototype.save=function(t){return c(this,void 0,void 0,function(){var e,n,r;return l(this,function(o){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),r=gc(t);try{return this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,(a=t.weightData,dc?i.from(a).toString("base64"):btoa(String.fromCharCode.apply(null,new Uint8Array(a))))),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy})),[2,{modelArtifactsInfo:r}]}catch(t){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+r.modelTopologyBytes+", weightSpecsBytes="+r.weightSpecsBytes+", weightDataBytes="+r.weightDataBytes+".")}var a;return[2]})})},t.prototype.load=function(){return c(this,void 0,void 0,function(){var t,e,n,r,o,a,s;return l(this,function(u){if(null==(t=JSON.parse(this.LS.getItem(this.keys.info))))throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if("JSON"!==t.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(e={},null==(n=JSON.parse(this.LS.getItem(this.keys.topology))))throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(e.modelTopology=n,null==(r=JSON.parse(this.LS.getItem(this.keys.weightSpecs))))throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(e.weightSpecs=r,null!=(o=this.LS.getItem(this.keys.modelMetadata))&&(a=JSON.parse(o),e.format=a.format,e.generatedBy=a.generatedBy,e.convertedBy=a.convertedBy),null==(s=this.LS.getItem(this.keys.weightData)))throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return e.weightData=function(t){if(dc){var e=i.from(t,"base64");return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}for(var n=atob(t),r=new Uint8Array(n.length),o=0;o<n.length;++o)r.set([n.charCodeAt(o)],o);return r.buffer}(s),[2,e]})})},t.URL_SCHEME="localstorage://",t}(),Lc=function(t){return h.getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(zc.URL_SCHEME)?(e=t.slice(zc.URL_SCHEME.length),new zc(e)):null;var e};vc.registerSaveRouter(Lc),vc.registerLoadRouter(Lc);var Bc=function(){function t(){w(h.getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),w(void 0!==window.localStorage,function(){return"Current browser does not appear to support localStorage"}),this.LS=window.localStorage}return t.prototype.listModels=function(){return c(this,void 0,void 0,function(){var t,e,n,r,i,o;return l(this,function(a){for(t={},e=Nc+Mc,n=Mc+Tc,r=0;r<this.LS.length;++r)(i=this.LS.key(r)).startsWith(e)&&i.endsWith(n)&&(o=Pc(i),t[o]=JSON.parse(this.LS.getItem(i)));return[2,t]})})},t.prototype.removeModel=function(t){return c(this,void 0,void 0,function(){var e,n;return l(this,function(r){var i;if(t=(i=t).startsWith(zc.URL_SCHEME)?i.slice(zc.URL_SCHEME.length):i,e=Fc(t),null==this.LS.getItem(e.info))throw new Error("Cannot find model at path '"+t+"'");return n=JSON.parse(this.LS.getItem(e.info)),this.LS.removeItem(e.info),this.LS.removeItem(e.topology),this.LS.removeItem(e.weightSpecs),this.LS.removeItem(e.weightData),[2,n]})})},t}();if(h.getBool("IS_BROWSER"))try{yc.registerManager(zc.URL_SCHEME,new Bc)}catch(a){}var Uc="model",Wc=".json",qc=".weights.bin";function Vc(t){return new Promise(function(t){return setTimeout(t)}).then(t)}var Hc=function(){function t(e){if(!h.getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(t.URL_SCHEME)&&(e=e.slice(t.URL_SCHEME.length)),null!=e&&0!==e.length||(e=Uc),this.modelTopologyFileName=e+Wc,this.weightDataFileName=e+qc}return t.prototype.save=function(t){return c(this,void 0,void 0,function(){var e,n,r,i,o,a;return l(this,function(s){switch(s.label){case 0:if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(e=window.URL.createObjectURL(new Blob([t.weightData],{type:"application/octet-stream"})),!(t.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return n=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:n},i=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),(o=null==this.jsonAnchor?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,o.href=i,[4,Vc(function(){return o.dispatchEvent(new MouseEvent("click"))})];case 2:return s.sent(),null==t.weightData?[3,4]:((a=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,a.href=e,[4,Vc(function(){return a.dispatchEvent(new MouseEvent("click"))})]);case 3:s.sent(),s.label=4;case 4:return[2,{modelArtifactsInfo:gc(t)}]}})})},t.URL_SCHEME="downloads://",t}(),$c=function(){function t(t){if(null==t||t.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+t);this.files=t}return t.prototype.load=function(){return c(this,void 0,void 0,function(){var t,e,n=this;return l(this,function(r){return t=this.files[0],e=this.files.slice(1),[2,new Promise(function(r,i){var o=new FileReader;o.onload=function(o){var a=JSON.parse(o.target.result),s=a.modelTopology;if(null!=s){0===e.length&&r({modelTopology:s});var u=a.weightsManifest;if(null!=u){var c;try{c=n.checkManifestAndWeightFiles(u,e)}catch(t){return void i(t)}var l=[],f=[],d=[];u.forEach(function(t){t.paths.forEach(function(t){f.push(t),d.push(null)}),l.push.apply(l,t.weights)}),u.forEach(function(t){t.paths.forEach(function(t){var e=new FileReader;e.onload=function(e){var n=e.target.result,i=f.indexOf(t);d[i]=n,-1===d.indexOf(null)&&r({modelTopology:s,weightSpecs:l,weightData:pc(d)})},e.onerror=function(e){return i("Failed to weights data from file of path '"+t+"'.")},e.readAsArrayBuffer(c[t])})})}else i(new Error("weightManifest field is missing from file "+t.name))}else i(new Error("modelTopology field is missing from file "+t.name))},o.onerror=function(e){return i("Failed to read model topology and weights manifest JSON from file '"+t.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},o.readAsText(t)})]})})},t.prototype.checkManifestAndWeightFiles=function(t,e){for(var n=[],r=e.map(function(t){return mc(t.name)}),i={},o=0,a=t;o<a.length;o++)a[o].paths.forEach(function(t){var o=mc(t);if(-1!==n.indexOf(o))throw new Error("Duplicate file basename found in weights manifest: '"+o+"'");if(n.push(o),-1===r.indexOf(o))throw new Error("Weight file with basename '"+o+"' is not provided.");i[t]=e[r.indexOf(o)]});if(n.length!==e.length)throw new Error("Mismatch in the number of files in weights manifest ("+n.length+") and the number of weight files provided ("+e.length+").");return i},t}();function Gc(t,e,n,r){!function(t){w(null!=t&&Array.isArray(t)&&t.length>0,function(){return"promises must be a none empty array"})}(t),function(t,e){w(t>=0&&t<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+t}),w(e>=0&&e<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+e}),w(e>=t,function(){return"startFraction must be no more than endFraction, but got startFraction "+t+" and endFraction "+e})}(n=null==n?0:n,r=null==r?1:r);var i=0;return Promise.all(t.map(function(o){return o.then(function(o){var a=n+ ++i/t.length*(r-n);return e(a),o}),o}))}function Kc(t,e){return c(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,f;return l(this,function(l){switch(l.label){case 0:return null==e&&(e={}),n=null==e.fetchFunc?nt:e.fetchFunc,r=t.map(function(t){return n(t,e.requestInit)}),i=0,o=.5,null!=e.onProgress?[3,2]:[4,Promise.all(r)];case 1:return a=l.sent(),[3,4];case 2:return[4,Gc(r,e.onProgress,i,o)];case 3:a=l.sent(),l.label=4;case 4:return s=a.map(function(t){return t.arrayBuffer()}),u=.5,c=1,null!=e.onProgress?[3,6]:[4,Promise.all(s)];case 5:return f=l.sent(),[3,8];case 6:return[4,Gc(s,e.onProgress,u,c)];case 7:f=l.sent(),l.label=8;case 8:return[2,f]}})})}function Xc(t){var e=this;return function(n,r,i){return void 0===r&&(r=""),c(e,void 0,void 0,function(){var e,o,a,s,u,c,f,d,h,p;return l(this,function(l){switch(l.label){case 0:if(e=n.map(function(){return!1}),o={},a=null!=i?i.map(function(){return!1}):[],s=[],n.forEach(function(t,n){var r=0;t.weights.forEach(function(t){var u="quantization"in t?t.quantization.dtype:t.dtype,c=lc[u]*S(t.shape),l=function(){e[n]=!0,null==o[n]&&(o[n]=[]),o[n].push({manifestEntry:t,groupOffset:r,sizeBytes:c})};null!=i?i.forEach(function(e,n){e===t.name&&(l(),a[n]=!0)}):l(),s.push(t.name),r+=c})}),!a.every(function(t){return t}))throw u=i.filter(function(t,e){return!a[e]}),new Error("Could not find weights in manifest with names: "+u.join(", ")+". \nManifest JSON has weights with names: "+s.join(", ")+".");return c=e.reduce(function(t,e,n){return e&&t.push(n),t},[]),f=[],c.forEach(function(t){n[t].paths.forEach(function(t){var e=r+(r.endsWith("/")?"":"/")+t;f.push(e)})}),[4,t(f)];case 1:return d=l.sent(),h={},p=0,c.forEach(function(t){for(var e=n[t].paths.length,r=0,i=0;i<e;i++)r+=d[p+i].byteLength;for(var a=new ArrayBuffer(r),s=new Uint8Array(a),u=0,c=0;c<e;c++){var l=new Uint8Array(d[p+c]);s.set(l,u),u+=l.byteLength}o[t].forEach(function(t){var e=fc(a.slice(t.groupOffset,t.groupOffset+t.sizeBytes),[t.manifestEntry]);for(var n in e)h[n]=e[n]}),p+=e}),[2,h]}})})}}vc.registerSaveRouter(function(t){return h.getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Hc.URL_SCHEME)?(void 0===(e=t.slice(Hc.URL_SCHEME.length))&&(e="model"),new Hc(e)):null;var e});var Yc=function(){function t(t,e){if(this.DEFAULT_METHOD="POST",null==e&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,null!=e.fetchFunc?(w("function"==typeof e.fetchFunc,function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=e.fetchFunc):this.fetch=nt,w(null!=t&&t.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(t)&&w(2===t.length,function(){return"URL paths for http must have a length of 2, (actual length is "+t.length+")."}),this.path=t,null!=e.requestInit&&null!=e.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}return t.prototype.save=function(t){return c(this,void 0,void 0,function(){var e,n,r,i;return l(this,function(o){switch(o.label){case 0:if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:n},e.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=t.weightData&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if((i=o.sent()).ok)return[2,{modelArtifactsInfo:gc(t),responses:[i]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+i.status+".")}})})},t.prototype.load=function(){return c(this,void 0,void 0,function(){var t,e,n,r,i,o,a,s;return l(this,function(u){switch(u.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(t=u.sent()).ok)throw new Error("Request to "+this.path+" failed with status code "+t.status+". Please verify this URL points to the model JSON of the model to load.");u.label=2;case 2:return u.trys.push([2,4,,5]),[4,t.json()];case 3:return e=u.sent(),[3,5];case 4:throw u.sent(),n="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?n+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":n+=" Please make sure the server is serving valid JSON for this request.",new Error(n);case 5:if(r=e.modelTopology,i=e.weightsManifest,null==r&&null==i)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==i?[3,7]:[4,this.loadWeights(i)];case 6:s=u.sent(),o=s[0],a=s[1],u.label=7;case 7:return[2,{modelTopology:r,weightSpecs:o,weightData:a}]}})})},t.prototype.loadWeights=function(t){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,f,d;return l(this,function(l){switch(l.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,n=function(t){var e=t.lastIndexOf("/"),n=t.lastIndexOf("?");return[t.substring(0,e)+"/",n>e?t.substring(n):""]}(e),r=n[0],i=n[1],o=this.weightPathPrefix||r,a=[],s=0,u=t;s<u.length;s++)c=u[s],a.push.apply(a,c.weights);return f=[],t.forEach(function(t){t.paths.forEach(function(t){f.push(o+t+i)})}),[4,Kc(f,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return d=l.sent(),[2,[a,pc(d)]]}})})},t.URL_SCHEME_REGEX=/^https?:\/\//,t}();function Jc(t){return null!=t.match(Yc.URL_SCHEME_REGEX)}var Zc=function(t,e){return(Array.isArray(t)?t.every(function(t){return Jc(t)}):Jc(t))?Qc(t,{onProgress:e}):null};function Qc(t,e){return new Yc(t,e)}vc.registerSaveRouter(Zc),vc.registerLoadRouter(Zc);var tl=function(){function t(t,e,n,r){this.modelTopology=t,this.weightSpecs=e,this.weightData=n,this.trainingConfig=r}return t.prototype.load=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){return t={},null!=this.modelTopology&&(t=u({modelTopology:this.modelTopology},t)),null!=this.weightSpecs&&this.weightSpecs.length>0&&(t=u({weightSpecs:this.weightSpecs},t)),null!=this.weightData&&this.weightData.byteLength>0&&(t=u({weightData:this.weightData},t)),null!=this.trainingConfig&&(t=u({trainingConfig:this.trainingConfig},t)),[2,t]})})},t}(),el=function(){function t(t){this.saveHandler=t}return t.prototype.save=function(t){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.saveHandler(t)]})})},t}(),nl=Object.freeze({browserFiles:function(t){return new $c(t)},browserHTTPRequest:function(t,e){return Qc(t,e)},concatenateArrayBuffers:pc,decodeWeights:fc,encodeWeights:function(t,e){return c(this,void 0,void 0,function(){var n,r,i,o,a,s=this;return l(this,function(u){switch(u.label){case 0:for(n=[],r=[],i=Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t),o=function(o){var a=i[o],u=Array.isArray(t)?t[o].tensor:t[a];if("float32"!==u.dtype&&"int32"!==u.dtype&&"bool"!==u.dtype&&"string"!==u.dtype)throw new Error("Unsupported dtype in weight '"+a+"': "+u.dtype);var f={name:a,shape:u.shape,dtype:u.dtype};if("string"===u.dtype){var d=new Promise(function(t){return c(s,void 0,void 0,function(){var e,n,r;return l(this,function(i){switch(i.label){case 0:return e=f,[4,u.data()];case 1:return n=i.sent(),r=h.platform.encodeUTF8(n.join("\0")),e.byteLength=r.length,e.delimiter="\0",t(r),[2]}})})});r.push(d)}else r.push(u.data());null!=e&&(f.group=e),n.push(f)},a=0;a<i.length;++a)o(a);return[4,Promise.all(r)];case 1:return[2,{data:function(t){if(null===t)throw new Error("Invalid input value: "+JSON.stringify(t));var e=0,n=[];t.forEach(function(t){if(e+=t.byteLength,n.push(t.byteLength===t.buffer.byteLength?t:new t.constructor(t)),!(t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+t.constructor.name)});var r=new Uint8Array(e),i=0;return n.forEach(function(t){r.set(new Uint8Array(t.buffer),i),i+=t.byteLength}),r.buffer}(u.sent()),specs:n}]}})})},fromMemory:function(t,e,n,r){return new tl(t,e,n,r)},getLoadHandlers:function(t,e){return vc.getLoadHandlers(t,e)},getModelArtifactsInfoForJSON:gc,getSaveHandlers:function(t){return vc.getSaveHandlers(t)},http:Qc,isHTTPScheme:Jc,loadWeights:function(t,e,n,r){return void 0===e&&(e=""),c(this,void 0,void 0,function(){return l(this,function(i){return[2,Xc(function(t){return Kc(t,{requestInit:r})})(t,e,n)]})})},registerLoadRouter:function(t){return vc.registerLoadRouter(t)},registerSaveRouter:function(t){return vc.registerSaveRouter(t)},weightsLoaderFactory:Xc,withSaveHandler:function(t){return new el(t)},copyModel:function(t,e){return c(this,void 0,void 0,function(){return l(this,function(n){return[2,xc(t,e,!1)]})})},listModels:function(){return c(this,void 0,void 0,function(){var t,e,n,r,i,o,a;return l(this,function(s){switch(s.label){case 0:t=yc.getSchemes(),e={},n=0,r=t,s.label=1;case 1:return n<r.length?(i=r[n],[4,yc.getManager(i).listModels()]):[3,4];case 2:for(a in o=s.sent())e[i+bc+a]=o[a];s.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},moveModel:function(t,e){return c(this,void 0,void 0,function(){return l(this,function(n){return[2,xc(t,e,!0)]})})},removeModel:function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){return e=wc(t),[2,yc.getManager(e.scheme).removeModel(e.path)]})})}}),rl=dn({confusionMatrix_:function(t,e,n){var r=Qe(t,"labels","confusionMatrix"),i=Qe(e,"predictions","confusionMatrix");w(null==n||n>0&&Number.isInteger(n),function(){return"If provided, numClasses must be a positive integer, but got "+n}),w(1===r.rank,function(){return"Expected the rank of labels to be 1, but got "+r.rank}),w(1===i.rank,function(){return"Expected the rank of predictions to be 1, but got "+i.rank}),w(r.shape[0]===i.shape[0],function(){return"Mismatch in the number of examples: "+r.shape[0]+" vs. "+i.shape[0]+". Labels and predictions should have the same number of elements."}),w(n>0&&Number.isInteger(n),function(){return"numClasses is required to be a positive integer, but got "+n});var o=or(r.asType("int32"),n),a=or(i.asType("int32"),n);return o.transpose().matMul(a).asType("int32")}}),il=Object.freeze({confusionMatrix:rl}),ol=dn({fromPixels_:function(t,e){if(void 0===e&&(e=3),e>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");return It.fromPixels(t,e)}}),al=Object.freeze({toPixels:function(t,e){return c(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,f,d,h,p,m,g,v,b,y,w,x,_,k,S,E;return l(this,function(l){switch(l.label){case 0:if(n=Qe(t,"img","toPixels"),t instanceof pt||(n=n.toInt()),2!==n.rank&&3!==n.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+n.rank+".");if(r=n.shape.slice(0,2),i=r[0],o=r[1],(a=2===n.rank?1:n.shape[2])>4||2===a)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+a);return[4,n.data()];case 1:return s=l.sent(),u=n.min(),c=n.max(),[4,Promise.all([u.data(),c.data()])];case 2:if(f=l.sent(),d=f[0],h=f[1],p=d[0],m=h[0],u.dispose(),c.dispose(),"float32"===n.dtype){if(p<0||m>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+p+" - "+m+"].")}else{if("int32"!==n.dtype)throw new Error("Unsupported type for toPixels: "+n.dtype+". Please use float32 or int32 tensors.");if(p<0||m>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+p+" - "+m+"].")}for(g="float32"===n.dtype?255:1,v=new Uint8ClampedArray(o*i*4),b=0;b<i*o;++b)y=void 0,w=void 0,x=void 0,_=void 0,1===a?(y=s[b]*g,w=s[b]*g,x=s[b]*g,_=255):3===a?(y=s[3*b]*g,w=s[3*b+1]*g,x=s[3*b+2]*g,_=255):4===a&&(y=s[4*b]*g,w=s[4*b+1]*g,x=s[4*b+2]*g,_=s[4*b+3]*g),v[0+(k=4*b)]=Math.round(y),v[k+1]=Math.round(w),v[k+2]=Math.round(x),v[k+3]=Math.round(_);return null!=e&&(e.width=o,e.height=i,S=e.getContext("2d"),E=new ImageData(v,o,i),S.putImageData(E,0,0)),n!==t&&n.dispose(),[2,v]}})})},fromPixels:ol}),sl=function(){function t(){}return t.prototype.getClassName=function(){return this.constructor.className},t.fromConfig=function(t,e){return new t(e)},t}(),ul=function(){function t(){this.classNameMap={}}return t.getMap=function(){return null==t.instance&&(t.instance=new t),t.instance},t.register=function(e){t.getMap().classNameMap[e.className]=[e,e.fromConfig]},t}();function cl(t){w(null!=t.className,function(){return"Class being registered does not have the static className property defined."}),w("string"==typeof t.className,function(){return"className is required to be a string, but got type "+typeof t.className}),w(t.className.length>0,function(){return"Class being registered has an empty-string as its className, which is disallowed."}),ul.register(t)}var ll=Object.freeze({Serializable:sl,SerializationMap:ul,registerClass:cl}),fl=.001,dl=.1;function hl(){return 32===It.backend.floatPrecision()?fl:dl}function pl(t,e,n){var r=!0;if((B(t)||B(e))&&(r=!1),B(t)&&B(e)&&(r=!0),r){var i=t.constructor.name,o=e.constructor.name;if(i!==o)throw new Error("Arrays are of different type. Actual: "+i+". Expected: "+o)}if(Array.isArray(t)&&Array.isArray(e)){var a=Je(t),s=Je(e);if(!E(a,s))throw new Error("Arrays have different shapes. Actual: ["+a+"]. Expected: ["+s+"]")}var u=B(t)?t:k(t),c=B(e)?e:k(e);if(u.length!==c.length)throw new Error("Arrays have different lengths actual: "+u.length+" vs expected: "+c.length+".\nActual: "+u+".\nExpected: "+c+".");for(var l=0;l<c.length;++l){var f=u[l],d=c[l];if(!n(f,d))throw new Error("Arrays differ: actual["+l+"] = "+f+", expected["+l+"] = "+d+".\nActual: "+u+".\nExpected: "+c+".")}}function ml(t,e,n){return!isFinite(t)&&!isFinite(e)||!(isNaN(t)||isNaN(e)||Math.abs(t-e)>n)}var gl=Object.freeze({TEST_EPSILON_FLOAT16:dl,expectArraysClose:function(t,e,n){return null==n&&(n=hl()),pl(t,e,function(t,e){return ml(t,e,n)})},testEpsilon:hl,expectPromiseToFail:function(t,e){t().then(function(){return e.fail()},function(){return e()})},expectArraysEqual:function(t,e){var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e?[e]:e;return q(t)||q(t[0])||q(e)||q(e[0])?pl(t,n,function(t,e){return t==e}):pl(t,e,function(t,e){return ml(t,e,0)})},expectNumbersClose:function(t,e,n){if(null==n&&(n=hl()),!ml(t,e,n))throw new Error("Numbers differ: actual === "+t+", expected === "+e)},expectValuesInRange:function(t,e,n){for(var r=0;r<t.length;r++)if(t[r]<e||t[r]>n)throw new Error("Value out of range:"+t[r]+" low: "+e+", high: "+n)},expectArrayBuffersEqual:function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}}),vl="1.2.2",bl=Object.freeze({gpgpu_util:vo,webgl_util:Me,MathBackendWebGL:zo,setWebGLContext:Ft,GPGPUContext:bo}),yl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.minimize=function(t,e,n){void 0===e&&(e=!1);var r=this.computeGradients(t,n),i=r.value,o=r.grads;if(null!=n){var a=n.map(function(t){return{name:t.name,tensor:o[t.name]}});this.applyGradients(a)}else this.applyGradients(o);return ze(o),e?i:(i.dispose(),null)},Object.defineProperty(e.prototype,"iterations",{get:function(){return null==this.iterations_&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),e.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},e.prototype.computeGradients=function(t,e){return Br(t,e)},e.prototype.dispose=function(){null!=this.iterations_&&ze(this.iterations_)},e.prototype.saveIterations=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return null==this.iterations_&&(this.iterations_=0),[2,{name:"iter",tensor:bn(this.iterations_,"int32")}]})})},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){return l(this,function(t){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){return l(this,function(t){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},e.prototype.extractIterations=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this,[4,t[0].tensor.data()];case 1:return e.iterations_=n.sent()[0],[2,t.slice(1)]}})})},e}(sl);Object.defineProperty(yl,Symbol.hasInstance,{value:function(t){return null!=t.minimize&&null!=t.computeGradients&&null!=t.applyGradients}});var wl=function(t){function e(e,n,r){void 0===r&&(r=null);var i=t.call(this)||this;return i.learningRate=e,i.rho=n,i.epsilon=r,i.accumulatedGrads=[],i.accumulatedUpdates=[],null==r&&(i.epsilon=It.backend.epsilon()),i}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,r){var i=It.registeredVariables[n];null==e.accumulatedGrads[r]&&(e.accumulatedGrads[r]={originalName:n+"/accum_grad",variable:Pe(function(){return Tn(i).variable(!1)})}),null==e.accumulatedUpdates[r]&&(e.accumulatedUpdates[r]={originalName:n+"/accum_var",variable:Pe(function(){return Tn(i).variable(!1)})});var o=Array.isArray(t)?t[r].tensor:t[n];if(null!=o){var a=e.accumulatedGrads[r].variable,s=e.accumulatedUpdates[r].variable;Pe(function(){var t=a.mul(e.rho).add(o.square().mul(1-e.rho)),n=s.add(e.epsilon).sqrt().div(a.add(e.epsilon).sqrt()).mul(o),r=s.mul(e.rho).add(n.square().mul(1-e.rho));a.assign(t),s.assign(r);var u=n.mul(-e.learningRate).add(i);i.assign(u)})}}),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedUpdates&&(ze(this.accumulatedGrads.map(function(t){return t.variable})),ze(this.accumulatedUpdates.map(function(t){return t.variable})))},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return[4,this.extractIterations(t)];case 1:return t=n.sent(),e=t.length/2,this.accumulatedGrads=t.slice(0,e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.accumulatedUpdates=t.slice(e,2*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.rho,e.epsilon)},e.className="AdadeltaOptimizer",e}(yl);cl(wl);var xl=function(t){function e(e,n){void 0===n&&(n=.1);var r=t.call(this)||this;return r.learningRate=e,r.initialAccumulatorValue=n,r.accumulatedGrads=[],r}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,r){var i=It.registeredVariables[n];null==e.accumulatedGrads[r]&&(e.accumulatedGrads[r]={originalName:n+"/accumulator",variable:Pe(function(){return An(i.shape,e.initialAccumulatorValue).variable(!1)})});var o=Array.isArray(t)?t[r].tensor:t[n];if(null!=o){var a=e.accumulatedGrads[r].variable;Pe(function(){var t=a.add(o.square());a.assign(t);var n=o.div(t.add(It.backend.epsilon()).sqrt()).mul(-e.learningRate).add(i);i.assign(n)})}}),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedGrads&&ze(this.accumulatedGrads.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(this.accumulatedGrads.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:return t=e.sent(),this.accumulatedGrads=t.map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},e.fromConfig=function(t,e){return new t(e.learningRate,e.initialAccumulatorValue)},e.className="Adagrad",e}(yl);cl(xl);var _l=function(t){function e(e,n,r,i){void 0===i&&(i=null);var o=t.call(this)||this;return o.learningRate=e,o.beta1=n,o.beta2=r,o.epsilon=i,o.accumulatedFirstMoment=[],o.accumulatedSecondMoment=[],Pe(function(){o.accBeta1=bn(n).variable(),o.accBeta2=bn(r).variable()}),null==i&&(o.epsilon=It.backend.epsilon()),o}return s(e,t),e.prototype.applyGradients=function(t){var e=this,n=Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t);Pe(function(){var r=Js(1,e.accBeta1),i=Js(1,e.accBeta2);n.forEach(function(n,o){var a=It.registeredVariables[n];null==e.accumulatedFirstMoment[o]&&(e.accumulatedFirstMoment[o]={originalName:n+"/m",variable:Pe(function(){return Tn(a).variable(!1)})}),null==e.accumulatedSecondMoment[o]&&(e.accumulatedSecondMoment[o]={originalName:n+"/v",variable:Pe(function(){return Tn(a).variable(!1)})});var s=Array.isArray(t)?t[o].tensor:t[n];if(null!=s){var u=e.accumulatedFirstMoment[o].variable,c=e.accumulatedSecondMoment[o].variable,l=u.mul(e.beta1).add(s.mul(1-e.beta1)),f=c.mul(e.beta2).add(s.square().mul(1-e.beta2)),d=l.div(r),h=f.div(i);u.assign(l),c.assign(f);var p=d.div(h.sqrt().add(e.epsilon)).mul(-e.learningRate).add(a);a.assign(p)}}),e.accBeta1.assign(e.accBeta1.mul(e.beta1)),e.accBeta2.assign(e.accBeta2.mul(e.beta2))}),this.incrementIterations()},e.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&ze(this.accumulatedFirstMoment.map(function(t){return t.variable})),null!=this.accumulatedSecondMoment&&ze(this.accumulatedSecondMoment.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){var e,n=this;return l(this,function(r){switch(r.label){case 0:return[4,this.extractIterations(t)];case 1:return t=r.sent(),Pe(function(){n.accBeta1.assign(Gs(n.beta1,n.iterations_+1)),n.accBeta2.assign(Gs(n.beta2,n.iterations_+1))}),e=t.length/2,this.accumulatedFirstMoment=t.slice(0,e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.accumulatedSecondMoment=t.slice(e,2*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)},e.className="Adam",e}(yl);cl(_l);var kl=function(t){function e(e,n,r,i,o){void 0===i&&(i=null),void 0===o&&(o=0);var a=t.call(this)||this;return a.learningRate=e,a.beta1=n,a.beta2=r,a.epsilon=i,a.decay=o,a.accumulatedFirstMoment=[],a.accumulatedWeightedInfNorm=[],Pe(function(){a.iteration=bn(0).variable(),a.accBeta1=bn(n).variable()}),null==i&&(a.epsilon=It.backend.epsilon()),a}return s(e,t),e.prototype.applyGradients=function(t){var e=this,n=Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t);Pe(function(){var r=Js(1,e.accBeta1),i=Fs(-e.learningRate,e.iteration.mul(e.decay).add(1));n.forEach(function(n,o){var a=It.registeredVariables[n];null==e.accumulatedFirstMoment[o]&&(e.accumulatedFirstMoment[o]={originalName:n+"/m",variable:Tn(a).variable(!1)}),null==e.accumulatedWeightedInfNorm[o]&&(e.accumulatedWeightedInfNorm[o]={originalName:n+"/v",variable:Tn(a).variable(!1)});var s=Array.isArray(t)?t[o].tensor:t[n];if(null!=s){var u=e.accumulatedFirstMoment[o].variable,c=e.accumulatedWeightedInfNorm[o].variable,l=u.mul(e.beta1).add(s.mul(1-e.beta1)),f=c.mul(e.beta2),d=s.abs(),h=f.maximum(d);u.assign(l),c.assign(h);var p=i.div(r).mul(l.div(h.add(e.epsilon))).add(a);a.assign(p)}}),e.iteration.assign(e.iteration.add(1)),e.accBeta1.assign(e.accBeta1.mul(e.beta1))}),this.incrementIterations()},e.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&ze(this.accumulatedFirstMoment.map(function(t){return t.variable})),null!=this.accumulatedWeightedInfNorm&&ze(this.accumulatedWeightedInfNorm.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){return l(this,function(t){throw new Error("getWeights() is not implemented for Adamax yet.")})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){return l(this,function(t){throw new Error("setWeights() is not implemented for Adamax yet.")})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)},e.className="Adamax",e}(yl);cl(kl);var Sl=function(t){function e(e){var n=t.call(this)||this;return n.learningRate=e,n.setLearningRate(e),n}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,r){var i=Array.isArray(t)?t[r].tensor:t[n];if(null!=i){var o=It.registeredVariables[n];Pe(function(){var t=e.c.mul(i).add(o);o.assign(t)})}}),this.incrementIterations()},e.prototype.setLearningRate=function(t){this.learningRate=t,null!=this.c&&this.c.dispose(),this.c=Le(bn(-t))},e.prototype.dispose=function(){this.c.dispose()},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()]]}})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:if(0!==(t=e.sent()).length)throw new Error("SGD optimizer does not have settable weights.");return[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate}},e.fromConfig=function(t,e){return new t(e.learningRate)},e.className="SGD",e}(yl);cl(Sl);var El=function(t){function e(e,n,r){void 0===r&&(r=!1);var i=t.call(this,e)||this;return i.learningRate=e,i.momentum=n,i.useNesterov=r,i.accumulations=[],i.m=bn(i.momentum),i}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,r){var i=It.registeredVariables[n];null==e.accumulations[r]&&(e.accumulations[r]={originalName:n+"/momentum",variable:Pe(function(){return Tn(i).variable(!1)})});var o=e.accumulations[r].variable,a=Array.isArray(t)?t[r].tensor:t[n];null!=a&&Pe(function(){var t,n=e.m.mul(o).add(a);t=e.useNesterov?e.c.mul(a.add(n.mul(e.m))).add(i):e.c.mul(n).add(i),o.assign(n),i.assign(t)})}),this.incrementIterations()},e.prototype.dispose=function(){this.m.dispose(),null!=this.accumulations&&ze(this.accumulations.map(function(t){return t.variable}))},e.prototype.setMomentum=function(t){this.momentum=t},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(this.accumulations.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:return t=e.sent(),this.accumulations=t.map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},e.fromConfig=function(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)},e.className="MomentumOptimizer",e}(Sl);cl(El);var Ol=function(t){function e(e,n,r,i,o){void 0===n&&(n=.9),void 0===r&&(r=0),void 0===i&&(i=null),void 0===o&&(o=!1);var a=t.call(this)||this;return a.learningRate=e,a.decay=n,a.momentum=r,a.epsilon=i,a.accumulatedMeanSquares=[],a.accumulatedMoments=[],a.accumulatedMeanGrads=[],a.centered=o,null==i&&(a.epsilon=It.backend.epsilon()),a}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,r){var i=It.registeredVariables[n];null==e.accumulatedMeanSquares[r]&&(e.accumulatedMeanSquares[r]={originalName:n+"/rms",variable:Pe(function(){return Tn(i).variable(!1)})}),null==e.accumulatedMoments[r]&&(e.accumulatedMoments[r]={originalName:n+"/momentum",variable:Pe(function(){return Tn(i).variable(!1)})}),null==e.accumulatedMeanGrads[r]&&e.centered&&(e.accumulatedMeanGrads[r]={originalName:n+"/mg",variable:Pe(function(){return Tn(i).variable(!1)})});var o=Array.isArray(t)?t[r].tensor:t[n];if(null!=o){var a=e.accumulatedMeanSquares[r].variable,s=e.accumulatedMoments[r].variable;Pe(function(){var t=a.mul(e.decay).add(o.square().mul(1-e.decay));if(e.centered){var n=e.accumulatedMeanGrads[r].variable,u=n.mul(e.decay).add(o.mul(1-e.decay)),c=s.mul(e.momentum).add(o.mul(e.learningRate).div(t.sub(u.square().add(e.epsilon)).sqrt()));a.assign(t),n.assign(u),s.assign(c);var l=i.sub(c);i.assign(l)}else{var f=a.mul(e.decay).add(o.square().mul(1-e.decay));c=s.mul(e.momentum).add(o.mul(e.learningRate).div(f.add(e.epsilon).sqrt())),a.assign(f),s.assign(c),l=i.sub(c),i.assign(l)}})}}),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedMeanSquares&&ze(this.accumulatedMeanSquares.map(function(t){return t.variable})),null!=this.accumulatedMeanGrads&&this.centered&&ze(this.accumulatedMeanGrads.map(function(t){return t.variable})),null!=this.accumulatedMoments&&ze(this.accumulatedMoments.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&t.push.apply(t,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return[4,this.extractIterations(t)];case 1:return t=n.sent(),e=this.centered?t.length/3:t.length/2,this.accumulatedMeanSquares=t.slice(0,e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.accumulatedMoments=t.slice(e,2*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.centered&&(this.accumulatedMeanGrads=t.slice(2*e,3*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},e.fromConfig=function(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)},e.className="RMSProp",e}(yl);cl(Ol);var Al=function(){function t(){}return t.sgd=function(t){return new Sl(t)},t.momentum=function(t,e,n){return void 0===n&&(n=!1),new El(t,e,n)},t.rmsprop=function(t,e,n,r,i){return void 0===e&&(e=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===i&&(i=!1),new Ol(t,e,n,r,i)},t.adam=function(t,e,n,r){return void 0===t&&(t=.001),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new _l(t,e,n,r)},t.adadelta=function(t,e,n){return void 0===t&&(t=.001),void 0===e&&(e=.95),void 0===n&&(n=null),new wl(t,e,n)},t.adamax=function(t,e,n,r,i){return void 0===t&&(t=.002),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===i&&(i=0),new kl(t,e,n,r,i)},t.adagrad=function(t,e){return void 0===e&&(e=.1),new xl(t,e)},t}(),Cl={sgd:Al.sgd,momentum:Al.momentum,adadelta:Al.adadelta,adagrad:Al.adagrad,rmsprop:Al.rmsprop,adamax:Al.adamax,adam:Al.adam},Ml="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:void 0!==o?o:function(t){return t()};function Nl(){return new Promise(function(t){return Ml(function(){return t()})})}dt=oc}.call(this,n(44),n(27),n(18).Buffer,n(356).setImmediate)},function(t,e,n){"use strict";var r=function(t,e,n){return t.fields=e||[],t.fname=n,t};function i(t){return null==t?null:t.fname}function o(t){return null==t?null:t.fields}var a=function(t){throw Error(t)},s=function(t){var e,n,r,i=[],o=null,s=0,u=t.length,c="";function l(){i.push(c+t.substring(e,n)),c="",e=n+1}for(t+="",e=n=0;n<u;++n)if("\\"===(r=t[n]))c+=t.substring(e,n),e=++n;else if(r===o)l(),o=null,s=-1;else{if(o)continue;e===s&&'"'===r?(e=n+1,o=r):e===s&&"'"===r?(e=n+1,o=r):"."!==r||s?"["===r?(n>e&&l(),s=e=n+1):"]"===r&&(s||a("Access path missing open bracket: "+t),s>0&&l(),s=0,e=n+1):n>e?l():e=n+1}return s&&a("Access path missing closing bracket: "+t),o&&a("Access path missing closing quote: "+t),n>e&&(n++,l()),i},u=Array.isArray,c=function(t){return t===Object(t)},l=function(t){return"string"==typeof t};function f(t){return u(t)?"["+t.map(f)+"]":c(t)||l(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}var d=function(t,e){var n=s(t),i="return _["+n.map(f).join("][")+"];";return r(Function("_",i),[t=1===n.length?n[0]:t],e||t)},h=[],p=d("id"),m=r(function(t){return t},h,"identity"),g=r(function(){return 0},h,"zero"),v=r(function(){return 1},h,"one"),b=r(function(){return!0},h,"true"),y=r(function(){return!1},h,"false");function w(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}var x=function(t,e){var n=t||0;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=1&&w(e||"error","ERROR",arguments),this},warn:function(){return n>=2&&w(e||"warn","WARN",arguments),this},info:function(){return n>=3&&w(e||"log","INFO",arguments),this},debug:function(){return n>=4&&w(e||"log","DEBUG",arguments),this}}},_=function(t){return t[t.length-1]},k=function(t){return null==t||""===t?null:+t};function S(t){return function(e){return t*Math.exp(e)}}function E(t){return function(e){return Math.log(t*e)}}function O(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function A(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function C(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function M(t,e,n,r){var i=n(t[0]),o=n(_(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function N(t,e){return M(t,e,k,m)}function T(t,e){var n=Math.sign(t[0]);return M(t,e,E(n),S(n))}function I(t,e,n){return M(t,e,C(n),C(1/n))}function D(t,e,n){return M(t,e,O(n),A(n))}function j(t,e,n,r,i){var o=r(t[0]),a=r(_(t)),s=null!=e?r(e):(o+a)/2;return[i(s+(o-s)*n),i(s+(a-s)*n)]}function R(t,e,n){return j(t,e,n,k,m)}function F(t,e,n){var r=Math.sign(t[0]);return j(t,e,n,E(r),S(r))}function P(t,e,n,r){return j(t,e,n,C(r),C(1/r))}function z(t,e,n,r){return j(t,e,n,O(r),A(r))}function L(t){return 1+~~(new Date(t).getMonth()/3)}function B(t){return 1+~~(new Date(t).getUTCMonth()/3)}var U=function(t){return null!=t?u(t)?t:[t]:[]},W=function(t,e,n){var r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),(r=o-i)>=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]},q=function(t){return"function"==typeof t},V=function(t,e){var n,i,a,u,c,l,d,h,p,m=[],g=(t=U(t)).map(function(t,e){return null==t?null:(m.push(e),q(t)?t:s(t).map(f).join("]["))}),v=m.length-1,b=U(e),y="var u,v;return ";if(v<0)return null;for(i=0;i<=v;++i)a=g[n=m[i]],q(a)?(u="(u=this."+(l="f"+n)+"(a))",c="(v=this."+l+"(b))",(d=d||{})[l]=a):(u="(u=a["+a+"])",c="(v=b["+a+"])"),l="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==b[n]?(p=1,h=-1):(p=-1,h=1),y+="("+u+"<"+c+"||u==null)&&v!=null?"+h+":(u>v||v==null)&&u!=null?"+p+":"+l+"!==u&&v===v?"+h+":v!==v&&u===u?"+p+(n<v?":":":0");return a=Function("a","b",y+";"),d&&(a=a.bind(d)),t=t.reduce(function(t,e){return q(e)?(o(e)||[]).forEach(function(e){t[e]=1}):null!=e&&(t[e+""]=1),t},{}),r(a,Object.keys(t))},H=function(t){return q(t)?t:function(){return t}},$=function(t,e){var n,r;function i(){e(r),n=r=null}return function(e){r=e,n&&clearTimeout(n),n=setTimeout(i,t)}},G=function(t){for(var e,n,r=1,i=arguments.length;r<i;++r)for(n in e=arguments[r])t[n]=e[n];return t},K=function(t,e){var n,r,i,o,a=0;if(t&&(n=t.length))if(null==e){for(r=t[a];null==r||r!=r;r=t[++a]);for(i=o=r;a<n;++a)null!=(r=t[a])&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=e(t[a]);null==r||r!=r;r=e(t[++a]));for(i=o=r;a<n;++a)null!=(r=e(t[a]))&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]},X=function(t,e){var n,r,i,o,a,s=-1,u=t.length;if(null==e){for(;++s<u;)if(null!=(r=t[s])&&r>=r){n=i=r;break}for(o=a=s;++s<u;)null!=(r=t[s])&&(n>r&&(n=r,o=s),i<r&&(i=r,a=s))}else{for(;++s<u;)if(null!=(r=e(t[s],s,t))&&r>=r){n=i=r;break}for(o=a=s;++s<u;)null!=(r=e(t[s],s,t))&&(n>r&&(n=r,o=s),i<r&&(i=r,a=s))}return[o,a]};const Y=Object.prototype.hasOwnProperty;var J=function(t,e){return Y.call(t,e)},Z={},Q=function(t){var e,n,r={};function i(t){return J(r,t)&&r[t]!==Z}return e={size:0,empty:0,object:r,has:i,get:function(t){return i(t)?r[t]:void 0},set:function(t,n){return i(t)||(++e.size,r[t]===Z&&--e.empty),r[t]=n,this},delete:function(t){return i(t)&&(--e.size,++e.empty,r[t]=Z),this},clear:function(){e.size=e.empty=0,e.object=r={}},test:function(t){return arguments.length?(n=t,e):n},clean:function(){var t,i,o={},a=0;for(t in r)(i=r[t])===Z||n&&n(i)||(o[t]=i,++a);e.size=a,e.empty=0,e.object=r=o}},t&&Object.keys(t).forEach(function(n){e.set(n,t[n])}),e},tt=function(t,e,n,r,i,o){if(!n&&0!==n)return o;var a,s,u=t[0],c=_(t),l=+n;return c<u&&(a=u,u=c,c=a),(a=Math.abs(e-u))<(s=Math.abs(c-e))&&a<=l?r:s<=l?i:o},et=function(t,e){var n=t.prototype=Object.create(e.prototype);return n.constructor=t,n},nt=function(t,e,n,r){var i,o=e[0],a=e[e.length-1];return o>a&&(i=o,o=a,a=i),n=void 0===n||n,r=void 0===r||r,(n?o<=t:o<t)&&(r?t<=a:t<a)},rt=function(t){return"boolean"==typeof t},it=function(t){return"[object Date]"===Object.prototype.toString.call(t)},ot=function(t){return"number"==typeof t},at=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},st=function(t,e){t&&(t=e?U(t).map(function(t){return t.replace(/\\(.)/g,"$1")}):U(t));var n=t&&t.length?Function("_","return ''+"+t.map(function(t){return"_["+(e?f(t):s(t).map(f).join("]["))+"]"}).join("+'|'+")+";"):function(){return""};return r(n,t,"key")},ut=function(t,e){const n=t[0],r=_(t),i=+e;return i?1===i?r:n+i*(r-n):n},ct=function(t,e,n,r){var i=e.length,o=n.length;if(!o)return e;if(!i)return n;for(var a=r||new e.constructor(i+o),s=0,u=0,c=0;s<i&&u<o;++c)a[c]=t(e[s],n[u])>0?n[u++]:e[s++];for(;s<i;++s,++c)a[c]=e[s];for(;u<o;++u,++c)a[c]=n[u];return a},lt=function(t,e){for(var n="";--e>=0;)n+=t;return n},ft=function(t,e,n,r){var i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?lt(i,a)+o:"center"===r?lt(i,~~(a/2))+o+lt(i,Math.ceil(a/2)):o+lt(i,a)},dt=function(t){return t&&_(t)-t[0]||0},ht=function(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t||!t)};function pt(t){return ot(t)?t:it(t)?t:Date.parse(t)}var mt=function(t,e){return e=e||pt,null==t||""===t?null:e(t)},gt=function(t){return null==t||""===t?null:t+""},vt=function(t){for(var e={},n=0,r=t.length;n<r;++n)e[t[n]]=!0;return e},bt=function(t,e,n,r){var i=null!=r?r:"…",o=t+"",a=o.length,s=Math.max(0,e-i.length);return a<=e?o:"left"===n?i+o.slice(a-s):"center"===n?o.slice(0,Math.ceil(s/2))+i+o.slice(a-~~(s/2)):o.slice(0,s)+i},yt=function(t,e,n){if(t){var r,i=0,o=t.length;if(e)for(;i<o;++i)(r=e(t[i]))&&n(r,i,t);else t.forEach(n)}};n.d(e,"f",function(){return r}),n.d(e,"h",function(){return i}),n.d(e,"g",function(){return o}),n.d(e,"w",function(){return p}),n.d(e,"x",function(){return m}),n.d(e,"Ha",function(){return g}),n.d(e,"M",function(){return v}),n.d(e,"Ea",function(){return b}),n.d(e,"r",function(){return y}),n.d(e,"K",function(){return x}),n.d(e,"d",function(){return 0}),n.d(e,"b",function(){return 1}),n.d(e,"e",function(){return 2}),n.d(e,"c",function(){return 3}),n.d(e,"a",function(){return 4}),n.d(e,"O",function(){return N}),n.d(e,"P",function(){return T}),n.d(e,"Q",function(){return I}),n.d(e,"R",function(){return D}),n.d(e,"Ia",function(){return R}),n.d(e,"Ja",function(){return F}),n.d(e,"Ka",function(){return P}),n.d(e,"La",function(){return z}),n.d(e,"T",function(){return L}),n.d(e,"Fa",function(){return B}),n.d(e,"i",function(){return U}),n.d(e,"j",function(){return W}),n.d(e,"k",function(){return V}),n.d(e,"l",function(){return H}),n.d(e,"m",function(){return $}),n.d(e,"n",function(){return a}),n.d(e,"o",function(){return G}),n.d(e,"p",function(){return K}),n.d(e,"q",function(){return X}),n.d(e,"s",function(){return Q}),n.d(e,"t",function(){return d}),n.d(e,"u",function(){return tt}),n.d(e,"v",function(){return J}),n.d(e,"y",function(){return et}),n.d(e,"z",function(){return nt}),n.d(e,"A",function(){return u}),n.d(e,"B",function(){return rt}),n.d(e,"C",function(){return it}),n.d(e,"D",function(){return q}),n.d(e,"E",function(){return ot}),n.d(e,"F",function(){return c}),n.d(e,"G",function(){return at}),n.d(e,"H",function(){return l}),n.d(e,"I",function(){return st}),n.d(e,"J",function(){return ut}),n.d(e,"L",function(){return ct}),n.d(e,"N",function(){return ft}),n.d(e,"S",function(){return _}),n.d(e,"U",function(){return lt}),n.d(e,"V",function(){return dt}),n.d(e,"W",function(){return s}),n.d(e,"X",function(){return f}),n.d(e,"Y",function(){return ht}),n.d(e,"Z",function(){return mt}),n.d(e,"Aa",function(){return k}),n.d(e,"Ca",function(){return gt}),n.d(e,"Ba",function(){return vt}),n.d(e,"Da",function(){return bt}),n.d(e,"Ga",function(){return yt})},function(t,e,n){"use strict";n.r(e);var r=n(0),i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};
/**
* @license
* Copyright 2019 Google LLC. 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 o(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a,s=function(){return(s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function u(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function c(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function l(){return null==a&&(a=Object(r.backend)().epsilon()),a}var f=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return o(e,t),e}(Error),d=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return o(e,t),e}(Error),h=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return o(e,t),e}(Error),p=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return o(e,t),e}(Error),m=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return o(e,t),e}(Error);function g(t,e){if(Array.isArray(t)){for(var n=[],r=0;r<e;r++)n=n.concat(t);return n}return(n=new Array(e)).fill(t),n}function v(t,e){if(!t)throw new m(e)}function b(t,e){for(var n=0,r=0,i=t;r<i.length;r++)i[r]===e&&n++;return n}function y(t){return 1===t.length?t[0]:t}function w(t){return Array.isArray(t)?t:[t]}function x(t){var e=t.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return"_"!==e[0]?e:"private"+e}function _(t){return t.length<=1?t:-1===t.indexOf("_")?t:t.replace(/[_]+(\w|$)/g,function(t,e){return e.toUpperCase()})}!function(t){o(function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r},t)}(Error);var k={};function S(t){if(null===t||void 0===t)return null;var e={};return e.className=t.getClassName(),e.config=t.getConfig(),e}function E(t,e,n,r,i){var o,a,u;if(void 0===e&&(e={}),void 0===n&&(n={}),void 0===r&&(r="object"),void 0===i&&(i=!1),"string"==typeof t){var c=t,l=void 0;if(c in n)l=n[c];else if(c in k)l=k[c];else if(null==(l=e[c]))throw new h("Unknown "+r+": "+t+". This may be due to one of the following reasons:\n1. The "+r+" is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom "+r+" is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().");return l}var f=t;if(null==f.className||null==f.config)throw new h(r+": Improper config format: "+JSON.stringify(f)+".\n'className' and 'config' must set.");var d=f.className,p=void 0,m=void 0;if(d in n?(p=(o=n[d])[0],m=o[1]):d in k?(p=(a=k.className)[0],m=a[1]):d in e&&(p=(u=e[d])[0],m=u[1]),null==p)throw new h("Unknown "+r+": "+d+". This may be due to one of the following reasons:\n1. The "+r+" is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom "+r+" is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().");if(null!=m){for(var g={},v=0,b=Object.keys(k);v<b.length;v++)g[E=b[v]]=k[E];for(var y=0,w=Object.keys(n);y<w.length;y++)g[E=w[y]]=n[E];f.config.customObjects=g;for(var x=s({},k),_=0,S=Object.keys(n);_<S.length;_++){var E=S[_];k[E]=n[E]}!function t(e){if(null!=e&&"object"==typeof e)if(Array.isArray(e))e.forEach(function(e){return t(e)});else for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n],o=e[i];null!=o&&"object"==typeof o&&(Array.isArray(o)||"ndarray"!==o.type||"number"!=typeof o.value?t(o):e[i]=o.value)}}(f.config);var O=m(p,f.config,n,i);return k=s({},x),O}x=s({},k);for(var A=0,C=Object.keys(n);A<C.length;A++)E=C[A],k[E]=n[E];return O=new p(f.config),k=s({},x),O}function O(t,e){return-1*function(t,e){return t<e?-1:t>e?1:0}(t,e)}function A(t){if(null==t)return t;for(var e=[],n=0,r=t;n<r.length;n++){var i=r[n];-1===e.indexOf(i)&&e.push(i)}return e}function C(t){if(null==t)throw new h("Invalid value in obj: "+JSON.stringify(t));for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function M(t,e,n){if(null!=n&&t.indexOf(n)<0)throw new h(n+" is not a valid "+e+". Valid values are "+t+" or null/undefined.")}function N(t,e,n,r){return void 0===n&&(n=0),void 0===r&&(r=1/0),v(n>=0),v(r>=n),Array.isArray(t)&&t.length>=n&&t.length<=r&&t.every(function(t){return typeof t===e})}function T(t,e){Array.isArray(t)?(r.util.assert(t.length>0,function(){return e+" is unexpectedly an empty array."}),t.forEach(function(t,n){return T(t,"element "+(n+1)+" of "+e)})):r.util.assert(Number.isInteger(t)&&t>0,function(){return"Expected "+e+" to be a positive integer, but got "+function t(e){return null===e?"null":Array.isArray(e)?"["+e.map(function(e){return t(e)}).join(",")+"]":"string"==typeof e?'"'+e+'"':""+e}(t)+"."})}function I(t,e){return Object(r.tidy)(function(){return Object(r.sqrt)(Object(r.sum)(Object(r.mulStrict)(t,t),e,!0))})}var D=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getConfig=function(){return{}},e}(r.serialization.Serializable),j=function(t){function e(e){var n=t.call(this)||this;return n.defaultMaxValue=2,n.defaultAxis=0,n.maxValue=null!=e.maxValue?e.maxValue:n.defaultMaxValue,n.axis=null!=e.axis?e.axis:n.defaultAxis,n}return o(e,t),e.prototype.apply=function(t){var e=this;return Object(r.tidy)(function(){var n=I(t,e.axis),i=Object(r.clipByValue)(n,0,e.maxValue);return Object(r.mul)(t,Object(r.div)(i,Object(r.add)(l(),n)))})},e.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},e.className="MaxNorm",e}(D);r.serialization.registerClass(j);var R=function(t){function e(e){var n=t.call(this)||this;return n.defaultAxis=0,n.axis=null!=e.axis?e.axis:n.defaultAxis,n}return o(e,t),e.prototype.apply=function(t){var e=this;return Object(r.tidy)(function(){return Object(r.div)(t,Object(r.add)(l(),I(t,e.axis)))})},e.prototype.getConfig=function(){return{axis:this.axis}},e.className="UnitNorm",e}(D);r.serialization.registerClass(R);var F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.relu)(t)},e.className="NonNeg",e}(D);r.serialization.registerClass(F);var P=function(t){function e(e){var n=t.call(this)||this;return n.defaultMinValue=0,n.defaultMaxValue=1,n.defaultRate=1,n.defaultAxis=0,n.minValue=null!=e.minValue?e.minValue:n.defaultMinValue,n.maxValue=null!=e.maxValue?e.maxValue:n.defaultMaxValue,n.rate=null!=e.rate?e.rate:n.defaultRate,n.axis=null!=e.axis?e.axis:n.defaultAxis,n}return o(e,t),e.prototype.apply=function(t){var e=this;return Object(r.tidy)(function(){var n=I(t,e.axis),i=Object(r.add)(Object(r.mul)(e.rate,Object(r.clipByValue)(n,e.minValue,e.maxValue)),Object(r.mul)(1-e.rate,n));return Object(r.mul)(t,Object(r.div)(i,Object(r.add)(l(),n)))})},e.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},e.className="MinMaxNorm",e}(D);r.serialization.registerClass(P);var z={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function L(t){return S(t)}function B(t,e){return void 0===e&&(e={}),E(t,r.serialization.SerializationMap.getMap().classNameMap,e,"constraint")}function U(t){return null==t?null:"string"==typeof t?B({className:t in z?z[t]:t,config:{}}):t instanceof D?t:B(t)}var W=Object.freeze({maxNorm:function(t){return new j(t)},unitNorm:function(t){return new R(t)},nonNeg:function(){return new F},minMaxNorm:function(t){return new P(t)}}),q=["channelsFirst","channelsLast"],V=["valid","same","causal"],H=["max","avg"],$=["sum","mul","concat","ave"],G=new Map;function K(t){M(q,"DataFormat",t)}function X(t){M(V,"PaddingMode",t)}var Y=[],J="/";function Z(t,e){Y.push(t);try{var n=e();return Y.pop(),n}catch(t){throw Y.pop(),t}}function Q(t){if(!nt(t))throw new Error("Not a valid tensor name: '"+t+"'");return(0===Y.length?"":Y.join(J)+J)+t}function tt(t){if(!nt(t))throw new Error("Not a valid tensor name: '"+t+"'");G.has(t)||G.set(t,0);var e=G.get(t);if(G.set(t,G.get(t)+1),e>0){var n=t+"_"+e;return G.set(n,1),n}return t}var et=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function nt(t){return!!t.match(et)}function rt(t){return t===parseInt(t.toString(),10)}function it(t,e,n){null==e&&(e=0),null==n&&(n=t.length);for(var r=1,i=e;i<n;++i)r*=t[i];return r}function ot(t){return t=Array.isArray(t)?new Float32Array(t):t,Object(r.tensor1d)(t)}function at(t){return Object(r.min)(ot(t)).dataSync()[0]}function st(t){return Object(r.max)(ot(t)).dataSync()[0]}function ut(t,e){if(e<t)throw new h("end ("+e+") < begin ("+t+") is forbidden.");for(var n=[],r=t;r<e;++r)n.push(r);return n}function ct(t,e){return t.asType(e)}function lt(t,e){void 0===e&&(e=-1);var n=t.shape.slice();return e<0&&(e=n.length+e+1),n.splice(e,0,1),t.reshape(n)}function ft(t,e,n){return Object(r.tidy)(function(){switch(t.rank){case 1:return Object(r.slice1d)(t,e,n);case 2:return Object(r.slice2d)(t,[e,0],[n,t.shape[1]]);case 3:return Object(r.slice3d)(t,[e,0,0],[n,t.shape[1],t.shape[2]]);case 4:return Object(r.slice4d)(t,[e,0,0,0],[n,t.shape[1],t.shape[2],t.shape[3]]);default:throw new h("sliceAlongFirstAxis() received an unsupported tensor rank: "+t.rank)}})}function dt(t,e,n){return Object(r.tidy)(function(){switch(t.rank){case 1:return Object(r.slice1d)(t,e,n);case 2:return Object(r.slice2d)(t,[0,e],[t.shape[0],n]);case 3:return Object(r.slice3d)(t,[0,0,e],[t.shape[0],t.shape[1],n]);case 4:return Object(r.slice4d)(t,[0,0,0,e],[t.shape[0],t.shape[1],t.shape[2],n]);default:throw new h("sliceAlongLastAxis() received an unsupported tensor rank: "+t.rank)}})}function ht(t,e,n,i){return Object(r.tidy)(function(){switch(t.rank){case 1:return Object(r.slice1d)(t,e,n);case 2:switch(i){case 1:return ft(t,e,n);case 2:return dt(t,e,n);default:throw new h("The axis is not within the rank of the tensor "+i)}case 3:switch(i){case 1:return ft(t,e,n);case 2:return Object(r.slice3d)(t,[0,e,0],[t.shape[0],n,t.shape[2]]);case 3:return dt(t,e,n);default:throw new h("The axis is not within the rank of the tensor "+i)}case 4:switch(i){case 1:return ft(t,e,n);case 2:return Object(r.slice4d)(t,[0,e,0,0],[t.shape[0],n,t.shape[2],t.shape[3]]);case 3:return Object(r.slice4d)(t,[0,0,e,0],[t.shape[0],t.shape[1],n,t.shape[3]]);case 4:return dt(t,e,n);default:throw new h("The axis is not within the rank of the tensor "+i)}default:throw new h("sliceAlongLastAxis() received an unsupported tensor rank: "+t.rank)}})}function pt(t,e){var n;return void 0===e&&(e=-1),e<0&&(e=0!==(n=t[0].rank)?n:0),e===t[0].rank&&(e=-1),Object(r.concat)(t,e)}function mt(t,e){switch(t.rank){case 1:return Object(r.concat1d)([t,e]);case 2:return Object(r.concat2d)([t,e],0);case 3:return Object(r.concat3d)([t,e],0);case 4:return Object(r.concat4d)([t,e],0);default:throw new h("concatAlongFirstAxis() received an unsupported tensor rank: "+t.rank)}}function gt(t,e){if(Array.isArray(e)||(e=[e]),t.rank!==e.length)throw new h("The length of input n ("+e.length+") does not match the number of dimensions in input x ("+t.rank+")");return Object(r.tile)(t,e)}function vt(t,e,n,i,o){return void 0===e&&(e=0),void 0===n&&(n=1),Object(r.randomNormal)(t,e,n,i,o)}function bt(t,e,n,i){if(t.rank<2||e.rank<2)throw new p("dot requires both inputs to be rank >= 2 but got x shape = "+t.shape+" and y shape = "+e.shape);if(e.rank>=3&&(u=t.shape.slice(-1)[0])!==(f=e.shape.slice(-2)[0]))throw new p("If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = "+t.shape+" and y shape = "+e.shape);if(2===t.rank&&2===e.rank){var o=!1,a=!1;return r.fused.matMul(t,e,o,a,i?xt(t.rank,i,"channelsLast"):null,n)}var s=t.shape.slice(),u=s.pop();t=t.reshape([-1,u]);var c=e.shape.slice(),l=c.pop(),f=c.pop(),d=c.concat([l]),h=Array.from({length:e.rank},function(t,n){return 0===n?e.rank-2:n<=e.rank-2?n-1:n});e=e.transpose(h).reshape([f,-1]);var m=s.concat(d);return o=!1,a=!1,r.fused.matMul(t,e,o,a,i?xt(t.rank,i,"channelsLast"):null,n).reshape(m)}function yt(t,e,n){return Object(r.tidy)(function(){return e=Array.isArray(e)?Object(r.tensor1d)(e,"int32"):e.toInt(),Object(r.gather)(t,e,n)})}function wt(t){return Object(r.mulStrict)(t,t)}function xt(t,e,n){var r=e.shape;if(1!==e.rank&&e.rank!==t)throw new h("Unexpected bias dimensions: "+e.rank+"; expected it to be 1 or "+t);if(5===t){if("channelsFirst"===n)return 1===r.length?e.reshape([1,r[0],1,1,1]):e.reshape([1,r[3],r[0],r[1],r[2]]);if("channelsLast"===n)return 1===r.length?e.reshape([1,1,1,1,r[0]]):e.reshape([1].concat(r))}else if(4===t){if("channelsFirst"===n)return 1===r.length?e.reshape([1,r[0],1,1]):e.reshape([1,r[2],r[0],r[1]]);if("channelsLast"===n)return 1===r.length?e.reshape([1,1,1,r[0]]):e.reshape([1].concat(r))}else if(3===t){if("channelsFirst"===n)return 1===r.length?e.reshape([1,r[0],1]):e.reshape([1,r[1],r[0]]);if("channelsLast"===n)return 1===r.length?e.reshape([1,1,r[0]]):e.reshape([1].concat(r))}else if(t<3)return e;throw new h("Unsupported input rank by biasAdd: "+e.rank)}function _t(t,e,n){return Object(r.tidy)(function(){return null==n&&(n="channelsLast"),K(n),t.add(xt(t.rank,e,n))})}function kt(t,e,n,i){return Object(r.tidy)(function(){return Object(r.dropout)(t,e,n,i)})}function St(t,e,n){return void 0===n&&(n=!1),n?t():e()}var Et=["fanIn","fanOut","fanAvg"],Ot=["normal","uniform","truncatedNormal"],At=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.fromConfigUsesCustomObjects=function(){return!1},e.prototype.getConfig=function(){return{}},e}(r.serialization.Serializable),Ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t,e){return Object(r.zeros)(t,e)},e.className="Zeros",e}(At);r.serialization.registerClass(Ct);var Mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t,e){return Object(r.ones)(t,e)},e.className="Ones",e}(At);r.serialization.registerClass(Mt);var Nt=function(t){function e(e){var n=t.call(this)||this;if("object"!=typeof e)throw new h("Expected argument of type ConstantConfig but got "+e);if(void 0===e.value)throw new h("config must have value set but got "+e);return n.value=e.value,n}return o(e,t),e.prototype.apply=function(t,e){var n=this;return Object(r.tidy)(function(){return Object(r.mul)(Object(r.scalar)(n.value),Object(r.ones)(t,e))})},e.prototype.getConfig=function(){return{value:this.value}},e.className="Constant",e}(At);r.serialization.registerClass(Nt);var Tt=function(t){function e(e){var n=t.call(this)||this;return n.DEFAULT_MINVAL=-.05,n.DEFAULT_MAXVAL=.05,n.minval=e.minval||n.DEFAULT_MINVAL,n.maxval=e.maxval||n.DEFAULT_MAXVAL,n.seed=e.seed,n}return o(e,t),e.prototype.apply=function(t,e){return Object(r.randomUniform)(t,this.minval,this.maxval,e)},e.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},e.className="RandomUniform",e}(At);r.serialization.registerClass(Tt);var It=function(t){function e(e){var n=t.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=e.mean||n.DEFAULT_MEAN,n.stddev=e.stddev||n.DEFAULT_STDDEV,n.seed=e.seed,n}return o(e,t),e.prototype.apply=function(t,e){if("float32"!==(e=e||"float32")&&"int32"!==e)throw new p("randomNormal does not support dType "+e+".");return vt(t,this.mean,this.stddev,e,this.seed)},e.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},e.className="RandomNormal",e}(At);r.serialization.registerClass(It);var Dt=function(t){function e(e){var n=t.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=e.mean||n.DEFAULT_MEAN,n.stddev=e.stddev||n.DEFAULT_STDDEV,n.seed=e.seed,n}return o(e,t),e.prototype.apply=function(t,e){if("float32"!==(e=e||"float32")&&"int32"!==e)throw new p("truncatedNormal does not support dType "+e+".");return Object(r.truncatedNormal)(t,this.mean,this.stddev,e,this.seed)},e.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},e.className="TruncatedNormal",e}(At);r.serialization.registerClass(Dt);var jt=function(t){function e(e){var n=t.call(this)||this;return n.gain=null!=e.gain?e.gain:1,n}return o(e,t),e.prototype.apply=function(t,e){var n=this;return Object(r.tidy)(function(){if(2!==t.length||t[0]!==t[1])throw new h("Identity matrix initializer can only be used for 2D square matrices.");return Object(r.mul)(n.gain,Object(r.eye)(t[0]))})},e.prototype.getConfig=function(){return{gain:this.gain}},e.className="Identity",e}(At);r.serialization.registerClass(jt);var Rt=function(t){function e(e){var n=t.call(this)||this;if(e.scale<0)throw new h("scale must be a positive float. Got: "+e.scale);return n.scale=null==e.scale?1:e.scale,n.mode=null==e.mode?"fanIn":e.mode,function(t){M(Et,"FanMode",t)}(n.mode),n.distribution=null==e.distribution?"normal":e.distribution,function(t){M(Ot,"Distribution",t)}(n.distribution),n.seed=e.seed,n}return o(e,t),e.prototype.apply=function(t,e){var n=function(t,e){var n,r;if(void 0===e&&(e="channelsLast"),K(e),2===t.length)n=t[0],r=t[1];else if(-1!==[3,4,5].indexOf(t.length))if("channelsFirst"===e){var i=it(t,2);n=t[1]*i,r=t[0]*i}else"channelsLast"===e&&(i=it(t,0,t.length-2),n=t[t.length-2]*i,r=t[t.length-1]*i);else{var o=it(t);n=Math.sqrt(o),r=Math.sqrt(o)}return[n,r]}(t),i=n[0],o=n[1],a=this.scale;if("fanIn"===this.mode?a/=Math.max(1,i):"fanOut"===this.mode?a/=Math.max(1,o):a/=Math.max(1,(i+o)/2),"normal"===this.distribution){var s=Math.sqrt(a);if("float32"!==(e=e||"float32")&&"int32"!==e)throw new p(this.getClassName()+" does not support dType "+e+".");return Object(r.truncatedNormal)(t,0,s,e,this.seed)}var u=Math.sqrt(3*a);return Object(r.randomUniform)(t,-u,u,e)},e.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},e.className="VarianceScaling",e}(At);r.serialization.registerClass(Rt);var Ft=function(t){function e(e){return t.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:null==e?null:e.seed})||this}return o(e,t),e.prototype.getClassName=function(){return Rt.className},e.className="GlorotUniform",e}(Rt);r.serialization.registerClass(Ft);var Pt=function(t){function e(e){return t.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:null==e?null:e.seed})||this}return o(e,t),e.prototype.getClassName=function(){return Rt.className},e.className="GlorotNormal",e}(Rt);r.serialization.registerClass(Pt);var zt=function(t){function e(e){return t.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})||this}return o(e,t),e.prototype.getClassName=function(){return Rt.className},e.className="HeNormal",e}(Rt);r.serialization.registerClass(zt);var Lt=function(t){function e(e){return t.call(this,{scale:2,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})||this}return o(e,t),e.prototype.getClassName=function(){return Rt.className},e.className="HeUniform",e}(Rt);r.serialization.registerClass(Lt);var Bt=function(t){function e(e){return t.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})||this}return o(e,t),e.prototype.getClassName=function(){return Rt.className},e.className="LeCunNormal",e}(Rt);r.serialization.registerClass(Bt);var Ut=function(t){function e(e){return t.call(this,{scale:1,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})||this}return o(e,t),e.prototype.getClassName=function(){return Rt.className},e.className="LeCunNormal",e}(Rt);r.serialization.registerClass(Ut);var Wt=function(t){function e(e){var n=t.call(this)||this;if(n.DEFAULT_GAIN=1,n.gain=null==e.gain?n.DEFAULT_GAIN:e.gain,n.seed=e.seed,null!=n.seed)throw new p("Random seed is not implemented for Orthogonal Initializer yet.");return n}return o(e,t),e.prototype.apply=function(t,e){var n=this;return Object(r.tidy)(function(){if(2!==t.length)throw new p("The Orthogonal Initializer does not support non-2D shapes yet.");t[0]*t[1]>2e3&&console.warn("Orthogonal initializer is being called on a matrix with more than 2000 ("+t[0]*t[1]+") elements: Slowness may result.");var e=vt(t[0]>t[1]?[t[1],t[0]]:t,0,1,"float32"),i=r.linalg.gramSchmidt(e);return t[0]>t[1]&&(i=i.transpose()),Object(r.mul)(n.gain,i)})},e.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},e.className="Orthogonal",e}(At);r.serialization.registerClass(Wt);var qt={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function Vt(t,e){return void 0===e&&(e={}),E(t,r.serialization.SerializationMap.getMap().classNameMap,e,"initializer")}function Ht(t){return S(t)}function $t(t){if("string"==typeof t){var e=t in qt?qt[t]:t;if("GlorotNormal"===e)return new Pt;if("GlorotUniform"===e)return new Ft;if("HeNormal"===e)return new zt;if("HeUniform"===e)return new Lt;if("LeCunNormal"===e)return new Bt;if("LeCunUniform"===e)return new Ut;var n={};return n.className=e,n.config={},Vt(n)}return t instanceof At?t:Vt(t)}var Gt=Object.freeze({zeros:function(){return new Ct},ones:function(){return new Mt},constant:function(t){return new Nt(t)},randomUniform:function(t){return new Tt(t)},randomNormal:function(t){return new It(t)},truncatedNormal:function(t){return new Dt(t)},identity:function(t){return new jt(t)},varianceScaling:function(t){return new Rt(t)},glorotUniform:function(t){return new Ft(t)},glorotNormal:function(t){return new Pt(t)},heNormal:function(t){return new zt(t)},heUniform:function(t){return new Lt(t)},leCunNormal:function(t){return new Bt(t)},leCunUniform:function(t){return new Ut(t)},orthogonal:function(t){return new Wt(t)}}),Kt=0;function Xt(){return Kt++}var Yt={};function Jt(t){return void 0===t&&(t=""),t in Yt||(Yt[t]=0),Yt[t]+=1,t+Yt[t].toString()}function Zt(t){return Array.isArray(t)&&Array.isArray(t[0])}function Qt(t){return 0===t.length?[]:Array.isArray(t[0])?t:[t]}function te(t){var e;if(Array.isArray(t)){if(1!==t.length)throw new h("Expected Tensor length to be 1; got "+t.length);e=t[0]}else e=t;return e}function ee(t){if(Array.isArray(t)&&Array.isArray(t[0])){if(1===t.length)return(t=t)[0];throw new h("Expected exactly 1 Shape; got "+t.length)}return t}function ne(t){for(var e=0,n=0,r=t;n<r.length;n++){var i=r[n];0===i.shape.length?e+=1:e+=i.shape.reduce(function(t,e){return t*e})}return e}var re="Variable",ie=function(){function t(t,e,n,i,o){void 0===e&&(e="float32"),void 0===n&&(n=re),void 0===i&&(i=!0),void 0===o&&(o=null),this.dtype=null==e?"float32":e,this.shape=t.shape,this.id=Xt(),n=null==n?re:n,this.originalName=Q(n),this.name=tt(this.originalName),this.trainable_=i,this.constraint=o,this.val=Object(r.variable)(t,this.trainable_,this.name,this.dtype)}return t.prototype.read=function(){return this.assertNotDisposed(),this.val},t.prototype.write=function(t){return this.assertNotDisposed(),function(t,e){if(t.shape.toString()!==e.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(t.shape)+" vs. "+JSON.stringify(e.shape))}(this.val,t),this.val.id!==t.id&&(this.val.assign(t),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val))),this},t.prototype.dispose=function(){this.assertNotDisposed(),this.val.dispose()},t.prototype.assertNotDisposed=function(){if(this.val.isDisposed)throw new Error("LayersVariable "+this.name+" is already disposed.")},Object.defineProperty(t.prototype,"trainable",{get:function(){return this.trainable_},set:function(t){this.trainable_=t,this.val.trainable=t},enumerable:!0,configurable:!0}),t}();function oe(t){return t.map(function(t){return t.read()})}function ae(t){t.forEach(function(t){t[0].write(t[1])})}var se,ue=function(t){this.dtype=t.dtype,this.shape=t.shape,null!=t.shape?this.ndim=t.shape.length:this.ndim=t.ndim,this.maxNDim=t.maxNDim,this.minNDim=t.minNDim,this.axes=t.axes||{}},ce=function(t,e,n,r,i,o,a){this.dtype=t,this.shape=e,this.sourceLayer=n,this.inputs=r,this.callArgs=i,this.outputTensorIndex=a,this.id=Xt(),null!=o&&(this.originalName=Q(o),this.name=tt(this.originalName)),this.rank=e.length},le=0,fe=function(){function t(t,e){this.callArgs=e,this.id=le++,this.outboundLayer=t.outboundLayer,this.inboundLayers=t.inboundLayers,this.nodeIndices=t.nodeIndices,this.tensorIndices=t.tensorIndices,this.inputTensors=t.inputTensors,this.outputTensors=t.outputTensors,this.inputMasks=t.inputMasks,this.outputMasks=t.outputMasks,this.inputShapes=t.inputShapes,this.outputShapes=t.outputShapes;for(var n=0,r=t.inboundLayers;n<r.length;n++){var i=r[n];null!=i&&i.outboundNodes.push(this)}t.outboundLayer.inboundNodes.push(this)}return t.prototype.getConfig=function(){for(var t=[],e=0,n=this.inboundLayers;e<n.length;e++){var r=n[e];null!=r?t.push(r.name):t.push(null)}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:t,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}},t}(),de=0,he=function(t){function e(e){var n=t.call(this)||this;n._callHook=null,n._addedWeightNames=[],n._stateful=!1,n.id=de++,n.activityRegularizer=null,n.inputSpec=null,n.supportsMasking=!1,n._trainableWeights=[],n._nonTrainableWeights=[],n._losses=[],n._updates=[],n._built=!1,n.inboundNodes=[],n.outboundNodes=[];var r=e.name;if(!r){var i=n.getClassName();r=x(i)+"_"+Jt(i)}if(n.name=r,n.trainable_=null==e.trainable||e.trainable,null!=e.inputShape||null!=e.batchInputShape){var o=void 0;if(null!=e.batchInputShape)o=e.batchInputShape;else if(null!=e.inputShape){var a=null;null!=e.batchSize&&(a=e.batchSize),o=[a].concat(e.inputShape)}n.batchInputShape=o;var s=e.dtype;null==s&&(s=e.inputDType),null==s&&(s="float32"),n.dtype=s}return null!=e.weights?n.initialWeights=e.weights:n.initialWeights=null,n._refCount=null,n.fastWeightInitDuringBuild=!1,n}return o(e,t),e.nodeKey=function(t,e){return t.name+"_ib-"+e.toString()},e.prototype.getNodeAtIndex=function(t,e){if(0===this.inboundNodes.length)throw new d("The layer has never been called and thus has no defined "+e+".");if(this.inboundNodes.length<=t)throw new h("Asked to get "+e+" at node "+t+", but the layer has only "+this.inboundNodes.length+" inbound nodes.");return this.inboundNodes[t]},e.prototype.getInputAt=function(t){return y(this.getNodeAtIndex(t,"input").inputTensors)},e.prototype.getOutputAt=function(t){return y(this.getNodeAtIndex(t,"output").outputTensors)},Object.defineProperty(e.prototype,"input",{get:function(){if(this.inboundNodes.length>1)throw new f("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use `getInputAt(nodeIndex)` instead.');if(0===this.inboundNodes.length)throw new f("Layer "+this.name+" is not connected, no input to return.");return y(this.getNodeAtIndex(0,"input").inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"output",{get:function(){if(0===this.inboundNodes.length)throw new f("Layer "+this.name+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new f("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return y(this.getNodeAtIndex(0,"output").outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"losses",{get:function(){return this._losses},enumerable:!0,configurable:!0}),e.prototype.calculateLosses=function(){return this.losses.map(function(t){return t()})},Object.defineProperty(e.prototype,"updates",{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"built",{get:function(){return this._built},set:function(t){this._built=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trainable",{get:function(){return this.trainable_},set:function(t){this._trainableWeights.forEach(function(e){return e.trainable=t}),this.trainable_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trainableWeights",{get:function(){return this.trainable_?this._trainableWeights.filter(function(t){return t.trainable}):[]},set:function(t){this._trainableWeights=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this._trainableWeights.filter(function(t){return!t.trainable}).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)},set:function(t){this._nonTrainableWeights=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stateful",{get:function(){return this._stateful},enumerable:!0,configurable:!0}),e.prototype.resetStates=function(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")},e.prototype.assertInputCompatibility=function(t){if(t=w(t),null!=this.inputSpec&&0!==this.inputSpec.length){var e=w(this.inputSpec);if(t.length!==e.length)throw new h("Layer "+this.name+" expects "+e.length+" inputs, but it received "+t.length+" input tensors. Input received: "+t);for(var n=0;n<t.length;n++){var r=t[n],i=e[n];if(null!=i){var o=r.rank;if(null!=i.ndim&&o!==i.ndim)throw new h("Input "+n+" is incompatible with layer "+this.name+": expected ndim="+i.ndim+", found ndim="+o);if(null!=i.maxNDim&&o>i.maxNDim)throw new h("Input "+n+" is incompatible with layer "+this.name+": expected max_ndim="+i.maxNDim+", found ndim="+o);if(null!=i.minNDim&&o<i.minNDim)throw new h("Input "+n+" is incompatible with layer "+this.name+": expected min_ndim="+i.minNDim+", found ndim="+o+".");if(null!=i.dtype&&r.dtype!==i.dtype)throw new h("Input "+n+" is incompatible with layer "+this.name+" : expected dtype="+i.dtype+", found dtype="+r.dtype+".");if(i.axes){var a=r.shape;for(var s in i.axes){var u=Number(s),c=i.axes[s],l=u>=0?a[u]:a[a.length+u];if(null!=c&&-1===[c,null].indexOf(l))throw new h("Input "+n+" is incompatible with layer "+this.name+": expected axis "+u+" of input shape to have value "+c+" but got shape "+a+".")}}if(null!=i.shape)for(var f=0;f<i.shape.length;++f){var d=i.shape[f],p=r.shape[f];if(null!=d&&null!=p&&d!==p)throw new h("Input "+n+" is incompatible with layer "+this.name+": expected shape="+i.shape+", found shape="+r.shape+".")}}}}},e.prototype.call=function(t,e){return t},e.prototype.invokeCallHook=function(t,e){null!=this._callHook&&this._callHook(t,e)},e.prototype.setCallHook=function(t){this._callHook=t},e.prototype.clearCallHook=function(){this._callHook=null},e.prototype.apply=function(t,e){var n=this;e=e||{},this.assertNotDisposed();for(var r=w(t),i=!0,o=0,a=r;o<a.length;o++)if(!(a[o]instanceof ce)){i=!1;break}for(var s=!0,u=0,c=r;u<c.length;u++)if(c[u]instanceof ce){s=!1;break}if(i===s)throw new h("Arguments to apply() must be all SymbolicTensors or all Tensors");return Z(this.name,function(){if(!n.built){n.assertInputCompatibility(t);for(var i=[],o=0,a=w(t);o<a.length;o++){var u=a[o];i.push(u.shape)}n.build(y(i)),n.built=!0,n.initialWeights&&n.setWeights(n.initialWeights),null===n._refCount&&s&&(n._refCount=1)}if(n.assertInputCompatibility(t),s){for(var c=[],l=0,f=w(g=n.call(t,e));l<f.length;l++){var d=f[l];-1!==r.indexOf(d)&&(d=d.clone()),c.push(d)}if(g=y(c),null!=n.activityRegularizer)throw new p("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return g}var h=function(t){for(var e=[],n=0,r=t=w(t);n<r.length;n++){var i=r[n];e.push(i.shape)}return y(e)}(t),m=n.computeOutputShape(h),g=void 0,v="float32";if(n.warnOnIncompatibleInputShape(Array.isArray(t)?h[0]:h),g=null!=m&&m.length>0&&Array.isArray(m[0])?m.map(function(r,i){return new ce(v,r,n,w(t),e,n.name,i)}):new ce(v,m,n,w(t),e,n.name),n.addInboundNode(t,g,null,null,h,m,e),n._refCount++,null!=n.activityRegularizer)throw new p("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return g})},e.prototype.warnOnIncompatibleInputShape=function(t){if(null!=this.batchInputShape)if(t.length!==this.batchInputShape.length)console.warn("The rank of the input tensor provided (shape: "+JSON.stringify(t)+") does not match that of the batchInputShape ("+JSON.stringify(this.batchInputShape)+") of the layer "+this.name);else{var e=!1;this.batchInputShape.forEach(function(n,r){null!=n&&null!=t[r]&&t[r]!==n&&(e=!0)}),e&&console.warn("The shape of the input tensor ("+JSON.stringify(t)+") does not match the expectation of layer "+this.name+": "+JSON.stringify(this.batchInputShape))}},Object.defineProperty(e.prototype,"outputShape",{get:function(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new f("The layer "+this.name+" has never been called and thus has no defined output shape.");for(var t=[],e=0,n=this.inboundNodes;e<n.length;e++){var r=n[e],i=JSON.stringify(r.outputShapes);-1===t.indexOf(i)&&t.push(i)}if(1===t.length){var o=this.inboundNodes[0].outputShapes;return Array.isArray(o)&&Array.isArray(o[0])&&1===o.length?o[0]:o}throw new f("The layer "+this.name+' has multiple inbound nodes with different output shapes. Hence the notion of "outut shape" is ill-defined for the layer.')},enumerable:!0,configurable:!0}),e.prototype.countParams=function(){if(!this.built)throw new d("You tried to call countParams() on "+this.name+", but the layer is not built yet. Build it first by calling build(batchInputShape).");return ne(this.weights)},e.prototype.build=function(t){this.built=!0},e.prototype.getWeights=function(t){return void 0===t&&(t=!1),oe(t?this.trainableWeights:this.weights)},e.prototype.setWeights=function(t){var e=this;Object(r.tidy)(function(){var n=e.weights;if(n.length!==t.length)throw new h('You called setWeights(weights) on layer "'+e.name+'" with a weight list of length '+t.length+", but the layer was expecting "+n.length+" weights. Provided weights: "+t+"...");if(0!==n.length){for(var i=[],o=oe(n),a=0;a<o.length;++a){var s=o[a],u=n[a],c=t[a];if(!r.util.arraysEqual(s.shape,c.shape))throw new h("Layer weight shape "+s.shape+" not compatible with provided weight shape "+c.shape);i.push([u,c])}ae(i)}})},e.prototype.addWeight=function(t,e,n,r,i,o,a){if(-1!==this._addedWeightNames.indexOf(t))throw new h("Duplicate weight name "+t+" for layer "+this.name);this._addedWeightNames.push(t),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(r=$t("zeros"));var s=r.apply(e,n),u=new ie(s,n,t,o,a);return s.dispose(),null!=i&&this.addLoss(function(){return i.apply(u.read())}),null==o&&(o=!0),o?this._trainableWeights.push(u):this._nonTrainableWeights.push(u),u},e.prototype.setFastWeightInitDuringBuild=function(t){this.fastWeightInitDuringBuild=t},e.prototype.addLoss=function(t){var e;null==t||Array.isArray(t)&&0===t.length||(t=w(t),void 0!==this._losses&&null!==this._losses&&(e=this.losses).push.apply(e,t))},e.prototype.computeOutputShape=function(t){return t},e.prototype.computeMask=function(t,e){var n=this;if(!this.supportsMasking){if(null!=e){if(!Array.isArray(e))throw new TypeError("Layer "+this.name+" does not support masking, but was passed an inputMask.");e.forEach(function(t){if(null!=t)throw new TypeError("Layer "+n.name+" does not support masking, but was passed an inputMask.")})}return null}return e},e.prototype.addInboundNode=function(t,e,n,r,i,o,a){void 0===a&&(a=null);var s=w(t);e=w(e),n=w(n),r=w(r),i=Qt(i),o=Qt(o);for(var u=[],c=[],l=[],f=0,d=s;f<d.length;f++){var h=d[f];u.push(h.sourceLayer),c.push(h.nodeIndex),l.push(h.tensorIndex)}new fe({outboundLayer:this,inboundLayers:u,nodeIndices:c,tensorIndices:l,inputTensors:s,outputTensors:e,inputMasks:n,outputMasks:r,inputShapes:i,outputShapes:o},a);for(var p=0;p<e.length;p++)e[p].sourceLayer=this,e[p].nodeIndex=this.inboundNodes.length-1,e[p].tensorIndex=p},e.prototype.getConfig=function(){var t={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(t.batchInputShape=this.batchInputShape),null!=this.dtype&&(t.dtype=this.dtype),t},e.prototype.disposeWeights=function(){return this.weights.forEach(function(t){return t.dispose()}),this.weights.length},e.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error("Layer '"+this.name+"' is already disposed.")},e.prototype.dispose=function(){if(!this.built)throw new Error("Cannot dispose Layer "+this.name+" because it has not been built yet.");if(null===this._refCount)throw new Error("Cannot dispose Layer "+this.name+" because it has not been used yet.");this.assertNotDisposed();var t=0;return 0==--this._refCount&&(t=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:t}},e}(r.serialization.Serializable),pe=function(t){function e(e){var n=t.call(this,{dtype:e.dtype,name:null!=e.name?e.name:Jt("input").toString()})||this;if(null==e.batchSize&&(e.batchSize=null),null==e.sparse&&(e.sparse=!1),n.trainable=!1,n.built=!0,n.sparse=e.sparse,null!=e.inputShape&&null!=e.batchInputShape)throw new h("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");var r=e.batchInputShape;if(null==r){if(null==e.inputShape)throw new h("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");r=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new h("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");var i=e.dtype||"float32";n.batchInputShape=r,n.dtype=i,n.inputSpec=[{shape:r}];var o=new ce(n.dtype,n.batchInputShape,n,[],{},n.name);return o.nodeIndex=0,o.tensorIndex=0,new fe({outboundLayer:n,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[o],outputTensors:[o],inputMasks:[null],outputMasks:[null],inputShapes:[r],outputShapes:[r]}),n}return o(e,t),e.prototype.apply=function(t,e){throw new h("Cannot pass any input to an InputLayer's apply() method. InputLayer name: "+this.name)},e.prototype.dispose=function(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}},e.prototype.getConfig=function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}},e.className="InputLayer",e}(he);function me(t){if(null==t.batchShape&&null==t.shape)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");if(null!=t.batchShape&&null!=t.shape)throw new h("Please provide either a `shape` or `batchShape` argument to Input, but not both.");var e=t.batchShape;null!=t.shape&&null==e&&(e=[null].concat(t.shape));var n=t.dtype;return null==n&&(n="float32"),new pe({batchInputShape:e,name:t.name,dtype:n,sparse:t.sparse}).inboundNodes[0].outputTensors[0]}function ge(t){return u(this,void 0,void 0,function(){var e,n,i,o,a,s,u,l;return c(this,function(c){switch(c.label){case 0:if(null==t)return[2];for(o in e=[],n=[],i=[],t)"number"!=typeof(a=t[o])&&(s=a,e.push(s.data()),n.push(o),i.push(s));return e.length>0?[4,Promise.all(e)]:[3,2];case 1:for(u=c.sent(),l=0;l<u.length;++l)t[n[l]]=u[l][0];Object(r.dispose)(i),c.label=2;case 2:return[2]}})})}function ve(t){if(null!=t)for(var e in t){var n=t[e];"number"!=typeof n&&n.dispose()}}r.serialization.registerClass(pe),function(t){t[t.SILENT=0]="SILENT",t[t.VERBOSE=1]="VERBOSE"}(se||(se={}));var be=125,ye=function(){function t(){this.validationData=null}return t.prototype.setParams=function(t){this.params=t},t.prototype.onEpochBegin=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(t){return[2]})})},t.prototype.onEpochEnd=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(t){return[2]})})},t.prototype.onBatchBegin=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(t){return[2]})})},t.prototype.onBatchEnd=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(t){return[2]})})},t.prototype.onTrainBegin=function(t){return u(this,void 0,void 0,function(){return c(this,function(t){return[2]})})},t.prototype.onTrainEnd=function(t){return u(this,void 0,void 0,function(){return c(this,function(t){return[2]})})},t.prototype.setModel=function(t){},t}(),we=function(){function t(t,e){void 0===e&&(e=10),null==t&&(t=[]),this.callbacks=t,this.queueLength=e}return t.prototype.append=function(t){this.callbacks.push(t)},t.prototype.setParams=function(t){for(var e=0,n=this.callbacks;e<n.length;e++)n[e].setParams(t)},t.prototype.setModel=function(t){for(var e=0,n=this.callbacks;e<n.length;e++)n[e].setModel(t)},t.prototype.onEpochBegin=function(t,e){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==e&&(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onEpochBegin(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onEpochEnd=function(t,e){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==e&&(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onEpochEnd(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onBatchBegin=function(t,e){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==e&&(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onBatchBegin(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onBatchEnd=function(t,e){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==e&&(e={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onBatchEnd(t,e)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.onTrainBegin=function(t){return u(this,void 0,void 0,function(){var e,n;return c(this,function(r){switch(r.label){case 0:null==t&&(t={}),e=0,n=this.callbacks,r.label=1;case 1:return e<n.length?[4,n[e].onTrainBegin(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},t.prototype.onTrainEnd=function(t){return u(this,void 0,void 0,function(){var e,n;return c(this,function(r){switch(r.label){case 0:null==t&&(t={}),e=0,n=this.callbacks,r.label=1;case 1:return e<n.length?[4,n[e].onTrainEnd(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},t}(),xe=function(t){function e(){return t.call(this)||this}return o(e,t),e.prototype.onEpochBegin=function(t){return u(this,void 0,void 0,function(){return c(this,function(t){return this.seen=0,this.totals={},[2]})})},e.prototype.onBatchEnd=function(t,e){return u(this,void 0,void 0,function(){var t,n,i,o,a=this;return c(this,function(s){for(o in null==e&&(e={}),t=null==e.size?0:e.size,this.seen+=t,n=function(n){var o=e[n];if("number"==typeof o)i.totals.hasOwnProperty(n)||(i.totals[n]=0),i.totals[n]=i.totals[n]+o*t;else{var s=void 0;n in i.totals?s=i.totals[n]:i.totals[n]=0,i.totals[n]=Object(r.tidy)(function(){return Object(r.add)(a.totals[n],Object(r.mul)(o,t))}),null!=s&&s.dispose()}},i=this,e)n(o);return[2]})})},e.prototype.onEpochEnd=function(t,e){return u(this,void 0,void 0,function(){var t,n,i,o,a,s=this;return c(this,function(u){if(null!=e)for(t=function(t){if(null==n.totals[t])return"continue";"number"==typeof n.totals[t]?e[t]=n.totals[t]/n.seen:Object(r.tidy)(function(){e[t]=Object(r.mul)(Object(r.div)(1,s.seen),s.totals[t]),s.totals[t].dispose(),Object(r.keep)(e[t])})},n=this,i=0,o=this.params.metrics;i<o.length;i++)a=o[i],t(a);return[2]})})},e}(ye),_e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onTrainBegin=function(t){return u(this,void 0,void 0,function(){return c(this,function(t){return this.epoch=[],this.history={},[2]})})},e.prototype.onEpochEnd=function(t,e){return u(this,void 0,void 0,function(){var n;return c(this,function(r){for(n in null==e&&(e={}),this.epoch.push(t),e)null==this.history[n]&&(this.history[n]=[]),this.history[n].push(e[n]);return[2]})})},e.prototype.syncData=function(){return u(this,void 0,void 0,function(){var t,e,n,r,i,o,a,s,u;return c(this,function(c){switch(c.label){case 0:for(r in t=[],e=[],n=[],this.history)for(i=this.history[r],o=0;o<i.length;++o)"number"!=typeof i[o]&&(a=i[o],t.push(a.data()),e.push(r),n.push(o));return[4,Promise.all(t)];case 1:for(s=c.sent(),u=0;u<s.length;++u)this.history[e[u]][n[u]].dispose(),this.history[e[u]][n[u]]=s[u][0];return[2]}})})},e}(ye),ke=function(t){function e(e,n){var i=t.call(this)||this;if(i.currentEpoch=0,i.yieldEvery=n||"auto","auto"===i.yieldEvery&&(i.yieldEvery=be),"never"===i.yieldEvery&&null!=e.onYield)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");return r.util.isNumber(i.yieldEvery)&&(i.maybeWait=function(t,e){var n,i=r.util.now();return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=r.util.now();return s-i<e?n:(i=s,n=t.apply(void 0,o))}}(i.maybeWait.bind(i),i.yieldEvery)),i.trainBegin=e.onTrainBegin,i.trainEnd=e.onTrainEnd,i.epochBegin=e.onEpochBegin,i.epochEnd=e.onEpochEnd,i.batchBegin=e.onBatchBegin,i.batchEnd=e.onBatchEnd,i.yield=e.onYield,i}return o(e,t),e.prototype.maybeWait=function(t,e,n){return u(this,void 0,void 0,function(){var i;return c(this,function(o){switch(o.label){case 0:return i=[],null==this.yield?[3,2]:[4,ge(n)];case 1:o.sent(),i.push(this.yield(t,e,n)),o.label=2;case 2:return i.push(Object(r.nextFrame)()),[4,Promise.all(i)];case 3:return o.sent(),[2]}})})},e.prototype.onEpochBegin=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){switch(n.label){case 0:return this.currentEpoch=t,null==this.epochBegin?[3,3]:[4,ge(e)];case 1:return n.sent(),[4,this.epochBegin(t,e)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.onEpochEnd=function(t,e){return u(this,void 0,void 0,function(){var n;return c(this,function(i){switch(i.label){case 0:return n=[],null==this.epochEnd?[3,2]:[4,ge(e)];case 1:i.sent(),n.push(this.epochEnd(t,e)),i.label=2;case 2:return"epoch"===this.yieldEvery&&n.push(Object(r.nextFrame)()),[4,Promise.all(n)];case 3:return i.sent(),[2]}})})},e.prototype.onBatchBegin=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){switch(n.label){case 0:return null==this.batchBegin?[3,3]:[4,ge(e)];case 1:return n.sent(),[4,this.batchBegin(t,e)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.onBatchEnd=function(t,e){return u(this,void 0,void 0,function(){var n;return c(this,function(i){switch(i.label){case 0:return n=[],null==this.batchEnd?[3,2]:[4,ge(e)];case 1:i.sent(),n.push(this.batchEnd(t,e)),i.label=2;case 2:return"batch"===this.yieldEvery?n.push(Object(r.nextFrame)()):r.util.isNumber(this.yieldEvery)&&n.push(this.maybeWait(this.currentEpoch,t,e)),[4,Promise.all(n)];case 3:return i.sent(),[2]}})})},e.prototype.onTrainBegin=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return null==this.trainBegin?[3,3]:[4,ge(t)];case 1:return e.sent(),[4,this.trainBegin(t)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},e.prototype.onTrainEnd=function(t){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return null==this.trainEnd?[3,3]:[4,ge(t)];case 1:return e.sent(),[4,this.trainEnd(t)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},e}(ye);function Se(t,e){return null==t&&(t={}),t instanceof ye?[t]:Array.isArray(t)&&t[0]instanceof ye?t:w(t).map(function(t){return new ke(t,e)})}var Ee=function(){function t(){}return t.registerCallbackConstructor=function(e,n){r.util.assert(e>=0&&Number.isInteger(e),function(){return"Verbosity level is expected to be an integer >= 0, but got "+e}),t.checkForDuplicate(n),null==t.constructors[e]&&(t.constructors[e]=[]),t.constructors[e].push(n)},t.checkForDuplicate=function(e){for(var n in t.constructors)t.constructors[+n].forEach(function(t){if(t===e)throw new h("Duplicate callback constructor.")})},t.clear=function(){t.constructors={}},t.createCallbacks=function(e){var n=[];for(var r in t.constructors){var i=+r;e>=i&&n.push.apply(n,t.constructors[i])}return n.map(function(t){return new t})},t.constructors={},t}();function Oe(t,e,n,r,i,o,a,s,u){var c=new _e,l=[new xe].concat(Ee.createCallbacks(e));null!=t&&l.push.apply(l,t),l.push(c);var f=new we(l);return f.setParams({epochs:n,initialEpoch:r,samples:i,steps:o,batchSize:a,verbose:e,doValidation:s,metrics:u}),{callbackList:f,history:c}}function Ae(t,e){return Object(r.tidy)(function(){"float32"!==t.dtype&&(t=t.asType("float32"));var n=Object(r.sum)(wt(t),e,!0),i=Object(r.fill)(n.shape,l()),o=Object(r.sqrt)(Object(r.maximum)(n,i));return Object(r.div)(t,o)})}function Ce(t,e){return Object(r.tidy)(function(){return Object(r.mean)(wt(Object(r.sub)(e,t)),-1)})}function Me(t,e){return Object(r.tidy)(function(){return Object(r.mean)(Object(r.abs)(Object(r.sub)(e,t)),-1)})}function Ne(t,e){return Object(r.tidy)(function(){var n=Object(r.sub)(t,e),i=Object(r.clipByValue)(Object(r.abs)(t),l(),Number.MAX_VALUE),o=Object(r.abs)(Object(r.div)(n,i));return Object(r.mul)(100,Object(r.mean)(o,-1))})}function Te(t,e,n){return void 0===n&&(n=!1),Object(r.tidy)(function(){if(n)e=Object(r.softmax)(e);else{var i=Object(r.sum)(e,e.shape.length-1,!0);e=Object(r.div)(e,i)}return e=Object(r.clipByValue)(e,l(),1-l()),Object(r.neg)(Object(r.sum)(Object(r.mul)(t.toFloat(),Object(r.log)(e)),e.shape.length-1))})}function Ie(t,e){return Object(r.tidy)(function(){var n=Object(r.floor)(function(t){var e=[it(t.shape)];return t.reshape(e)}(t)).toInt(),i=(e=Object(r.clipByValue)(e,l(),1-l())).shape;return Te(Object(r.oneHot)(n,i[i.length-1]).reshape(i),e,!1)})}function De(t,e){return Object(r.tidy)(function(){var n;return n=Object(r.clipByValue)(e,l(),1-l()),n=Object(r.log)(Object(r.div)(n,Object(r.sub)(1,n))),Object(r.mean)(function(t,e){if(!r.util.arraysEqual(t.shape,e.shape))throw new h("logits and labels must have the same shape, but got shapes "+JSON.stringify(t.shape)+" and "+JSON.stringify(e.shape));return Object(r.tidy)(function(){var n=e.relu(),r=e.abs().neg();return n.sub(e.mul(t)).add(r.exp().log1p())})}(t,n),-1)})}function je(t,e){return Object(r.tidy)(function(){var n=Ae(t,-1),i=Ae(e,-1),o=Object(r.mul)(n,i);return Object(r.neg)(Object(r.sum)(o,-1))})}var Re={meanSquaredError:Ce,meanAbsoluteError:Me,meanAbsolutePercentageError:Ne,meanSquaredLogarithmicError:function(t,e){return Object(r.tidy)(function(){var n=Object(r.clipByValue)(e,l(),Number.MAX_VALUE),i=Object(r.log)(Object(r.add)(1,n)),o=Object(r.clipByValue)(t,l(),Number.MAX_VALUE),a=Object(r.log)(Object(r.add)(1,o));return Object(r.mean)(wt(Object(r.sub)(i,a)),-1)})},squaredHinge:function(t,e){return Object(r.tidy)(function(){var n=Object(r.maximum)(0,Object(r.sub)(1,Object(r.mul)(t,e)));return Object(r.mean)(wt(n),-1)})},hinge:function(t,e){return Object(r.tidy)(function(){var n=Object(r.maximum)(0,Object(r.sub)(1,Object(r.mul)(t,e)));return Object(r.mean)(n,-1)})},categoricalHinge:function(t,e){return Object(r.tidy)(function(){var n=Object(r.sum)(Object(r.mul)(t,e),-1),i=Object(r.max)(Object(r.mul)(Object(r.sub)(1,t),e),-1);return Object(r.maximum)(0,Object(r.add)(1,Object(r.sub)(i,n)))})},logcosh:function(t,e){return Object(r.tidy)(function(){var n=Math.log(2),i=Object(r.sub)(e,t),o=Object(r.sub)(Object(r.add)(i,Object(r.softplus)(Object(r.mul)(-2,i))),n);return Object(r.mean)(o,-1)})},categoricalCrossentropy:Te,sparseCategoricalCrossentropy:Ie,binaryCrossentropy:De,kullbackLeiblerDivergence:function(t,e){return Object(r.tidy)(function(){var n=Object(r.clipByValue)(t,l(),1),i=Object(r.clipByValue)(e,l(),1);return Object(r.sum)(Object(r.mul)(t,Object(r.log)(Object(r.div)(n,i))),-1)})},poisson:function(t,e){return Object(r.tidy)(function(){var n=Object(r.log)(Object(r.add)(l(),e));return Object(r.mean)(Object(r.sub)(e,Object(r.mul)(t,n)),-1)})},cosineProximity:je};function Fe(t){if("string"==typeof t){if(t in Re)return Re[t];var e="Unknown loss "+t;throw t.toLowerCase().includes("softmaxcrossentropy")&&(e="Unknown loss "+t+'. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'),new h(e)}return t}function Pe(t,e){return Object(r.tidy)(function(){var n=Object(r.mul)(.5,Object(r.onesLike)(e)),i=ct(Object(r.greater)(e,n),t.dtype);return Object(r.mean)(Object(r.equal)(t,i),-1)})}function ze(t,e){return Object(r.tidy)(function(){return ct(Object(r.equal)(Object(r.argMax)(t,-1),Object(r.argMax)(e,-1)),"float32")})}function Le(t,e){return Object(r.tidy)(function(){return Object(r.logicalAnd)(t.equal(1),e.equal(1)).sum().cast("float32")})}function Be(t,e){return Object(r.tidy)(function(){var n=Le(t,e),i=function(t,e){return Object(r.tidy)(function(){return Object(r.logicalAnd)(t.equal(0),e.equal(1)).sum().cast("float32")})}(t,e),o=n.add(i);return Object(r.where)(Object(r.greater)(o,0),n.div(o),0).cast("float32")})}function Ue(t,e){return De(t,e)}function We(t,e){return t.rank===e.rank&&(t=t.squeeze([t.rank-1])),(e=e.argMax(-1)).dtype!==t.dtype&&(e=e.asType(t.dtype)),Object(r.equal)(t,e).asType("float32")}var qe=Te,Ve=Ie,He={binaryAccuracy:Pe,categoricalAccuracy:ze,precision:Be,categoricalCrossentropy:qe,sparseCategoricalCrossentropy:Ve,mse:Ce,MSE:Ce,mae:Me,MAE:Me,mape:Ne,MAPE:Ne,cosine:je};function $e(t,e,n){void 0===n&&(n=console.log);for(var r="",i=0;i<t.length;++i)i>0&&(r=r.slice(0,r.length-1)+" "),r=(r+=t[i]).slice(0,e[i]),r+=" ".repeat(e[i]-r.length);n(r)}function Ge(t,e,n){var r;try{r=JSON.stringify(t.outputShape)}catch(t){r="multiple"}$e([t.name+" ("+t.getClassName()+")",r,t.countParams().toString()],e,n)}function Ke(t,e,n,r){var i;try{i=JSON.stringify(t.outputShape)}catch(t){i="multiple"}for(var o=[],a=0,s=t.inboundNodes;a<s.length;a++){var u=s[a];if(!(null!=n&&n.length>0&&-1===n.indexOf(u)))for(var c=0;c<u.inboundLayers.length;++c){var l=u.inboundLayers[c].name,f=u.nodeIndices[c],d=u.tensorIndices[c];o.push(l+"["+f+"]["+d+"]")}}var h=t.name,p=t.getClassName(),m=0===o.length?"":o[0];for($e([h+" ("+p+")",i,t.countParams().toString(),m],e,r),c=1;c<o.length;++c)$e(["","","",o[c]],e,r)}function Xe(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=!1),E(t,r.serialization.SerializationMap.getMap().classNameMap,e,"layer",n)}function Ye(t,e,n){return("inboundNodes"===t||"outputLayers"===t||"inputLayers"===t)&&0===e&&"string"==typeof n}function Je(t,e){if(null===t)return null;if("string"==typeof t)return _(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){for(var n=[],r=t.length,i=0;i<r;++i){var o=t[i];Ye(e,i,o)?n.push(o):n.push(Je(o,e))}return n}for(var a={},s=0,u=Object.keys(t);s<u.length;s++){var c=u[s],l=t[c];if("name"===c&&"string"==typeof l)a[c]=l;else{var f=_(c);a[f]=Je(l,f)}}return a}var Ze=function(){function t(e){if(this.id2Value={},this.id2Mask={},this.name2Id={},e instanceof t)for(var n in e.id2Value)this.id2Value[n]=e.id2Value[n],n in e.id2Mask&&(this.id2Mask[n]=e.id2Mask[n]);else{if(null==e)return;for(var r=0,i=e;r<i.length;r++){var o=i[r];this.add(o.key,o.value)}}}return t.prototype.add=function(t,e,n){if(null!=this.id2Value[t.id])throw new h("Duplicate key: name="+t.name+", id="+t.id);return this.id2Value[t.id]=function(t,e){if(null==t.dtype||t.dtype===e.dtype)return e;try{return Object(r.cast)(e,t.dtype)}catch(n){throw new h("The dtype of the feed ("+e.dtype+") can not be cast to the dtype of the key '"+t.name+"' ("+t.dtype+").")}}(t,e),this.name2Id[t.name]=t.id,null!=n&&(this.id2Mask[t.id]=n),this},t.prototype.addFeed=function(t){this.add(t.key,t.value)},t.prototype.hasKey=function(t){return null!=this.id2Value[t.id]},t.prototype.names=function(){return Object.keys(this.name2Id)},t.prototype.getValue=function(t){if(t instanceof ce){if(null==this.id2Value[t.id])throw new h("Nonexistent key: "+t.name);return this.id2Value[t.id]}var e=this.name2Id[t];if(null==e)throw new h("Feed dict has no SymbolicTensor name: "+t);return this.id2Value[e]},t.prototype.getMask=function(t){if(t instanceof ce){if(null==this.id2Value[t.id])throw new h("Nonexistent key: "+t.name);return this.id2Mask[t.id]}var e=this.name2Id[t];if(null==e)throw new h("Feed dict has no SymbolicTensor name: "+t);return this.id2Mask[e]},t.prototype.disposeMasks=function(){null!=this.id2Mask&&Object(r.dispose)(this.id2Mask)},t}(),Qe={},tn={};function en(t,e,n,i){for(var o=null!=n&&n.training,a=Array.isArray(t),s=a?t:[t],u=s.map(function(t){return t.name}),c=[],l=e.names(),f=0,d=u;f<d.length;f++){var h=d[f];-1!==l.indexOf(h)?c.push(e.getValue(h)):c.push(null)}null!=i&&(i.maxNumTensors=-1/0,i.minNumTensors=1/0);var p,m,g=u.join(",")+"|"+e.names().join(",");if(null==Qe[g]){var v=function(t,e){r.util.assert(null!=t&&t.length>0,function(){return"Expected at least one fetch, got none"});var n=[],i={};if(1===t.length){var o=nn(t[0],e);n=o.sorted,i=o.recipientMap}else for(var a=new Set,s=0,u=t;s<u.length;s++){for(var c=nn(u[s],e),l=c.sorted,f=c.recipientMap,d=0,h=l;d<h.length;d++){var p=h[d];a.has(p.name)||(n.push(p),a.add(p.name))}var m=function(t){null==i[t]&&(i[t]=new Set),f[t].forEach(function(e){return i[t].add(e)})};for(var g in f)m(g)}return{sorted:n,recipientCounts:function(t){var e={};for(var n in t)e[n]=t[n].size;return e}(i)}}(s,e);p=v.sorted,m=v.recipientCounts,Qe[g]=p,tn[g]=m}p=Qe[g],m={},o||Object.assign(m,tn[g]);for(var b=new Ze(e),y=0;y<p.length;++y){if(null!=i){var x=Object(r.memory)().numTensors;x>i.maxNumTensors&&(i.maxNumTensors=x),x<i.minNumTensors&&(i.minNumTensors=x)}var _=p[y],k=_.sourceLayer;if(!(k instanceof pe)){for(var S=[],E=[],O=[],A=!1,C=0,M=_.inputs;C<M.length;C++){var N=M[C],T=b.getValue(N),I=b.getMask(N);S.push(T),E.push(I),null!=I&&(A=!0),o||(m[N.name]--,0!==m[N.name]||e.hasKey(N)||-1!==u.indexOf(N.name)||T.isDisposed||!0===N.sourceLayer.stateful||O.push(T))}A&&((n=n||{}).mask=E[0]);var D=w(k.apply(S,n)),j=null;k.supportsMasking&&(j=k.computeMask(S,E));for(var R=rn(_),F=Array.isArray(R)?R:[R],P=0;P<F.length;++P){b.hasKey(F[P])||b.add(F[P],D[P],Array.isArray(j)?j[0]:j);var z=u.indexOf(F[P].name);-1!==z&&(c[z]=D[P])}o||Object(r.dispose)(O)}}return b.disposeMasks(),a?c:c[0]}function nn(t,e){for(var n=new Set,r=[],i={},o=0,a=e.names();o<a.length;o++){var s=a[o];n.add(s)}var u=[],c=[];for(u.push(t);u.length>0;){var l=u[u.length-1];if(n.has(l.name))u.pop();else{var f=c[c.length-1]===u.length-1;if(0===l.inputs.length||f)u.pop(),r.push(l),n.add(l.name),f&&c.pop();else{c.push(u.length-1);for(var d=0,h=l.inputs;d<h.length;d++){var p=h[d];null==i[p.name]&&(i[p.name]=new Set),i[p.name].add(l.name),n.has(p.name)||u.push(p)}}}}return{sorted:r,recipientMap:i}}function rn(t){var e;if(1===t.sourceLayer.inboundNodes.length)e=t.sourceLayer.output;else{for(var n=null,r=0;r<t.sourceLayer.inboundNodes.length;++r)for(var i=0,o=t.sourceLayer.inboundNodes[r].outputTensors;i<o.length;i++)if(o[i].id===t.id){n=r;break}e=t.sourceLayer.getOutputAt(n)}return e}var on=32;function an(t,e){var n,i,o=e;n=o.xs,i=o.ys,r.util.assert(null!=n&&null!=i,function(){return"A Dataset iterator for fitDataset() is expected to generate objects of the form `{xs: xVal, ys: yVal}`, where the two values may be `tf.Tensor`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates "+e});var a=sn("input",t.inputNames,n),s=sn("output",t.outputNames,i),u=a[0].shape[0];r.util.assert(a.length===t.inputs.length,function(){return"LayersModel has "+t.inputs.length+" inputs, but the dataset provides "+a.length+" inputs. (Expected input keys: "+JSON.stringify(t.inputNames)+")"}),r.util.assert(s.length===t.outputs.length,function(){return"LayersModel has "+t.outputs.length+" outputs, but the dataset provides "+s.length+" outputs. (Expected output keys: "+JSON.stringify(t.outputNames)+")"});var c=function(e){r.util.assert(a[e].shape[0]===u,function(){return"Batch size mismatch: input "+t.inputNames[e]+" has "+a[e].shape[0]+"; expected "+u+" based on input "+t.inputNames[0]+"."})};for(var l in a)c(l);var f=function(e){r.util.assert(s[e].shape[0]===u,function(){return"Batch size mismatch: output "+t.outputNames[e]+" has "+s[e].shape[0]+"; expected "+u+" based on input "+t.inputNames[0]+"."})};for(var d in s)f(d);return a.concat(s)}function sn(t,e,n){if(n instanceof r.Tensor)return[n];if(Array.isArray(n))return r.util.assert(n.length===e.length,function(){return"Received an array of "+n.length+" Tensors, but expected "+e.length+" to match the "+t+" keys "+e+"."}),n;for(var i=[],o=0,a=e;o<a.length;o++){var s=a[o];if(null==n[s])throw new h("The feature data generated by the dataset lacks the required "+t+" key '"+s+"'.");i.push(n[s])}return i}function un(t){return"function"==typeof t.iterator}function cn(t){r.util.assert(t>0&&Number.isInteger(t),function(){return"batchSize is required to be a positive integer, but got "+t})}function ln(t,e,n){return null==t?[null]:Array.isArray(t)?t.map(function(t){return ft(t,e,n-e)}):ft(t,e,n-e)}function fn(t,e){return Object(r.tidy)(function(){return null==t?null:Array.isArray(t)?t.map(function(t){return fn(t,e)}):yt(t,"int32"===e.dtype?e:e.toInt())})}function dn(t,e){for(var n=[],r=0,i=null;r<t;)(i=r+e)>=t&&(i=t),n.push([r,i]),r=i;return n}function hn(t,e,n,i){return void 0===i&&(i={}),u(this,void 0,void 0,function(){var o,a,s,l,f,d,m,g,v,b,y,w,x,_,k,S,E,O,A;return c(this,function(C){switch(C.label){case 0:if(t.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");t.isTraining=!0,C.label=1;case 1:if(C.trys.push([1,,3,4]),cn(m=null==i.batchSize?32:i.batchSize),g=t.standardizeUserData(e,n,!1,m),o=g[0],a=g[1],v=!1,b=void 0,null!=i.validationData&&i.validationData.length>0){if(v=!0,2!==i.validationData.length)throw 3===i.validationData.length?new p("validationData including sample weights is not supported yet."):new h("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+i.validationData+" is invalid.");s=i.validationData[0],l=i.validationData[1],y=t.standardizeUserData(s,l,!0,m),f=y[0],d=y[1],b=f.concat(d)}else null!=i.validationSplit&&i.validationSplit>0&&i.validationSplit<1?(v=!0,w=Math.floor(o[0].shape[0]*(1-i.validationSplit)),x=o[0].shape[0],f=ln(o,w,x),o=ln(o,0,w),d=ln(a,w,x),a=ln(a,0,w),b=f.concat(d)):null!=i.validationSteps&&(v=!0);return _=o.concat(a),t.checkTrainableWeightsConsistency(),k=t.makeTrainFunction(),S=t.getDedupedMetricsNames(),E=void 0,O=void 0,v?(t.makeTestFunction(),E=t.testFunction,O=S.slice().concat(S.map(function(t){return"val_"+t}))):(E=null,b=[],O=S.slice()),A=Se(i.callbacks,i.yieldEvery),[4,function(t,e,n,i,o,a,s,l,f,d,h,m,g,v,b){return u(this,void 0,void 0,function(){var u,b,y,w,x,_,k,S;return c(this,function(E){switch(E.label){case 0:return null==o&&(o=32),null==a&&(a=1),null==h&&(h=!0),null==g&&(g=0),u=!1,null!=f&&null!=d&&(u=!0),null!=(b=t.checkNumSamples(n,o,v,"steps_per_epoch"))&&(y=ut(0,b)),null==s&&(s=1),w=Oe(l,s,a,g,b,v,o,u,m),x=w.callbackList,_=w.history,x.setModel(t),t.history=_,[4,x.onTrainBegin()];case 1:E.sent(),t.stopTraining_=!1,k=function(a){var s,l,m,g,v;return c(this,function(w){switch(w.label){case 0:return[4,x.onEpochBegin(a)];case 1:return w.sent(),s={},[3,2];case 2:if("batch"===h)throw new p("batch shuffling is not implemneted yet");h&&r.util.shuffle(y),l=Object(r.tensor1d)(y),m=dn(b,o),g=function(a){var h;return c(this,function(c){switch(c.label){case 0:return h={},[4,x.onBatchBegin(a,h)];case 1:return c.sent(),Object(r.tidy)(function(){var c=m[a][0],p=m[a][1],g=ft(l,c,p-c);h.batch=a,h.size=p-c;for(var v=fn(n,g),b=e(v),y=0;y<i.length;++y){var w=i[y],x=b[y];h[w]=x,Object(r.keep)(x)}if(a===m.length-1&&u){var _=t.testLoop(f,d,o);for(y=0;y<i.length;++y)w=i[y],x=_[y],Object(r.keep)(x),s["val_"+w]=x}}),[4,x.onBatchEnd(a,h)];case 2:return c.sent(),ve(h),t.stopTraining_?[2,"break"]:[2]}})},v=0,w.label=3;case 3:return v<m.length?[5,g(v)]:[3,6];case 4:if("break"===w.sent())return[3,6];w.label=5;case 5:return++v,[3,3];case 6:l.dispose(),w.label=7;case 7:return[4,x.onEpochEnd(a,s)];case 8:return w.sent(),t.stopTraining_?[2,"break"]:[2]}})},S=g,E.label=2;case 2:return S<a?[5,k(S)]:[3,5];case 3:if("break"===E.sent())return[3,5];E.label=4;case 4:return++S,[3,2];case 5:return[4,x.onTrainEnd()];case 6:return E.sent(),[4,t.history.syncData()];case 7:return E.sent(),[2,t.history]}})})}(t,k,_,S,m,i.epochs,i.verbose,A,E,b,i.shuffle,O,i.initialEpoch,null)];case 2:return[2,C.sent()];case 3:return t.isTraining=!1,mn(o,e),mn(a,n),mn(f,s),mn(d,l),[7];case 4:return[2]}})})}function pn(t){var e=[];t instanceof r.Tensor&&(t=[t]);for(var n=0;n<t.length;++n){var i=t[n];if(1===i.rank)e.push(lt(i,1));else{if(0===i.rank)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");e.push(i)}}return e}function mn(t,e){if(null!=t){var n=[];if(e instanceof r.Tensor)n.push(e.id);else if(Array.isArray(e))e.forEach(function(t){return n.push(t.id)});else if(null!=e)for(var i in e){var o=e[i];n.push(o.id)}var a=[];if(t instanceof r.Tensor)-1===n.indexOf(t.id)&&a.push(t);else if(Array.isArray(t))t.forEach(function(t){-1===n.indexOf(t.id)&&a.push(t)});else if(null!=t)for(var s in t){var u=t[s];-1===n.indexOf(u.id)&&a.push(u)}a.forEach(function(t){t.isDisposed||t.dispose()})}}function gn(t){return Array.isArray(t)}function vn(t){return!function(t){return t instanceof r.Tensor}(t)&&!gn(t)}function bn(t,e,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=""),null==e||0===e.length){if(null!=t){var o=!1;if(gn(t)&&t.length>0)o=!0;else if(vn(t)){for(var a in t)if(t.hasOwnProperty(a)){o=!0;break}}else o=!0;if(o)throw new h("Error when checking model "+i+" expected no data, but got "+t)}return[]}if(null==t)return e.map(function(t){return null});var s;if(vn(t)){t=t,s=[];for(var u=0,c=e;u<c.length;u++){var l=c[u];if(null==t[l])throw new h('No data provided for "'+l+'". Need data for each key in: '+e);s.push(t[l])}}else if(gn(t)){if((t=t).length!==e.length)throw new h("Error when checking model "+i+": the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see "+e.length+" Tensor(s), but instead got the following list of Tensor(s): "+t);s=t}else{if(t=t,e.length>1)throw new h("The model "+i+" expects "+e.length+" Tensor(s), but only received one Tensor. Found: Tensor with shape "+t.shape);s=[t]}if(s=pn(s),null!=n)for(var f=0;f<e.length;++f)if(null!=n[f]){var d=s[f];if(d.shape.length!==n[f].length)throw new h("Error when checking "+i+": expected "+e[f]+" to have "+n[f].length+" dimension(s). but got array with shape "+d.shape);for(var p=0;p<n[f].length;++p)if(0!==p||r){var m=d.shape[p],g=n[f][p];if(null!=g&&g>=0&&m!==g)throw new h("Error when checking "+i+": expected "+e[f]+" to have shape ["+n[f]+"], but got array with shape ["+d.shape+"].")}}return s}function yn(t,e,n,r,i){var o;if(void 0===r&&(r=!0),void 0===i&&(i=""),Array.isArray(t)){if(t.length!==e.length)throw new h("Error when checking model "+i+": the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see "+e.length+" Tensor(s), but instead got "+t.length+" Tensors(s).");o=t}else{if(e.length>1)throw new h("The model expects "+e.length+" "+i+" Tensors, but only received one Tensor. Found: array with shape "+JSON.stringify(t.shape)+".");o=[t]}if(null!=n)for(var a=0;a<e.length;++a)if(null!=n[a]){var s=o[a];if(s.shape.length!==n[a].length)throw new h("Error when checking "+i+": expected "+e[a]+" to have "+n[a].length+" dimension(s), but got array with shape "+JSON.stringify(s.shape));for(var u=0;u<n[a].length;++u)if(0!==u||r){var c=s.shape[u],l=n[a][u];if(null!=l&&l!==c)throw new h("Error when checking "+i+": expected "+e[a]+" to have shape "+JSON.stringify(n[a])+" but got array with shape "+JSON.stringify(s.shape)+".")}}}var wn=function(t){function e(e){var n=t.call(this,e)||this;return n.isTraining=!1,n}return o(e,t),e.prototype.summary=function(t,e,n){if(void 0===n&&(n=console.log),!this.built)throw new h("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");!function(t,e,n,r){void 0===r&&(r=console.log);var i,o=function(t){var e=!0,n=[],r=[];for(var i in t.nodesByDepth)n.push(t.nodesByDepth[i]);for(var o=0,a=n;o<a.length;o++){var s=a[o];if(s.length>1||1===s.length&&s[0].inboundLayers.length>1){e=!1;break}r.push.apply(r,s)}if(e)for(var u=0,c=t.layers;u<c.length;u++){for(var l=!1,f=0,d=c[u].inboundNodes;f<d.length;f++){var h=d[f];if(-1!==r.indexOf(h)){if(l){e=!1;break}l=!0}}if(!e)break}return e}(t),a=["Layer (type)","Output shape","Param #"];if(o?(e=e||65,n=n||[.45,.85,1]):(e=e||98,n=n||[.33,.55,.67,1]),n[n.length-1]<=1&&(n=n.map(function(t){return Math.floor(e*t)})),!o)for(var s in a.push("Receives inputs"),i=[],t.nodesByDepth)i.push.apply(i,t.nodesByDepth[s]);r("_".repeat(e)),$e(a,n,r),r("=".repeat(e));for(var u=t.layers,c=0;c<u.length;++c)o?Ge(u[c],n,r):Ke(u[c],n,i,r),r((c===u.length-1?"=":"_").repeat(e));t.checkTrainableWeightsConsistency();var l=function(t){return null!=t.collectedTrainableWeights?ne(t.collectedTrainableWeights):ne(t.trainableWeights)}(t),f=ne(t.nonTrainableWeights);r("Total params: "+(l+f)),r("Trainable params: "+l),r("Non-trainable params: "+f),r("_".repeat(e))}(this,t,e,n)},e.prototype.compile=function(t){var e=this;if(null==t.loss&&(t.loss=[]),this.loss=t.loss,"string"==typeof t.optimizer)this.optimizer_=function(t){var e={Adagrad:function(){return r.train.adagrad(.01)},Adadelta:function(){return r.train.adadelta(1,.95,l())},Adam:function(){return r.train.adam(.001,.9,.999,l())},Adamax:function(){return r.train.adamax(.002,.9,.999,l(),0)},RMSProp:function(){return r.train.rmsprop(.001,.9,0,l())},SGD:function(){return r.train.sgd(.01)}};if(e.adagrad=e.Adagrad,e.adadelta=e.Adadelta,e.adam=e.Adam,e.adamax=e.Adamax,e.rmsprop=e.RMSProp,e.sgd=e.SGD,t in e)return e[t]();throw new h("Unknown Optimizer "+t)}(t.optimizer),this.isOptimizerOwned=!0;else{if(!(t.optimizer instanceof r.Optimizer))throw new h("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=t.optimizer,this.isOptimizerOwned=!1}var n=[];if(Array.isArray(t.loss)||"string"==typeof t.loss||"function"==typeof t.loss)if(Array.isArray(t.loss)){if(t.loss.length!==this.outputs.length)throw new h("When passing an Array as loss, it should have one entry per model output. The model has "+this.outputs.length+" output(s), but you passed loss="+t.loss+".");var i=t.loss;n=i.map(function(t){return Fe(t)})}else{var o=Fe(t.loss);this.outputs.forEach(function(t){n.push(o)})}else{for(var a in t.loss=t.loss,t.loss)if(-1===this.outputNames.indexOf(a))throw new h('Unknown entry in loss dictionary: "'+a+'". Only expected the following keys: '+this.outputNames);for(var s=0,u=this.outputNames;s<u.length;s++){var c=u[s];null==t.loss[c]&&console.warn('Output "'+c+'" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to '+c+" during training"),n.push(Fe(t.loss[c]))}}this.lossFunctions=n,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(var f=0;f<this.outputs.length;++f){var d=this.internalOutputShapes[f],p=this.outputNames[f];this.feedOutputNames.push(p),this.feedOutputShapes.push(d),this.feedLossFns.push(this.lossFunctions[f])}var m=[];this.metrics=t.metrics,this.metricsNames=["loss"],this.metricsTensors=[],Z("loss",function(){for(var t=0;t<e.outputs.length;++t)if(-1===m.indexOf(t)){var n=e.lossFunctions[t];e.outputs.length>1&&(e.metricsTensors.push([n,t]),e.metricsNames.push(e.outputNames[t]+"_loss"))}});var g=function(t,e){if(null==t||Array.isArray(t)&&0===t.length)return e.map(function(t){return[]});var n;if("string"==typeof t||"function"==typeof t)n=[t];else{if(!Array.isArray(t)&&"object"!=typeof t)throw new TypeError("Type of metrics argument not understood. Expected an string,function, Array, or Object, found: "+t);n=t}if(Array.isArray(n))return e.map(function(t){return n});for(var r=[],i=0,o=e;i<o.length;i++){var a=o[i],s=n.hasOwnProperty(a)?n[a]:[];Array.isArray(s)||(s=[s]),r.push(s)}return r}(t.metrics,this.outputNames);Z("metric",function(){for(var t=function(t){if(-1!==m.indexOf(t))return"continue";!function(n){for(var r,i,o,a=function(n){if("string"==typeof n&&-1!==["accuracy","acc","crossentropy","ce"].indexOf(n)){var a=e.internalOutputShapes[t];1===a[a.length-1]||e.lossFunctions[t]===De?-1!==["accuracy","acc"].indexOf(n)?i=Pe:-1!==["crossentropy","ce"].indexOf(n)&&(i=Ue):e.lossFunctions[t]===Ie?-1!==["accuracy","acc"].indexOf(n)?i=We:-1!==["crossentropy","ce"].indexOf(n)&&(i=Ve):-1!==["accuracy","acc"].indexOf(n)?i=ze:-1!==["crossentropy","ce"].indexOf(n)&&(i=qe);var s=void 0;-1!==["accuracy","acc"].indexOf(n)?s="acc":-1!==["crossentropy","ce"].indexOf(n)&&(s="ce"),o=i,r=""+s}else{var u=function(t){if("string"==typeof t&&t in He)return He[t];if("string"!=typeof t&&null!=t)return t;throw new h("Unknown metric "+t)}(n);o=u,r=""+function(t){if(v(null!==t,"Unknown LossOrMetricFn "+t),"string"==typeof t)return t;for(var e=void 0,n=0,r=Object.keys(Re);n<r.length;n++){var i=r[n];if(Re[i]===t){e=i;break}}if(void 0!==e)return e;for(var o=0,a=Object.keys(He);o<a.length;o++)if(i=a[o],He[i]===t){e=i;break}return void 0!==e?e:t.name}(n)}var c;Z(r,function(){c=o}),function(t,n,r){e.outputNames.length>1&&(n=e.outputNames[t]+"_"+n),e.metricsNames.push(n),e.metricsTensors.push([r,t])}(t,r,c)},s=0,u=g[t];s<u.length;s++)a(u[s])}()},n=0;n<e.outputs.length;++n)t(n)}),this.collectedTrainableWeights=this.trainableWeights},e.prototype.checkTrainableWeightsConsistency=function(){null!=this.collectedTrainableWeights&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")},e.prototype.evaluate=function(t,e,n){void 0===n&&(n={});var r=null==n.batchSize?32:n.batchSize;cn(r);var i=this.standardizeUserData(t,e,!0,r);try{var o=i[0].concat(i[1]);this.makeTestFunction();var a=this.testFunction;return y(this.testLoop(a,o,r,n.verbose,n.steps))}finally{mn(i[0],t),mn(i[1],e)}},e.prototype.evaluateDataset=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){return this.makeTestFunction(),[2,function(t,e,n){return u(this,void 0,void 0,function(){var i,o,a,s,u,l,f,d,h,m;return c(this,function(g){switch(g.label){case 0:if(i=null!=(n=n||{}).batches,o=t.testFunction,a=[],n.verbose>0)throw new p("Verbose mode is not implemented yet.");return r.util.assert(!i||n.batches>0&&Number.isInteger(n.batches),function(){return"Test loop expects `batches` to be a positive integer, but received "+JSON.stringify(n.batches)}),"function"==typeof e.next?(u=e,[3,3]):[3,1];case 1:return[4,e.iterator()];case 2:u=g.sent(),g.label=3;case 3:s=u,l=0,f=0,d=function(){var e;return c(this,function(u){switch(u.label){case 0:return[4,s.next()];case 1:return e=u.sent(),a=Object(r.tidy)(function(){if(e.value){var n=an(t,e.value),i=Object(r.tidy)(function(){return o(n)});if(Object(r.dispose)(n),0===f)for(var s=0;s<i.length;++s)a.push(Object(r.scalar)(0));var u=n[0].shape[0],c=function(t){var e=i[t],n=a[t];a[t]=Object(r.tidy)(function(){return Object(r.add)(a[t],Object(r.mul)(u,e))}),f>0&&Object(r.dispose)(n)};for(s=0;s<i.length;++s)c(s);Object(r.dispose)(i),l+=u,++f}return a}),e.done?(i&&console.warn("Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least `batches` batches (in this case, "+n.batches+" batches). You may need to use the repeat() function when building your dataset."),[2,"break"]):[2]}})},g.label=4;case 4:return!i||f<n.batches?[5,d()]:[3,6];case 5:return"break"===g.sent()?[3,6]:[3,4];case 6:for(h=0;h<a.length;++h)m=a[h],a[h]=Object(r.div)(a[h],l),Object(r.dispose)(m);return[2,y(a)]}})})}(this,t,e)]})})},e.prototype.checkNumSamples=function(t,e,n,r){var i;if(void 0===r&&(r="steps"),null!=n){if(i=null,null!=e)throw new h("If "+r+" is set, batchSize must be null or undefined.Got batchSize = "+e)}else{if(null==t)throw new h("Either the input data should have a defined shape, or "+r+" shoud be specified.");i=Array.isArray(t)?t[0].shape[0]:t.shape[0]}return i},e.prototype.execute=function(t,e){if(Array.isArray(e)&&0===e.length)throw new h("`outputs` is an empty Array, which is not allowed.");var n=Array.isArray(e),i=n?e:[e],o=this.retrieveSymbolicTensors(i),a=new Ze;if(t instanceof r.Tensor&&(t=[t]),Array.isArray(t)){if(t.length!==this.inputs.length)throw new h("The number of inputs provided ("+t.length+") does not match the number of inputs of this model ("+this.inputs.length+").");for(var s=0;s<this.inputs.length;++s)a.add(this.inputs[s],t[s])}else for(var u=0,c=this.inputs;u<c.length;u++){var l=c[u],f=t[l.name];if(null==f)throw new h("No value is provided for the model's input "+l.name);a.add(l,f)}var d=en(o,a);return n?d:d[0]},e.prototype.retrieveSymbolicTensors=function(t){for(var e=g(null,t.length),n=t.length,r=0,i=this.layers;r<i.length;r++){for(var o=i[r],a=Array.isArray(o.output)?o.output:[o.output],s=a.map(function(t){return t.name}),u=0;u<t.length;++u){var c=s.indexOf(t[u]);if(-1!==c&&(e[u]=a[c],n--),0===n)break}if(0===n)break}if(n>0){var l=[];throw e.forEach(function(e,n){null==e&&l.push(t[n])}),new h("Cannot find SymbolicTensors for output name(s): "+JSON.stringify(l))}return e},e.prototype.predictLoop=function(t,e,n){var i=this;return void 0===e&&(e=32),void 0===n&&(n=!1),Object(r.tidy)(function(){var o=i.checkNumSamples(t);if(n)throw new p("Verbose predictLoop() is not implemented yet.");for(var a=dn(o,e),s=i.outputs.map(function(t){return[]}),u=function(e){Object(r.tidy)(function(){var n=a[e][0],r=a[e][1],o=ln(t,n,r),s=[];if(Array.isArray(o))for(var u=0;u<o.length;++u)s.push({key:i.inputs[u],value:o[u]});else s.push({key:i.inputs[0],value:o});var c=new Ze(s);return en(i.outputs,c)}).forEach(function(t,e){return s[e].push(t)})},c=0;c<a.length;++c)u(c);return y(s.map(function(t){return Object(r.concat)(t,0)}))})},e.prototype.predict=function(t,e){void 0===e&&(e={});var n=pn(t);yn(n,this.inputNames,this.feedInputShapes,!1);try{var r=null==e.batchSize?32:e.batchSize;return cn(r),this.predictLoop(n,r)}finally{mn(n,t)}},e.prototype.predictOnBatch=function(t){return yn(t,this.inputNames,this.feedInputShapes,!0),this.predictLoop(t,t.shape[0])},e.prototype.standardizeUserData=function(t,e,n,i){if(void 0===n&&(n=!0),null==this.optimizer_)throw new d("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");for(var o=[],a=0;a<this.feedOutputShapes.length;++a){var s=this.feedOutputShapes[a];this.feedLossFns[a]===Ie?o.push(s.slice(0,s.length-1).concat([1])):o.push(s)}if(function(t,e,n){var i=A(t.map(function(t){return t.shape[0]}));i.sort();var o=A(e.map(function(t){return t.shape[0]}));if(o.sort(),i.length>1)throw new h("All input Tensors (x) should have the same number of samples. Got array shapes: "+JSON.stringify(t.map(function(t){return t.shape})));if(o.length>1)throw new h("All target Tensors (y) should have the same number of samples. Got array shapes: "+JSON.stringify(e.map(function(t){return t.shape})));if(i.length>0&&o.length>0&&!r.util.arraysEqual(i,o))throw new h("Input Tensors should have the same number of samples as target Tensors. Found "+i[0]+" input sample(s) and "+o[0]+" target sample(s).")}(t=bn(t,this.feedInputNames,this.feedInputShapes,!1,"input"),e=bn(e,this.feedOutputNames,o,!1,"target")),function(t,e,n){for(var r=[Ce,De,Te],i=0;i<t.length;++i){var o=t[i],a=e[i],s=n[i];if(null!=a){if(a===Te&&1===o.shape[o.shape.length-1])throw new h("You are passing a target array of shape "+o.shape+" while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].");if(-1!==r.indexOf(a))for(var u=o.shape.slice(1),c=s.slice(1),l=0;l<u.length;++l){var f=u[l],d=c[l];if(null!=d&&f!==d)throw new h("A target Tensor with shape "+o.shape+" was passed for an output of shape "+s+", while using a loss function that expects targets to have the same shape as the output.")}}}}(e,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=i&&i>0&&t[0].shape[0]%i!=0)throw new h("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+i+". Found: "+t[0].shape[0]+" sample(s).");return[t,e,null]},e.prototype.testLoop=function(t,e,n,i,o){var a=this;return void 0===i&&(i=0),Object(r.tidy)(function(){var s=a.checkNumSamples(e,n,o,"steps"),u=[];if(i>0)throw new p("Verbose mode is not implemented yet.");if(null!=o)throw new p("steps mode in testLoop() is not implemented yet");for(var c=dn(s,n),l=Object(r.tensor1d)(ut(0,s)),f=0;f<c.length;++f){var d=c[f][0],h=c[f][1],m=ft(l,d,h-d),g=fn(e,m),v=t(g);if(0===f)for(var b=0;b<v.length;++b)u.push(Object(r.scalar)(0));for(b=0;b<v.length;++b){var y=v[b];u[b]=Object(r.add)(u[b],Object(r.mul)(h-d,y))}}for(b=0;b<u.length;++b)u[b]=Object(r.div)(u[b],s);return u})},e.prototype.getDedupedMetricsNames=function(){for(var t=this.metricsNames,e=[],n=0;n<t.length;++n){var r=t[n],i=r;b(t,r)>1&&(i+="_"+b(t.slice(0,n),r)),e.push(i)}return e},e.prototype.makeTrainFunction=function(){var t=this;return function(e){var n=e.slice(0,t.inputs.length),i=e.slice(t.inputs.length,t.inputs.length+t.outputs.length),o=[],a=t.collectedTrainableWeights.map(function(t){return t.read()});return[t.optimizer_.minimize(function(){for(var e=[],a=0;a<t.inputs.length;++a)e.push({key:t.inputs[a],value:n[a]});var s,u=new Ze(e),c=en(t.outputs,u,{training:!0});for(a=0;a<t.lossFunctions.length;++a){var l=(0,t.lossFunctions[a])(i[a],c[a]);Object(r.mean)(l),s=0===a?l:Object(r.add)(s,l)}for(a=0;a<t.metricsTensors.length;++a){var f=t.metricsTensors[a][0],d=t.metricsTensors[a][1],h=Object(r.mean)(f(i[d],c[d]));Object(r.keep)(h),o.push(h)}return s=Object(r.mean)(s),t.calculateLosses().forEach(function(t){s=Object(r.add)(s,t)}),s},!0,a)].concat(o)}},e.prototype.makeTestFunction=function(){var t=this;this.testFunction=function(e){return Object(r.tidy)(function(){for(var n,i=[],o=e.slice(0,t.inputs.length),a=e.slice(t.inputs.length,t.inputs.length+t.outputs.length),s=[],u=0;u<t.inputs.length;++u)s.push({key:t.inputs[u],value:o[u]});var c=new Ze(s),l=en(t.outputs,c);for(u=0;u<t.lossFunctions.length;++u){var f=t.lossFunctions[u],d=Object(r.mean)(f(a[u],l[u]));n=0===u?d:Object(r.add)(n,d),i.push(n)}for(u=0;u<t.metricsTensors.length;++u){var h=t.metricsTensors[u][0],p=t.metricsTensors[u][1],m=Object(r.mean)(h(a[p],l[p]));i.push(m)}return i})}},e.prototype.fit=function(t,e,n){return void 0===n&&(n={}),u(this,void 0,void 0,function(){return c(this,function(r){return[2,hn(this,t,e,n)]})})},e.prototype.fitDataset=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){return[2,function(t,e,n){return u(this,void 0,void 0,function(){var i,o,a,s,u,l,f,d,h,m,g,v,b,y,x,_,k,S,E,O,A,C,M,N,T,I,D;return c(this,function(c){switch(c.label){case 0:if(i=null!=n.batchesPerEpoch,r.util.assert(null!=t.optimizer,function(){return"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."}),r.util.assert(null!=n,function(){return"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."}),r.util.assert(null!=n.epochs&&n.epochs>0&&Number.isInteger(n.epochs),function(){return"For fitDataset(), config.epochs is expected to be a positive integer, but got "+n.epochs}),r.util.assert(!i||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),function(){return"For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got "+n.batchesPerEpoch}),r.util.assert(null==n.validationSplit,function(){return"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."}),t.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");t.isTraining=!0,c.label=1;case 1:return c.trys.push([1,,22,23]),o=null!=n.validationData,a=void 0,s=void 0,o&&(un(n.validationData)?r.util.assert(null==n.validationBatches||n.validationBatches>0&&Number.isInteger(n.validationBatches),function(){return"For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got "+n.validationBatches}):(u=function(t){if(3===t.length)throw new p("Validation with sample weights is not implemented yet.");return{xs:t[0],ys:t[1]}}(n.validationData),a=u.xs,s=u.ys)),l=t.makeTrainFunction(),f=t.getDedupedMetricsNames(),d=void 0,d=o?f.slice().concat(f.map(function(t){return"val_"+t})):f.slice(),h=Se(n.callbacks,n.yieldEvery),m=null==n.verbose?1:n.verbose,g=Oe(h,m,n.epochs,null,null,function(t,e){var n=null;return null!=e.batchesPerEpoch?n=e.batchesPerEpoch:Number.isFinite(t.size)&&(n=t.size),n}(e,n),null,o,d),v=g.callbackList,b=g.history,v.setModel(t),t.history=b,[4,v.onTrainBegin()];case 2:return c.sent(),t.stopTraining_=!1,y=null==n.initialEpoch?0:n.initialEpoch,[4,e.iterator()];case 3:x=c.sent(),c.label=4;case 4:return y<n.epochs?(_={},[4,v.onEpochBegin(y)]):[3,19];case 5:return c.sent(),k=0,S=0,i?[3,7]:[4,e.iterator()];case 6:x=c.sent(),c.label=7;case 7:return!i||k<n.batchesPerEpoch?[4,x.next()]:[3,17];case 8:return E=c.sent(),i&&E.done?(console.warn("You provided `batchesPerEpoch` as "+n.batchesPerEpoch+", but your dataset iterator ran out of data after "+k+" batches; interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, "+n.batchesPerEpoch*n.epochs+" batches). You may need to use the repeat() function when building your dataset."),[3,17]):null==E.value?[3,11]:(O=an(t,E.value),(A={}).batch=S,A.size=O[0].shape[0],[4,v.onBatchBegin(S,A)]);case 9:for(c.sent(),C=l(O),Object(r.dispose)(O),D=0;D<f.length;++D)M=f[D],N=C[D],A[M]=N,Object(r.keep)(N);return[4,v.onBatchEnd(S,A)];case 10:c.sent(),ve(A),S++,k++,c.label=11;case 11:return(i?k>=n.batchesPerEpoch:E.done)?o?(T=void 0,un(n.validationData)?(I=w,[4,t.evaluateDataset(n.validationData,{batches:n.validationBatches})]):[3,13]):[3,15]:[3,16];case 12:return T=I.apply(void 0,[c.sent()]),[3,14];case 13:T=w(t.evaluate(a,s,{batchSize:null==n.validationBatchSize?on:n.validationBatchSize,verbose:0})),c.label=14;case 14:for(D=0;D<t.metricsNames.length;++D)_["val_"+t.metricsNames[D]]=T[D];c.label=15;case 15:return[3,17];case 16:return t.stopTraining_?[3,17]:[3,7];case 17:return[4,v.onEpochEnd(y,_)];case 18:return c.sent(),y++,t.stopTraining_?[3,19]:[3,4];case 19:return[4,v.onTrainEnd()];case 20:return c.sent(),[4,t.history.syncData()];case 21:return c.sent(),[2,t.history];case 22:return t.isTraining=!1,[7];case 23:return[2]}})})}(this,t,e)]})})},e.prototype.trainOnBatch=function(t,e){return u(this,void 0,void 0,function(){var n,i,o,a,s,u,l,f,d;return c(this,function(c){switch(c.label){case 0:n=this.standardizeUserData(t,e),i=n[0],o=n[1],a=this.makeTrainFunction(),s=a(i.concat(o)),u=[],l=0,f=s,c.label=1;case 1:return l<f.length?[4,f[l].data()]:[3,4];case 2:d=c.sent(),u.push(d[0]),c.label=3;case 3:return l++,[3,1];case 4:return Object(r.dispose)(s),[2,y(u)]}})})},e.prototype.getNamedWeights=function(t){for(var e={},n=null!=t&&t.trainableOnly,r=n?this.trainableWeights:this.weights,i=this.getWeights(n),o=0;o<r.length;++o)n&&!r[o].trainable||(e[r[o].originalName]=i[o]);return e},Object.defineProperty(e.prototype,"stopTraining",{get:function(){return this.stopTraining_},set:function(t){this.stopTraining_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"optimizer",{get:function(){return this.optimizer_},set:function(t){this.optimizer_!==t&&(this.optimizer_=t,this.isOptimizerOwned=!1)},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){var e=t.prototype.dispose.call(this);if(0===e.refCountAfterDispose&&null!=this.optimizer&&this.isOptimizerOwned){var n=Object(r.memory)().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=n-Object(r.memory)().numTensors}return e},e.prototype.save=function(t,e){return u(this,void 0,void 0,function(){var n,i,o,a,s;return c(this,function(u){switch(u.label){case 0:if("string"==typeof t){if(0===(n=r.io.getSaveHandlers(t)).length)throw new h("Cannot find any save handlers for URL '"+t+"'");if(n.length>1)throw new h("Found more than one ("+n.length+") save handlers for URL '"+t+"'");t=n[0]}if(null==t.save)throw new h("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[4,r.io.encodeWeights(this.getNamedWeights(e))];case 1:return i=u.sent(),o=!1,a=null,s=this.toJSON(a,o),[2,t.save({modelTopology:s,weightData:i.data,weightSpecs:i.specs,format:"layers-model",generatedBy:"TensorFlow.js tfjs-layers v1.2.2",convertedBy:null})]}})})},e.className="Model",e}(function(t){function e(n){var r=t.call(this,{})||this;if(r.containerNodes=new Set,r.name=n.name,null==r.name){var i=r.getClassName().toLowerCase();r.name=Jt(i)}if(r.supportsMasking=!1,r.trainable_=!0,Array.isArray(n.inputs)?r.inputs=n.inputs.slice():r.inputs=[n.inputs],Array.isArray(n.outputs)?r.outputs=n.outputs.slice():r.outputs=[n.outputs],A(r.inputs).length!==r.inputs.length)throw new h("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+r.inputs.map(function(t){return t.name}));A(r.outputs).length!==r.outputs.length&&console.warn("The list of outputs passed to the model is redundant. All outputs should only appear once. Found: "+r.outputs.map(function(t){return t.name})),r.inputLayers=[],r.inputLayersNodeIndices=[],r.inputLayersTensorIndices=[],r.outputLayers=[],r.outputLayersNodeIndices=[],r.outputLayersTensorIndices=[],r.layers=[];for(var o=0,a=r.outputs;o<a.length;o++){var s=(T=a[o]).sourceLayer,u=T.nodeIndex,c=T.tensorIndex;r.outputLayers.push(s),r.outputLayersNodeIndices.push(u),r.outputLayersTensorIndices.push(c)}for(var l=0,f=r.inputs;l<f.length;l++)s=(T=f[l]).sourceLayer,u=T.nodeIndex,c=T.tensorIndex,v(0===u,"input layer has >1 nodes"),v(0===c,"input layer has >1 tensors"),r.inputLayers.push(s),r.inputLayersNodeIndices.push(u),r.inputLayersTensorIndices.push(c);r.inputNames=[],r.outputNames=[],r.feedInputShapes=[],r.feedInputNames=[],r.feedOutputNames=[];for(var p=0;p<r.inputLayers.length;p++){if(!((s=r.inputLayers[p])instanceof pe))throw new TypeError("Input layers to a LayersModel must be InputLayer objects. Received inputs: "+n.inputs+". Input "+p+" (0-based) originates from layer type "+s.getClassName()+".");r.inputNames.push(s.name),r.feedInputShapes.push(s.batchInputShape),r.feedInputNames.push(s.name)}for(var m=0,g=r.outputLayers;m<g.length;m++)s=g[m],r.outputNames.push(s.name);r.internalInputShapes=r.inputs.map(function(t){return t.shape}),r.internalOutputShapes=r.outputs.map(function(t){return t.shape});for(var b={},y={},w={},x={},_={},k=[],S=function(t,n,i,o,a,s){null!=o&&null!=a&&null!=s||(o=t.sourceLayer,a=t.nodeIndex,s=t.tensorIndex);var u=o.inboundNodes[a];if(-1!==i.indexOf(u))throw new d("The tensor "+t.name+' at layer "'+o.name+'" is part of a cycle.');if(-1===n.indexOf(u)){r.containerNodes.add(e.nodeKey(o,a)),o.id in _||(_[o.id]=Object.keys(_).length),-1===i.indexOf(u)&&i.push(u);for(var c=u.inboundLayers.length,l=0;l<c;l++){var f=u.inputTensors[l],h=u.inboundLayers[l],p=u.nodeIndices[l],m=u.tensorIndices[l];S(f,n,i,h,p,m)}for(n.push(u);i.indexOf(u)>=0;)i.splice(i.indexOf(u),1);k.push(u)}},E=[],C=[],M=0,N=r.outputs;M<N.length;M++){var T=N[M];S(T,E,C)}for(var I=0,D=k.slice().reverse();I<D.length;I++){y[(et=D[I]).id]=et,et.id in b||(b[et.id]=0);var j=b[et.id],R=null==w[et.outboundLayer.id]?0:w[et.outboundLayer.id];for(j=Math.max(j,R),w[et.outboundLayer.id]=j,x[et.outboundLayer.id]=et.outboundLayer,b[et.id]=j,p=0;p<et.inboundLayers.length;p++){var F=et.inboundLayers[p],P=(u=et.nodeIndices[p],F.inboundNodes[u]),z=null==b[P.id]?0:b[P.id];b[P.id]=Math.max(j+1,z),y[P.id]=P}}var L={};for(var B in b)(j=b[B])in L||(L[j]=[]),L[j].push(y[B]);var U={};for(var W in w)(j=w[W])in U||(U[j]=[]),U[j].push(x[W]);var q=Object.keys(U).map(function(t){return parseInt(t,10)}).sort(O);r.layers=[];for(var V=0,H=q;V<H.length;V++){var $=U[j=H[V]];$.sort(function(t,e){var n=_[t.id],r=_[e.id];return n<r?-1:n>r?1:0});for(var G=0,K=$;G<K.length;G++)s=K[G],r.layers.push(s)}r.layersByDepth=U,q=Object.keys(L).map(function(t){return parseInt(t,10)}).sort(O);for(var X=r.inputs.slice(),Y=[],J=0,Z=q;J<Z.length;J++)for(var Q=0,tt=L[j=Z[J]];Q<tt.length;Q++){var et;if(null!=(s=(et=tt[Q]).outboundLayer)){for(var nt=0,rt=et.inputTensors;nt<rt.length;nt++)if(T=rt[nt],-1===X.indexOf(T))throw new d("Graph disconnected: cannot obtain value for tensor "+T+' at layer "'+s.name+'". The following previous layers were accessed without issue: '+Y);for(var it=0,ot=et.outputTensors;it<ot.length;it++)T=ot[it],X.push(T);Y.push(s.name)}}r.nodesByDepth=L;for(var at=r.layers.map(function(t){return t.name}),st=function(t){var e=at.filter(function(e){return e===t}).length;if(1!==e)throw new d('The name "'+t+'" is used '+e+" times in the model. All layer names should be unique. Layer names: "+JSON.stringify(at))},ut=0,ct=at;ut<ct.length;ut++)st(ct[ut]);return r.outboundNodes=[],r.inboundNodes=[],new fe({outboundLayer:r,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:r.inputs,outputTensors:r.outputs,inputMasks:r.inputs.map(function(t){return null}),outputMasks:r.outputs.map(function(t){return null}),inputShapes:r.inputs.map(function(t){return t.shape}),outputShapes:r.outputs.map(function(t){return t.shape})}),r.built=!0,r._refCount=1,r}return o(e,t),e.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error("Container '"+this.name+"' is already disposed.")},e.prototype.dispose=function(){this.assertNotDisposed();var t={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount)for(var e=0,n=this.layers;e<n.length;e++){var r=n[e];t.numDisposedVariables+=r.dispose().numDisposedVariables}return t.refCountAfterDispose=this._refCount,t},Object.defineProperty(e.prototype,"trainable",{get:function(){return this.trainable_},set:function(t){this.layers.forEach(function(e){e._trainableWeights.forEach(function(e){return e.trainable=t})}),this.trainable_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trainableWeights",{get:function(){if(this._trainableWeights.length>0)throw new h("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];for(var t=[],e=0,n=this.layers;e<n.length;e++){var r=n[e];t=t.concat(r.trainableWeights)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nonTrainableWeights",{get:function(){for(var t=[],e=0,n=this.layers;e<n.length;e++){var r=n[e];t.push.apply(t,r.nonTrainableWeights)}if(!this.trainable){for(var i=[],o=0,a=this.layers;o<a.length;o++)r=a[o],i.push.apply(i,r.trainableWeights);return i.concat(t)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),e.prototype.loadWeights=function(t,e){void 0===e&&(e=!0);for(var n={},r=0,i=0,o=this.layers;i<o.length;i++)for(var a=0,s=o[i].weights;a<s.length;a++){var u=s[a];if(null!=n[u.originalName])throw new h("Duplicate weight name: "+u.originalName);n[u.originalName]=u,r++}var c=[];for(var l in t){if(null!=n[l])c.push([n[l],t[l]]);else if(e)throw new h("Provided weight data has no target variable: "+l);delete n[l]}if(e){var f=[];for(var d in n)f.push(d);if(f.length>0)throw new h(f.length+" of "+r+" weights are not set: "+f)}ae(c)},e.prototype.updatedConfig=function(){var t=this.getConfig(),e={};return e.className=this.getClassName(),e.config=t,e.kerasVersion="tfjs-layers 1.2.2",e.backend="TensorFlow.js",e},e.prototype.toJSON=function(t,e){void 0===e&&(e=!0);var n=function t(e,n){if(null===e||void 0===e)return null;if("string"==typeof e)return x(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){for(var r=[],i=e.length,o=0;o<i;++o){var a=e[o];Ye(n,o,a)?r.push(a):r.push(t(a,n))}return r}for(var s={},u=0,c=Object.keys(e);u<c.length;u++){var l=c[u],f=e[l];s[x(l)]="name"!==l&&"className"!==l||"string"!=typeof f?t(f,l):f}return s}(this.updatedConfig());return e?JSON.stringify(n):n},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){t=w(t);for(var r=new Ze,i=0;i<n.inputs.length;++i)r.add(n.inputs[i],t[i]);return en(n.outputs,r,e)})},e.prototype.computeMask=function(t,e){var n=this;return Object(r.tidy)(function(){var r;return t=w(t),r=null==e?g(null,t.length):w(e),n.runInternalGraph(t,r)[1]})},e.prototype.computeOutputShape=function(t){var e=Qt(t);if(e.length!==this.inputLayers.length)throw new h("Invalid inputShape argument "+t+": model has "+this.inputLayers.length+" tensor inputs.");for(var n={},r=0;r<e.length;r++){var i=this.inputLayers[r],o=e[r];n[A=i.name+"_0_0"]=o}var a=Object.keys(this.nodesByDepth).map(function(t){return parseInt(t,10)}).sort(O);if(a.length>1)for(var s=0,u=a;s<u.length;s++)for(var c=u[s],l=0,f=this.nodesByDepth[c];l<f.length;l++){var d=f[l];if(i=d.outboundLayer,-1===this.inputLayers.map(function(t){return t.id}).indexOf(i.id)){for(var p=[],m=0;m<d.inboundLayers.length;m++){var g=d.inboundLayers[m],b=d.nodeIndices[m],w=d.tensorIndices[m],x=n[A=g.name+"_"+b+"_"+w];p.push(x)}var _=Qt(i.computeOutputShape(y(p))),k=i.inboundNodes.indexOf(d);for(m=0;m<_.length;m++)n[A=i.name+"_"+k+"_"+m]=_[m]}}var S=[],E=[];for(r=0;r<this.outputLayers.length;r++){i=this.outputLayers[r],k=this.outputLayersNodeIndices[r],w=this.outputLayersTensorIndices[r];var A=i.name+"_"+k+"_"+w;E.push(A)}for(r=0;r<E.length;r++){var C=E[r];v(C in n),S.push(n[C])}return y(S)},e.prototype.runInternalGraph=function(t,e){null==e&&(e=g(null,t.length));for(var n={},r=0;r<this.inputs.length;++r){var i=this.inputs[r],o=t[r],a=e[r];n[i.id]=[o,a]}for(var s=0,u=Object.keys(this.nodesByDepth).map(function(t){return parseInt(t,10)}).sort(O);s<u.length;s++)for(var c=u[s],l=0,f=this.nodesByDepth[c];l<f.length;l++){for(var d=f[l],h=d.outboundLayer,m=d.inputTensors,b=d.outputTensors,y=new Array,x=0,_=m;x<_.length;x++)(i=_[x]).id in n&&y.push(n[i.id]);if(y.length===m.length){var k={},S=void 0,E=void 0,A=void 0,C=void 0;if(null!=d.callArgs&&(k=d.callArgs),1===y.length){var M=y[0],N=M[0],T=M[1];null==k.mask&&(k.mask=T),A=w(h.call(N,k)),C=w(h.computeMask(N,T)),S=[N],E=[T]}else S=y.map(function(t){return t[0]}),E=y.map(function(t){return t[1]}),null==k.mask&&(k.mask=E),A=w(h.call(S,k)),C=w(h.computeMask(S,E));if(h.activityRegularizer)throw new p("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(r=0;r<b.length;++r)i=b[r],o=A[r],a=C[r],n[i.id]=[o,a]}}for(var I=[],D=[],j=[],R=0,F=this.outputs;R<F.length;R++){v((i=F[R]).id in n,"Could not compute output "+i.name+" : "+i.id);var P=n[i.id],z=P[0];a=P[1],j.push(z.shape),I.push(z),D.push(a)}return[I,D,j]},e.prototype.buildNodeConversionMap=function(t){for(var n,r={},i=0,o=this.layers;i<o.length;i++){var a=o[i];n=a instanceof e?1:0;for(var s=0;s<a.inboundNodes.length;s++){var u=e.nodeKey(a,s);this.containerNodes.has(u)&&(r[u]=n,n+=1)}}return r},e.prototype.getLayer=function(t,e){if(null!=e){if(this.layers.length<=e)throw new h("Was asked to retrieve layer at index "+e+", but model only has "+this.layers.length+" layer(s).");return this.layers[e]}if(null==t)throw new h("Provide either a layer name or layer index");for(var n=0,r=this.layers;n<r.length;n++){var i=r[n];if(i.name===t)return i}throw new h("No such layer: "+t)},e.prototype.calculateLosses=function(){var t=this;return Object(r.tidy)(function(){for(var n=[],r=0,i=t.layers;r<i.length;r++)for(var o=i[r],a=0;a<o.inboundNodes.length;++a){var s=e.nodeKey(o,a);t.containerNodes.has(s)&&n.push.apply(n,o.calculateLosses())}return n})},e.prototype.getConfig=function(){for(var t={name:this.name},n=this.buildNodeConversionMap(this.layers),r=[],i=0,o=this.layers;i<o.length;i++){for(var a=(w=o[i]).getClassName(),s=w.getConfig(),u=[],c=0;c<w.inboundNodes.length;c++){var l=w.inboundNodes[c],f=e.nodeKey(w,c),d={};if(this.containerNodes.has(f)){if(l.callArgs)try{JSON.stringify(l.callArgs),d=l.callArgs}catch(t){console.warn("Layer "+w.name+" was passed non-serializable keyword arguments: "+l.callArgs+". They will not be included in the serialized model (and thus will be missing at deserialization time)."),d={}}if(l.inboundLayers.length>0){for(var h=[],p=0;p<l.inboundLayers.length;p++){var m=l.inboundLayers[p],g=l.nodeIndices[p],v=l.tensorIndices[p];null==(_=n[e.nodeKey(m,g)])&&(_=0),h.push([m.name,_,v,d])}u.push(h)}}}var b={};b.name=w.name,b.className=a,b.config=s,b.inboundNodes=u,r.push(b)}t.layers=r;var y=[];for(p=0;p<this.inputLayers.length;p++){var w=this.inputLayers[p];g=this.inputLayersNodeIndices[p],f=e.nodeKey(w,g),this.containerNodes.has(f)&&(null!==(_=n[f])&&void 0!==_||(_=0),v=this.inputLayersTensorIndices[p],y.push([w.name,_,v]))}t.inputLayers=y;var x=[];for(p=0;p<this.outputLayers.length;p++){var _;w=this.outputLayers[p],g=this.outputLayersNodeIndices[p],f=e.nodeKey(w,g),this.containerNodes.has(f)&&(null!==(_=n[f])&&void 0!==_||(_=0),v=this.outputLayersTensorIndices[p],x.push([w.name,_,v]))}return t.outputLayers=x,t},e.fromConfig=function(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var i={},o={};function a(t,e){t.name in o?o[t.name].push(e):o[t.name]=[e]}function s(t,e){for(var n,r=[],o=0,s=e;o<s.length;o++){var u=s[o],c=u[0],l=u[1],f=u[2];if(n=null==u[3]?{}:u[3],!(c in i))return void a(t,e);var d=i[c];if(d.inboundNodes.length<=l)return void a(t,e);var h=d.inboundNodes[l];r.push(h.outputTensors[f])}r.length>0&&t.apply(y(r),n)}function u(t){var n=t.name,o=Xe(t,null!=e.customObjects?e.customObjects:{});o.setFastWeightInitDuringBuild(r),i[n]=o,t.inboundNodes.forEach(function(t){if(!(t instanceof Array))throw new h("Corrupted configuration, expected array for nodeData: "+t);a(o,t)})}for(var c=e.name,l=e.layers,f=0,d=l;f<d.length;f++)u(g=d[f]);for(;!C(o);)for(var p=0,m=l;p<m.length;p++){var g=m[p];if((D=i[g.name]).name in o){var b=o[D.name];delete o[D.name];for(var w=0,x=b;w<x.length;w++)s(D,x[w])}}for(var _=[],k=[],S=0,E=e.inputLayers;S<E.length;S++){var O=(g=E[S])[0],A=g[1],M=g[2];v(O in i);var N=(D=i[O]).inboundNodes[A].outputTensors;_.push(N[M])}for(var T=0,I=e.outputLayers;T<I.length;T++){var D;O=(g=I[T])[0],A=g[1],M=g[2],v(O in i),N=(D=i[O]).inboundNodes[A].outputTensors,k.push(N[M])}return new t({inputs:_,outputs:k,name:c})},Object.defineProperty(e.prototype,"stateful",{get:function(){if(this._stateful)throw new h("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(var t=0,e=this.layers;t<e.length;t++)if(e[t].stateful)return!0;return!1},enumerable:!0,configurable:!0}),e.prototype.resetStates=function(){var t=this;Object(r.tidy)(function(){t.layers.forEach(function(t){t.stateful&&t.resetStates()})})},e}(he));r.serialization.registerClass(wn);var xn=function(t){function e(e){var n=t.call(this,{inputs:[],outputs:[]})||this;if(e=e||{},n.trainable=!0,n.built=!1,n.name=null!=e.name?e.name:Jt("sequential_"),null!=e.layers)for(var r=0,i=e.layers;r<i.length;r++){var o=i[r];n.add(o)}return n}return o(e,t),e.prototype.checkShape=function(t){if(t.inboundNodes[0].outputTensors[0].shape.some(function(t){return t<0}))throw new h("Negative dimension size caused by adding layer "+t.name+" with input shape ["+t.inboundNodes[0].inputTensors[0].shape+"]")},e.prototype.add=function(t){var n,r=t instanceof e||t instanceof wn;if(r){if(1!==(n=t).outputs.length)throw new h("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==n.inputs.length)throw new h("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(0===this.outputs.length){if(0===t.inboundNodes.length){if(null==t.batchInputShape)throw new h("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");var i=me({batchShape:t.batchInputShape,dtype:t.dtype,name:t.name+"_input"});t.apply(i)}if(r)this.outputs=n.outputs,this.inputs=n.inputs;else{if(1!==t.inboundNodes.length)throw new h("A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer "+t.name+" which has "+t.inboundNodes.length+" pre-existing inbound connections.");if(1!==t.inboundNodes[0].outputTensors.length)throw new h("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(t),this.outputs=[t.inboundNodes[0].outputTensors[0]],this.inputs=function t(e,n,r){if((null==n||null!=r&&r>0)&&(n=e.sourceLayer,r=e.nodeIndex),0===n.inboundNodes.length)return[e];var i=n.inboundNodes[r];if(0===i.inboundLayers.length)return i.inputTensors;for(var o=[],a=0;a<i.inboundLayers.length;a++)for(var s=0,u=t(i.inputTensors[a],i.inboundLayers[a],i.nodeIndices[a]);s<u.length;s++){var c=u[s];-1===o.indexOf(c)&&o.push(c)}return o}(this.outputs[0])}this.inboundNodes=[],new fe({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:g(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(function(t){return t.shape}),outputShapes:this.outputs[0].shape})}else{var o=t.apply(this.outputs[0]);if(Array.isArray(o))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(t),this.outputs=[o],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(t),this.built=!1},e.prototype.pop=function(){if(0===this.layers.length)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),0===this.layers.length)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{var t=this.layers.length-1;this.layers[t].outboundNodes=[],this.outputs=[this.layers[t].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}},e.prototype.call=function(t,e){return null==this.model&&this.build(),this.model.call(t,e)},e.prototype.build=function(t){if(ee(t),0===this.inputs.length||0===this.outputs.length)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new wn({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0},e.prototype.countParams=function(){return this.built||this.build(),t.prototype.countParams.call(this)},e.prototype.summary=function(e,n,r){void 0===r&&(r=console.log),this.built||this.build(),t.prototype.summary.call(this,e,n,r)},e.prototype.setWeights=function(t){null==this.model&&this.build(),this.model.setWeights(t)},e.prototype.evaluate=function(t,e,n){if(void 0===n&&(n={}),!this.built)throw new d("The model needs to be compiled before being used.");return this.model.evaluate(t,e,n)},e.prototype.evaluateDataset=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){if(!this.built)throw new d("The model needs to be compiled before being used.");return[2,this.model.evaluateDataset(t,e)]})})},e.prototype.predict=function(t,e){return void 0===e&&(e={}),null==this.model&&this.build(),this.model.predict(t,e)},e.prototype.predictOnBatch=function(t){return null==this.model&&this.build(),this.model.predictOnBatch(t)},e.prototype.compile=function(t){this.build(),this.model.compile(t),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames},Object.defineProperty(e.prototype,"optimizer",{get:function(){return this.model.optimizer},set:function(t){this.model.optimizer=t},enumerable:!0,configurable:!0}),e.prototype.fit=function(t,e,n){return void 0===n&&(n={}),u(this,void 0,void 0,function(){return c(this,function(r){if(!this.built)throw new d("The model needs to be compiled before being used.");return[2,this.model.fit(t,e,n)]})})},e.prototype.fitDataset=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){if(!this.built)throw new d("The model needs to be compiled before being used.");return[2,this.model.fitDataset(t,e)]})})},e.prototype.trainOnBatch=function(t,e){return u(this,void 0,void 0,function(){return c(this,function(n){return[2,this.model.trainOnBatch(t,e)]})})},e.fromConfig=function(t,n,i,o){var a;void 0===i&&(i={}),void 0===o&&(o=!1);var s={};if(n instanceof Array){if(null==n[0].className||"Merge"===n[0].className)throw new h("Legacy serialization format not supported yet.");a=n}else r.util.assert(null!=n.layers,function(){return"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."}),a=n.layers,delete n.layers,s=n;var u=new t(s);if(!(u instanceof e))throw new p("Sequential.fromConfig called on non-Sequential input: "+u);for(var c=0,l=a;c<l.length;c++){var f=Xe(l[c],void 0,o);o&&f.setFastWeightInitDuringBuild(!0),u.add(f)}return u},Object.defineProperty(e.prototype,"stopTraining",{get:function(){if(null==this.model)throw new h("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining},set:function(t){if(null==this.model)throw new h("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=t},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){for(var t=[],e=0,n=this.layers;e<n.length;e++){var r=n[e],i={};i.className=r.getClassName(),i.config=r.getConfig(),t.push(i)}return t},e.className="Sequential",e}(wn);function _n(t){return new wn(t)}function kn(t){return new xn(t)}function Sn(t,e){return null==e&&(e={}),function(t,e){return u(this,void 0,void 0,function(){var n;return c(this,function(i){if(null==e&&(e={}),"string"==typeof t){if(0===(n=r.io.getLoadHandlers(t,e.onProgress)).length)n.push(r.io.browserHTTPRequest(t,e));else if(n.length>1)throw new h("Found more than one ("+n.length+") load handlers for URL '"+t+"'");t=n[0]}return[2,function(t,e,n){return u(this,void 0,void 0,function(){var e,i,o,a,s,u;return c(this,function(c){switch(c.label){case 0:if(null==n&&(n={}),null==t.load)throw new h("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,t.load()];case 1:if(e=c.sent(),null!=(i=e.modelTopology).model_config&&(i=i.model_config),o=null==n.strict||n.strict,a=null!=e.weightData&&null!=e.weightSpecs&&o,s=Xe(Je(i),void 0,a),null!=e.weightData){if(null==e.weightSpecs)throw new h("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");u=r.io.decodeWeights(e.weightData,e.weightSpecs),s.loadWeights(u,o),Object(r.dispose)(u)}return[2,s]}})})}(t,0,e)]})})}(t,e)}function En(t){return me(t)}function On(t,e){Ee.registerCallbackConstructor(t,e)}r.serialization.registerClass(xn);var An=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getConfig=function(){return{}},e}(r.serialization.Serializable),Cn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t,e){return void 0===e&&(e=1),function(t,e){if(void 0===e&&(e=1),1!==e)throw new p("Support for alpha values other than 1 ("+e+") is not implemented yet.");return Object(r.elu)(t)}(t,e)},e.className="elu",e}(An);r.serialization.registerClass(Cn);var Mn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.selu)(t)},e.className="selu",e}(An);r.serialization.registerClass(Mn);var Nn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.relu)(t)},e.className="relu",e}(An);r.serialization.registerClass(Nn);var Tn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.tidy)(function(){return Object(r.minimum)(6,Object(r.relu)(t))})},e.className="relu6",e}(An);r.serialization.registerClass(Tn);var In=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return t},e.className="linear",e}(An);r.serialization.registerClass(In);var Dn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.sigmoid)(t)},e.className="sigmoid",e}(An);r.serialization.registerClass(Dn);var jn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return function(t){return Object(r.tidy)(function(){var e=Object(r.add)(.5,Object(r.mul)(.2,t));return Object(r.clipByValue)(e,0,1)})}(t)},e.className="hardSigmoid",e}(An);r.serialization.registerClass(jn);var Rn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.softplus)(t)},e.className="softplus",e}(An);r.serialization.registerClass(Rn);var Fn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return function(t){return Object(r.tidy)(function(){return Object(r.div)(t,Object(r.abs)(t).add(1))})}(t)},e.className="softsign",e}(An);r.serialization.registerClass(Fn);var Pn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t){return Object(r.tanh)(t)},e.className="tanh",e}(An);r.serialization.registerClass(Pn);var zn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t,e){return void 0===e&&(e=-1),Object(r.softmax)(t,e)},e.className="softmax",e}(An);r.serialization.registerClass(zn);var Ln=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t,e){return void 0===e&&(e=-1),Object(r.logSoftmax)(t,e)},e.className="logSoftmax",e}(An);function Bn(t){return t.getClassName()}function Un(t,e){return void 0===e&&(e={}),E(t,r.serialization.SerializationMap.getMap().classNameMap,e,"activation")}function Wn(t){var e;return null==t?Un(e={className:"linear",config:{}}):"string"==typeof t?((e={}).className=t,e.config={},Un(e)):t instanceof An?t:Un(t)}r.serialization.registerClass(Ln);var qn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r.serialization.Serializable),Vn=function(t){function e(e){var n=t.call(this)||this;return n.l1=null==e||null==e.l1?.01:e.l1,n.l2=null==e||null==e.l2?.01:e.l2,n.hasL1=0!==n.l1,n.hasL2=0!==n.l2,n}return o(e,t),e.prototype.apply=function(t){var e=this;return Object(r.tidy)(function(){var n=Object(r.zeros)([1]);return e.hasL1&&(n=Object(r.add)(n,Object(r.sum)(Object(r.mul)(e.l1,Object(r.abs)(t))))),e.hasL2&&(n=Object(r.add)(n,Object(r.sum)(Object(r.mul)(e.l2,wt(t))))),n.asScalar()})},e.prototype.getConfig=function(){return{l1:this.l1,l2:this.l2}},e.fromConfig=function(t,e){return new t({l1:e.l1,l2:e.l2})},e.className="L1L2",e}(qn);r.serialization.registerClass(Vn);var Hn={l1l2:"L1L2"};function $n(t){return S(t)}function Gn(t,e){return void 0===e&&(e={}),E(t,r.serialization.SerializationMap.getMap().classNameMap,e,"regularizer")}function Kn(t){return null==t?null:"string"==typeof t?Gn({className:t in Hn?Hn[t]:t,config:{}}):t instanceof qn?t:Gn(t)}var Xn=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.supportsMasking=!0,null!=e&&(n.maxValue=e.maxValue),n}return o(e,t),e.prototype.call=function(t,e){t=te(t);var n=Object(r.relu)(t);return null!=this.maxValue&&(n=Object(r.clipByValue)(n,0,this.maxValue)),n},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={maxValue:this.maxValue},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="ReLU",e}(he);r.serialization.registerClass(Xn);var Yn=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.DEFAULT_ALPHA=.3,null==e&&(e={}),n.alpha=null==e.alpha?n.DEFAULT_ALPHA:e.alpha,n}return o(e,t),e.prototype.call=function(t,e){var n=te(t);return Object(r.leakyRelu)(n,this.alpha)},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={alpha:this.alpha},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="LeakyReLU",e}(he);r.serialization.registerClass(Yn);var Jn=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;if(n.DEFAULT_ALPHA_INITIALIZER="zeros",null==e&&(e={}),n.supportsMasking=!0,n.alphaInitializer=$t(e.alphaInitializer||n.DEFAULT_ALPHA_INITIALIZER),n.alphaRegularizer=Kn(e.alphaRegularizer),n.alphaConstraint=U(e.alphaConstraint),null==e.sharedAxes)n.sharedAxes=null;else if(Array.isArray(e.sharedAxes))n.sharedAxes=e.sharedAxes;else{if("number"!=typeof e.sharedAxes)throw new h("Expected sharedAxes to be a number or an array of numbers, but got "+e.sharedAxes);n.sharedAxes=[e.sharedAxes]}return n}return o(e,t),e.prototype.build=function(t){var e=(t=ee(t)).slice(1);if(null!=this.sharedAxes)for(var n=0,r=this.sharedAxes;n<r.length;n++)e[(o=r[n])-1]=1;this.alpha=this.addWeight("alpha",e,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);var i={};if(null!=this.sharedAxes)for(var o=1;o<t.length;++o)i[o]=t[o];this.inputSpec=[new ue({ndim:t.length,axes:i})],this.built=!0},e.prototype.call=function(t,e){return t=te(t),Object(r.prelu)(t,this.alpha.read())},e.prototype.getConfig=function(){var e={alphaInitializer:Ht(this.alphaInitializer),alphaRegularizer:$n(this.alphaRegularizer),alphaConstraint:L(this.alphaConstraint),sharedAxes:this.sharedAxes},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="PReLU",e}(he);r.serialization.registerClass(Jn);var Zn=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;if(n.DEFAULT_ALPHA=1,null==e&&(e={}),null!=e.alpha&&e.alpha!==n.DEFAULT_ALPHA)throw new p("Non-default alpha value ("+e.alpha+") is not supported by the ELU layer yet.");return n.alpha=null==e.alpha?n.DEFAULT_ALPHA:e.alpha,n}return o(e,t),e.prototype.call=function(t,e){var n=te(t);return Object(r.elu)(n)},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={alpha:this.alpha},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="ELU",e}(he);r.serialization.registerClass(Zn);var Qn=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.DEFAULT_THETA=1,null==e&&(e={}),n.theta=null==e.theta?n.DEFAULT_THETA:e.theta,n}return o(e,t),e.prototype.call=function(t,e){var n=te(t);return n.mul(ct(n.greater(this.theta),"float32"))},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={theta:this.theta},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="ThresholdedReLU",e}(he);r.serialization.registerClass(Qn);var tr=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.DEFAULT_AXIS=1,null==e&&(e={}),n.softmax=(new zn).apply,n.axis=null==e.axis?n.DEFAULT_AXIS:e.axis,n}return o(e,t),e.prototype.call=function(t,e){var n=te(t);return this.softmax(n,this.axis)},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e={axis:this.axis},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Softmax",e}(he);function er(t,e,n){if("number"==typeof t)return g(t,e);if(t.length!==e)throw new h("The "+n+" argument must be an integer or tuple of "+e+" integers. Received: "+t.length+" elements.");for(var r=0;r<e;++r){var i=t[r];if(!rt(i))throw new h("The "+n+" argument must be an integer or tuple of "+e+" integers. Received: "+JSON.stringify(t)+" including a non-integer number "+i)}return t}function nr(t,e,n,r,i){return void 0===i&&(i=1),null==t?t:(o="same"===n?t:t-(e+(e-1)*(i-1))+1,Math.floor((o+r-1)/r));var o}function rr(t,e,n,r){if(null==t)return null;if("valid"===r)t=t*e+st([n-e,0]);else{if("same"!==r)throw new h("Unsupport padding mode: "+r+".");t*=e}return t}function ir(t,e){return Object(r.tidy)(function(){return K(e),"channelsFirst"===e?Object(r.transpose)(t,[0,2,3,1]):t})}r.serialization.registerClass(tr);var or=function(t){function e(n,r){var i=t.call(this,r)||this;if(i.bias=null,i.DEFAULT_KERNEL_INITIALIZER="glorotNormal",i.DEFAULT_BIAS_INITIALIZER="zeros",e.verifyArgs(r),i.rank=n,T(i.rank,"rank"),1!==i.rank&&2!==i.rank&&3!==i.rank)throw new p("Convolution layer for rank other than 1, 2, or 3 ("+i.rank+") is not implemented yet.");if(i.kernelSize=er(r.kernelSize,n,"kernelSize"),i.strides=er(null==r.strides?1:r.strides,n,"strides"),i.padding=null==r.padding?"valid":r.padding,X(i.padding),i.dataFormat=null==r.dataFormat?"channelsLast":r.dataFormat,K(i.dataFormat),i.activation=Wn(r.activation),i.useBias=null==r.useBias||r.useBias,i.biasInitializer=$t(r.biasInitializer||i.DEFAULT_BIAS_INITIALIZER),i.biasConstraint=U(r.biasConstraint),i.biasRegularizer=Kn(r.biasRegularizer),i.activityRegularizer=Kn(r.activityRegularizer),i.dilationRate=er(null==r.dilationRate?1:r.dilationRate,n,"dilationRate"),1===i.rank&&Array.isArray(i.dilationRate)&&1!==i.dilationRate.length)throw new h("dilationRate must be a number or an array of a single number for 1D convolution, but received "+JSON.stringify(i.dilationRate));if(2===i.rank){if("number"==typeof i.dilationRate)i.dilationRate=[i.dilationRate,i.dilationRate];else if(2!==i.dilationRate.length)throw new h("dilationRate must be a number or array of two numbers for 2D convolution, but received "+JSON.stringify(i.dilationRate))}else if(3===i.rank)if("number"==typeof i.dilationRate)i.dilationRate=[i.dilationRate,i.dilationRate,i.dilationRate];else if(3!==i.dilationRate.length)throw new h("dilationRate must be a number or array of three numbers for 3D convolution, but received "+JSON.stringify(i.dilationRate));return i}return o(e,t),e.verifyArgs=function(t){if(v("kernelSize"in t,"required key 'kernelSize' not in config"),"number"!=typeof t.kernelSize&&!N(t.kernelSize,"number",1,3))throw new h("BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received "+JSON.stringify(t.kernelSize)+".")},e.prototype.getConfig=function(){var e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Bn(this.activation),useBias:this.useBias,biasInitializer:Ht(this.biasInitializer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),biasConstraint:L(this.biasConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(he),ar=function(t){function e(n,r){var i=t.call(this,n,r)||this;return i.kernel=null,e.verifyArgs(r),i.filters=r.filters,T(i.filters,"filters"),i.kernelInitializer=$t(r.kernelInitializer||i.DEFAULT_KERNEL_INITIALIZER),i.kernelConstraint=U(r.kernelConstraint),i.kernelRegularizer=Kn(r.kernelRegularizer),i}return o(e,t),e.prototype.build=function(t){var e;t=ee(t);var n="channelsFirst"===this.dataFormat?1:t.length-1;if(null==t[n])throw new h("The channel dimension of the input should be defined. Found "+t[n]);var r=t[n],i=this.kernelSize.concat([r,this.filters]);this.kernel=this.addWeight("kernel",i,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:(e={},e[n]=r,e)}],this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e;t=te(t);var i=null==n.bias?null:n.bias.read();if(1===n.rank)e=function(t,e,n,i,o,a,s){return void 0===i&&(i=1),void 0===o&&(o="valid"),void 0===s&&(s=1),Object(r.tidy)(function(){if(null==a&&(a="channelsLast"),K(a),3!==t.shape.length)throw new h("The input of a conv1dWithBias operation should be 3, but is "+t.shape.length+" instead.");if(3!==e.shape.length)throw new h("The kernel for a conv1dWithBias operation should be 3, but is "+e.shape.length+" instead");if(null!=n&&1!==n.shape.length)throw new h("The bias for a conv1dWithBias operation should be 1, but is "+e.shape.length+" instead");if("channelsFirst"===a&&(t=Object(r.transpose)(t,[0,2,1])),"causal"===o)throw new p("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");var u=Object(r.conv1d)(t,e,i,"same"===o?"same":"valid","NWC",s);return null!=n&&(u=_t(u,n)),u})}(t,n.kernel.read(),i,n.strides[0],n.padding,n.dataFormat,n.dilationRate[0]);else if(2===n.rank)e=function(t,e,n,i,o,a,s){return void 0===i&&(i=[1,1]),void 0===o&&(o="valid"),Object(r.tidy)(function(){if(null==a&&(a="channelsLast"),K(a),3!==t.rank&&4!==t.rank)throw new h("conv2dWithBias expects input to be of rank 3 or 4, but received "+t.rank+".");if(3!==e.rank&&4!==e.rank)throw new h("conv2dWithBias expects kernel to be of rank 3 or 4, but received "+t.rank+".");var u=ir(t,a);if("causal"===o)throw new p("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return u=Object(r.conv2d)(u,e,i,"same"===o?"same":"valid","NHWC",s),null!=n&&(u=_t(u,n)),"channelsFirst"===a&&(u=Object(r.transpose)(u,[0,3,1,2])),u})}(t,n.kernel.read(),i,n.strides,n.padding,n.dataFormat,n.dilationRate);else{if(3!==n.rank)throw new p("convolutions greater than 3D are not implemented yet.");e=function(t,e,n,i,o,a,s){return void 0===i&&(i=[1,1,1]),void 0===o&&(o="valid"),Object(r.tidy)(function(){if(null==a&&(a="channelsLast"),K(a),4!==t.rank&&5!==t.rank)throw new h("conv3dWithBias expects input to be of rank 4 or 5, but received "+t.rank+".");if(4!==e.rank&&5!==e.rank)throw new h("conv3dWithBias expects kernel to be of rank 4 or 5, but received "+t.rank+".");var u=function(t,e){return Object(r.tidy)(function(){return K(e),"channelsFirst"===e?Object(r.transpose)(t,[0,2,3,4,1]):t})}(t,a);if("causal"===o)throw new p("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return u=Object(r.conv3d)(u,e,i,"same"===o?"same":"valid","NDHWC",s),null!=n&&(u=_t(u,n)),"channelsFirst"===a&&(u=Object(r.transpose)(u,[0,4,1,2,3])),u})}(t,n.kernel.read(),i,n.strides,n.padding,n.dataFormat,n.dilationRate)}return null!=n.activation&&(e=n.activation.apply(e)),e})},e.prototype.computeOutputShape=function(t){t=ee(t);for(var e=[],n="channelsLast"===this.dataFormat?t.slice(1,t.length-1):t.slice(2),r=0;r<n.length;++r){var i=nr(n[r],this.kernelSize[r],this.padding,this.strides[r],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[r]);e.push(i)}var o=[t[0]];return"channelsLast"===this.dataFormat?(o=o.concat(e)).push(this.filters):(o.push(this.filters),o=o.concat(e)),o},e.prototype.getConfig=function(){var e={filters:this.filters,kernelInitializer:Ht(this.kernelInitializer),kernelRegularizer:$n(this.kernelRegularizer),kernelConstraint:L(this.kernelConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.verifyArgs=function(t){if(!("filters"in t)||"number"!=typeof t.filters||t.filters<1)throw new h("Convolution layer expected config.filters to be a 'number' > 0 but got "+JSON.stringify(t.filters))},e}(or),sr=function(t){function e(n){var r=t.call(this,2,n)||this;return e.verifyArgs(n),r}return o(e,t),e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,e},e.verifyArgs=function(t){if("number"!=typeof t.kernelSize&&!N(t.kernelSize,"number",1,2))throw new h("Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(t.kernelSize)+".")},e.className="Conv2D",e}(ar);r.serialization.registerClass(sr);var ur=function(t){function e(n){var r=t.call(this,3,n)||this;return e.verifyArgs(n),r}return o(e,t),e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,e},e.verifyArgs=function(t){if("number"!=typeof t.kernelSize&&(!Array.isArray(t.kernelSize)||1!==t.kernelSize.length&&3!==t.kernelSize.length))throw new h("Conv3D expects config.kernelSize to be number or [number, number, number], but received "+JSON.stringify(t.kernelSize)+".")},e.className="Conv3D",e}(ar);r.serialization.registerClass(ur);var cr=function(t){function e(e){var n=t.call(this,e)||this;if(n.inputSpec=[new ue({ndim:4})],"same"!==n.padding&&"valid"!==n.padding)throw new h("Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode "+n.padding);return n}return o(e,t),e.prototype.build=function(t){var e;if(4!==(t=ee(t)).length)throw new h("Input should have rank 4; Received input shape: "+JSON.stringify(t));var n="channelsFirst"===this.dataFormat?1:t.length-1;if(null==t[n])throw new h("The channel dimension of the inputs should be defined. Found `None`.");var r=t[n],i=this.kernelSize.concat([this.filters,r]);this.kernel=this.addWeight("kernel",i,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new ue({ndim:4,axes:(e={},e[n]=r,e)})],this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e=te(t);if(4!==e.shape.length)throw new h("Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-"+e.shape.length);var i,o,a=e.shape,s=a[0];"channelsFirst"===n.dataFormat?(i=2,o=3):(i=1,o=2);var u=a[i],c=a[o],l=n.kernelSize[0],f=n.kernelSize[1],d=n.strides[0],p=n.strides[1],m=[s,rr(u,d,l,n.padding),rr(c,p,f,n.padding),n.filters];"channelsLast"!==n.dataFormat&&(e=Object(r.transpose)(e,[0,2,3,1]));var g=Object(r.conv2dTranspose)(e,n.kernel.read(),m,n.strides,n.padding);return"channelsLast"!==n.dataFormat&&(g=Object(r.transpose)(g,[0,3,1,2])),null!=n.bias&&(g=_t(g,n.bias.read(),n.dataFormat)),null!=n.activation&&(g=n.activation.apply(g)),g})},e.prototype.computeOutputShape=function(t){var e,n,r,i=(t=ee(t)).slice();"channelsFirst"===this.dataFormat?(e=1,n=2,r=3):(e=3,n=1,r=2);var o=this.kernelSize[0],a=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return i[e]=this.filters,i[n]=rr(i[n],s,o,this.padding),i[r]=rr(i[r],u,a,this.padding),i},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.dilationRate,e},e.className="Conv2DTranspose",e}(sr);r.serialization.registerClass(cr);var lr=function(t){function e(e){return t.call(this,2,e)||this}return o(e,t),e.className="SeparableConv2D",e}(function(t){function e(e,n){var r=t.call(this,e,n)||this;if(r.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",r.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",r.depthwiseKernel=null,r.pointwiseKernel=null,null==n.filters)throw new h("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=n.kernelInitializer||null!=n.kernelRegularizer||null!=n.kernelConstraint)throw new h("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=n.padding&&"same"!==n.padding&&"valid"!==n.padding)throw new h("SeparableConv"+r.rank+"D supports only padding modes: 'same' and 'valid', but received "+JSON.stringify(n.padding));return r.depthMultiplier=null==n.depthMultiplier?1:n.depthMultiplier,r.depthwiseInitializer=$t(n.depthwiseInitializer||r.DEFAULT_DEPTHWISE_INITIALIZER),r.depthwiseRegularizer=Kn(n.depthwiseRegularizer),r.depthwiseConstraint=U(n.depthwiseConstraint),r.pointwiseInitializer=$t(n.depthwiseInitializer||r.DEFAULT_POINTWISE_INITIALIZER),r.pointwiseRegularizer=Kn(n.pointwiseRegularizer),r.pointwiseConstraint=U(n.pointwiseConstraint),r}return o(e,t),e.prototype.build=function(t){var e;if((t=ee(t)).length<this.rank+2)throw new h("Inputs to SeparableConv"+this.rank+"D should have rank "+(this.rank+2)+", but received input shape: "+JSON.stringify(t));var n="channelsFirst"===this.dataFormat?1:t.length-1;if(null==t[n]||t[n]<0)throw new h("The channel dimension of the inputs should be defined, but found "+JSON.stringify(t[n]));for(var r=t[n],i=this.kernelSize.concat([r,this.depthMultiplier]),o=[],a=0;a<this.rank;++a)o.push(1);o.push(r*this.depthMultiplier,this.filters),this.depthwiseKernel=this.addWeight("depthwise_kernel",i,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",o,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,!0,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.inputSpec=[new ue({ndim:this.rank+2,axes:(e={},e[n]=r,e)})],this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e;if(t=te(t),1===n.rank)throw new p("1D separable convolution is not implemented yet.");return 2===n.rank&&("channelsFirst"===n.dataFormat&&(t=Object(r.transpose)(t,[0,2,3,1])),e=Object(r.separableConv2d)(t,n.depthwiseKernel.read(),n.pointwiseKernel.read(),n.strides,n.padding,n.dilationRate,"NHWC")),n.useBias&&(e=_t(e,n.bias.read(),n.dataFormat)),null!=n.activation&&(e=n.activation.apply(e)),"channelsFirst"===n.dataFormat&&(e=Object(r.transpose)(e,[0,3,1,2])),e})},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=Ht(this.depthwiseInitializer),e.pointwiseInitializer=Ht(this.pointwiseInitializer),e.depthwiseRegularizer=$n(this.depthwiseRegularizer),e.pointwiseRegularizer=$n(this.pointwiseRegularizer),e.depthwiseConstraint=L(this.depthwiseConstraint),e.pointwiseConstraint=L(this.pointwiseConstraint),e},e.className="SeparableConv",e}(ar));r.serialization.registerClass(lr);var fr=function(t){function e(n){var r=t.call(this,1,n)||this;return e.verifyArgs(n),r.inputSpec=[{ndim:3}],r}return o(e,t),e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return delete e.rank,delete e.dataFormat,e},e.verifyArgs=function(t){if("number"!=typeof t.kernelSize&&!N(t.kernelSize,"number",1,1))throw new h("Conv1D expects config.kernelSize to be number or number[] with length 1, but received "+JSON.stringify(t.kernelSize)+".")},e.className="Conv1D",e}(ar);r.serialization.registerClass(fr);var dr=function(t){function e(e){var n=t.call(this,e)||this;return"number"==typeof e.cropping?n.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:"number"==typeof e.cropping[0]?n.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:n.cropping=e.cropping,n.dataFormat=void 0===e.dataFormat?"channelsLast":e.dataFormat,n.inputSpec=[{ndim:4}],n}return o(e,t),e.prototype.computeOutputShape=function(t){return"channelsFirst"===this.dataFormat?[t[0],t[1],t[2]-this.cropping[0][0]-this.cropping[0][1],t[3]-this.cropping[1][0]-this.cropping[1][1]]:[t[0],t[1]-this.cropping[0][0]-this.cropping[0][1],t[2]-this.cropping[1][0]-this.cropping[1][1],t[3]]},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){return t=te(t),"channelsLast"===n.dataFormat?ht(ht(t,n.cropping[0][0],t.shape[1]-n.cropping[0][0]-n.cropping[0][1],2),n.cropping[1][0],t.shape[2]-n.cropping[1][1]-n.cropping[1][0],3):ht(ht(t,n.cropping[0][0],t.shape[2]-n.cropping[0][0]-n.cropping[0][1],3),n.cropping[1][0],t.shape[3]-n.cropping[1][1]-n.cropping[1][0],4)})},e.prototype.getConfig=function(){var e={cropping:this.cropping,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Cropping2D",e}(he);r.serialization.registerClass(dr);var hr=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_SIZE=[2,2],n.inputSpec=[{ndim:4}],n.size=null==e.size?n.DEFAULT_SIZE:e.size,n.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,n}return o(e,t),e.prototype.computeOutputShape=function(t){if("channelsFirst"===this.dataFormat){var e=null==t[2]?null:this.size[0]*t[2],n=null==t[3]?null:this.size[1]*t[3];return[t[0],t[1],e,n]}return e=null==t[1]?null:this.size[0]*t[1],n=null==t[2]?null:this.size[1]*t[2],[t[0],e,n,t[3]]},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e=te(t),i=e.shape;if("channelsFirst"===n.dataFormat){e=Object(r.transpose)(e,[0,2,3,1]);var o=n.size[0]*i[2],a=n.size[1]*i[3],s=e.resizeNearestNeighbor([o,a]);return Object(r.transpose)(s,[0,3,1,2])}return o=n.size[0]*i[1],a=n.size[1]*i[2],e.resizeNearestNeighbor([o,a])})},e.prototype.getConfig=function(){var e={size:this.size,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="UpSampling2D",e}(he);r.serialization.registerClass(hr);var pr=function(t){function e(e){var n=t.call(this,2,e)||this;return n.depthwiseKernel=null,n.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,n.depthwiseInitializer=$t(e.depthwiseInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.depthwiseConstraint=U(e.depthwiseConstraint),n.depthwiseRegularizer=Kn(e.depthwiseRegularizer),n}return o(e,t),e.prototype.build=function(t){if((t=ee(t)).length<4)throw new h("Inputs to DepthwiseConv2D should have rank 4. Received input shape: "+JSON.stringify(t)+".");var e="channelsFirst"===this.dataFormat?1:3;if(null==t[e]||t[e]<0)throw new h("The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not ("+t[e]+").");var n=t[e],r=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",r,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e=function(t,e,n,i,o,a){return void 0===n&&(n=[1,1]),void 0===i&&(i="valid"),Object(r.tidy)(function(){null==o&&(o="channelsLast"),K(o);var a=ir(t,o);if(4!==t.rank)throw new h("Input for depthwiseConv2d is required to be 4-D, but is instead "+t.rank+"-D");if(4!==e.rank)throw new h("depthwiseKernel is required to be 4-D, but is instead "+e.rank+"-D");return a=Object(r.depthwiseConv2d)(a,e,n,"same"===i?"same":"valid","NHWC",null),"channelsFirst"===o&&(a=Object(r.transpose)(a,[0,3,1,2])),a})}(t=te(t),n.depthwiseKernel.read(),n.strides,n.padding,n.dataFormat);return n.useBias&&(e=_t(e,n.bias.read(),n.dataFormat)),null!=n.activation&&(e=n.activation.apply(e)),e})},e.prototype.computeOutputShape=function(t){t=ee(t);var e="channelsFirst"===this.dataFormat?t[2]:t[1],n="channelsFirst"===this.dataFormat?t[3]:t[2],r="channelsFirst"===this.dataFormat?t[1]*this.depthMultiplier:t[3]*this.depthMultiplier,i=nr(e,this.kernelSize[0],this.padding,this.strides[0]),o=nr(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[t[0],r,i,o]:[t[0],i,o,r]},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this);return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=Ht(this.depthwiseInitializer),e.depthwiseRegularizer=$n(this.depthwiseRegularizer),e.depthwiseConstraint=L(this.depthwiseRegularizer),e},e.className="DepthwiseConv2D",e}(or);r.serialization.registerClass(pr);var mr=function(t){function e(e){var n=t.call(this,e)||this;if(n.rate=Math.max(Math.min(e.rate,1),0),n.noiseShape=e.noiseShape,n.seed=e.seed,null!=n.seed)throw new p("Non-default seed is not implemented in Dropout layer yet: "+n.seed);return n.supportsMasking=!0,n}return o(e,t),e.prototype.getNoiseShape=function(t){if(null==this.noiseShape)return this.noiseShape;for(var e=t.shape,n=[],r=0;r<this.noiseShape.length;++r)n.push(null==this.noiseShape[r]?e[r]:this.noiseShape[r]);return n},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var i=te(t);if(null!=n.noiseShape&&!r.util.arraysEqual(i.shape,n.noiseShape))throw new p("Non-default noise shape is not implemented in Dropout layer yet: "+JSON.stringify(n.noiseShape));if(0<n.rate&&n.rate<1){var o=null!=e.training&&e.training,a=n.getNoiseShape(i);return St(function(){return kt(i,n.rate,a,n.seed)},function(){return i},o)}return t})},e.prototype.getConfig=function(){var e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.prototype.dispose=function(){return t.prototype.dispose.call(this)},e.className="Dropout",e}(he);r.serialization.registerClass(mr);var gr=function(t){function e(e){var n=t.call(this,e)||this;if(n.activation=null,n.useBias=!0,n.kernel=null,n.bias=null,n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_BIAS_INITIALIZER="zeros",null==e.batchInputShape&&null==e.inputShape&&null!=e.inputDim){var r=null;null!=e.batchSize&&(r=e.batchSize),n.batchInputShape=[r,e.inputDim]}return n.units=e.units,T(n.units,"units"),n.activation=Wn(e.activation),null!=e.useBias&&(n.useBias=e.useBias),n.kernelInitializer=$t(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.biasInitializer=$t(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelConstraint=U(e.kernelConstraint),n.biasConstraint=U(e.biasConstraint),n.kernelRegularizer=Kn(e.kernelRegularizer),n.biasRegularizer=Kn(e.biasRegularizer),n.activityRegularizer=Kn(e.activityRegularizer),n.supportsMasking=!0,n.inputSpec=[{minNDim:2}],n}return o(e,t),e.prototype.build=function(t){var e,n=(t=ee(t))[t.length-1];null==this.kernel&&(this.kernel=this.addWeight("kernel",[n,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:(e={},e[-1]=n,e)}],this.built=!0},e.prototype.computeOutputShape=function(t){var e=(t=ee(t)).slice();return e[e.length-1]=this.units,e},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var r,i=te(t),o=function(t){return"relu"===t?"relu":"linear"===t?"linear":null}(n.activation.getClassName());return null!=o?r=bt(i,n.kernel.read(),o,n.bias?n.bias.read():null):(r=bt(i,n.kernel.read()),null!=n.bias&&(r=_t(r,n.bias.read())),null!=n.activation&&(r=n.activation.apply(r))),r})},e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:$n(this.kernelRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),biasConstraint:L(this.biasConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Dense",e}(he);r.serialization.registerClass(gr);var vr=function(t){function e(e){var n=t.call(this,e||{})||this;return n.inputSpec=[{minNDim:3}],n}return o(e,t),e.prototype.computeOutputShape=function(t){for(var e=0,n=(t=ee(t)).slice(1);e<n.length;e++)if(null==n[e])throw new h('The shape of the input to "Flatten" is not fully defined (got '+t.slice(1)+'). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.');return[t[0],it(t,1)]},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){return n.invokeCallHook(t,e),function(t){if(t.rank<=1)throw new h("batchFlatten requires a minimum rank of 2. Got rank: "+t.rank+".");var e=[t.shape[0],it(t.shape,1)];return t.reshape(e)}(te(t))})},e.className="Flatten",e}(he);r.serialization.registerClass(vr);var br=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.activation=Wn(e.activation),n}return o(e,t),e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var r=te(t);return n.activation.apply(r)})},e.prototype.getConfig=function(){var e={activation:Bn(this.activation)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Activation",e}(he);r.serialization.registerClass(br);var yr=function(t){function e(e){var n=t.call(this,e)||this;return n.n=e.n,n.inputSpec=[{ndim:2}],n}return o(e,t),e.prototype.computeOutputShape=function(t){return[t[0],this.n,t[1]]},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){return function(t,e){return Object(r.tidy)(function(){if(2!==t.shape.length)throw new h("repeat() expects a rank-2 tensor, but received a rank-"+t.shape.length+" tensor.");return gt(lt(t,1),[1,e,1])})}(t=te(t),n.n)})},e.prototype.getConfig=function(){var e={n:this.n},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="RepeatVector",e}(he);r.serialization.registerClass(yr);var wr=function(t){function e(e){var n=t.call(this,e)||this;n.targetShape=e.targetShape;for(var r=0;r<n.targetShape.length;++r)n.isUnknown(n.targetShape[r])&&(n.targetShape[r]=null);return n}return o(e,t),e.prototype.isUnknown=function(t){return t<0||null==t},e.prototype.fixUnknownDimension=function(t,e){for(var n="Total size of new array must be unchanged.",r=e.slice(),i=1,o=null,a=0;a<r.length;++a){var s=r[a];if(this.isUnknown(s)){if(null!==o)throw new h("Can only specifiy one unknown dimension.");o=a}else i*=s}var u=it(t);if(null!==o){if(0===i||u%i!=0)throw new h(n);r[o]=u/i}else if(u!==i)throw new h(n);return r},e.prototype.computeOutputShape=function(t){for(var e=!1,n=0;n<t.length;++n)if(this.isUnknown(t[n])){e=!0;break}return e?t.slice(0,1).concat(this.targetShape):t.slice(0,1).concat(this.fixUnknownDimension(t.slice(1),this.targetShape))},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var r=te(t),i=r.shape,o=i.slice(0,1).concat(n.fixUnknownDimension(i.slice(1),n.targetShape));return r.reshape(o)})},e.prototype.getConfig=function(){var e={targetShape:this.targetShape},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Reshape",e}(he);r.serialization.registerClass(wr);var xr=function(t){function e(e){var n=t.call(this,e)||this;if(null==e.dims)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error("Permute constructor requires `dims` to be an Array, but received "+e.dims+" instead.");var i=ut(1,e.dims.length+1);if(!r.util.arraysEqual(e.dims.slice().sort(),i))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");return n.dims=e.dims,n.dimsIncludingBatch=[0].concat(n.dims),n.inputSpec=[new ue({ndim:n.dims.length+1})],n}return o(e,t),e.prototype.computeOutputShape=function(t){var e=(t=ee(t)).slice();return this.dims.forEach(function(n,r){e[r+1]=t[n]}),e},e.prototype.call=function(t,e){return Object(r.transpose)(te(t),this.dimsIncludingBatch)},e.prototype.getConfig=function(){var e={dims:this.dims},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Permute",e}(he);r.serialization.registerClass(xr);var _r=function(t){function e(e){var n=t.call(this,null==e?{}:e)||this;return n.supportsMasking=!0,n.maskValue=null!=e?null==e.maskValue?0:e.maskValue:0,n}return o(e,t),e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={maskValue:this.maskValue};return Object.assign(n,e),n},e.prototype.computeMask=function(t,e){var n=te(t);return Object(r.any)(Object(r.notEqual)(n,this.maskValue),-1)},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var i=te(t),o=Object(r.any)(Object(r.notEqual)(i,n.maskValue),-1,!0);return i.mul(o.asType(i.dtype))})},e.className="Masking",e}(he);r.serialization.registerClass(_r);var kr=function(t){function e(e){var n=t.call(this,e)||this;if(n.embeddings=null,n.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==e.batchInputShape&&null==e.inputShape){var r=null;null!=e.batchSize&&(r=e.batchSize),null==e.inputLength?n.batchInputShape=[r,null]:n.batchInputShape=[r].concat(w(e.inputLength))}return n.inputDim=e.inputDim,T(n.inputDim,"inputDim"),n.outputDim=e.outputDim,T(n.outputDim,"outputDim"),n.embeddingsInitializer=$t(e.embeddingsInitializer||n.DEFAULT_EMBEDDINGS_INITIALIZER),n.embeddingsRegularizer=Kn(e.embeddingsRegularizer),n.activityRegularizer=Kn(e.activityRegularizer),n.embeddingsConstraint=U(e.embeddingsConstraint),n.maskZero=e.maskZero,n.supportsMasking=e.maskZero,n.inputLength=e.inputLength,n}return o(e,t),e.prototype.build=function(t){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0},e.prototype.warnOnIncompatibleInputShape=function(t){},e.prototype.computeMask=function(t,e){var n=this;return Object(r.tidy)(function(){return n.maskZero?(t=te(t),Object(r.notEqual)(t,Object(r.zerosLike)(t))):null})},e.prototype.computeOutputShape=function(t){if(t=ee(t),null==this.inputLength)return t.concat([this.outputDim]);var e=w(this.inputLength);if(e.length!==t.length-1)throw new h('"inputLength" is '+this.inputLength+", but received input shape has shape "+t);for(var n=0,r=0;r<e.length;++r){var i=e[r],o=t[r+1];if(null!=i&&null!=o&&i!==o)throw new h('"inputLength" is '+this.inputLength+", but received input shape has shape "+t);null==i&&(e[n]=o),n++}return[t[0]].concat(e,[this.outputDim])},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var r=te(t);return"int32"!==r.dtype&&(r=ct(r,"int32")),yt(n.embeddings.read(),r.as1D()).reshape(ee(n.computeOutputShape(r.shape)))})},e.prototype.getConfig=function(){var e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:Ht(this.embeddingsInitializer),embeddingsRegularizer:$n(this.embeddingsRegularizer),activityRegularizer:$n(this.activityRegularizer),embeddingsConstraint:L(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Embedding",e}(he);r.serialization.registerClass(kr);var Sr=function(t){function e(e){var n=t.call(this,e||{})||this;return n.supportsMasking=!0,n}return o(e,t),e.prototype.mergeFunction=function(t){throw new p},e.prototype.computeElementwiseOpOutputShape=function(t,e){if(null==t||null==e)return null;if(t.length<e.length)return this.computeElementwiseOpOutputShape(e,t);if(0===e.length)return t;for(var n=t.slice(0,t.length-e.length),r=0;r<e.length;++r){var i=t[t.length-e.length+r],o=e[r];if(null==i||null==o||i<0||o<0)n.push(null);else if(1===i)n.push(o);else if(1===o)n.push(i);else{if(i!==o)throw new h("Operands could not be broadcast together with shapes "+JSON.stringify(t)+" "+JSON.stringify(e));n.push(i)}}return n},e.prototype.build=function(t){if(Array.isArray(t)&&!Array.isArray(t[0])&&(t=[ee(t)]),(t=t).length<2)throw new h("A merge layer should be called on an Array of at least 2 inputs. Got "+t.length+" input(s).");for(var e=[],n=0,r=t;n<r.length;n++)null!=(a=r[n])&&null!==a[0]&&e.push(a[0]);if((e=A(e)).length>1)throw new h("Can not merge tensors with different batch sizes. Got tensors with shapes: "+JSON.stringify(t)+".");for(var i=null==t[0]?null:t[0].slice(1),o=1;o<t.length;++o){var a=null==t[o]?null:t[o].slice(1);i=this.computeElementwiseOpOutputShape(i,a)}var s=t.map(function(t){return t.length});-1===t.indexOf(null)&&1===A(s).length?this.reshapeRequired=!1:this.reshapeRequired=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){if(t=t,n.reshapeRequired){var e=[],i=t.map(function(t){return t.rank});if(-1===i.indexOf(null)){for(var o=st(i),a=0,s=t;a<s.length;a++){for(var u=(h=s[a]).rank,c=0;c<o-u;++c)h=lt(h,1);e.push(h)}return n.mergeFunction(e)}for(var l=!1,f=0,d=t;f<d.length;f++){var h;if(null==(u=(h=d[f]).rank)){var p=h.shape,m=p[0],g=p.slice(1).concat([m]),v=h.reshape([m].concat(it(p.slice(1))));v=(v=Object(r.transpose)(v,[1,0])).reshape(g),e.push(v),l=!0}else if(u>1){var b=ut(1,u).concat([0]);e.push(Object(r.transpose)(h,b)),l=!0}else e.push(h)}var y=n.mergeFunction(e),w=y.rank;if(l)if(null==w){var x=y.shape;g=[m=x[x.length-1]].concat(x.slice(0,x.length-1)),y=Object(r.transpose)(y.reshape([-1,m]),[1,0]).reshape(g)}else w>1&&(b=[w-1].concat(ut(0,w-1)),y=Object(r.transpose)(y,b));return y}return n.mergeFunction(t)})},e.prototype.computeOutputShape=function(t){var e;e=null==(t=t)[0]?null:t[0].slice(1);for(var n=1;n<t.length;++n){var r=null==t[n]?null:t[n].slice(1);e=this.computeElementwiseOpOutputShape(e,r)}for(var i=[],o=0,a=t;o<a.length;o++)null!=(r=a[o])&&null!==r[0]&&i.push(r[0]);return 1===(i=A(i)).length?i.concat(e):[null].concat(e)},e.prototype.computeMask=function(t,e){return Object(r.tidy)(function(){if(null==e)return null;if(!Array.isArray(e))throw new h("`mask` should be an Array");if(!Array.isArray(t))throw new h("`inputs` should be an Array");if(e.length!==t.length)throw new h("The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths ("+t.length+" vs "+e.length+")");if(e.every(function(t){return null==t}))return null;for(var n=(e=e.map(function(t){return null==t?t:Object(r.expandDims)(t,0)}))[0],i=1;i<e.length-1;++i)n=Object(r.logicalAnd)(n,e[i]);return n})},e}(he),Er=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.mergeFunction=function(t){return Object(r.tidy)(function(){for(var e=t[0].clone(),n=1;n<t.length;++n)e=Object(r.add)(e,t[n]);return e})},e.className="Add",e}(Sr);r.serialization.registerClass(Er);var Or=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.mergeFunction=function(t){return Object(r.tidy)(function(){for(var e=t[0].clone(),n=1;n<t.length;++n)e=Object(r.mul)(e,t[n]);return e})},e.className="Multiply",e}(Sr);r.serialization.registerClass(Or);var Ar=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.mergeFunction=function(t){return Object(r.tidy)(function(){for(var e=t[0].clone(),n=1;n<t.length;++n)e=Object(r.add)(e,t[n]);return Object(r.mul)(1/t.length,e)})},e.className="Average",e}(Sr);r.serialization.registerClass(Ar);var Cr=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.mergeFunction=function(t){return Object(r.tidy)(function(){for(var e=t[0],n=1;n<t.length;++n)e=Object(r.maximum)(e,t[n]);return e})},e.className="Maximum",e}(Sr);r.serialization.registerClass(Cr);var Mr=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.mergeFunction=function(t){return Object(r.tidy)(function(){for(var e=t[0],n=1;n<t.length;++n)e=Object(r.minimum)(e,t[n]);return e})},e.className="Minimum",e}(Sr);r.serialization.registerClass(Mr);var Nr=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_AXIS=-1,null==e&&(e={}),n.axis=null==e.axis?n.DEFAULT_AXIS:e.axis,n.supportsMasking=!0,n.reshapeRequired=!1,n}return o(e,t),e.prototype.build=function(t){if(!Array.isArray(t)||!Array.isArray(t[0])||1===t.length)throw new h("A `Concatenate` layer should be called on a list of at least 2 inputs");for(var e=!0,n=0,i=t=t;n<i.length;n++)if(null!=(f=i[n])){e=!1;break}if(!e){for(var o=[],a=0;a<t.length;++a){var s=t[a].slice();s.splice(this.axis,1);for(var u=!1,c=0,l=o;c<l.length;c++){var f=l[c];if(r.util.arraysEqual(f,s)){u=!0;break}}u||o.push(s)}if(o.length>1)throw new h("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(t))}},e.prototype.mergeFunction=function(t){var e=this;return Object(r.tidy)(function(){return pt(t,e.axis)})},e.prototype.computeOutputShape=function(t){if(!Array.isArray(t)||!Array.isArray(t[0]))throw new h("A `Concatenate` layer should be called on a list of inputs.");for(var e=t,n=e[0].slice(),r=this.axis<0?n.length+this.axis:this.axis,i=0,o=e.slice(1);i<o.length;i++){var a=o[i];if(null==n[r]||null==a[r]){n[r]=null;break}n[r]+=a[r]}return n},e.prototype.computeMask=function(t,e){var n=this;if(null==e)return null;if(!Array.isArray(e))throw new h("`mask` should be an array for Concatenate");if(!Array.isArray(t))throw new h("`inputs` should be an array for Concatenate");if(e.length!==t.length)throw new h("Mismatch in the length of mask ("+e.length+") and the legnth of inputs ("+t.length+")");return Object(r.tidy)(function(){var i=!0;if(e.forEach(function(t){null==t||(i=!1)}),i)return null;for(var o=[],a=0;a<t.length;++a)null==e[a]?o.push(Object(r.onesLike)(t[a]).asType("bool")):e[a].rank<t[a].rank?o.push(Object(r.expandDims)(e[a],-1)):o.push(e[a]);var s=Object(r.concat)(o,n.axis);return Object(r.all)(s,-1,!1)})},e.prototype.getConfig=function(){var e={axis:this.axis},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Concatenate",e}(Sr);function Tr(t,e){for(;t<0;)t+=e;return t}r.serialization.registerClass(Nr);var Ir=function(t){function e(e){var n=t.call(this,e)||this;return n.axes=e.axes,n.normalize=null!=e.normalize&&e.normalize,n.supportsMasking=!0,n.reshapeRequired=!1,n}return o(e,t),e.prototype.build=function(t){r.util.assert(Array.isArray(t)&&2===t.length&&Array.isArray(t[0])&&Array.isArray(t[1]),function(){return"A `Dot` layer should be called on a list of exactly 2 inputs."});var e=t[0],n=t[1];if(e.length>3||n.length>3)throw new p("Dot layer does not support tensors of 4D or higher rank yet.");var i=this.interpretAxes(e,n);if(e[i[0]]!==n[i[1]])throw new h("Dimension incompatibility: "+e[i[0]]+" !== "+n[i[1]])},e.prototype.mergeFunction=function(t){if(2!==t.length)throw new h("A `Dot` layer must be called on exactly 2 inputs, but received "+t.length+" input(s).");var e,n=t[0],i=t[1];return e=Array.isArray(this.axes)?this.axes.map(function(e,n){return Tr(e,t[n].shape.length)}):[Tr(this.axes,n.shape.length),Tr(this.axes,i.shape.length)],this.normalize&&(n=Ae(n,e[0]),i=Ae(i,e[1])),function(t,e,n){if(t.shape.length>3||e.shape.length>3)throw new p("batchDot is not implemented for tensors of 4D or higher rank yet");if(r.util.assert(t.shape.length>=2,function(){return"batchDot requires the rank of x to be >= 2, but got "+t.shape.length}),r.util.assert(t.shape.length>=2,function(){return"batchDot requires the rank of y to be >= 2, but got "+e.shape.length}),"number"==typeof n&&(n=[n,n]),"complex64"===t.dtype||"complex64"===e.dtype)throw new p("batchDot is not implemented for complex64-type Tensors yet.");var i=t.shape.length,o=e.shape.length;null==n&&(n=[i-1,o-2]);var a=n;return Object(r.tidy)(function(){var n,r;if(i>o){n=i-o;for(var s=[],u=0;u<n;++u)s.push(1);e=e.reshape(e.shape.concat(s))}else if(o>i){for(n=o-i,s=[],u=0;u<n;++u)s.push(1);t=t.reshape(t.shape.concat(s))}else n=0;if(2===t.shape.length&&2===e.shape.length)r=a[0]===a[1]?t.mulStrict(e).sum(a[0]):t.transpose([1,0]).mulStrict(e).sum(a[1]);else{var c=a[0]!==t.shape.length-1,l=a[1]===e.shape.length-1;r=t.matMul(e,c,l)}if(n>0){var f,d=[];for(u=f=i>o?i+o-3:i-1;u<f+n;++u)d.push(u);r=r.squeeze(d)}return 1===r.shape.length&&(r=r.expandDims(1)),r})}(n,i,e)},e.prototype.interpretAxes=function(t,e){return Array.isArray(this.axes)?this.axes:[Tr(this.axes,t.length),Tr(this.axes,e.length)]},e.prototype.computeOutputShape=function(t){r.util.assert(Array.isArray(t)&&2===t.length&&Array.isArray(t[0])&&Array.isArray(t[1]),function(){return"A `Dot` layer should be called on a list of exactly 2 inputs."});var e=t[0].slice(),n=t[1].slice();if(e.length>3||n.length>3)throw new p("Dot layer does not support tensors of 4D or higher rank yet.");var i=this.interpretAxes(e,n);e.splice(i[0],1),n.splice(i[1],1),n.splice(0,1);var o=e.concat(n);return 1===o.length&&o.push(1),o},e.prototype.computeMask=function(t,e){return null},e.prototype.getConfig=function(){var e={axes:this.axes,normalize:this.normalize},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="Dot",e}(Sr);r.serialization.registerClass(Ir);var Dr=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.stddev=e.stddev,n}return o(e,t),e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={stddev:this.stddev};return Object.assign(n,e),n},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var r=te(t);return St(function(){return vt(r.shape,0,n.stddev).add(r)},function(){return r},e.training||!1)})},e.className="GaussianNoise",e}(he);r.serialization.registerClass(Dr);var jr=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.rate=e.rate,n}return o(e,t),e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={rate:this.rate};return Object.assign(n,e),n},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e);var r=te(t);return n.rate>0&&n.rate<1?St(function(){var t=Math.sqrt(n.rate/(1-n.rate));return r.mul(vt(r.shape,1,t))},function(){return r},e.training||!1):r})},e.className="GaussianDropout",e}(he);r.serialization.registerClass(jr);var Rr=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n.rate=e.rate,n.noiseShape=e.noiseShape,n}return o(e,t),e.prototype._getNoiseShape=function(t){return this.noiseShape||te(t).shape},e.prototype.computeOutputShape=function(t){return t},e.prototype.getConfig=function(){var e=t.prototype.getConfig.call(this),n={rate:this.rate};return Object.assign(n,e),n},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){if(n.rate<1&&n.rate>0){var i=n._getNoiseShape(t);return St(function(){var e=te(t),o=-1.7580993408473766,a=Object(r.greaterEqual)(Object(r.randomUniform)(i),n.rate);a=ct(a,"float32");var s=Math.pow((1-n.rate)*(1+n.rate*Math.pow(o,2)),-.5),u=-s*o*n.rate;return e.mul(a).add(a.add(-1).mul(o)).mul(s).add(u)},function(){return te(t)},e.training||!1)}return t})},e.className="AlphaDropout",e}(he);function Fr(t,e,n,i,o,a){var s;if(void 0===a&&(a=.001),2===t.rank)s=Object(r.batchNorm2d)(t,e,n,i,o,a);else if(3===t.rank)s=Object(r.batchNorm3d)(t,e,n,i,o,a);else{if(4!==t.rank)throw new p("batchNormalization is not implemented for array of rank "+t.rank+" yet");s=Object(r.batchNorm4d)(t,e,n,i,o,a)}return s}r.serialization.registerClass(Rr);var Pr=function(t){function e(e){var n=this;return null==e&&(e={}),(n=t.call(this,e)||this).supportsMasking=!0,n.axis=null==e.axis?-1:e.axis,n.momentum=null==e.momentum?.99:e.momentum,n.epsilon=null==e.epsilon?.001:e.epsilon,n.center=null==e.center||e.center,n.scale=null==e.scale||e.scale,n.betaInitializer=$t(e.betaInitializer||"zeros"),n.gammaInitializer=$t(e.gammaInitializer||"ones"),n.movingMeanInitializer=$t(e.movingMeanInitializer||"zeros"),n.movingVarianceInitializer=$t(e.movingVarianceInitializer||"ones"),n.betaConstraint=U(e.betaConstraint),n.gammaConstraint=U(e.gammaConstraint),n.betaRegularizer=Kn(e.betaRegularizer),n.gammaRegularizer=Kn(e.gammaRegularizer),n}return o(e,t),e.prototype.build=function(t){var e;t=ee(t);var n=this.axis>=0?this.axis:this.axis+t.length,r=t[n];if(null==r)throw new h("Axis "+n+" of input tensor should have a defined dimension but the layer received an input with shape "+JSON.stringify(t)+".");this.inputSpec=[new ue({ndim:t.length,axes:(e={},e[n]=r,e)})];var i=[r];this.scale&&(this.gamma=this.addWeight("gamma",i,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",i,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",i,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",i,null,this.movingVarianceInitializer,null,!1),this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var i=null!=e.training&&e.training,o=te(t),a=o.shape,s=a.length,u=ut(0,s),c=n.axis>=0?n.axis:n.axis+s;u.splice(c,1);var l=g(1,s);l[c]=a[c];var f=u.slice();f.sort();var d=!r.util.arraysEqual(f,ut(0,s).slice(0,s-1));if(!i)return function(){if(d){var t=n.movingMean.read().reshape(l),e=n.movingVariance.read().reshape(l),r=n.center?n.beta.read().reshape(l):null,i=n.scale?n.gamma.read().reshape(l):null;return Fr(o,t,e,r,i,n.epsilon)}return Fr(o,n.movingMean.read(),n.movingVariance.read(),null==n.beta?null:n.beta.read(),null==n.gamma?null:n.gamma.read(),n.epsilon)}();var h=function(t,e,n,i,o){return void 0===o&&(o=.001),r.util.arraysEqual(i.slice().sort(),ut(0,t.rank-1))?function(t,e,n,i,o){return void 0===o&&(o=.001),Object(r.tidy)(function(){var a=Object(r.moments)(t,i),s=a.mean,u=a.variance;return[Fr(t,s,u,n,e,o),s,u]})}(t,e,n,i,o):function(t,e,n,i,o){return void 0===o&&(o=.001),Object(r.tidy)(function(){for(var a=Object(r.moments)(t,i),s=a.mean,u=a.variance,c=[],l=0,f=ut(0,t.rank);l<f.length;l++){var d=f[l];-1!==i.indexOf(d)?c.push(1):c.push(t.shape[d])}var h=s.reshape(c),p=u.reshape(c),m=null==e?null:e.reshape(c),g=null==n?null:n.reshape(c);return[Fr(t,h,p,g,m,o),s,u]})}(t,e,n,i,o)}(o,n.gamma.read(),n.beta.read(),u,n.epsilon),p=h[0],m=h[1],v=h[2],b=function(t,e,n){Object(r.tidy)(function(){var r=1-n,i=t.read(),o=i.sub(e).mul(r);t.write(i.sub(o))})};return b(n.movingMean,m,n.momentum),b(n.movingVariance,v,n.momentum),p})},e.prototype.getConfig=function(){var e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Ht(this.betaInitializer),gammaInitializer:Ht(this.gammaInitializer),movingMeanInitializer:Ht(this.movingMeanInitializer),movingVarianceInitializer:Ht(this.movingVarianceInitializer),betaRegularizer:$n(this.betaRegularizer),gammaRegularizer:$n(this.gammaRegularizer),betaConstraint:L(this.betaConstraint),gammaConstraint:L(this.gammaConstraint)},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="BatchNormalization",e}(he);r.serialization.registerClass(Pr);var zr=function(t){function e(e){var n=this;if(null==e&&(e={}),(n=t.call(this,e)||this).dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,null==e.padding)n.padding=[[1,1],[1,1]];else if("number"==typeof e.padding)n.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,2!==e.padding.length)throw new h("ZeroPadding2D expects padding to be a length-2 array, but received a length-"+e.padding.length+" array.");var r=void 0,i=void 0;if("number"==typeof e.padding[0])r=[e.padding[0],e.padding[0]],i=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,2!==e.padding[0].length)throw new h("ZeroPadding2D expects height padding to be a length-2 array, but received a length-"+e.padding[0].length+" array.");if(r=e.padding[0],2!==e.padding[1].length)throw new h("ZeroPadding2D expects width padding to be a length-2 array, but received a length-"+e.padding[1].length+" array.");i=e.padding[1]}n.padding=[r,i]}return n.inputSpec=[new ue({ndim:4})],n}return o(e,t),e.prototype.computeOutputShape=function(t){var e,n;return t=ee(t),"channelsFirst"===this.dataFormat?(e=null!=t[2]&&t[2]>=0?t[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=t[3]&&t[3]>=0?t[3]+this.padding[1][0]+this.padding[1][1]:null,[t[0],t[1],e,n]):(e=null!=t[1]&&t[1]>=0?t[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=t[2]&&t[2]>=0?t[2]+this.padding[1][0]+this.padding[1][1]:null,[t[0],e,n,t[3]])},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){return function(t,e,n){return Object(r.tidy)(function(){if(4!==t.rank)throw new h("temporalPadding expects input tensor to be 4-D, but received a "+t.rank+"-D tensor.");if(null==e&&(e=[[1,1],[1,1]]),2!==e.length||2!==e[0].length||2!==e[1].length)throw new h("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==n&&(n="channelsLast"),"channelsLast"!==n&&"channelsFirst"!==n)throw new h("Unknown data format: "+n+". Supported data formats are 'channelsLast' and 'channelsFirst.");var i;return i="channelsFirst"===n?[[0,0],[0,0],e[0],e[1]]:[[0,0],e[0],e[1],[0,0]],Object(r.pad)(t,i)})}(te(t),n.padding,n.dataFormat)})},e.prototype.getConfig=function(){var e={padding:this.padding,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="ZeroPadding2D",e}(he);function Lr(t,e,n,i,o,a){return Object(r.tidy)(function(){var s;K(o),M(H,"PoolMode",a),X(i),null==n&&(n=[1,1]),null==i&&(i="valid"),null==o&&(o="channelsLast"),null==a&&(a="max"),t=ir(t,o);var u="same"===i?"same":"valid";return s="max"===a?Object(r.maxPool)(t,e,n,u):Object(r.avgPool)(t,e,n,u),"channelsFirst"===o&&(s=Object(r.transpose)(s,[0,3,1,2])),s})}r.serialization.registerClass(zr);var Br=function(t){function e(e){var n=this;if(null==e.poolSize&&(e.poolSize=2),n=t.call(this,e)||this,"number"==typeof e.poolSize)n.poolSize=[e.poolSize];else{if(!Array.isArray(e.poolSize)||1!==e.poolSize.length||"number"!=typeof e.poolSize[0])throw new h("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(e.poolSize));n.poolSize=e.poolSize}if(T(n.poolSize,"poolSize"),null==e.strides)n.strides=n.poolSize;else if("number"==typeof e.strides)n.strides=[e.strides];else{if(!Array.isArray(e.strides)||1!==e.strides.length||"number"!=typeof e.strides[0])throw new h("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(e.strides));n.strides=e.strides}return T(n.strides,"strides"),n.padding=null==e.padding?"valid":e.padding,X(n.padding),n.inputSpec=[new ue({ndim:3})],n}return o(e,t),e.prototype.computeOutputShape=function(t){var e=nr((t=ee(t))[1],this.poolSize[0],this.padding,this.strides[0]);return[t[0],e,t[2]]},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){n.invokeCallHook(t,e),t=lt(te(t),2);var i=n.poolingFunction(te(t),[n.poolSize[0],1],[n.strides[0],1],n.padding,"channelsLast");return Object(r.squeeze)(i,[2])})},e.prototype.getConfig=function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(he),Ur=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return K(i),X(r),Lr(t,e,n,r,i,"max")},e.className="MaxPooling1D",e}(Br);r.serialization.registerClass(Ur);var Wr=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return K(i),X(r),Lr(t,e,n,r,i,"avg")},e.className="AveragePooling1D",e}(Br);r.serialization.registerClass(Wr);var qr=function(t){function e(e){var n=this;if(null==e.poolSize&&(e.poolSize=[2,2]),(n=t.call(this,e)||this).poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],null==e.strides)n.strides=n.poolSize;else if(Array.isArray(e.strides)){if(2!==e.strides.length)throw new h("If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length "+e.strides.length+".");n.strides=e.strides}else n.strides=[e.strides,e.strides];return T(n.poolSize,"poolSize"),T(n.strides,"strides"),n.padding=null==e.padding?"valid":e.padding,n.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,K(n.dataFormat),X(n.padding),n.inputSpec=[new ue({ndim:4})],n}return o(e,t),e.prototype.computeOutputShape=function(t){t=ee(t);var e="channelsFirst"===this.dataFormat?t[2]:t[1],n="channelsFirst"===this.dataFormat?t[3]:t[2];return e=nr(e,this.poolSize[0],this.padding,this.strides[0]),n=nr(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[t[0],t[1],e,n]:[t[0],e,n,t[3]]},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){return n.invokeCallHook(t,e),n.poolingFunction(te(t),n.poolSize,n.strides,n.padding,n.dataFormat)})},e.prototype.getConfig=function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(he),Vr=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return K(i),X(r),Lr(t,e,n,r,i,"max")},e.className="MaxPooling2D",e}(qr);r.serialization.registerClass(Vr);var Hr=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.poolingFunction=function(t,e,n,r,i){return K(i),X(r),Lr(t,e,n,r,i,"avg")},e.className="AveragePooling2D",e}(qr);r.serialization.registerClass(Hr);var $r=function(t){function e(e){var n=t.call(this,e)||this;return n.inputSpec=[new ue({ndim:3})],n}return o(e,t),e.prototype.computeOutputShape=function(t){return[t[0],t[2]]},e.prototype.call=function(t,e){throw new p},e}(he),Gr=function(t){function e(e){return t.call(this,e||{})||this}return o(e,t),e.prototype.call=function(t,e){return Object(r.tidy)(function(){var e=te(t);return Object(r.mean)(e,1)})},e.className="GlobalAveragePooling1D",e}($r);r.serialization.registerClass(Gr);var Kr=function(t){function e(e){return t.call(this,e||{})||this}return o(e,t),e.prototype.call=function(t,e){return Object(r.tidy)(function(){var e=te(t);return Object(r.max)(e,1)})},e.className="GlobalMaxPooling1D",e}($r);r.serialization.registerClass(Kr);var Xr=function(t){function e(e){var n=t.call(this,e)||this;return n.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,K(n.dataFormat),n.inputSpec=[new ue({ndim:4})],n}return o(e,t),e.prototype.computeOutputShape=function(t){return t=t,"channelsLast"===this.dataFormat?[t[0],t[3]]:[t[0],t[1]]},e.prototype.call=function(t,e){throw new p},e.prototype.getConfig=function(){var e={dataFormat:this.dataFormat},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e}(he),Yr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e=te(t);return"channelsLast"===n.dataFormat?Object(r.mean)(e,[1,2]):Object(r.mean)(e,[2,3])})},e.className="GlobalAveragePooling2D",e}(Xr);r.serialization.registerClass(Yr);var Jr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var e=te(t);return"channelsLast"===n.dataFormat?Object(r.max)(e,[1,2]):Object(r.max)(e,[2,3])})},e.className="GlobalMaxPooling2D",e}(Xr);function Zr(t,e,n,r){if(Array.isArray(t)){if(null!=e||null!=n)throw new h("When inputs is an array, neither initialState or constants should be provided");null!=r&&(n=t.slice(t.length-r,t.length),t=t.slice(0,t.length-r)),t.length>1&&(e=t.slice(1,t.length)),t=t[0]}function i(t){return null==t||Array.isArray(t)?t:[t]}return{inputs:t,initialState:e=i(e),constants:n=i(n)}}function Qr(t,e,n,i,o,a,s,u){return void 0===i&&(i=!1),void 0===s&&(s=!1),void 0===u&&(u=!1),Object(r.tidy)(function(){var c=e.shape.length;if(c<3)throw new h("Input should be at least 3D, but is "+c+"D.");var l=[1,0].concat(ut(2,c));if(e=Object(r.transpose)(e,l),null!=a)throw new p("The rnn() functoin of the deeplearn.js backend does not support constants yet.");s&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),null!=o&&((o=o.asType("bool").asType("float32")).rank===c-1&&(o=Object(r.expandDims)(o,-1)),o=Object(r.transpose)(o,l)),i&&(e=Object(r.reverse)(e,0),null!=o&&(o=Object(r.reverse)(o,0)));var f,d,m=[],g=n,v=e.shape[0],b=Object(r.unstack)(e);null!=o&&(d=Object(r.unstack)(o));for(var y,w=function(e){var n=b[e],i=Object(r.tidy)(function(){return t(n,g)});if(null==o)f=i[0],g=i[1];else{var a=Object(r.tidy)(function(){var t=d[e],n=Object(r.onesLike)(t).sub(t);return{output:i[0].mul(t).addStrict(g[0].mul(n)),newStates:g.map(function(e,r){return i[1][r].mul(t).addStrict(e.mul(n))})}});f=a.output,g=a.newStates}u&&m.push(f)},x=0;x<v;++x)w(x);return u&&(y=Object(r.stack)(m,1)),[f,y,g]})}r.serialization.registerClass(Jr);var ti=function(t){function e(e){var n,r=t.call(this,e)||this;if(null==e.cell)throw new h("cell property is missing for the constructor of RNN.");if(null==(n=Array.isArray(e.cell)?new ui({cells:e.cell}):e.cell).stateSize)throw new h("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");return r.cell=n,r.returnSequences=null!=e.returnSequences&&e.returnSequences,r.returnState=null!=e.returnState&&e.returnState,r.goBackwards=null!=e.goBackwards&&e.goBackwards,r._stateful=null!=e.stateful&&e.stateful,r.unroll=null!=e.unroll&&e.unroll,r.supportsMasking=!0,r.inputSpec=[new ue({ndim:3})],r.stateSpec=null,r.states_=null,r.numConstants=null,r.keptStates=[],r}return o(e,t),e.prototype.getStates=function(){return null==this.states_?ut(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map(function(t){return null}):this.states_},e.prototype.setStates=function(t){this.states_=t},e.prototype.computeOutputShape=function(t){Zt(t)&&(t=t[0]),t=t;var e=this.cell.stateSize;Array.isArray(e)||(e=[e]);var n,r=e[0];if(n=this.returnSequences?[t[0],t[1],r]:[t[0],r],this.returnState){for(var i=[],o=0,a=e;o<a.length;o++){var s=a[o];i.push([t[0],s])}return[n].concat(i)}return n},e.prototype.computeMask=function(t,e){var n=this;return Object(r.tidy)(function(){Array.isArray(e)&&(e=e[0]);var t=n.returnSequences?e:null;if(n.returnState){var r=n.states.map(function(t){return null});return[t].concat(r)}return t})},Object.defineProperty(e.prototype,"states",{get:function(){if(null==this.states_){for(var t=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,e=[],n=0;n<t;++n)e.push(null);return e}return this.states_},set:function(t){this.states_=t},enumerable:!0,configurable:!0}),e.prototype.build=function(t){if(null!=this.numConstants)throw new p("Constants support is not implemented in RNN yet.");Zt(t)&&(t=t[0]),t=t;var e=this.stateful?t[0]:null,n=t[t.length-1];this.inputSpec[0]=new ue({shape:[e,null,n]});var i,o=[t[0]].concat(t.slice(2));if(this.cell.build(o),i=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!r.util.arraysEqual(this.stateSpec.map(function(t){return t.shape[t.shape.length-1]}),i))throw new h("An initialState was passed that is not compatible with cell.stateSize. Received stateSpec="+this.stateSpec+"; However cell.stateSize is "+this.cell.stateSize)}else this.stateSpec=i.map(function(t){return new ue({shape:[null,t]})});this.stateful&&this.resetStates()},e.prototype.resetStates=function(t,e){var n=this;void 0===e&&(e=!1),Object(r.tidy)(function(){if(!n.stateful)throw new f("Cannot call resetStates() on an RNN Layer that is not stateful.");var i=n.inputSpec[0].shape[0];if(null==i)throw new h("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==n.states_)Array.isArray(n.cell.stateSize)?n.states_=n.cell.stateSize.map(function(t){return Object(r.zeros)([i,t])}):n.states_=[Object(r.zeros)([i,n.cell.stateSize])];else if(null==t)Object(r.dispose)(n.states_),null!=n.keptStates&&(Object(r.dispose)(n.keptStates),n.keptStates=[]),Array.isArray(n.cell.stateSize)?n.states_=n.cell.stateSize.map(function(t){return Object(r.zeros)([i,t])}):n.states_[0]=Object(r.zeros)([i,n.cell.stateSize]);else{if(Array.isArray(t)||(t=[t]),t.length!==n.states_.length)throw new h("Layer "+n.name+" expects "+n.states_.length+" state(s), but it received "+t.length+" state value(s). Input received: "+t);!0===e?n.keptStates.push(n.states_.slice()):Object(r.dispose)(n.states_);for(var o=0;o<n.states_.length;++o){var a=t[o],s=Array.isArray(n.cell.stateSize)?n.cell.stateSize[o]:n.cell.stateSize,u=[i,s];if(!r.util.arraysEqual(a.shape,u))throw new h("State "+o+" is incompatible with layer "+n.name+": expected shape="+u+", received shape="+a.shape);n.states_[o]=a}}n.states_=n.states_.map(function(t){return Object(r.keep)(t.clone())})})},e.prototype.apply=function(e,n){var r=null==n?null:n.initialState,i=null==n?null:n.constants;null==n&&(n={});var o=Zr(e,r,i,this.numConstants);e=o.inputs,r=o.initialState,i=o.constants;var a=[],s=[];if(null!=r){n.initialState=r,a=a.concat(r),this.stateSpec=[];for(var u=0,c=r;u<c.length;u++){var l=c[u];this.stateSpec.push(new ue({shape:l.shape}))}s=s.concat(this.stateSpec)}if(null!=i&&(n.constants=i,a=a.concat(i),this.numConstants=i.length),a[0]instanceof ce){var f=[e].concat(a),d=this.inputSpec.concat(s),h=this.inputSpec;this.inputSpec=d;var p=t.prototype.apply.call(this,f,n);return this.inputSpec=h,p}return t.prototype.apply.call(this,e,n)},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var r=null==e?null:e.mask,i=null==e?null:e.training,o=null==e?null:e.initialState;t=te(t),null==o&&(o=n.stateful?n.states_:n.getInitialState(t));var a=Array.isArray(n.cell.stateSize)?n.cell.stateSize.length:1;if(o.length!==a)throw new h("RNN Layer has "+a+" state(s) but was passed "+o.length+" initial state(s).");n.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");var s={training:i},u=Qr(function(t,e){var r=n.cell.call([t].concat(e),s);return[r[0],r.slice(1)]},t,o,n.goBackwards,r,null,n.unroll,n.returnSequences),c=u[0],l=u[1],f=u[2];n.stateful&&n.resetStates(f,i);var d=n.returnSequences?l:c;return n.returnState?[d].concat(f):d})},e.prototype.getInitialState=function(t){var e=this;return Object(r.tidy)(function(){var n=Object(r.zeros)(t.shape);return n=lt(n=Object(r.sum)(n,[1,2])),Array.isArray(e.cell.stateSize)?e.cell.stateSize.map(function(t){return t>1?gt(n,[1,t]):n}):e.cell.stateSize>1?[gt(n,[1,e.cell.stateSize])]:[n]})},Object.defineProperty(e.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),e.prototype.setFastWeightInitDuringBuild=function(e){t.prototype.setFastWeightInitDuringBuild.call(this,e),null!=this.cell&&this.cell.setFastWeightInitDuringBuild(e)},e.prototype.getConfig=function(){var e={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(e.numConstants=this.numConstants);var n=this.cell.getConfig();e.cell={className:this.cell.getClassName(),config:n};var r=t.prototype.getConfig.call(this);return Object.assign(e,r),e},e.fromConfig=function(t,e,n){void 0===n&&(n={});var r=Xe(e.cell,n);return new t(Object.assign(e,{cell:r}))},e.className="RNN",e}(he);r.serialization.registerClass(ti);var ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(he),ni=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=e.units,T(n.units,"units"),n.activation=Wn(null==e.activation?n.DEFAULT_ACTIVATION:e.activation),n.useBias=null==e.useBias||e.useBias,n.kernelInitializer=$t(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=$t(e.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=$t(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=Kn(e.kernelRegularizer),n.recurrentRegularizer=Kn(e.recurrentRegularizer),n.biasRegularizer=Kn(e.biasRegularizer),n.kernelConstraint=U(e.kernelConstraint),n.recurrentConstraint=U(e.recurrentConstraint),n.biasConstraint=U(e.biasConstraint),n.dropout=at([1,st([0,null==e.dropout?0:e.dropout])]),n.recurrentDropout=at([1,st([0,null==e.recurrentDropout?0:e.recurrentDropout])]),n.stateSize=n.units,n.dropoutMask=null,n.recurrentDropoutMask=null,n}return o(e,t),e.prototype.build=function(t){t=ee(t),this.kernel=this.addWeight("kernel",[t[t.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){if(2!==(t=t).length)throw new h("SimpleRNNCell expects 2 input Tensors, got "+t.length+".");var i=t[1];t=t[0];var o,a=null!=e.training&&e.training;0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=ci(function(){return Object(r.onesLike)(t)},n.dropout,a)),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=ci(function(){return Object(r.onesLike)(i)},n.recurrentDropout,a));var s=n.dropoutMask,u=n.recurrentDropoutMask;o=bt(null!=s?Object(r.mul)(t,s):t,n.kernel.read()),null!=n.bias&&(o=_t(o,n.bias.read())),null!=u&&(i=Object(r.mul)(i,u));var c=Object(r.add)(o,bt(i,n.recurrentKernel.read()));return null!=n.activation&&(c=n.activation.apply(c)),[c,c]})},e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:$n(this.kernelRegularizer),recurrentRegularizer:$n(this.recurrentRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),recurrentConstraint:L(this.recurrentConstraint),biasConstraint:L(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="SimpleRNNCell",e}(ei);r.serialization.registerClass(ni);var ri=function(t){function e(e){return e.cell=new ni(e),t.call(this,e)||this}return o(e,t),e.prototype.call=function(e,n){var i=this;return Object(r.tidy)(function(){null!=i.cell.dropoutMask&&(Object(r.dispose)(i.cell.dropoutMask),i.cell.dropoutMask=null),null!=i.cell.recurrentDropoutMask&&(Object(r.dispose)(i.cell.recurrentDropoutMask),i.cell.recurrentDropoutMask=null);var o=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return t.prototype.call.call(i,e,{mask:o,training:a,initialState:s})})},Object.defineProperty(e.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:$n(this.kernelRegularizer),recurrentRegularizer:$n(this.recurrentRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),recurrentConstraint:L(this.recurrentConstraint),biasConstraint:L(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=t.prototype.getConfig.call(this);return delete n.cell,Object.assign(e,n),e},e.fromConfig=function(t,e){return new t(e)},e.className="SimpleRNN",e}(ti);r.serialization.registerClass(ri);var ii=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=e.units,T(n.units,"units"),n.activation=Wn(void 0===e.activation?n.DEFAULT_ACTIVATION:e.activation),n.recurrentActivation=Wn(void 0===e.recurrentActivation?n.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),n.useBias=null==e.useBias||e.useBias,n.kernelInitializer=$t(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=$t(e.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=$t(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=Kn(e.kernelRegularizer),n.recurrentRegularizer=Kn(e.recurrentRegularizer),n.biasRegularizer=Kn(e.biasRegularizer),n.kernelConstraint=U(e.kernelConstraint),n.recurrentConstraint=U(e.recurrentConstraint),n.biasConstraint=U(e.biasConstraint),n.dropout=at([1,st([0,null==e.dropout?0:e.dropout])]),n.recurrentDropout=at([1,st([0,null==e.recurrentDropout?0:e.recurrentDropout])]),n.implementation=e.implementation,n.stateSize=n.units,n.dropoutMask=null,n.recurrentDropoutMask=null,n}return o(e,t),e.prototype.build=function(t){var e=(t=ee(t))[t.length-1];this.kernel=this.addWeight("kernel",[e,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){if(2!==(t=t).length)throw new h("GRUCell expects 2 input Tensors (inputs, h, c), got "+t.length+".");var i=null!=e.training&&e.training,o=t[1];t=t[0],0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=ci(function(){return Object(r.onesLike)(t)},n.dropout,i,3)),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=ci(function(){return Object(r.onesLike)(o)},n.recurrentDropout,i,3));var a,s,u,c=n.dropoutMask,l=n.recurrentDropoutMask;0<n.dropout&&n.dropout<1&&(t=Object(r.mul)(t,c[0]));var f=bt(t,n.kernel.read());n.useBias&&(f=_t(f,n.bias.read())),0<n.recurrentDropout&&n.recurrentDropout<1&&(o=Object(r.mul)(o,l[0]));var d=n.recurrentKernel.read(),p=Object(r.split)(d,[2*n.units,n.units],d.rank-1),m=p[0],g=p[1],v=bt(o,m),b=Object(r.split)(f,3,f.rank-1),y=b[0],w=b[1],x=b[2],_=Object(r.split)(v,2,v.rank-1),k=_[0],S=_[1];a=n.recurrentActivation.apply(Object(r.add)(y,k)),s=n.recurrentActivation.apply(Object(r.add)(w,S));var E=bt(Object(r.mul)(s,o),g);u=n.activation.apply(Object(r.add)(x,E));var O=Object(r.add)(Object(r.mul)(a,o),Object(r.mul)(Object(r.add)(1,Object(r.neg)(a)),u));return[O,O]})},e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),recurrentActivation:Bn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:$n(this.kernelRegularizer),recurrentRegularizer:$n(this.recurrentRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),recurrentConstraint:L(this.recurrentConstraint),biasConstraint:L(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="GRUCell",e}(ei);r.serialization.registerClass(ii);var oi=function(t){function e(e){return 0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new ii(e),t.call(this,e)||this}return o(e,t),e.prototype.call=function(e,n){var i=this;return Object(r.tidy)(function(){null!=i.cell.dropoutMask&&(Object(r.dispose)(i.cell.dropoutMask),i.cell.dropoutMask=null),null!=i.cell.recurrentDropoutMask&&(Object(r.dispose)(i.cell.recurrentDropoutMask),i.cell.recurrentDropoutMask=null);var o=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return t.prototype.call.call(i,e,{mask:o,training:a,initialState:s})})},Object.defineProperty(e.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),recurrentActivation:Bn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),kernelRegularizer:$n(this.kernelRegularizer),recurrentRegularizer:$n(this.recurrentRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),recurrentConstraint:L(this.recurrentConstraint),biasConstraint:L(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return delete n.cell,Object.assign(e,n),e},e.fromConfig=function(t,e){return 0===e.implmentation&&(e.implementation=1),new t(e)},e.className="GRU",e}(ti);r.serialization.registerClass(oi);var ai=function(t){function e(e){var n=t.call(this,e)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=e.units,T(n.units,"units"),n.activation=Wn(void 0===e.activation?n.DEFAULT_ACTIVATION:e.activation),n.recurrentActivation=Wn(void 0===e.recurrentActivation?n.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),n.useBias=null==e.useBias||e.useBias,n.kernelInitializer=$t(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=$t(e.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=$t(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.unitForgetBias=e.unitForgetBias,n.kernelRegularizer=Kn(e.kernelRegularizer),n.recurrentRegularizer=Kn(e.recurrentRegularizer),n.biasRegularizer=Kn(e.biasRegularizer),n.kernelConstraint=U(e.kernelConstraint),n.recurrentConstraint=U(e.recurrentConstraint),n.biasConstraint=U(e.biasConstraint),n.dropout=at([1,st([0,null==e.dropout?0:e.dropout])]),n.recurrentDropout=at([1,st([0,null==e.recurrentDropout?0:e.recurrentDropout])]),n.implementation=e.implementation,n.stateSize=[n.units,n.units],n.dropoutMask=null,n.recurrentDropoutMask=null,n}return o(e,t),e.prototype.build=function(t){var e,n,r=(t=ee(t))[t.length-1];if(this.kernel=this.addWeight("kernel",[r,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){var i=this.biasInitializer,a=this.units;n=new((e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.apply=function(t,e){var n=i.apply([a]),r=(new Mt).apply([a]),o=i.apply([2*a]);return mt(mt(n,r),o)},e}(At)).className="CustomInit",e)}else n=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,n,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){var i=null!=e.training&&e.training;if(3!==(t=t).length)throw new h("LSTMCell expects 3 input Tensors (inputs, h, c), got "+t.length+".");var o=t[1],a=t[2];t=t[0],0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=ci(function(){return Object(r.onesLike)(t)},n.dropout,i,4)),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=ci(function(){return Object(r.onesLike)(o)},n.recurrentDropout,i,4));var s,u,c,l,f=n.dropoutMask,d=n.recurrentDropoutMask;0<n.dropout&&n.dropout<1&&(t=Object(r.mul)(t,f[0]));var p=bt(t,n.kernel.read());0<n.recurrentDropout&&n.recurrentDropout<1&&(o=Object(r.mul)(o,d[0])),p=Object(r.add)(p,bt(o,n.recurrentKernel.read())),n.useBias&&(p=_t(p,n.bias.read()));var m=Object(r.split)(p,4,p.rank-1),g=m[0],v=m[1],b=m[2],y=m[3];s=n.recurrentActivation.apply(g),u=n.recurrentActivation.apply(v),c=Object(r.add)(Object(r.mul)(u,a),Object(r.mul)(s,n.activation.apply(b))),l=n.recurrentActivation.apply(y);var w=Object(r.mul)(l,n.activation.apply(c));return[w,w,c]})},e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),recurrentActivation:Bn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:$n(this.kernelRegularizer),recurrentRegularizer:$n(this.recurrentRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),recurrentConstraint:L(this.recurrentConstraint),biasConstraint:L(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.className="LSTMCell",e}(ei);r.serialization.registerClass(ai);var si=function(t){function e(e){return 0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new ai(e),t.call(this,e)||this}return o(e,t),e.prototype.call=function(e,n){var i=this;return Object(r.tidy)(function(){null!=i.cell.dropoutMask&&(Object(r.dispose)(i.cell.dropoutMask),i.cell.dropoutMask=null),null!=i.cell.recurrentDropoutMask&&(Object(r.dispose)(i.cell.recurrentDropoutMask),i.cell.recurrentDropoutMask=null);var o=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return t.prototype.call.call(i,e,{mask:o,training:a,initialState:s})})},Object.defineProperty(e.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"unitForgetBias",{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(){var e={units:this.units,activation:Bn(this.activation),recurrentActivation:Bn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ht(this.kernelInitializer),recurrentInitializer:Ht(this.recurrentInitializer),biasInitializer:Ht(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:$n(this.kernelRegularizer),recurrentRegularizer:$n(this.recurrentRegularizer),biasRegularizer:$n(this.biasRegularizer),activityRegularizer:$n(this.activityRegularizer),kernelConstraint:L(this.kernelConstraint),recurrentConstraint:L(this.recurrentConstraint),biasConstraint:L(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=t.prototype.getConfig.call(this);return delete n.cell,Object.assign(e,n),e},e.fromConfig=function(t,e){return 0===e.implmentation&&(e.implementation=1),new t(e)},e.className="LSTM",e}(ti);r.serialization.registerClass(si);var ui=function(t){function e(e){var n=t.call(this,e)||this;return n.cells=e.cells,n}return o(e,t),Object.defineProperty(e.prototype,"stateSize",{get:function(){for(var t=[],e=0,n=this.cells.slice().reverse();e<n.length;e++){var r=n[e];Array.isArray(r.stateSize)?t.push.apply(t,r.stateSize):t.push(r.stateSize)}return t},enumerable:!0,configurable:!0}),e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){for(var r=(t=t).slice(1),i=[],o=0,a=n.cells.slice().reverse();o<a.length;o++){var s=a[o];Array.isArray(s.stateSize)?i.push(r.splice(0,s.stateSize.length)):i.push(r.splice(0,1))}i.reverse();for(var u,c=[],l=0;l<n.cells.length;++l)s=n.cells[l],r=i[l],u=0===l?[t[0]].concat(r):[u[0]].concat(r),u=s.call(u,e),c.push(u.slice(1));r=[];for(var f=0,d=c.slice().reverse();f<d.length;f++){var h=d[f];r.push.apply(r,h)}return[u[0]].concat(r)})},e.prototype.build=function(t){var e;Zt(t)&&(t=t[0]),t=t;for(var n=0,r=this.cells;n<r.length;n++){var i=r[n];i.build(t),e=Array.isArray(i.stateSize)?i.stateSize[0]:i.stateSize,t=[t[0],e]}this.built=!0},e.prototype.getConfig=function(){for(var e=[],n=0,r=this.cells;n<r.length;n++){var i=r[n];e.push({className:i.getClassName(),config:i.getConfig()})}var o={cells:e},a=t.prototype.getConfig.call(this);return Object.assign(o,a),o},e.fromConfig=function(t,e,n){void 0===n&&(n={});for(var r=[],i=0,o=e.cells;i<o.length;i++){var a=o[i];r.push(Xe(a,n))}return new t({cells:r})},Object.defineProperty(e.prototype,"trainableWeights",{get:function(){if(!this.trainable)return[];for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push.apply(t,r.trainableWeights)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nonTrainableWeights",{get:function(){for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push.apply(t,r.nonTrainableWeights)}if(!this.trainable){for(var i=[],o=0,a=this.cells;o<a.length;o++)r=a[o],i.push.apply(i,r.trainableWeights);return i.concat(t)}return t},enumerable:!0,configurable:!0}),e.prototype.getWeights=function(){for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push.apply(t,r.weights)}return oe(t)},e.prototype.setWeights=function(t){for(var e=[],n=0,r=this.cells;n<r.length;n++)for(var i=r[n],o=i.weights.length,a=t.splice(o),s=0;s<i.weights.length;++s)e.push([i.weights[s],a[s]]);ae(e)},e.className="StackedRNNCells",e}(ei);function ci(t,e,n,i){function o(){return kt(t(),e)}if(void 0===n&&(n=null),void 0===i&&(i=1),i>1){for(var a=[],s=0;s<i;s++)a.push(St(o,t,n));return a.map(function(t){return Object(r.keep)(t.clone())})}return Object(r.keep)(St(o,t,n).clone())}r.serialization.registerClass(ui);var li=function(t){function e(e){var n=t.call(this,e)||this;return n.layer=e.layer,n}return o(e,t),e.prototype.build=function(t){this.built=!0},Object.defineProperty(e.prototype,"trainable",{get:function(){return null!=this.layer&&this.layer.trainable},set:function(t){null!=this.layer&&(this.layer.trainable=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trainableWeights",{get:function(){return this.layer.trainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nonTrainableWeights",{get:function(){return this.layer.nonTrainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updates",{get:function(){return this.layer._updates},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"losses",{get:function(){return this.layer.losses},enumerable:!0,configurable:!0}),e.prototype.getWeights=function(){return this.layer.getWeights()},e.prototype.setWeights=function(t){this.layer.setWeights(t)},e.prototype.getConfig=function(){var e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.prototype.setFastWeightInitDuringBuild=function(e){t.prototype.setFastWeightInitDuringBuild.call(this,e),null!=this.layer&&this.layer.setFastWeightInitDuringBuild(e)},e.fromConfig=function(t,e,n){void 0===n&&(n={});var r=Xe(e.layer,n);delete e.layer;var i={layer:r};return Object.assign(i,e),new t(i)},e}(he),fi=function(t){function e(e){var n=t.call(this,e)||this;return n.supportsMasking=!0,n}return o(e,t),e.prototype.build=function(e){if((e=ee(e)).length<3)throw new h("TimeDistributed layer expects an input shape >= 3D, but received input shape "+JSON.stringify(e));this.inputSpec=[{shape:e}];var n=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(n),this.layer.built=!0),t.prototype.build.call(this,e)},e.prototype.computeOutputShape=function(t){var e=[(t=ee(t))[0]].concat(t.slice(2)),n=this.layer.computeOutputShape(e),r=t[1];return[n[0],r].concat(n.slice(1))},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){return Qr(function(t,r){return[te(n.layer.call(t,e)),[]]},t=te(t),[],!1,null,null,!1,!0)[1]})},e.className="TimeDistributed",e}(li);r.serialization.registerClass(fi);var di="concat",hi=function(t){function e(e){var n=t.call(this,e)||this,r=e.layer.getConfig(),i={};i.className=e.layer.getClassName(),i.config=r,n.forwardLayer=Xe(i),r.goBackwards=!0!==r.goBackwards;var o={};if(o.className=e.layer.getClassName(),o.config=r,n.backwardLayer=Xe(o),n.forwardLayer.name="forward_"+n.forwardLayer.name,n.backwardLayer.name="backward_"+n.backwardLayer.name,n.mergeMode=void 0===e.mergeMode?di:e.mergeMode,function(t){M($,"BidirectionalMergeMode",t)}(n.mergeMode),e.weights)throw new p("weights support is not implemented for Bidirectional layer yet.");return n._stateful=e.layer.stateful,n.returnSequences=e.layer.returnSequences,n.returnState=e.layer.returnState,n.supportsMasking=!0,n._trainable=!0,n.inputSpec=e.layer.inputSpec,n.numConstants=null,n}return o(e,t),Object.defineProperty(e.prototype,"trainable",{get:function(){return this._trainable},set:function(t){this._trainable=t,null!=this.forwardLayer&&(this.forwardLayer.trainable=t),null!=this.backwardLayer&&(this.backwardLayer.trainable=t)},enumerable:!0,configurable:!0}),e.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},e.prototype.setWeights=function(t){var e=t.length,n=Math.floor(e/2);this.forwardLayer.setWeights(t.slice(0,n)),this.backwardLayer.setWeights(t.slice(n))},e.prototype.computeOutputShape=function(t){var e,n,r,i=this.forwardLayer.computeOutputShape(t);return Array.isArray(i)&&Array.isArray(i[0])||(i=[i]),i=i,this.returnState?(r=i.slice(1),e=i[0]):e=i[0],e=e,"concat"===this.mergeMode?(e[e.length-1]*=2,n=[e]):n=null==this.mergeMode?[e,e.slice()]:[e],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[e].concat(r).concat(r.slice()):y(n)},e.prototype.apply=function(e,n){var r=null==n?null:n.initialState,i=null==n?null:n.constants;null==n&&(n={});var o=Zr(e,r,i,this.numConstants);if(e=o.inputs,r=o.initialState,i=o.constants,Array.isArray(e)&&(r=e.slice(1),e=e[0]),(null==r||0===r.length)&&null==i)return t.prototype.apply.call(this,e,n);var a=[],s=[];if(null!=r){var u=r.length;if(u%2>0)throw new h("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");n.initialState=r,a.push.apply(a,r);var c=r.map(function(t){return new ue({shape:t.shape})});this.forwardLayer.stateSpec=c.slice(0,u/2),this.backwardLayer.stateSpec=c.slice(u/2),s.push.apply(s,c)}if(null!=i)throw new p("Support for constants in Bidirectional layers is not implemented yet.");for(var l=a[0]instanceof ce,f=0,d=a;f<d.length;f++)if(d[f]instanceof ce!==l)throw new h("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(l){var m=[e].concat(a),g=this.inputSpec.concat(s),v=this.inputSpec;this.inputSpec=g;var b=t.prototype.apply.call(this,m,n);return this.inputSpec=v,b}return t.prototype.apply.call(this,e,n)},e.prototype.call=function(t,e){var n=this;return Object(r.tidy)(function(){if(null!=e.mask)throw new p("The support for masking is not implemented for Bidirectional layers yet.");var i,o,a,s,u=e.initialState;if(null==u)i=n.forwardLayer.call(t,e),o=n.backwardLayer.call(t,e);else{var c=u.slice(0,u.length/2),l=u.slice(u.length/2);i=n.forwardLayer.call(t,Object.assign(e,{initialState:c})),o=n.backwardLayer.call(t,Object.assign(e,{initialState:l}))}return n.returnState&&(Array.isArray(i)&&(a=i.slice(1).concat(o.slice(1))),i=i[0],o=o[0]),n.returnSequences&&(o=Object(r.reverse)(o,1)),"concat"===n.mergeMode?s=pt([i,o]):"sum"===n.mergeMode?s=Object(r.add)(i,o):"ave"===n.mergeMode?s=Object(r.mul)(.5,Object(r.add)(i,o)):"mul"===n.mergeMode?s=Object(r.mul)(i,o):null==n.mergeMode&&(s=[i,o]),n.returnState?null==n.mergeMode?s.concat(a):[s].concat(a):s})},e.prototype.resetStates=function(t){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},e.prototype.build=function(t){var e=this;Z(this.forwardLayer.name,function(){e.forwardLayer.build(t)}),Z(this.backwardLayer.name,function(){e.backwardLayer.build(t)}),this.built=!0},Object.defineProperty(e.prototype,"trainableWeights",{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nonTrainableWeights",{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),e.prototype.setFastWeightInitDuringBuild=function(e){t.prototype.setFastWeightInitDuringBuild.call(this,e),null!=this.forwardLayer&&this.forwardLayer.setFastWeightInitDuringBuild(e),null!=this.backwardLayer&&this.backwardLayer.setFastWeightInitDuringBuild(e)},e.prototype.getConfig=function(){var e={mergeMode:this.mergeMode},n=t.prototype.getConfig.call(this);return Object.assign(e,n),e},e.fromConfig=function(t,e){var n=Xe(e.layer);if(delete e.layer,null!=e.numConstants)throw new p("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var r=e;return r.layer=n,new t(r)},e.className="Bidirectional",e}(li);function pi(t){return new Wr(t)}function mi(t){return new Hr(t)}function gi(t){return new Kr(t)}function vi(t){return new Jr(t)}function bi(t){return new Ur(t)}function yi(t){return new Vr(t)}r.serialization.registerClass(hi);var wi=gi,xi=vi,_i=bi,ki=yi,Si=Object.freeze({inputLayer:function(t){return new pe(t)},elu:function(t){return new Zn(t)},reLU:function(t){return new Xn(t)},leakyReLU:function(t){return new Yn(t)},prelu:function(t){return new Jn(t)},softmax:function(t){return new tr(t)},thresholdedReLU:function(t){return new Qn(t)},conv1d:function(t){return new fr(t)},conv2d:function(t){return new sr(t)},conv2dTranspose:function(t){return new cr(t)},conv3d:function(t){return new ur(t)},separableConv2d:function(t){return new lr(t)},cropping2D:function(t){return new dr(t)},upSampling2d:function(t){return new hr(t)},depthwiseConv2d:function(t){return new pr(t)},activation:function(t){return new br(t)},dense:function(t){return new gr(t)},dropout:function(t){return new mr(t)},flatten:function(t){return new vr(t)},repeatVector:function(t){return new yr(t)},reshape:function(t){return new wr(t)},permute:function(t){return new xr(t)},embedding:function(t){return new kr(t)},add:function(t){return new Er(t)},average:function(t){return new Ar(t)},concatenate:function(t){return new Nr(t)},maximum:function(t){return new Cr(t)},minimum:function(t){return new Mr(t)},multiply:function(t){return new Or(t)},dot:function(t){return new Ir(t)},batchNormalization:function(t){return new Pr(t)},zeroPadding2d:function(t){return new zr(t)},averagePooling1d:pi,avgPool1d:function(t){return pi(t)},avgPooling1d:function(t){return pi(t)},averagePooling2d:mi,avgPool2d:function(t){return mi(t)},avgPooling2d:function(t){return mi(t)},globalAveragePooling1d:function(t){return new Gr(t)},globalAveragePooling2d:function(t){return new Yr(t)},globalMaxPooling1d:gi,globalMaxPooling2d:vi,maxPooling1d:bi,maxPooling2d:yi,gru:function(t){return new oi(t)},gruCell:function(t){return new ii(t)},lstm:function(t){return new si(t)},lstmCell:function(t){return new ai(t)},simpleRNN:function(t){return new ri(t)},simpleRNNCell:function(t){return new ni(t)},rnn:function(t){return new ti(t)},stackedRNNCells:function(t){return new ui(t)},bidirectional:function(t){return new hi(t)},timeDistributed:function(t){return new fi(t)},globalMaxPool1d:wi,globalMaxPool2d:xi,maxPool1d:_i,maxPool2d:ki,Layer:he,RNN:ti,RNNCell:ei,input:En,gaussianNoise:function(t){return new Dr(t)},gaussianDropout:function(t){return new jr(t)},alphaDropout:function(t){return new Rr(t)},masking:function(t){return new _r(t)}}),Ei=Object.freeze({binaryAccuracy:function(t,e){return Pe(t,e)},binaryCrossentropy:function(t,e){return Ue(t,e)},sparseCategoricalAccuracy:function(t,e){return We(t,e)},categoricalAccuracy:function(t,e){return ze(t,e)},categoricalCrossentropy:function(t,e){return qe(t,e)},precision:function(t,e){return Be(t,e)},recall:function(t,e){return function(t,e){return Object(r.tidy)(function(){var n=Le(t,e),i=function(t,e){return Object(r.tidy)(function(){return Object(r.logicalAnd)(t.equal(1),e.equal(0)).sum().cast("float32")})}(t,e),o=n.add(i);return Object(r.where)(Object(r.greater)(o,0),n.div(o),0).cast("float32")})}(t,e)},cosineProximity:function(t,e){return je(t,e)},meanAbsoluteError:function(t,e){return Me(t,e)},meanAbsolutePercentageError:function(t,e){return Ne(t,e)},MAPE:function(t,e){return Ne(t,e)},mape:function(t,e){return Ne(t,e)},meanSquaredError:function(t,e){return Ce(t,e)},MSE:function(t,e){return Ce(t,e)},mse:function(t,e){return Ce(t,e)}}),Oi=Object.freeze({modelFromJSON:function(t,e){return u(this,void 0,void 0,function(){var n,i,o,a,s,u,l,f;return c(this,function(c){switch(c.label){case 0:return"modelTopology"in t||(t={modelTopology:t}),null!=(n=(t=t).modelTopology).model_config&&(n=n.model_config),i=Je(n),o=Xe(i,e),null==t.weightsManifest?[3,2]:[4,r.io.loadWeights(t.weightsManifest,t.pathPrefix,o.weights.map(function(t){return t.originalName}))];case 1:for(a=c.sent(),s={},u=0,l=o.weights;u<l.length;u++)f=l[u],s[f.originalName]=a[f.originalName];o.loadWeights(s),Object(r.dispose)(a),c.label=2;case 2:return[2,o]}})})}}),Ai=Object.freeze({l1l2:function(t){return new Vn(t)},l1:function(t){return function(t){return new Vn({l1:null!=t?t.l1:null,l2:0})}(t)},l2:function(t){return function(t){return new Vn({l2:null!=t?t.l2:null,l1:0})}(t)}}),Ci=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.model=null,e}return o(e,t),e.prototype.setModel=function(t){if(!(t instanceof wn))throw new Error("model must be a LayersModel, not some other Container");this.model=t},e}(ye);function Mi(t,e){return t<e}function Ni(t,e){return t>e}var Ti=function(t){function e(e){var n=t.call(this)||this;if(null==e&&(e={}),e.restoreBestWeights)throw new p("restoreBestWeights = True is not implemented in EarlyStopping yet.");return n.monitor=e.monitor||"val_loss",n.minDelta=Math.abs(e.minDelta||0),n.patience=e.patience||0,n.verbose=e.verbose||0,n.mode=e.mode||"auto",n.baseline=e.baseline,-1===["auto","min","max"].indexOf(n.mode)&&(console.warn("EarlyStopping mode '"+n.mode+"' is invalid. Falling back to mode 'auto'."),n.mode="auto"),"min"===n.mode?n.monitorFunc=Mi:"max"===n.mode?n.monitorFunc=Ni:-1!==n.monitor.indexOf("acc")?n.monitorFunc=Ni:n.monitorFunc=Mi,n.monitorFunc===Mi&&(n.minDelta*=-1),n}return o(e,t),e.prototype.onTrainBegin=function(t){return u(this,void 0,void 0,function(){return c(this,function(t){return this.wait=0,this.stoppedEpoch=0,null!=this.baseline?this.best=this.baseline:this.best=this.monitorFunc===Mi?1/0:-1/0,[2]})})},e.prototype.onEpochEnd=function(t,e){return u(this,void 0,void 0,function(){var n;return c(this,function(r){switch(r.label){case 0:return[4,ge(e)];case 1:return r.sent(),null==(n=this.getMonitorValue(e))?[2]:(this.monitorFunc(n-this.minDelta,this.best)?(this.best=n,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=t,this.model.stopTraining=!0)),[2])}})})},e.prototype.onTrainEnd=function(t){return u(this,void 0,void 0,function(){return c(this,function(t){return this.stoppedEpoch>0&&this.verbose&&console.log("Epoch "+this.stoppedEpoch+": early stopping."),[2]})})},e.prototype.getMonitorValue=function(t){null==t&&(t={});var e=t[this.monitor];return null==e&&console.warn("Metric for EarlyStopping "+this.monitor+" is not available. Available metrics are: "+Object.keys(t)),e},e}(Ci),Ii={earlyStopping:function(t){return new Ti(t)}},Di=n(32),ji=n(168);n.d(e,"version",function(){return Ri}),n.d(e,"AdadeltaOptimizer",function(){return r.AdadeltaOptimizer}),n.d(e,"AdagradOptimizer",function(){return r.AdagradOptimizer}),n.d(e,"AdamOptimizer",function(){return r.AdamOptimizer}),n.d(e,"AdamaxOptimizer",function(){return r.AdamaxOptimizer}),n.d(e,"DataStorage",function(){return r.DataStorage}),n.d(e,"ENV",function(){return r.ENV}),n.d(e,"Environment",function(){return r.Environment}),n.d(e,"KernelBackend",function(){return r.KernelBackend}),n.d(e,"MomentumOptimizer",function(){return r.MomentumOptimizer}),n.d(e,"Optimizer",function(){return r.Optimizer}),n.d(e,"RMSPropOptimizer",function(){return r.RMSPropOptimizer}),n.d(e,"Rank",function(){return r.Rank}),n.d(e,"Reduction",function(){return r.Reduction}),n.d(e,"SGDOptimizer",function(){return r.SGDOptimizer}),n.d(e,"Tensor",function(){return r.Tensor}),n.d(e,"TensorBuffer",function(){return r.TensorBuffer}),n.d(e,"Variable",function(){return r.Variable}),n.d(e,"abs",function(){return r.abs}),n.d(e,"acos",function(){return r.acos}),n.d(e,"acosh",function(){return r.acosh}),n.d(e,"add",function(){return r.add}),n.d(e,"addN",function(){return r.addN}),n.d(e,"addStrict",function(){return r.addStrict}),n.d(e,"all",function(){return r.all}),n.d(e,"any",function(){return r.any}),n.d(e,"argMax",function(){return r.argMax}),n.d(e,"argMin",function(){return r.argMin}),n.d(e,"asin",function(){return r.asin}),n.d(e,"asinh",function(){return r.asinh}),n.d(e,"atan",function(){return r.atan}),n.d(e,"atan2",function(){return r.atan2}),n.d(e,"atanh",function(){return r.atanh}),n.d(e,"avgPool",function(){return r.avgPool}),n.d(e,"backend",function(){return r.backend}),n.d(e,"backend_util",function(){return r.backend_util}),n.d(e,"basicLSTMCell",function(){return r.basicLSTMCell}),n.d(e,"batchNorm",function(){return r.batchNorm}),n.d(e,"batchNorm2d",function(){return r.batchNorm2d}),n.d(e,"batchNorm3d",function(){return r.batchNorm3d}),n.d(e,"batchNorm4d",function(){return r.batchNorm4d}),n.d(e,"batchNormalization",function(){return r.batchNormalization}),n.d(e,"batchNormalization2d",function(){return r.batchNormalization2d}),n.d(e,"batchNormalization3d",function(){return r.batchNormalization3d}),n.d(e,"batchNormalization4d",function(){return r.batchNormalization4d}),n.d(e,"batchToSpaceND",function(){return r.batchToSpaceND}),n.d(e,"browser",function(){return r.browser}),n.d(e,"buffer",function(){return r.buffer}),n.d(e,"cast",function(){return r.cast}),n.d(e,"ceil",function(){return r.ceil}),n.d(e,"clipByValue",function(){return r.clipByValue}),n.d(e,"clone",function(){return r.clone}),n.d(e,"complex",function(){return r.complex}),n.d(e,"concat",function(){return r.concat}),n.d(e,"concat1d",function(){return r.concat1d}),n.d(e,"concat2d",function(){return r.concat2d}),n.d(e,"concat3d",function(){return r.concat3d}),n.d(e,"concat4d",function(){return r.concat4d}),n.d(e,"conv1d",function(){return r.conv1d}),n.d(e,"conv2d",function(){return r.conv2d}),n.d(e,"conv2dDerFilter",function(){return r.conv2dDerFilter}),n.d(e,"conv2dTranspose",function(){return r.conv2dTranspose}),n.d(e,"conv3d",function(){return r.conv3d}),n.d(e,"cos",function(){return r.cos}),n.d(e,"cosh",function(){return r.cosh}),n.d(e,"cumsum",function(){return r.cumsum}),n.d(e,"customGrad",function(){return r.customGrad}),n.d(e,"deprecationWarn",function(){return r.deprecationWarn}),n.d(e,"depthToSpace",function(){return r.depthToSpace}),n.d(e,"depthwiseConv2d",function(){return r.depthwiseConv2d}),n.d(e,"disableDeprecationWarnings",function(){return r.disableDeprecationWarnings}),n.d(e,"dispose",function(){return r.dispose}),n.d(e,"disposeVariables",function(){return r.disposeVariables}),n.d(e,"div",function(){return r.div}),n.d(e,"divStrict",function(){return r.divStrict}),n.d(e,"dot",function(){return r.dot}),n.d(e,"dropout",function(){return r.dropout}),n.d(e,"elu",function(){return r.elu}),n.d(e,"enableDebugMode",function(){return r.enableDebugMode}),n.d(e,"enableProdMode",function(){return r.enableProdMode}),n.d(e,"environment",function(){return r.environment}),n.d(e,"equal",function(){return r.equal}),n.d(e,"equalStrict",function(){return r.equalStrict}),n.d(e,"erf",function(){return r.erf}),n.d(e,"exp",function(){return r.exp}),n.d(e,"expandDims",function(){return r.expandDims}),n.d(e,"expm1",function(){return r.expm1}),n.d(e,"eye",function(){return r.eye}),n.d(e,"fft",function(){return r.fft}),n.d(e,"fill",function(){return r.fill}),n.d(e,"findBackend",function(){return r.findBackend}),n.d(e,"findBackendFactory",function(){return r.findBackendFactory}),n.d(e,"floor",function(){return r.floor}),n.d(e,"floorDiv",function(){return r.floorDiv}),n.d(e,"frame",function(){return r.frame}),n.d(e,"fused",function(){return r.fused}),n.d(e,"gather",function(){return r.gather}),n.d(e,"gatherND",function(){return r.gatherND}),n.d(e,"getBackend",function(){return r.getBackend}),n.d(e,"grad",function(){return r.grad}),n.d(e,"grads",function(){return r.grads}),n.d(e,"greater",function(){return r.greater}),n.d(e,"greaterEqual",function(){return r.greaterEqual}),n.d(e,"greaterEqualStrict",function(){return r.greaterEqualStrict}),n.d(e,"greaterStrict",function(){return r.greaterStrict}),n.d(e,"hammingWindow",function(){return r.hammingWindow}),n.d(e,"hannWindow",function(){return r.hannWindow}),n.d(e,"ifft",function(){return r.ifft}),n.d(e,"imag",function(){return r.imag}),n.d(e,"image",function(){return r.image}),n.d(e,"io",function(){return r.io}),n.d(e,"irfft",function(){return r.irfft}),n.d(e,"isFinite",function(){return r.isFinite}),n.d(e,"isInf",function(){return r.isInf}),n.d(e,"isNaN",function(){return r.isNaN}),n.d(e,"keep",function(){return r.keep}),n.d(e,"leakyRelu",function(){return r.leakyRelu}),n.d(e,"less",function(){return r.less}),n.d(e,"lessEqual",function(){return r.lessEqual}),n.d(e,"lessEqualStrict",function(){return r.lessEqualStrict}),n.d(e,"lessStrict",function(){return r.lessStrict}),n.d(e,"linalg",function(){return r.linalg}),n.d(e,"linspace",function(){return r.linspace}),n.d(e,"localResponseNormalization",function(){return r.localResponseNormalization}),n.d(e,"log",function(){return r.log}),n.d(e,"log1p",function(){return r.log1p}),n.d(e,"logSigmoid",function(){return r.logSigmoid}),n.d(e,"logSoftmax",function(){return r.logSoftmax}),n.d(e,"logSumExp",function(){return r.logSumExp}),n.d(e,"logicalAnd",function(){return r.logicalAnd}),n.d(e,"logicalNot",function(){return r.logicalNot}),n.d(e,"logicalOr",function(){return r.logicalOr}),n.d(e,"logicalXor",function(){return r.logicalXor}),n.d(e,"losses",function(){return r.losses}),n.d(e,"matMul",function(){return r.matMul}),n.d(e,"math",function(){return r.math}),n.d(e,"max",function(){return r.max}),n.d(e,"maxPool",function(){return r.maxPool}),n.d(e,"maximum",function(){return r.maximum}),n.d(e,"maximumStrict",function(){return r.maximumStrict}),n.d(e,"mean",function(){return r.mean}),n.d(e,"memory",function(){return r.memory}),n.d(e,"min",function(){return r.min}),n.d(e,"minimum",function(){return r.minimum}),n.d(e,"minimumStrict",function(){return r.minimumStrict}),n.d(e,"mod",function(){return r.mod}),n.d(e,"modStrict",function(){return r.modStrict}),n.d(e,"moments",function(){return r.moments}),n.d(e,"movingAverage",function(){return r.movingAverage}),n.d(e,"mul",function(){return r.mul}),n.d(e,"mulStrict",function(){return r.mulStrict}),n.d(e,"multiRNNCell",function(){return r.multiRNNCell}),n.d(e,"multinomial",function(){return r.multinomial}),n.d(e,"neg",function(){return r.neg}),n.d(e,"nextFrame",function(){return r.nextFrame}),n.d(e,"norm",function(){return r.norm}),n.d(e,"notEqual",function(){return r.notEqual}),n.d(e,"notEqualStrict",function(){return r.notEqualStrict}),n.d(e,"oneHot",function(){return r.oneHot}),n.d(e,"ones",function(){return r.ones}),n.d(e,"onesLike",function(){return r.onesLike}),n.d(e,"op",function(){return r.op}),n.d(e,"outerProduct",function(){return r.outerProduct}),n.d(e,"pad",function(){return r.pad}),n.d(e,"pad1d",function(){return r.pad1d}),n.d(e,"pad2d",function(){return r.pad2d}),n.d(e,"pad3d",function(){return r.pad3d}),n.d(e,"pad4d",function(){return r.pad4d}),n.d(e,"pool",function(){return r.pool}),n.d(e,"pow",function(){return r.pow}),n.d(e,"powStrict",function(){return r.powStrict}),n.d(e,"prelu",function(){return r.prelu}),n.d(e,"print",function(){return r.print}),n.d(e,"prod",function(){return r.prod}),n.d(e,"profile",function(){return r.profile}),n.d(e,"rand",function(){return r.rand}),n.d(e,"randomNormal",function(){return r.randomNormal}),n.d(e,"randomUniform",function(){return r.randomUniform}),n.d(e,"range",function(){return r.range}),n.d(e,"ready",function(){return r.ready}),n.d(e,"real",function(){return r.real}),n.d(e,"reciprocal",function(){return r.reciprocal}),n.d(e,"registerBackend",function(){return r.registerBackend}),n.d(e,"relu",function(){return r.relu}),n.d(e,"removeBackend",function(){return r.removeBackend}),n.d(e,"reshape",function(){return r.reshape}),n.d(e,"reverse",function(){return r.reverse}),n.d(e,"reverse1d",function(){return r.reverse1d}),n.d(e,"reverse2d",function(){return r.reverse2d}),n.d(e,"reverse3d",function(){return r.reverse3d}),n.d(e,"reverse4d",function(){return r.reverse4d}),n.d(e,"rfft",function(){return r.rfft}),n.d(e,"round",function(){return r.round}),n.d(e,"rsqrt",function(){return r.rsqrt}),n.d(e,"scalar",function(){return r.scalar}),n.d(e,"scatterND",function(){return r.scatterND}),n.d(e,"selu",function(){return r.selu}),n.d(e,"separableConv2d",function(){return r.separableConv2d}),n.d(e,"serialization",function(){return r.serialization}),n.d(e,"setBackend",function(){return r.setBackend}),n.d(e,"setPlatform",function(){return r.setPlatform}),n.d(e,"setdiff1dAsync",function(){return r.setdiff1dAsync}),n.d(e,"sigmoid",function(){return r.sigmoid}),n.d(e,"sign",function(){return r.sign}),n.d(e,"signal",function(){return r.signal}),n.d(e,"sin",function(){return r.sin}),n.d(e,"sinh",function(){return r.sinh}),n.d(e,"slice",function(){return r.slice}),n.d(e,"slice1d",function(){return r.slice1d}),n.d(e,"slice2d",function(){return r.slice2d}),n.d(e,"slice3d",function(){return r.slice3d}),n.d(e,"slice4d",function(){return r.slice4d}),n.d(e,"softmax",function(){return r.softmax}),n.d(e,"softplus",function(){return r.softplus}),n.d(e,"spaceToBatchND",function(){return r.spaceToBatchND}),n.d(e,"sparseToDense",function(){return r.sparseToDense}),n.d(e,"spectral",function(){return r.spectral}),n.d(e,"split",function(){return r.split}),n.d(e,"sqrt",function(){return r.sqrt}),n.d(e,"square",function(){return r.square}),n.d(e,"squaredDifference",function(){return r.squaredDifference}),n.d(e,"squaredDifferenceStrict",function(){return r.squaredDifferenceStrict}),n.d(e,"squeeze",function(){return r.squeeze}),n.d(e,"stack",function(){return r.stack}),n.d(e,"step",function(){return r.step}),n.d(e,"stridedSlice",function(){return r.stridedSlice}),n.d(e,"sub",function(){return r.sub}),n.d(e,"subStrict",function(){return r.subStrict}),n.d(e,"sum",function(){return r.sum}),n.d(e,"tan",function(){return r.tan}),n.d(e,"tanh",function(){return r.tanh}),n.d(e,"tensor",function(){return r.tensor}),n.d(e,"tensor1d",function(){return r.tensor1d}),n.d(e,"tensor2d",function(){return r.tensor2d}),n.d(e,"tensor3d",function(){return r.tensor3d}),n.d(e,"tensor4d",function(){return r.tensor4d}),n.d(e,"tensor5d",function(){return r.tensor5d}),n.d(e,"tensor6d",function(){return r.tensor6d}),n.d(e,"tensor_util",function(){return r.tensor_util}),n.d(e,"test_util",function(){return r.test_util}),n.d(e,"tidy",function(){return r.tidy}),n.d(e,"tile",function(){return r.tile}),n.d(e,"time",function(){return r.time}),n.d(e,"topk",function(){return r.topk}),n.d(e,"train",function(){return r.train}),n.d(e,"transpose",function(){return r.transpose}),n.d(e,"truncatedNormal",function(){return r.truncatedNormal}),n.d(e,"unsortedSegmentSum",function(){return r.unsortedSegmentSum}),n.d(e,"unstack",function(){return r.unstack}),n.d(e,"util",function(){return r.util}),n.d(e,"valueAndGrad",function(){return r.valueAndGrad}),n.d(e,"valueAndGrads",function(){return r.valueAndGrads}),n.d(e,"variable",function(){return r.variable}),n.d(e,"variableGrads",function(){return r.variableGrads}),n.d(e,"version_core",function(){return r.version_core}),n.d(e,"webgl",function(){return r.webgl}),n.d(e,"where",function(){return r.where}),n.d(e,"whereAsync",function(){return r.whereAsync}),n.d(e,"zeros",function(){return r.zeros}),n.d(e,"zerosLike",function(){return r.zerosLike}),n.d(e,"constraints",function(){return W}),n.d(e,"initializers",function(){return Gt}),n.d(e,"layers",function(){return Si}),n.d(e,"metrics",function(){return Ei}),n.d(e,"models",function(){return Oi}),n.d(e,"regularizers",function(){return Ai}),n.d(e,"CallbackList",function(){return we}),n.d(e,"CustomCallback",function(){return ke}),n.d(e,"History",function(){return _e}),n.d(e,"Callback",function(){return Ci}),n.d(e,"callbacks",function(){return Ii}),n.d(e,"EarlyStopping",function(){return Ti}),n.d(e,"InputSpec",function(){return ue}),n.d(e,"SymbolicTensor",function(){return ce}),n.d(e,"LayersModel",function(){return wn}),n.d(e,"input",function(){return En}),n.d(e,"loadLayersModel",function(){return Sn}),n.d(e,"model",function(){return _n}),n.d(e,"registerCallbackConstructor",function(){return On}),n.d(e,"sequential",function(){return kn}),n.d(e,"RNN",function(){return ti}),n.d(e,"Sequential",function(){return xn}),n.d(e,"LayerVariable",function(){return ie}),n.d(e,"version_layers",function(){return"1.2.2"}),n.d(e,"GraphModel",function(){return Di.a}),n.d(e,"loadGraphModel",function(){return Di.c}),n.d(e,"deregisterOp",function(){return Di.b}),n.d(e,"registerOp",function(){return Di.d}),n.d(e,"version_converter",function(){return Di.e}),n.d(e,"data",function(){return ji});var Ri={"tfjs-core":r.version_core,"tfjs-data":ji.version_data,"tfjs-layers":"1.2.2","tfjs-converter":Di.e,tfjs:"1.2.2"}},function(t,e,n){var r=n(8),i=n(51),o=n(35),a=n(34),s=n(50),u=function(t,e,n){var c,l,f,d,h=t&u.F,p=t&u.G,m=t&u.S,g=t&u.P,v=t&u.B,b=p?r:m?r[e]||(r[e]={}):(r[e]||{}).prototype,y=p?i:i[e]||(i[e]={}),w=y.prototype||(y.prototype={});for(c in p&&(n=e),n)f=((l=!h&&b&&void 0!==b[c])?b:n)[c],d=v&&l?s(f,r):g&&"function"==typeof f?s(Function.call,f):f,b&&a(b,c,f,t&u.U),y[c]!=f&&o(y,c,d),g&&w[c]!=f&&(w[c]=f)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,n){"use strict";n.d(e,"c",function(){return i}),n.d(e,"a",function(){return o}),n.d(e,"b",function(){return a}),n.d(e,"d",function(){return s});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. 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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function a(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function s(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}},function(t,e,n){var r=n(14);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){var r=n(18),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){"use strict";e.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(272));e.default=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),(0,r.default)(t,i.key,i)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}()},function(t,e,n){"use strict";e.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(36));e.default=function(t){return function(){var e=t.apply(this,arguments);return new r.default(function(t,n){return function i(o,a){try{var s=e[o](a),u=s.value}catch(t){return void n(t)}if(!s.done)return r.default.resolve(u).then(function(t){i("next",t)},function(t){i("throw",t)});t(u)}("next")})}}},function(t,e,n){t.exports=n(512)},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(167)("wks"),i=n(87),o=n(8).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},function(t,e,n){var r=n(48),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e,n){"use strict";e.__esModule=!0;var r=a(n(495)),i=a(n(493)),o="function"==typeof i.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof i.default&&t.constructor===i.default&&t!==i.default.prototype?"symbol":typeof t};function a(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof i.default&&"symbol"===o(r.default)?function(t){return void 0===t?"undefined":o(t)}:function(t){return t&&"function"==typeof i.default&&t.constructor===i.default&&t!==i.default.prototype?"symbol":void 0===t?"undefined":o(t)}},function(t,e,n){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var r=n(759),i=n(758),o=n(357);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=d(t,e),t}(t,e,n,r):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=s(t,r)).write(e,n);return i!==r&&(t=t.slice(0,i)),t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|h(e.length);return 0===(t=s(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||function(t){return t!=t}(e.length)?s(t,0):d(t,e);if("Buffer"===e.type&&o(e.data))return d(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(l(e),t=s(t,e<0?0:0|h(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function d(t,e){var n=e.length<0?0:0|h(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function h(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(r)return B(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(t,o+d)!==c(e,d)){f=!1;break}if(f)return o}return-1}function b(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function y(t,e,n,r){return W(B(e,t.length-n),t,n,r)}function w(t,e,n,r){return W(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function x(t,e,n,r){return w(t,e,n,r)}function _(t,e,n,r){return W(U(e),t,n,r)}function k(t,e,n,r){return W(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(n=t.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function E(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,u,c=t[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=O));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return c(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return function(t,e,n,r){return l(e),e<=0?s(t,e):void 0!==n?"string"==typeof r?s(t,e).fill(n,r):s(t,e).fill(n):s(t,e)}(null,t,e,n)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var a=t[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,n);case"utf8":case"utf-8":return E(this,e,n);case"ascii":return A(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;for(var o=i-r,a=n-e,s=Math.min(o,a),c=this.slice(r,i),l=t.slice(e,n),f=0;f<s;++f)if(c[f]!==l[f]){o=c[f],a=l[f];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return w(this,t,e,n);case"latin1":case"binary":return x(this,t,e,n);case"base64":return _(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function A(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function M(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=L(t[o]);return i}function N(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function T(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function D(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function j(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function R(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,n,r,o){return o||R(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function P(t,e,n,r,o){return o||R(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if(t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||I(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||I(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);I(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);I(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return P(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return P(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=u.isBuffer(t)?t:B(new u(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var z=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(27))},function(t,e){var n=t.exports={version:"2.6.1"};"number"==typeof __e&&(__e=n)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return e&&t.then(function(t){return e(void 0,t),t}).catch(function(t){return e(t),t}),t}},function(t,e,n){var r=n(5),i=n(395),o=n(60),a=Object.defineProperty;e.f=n(22)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){t.exports=!n(13)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){"use strict";n.r(e);var r=function(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]},i=function(t){return(t=r(Math.abs(t)))?t[1]:NaN},o=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function a(t){if(!(e=o.exec(t)))throw new Error("invalid format: "+t);var e;return new s({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function s(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}a.prototype=s.prototype,s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var u,c,l,f,d=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(e+1):t},h=function(t,e){var n=r(t,e);if(!n)return t+"";var i=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")},p={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return h(100*t,e)},r:h,s:function(t,e){var n=r(t,e);if(!n)return t+"";var i=n[0],o=n[1],a=o-(u=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,s=i.length;return a===s?i:a>s?i+new Array(a-s+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+r(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},m=function(t){return t},g=Array.prototype.map,v=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],b=function(t){var e=void 0===t.grouping||void 0===t.thousands?m:function(t,e){return function(n,r){for(var i=n.length,o=[],a=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(n.substring(i-=s,i+s)),!((u+=s+1)>r));)s=t[a=(a+1)%t.length];return o.reverse().join(e)}}(g.call(t.grouping,Number),t.thousands+""),n=void 0===t.currency?"":t.currency[0]+"",r=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?m:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(g.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function h(t){var i=(t=a(t)).fill,h=t.align,m=t.sign,g=t.symbol,b=t.zero,y=t.width,w=t.comma,x=t.precision,_=t.trim,k=t.type;"n"===k?(w=!0,k="g"):p[k]||(void 0===x&&(x=12),_=!0,k="g"),(b||"0"===i&&"="===h)&&(b=!0,i="0",h="=");var S="$"===g?n:"#"===g&&/[boxX]/.test(k)?"0"+k.toLowerCase():"",E="$"===g?r:/[%p]/.test(k)?c:"",O=p[k],A=/[defgprs%]/.test(k);function C(t){var n,r,a,c=S,p=E;if("c"===k)p=O(t)+p,t="";else{var g=(t=+t)<0;if(t=isNaN(t)?f:O(Math.abs(t),x),_&&(t=d(t)),g&&0==+t&&(g=!1),c=(g?"("===m?m:l:"-"===m||"("===m?"":m)+c,p=("s"===k?v[8+u/3]:"")+p+(g&&"("===m?")":""),A)for(n=-1,r=t.length;++n<r;)if(48>(a=t.charCodeAt(n))||a>57){p=(46===a?o+t.slice(n+1):t.slice(n))+p,t=t.slice(0,n);break}}w&&!b&&(t=e(t,1/0));var C=c.length+t.length+p.length,M=C<y?new Array(y-C+1).join(i):"";switch(w&&b&&(t=e(M+t,M.length?y-p.length:1/0),M=""),h){case"<":t=c+t+p+M;break;case"=":t=c+M+t+p;break;case"^":t=M.slice(0,C=M.length>>1)+c+t+p+M.slice(C);break;default:t=M+c+t+p}return s(t)}return x=void 0===x?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),C.toString=function(){return t+""},C}return{format:h,formatPrefix:function(t,e){var n=h(((t=a(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(i(e)/3))),o=Math.pow(10,-r),s=v[8+r/3];return function(t){return n(o*t)+s}}}};function y(t){return c=b(t),l=c.format,f=c.formatPrefix,c}y({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});var w=function(t){return Math.max(0,-i(Math.abs(t)))},x=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(i(e)/3)))-i(Math.abs(t)))},_=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,i(e)-i(t))+1};n.d(e,"formatDefaultLocale",function(){return y}),n.d(e,"format",function(){return l}),n.d(e,"formatPrefix",function(){return f}),n.d(e,"formatLocale",function(){return b}),n.d(e,"formatSpecifier",function(){return a}),n.d(e,"FormatSpecifier",function(){return s}),n.d(e,"precisionFixed",function(){return w}),n.d(e,"precisionPrefix",function(){return x}),n.d(e,"precisionRound",function(){return _})},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=n(722).Buffer}catch(t){}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var f=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)f*=e;this.imuln(f),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,e.length-1),h=Math.max(0,c-t.length+1);h<=d;h++){var p=c-h|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[h])+f)/67108864|0,f=67108863&a}n.words[c]=0|f,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(t=t||10,e=0|e||1,16===t||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],h=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(t);n=(p=p.idivn(h)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var h=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],w=8191&y,x=y>>>13,_=0|a[4],k=8191&_,S=_>>>13,E=0|a[5],O=8191&E,A=E>>>13,C=0|a[6],M=8191&C,N=C>>>13,T=0|a[7],I=8191&T,D=T>>>13,j=0|a[8],R=8191&j,F=j>>>13,P=0|a[9],z=8191&P,L=P>>>13,B=0|s[0],U=8191&B,W=B>>>13,q=0|s[1],V=8191&q,H=q>>>13,$=0|s[2],G=8191&$,K=$>>>13,X=0|s[3],Y=8191&X,J=X>>>13,Z=0|s[4],Q=8191&Z,tt=Z>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191<,dt=lt>>>13,ht=0|s[9],pt=8191&ht,mt=ht>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,W))+Math.imul(d,U)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,W))+Math.imul(m,U)|0,o=Math.imul(m,W);var vt=(c+(r=r+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(d,V)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,W))+Math.imul(b,U)|0,o=Math.imul(b,W),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var bt=(c+(r=r+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,U),i=(i=Math.imul(w,W))+Math.imul(x,U)|0,o=Math.imul(x,W),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,K)|0;var yt=(c+(r=r+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(k,U),i=(i=Math.imul(k,W))+Math.imul(S,U)|0,o=Math.imul(S,W),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(v,G)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var wt=(c+(r=r+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,W))+Math.imul(A,U)|0,o=Math.imul(A,W),r=r+Math.imul(k,V)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,J)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var xt=(c+(r=r+Math.imul(f,nt)|0)|0)+((8191&(i=(i=i+Math.imul(f,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,W))+Math.imul(N,U)|0,o=Math.imul(N,W),r=r+Math.imul(O,V)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(k,G)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var _t=(c+(r=r+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(I,U),i=(i=Math.imul(I,W))+Math.imul(D,U)|0,o=Math.imul(D,W),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(O,G)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,J)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(v,nt)|0,i=(i=i+Math.imul(v,rt)|0)+Math.imul(b,nt)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var kt=(c+(r=r+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,W))+Math.imul(F,U)|0,o=Math.imul(F,W),r=r+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(M,G)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,r=r+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(v,ot)|0,i=(i=i+Math.imul(v,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(z,U),i=(i=Math.imul(z,W))+Math.imul(L,U)|0,o=Math.imul(L,W),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,H)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,r=r+Math.imul(k,nt)|0,i=(i=i+Math.imul(k,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,r=r+Math.imul(v,ut)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,r=r+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,dt)|0;var Et=(c+(r=r+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(z,V),i=(i=Math.imul(z,H))+Math.imul(L,V)|0,o=Math.imul(L,H),r=r+Math.imul(R,G)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,K)|0,r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,J)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(O,nt)|0,i=(i=i+Math.imul(O,rt)|0)+Math.imul(A,nt)|0,o=o+Math.imul(A,rt)|0,r=r+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,r=r+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var Ot=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(z,G),i=(i=Math.imul(z,K))+Math.imul(L,G)|0,o=Math.imul(L,K),r=r+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(F,Y)|0,o=o+Math.imul(F,J)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(M,nt)|0,i=(i=i+Math.imul(M,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,r=r+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,dt)|0;var At=(c+(r=r+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(z,Y),i=(i=Math.imul(z,J))+Math.imul(L,Y)|0,o=Math.imul(L,J),r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(M,ot)|0,i=(i=i+Math.imul(M,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,r=r+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,dt)|0)+Math.imul(S,ft)|0,o=o+Math.imul(S,dt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),r=r+Math.imul(R,nt)|0,i=(i=i+Math.imul(R,rt)|0)+Math.imul(F,nt)|0,o=o+Math.imul(F,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(M,ut)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,dt)|0;var Mt=(c+(r=r+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(z,nt),i=(i=Math.imul(z,rt))+Math.imul(L,nt)|0,o=Math.imul(L,rt),r=r+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,at)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,dt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,dt)|0;var Nt=(c+(r=r+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,ot),i=(i=Math.imul(z,at))+Math.imul(L,ot)|0,o=Math.imul(L,at),r=r+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ct)|0)+Math.imul(F,ut)|0,o=o+Math.imul(F,ct)|0,r=r+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(D,ft)|0,o=o+Math.imul(D,dt)|0;var Tt=(c+(r=r+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(z,ut),i=(i=Math.imul(z,ct))+Math.imul(L,ut)|0,o=Math.imul(L,ct),r=r+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,dt)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,dt)|0;var It=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(z,ft),i=(i=Math.imul(z,dt))+Math.imul(L,ft)|0,o=Math.imul(L,dt);var Dt=(c+(r=r+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(F,pt)|0))<<13)|0;c=((o=o+Math.imul(F,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var jt=(c+(r=Math.imul(z,pt))|0)+((8191&(i=(i=Math.imul(z,mt))+Math.imul(L,pt)|0))<<13)|0;return c=((o=Math.imul(L,mt))+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,u[0]=gt,u[1]=vt,u[2]=bt,u[3]=yt,u[4]=wt,u[5]=xt,u[6]=_t,u[7]=kt,u[8]=St,u[9]=Et,u[10]=Ot,u[11]=At,u[12]=Ct,u[13]=Mt,u[14]=Nt,u[15]=Tt,u[16]=It,u[17]=Dt,u[18]=jt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(h=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?h(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var p=n[l+h],m=r[l+h],g=n[l+h+a],v=r[l+h+a],b=f*g-d*v;v=f*v+d*g,g=b,n[l+h]=p+g,r[l+h]=m+v,n[l+h+a]=p-g,r[l+h+a]=m-v,h!==s&&(b=u*f-c*d,d=u*d+c*f,f=b)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),f=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,f,r,i);for(var h=0;h<r;h++){var p=s[h]*l[h]-u[h]*f[h];u[h]=s[h]*f[h]+u[h]*l[h],s[h]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*(0|r.words[i.length+f])+(0|r.words[i.length+f-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,f);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,f),r.isZero()||(r.negative^=1);s&&(s.words[f]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),f=e.clone();!e.isZero();){for(var d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,d=1;0==(n.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new _(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(y,v),i(w,v),i(x,v),x.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new y;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new x}return g[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),h=this.pow(t,i),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var v=this.pow(f,new o(1).iushln(p-g-1));d=d.redMul(v),f=v.redSqr(),h=h.redMul(f),p=g}return d},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var f=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},i(k,_),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)}).call(this,n(146)(t))},function(t,e,n){var r=n(59);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(29),i=n(19),o=n(64),a=n(68),s=n(77),u=function(t,e,n){var c,l,f,d=t&u.F,h=t&u.G,p=t&u.S,m=t&u.P,g=t&u.B,v=t&u.W,b=h?i:i[e]||(i[e]={}),y=b.prototype,w=h?r:p?r[e]:(r[e]||{}).prototype;for(c in h&&(n=e),n)(l=!d&&w&&void 0!==w[c])&&s(b,c)||(f=l?w[c]:n[c],b[c]=h&&"function"!=typeof w[c]?n[c]:g&&l?o(f,r):v&&w[c]==f?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(f):m&&"function"==typeof f?o(Function.call,f):f,m&&((b.virtual||(b.virtual={}))[c]=f,t&u.R&&y&&!y[c]&&a(y,c,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(220)("wks"),i=n(151),o=n(29).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";var r=e;r.version=n(716).version,r.utils=n(715),r.rand=n(333),r.curve=n(145),r.curves=n(710),r.ec=n(702),r.eddsa=n(698)},function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return xt}),n.d(e,"c",function(){return _t}),n.d(e,"b",function(){return d}),n.d(e,"d",function(){return l}),n.d(e,"e",function(){return kt});var r,i,o=n(0),a=function(){return(a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};
/**
* @license
* Copyright 2019 Google LLC. 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 s(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function u(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}!function(t){t[t.DT_INVALID=0]="DT_INVALID",t[t.DT_FLOAT=1]="DT_FLOAT",t[t.DT_DOUBLE=2]="DT_DOUBLE",t[t.DT_INT32=3]="DT_INT32",t[t.DT_UINT8=4]="DT_UINT8",t[t.DT_INT16=5]="DT_INT16",t[t.DT_INT8=6]="DT_INT8",t[t.DT_STRING=7]="DT_STRING",t[t.DT_COMPLEX64=8]="DT_COMPLEX64",t[t.DT_INT64=9]="DT_INT64",t[t.DT_BOOL=10]="DT_BOOL",t[t.DT_QINT8=11]="DT_QINT8",t[t.DT_QUINT8=12]="DT_QUINT8",t[t.DT_QINT32=13]="DT_QINT32",t[t.DT_BFLOAT16=14]="DT_BFLOAT16",t[t.DT_FLOAT_REF=101]="DT_FLOAT_REF",t[t.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",t[t.DT_INT32_REF=103]="DT_INT32_REF",t[t.DT_UINT8_REF=104]="DT_UINT8_REF",t[t.DT_INT16_REF=105]="DT_INT16_REF",t[t.DT_INT8_REF=106]="DT_INT8_REF",t[t.DT_STRING_REF=107]="DT_STRING_REF",t[t.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",t[t.DT_INT64_REF=109]="DT_INT64_REF",t[t.DT_BOOL_REF=110]="DT_BOOL_REF",t[t.DT_QINT8_REF=111]="DT_QINT8_REF",t[t.DT_QUINT8_REF=112]="DT_QUINT8_REF",t[t.DT_QINT32_REF=113]="DT_QINT32_REF",t[t.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF"}(r||(r={})),function(t){!function(t){t[t.LEGACY=0]="LEGACY",t[t.V1=1]="V1",t[t.V2=2]="V2"}(t.CheckpointFormatVersion||(t.CheckpointFormatVersion={}))}(i||(i={}));var c={};function l(t,e){var n={tfOpName:t,category:"custom",inputs:[],attrs:[],customExecutor:e};c[t]=n}function f(t){return c[t]}function d(t){delete c[t]}function h(t,e,n,r){var i=e.inputParams[t];if(i&&void 0!==i.inputIndexStart){var o=i.inputIndexStart,a=0===i.inputIndexEnd?void 0:void 0===i.inputIndexEnd?o+1:i.inputIndexEnd;if("tensor"===i.type)return p(e.inputNames[i.inputIndexStart],n,r);if("tensors"===i.type)return e.inputNames.slice(o,a).map(function(t){return p(t,n,r)});var s=Array.prototype.slice.call(p(e.inputNames.slice(o)[0],n,r).dataSync());return"number"===i.type?s[0]:s}var u=e.attrParams[t];return u&&u.value}function p(t,e,n){var r=v(t),i=r[0],o=r[1],a=n.currentContextIds.find(function(t){return!!e[g(i,t)]});return void 0!==a?e[g(i,a)][o]:void 0}function m(t,e){var n=v(t),r=n[0],i=n[1];return[g(r,e&&e.currentContextId),i]}function g(t,e){return e?t+"-"+e:t}function v(t){var e=t.lastIndexOf(":");return-1===e?[t,0]:[t.substring(0,e),Number(t.substring(e+1))]}function b(t,e){for(var n=[],r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}var y=Object.freeze({json:[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),w=Object.freeze({json:[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"clip_value_min",name:"clipValueMin",type:"number"},{tfName:"clip_value_max",name:"clipValueMax",type:"number"}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"clipValueMin",name:"clipValueMin",type:"number",defaultValue:0},{tfName:"clipValueMax",name:"clipValueMax",type:"number",defaultValue:6}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),x=Object.freeze({json:[{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"}]}]}),_=Object.freeze({json:[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]}]}),k=Object.freeze({json:[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]}]}),S=Object.freeze({json:[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),E=Object.freeze({json:[{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]}]}),O=Object.freeze({json:[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}]}),A=Object.freeze({json:[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]}]}),C=Object.freeze({json:[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),M=Object.freeze({json:[{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),N=Object.freeze({json:[{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}]}]}),T=Object.freeze({json:[{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]}]}),I=Object.freeze({json:[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool",notSupported:!0}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}]}),D=Object.freeze({json:[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}]}),j=Object.freeze({json:[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]}]}),R=function(){function t(){var t=[y,w,x,_,k,S,E,C,A,O,M,N,T,I,D,j],e=[].concat.apply([],t.map(function(t){return t.json}));this.opMappers=e.reduce(function(t,e){return t[e.tfOpName]=e,t},{})}return Object.defineProperty(t,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),t.prototype.transformGraph=function(t){var e=this,n=[],r=[],i=t.node.reduce(function(t,i){return t[i.name]=e.mapNode(i),"Placeholder"===i.op&&n.push(t[i.name]),"Const"===i.op&&r.push(t[i.name]),t},{}),o=[],a=[],s=Object.keys(i);return s.forEach(function(t){var e=i[t];e.inputNames.forEach(function(t){var n=m(t)[0];e.inputs.push(i[n]),i[n].children.push(e)}),0===e.inputs.length&&o.push(e)}),s.forEach(function(t){var e=i[t];0===e.children.length&&a.push(e)}),{nodes:i,inputs:o,outputs:a,weights:r,placeholders:n}},t.prototype.mapNode=function(t){var e=f(t.op)||this.opMappers[t.op]||{};null==t.attr&&(t.attr={});var n={name:t.name,op:t.op,category:e.category,inputNames:(t.input||[]).map(function(t){return t.startsWith("^")?t.substr(1):t}),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:t.attr};return null!=e.inputs&&(n.inputParams=e.inputs.reduce(function(t,e){return t[e.name]={type:e.type,inputIndexStart:e.start,inputIndexEnd:e.end},t},{})),null!=e.attrs&&(n.attrParams=e.attrs.reduce(function(e,n){var r=n.type,i=void 0;switch(n.type){case"string":void 0===(i=P(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=P(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":void 0===(i=$(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=$(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":void 0===(i=L(t.attr,n.tfName,n.defaultValue||0))&&n.tfDeprecatedName&&(i=L(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":void 0===(i=H(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=H(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":void 0===(i=z(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=z(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":void 0===(i=K(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=K(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":void 0===(i=V(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=V(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":void 0===(i=G(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=G(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":void 0===(i=U(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=U(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":void 0===(i=W(t.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(i=W(t.attr,n.tfDeprecatedName,n.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+n.type+" for op: "+t.op)}return e[n.name]={value:i,type:r},e},{})),n},t}();function F(e,n){var r=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){var n=o.ENV.global;if(void 0!==n.atob)return n.atob(e);if(void 0!==t)return new t(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(e);return n?r:r.toLowerCase()}function P(t,e,n,r){void 0===r&&(r=!1);var i=t[e];return null!=i?F(i.s,r):n}function z(t,e,n){var r=t[e];return r?r.b:n}function L(t,e,n){var r=t[e]||{},i=null!=r.i?r.i:null!=r.f?r.f:n;return"number"==typeof i?i:parseInt(i,10)}function B(t){switch("string"==typeof t&&(t=r[t]),t){case r.DT_FLOAT:return"float32";case r.DT_INT32:return"int32";case r.DT_BOOL:return"bool";case r.DT_DOUBLE:return"float32";case r.DT_STRING:return"string";default:return null}}function U(t,e,n){var r=t[e];return r&&r.type?B(r.type):n}function W(t,e,n){var r=t[e];return r&&r.list&&r.list.type?r.list.type.map(function(t){return B(t)}):n}function q(t){if(!t.unknownRank)return null!=t.dim?t.dim.map(function(t){return"number"==typeof t.size?t.size:parseInt(t.size,10)}):[]}function V(t,e,n){var r=t[e];return r&&r.shape?q(r.shape):n}function H(t,e,n){var r=t[e];return r?(r.list.f&&r.list.f.length?r.list.f:r.list.i).map(function(t){return"number"==typeof t?t:parseInt(t,10)}):n}function $(t,e,n,r){void 0===r&&(r=!1);var i=t[e];return i&&i.list&&i.list.s?i.list.s.map(function(t){return F(t,r)}):n}function G(t,e,n){var r=t[e];return r&&r.list&&r.list.shape?r.list.shape.map(function(t){return q(t)}):n}function K(t,e,n){var r=t[e];return r&&r.list&&r.list.b?r.list.b:n}var X=function(){function t(t,e,n){var r=this;this.node=t,this.tensorMap=e,this.context=n,this.inputs=[],this.attrs={},this.inputs=t.inputNames.map(function(t){return r.getInput(t)}),null!=t.rawAttrs&&(this.attrs=Object.keys(t.rawAttrs).reduce(function(t,e){return t[e]=r.getAttr(e),t},{}))}return t.prototype.getInput=function(t){return p(t,this.tensorMap,this.context)},t.prototype.getAttr=function(t,e){var n=this.node.rawAttrs[t];if(null!=n.tensor)return p(t,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return L(this.node.rawAttrs,t,e);if(null!=n.s)return P(this.node.rawAttrs,t,e);if(null!=n.b)return z(this.node.rawAttrs,t,e);if(null!=n.shape)return V(this.node.rawAttrs,t,e);if(null!=n.type)return U(this.node.rawAttrs,t,e);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return H(this.node.rawAttrs,t,e);if(null!=n.list.s)return $(this.node.rawAttrs,t,e);if(null!=n.list.shape)return G(this.node.rawAttrs,t,e);if(null!=n.list.b)return K(this.node.rawAttrs,t,e);if(null!=n.list.type)return W(this.node.rawAttrs,t,e)}return e},t}(),Y=function(t,e,n){switch(t.op){case"BiasAdd":case"Add":return[Object(o.add)(h("a",t,e,n),h("b",t,e,n))];case"AddN":return[Object(o.addN)(h("tensors",t,e,n))];case"FloorMod":case"Mod":return[Object(o.mod)(h("a",t,e,n),h("b",t,e,n))];case"Mul":return[Object(o.mul)(h("a",t,e,n),h("b",t,e,n))];case"RealDiv":case"Div":return[Object(o.div)(h("a",t,e,n),h("b",t,e,n))];case"FloorDiv":return[Object(o.floorDiv)(h("a",t,e,n),h("b",t,e,n))];case"Sub":return[Object(o.sub)(h("a",t,e,n),h("b",t,e,n))];case"Minimum":return[Object(o.minimum)(h("a",t,e,n),h("b",t,e,n))];case"Maximum":return[Object(o.maximum)(h("a",t,e,n),h("b",t,e,n))];case"Pow":return[Object(o.pow)(h("a",t,e,n),h("b",t,e,n))];case"SquaredDifference":return[Object(o.squaredDifference)(h("a",t,e,n),h("b",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},J=function(t,e,n){switch(t.op){case"Abs":case"ComplexAbs":return[Object(o.abs)(h("x",t,e,n))];case"Acos":return[Object(o.acos)(h("x",t,e,n))];case"Acosh":return[Object(o.acosh)(h("x",t,e,n))];case"Asin":return[Object(o.asin)(h("x",t,e,n))];case"Asinh":return[Object(o.asinh)(h("x",t,e,n))];case"Atan":return[Object(o.atan)(h("x",t,e,n))];case"Atan2":return[Object(o.atan2)(h("x",t,e,n),h("y",t,e,n))];case"Atanh":return[Object(o.atanh)(h("x",t,e,n))];case"Ceil":return[Object(o.ceil)(h("x",t,e,n))];case"Complex":return[Object(o.complex)(h("real",t,e,n),h("imag",t,e,n))];case"Cos":return[Object(o.cos)(h("x",t,e,n))];case"Cosh":return[Object(o.cosh)(h("x",t,e,n))];case"Elu":return[Object(o.elu)(h("x",t,e,n))];case"Erf":return[Object(o.erf)(h("x",t,e,n))];case"Exp":return[Object(o.exp)(h("x",t,e,n))];case"Expm1":return[Object(o.expm1)(h("x",t,e,n))];case"Floor":return[Object(o.floor)(h("x",t,e,n))];case"Log":return[Object(o.log)(h("x",t,e,n))];case"Log1p":return[Object(o.log1p)(h("x",t,e,n))];case"Neg":return[Object(o.neg)(h("x",t,e,n))];case"Reciprocal":return[Object(o.reciprocal)(h("x",t,e,n))];case"Relu":return[Object(o.relu)(h("x",t,e,n))];case"Round":return[Object(o.round)(h("x",t,e,n))];case"Selu":return[Object(o.selu)(h("x",t,e,n))];case"Sigmoid":return[Object(o.sigmoid)(h("x",t,e,n))];case"Sin":return[Object(o.sin)(h("x",t,e,n))];case"Sign":return[Object(o.sign)(h("x",t,e,n))];case"Sinh":return[Object(o.sinh)(h("x",t,e,n))];case"Softplus":return[Object(o.softplus)(h("x",t,e,n))];case"Sqrt":return[Object(o.sqrt)(h("x",t,e,n))];case"Square":return[Object(o.square)(h("x",t,e,n))];case"Tanh":return[Object(o.tanh)(h("x",t,e,n))];case"Tan":return[Object(o.tan)(h("x",t,e,n))];case"Relu6":case"ClipByValue":return[Object(o.clipByValue)(h("x",t,e,n),h("clipValueMin",t,e,n),h("clipValueMax",t,e,n))];case"Rsqrt":return[Object(o.rsqrt)(p(t.inputNames[0],e,n))];case"Prod":return[Object(o.prod)(h("x",t,e,n),h("axes",t,e,n))];case"LeakyRelu":return[Object(o.leakyRelu)(h("x",t,e,n),h("alpha",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},Z=function(){function t(e,n,r,i,o,a,s){this.name=e,this.dtype=n,this.maxSize=r,this.elementShape=i,this.identicalElementShapes=o,this.dynamicSize=a,this.clearAfterRead=s,this.tensors=[],this.closed_=!1,this.id=t.nextId++}return Object.defineProperty(t.prototype,"closed",{get:function(){return this.closed_},enumerable:!0,configurable:!0}),t.prototype.clearAndClose=function(){this.tensors.forEach(function(t){return t.tensor.dispose()}),this.tensors=[],this.closed_=!0},t.prototype.size=function(){return this.tensors.length},t.prototype.read=function(t){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(t<0||t>=this.tensors.length)throw new Error("Tried to read from index "+t+", but array size is: "+this.tensors.length);var e=this.tensors[t];if(e.cleared)throw new Error("TensorArray "+this.name+": Could not read index "+t+" twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(e.cleared=!0),e.read=!0,e.tensor},t.prototype.readMany=function(t){var e=this;return t.map(function(t){return e.read(t)})},t.prototype.write=function(t,e){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(t<0||!this.dynamicSize&&t>=this.maxSize)throw new Error("Tried to write to index "+t+", but array is not resizeable and size is: "+this.maxSize);var n=this.tensors[t]||{};if(e.dtype!==this.dtype)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+",\n because the value dtype is "+e.dtype+", but TensorArray dtype is "+this.dtype+".");if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=e.shape),this.assertShapesMatchAllowUndefinedSize(this.elementShape,e.shape,"TensorArray "+this.name+": Could not write to TensorArray index "+t+"."),n&&n.read)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+", because it has already been read.");if(n&&n.written)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+", because it has already been written.");n.tensor=e,n.written=!0,this.tensors[t]=n},t.prototype.writeMany=function(t,e){var n=this;if(t.length!==e.length)throw new Error("TensorArray "+this.name+": could not write multiple tensors,because the index size: "+t.length+" is not the same as tensors size: "+e.length+".");t.forEach(function(t,r){return n.write(t,e[r])})},t.prototype.gather=function(t,e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but gather requested dtype "+e);if(!t){t=[];for(var n=0;n<this.size();n++)t.push(n)}if(0===t.length)return Object(o.tensor)([],[0].concat(this.elementShape));var r=this.readMany(t);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),Object(o.stack)(r,0)},t.prototype.concat=function(t){if(t&&t!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but concat requested dtype "+t);if(0===this.size())return Object(o.tensor)([],[0].concat(this.elementShape));for(var e=[],n=0;n<this.size();n++)e.push(n);var r=this.readMany(e);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,r[0].shape,"TensorArray shape mismatch: tensor array shape ("+this.elementShape+") vs first tensor shape ("+r[0].shape+")"),Object(o.concat)(r,0)},t.prototype.scatter=function(t,e){if(e.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+e.dtype);if(t.length!==e.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: "+t.length+" vs. "+e.shape[0]);var n=Math.max.apply(Math,t);if(!this.dynamicSize&&n>=this.maxSize)throw new Error("Max index must be < array size ("+n+" vs. "+this.maxSize+")");this.writeMany(t,Object(o.unstack)(e,0))},t.prototype.split=function(t,e){var n=this;if(e.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+e.dtype);var r=0,i=t.map(function(t){return r+=t});if(r!==e.shape[0])throw new Error("Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n "+r+", and tensor's shape is: "+e.shape);if(!this.dynamicSize&&t.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths ("+this.maxSize+" vs. "+t.length+"), and the TensorArray is not marked as dynamically resizeable");var a=0===r?0:e.size/r,s=[];Object(o.tidy)(function(){e=e.reshape([1,r,a]);for(var u=0;u<t.length;++u){var c=[0,0===u?0:i[u-1],0],l=[1,t[u],a];s[u]=Object(o.slice)(e,c,l).reshape(n.elementShape)}return s});for(var u=[],c=0;c<t.length;c++)u[c]=c;this.writeMany(u,s)},t.prototype.assertShapesMatchAllowUndefinedSize=function(t,e,n){void 0===n&&(n=""),o.util.assert(this.shapesEqualAllowUndefinedSize(t,e),function(){return n+" Shapes "+t+" and "+e+" must match"})},t.prototype.shapesEqualAllowUndefinedSize=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(-1!==t[n]&&-1!==e[n]&&t[n]!==e[n])return!1;return!0},t.nextId=0,t}(),Q=function(t,e,n){switch(t.op){case"Conv1D":var r=h("stride",t,e,n),i=h("pad",t,e,n),a=h("dataFormat",t,e,n).toUpperCase(),s=h("dilation",t,e,n);return[Object(o.conv1d)(h("x",t,e,n),h("filter",t,e,n),r,i,a,s)];case"Conv2D":r=h("strides",t,e,n),i=h("pad",t,e,n),a=h("dataFormat",t,e,n).toUpperCase();var u=h("dilations",t,e,n);return[Object(o.conv2d)(h("x",t,e,n),h("filter",t,e,n),[r[1],r[2]],i,a,[u[1],u[2]])];case"Conv2DBackpropInput":case"Conv2dTranspose":var c=h("outputShape",t,e,n);return r=h("strides",t,e,n),i=h("pad",t,e,n),[Object(o.conv2dTranspose)(h("x",t,e,n),h("filter",t,e,n),c,[r[1],r[2]],i)];case"DepthwiseConv2dNative":case"DepthwiseConv2d":return r=h("strides",t,e,n),i=h("pad",t,e,n),u=h("dilations",t,e,n),a=h("dataFormat",t,e,n).toUpperCase(),[Object(o.depthwiseConv2d)(h("input",t,e,n),h("filter",t,e,n),[r[1],r[2]],i,a,[u[1],u[2]])];case"AvgPool":r=h("strides",t,e,n),i=h("pad",t,e,n);var l=h("kernelSize",t,e,n);return[Object(o.avgPool)(h("x",t,e,n),[l[1],l[2]],[r[1],r[2]],i)];case"MaxPool":return r=h("strides",t,e,n),i=h("pad",t,e,n),l=h("kernelSize",t,e,n),[Object(o.maxPool)(h("x",t,e,n),[l[1],l[2]],[r[1],r[2]],i)];default:throw TypeError("Node type "+t.op+" is not implemented")}},tt=function(t,e,n){switch(t.op){case"Fill":var r=h("shape",t,e,n),i=h("dtype",t,e,n),a=h("value",t,e,n);return[Object(o.fill)(r,a,i)];case"LinSpace":var s=h("start",t,e,n),u=h("stop",t,e,n),c=h("num",t,e,n);return[Object(o.linspace)(s,u,c)];case"OneHot":var l=h("indices",t,e,n),f=h("depth",t,e,n),d=h("onValue",t,e,n),p=h("offValue",t,e,n);return[Object(o.oneHot)(l,f,d,p)];case"Ones":return[Object(o.ones)(h("shape",t,e,n),h("dtype",t,e,n))];case"OnesLike":return[Object(o.onesLike)(h("x",t,e,n))];case"RandomUniform":return[Object(o.randomUniform)(h("shape",t,e,n),h("minval",t,e,n),h("maxval",t,e,n),h("dtype",t,e,n))];case"Range":s=h("start",t,e,n);var m=h("stop",t,e,n),g=h("step",t,e,n);return[Object(o.range)(s,m,g,h("dtype",t,e,n))];case"TruncatedNormal":r=h("shape",t,e,n);var v=h("mean",t,e,n),b=h("stdDev",t,e,n),y=h("seed",t,e,n);return[Object(o.truncatedNormal)(r,v,b,h("dtype",t,e,n),y)];case"Zeros":return[Object(o.zeros)(h("shape",t,e,n),h("dtype",t,e,n))];case"ZerosLike":return[Object(o.zerosLike)(h("x",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},et=function(t,e,n){switch(t.op){case"TopKV2":var r=h("x",t,e,n),i=h("k",t,e,n),a=h("sorted",t,e,n),s=Object(o.topk)(r,i,a);return[s.values,s.indices];default:throw TypeError("Node type "+t.op+" is not implemented")}},nt=function(t,e,n){switch(t.op){case"Const":return e[t.name];case"PlaceholderWithDefault":var r=h("default",t,e,n);return[p(t.name,e,n)||r];case"Placeholder":return[p(t.name,e,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":return[h("x",t,e,n).clone()];case"IdentityN":return h("x",t,e,n).map(function(t){return t.clone()});case"Snapshot":return[h("x",t,e,n).clone()];case"Shape":return[Object(o.tensor1d)(h("x",t,e,n).shape,"int32")];case"ShapeN":return h("x",t,e,n).map(function(t){return Object(o.tensor1d)(t.shape)});case"Size":return[Object(o.scalar)(h("x",t,e,n).size,"int32")];case"Rank":return[Object(o.scalar)(h("x",t,e,n).rank,"int32")];case"NoOp":return[];case"Print":var i=h("x",t,e,n),a=h("data",t,e,n),s=h("message",t,e,n),u=h("summarize",t,e,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(s);for(var c=0;c<a.length;c++)console.log(Array.prototype.slice.call(a[c].dataSync()).slice(0,u));return[i];default:throw TypeError("Node type "+t.op+" is not implemented")}},rt=function(t,e,n){switch(t.op){case"ResizeBilinear":var r=h("images",t,e,n),i=h("size",t,e,n),a=h("alignCorners",t,e,n);return[o.image.resizeBilinear(r,[i[0],i[1]],a)];case"ResizeNearestNeighbor":return r=h("images",t,e,n),i=h("size",t,e,n),a=h("alignCorners",t,e,n),[o.image.resizeNearestNeighbor(r,[i[0],i[1]],a)];case"CropAndResize":var s=h("image",t,e,n),u=h("boxes",t,e,n),c=h("boxInd",t,e,n),l=h("cropSize",t,e,n),f=h("method",t,e,n),d=h("extrapolationValue",t,e,n);return[o.image.cropAndResize(s,u,c,l,f,d)];default:throw TypeError("Node type "+t.op+" is not implemented")}},it=function(t,e,n){switch(t.op){case"Equal":return[Object(o.equal)(h("a",t,e,n),h("b",t,e,n))];case"NotEqual":return[Object(o.notEqual)(h("a",t,e,n),h("b",t,e,n))];case"Greater":return[Object(o.greater)(h("a",t,e,n),h("b",t,e,n))];case"GreaterEqual":return[Object(o.greaterEqual)(h("a",t,e,n),h("b",t,e,n))];case"Less":return[Object(o.less)(h("a",t,e,n),h("b",t,e,n))];case"LessEqual":return[Object(o.lessEqual)(h("a",t,e,n),h("b",t,e,n))];case"LogicalAnd":return[Object(o.logicalAnd)(h("a",t,e,n),h("b",t,e,n))];case"LogicalNot":return[Object(o.logicalNot)(h("a",t,e,n))];case"LogicalOr":return[Object(o.logicalOr)(h("a",t,e,n),h("b",t,e,n))];case"Select":return[Object(o.where)(h("condition",t,e,n),h("a",t,e,n),h("b",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},ot=function(t,e,n){switch(t.op){case"BatchMatMul":case"MatMul":return[Object(o.matMul)(h("a",t,e,n),h("b",t,e,n),h("transposeA",t,e,n),h("transposeB",t,e,n))];case"Transpose":return[Object(o.transpose)(h("x",t,e,n),h("perm",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},at=function(t,e,n){switch(t.op){case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[Object(o.batchNorm)(h("x",t,e,n),h("mean",t,e,n),h("variance",t,e,n),h("offset",t,e,n),h("scale",t,e,n),h("epsilon",t,e,n))];case"LRN":return[Object(o.localResponseNormalization)(h("x",t,e,n),h("radius",t,e,n),h("bias",t,e,n),h("alpha",t,e,n),h("beta",t,e,n))];case"Softmax":return[Object(o.softmax)(h("x",t,e,n))];case"LogSoftmax":return[Object(o.logSoftmax)(h("x",t,e,n))];case"SparseToDense":return[Object(o.sparseToDense)(h("sparseIndices",t,e,n),h("outputShape",t,e,n),h("sparseValues",t,e,n),h("defaultValue",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},st=function(t,e,n){switch(t.op){case"Max":var r=h("axis",t,e,n),i=h("keepDims",t,e,n);return[Object(o.max)(h("x",t,e,n),r,i)];case"Mean":return r=h("axis",t,e,n),i=h("keepDims",t,e,n),[Object(o.mean)(h("x",t,e,n),r,i)];case"Min":return r=h("axis",t,e,n),i=h("keepDims",t,e,n),[Object(o.min)(h("x",t,e,n),r,i)];case"Sum":return r=h("axis",t,e,n),i=h("keepDims",t,e,n),[Object(o.sum)(h("x",t,e,n),r,i)];case"All":return r=h("axis",t,e,n),i=h("keepDims",t,e,n),[Object(o.all)(h("x",t,e,n),r,i)];case"Any":return r=h("axis",t,e,n),i=h("keepDims",t,e,n),[Object(o.any)(h("x",t,e,n),r,i)];case"ArgMax":return r=h("axis",t,e,n),[Object(o.argMax)(h("x",t,e,n),r)];case"ArgMin":return r=h("axis",t,e,n),[Object(o.argMin)(h("x",t,e,n),r)];case"Prod":return r=h("axis",t,e,n),i=h("keepDims",t,e,n),[Object(o.prod)(h("x",t,e,n),r,i)];default:throw TypeError("Node type "+t.op+" is not implemented")}},ut=function(t,e,n){switch(t.op){case"ConcatV2":case"Concat":var r=h("axis",t,e,n),i=h("tensors",t,e,n);return[Object(o.concat)(i,r)];case"GatherV2":case"Gather":r=h("axis",t,e,n);var a=h("x",t,e,n),s=h("indices",t,e,n);return[Object(o.gather)(a,s.asType("int32"),r)];case"ReverseV2":case"Reverse":return r=h("axis",t,e,n),a=h("x",t,e,n),[Object(o.reverse)(a,r)];case"Slice":var u=h("begin",t,e,n),c=h("size",t,e,n);return[Object(o.slice)(h("x",t,e,n),u,c)];case"StridedSlice":u=h("begin",t,e,n);var l=h("end",t,e,n),f=h("strides",t,e,n),d=h("beginMask",t,e,n),p=h("endMask",t,e,n),m=h("ellipsisMask",t,e,n),g=h("newAxisMask",t,e,n),v=h("shrinkAxisMask",t,e,n),b=h("x",t,e,n);if(1===u.length&&b.shape.length>1)for(var y=1;y<b.shape.length;y++)u.push(0),l.push(b.shape[y]),f.push(f[0]);return[Object(o.stridedSlice)(b,u,l,f,d,p,m,g,v)];case"Pack":return Object(o.tidy)(function(){var r=h("axis",t,e,n),i=h("tensors",t,e,n),a=i[0].shape,s=i[0].squeeze().shape,u=i.map(function(t){var e=o.util.arraysEqual(t.shape,a);if(!e&&!o.util.arraysEqual(t.squeeze().shape,s))throw new Error("the input tensors shape does not match");return e?t:t.reshape(a)});return[Object(o.stack)(u,r)]});case"Unpack":return Object(o.tidy)(function(){var r=h("axis",t,e,n),i=h("tensor",t,e,n);return Object(o.unstack)(i,r)});case"Tile":var w=h("reps",t,e,n);return[Object(o.tile)(h("x",t,e,n),w)];case"Split":case"SplitV":r=h("axis",t,e,n);var x=h("numOrSizeSplits",t,e,n);return Object(o.split)(h("x",t,e,n),x,r);case"ScatterNd":s=h("indices",t,e,n);var _=h("values",t,e,n),k=h("shape",t,e,n);return[Object(o.scatterND)(s,_,k)];case"GatherNd":var S=h("x",t,e,n);return s=h("indices",t,e,n),[Object(o.gatherND)(S,s)];case"SparseToDense":s=h("sparseIndices",t,e,n),k=h("outputShape",t,e,n);var E=h("sparseValues",t,e,n),O=h("defaultValue",t,e,n);return[Object(o.sparseToDense)(s,E,k,E.dtype===O.dtype?O:O.asType(E.dtype))];default:throw TypeError("Node type "+t.op+" is not implemented")}},ct=function(t,e,n){switch(t.op){case"FFT":return[Object(o.fft)(h("x",t,e,n))];case"IFFT":return[Object(o.ifft)(h("x",t,e,n))];case"RFFT":return[Object(o.rfft)(h("x",t,e,n))];case"IRFFT":return[Object(o.irfft)(h("x",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},lt=function(t,e,n){switch(t.op){case"Cast":return[Object(o.cast)(h("x",t,e,n),h("dtype",t,e,n))];case"ExpandDims":var r=h("axis",t,e,n);return[Object(o.expandDims)(h("x",t,e,n),r)];case"Squeeze":return r=h("axis",t,e,n),[Object(o.squeeze)(h("x",t,e,n),r)];case"Reshape":return[Object(o.reshape)(h("x",t,e,n),h("shape",t,e,n))];case"PadV2":case"Pad":return[Object(o.pad)(h("x",t,e,n),b(h("padding",t,e,n),2),h("constantValue",t,e,n))];case"SpaceToBatchND":var i=h("blockShape",t,e,n),a=b(h("paddings",t,e,n),2);return[Object(o.spaceToBatchND)(h("x",t,e,n),i,a)];case"BatchToSpaceND":i=h("blockShape",t,e,n);var s=b(h("crops",t,e,n),2);return[Object(o.batchToSpaceND)(h("x",t,e,n),i,s)];case"DepthToSpace":var u=h("blockSize",t,e,n),c=h("dataFormat",t,e,n).toUpperCase();return[Object(o.depthToSpace)(h("x",t,e,n),u,c)];default:throw TypeError("Node type "+t.op+" is not implemented")}};function ft(t,e,n){var r=function(t,e,n){switch(t.category){case"arithmetic":return Y(t,e,n);case"basic_math":return J(t,e,n);case"control":return function(t,e,n){return s(this,void 0,void 0,function(){var r,i,a,s,c,l,f,d,m,g,v,b,y,w,x,_,k,S,E,O,A,C,M,N,T,I,D,j,R,F,P,z,L,B,U;return u(this,function(u){switch(u.label){case 0:switch(t.op){case"LoopCond":return[3,1];case"Switch":return[3,2];case"Merge":return[3,4];case"Enter":return[3,5];case"Exit":return[3,6];case"NextIteration":return[3,7];case"TensorArrayV3":return[3,8];case"TensorArrayWriteV3":return[3,9];case"TensorArrayReadV3":return[3,10];case"TensorArrayGatherV3":return[3,11];case"TensorArrayScatterV3":return[3,12];case"TensorArrayConcatV3":return[3,13];case"TensorArraySplitV3":return[3,14];case"TensorArraySizeV3":return[3,15];case"TensorArrayCloseV3":return[3,16]}return[3,17];case 1:return[2,[h("pred",t,e,n).clone()]];case 2:return r=h("pred",t,e,n),i=h("data",t,e,n),[4,r.data()];case 3:return[2,u.sent()[0]?[void 0,i.clone()]:[i.clone(),void 0]];case 4:return[2,(a=t.inputNames.find(function(t){return void 0!==p(t,e,n)}))?[p(a,e,n).clone()]:void 0];case 5:return s=h("frameName",t,e,n),c=h("tensor",t,e,n),n.enterFrame(s),[2,[c.clone()]];case 6:return l=h("tensor",t,e,n),n.exitFrame(),[2,[l.clone()]];case 7:return f=h("tensor",t,e,n),n.nextIteration(),[2,[f.clone()]];case 8:return d=h("size",t,e,n),m=h("dtype",t,e,n),g=h("elementShape",t,e,n),v=h("dynamicSize",t,e,n),b=h("clearAfterRead",t,e,n),y=h("identicalElementShapes",t,e,n),w=h("name",t,e,n),x=new Z(w,m,d,g,y,v,b),n.addTensorArray(x),[2,[Object(o.scalar)(x.id),Object(o.scalar)(1)]];case 9:return _=h("tensorArrayId",t,e,n),k=h("index",t,e,n),S=h("tensor",t,e,n),n.getTensorArray(_).write(k,S),[2,[Object(o.scalar)(1)]];case 10:return E=h("tensorArrayId",t,e,n),O=h("index",t,e,n),[2,[n.getTensorArray(E).read(O)]];case 11:return A=h("tensorArrayId",t,e,n),C=h("indices",t,e,n),M=h("dtype",t,e,n),[2,[n.getTensorArray(A).gather(C,M)]];case 12:return N=h("tensorArrayId",t,e,n),T=h("indices",t,e,n),I=h("tensor",t,e,n),n.getTensorArray(N).scatter(T,I),[2,[Object(o.scalar)(1)]];case 13:return D=h("tensorArrayId",t,e,n),j=n.getTensorArray(D),R=h("dtype",t,e,n),[2,[j.concat(R)]];case 14:return F=h("tensorArrayId",t,e,n),P=h("tensor",t,e,n),z=h("lengths",t,e,n),n.getTensorArray(F).split(z,P),[2,[Object(o.scalar)(1)]];case 15:return L=h("tensorArrayId",t,e,n),B=n.getTensorArray(L),[2,[Object(o.scalar)(B.size(),"int32")]];case 16:return U=h("tensorArrayId",t,e,n),n.getTensorArray(U).clearAndClose(),[2,[]];case 17:throw TypeError("Node type "+t.op+" is not implemented")}})})}(t,e,n);case"convolution":return Q(t,e,n);case"creation":return tt(t,e,n);case"dynamic":return function(t,e,n){return s(this,void 0,void 0,function(){var r,i,a,s,c;return u(this,function(u){switch(u.label){case 0:switch(t.op){case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":return[3,1];case"Where":return[3,3];case"ListDiff":return[3,5]}return[3,7];case 1:return r=h("boxes",t,e,n),i=h("scores",t,e,n),a=h("maxOutputSize",t,e,n),s=h("iouThreshold",t,e,n),c=h("scoreThreshold",t,e,n),[4,o.image.nonMaxSuppressionAsync(r,i,a,s,c)];case 2:return[2,[u.sent()]];case 3:return[4,Object(o.whereAsync)(h("condition",t,e,n))];case 4:return[2,[u.sent()]];case 5:return[4,Object(o.setdiff1dAsync)(h("x",t,e,n),h("y",t,e,n))];case 6:return[2,u.sent()];case 7:throw TypeError("Node type "+t.op+" is not implemented")}})})}(t,e,n);case"evaluation":return et(t,e,n);case"image":return rt(t,e,n);case"graph":return nt(t,e,n);case"logical":return it(t,e,n);case"matrices":return ot(t,e,n);case"normalization":return at(t,e,n);case"reduction":return st(t,e,n);case"slice_join":return ut(t,e,n);case"spectral":return ct(t,e,n);case"transformation":return lt(t,e,n);case"custom":var r=f(t.op);if(r&&r.customExecutor)return r.customExecutor(new X(t,e,n));throw TypeError("Custom op "+t.op+" is not registered.");default:throw TypeError("Unknown op '"+t.op+"'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}}(t,e,n);return r instanceof Promise?r.then(function(t){return[].concat(t)}):[].concat(r)}var dt=function(){function t(t,e){this.weightMap=t,this.tensorArrayMap=e,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return t.prototype.newFrame=function(t,e){return{id:t,frameName:e,iterationId:0}},Object.defineProperty(t.prototype,"currentContext",{get:function(){return this.contexts},set:function(t){this.contexts!==t&&(this.contexts=t,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentContextId",{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentContextIds",{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),t.prototype.generateCurrentContextIds=function(){for(var t=[],e=0;e<this.contexts.length-1;e++){var n=this.contexts.slice(0,this.contexts.length-e);t.push(this.contextIdforContexts(n))}t.push(""),this._currentContextIds=t},t.prototype.contextIdforContexts=function(t){return t?t.map(function(t){return 0===t.id&&0===t.iterationId?"":t.frameName+"-"+t.iterationId}).join("/"):""},t.prototype.enterFrame=function(t){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,t)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},t.prototype.exitFrame=function(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},t.prototype.nextIteration=function(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");this.contexts=this.contexts.slice(),this.lastId++;var t=Object.assign({},this.contexts[this.contexts.length-1]);t.iterationId+=1,t.id=this.lastId,this.contexts.splice(-1,1,t),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},t.prototype.getWeight=function(t){return this.weightMap[t]},t.prototype.addTensorArray=function(t){this.tensorArrayMap[t.id]=t},t.prototype.getTensorArray=function(t){return this.tensorArrayMap[t]},t}();function ht(t,e,n){for(var r=new Set,i=[],o=null,a=null,s=new Set,u=e.slice();u.length>0;){var c=u.pop();(gt(c)||vt(c))&&null==o&&(a=(o=c).children.map(function(t){return t.name}).filter(function(t){return r.has(t)})),r.add(c.name),null==n[c.name]&&null==t[c.name]&&(0!==c.inputs.length?c.inputs.forEach(function(t){s.has(t.name)||(s.add(t.name),u.push(t))}):i.push(c.name))}return{inputs:t,outputs:e,usedNodes:r,missingInputs:i,dynamicNode:o,syncInputs:a}}var pt=["Switch","Merge","Enter","Exit","NextIteration"],mt=["NonMaxSuppressionV2","NonMaxSuppressionV3","Where"];function gt(t){return pt.indexOf(t.op)>=0}function vt(t){return mt.indexOf(t.op)>=0}var bt=function(){function t(t){this.graph=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this.placeholders=t.placeholders,this._outputs=t.outputs}return Object.defineProperty(t.prototype,"weightMap",{get:function(){return this._weightMap},set:function(t){var e=Object.keys(t).map(function(e){return t[e].map(function(t){return t.id})});this.weightIds=[].concat.apply([],e),this._weightMap=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputs",{get:function(){return this.placeholders.map(function(t){return{name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"outputs",{get:function(){return this._outputs.map(function(t){return{name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputNodes",{get:function(){return this.placeholders.map(function(t){return t.name})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"outputNodes",{get:function(){return this.outputs.map(function(t){return t.name})},enumerable:!0,configurable:!0}),t.prototype.getCompilationKey=function(t,e){var n=t.map(function(t){return t.name}).sort(),r=e.map(function(t){return t.name}).sort();return n.join(this.SEPERATOR)+"--"+r.join(this.SEPERATOR)},t.prototype.compile=function(t,e){var n=ht(t,e,this.weightMap),r=n.missingInputs,i=n.dynamicNode,o=n.syncInputs;if(null!=i)throw new Error("This execution contains the node '"+i.name+"', which has the dynamic op '"+i.op+"'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs ["+o+"]");if(r.length>0){var a=e.map(function(t){return t.name}),s=Object.keys(t);throw new Error("Cannot compute the outputs ["+a+"] from the provided inputs ["+s+"]. Missing the following inputs: ["+r+"]")}return function(t,e,n){var r=n.usedNodes,i=n.inputs,o=[];Object.keys(i).map(function(e){return t.nodes[e]}).forEach(function(t){r.has(t.name)&&o.push(t)}),t.weights.forEach(function(t){r.has(t.name)&&o.push(t)});for(var a=new Set,s=[];o.length>0;){var u=o.pop();a.add(u.name),e[u.name]||s.push(u),u.children.forEach(function(t){!a.has(t.name)&&r.has(t.name)&&t.inputs.every(function(t){return a.has(t.name)})&&o.push(t)})}return s}(this.graph,this.weightMap,n)},t.prototype.execute=function(t,e){var n=this,r=Object.keys(t).sort();this.checkInputs(t),this.checkInputShapeAndType(t),this.checkOutputs(e);var i=r.map(function(t){return n.graph.nodes[t]}),s=e.map(function(t){return n.graph.nodes[v(t)[0]]}),u=this.getCompilationKey(i,s),c=this.compiledMap.get(u);null==c&&(c=this.compile(t,s),this.compiledMap.set(u,c));var l={};return Object(o.tidy)(function(){var r=new dt(n._weightMap,l),i=a({},n.weightMap);Object.keys(t).forEach(function(e){i[e]=[t[e]]});for(var o=n.getFrozenTensorIds(i),s={},u=0;u<c.length;u++){var f=c[u];if(!i[f.name]){var d=ft(f,i,r);if(d instanceof Promise)throw new Error("The execution of the op '"+f.op+"' returned a promise. Please use model.executeAsync() instead.");i[f.name]=d,n.checkTensorForDisposal(f.name,f,i,r,o,e,s)}}return e.map(function(t){return p(t,i,r)})})},t.prototype.getFrozenTensorIds=function(t){var e=[].concat.apply([],Object.keys(t).map(function(e){return t[e]}).map(function(t){return t.map(function(t){return t.id})}));return new Set(e)},t.prototype.checkTensorForDisposal=function(t,e,n,r,i,o,a){"control"!==e.category&&-1===o.indexOf(t)&&(n[t].forEach(function(t){null!=t&&(a[t.id]=(a[t.id]||0)+e.children.length)}),e.inputs.forEach(function(t){if("control"!==t.category){var e=function(t,e,n){return e[g(t,r.currentContextId)]}(t.name,n);null!=e&&e.forEach(function(t){if(t&&!i.has(t.id)){var e=a[t.id];1===e?(t.dispose(),delete a[t.id]):null!=e&&a[t.id]--}})}}))},t.prototype.executeAsync=function(t,e){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,c=this;return u(this,function(u){switch(u.label){case 0:return this.checkInputs(t),this.checkInputShapeAndType(t),n={},r=new dt(this._weightMap,n),[4,this.executeWithControlFlow(t,r,e)];case 1:return i=u.sent(),o=e.map(function(t){return p(t,i,r)}),a=new Set(o.map(function(t){return t.id})),s=new Set(Object.keys(t).map(function(e){return t[e].id})),Object.keys(i).forEach(function(t){i[t].forEach(function(t){!t||t.isDisposed||a.has(t.id)||s.has(t.id)||-1!==c.weightIds.indexOf(t.id)||t.dispose()})}),[2,o]}})})},t.prototype.executeWithControlFlow=function(t,e,n){return s(this,void 0,void 0,function(){var r,i,o,s,c,l,f,d,h,m,g,b,y,w,x,_,k=this;return u(this,function(u){switch(u.label){case 0:r=Object.keys(t),i=r.map(function(t){return k.graph.nodes[t]}),o=n.map(function(t){return k.graph.nodes[v(t)[0]]}),s=ht(t,o,this.weightMap),c=s.usedNodes,l=s.missingInputs,f=s.dynamicNode,d=s.syncInputs,h=i.concat(this.graph.weights).map(function(t){return{node:t,contexts:e.currentContext}}),m=a({},this.weightMap),Object.keys(t).forEach(function(e){m[e]=[t[e]]}),g={},b=this.getFrozenTensorIds(m),y={},u.label=1;case 1:return h.length>0?(w=this.processStack(i,h,e,m,y,b,n,g,c),[4,Promise.all(w)]):[3,3];case 2:return u.sent(),[3,1];case 3:if(null==f&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead."),(x=o.filter(function(t){return!gt(t)&&!p(t.name,m,e)}).map(function(t){return t.name})).length>0)throw _="",null!=f&&(_="Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs ["+d+"]"),new Error("Cannot compute the outputs ["+x+"] from the provided inputs ["+r+"]. Consider providing the following inputs: ["+l+"]. "+_);return[2,m]}})})},t.prototype.processStack=function(t,e,n,r,i,o,a,s,u){for(var c=this,l=[],f=function(){var f=e.pop();n.currentContext=f.contexts;var p="";if("Enter"===f.node.op&&h("isConstant",f.node,r,n)&&(p=m(f.node.name,n)[0]),-1===t.indexOf(f.node)){var g=ft(f.node,r,n);p||(p=m(f.node.name,n)[0]);var v=n.currentContext;g instanceof Promise?l.push(g.then(function(t){return r[p]=t,n.currentContext=v,c.checkTensorForDisposal(p,f.node,r,n,o,a,s),c.processChildNodes(f.node,e,n,r,i,u),t})):(r[p]=g,d.checkTensorForDisposal(p,f.node,r,n,o,a,s),d.processChildNodes(f.node,e,n,r,i,u))}else d.processChildNodes(f.node,e,n,r,i,u)},d=this;e.length>0;)f();return l},t.prototype.processChildNodes=function(t,e,n,r,i,o){t.children.forEach(function(t){var a=m(t.name,n)[0];!i[a]&&o.has(t.name)&&("Merge"===t.op?t.inputNames.some(function(t){return!!p(t,r,n)})&&(i[a]=!0,e.push({contexts:n.currentContext,node:t})):t.inputNames.every(function(t){return!!p(t,r,n)})&&(i[a]=!0,e.push({contexts:n.currentContext,node:t})))})},t.prototype.dispose=function(){var t=this;Object.keys(this.weightMap).forEach(function(e){return t.weightMap[e].forEach(function(t){return t.dispose()})})},t.prototype.checkInputShapeAndType=function(t){var e=this;Object.keys(t).forEach(function(n){var r=t[n],i=e.graph.nodes[n];if(i.attrParams.shape&&i.attrParams.shape.value){var a=i.attrParams.shape.value,s=a.length===r.shape.length&&r.shape.every(function(t,e){return-1===a[e]||a[e]===t});o.util.assert(s,function(){return"The shape of dict['"+i.name+"'] provided in model.execute(dict) must be ["+a+"], but was ["+r.shape+"]"})}i.attrParams.dtype&&i.attrParams.dtype.value&&o.util.assert(r.dtype===i.attrParams.dtype.value,function(){return"The dtype of dict['"+i.name+"'] provided in model.execute(dict) must be "+i.attrParams.dtype.value+", but was "+r.dtype})})},t.prototype.checkInputs=function(t){var e=this,n=Object.keys(t).filter(function(t){return!e.graph.nodes[t]});if(n.length>0)throw new Error("The dict provided in model.execute(dict) has keys: ["+n+"] that are not part of graph")},t.prototype.checkOutputs=function(t){var e=this;t.forEach(function(t){var n=v(t)[0];if(!e.graph.nodes[n])throw new Error("The output '"+t+"' is not found in the graph")})},t}(),yt="?tfjs-format=file",wt="model.json",xt=function(){function t(t,e){void 0===e&&(e={}),this.modelUrl=t,this.loadOptions=e,this.version="n/a",null==e&&(this.loadOptions={})}return Object.defineProperty(t.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputs",{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"outputs",{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),t.prototype.findIOHandler=function(){var t=this.modelUrl;if(null!=t.load)this.handler=t;else if(null!=this.loadOptions.requestInit)this.handler=o.io.browserHTTPRequest(t,this.loadOptions);else{var e=o.io.getLoadHandlers(t,this.loadOptions.onProgress);if(0===e.length)e.push(o.io.browserHTTPRequest(t,this.loadOptions));else if(e.length>1)throw new Error("Found more than one ("+e.length+") load handlers for URL '"+[t]+"'");this.handler=e[0]}},t.prototype.load=function(){return s(this,void 0,void 0,function(){var t,e,n;return u(this,function(r){switch(r.label){case 0:if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,this.handler.load()];case 1:return t=r.sent(),e=t.modelTopology,this.version=e.versions.producer+"."+e.versions.minConsumer,n=o.io.decodeWeights(t.weightData,t.weightSpecs),this.executor=new bt(R.Instance.transformGraph(e)),this.executor.weightMap=this.convertTensorMapToTensorsMap(n),[2,!0]}})})},t.prototype.predict=function(t,e){return this.execute(t,this.outputNodes)},t.prototype.normalizeInputs=function(t){if(!(t instanceof o.Tensor||Array.isArray(t)))return t;if((t=Array.isArray(t)?t:[t]).length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the graph model has "+this.inputNodes.length+" placeholders, while there are "+t.length+" input tensors.");return this.inputNodes.reduce(function(e,n,r){return e[n]=t[r],e},{})},t.prototype.normalizeOutputs=function(t){return t=t||this.outputNodes,Array.isArray(t)?t:[t]},t.prototype.execute=function(t,e){t=this.normalizeInputs(t),e=this.normalizeOutputs(e);var n=this.executor.execute(t,e);return n.length>1?n:n[0]},t.prototype.executeAsync=function(t,e){return s(this,void 0,void 0,function(){var n;return u(this,function(r){switch(r.label){case 0:return t=this.normalizeInputs(t),e=this.normalizeOutputs(e),[4,this.executor.executeAsync(t,e)];case 1:return[2,(n=r.sent()).length>1?n:n[0]]}})})},t.prototype.convertTensorMapToTensorsMap=function(t){return Object.keys(t).reduce(function(e,n){return e[n]=[t[n]],e},{})},t.prototype.dispose=function(){this.executor.dispose()},t}();function _t(t,e){return void 0===e&&(e={}),s(this,void 0,void 0,function(){var n;return u(this,function(r){switch(r.label){case 0:if(null==t)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");return null==e&&(e={}),e.fromTFHub&&null==t.load&&(t.endsWith("/")||(t+="/"),t=""+t+wt+yt),[4,(n=new xt(t,e)).load()];case 1:return r.sent(),[2,n]}})})}var kt="1.2.2"}).call(this,n(18).Buffer)},function(t,e,n){var r=n(3),i=n(13),o=n(59),a=/"/g,s=function(t,e,n,r){var i=String(o(t)),s="<"+e;return""!==n&&(s+=" "+n+'="'+String(r).replace(a,""")+'"'),s+">"+i+"</"+e+">"};t.exports=function(t,e){var n={};n[t]=e(s),r(r.P+r.F*i(function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}),"String",n)}},function(t,e,n){var r=n(8),i=n(35),o=n(42),a=n(87)("src"),s=Function.toString,u=(""+s).split("toString");n(51).inspectSource=function(t){return s.call(t)},(t.exports=function(t,e,n,s){var c="function"==typeof n;c&&(o(n,"name")||i(n,"name",e)),t[e]!==n&&(c&&(o(n,a)||i(n,a,t[e]?""+t[e]:u.join(String(e)))),t===r?t[e]=n:s?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},function(t,e,n){var r=n(21),i=n(88);t.exports=n(22)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){t.exports={default:n(510),__esModule:!0}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=n,n.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e,n){var r=n(42),i=n(25),o=n(251)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,n){var r=n(130),i=n(88),o=n(41),a=n(60),s=n(42),u=n(395),c=Object.getOwnPropertyDescriptor;e.f=n(22)?c:function(t,e){if(t=o(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(s(t,e))return i(!r.f.call(t,e),t[e])}},function(t,e,n){var r=n(131),i=n(59);t.exports=function(t){return r(i(t))}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(318),o=n(317);e.getDrawArea=function(t){if(t instanceof HTMLElement)return t;if(i.isSurface(t))return t.drawArea;if(i.isSurfaceInfo(t))return o.visor().surface({name:t.name,tab:t.tab,styles:t.styles}).drawArea;throw new Error("Not a drawable")},e.shallowEquals=function(t,e){const n=Object.getOwnPropertyNames(t),r=Object.getOwnPropertyNames(e);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++){const i=n[r];if(t[i]!==e[i])return!1}return!0},e.nextFrame=function(){return r(this,void 0,void 0,function*(){yield new Promise(t=>requestAnimationFrame(t))})}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(56),i=n(359),o=n(225),a=Object.defineProperty;e.f=n(55)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){"use strict";var r=n(13);t.exports=function(t,e){return!!t&&r(function(){e?t.call(null,function(){},1):t.call(null)})}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(30);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e){var n=t.exports={version:"2.6.1"};"number"==typeof __e&&(__e=n)},function(t,e,n){t.exports={default:n(486),__esModule:!0}},function(t,e,n){var r=n(308),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e,n){"use strict";var r=n(38),i=n(6);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var a=t.charCodeAt(i);a<128?n[r++]=a:a<2048?(n[r++]=a>>6|192,n[r++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),n[r++]=a>>18|240,n[r++]=a>>12&63|128,n[r++]=a>>6&63|128,n[r++]=63&a|128):(n[r++]=a>>12|224,n[r++]=a>>6&63|128,n[r++]=63&a|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},e.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=s(t[n].toString(16));return e},e.htonl=a,e.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=a(i)),n+=u(i.toString(16))}return n},e.zero2=s,e.zero8=u,e.join32=function(t,e,n,i){var o=n-e;r(o%4==0);for(var a=new Array(o/4),s=0,u=e;s<a.length;s++,u+=4){var c;c="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],a[s]=c>>>0}return a},e.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},e.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},e.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},e.sum64_lo=function(t,e,n,r){return e+r>>>0},e.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},e.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,f=e;return l+=(f=f+r>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+s>>>0)<s?1:0,t+n+i+a+u+(l+=(f=f+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){t.exports=!n(78)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(45);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){var r=n(50),i=n(131),o=n(25),a=n(16),s=n(235);t.exports=function(t,e){var n=1==t,u=2==t,c=3==t,l=4==t,f=6==t,d=5==t||f,h=e||s;return function(e,s,p){for(var m,g,v=o(e),b=i(v),y=r(s,p,3),w=a(b.length),x=0,_=n?h(e,w):u?h(e,0):void 0;w>x;x++)if((d||x in b)&&(g=y(m=b[x],x,v),t))if(n)_[x]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return x;case 2:_.push(m)}else if(l)return!1;return f?-1:c||l?l:_}}},function(t,e,n){var r=n(3),i=n(51),o=n(13);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*o(function(){n(1)}),"Object",a)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(14);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){t.exports={default:n(467),__esModule:!0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.imgToPixelArray=e.flipImage=e.isInstanceOfSupportedElement=e.imgToTensor=e.cropImage=e.processVideo=e.array3DToImage=void 0;var r=u(n(52)),i=u(n(17)),o=u(n(72)),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),s=u(n(108));function u(t){return t&&t.__esModule?t:{default:t}}var c=function(t){var e=Math.min(t.shape[0],t.shape[1]),n=t.shape[0]/2-e/2,r=t.shape[1]/2-e/2;return t.slice([n,r,0],[e,e,3])};e.array3DToImage=function(t){var e=(0,o.default)(t.shape,2),n=e[0],r=e[1],i=t.dataSync(),a=document.createElement("canvas");a.width=r,a.height=n;for(var s=a.getContext("2d"),u=s.getImageData(0,0,a.width,a.height),c=0;c<r*n;c+=1){var l=4*c,f=3*c;u.data[l+0]=Math.floor(256*i[f+0]),u.data[l+1]=Math.floor(256*i[f+1]),u.data[l+2]=Math.floor(256*i[f+2]),u.data[l+3]=255}s.putImageData(u,0,0);var d=a.toDataURL(),h=document.createElement("img");return h.src=d,h.style.width=r,h.style.height=n,t.dispose(),h},e.processVideo=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=t,i=document.createElement("video");return r.onplay=function(){var t=r.captureStream();i.srcObject=t,i.width=e,i.height=e,i.autoplay=!0,i.playsinline=!0,i.muted=!0,n()},i},e.cropImage=c,e.imgToTensor=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return a.tidy(function(){var n=a.browser.fromPixels(t);return e&&(n=a.image.resizeBilinear(n,e)),c(n).expandDims(0).toFloat().div(a.scalar(127)).sub(a.scalar(1))})},e.isInstanceOfSupportedElement=function(t){return t instanceof HTMLVideoElement||t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData},e.flipImage=function(t){var e,n,r;if(r=t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData?t:"object"===(void 0===t?"undefined":(0,i.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof HTMLVideoElement||t.elt instanceof ImageData)?t.elt:"object"===(void 0===t?"undefined":(0,i.default)(t))&&t.canvas instanceof HTMLCanvasElement?t.canvas:t,HTMLVideoElement,e=r.width,n=r.height,s.default.checkP5()){var o=s.default.p5Instance.createGraphics(e,n);return o.push(),o.translate(e,0),o.scale(-1,1),o.image(t,0,0,e,n),o.pop(),o}var a=document.createElement("canvas");a.width=e,a.height=n;var u=a.getContext("2d");return u.drawImage(r,0,0,e,n),u.translate(e,0),u.scale(-1,1),u.drawImage(a,-1*e,0,e,n),a},e.imgToPixelArray=function(t){var e,n,o;o=t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData?t:"object"===(void 0===t?"undefined":(0,i.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof HTMLVideoElement||t.elt instanceof ImageData)?t.elt:"object"===(void 0===t?"undefined":(0,i.default)(t))&&t.canvas instanceof HTMLCanvasElement?t.canvas:t,HTMLVideoElement,e=o.width,n=o.height;var a=document.createElement("canvas");a.width=e,a.height=n;var s=a.getContext("2d");s.drawImage(o,0,0,e,n);var u=s.getImageData(0,0,e,n);return(0,r.default)(u.data)}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var r=n(127);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(372),i=n(3),o=n(167)("metadata"),a=o.store||(o.store=new(n(369))),s=function(t,e,n){var i=a.get(t);if(!i){if(!n)return;a.set(t,i=new r)}var o=i.get(e);if(!o){if(!n)return;i.set(e,o=new r)}return o};t.exports={store:a,map:s,has:function(t,e,n){var r=s(e,n,!1);return void 0!==r&&r.has(t)},get:function(t,e,n){var r=s(e,n,!1);return void 0===r?void 0:r.get(t)},set:function(t,e,n,r){s(n,r,!0).set(t,e)},keys:function(t,e){var n=s(t,e,!1),r=[];return n&&n.forEach(function(t,e){r.push(e)}),r},key:function(t){return void 0===t||"symbol"==typeof t?t:String(t)},exp:function(t){i(i.S,"Reflect",t)}}},function(t,e,n){"use strict";if(n(22)){var r=n(70),i=n(8),o=n(13),a=n(3),s=n(156),u=n(227),c=n(50),l=n(81),f=n(88),d=n(35),h=n(79),p=n(48),m=n(16),g=n(367),v=n(85),b=n(60),y=n(42),w=n(105),x=n(14),_=n(25),k=n(238),S=n(84),E=n(39),O=n(83).f,A=n(236),C=n(87),M=n(15),N=n(57),T=n(166),I=n(128),D=n(233),j=n(103),R=n(161),F=n(82),P=n(234),z=n(378),L=n(21),B=n(40),U=L.f,W=B.f,q=i.RangeError,V=i.TypeError,H=i.Uint8Array,$=Array.prototype,G=u.ArrayBuffer,K=u.DataView,X=N(0),Y=N(2),J=N(3),Z=N(4),Q=N(5),tt=N(6),et=T(!0),nt=T(!1),rt=D.values,it=D.keys,ot=D.entries,at=$.lastIndexOf,st=$.reduce,ut=$.reduceRight,ct=$.join,lt=$.sort,ft=$.slice,dt=$.toString,ht=$.toLocaleString,pt=M("iterator"),mt=M("toStringTag"),gt=C("typed_constructor"),vt=C("def_constructor"),bt=s.CONSTR,yt=s.TYPED,wt=s.VIEW,xt=N(1,function(t,e){return Ot(I(t,t[vt]),e)}),_t=o(function(){return 1===new H(new Uint16Array([1]).buffer)[0]}),kt=!!H&&!!H.prototype.set&&o(function(){new H(1).set({})}),St=function(t,e){var n=p(t);if(n<0||n%e)throw q("Wrong offset!");return n},Et=function(t){if(x(t)&&yt in t)return t;throw V(t+" is not a typed array!")},Ot=function(t,e){if(!(x(t)&> in t))throw V("It is not a typed array constructor!");return new t(e)},At=function(t,e){return Ct(I(t,t[vt]),e)},Ct=function(t,e){for(var n=0,r=e.length,i=Ot(t,r);r>n;)i[n]=e[n++];return i},Mt=function(t,e,n){U(t,e,{get:function(){return this._d[n]}})},Nt=function(t){var e,n,r,i,o,a,s=_(t),u=arguments.length,l=u>1?arguments[1]:void 0,f=void 0!==l,d=A(s);if(void 0!=d&&!k(d)){for(a=d.call(s),r=[],e=0;!(o=a.next()).done;e++)r.push(o.value);s=r}for(f&&u>2&&(l=c(l,arguments[2],2)),e=0,n=m(s.length),i=Ot(this,n);n>e;e++)i[e]=f?l(s[e],e):s[e];return i},Tt=function(){for(var t=0,e=arguments.length,n=Ot(this,e);e>t;)n[t]=arguments[t++];return n},It=!!H&&o(function(){ht.call(new H(1))}),Dt=function(){return ht.apply(It?ft.call(Et(this)):Et(this),arguments)},jt={copyWithin:function(t,e){return z.call(Et(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return Z(Et(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return P.apply(Et(this),arguments)},filter:function(t){return At(this,Y(Et(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Q(Et(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(Et(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){X(Et(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return nt(Et(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return et(Et(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ct.apply(Et(this),arguments)},lastIndexOf:function(t){return at.apply(Et(this),arguments)},map:function(t){return xt(Et(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return st.apply(Et(this),arguments)},reduceRight:function(t){return ut.apply(Et(this),arguments)},reverse:function(){for(var t,e=Et(this).length,n=Math.floor(e/2),r=0;r<n;)t=this[r],this[r++]=this[--e],this[e]=t;return this},some:function(t){return J(Et(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return lt.call(Et(this),t)},subarray:function(t,e){var n=Et(this),r=n.length,i=v(t,r);return new(I(n,n[vt]))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,m((void 0===e?r:v(e,r))-i))}},Rt=function(t,e){return At(this,ft.call(Et(this),t,e))},Ft=function(t){Et(this);var e=St(arguments[1],1),n=this.length,r=_(t),i=m(r.length),o=0;if(i+e>n)throw q("Wrong length!");for(;o<i;)this[e+o]=r[o++]},Pt={entries:function(){return ot.call(Et(this))},keys:function(){return it.call(Et(this))},values:function(){return rt.call(Et(this))}},zt=function(t,e){return x(t)&&t[yt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Lt=function(t,e){return zt(t,e=b(e,!0))?f(2,t[e]):W(t,e)},Bt=function(t,e,n){return!(zt(t,e=b(e,!0))&&x(n)&&y(n,"value"))||y(n,"get")||y(n,"set")||n.configurable||y(n,"writable")&&!n.writable||y(n,"enumerable")&&!n.enumerable?U(t,e,n):(t[e]=n.value,t)};bt||(B.f=Lt,L.f=Bt),a(a.S+a.F*!bt,"Object",{getOwnPropertyDescriptor:Lt,defineProperty:Bt}),o(function(){dt.call({})})&&(dt=ht=function(){return ct.call(this)});var Ut=h({},jt);h(Ut,Pt),d(Ut,pt,Pt.values),h(Ut,{slice:Rt,set:Ft,constructor:function(){},toString:dt,toLocaleString:Dt}),Mt(Ut,"buffer","b"),Mt(Ut,"byteOffset","o"),Mt(Ut,"byteLength","l"),Mt(Ut,"length","e"),U(Ut,mt,{get:function(){return this[yt]}}),t.exports=function(t,e,n,u){var c=t+((u=!!u)?"Clamped":"")+"Array",f="get"+t,h="set"+t,p=i[c],v=p||{},b=p&&E(p),y=!p||!s.ABV,_={},k=p&&p.prototype,A=function(t,n){U(t,n,{get:function(){return function(t,n){var r=t._d;return r.v[f](n*e+r.o,_t)}(this,n)},set:function(t){return function(t,n,r){var i=t._d;u&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),i.v[h](n*e+i.o,r,_t)}(this,n,t)},enumerable:!0})};y?(p=n(function(t,n,r,i){l(t,p,c,"_d");var o,a,s,u,f=0,h=0;if(x(n)){if(!(n instanceof G||"ArrayBuffer"==(u=w(n))||"SharedArrayBuffer"==u))return yt in n?Ct(p,n):Nt.call(p,n);o=n,h=St(r,e);var v=n.byteLength;if(void 0===i){if(v%e)throw q("Wrong length!");if((a=v-h)<0)throw q("Wrong length!")}else if((a=m(i)*e)+h>v)throw q("Wrong length!");s=a/e}else s=g(n),o=new G(a=s*e);for(d(t,"_d",{b:o,o:h,l:a,e:s,v:new K(o)});f<s;)A(t,f++)}),k=p.prototype=S(Ut),d(k,"constructor",p)):o(function(){p(1)})&&o(function(){new p(-1)})&&R(function(t){new p,new p(null),new p(1.5),new p(t)},!0)||(p=n(function(t,n,r,i){var o;return l(t,p,c),x(n)?n instanceof G||"ArrayBuffer"==(o=w(n))||"SharedArrayBuffer"==o?void 0!==i?new v(n,St(r,e),i):void 0!==r?new v(n,St(r,e)):new v(n):yt in n?Ct(p,n):Nt.call(p,n):new v(g(n))}),X(b!==Function.prototype?O(v).concat(O(b)):O(v),function(t){t in p||d(p,t,v[t])}),p.prototype=k,r||(k.constructor=p));var C=k[pt],M=!!C&&("values"==C.name||void 0==C.name),N=Pt.values;d(p,gt,!0),d(k,yt,c),d(k,wt,!0),d(k,vt,p),(u?new p(1)[mt]==c:mt in k)||U(k,mt,{get:function(){return c}}),_[c]=p,a(a.G+a.W+a.F*(p!=v),_),a(a.S,c,{BYTES_PER_ELEMENT:e}),a(a.S+a.F*o(function(){v.of.call(p,1)}),c,{from:Nt,of:Tt}),"BYTES_PER_ELEMENT"in k||d(k,"BYTES_PER_ELEMENT",e),a(a.P,c,jt),F(c),a(a.P+a.F*kt,c,{set:Ft}),a(a.P+a.F*!M,c,Pt),r||k.toString==dt||(k.toString=dt),a(a.P+a.F*o(function(){new p(1).slice()}),c,{slice:Rt}),a(a.P+a.F*(o(function(){return[1,2].toLocaleString()!=new p([1,2]).toLocaleString()})||!o(function(){k.toLocaleString.call([1,2])})),c,{toLocaleString:Dt}),j[c]=M?C:N,r||M||d(k,pt,N)}}else t.exports=function(){}},function(t,e,n){var r=n(7).Buffer,i=n(216).Transform,o=n(213).StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(6)(a,i),a.prototype.update=function(t,e,n){"string"==typeof t&&(t=r.from(t,e));var i=this._update(t);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,n){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{n(r)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||r.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var r=this._decoder.write(t);return n&&(r+=this._decoder.end()),r},t.exports=a},function(t,e,n){var r=n(46),i=n(126);t.exports=n(55)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(15)("unscopables"),i=Array.prototype;void 0==i[r]&&n(35)(i,r,{}),t.exports=function(t){i[r][t]=!0}},function(t,e){t.exports=!1},function(t,e,n){var r=n(87)("meta"),i=n(14),o=n(42),a=n(21).f,s=0,u=Object.isExtensible||function(){return!0},c=!n(13)(function(){return u(Object.preventExtensions({}))}),l=function(t){a(t,r,{value:{i:"O"+ ++s,w:{}}})},f=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[r].w},onFreeze:function(t){return c&&f.NEED&&u(t)&&!o(t,r)&&l(t),t}}},function(t,e,n){"use strict";e.__esModule=!0;var r=o(n(479)),i=o(n(476));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if(Array.isArray(t))return t;if((0,r.default)(Object(t)))return function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var s,u=(0,i.default)(t);!(r=(s=u.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw a}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){var r=n(627),i=n(622);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},function(t,e,n){"use strict";var r=n(149),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=f;var o=n(121);o.inherits=n(6);var a=n(353),s=n(214);o.inherits(f,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var l=u[c];f.prototype[l]||(f.prototype[l]=s.prototype[l])}function f(t){if(!(this instanceof f))return new f(t);a.call(this,t),s.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",d)}function d(){this.allowHalfOpen||this._writableState.ended||r.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),f.prototype._destroy=function(t,e){this.push(null),this.end(),r.nextTick(e,t)}},function(t,e,n){var r=n(224),i=n(223);t.exports=function(t){return r(i(t))}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(34);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},function(t,e,n){var r=n(50),i=n(380),o=n(238),a=n(5),s=n(16),u=n(236),c={},l={};(e=t.exports=function(t,e,n,f,d){var h,p,m,g,v=d?function(){return t}:u(t),b=r(n,f,e?2:1),y=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(o(v)){for(h=s(t.length);h>y;y++)if((g=e?b(a(p=t[y])[0],p[1]):b(t[y]))===c||g===l)return g}else for(m=v.call(t);!(p=m.next()).done;)if((g=i(m,b,p.value,e))===c||g===l)return g}).BREAK=c,e.RETURN=l},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){"use strict";var r=n(8),i=n(21),o=n(22),a=n(15)("species");t.exports=function(t){var e=r[t];o&&e&&!e[a]&&i.f(e,a,{configurable:!0,get:function(){return this}})}},function(t,e,n){var r=n(393),i=n(250).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){var r=n(5),i=n(392),o=n(250),a=n(251)("IE_PROTO"),s=function(){},u=function(){var t,e=n(253)("iframe"),r=o.length;for(e.style.display="none",n(249).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;r--;)delete u.prototype[o[r]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=u(),void 0===e?n:i(n,e)}},function(t,e,n){var r=n(48),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,n){var r=n(393),i=n(250);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";n.r(e);var r="http://www.w3.org/1999/xhtml",i={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},o=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),i.hasOwnProperty(e)?{space:i[e],local:t}:t},a=function(t){var e=o(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===r&&e.documentElement.namespaceURI===r?e.createElement(t):e.createElementNS(n,t)}})(e)};function s(){}var u=function(t){return null==t?s:function(){return this.querySelector(t)}};function c(){return[]}var l=function(t){return null==t?c:function(){return this.querySelectorAll(t)}},f=function(t){return function(){return this.matches(t)}},d=function(t){return new Array(t.length)};function h(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}h.prototype={constructor:h,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var p="$";function m(t,e,n,r,i,o){for(var a,s=0,u=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new h(t,o[s]);for(;s<u;++s)(a=e[s])&&(i[s]=a)}function g(t,e,n,r,i,o,a){var s,u,c,l={},f=e.length,d=o.length,m=new Array(f);for(s=0;s<f;++s)(u=e[s])&&(m[s]=c=p+a.call(u,u.__data__,s,e),c in l?i[s]=u:l[c]=u);for(s=0;s<d;++s)(u=l[c=p+a.call(t,o[s],s,o)])?(r[s]=u,u.__data__=o[s],l[c]=null):n[s]=new h(t,o[s]);for(s=0;s<f;++s)(u=e[s])&&l[m[s]]===u&&(i[s]=u)}function v(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var b=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function y(t,e){return t.style.getPropertyValue(e)||b(t).getComputedStyle(t,null).getPropertyValue(e)}function w(t){return t.trim().split(/^|\s+/)}function x(t){return t.classList||new _(t)}function _(t){this._node=t,this._names=w(t.getAttribute("class")||"")}function k(t,e){for(var n=x(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function S(t,e){for(var n=x(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function E(){this.textContent=""}function O(){this.innerHTML=""}function A(){this.nextSibling&&this.parentNode.appendChild(this)}function C(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function M(){return null}function N(){var t=this.parentNode;t&&t.removeChild(this)}function T(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function I(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}_.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var D={},j=null;function R(t,e,n){return t=F(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function F(t,e,n){return function(r){var i=j;j=r;try{t.call(this,this.__data__,e,n)}finally{j=i}}}function P(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.capture);++i?e.length=i:delete this.__on}}}function z(t,e,n){var r=D.hasOwnProperty(t.type)?R:F;return function(i,o,a){var s,u=this.__on,c=r(e,o,a);if(u)for(var l=0,f=u.length;l<f;++l)if((s=u[l]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=c,s.capture=n),void(s.value=e);this.addEventListener(t.type,c,n),s={type:t.type,name:t.name,value:e,listener:c,capture:n},u?u.push(s):this.__on=[s]}}function L(t,e,n,r){var i=j;t.sourceEvent=j,j=t;try{return e.apply(n,r)}finally{j=i}}function B(t,e,n){var r=b(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(D={mouseenter:"mouseover",mouseleave:"mouseout"}));var U=[null];function W(t,e){this._groups=t,this._parents=e}function q(){return new W([[document.documentElement]],U)}W.prototype=q.prototype={constructor:W,select:function(t){"function"!=typeof t&&(t=u(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],c=s.length,l=r[i]=new Array(c),f=0;f<c;++f)(o=s[f])&&(a=t.call(o,o.__data__,f,s))&&("__data__"in o&&(a.__data__=o.__data__),l[f]=a);return new W(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],u=s.length,c=0;c<u;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new W(r,i)},filter:function(t){"function"!=typeof t&&(t=f(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,u=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&u.push(o);return new W(r,this._parents)},data:function(t,e){if(!t)return h=new Array(this.size()),c=-1,this.each(function(t){h[++c]=t}),h;var n=e?g:m,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),s=new Array(o),u=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],d=f.length,h=t.call(l,l&&l.__data__,c,r),p=h.length,v=s[c]=new Array(p),b=a[c]=new Array(p);n(l,f,v,b,u[c]=new Array(d),h,e);for(var y,w,x=0,_=0;x<p;++x)if(y=v[x]){for(x>=_&&(_=x+1);!(w=b[_])&&++_<p;);y._next=w||null}}return(a=new W(a,r))._enter=s,a._exit=u,a},enter:function(){return new W(this._enter||this._groups.map(d),this._parents)},exit:function(){return new W(this._exit||this._groups.map(d),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(i=e(i)),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,c=e[s],l=n[s],f=c.length,d=a[s]=new Array(f),h=0;h<f;++h)(u=c[h]||l[h])&&(d[h]=u);for(;s<r;++s)a[s]=e[s];return new W(a,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=v);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],u=s.length,c=i[o]=new Array(u),l=0;l<u;++l)(a=s[l])&&(c[l]=a);c.sort(e)}return new W(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()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],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 e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=o(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):y(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=w(t+"");if(arguments.length<2){for(var r=x(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?k:S)(this,t)}}:e?function(t){return function(){k(this,t)}}:function(t){return function(){S(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?E:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?O:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(A)},lower:function(){return this.each(C)},append:function(t){var e="function"==typeof t?t:a(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:a(t),r=null==e?M:"function"==typeof e?e:u(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(N)},clone:function(t){return this.select(t?I:T)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?z:P,null==n&&(n=!1),r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(r=0,u=s[c];r<a;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return B(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return B(this,t,e)}})(t,e))}};var V=q,H=function(t){return"string"==typeof t?new W([[document.querySelector(t)]],[document.documentElement]):new W([[t]],U)},$=function(t){return H(a(t).call(document.documentElement))},G=0;function K(){return new X}function X(){this._="@"+(++G).toString(36)}X.prototype=K.prototype={constructor:X,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Y=function(){for(var t,e=j;t=e.sourceEvent;)e=t;return e},J=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]},Z=function(t){var e=Y();return e.changedTouches&&(e=e.changedTouches[0]),J(t,e)},Q=function(t){return"string"==typeof t?new W([document.querySelectorAll(t)],[document.documentElement]):new W([null==t?[]:t],U)},tt=function(t,e,n){arguments.length<3&&(n=e,e=Y().changedTouches);for(var r,i=0,o=e?e.length:0;i<o;++i)if((r=e[i]).identifier===n)return J(t,r);return null},et=function(t,e){null==e&&(e=Y().touches);for(var n=0,r=e?e.length:0,i=new Array(r);n<r;++n)i[n]=J(t,e[n]);return i};n.d(e,"create",function(){return $}),n.d(e,"creator",function(){return a}),n.d(e,"local",function(){return K}),n.d(e,"matcher",function(){return f}),n.d(e,"mouse",function(){return Z}),n.d(e,"namespace",function(){return o}),n.d(e,"namespaces",function(){return i}),n.d(e,"clientPoint",function(){return J}),n.d(e,"select",function(){return H}),n.d(e,"selectAll",function(){return Q}),n.d(e,"selection",function(){return V}),n.d(e,"selector",function(){return u}),n.d(e,"selectorAll",function(){return l}),n.d(e,"style",function(){return y}),n.d(e,"touch",function(){return tt}),n.d(e,"touches",function(){return et}),n.d(e,"window",function(){return b}),n.d(e,"event",function(){return j}),n.d(e,"customEvent",function(){return L})},function(t,e,n){"use strict";n.r(e);var r={};n.d(r,"aggregate",function(){return Ai}),n.d(r,"bin",function(){return Mi}),n.d(r,"collect",function(){return Ii}),n.d(r,"compare",function(){return Di}),n.d(r,"countpattern",function(){return Ri}),n.d(r,"cross",function(){return Pi}),n.d(r,"density",function(){return Wi}),n.d(r,"expression",function(){return Hi}),n.d(r,"extent",function(){return Gi}),n.d(r,"facet",function(){return Yi}),n.d(r,"field",function(){return Zi}),n.d(r,"filter",function(){return to}),n.d(r,"flatten",function(){return no}),n.d(r,"fold",function(){return ro}),n.d(r,"formula",function(){return io}),n.d(r,"generate",function(){return oo}),n.d(r,"impute",function(){return uo}),n.d(r,"joinaggregate",function(){return co}),n.d(r,"key",function(){return fo}),n.d(r,"load",function(){return po}),n.d(r,"lookup",function(){return mo}),n.d(r,"multiextent",function(){return go}),n.d(r,"multivalues",function(){return bo}),n.d(r,"params",function(){return wo}),n.d(r,"pivot",function(){return xo}),n.d(r,"prefacet",function(){return ko}),n.d(r,"project",function(){return So}),n.d(r,"proxy",function(){return Eo}),n.d(r,"relay",function(){return Oo}),n.d(r,"sample",function(){return Ao}),n.d(r,"sequence",function(){return Co}),n.d(r,"sieve",function(){return Mo}),n.d(r,"subflow",function(){return Ki}),n.d(r,"tupleindex",function(){return No}),n.d(r,"values",function(){return To}),n.d(r,"window",function(){return Po});var i={};n.d(i,"bound",function(){return Bl}),n.d(i,"identifier",function(){return ql}),n.d(i,"mark",function(){return Vl}),n.d(i,"overlap",function(){return Hl}),n.d(i,"render",function(){return Zl}),n.d(i,"viewlayout",function(){return ff});var o={};n.d(o,"interpolate",function(){return Dh}),n.d(o,"interpolateArray",function(){return Oh}),n.d(o,"interpolateBasis",function(){return dh}),n.d(o,"interpolateBasisClosed",function(){return hh}),n.d(o,"interpolateDate",function(){return Ah}),n.d(o,"interpolateDiscrete",function(){return jh}),n.d(o,"interpolateHue",function(){return Rh}),n.d(o,"interpolateNumber",function(){return Ch}),n.d(o,"interpolateObject",function(){return Mh}),n.d(o,"interpolateRound",function(){return Fh}),n.d(o,"interpolateString",function(){return Ih}),n.d(o,"interpolateTransformCss",function(){return Uh}),n.d(o,"interpolateTransformSvg",function(){return Wh}),n.d(o,"interpolateZoom",function(){return Hh}),n.d(o,"interpolateRgb",function(){return bh}),n.d(o,"interpolateRgbBasis",function(){return Sh}),n.d(o,"interpolateRgbBasisClosed",function(){return Eh}),n.d(o,"interpolateHsl",function(){return Gh}),n.d(o,"interpolateHslLong",function(){return Kh}),n.d(o,"interpolateLab",function(){return Xh}),n.d(o,"interpolateHcl",function(){return Jh}),n.d(o,"interpolateHclLong",function(){return Zh}),n.d(o,"interpolateCubehelix",function(){return tp}),n.d(o,"interpolateCubehelixLong",function(){return ep}),n.d(o,"piecewise",function(){return np}),n.d(o,"quantize",function(){return rp});var a={};n.d(a,"schemeCategory10",function(){return om}),n.d(a,"schemeAccent",function(){return am}),n.d(a,"schemeDark2",function(){return sm}),n.d(a,"schemePaired",function(){return um}),n.d(a,"schemePastel1",function(){return cm}),n.d(a,"schemePastel2",function(){return lm}),n.d(a,"schemeSet1",function(){return fm}),n.d(a,"schemeSet2",function(){return dm}),n.d(a,"schemeSet3",function(){return hm}),n.d(a,"schemeTableau10",function(){return Am}),n.d(a,"interpolateBrBG",function(){return Nm}),n.d(a,"schemeBrBG",function(){return Mm}),n.d(a,"interpolatePRGn",function(){return Im}),n.d(a,"schemePRGn",function(){return Tm}),n.d(a,"interpolatePiYG",function(){return jm}),n.d(a,"schemePiYG",function(){return Dm}),n.d(a,"interpolatePuOr",function(){return Fm}),n.d(a,"schemePuOr",function(){return Rm}),n.d(a,"interpolateRdBu",function(){return zm}),n.d(a,"schemeRdBu",function(){return Pm}),n.d(a,"interpolateRdGy",function(){return Bm}),n.d(a,"schemeRdGy",function(){return Lm}),n.d(a,"interpolateRdYlBu",function(){return Wm}),n.d(a,"schemeRdYlBu",function(){return Um}),n.d(a,"interpolateRdYlGn",function(){return Vm}),n.d(a,"schemeRdYlGn",function(){return qm}),n.d(a,"interpolateSpectral",function(){return $m}),n.d(a,"schemeSpectral",function(){return Hm}),n.d(a,"interpolateBuGn",function(){return Km}),n.d(a,"schemeBuGn",function(){return Gm}),n.d(a,"interpolateBuPu",function(){return Ym}),n.d(a,"schemeBuPu",function(){return Xm}),n.d(a,"interpolateGnBu",function(){return Zm}),n.d(a,"schemeGnBu",function(){return Jm}),n.d(a,"interpolateOrRd",function(){return tg}),n.d(a,"schemeOrRd",function(){return Qm}),n.d(a,"interpolatePuBuGn",function(){return ng}),n.d(a,"schemePuBuGn",function(){return eg}),n.d(a,"interpolatePuBu",function(){return ig}),n.d(a,"schemePuBu",function(){return rg}),n.d(a,"interpolatePuRd",function(){return ag}),n.d(a,"schemePuRd",function(){return og}),n.d(a,"interpolateRdPu",function(){return ug}),n.d(a,"schemeRdPu",function(){return sg}),n.d(a,"interpolateYlGnBu",function(){return lg}),n.d(a,"schemeYlGnBu",function(){return cg}),n.d(a,"interpolateYlGn",function(){return dg}),n.d(a,"schemeYlGn",function(){return fg}),n.d(a,"interpolateYlOrBr",function(){return pg}),n.d(a,"schemeYlOrBr",function(){return hg}),n.d(a,"interpolateYlOrRd",function(){return gg}),n.d(a,"schemeYlOrRd",function(){return mg}),n.d(a,"interpolateBlues",function(){return bg}),n.d(a,"schemeBlues",function(){return vg}),n.d(a,"interpolateGreens",function(){return wg}),n.d(a,"schemeGreens",function(){return yg}),n.d(a,"interpolateGreys",function(){return _g}),n.d(a,"schemeGreys",function(){return xg}),n.d(a,"interpolatePurples",function(){return Sg}),n.d(a,"schemePurples",function(){return kg}),n.d(a,"interpolateReds",function(){return Og}),n.d(a,"schemeReds",function(){return Eg}),n.d(a,"interpolateOranges",function(){return Cg}),n.d(a,"schemeOranges",function(){return Ag}),n.d(a,"interpolateCividis",function(){return Mg}),n.d(a,"interpolateCubehelixDefault",function(){return Ng}),n.d(a,"interpolateRainbow",function(){return _m}),n.d(a,"interpolateWarm",function(){return ym}),n.d(a,"interpolateCool",function(){return wm}),n.d(a,"interpolateSinebow",function(){return Om}),n.d(a,"interpolateTurbo",function(){return Tg}),n.d(a,"interpolateViridis",function(){return mm}),n.d(a,"interpolateMagma",function(){return gm}),n.d(a,"interpolateInferno",function(){return vm}),n.d(a,"interpolatePlasma",function(){return bm});var s={};n.d(s,"axisticks",function(){return Hg}),n.d(s,"datajoin",function(){return $g}),n.d(s,"encode",function(){return Xg}),n.d(s,"legendentries",function(){return tv}),n.d(s,"linkpath",function(){return av}),n.d(s,"pie",function(){return lv}),n.d(s,"scale",function(){return pv}),n.d(s,"sortitems",function(){return bv}),n.d(s,"stack",function(){return wv}),n.d(s,"validTicks",function(){return Wg});var u={};n.d(u,"contour",function(){return Zv}),n.d(u,"geojson",function(){return tb}),n.d(u,"geopath",function(){return b_}),n.d(u,"geopoint",function(){return y_}),n.d(u,"geoshape",function(){return w_}),n.d(u,"graticule",function(){return x_}),n.d(u,"projection",function(){return __});var c={};n.d(c,"force",function(){return vk});var l={};n.d(l,"nest",function(){return bS}),n.d(l,"pack",function(){return kS}),n.d(l,"partition",function(){return OS}),n.d(l,"stratify",function(){return CS}),n.d(l,"tree",function(){return TS}),n.d(l,"treelinks",function(){return DS}),n.d(l,"treemap",function(){return FS});var f={};n.d(f,"voronoi",function(){return xE});var d={};n.d(d,"wordcloud",function(){return FE});var h={};n.d(h,"crossfilter",function(){return WE}),n.d(h,"resolvefilter",function(){return VE});var p={};n.d(p,"version",function(){return HE.a}),n.d(p,"accessor",function(){return H.f}),n.d(p,"accessorName",function(){return H.h}),n.d(p,"accessorFields",function(){return H.g}),n.d(p,"id",function(){return H.w}),n.d(p,"identity",function(){return H.x}),n.d(p,"zero",function(){return H.Ha}),n.d(p,"one",function(){return H.M}),n.d(p,"truthy",function(){return H.Ea}),n.d(p,"falsy",function(){return H.r}),n.d(p,"logger",function(){return H.K}),n.d(p,"None",function(){return H.d}),n.d(p,"Error",function(){return H.b}),n.d(p,"Warn",function(){return H.e}),n.d(p,"Info",function(){return H.c}),n.d(p,"Debug",function(){return H.a}),n.d(p,"panLinear",function(){return H.O}),n.d(p,"panLog",function(){return H.P}),n.d(p,"panPow",function(){return H.Q}),n.d(p,"panSymlog",function(){return H.R}),n.d(p,"zoomLinear",function(){return H.Ia}),n.d(p,"zoomLog",function(){return H.Ja}),n.d(p,"zoomPow",function(){return H.Ka}),n.d(p,"zoomSymlog",function(){return H.La}),n.d(p,"quarter",function(){return H.T}),n.d(p,"utcquarter",function(){return H.Fa}),n.d(p,"array",function(){return H.i}),n.d(p,"clampRange",function(){return H.j}),n.d(p,"compare",function(){return H.k}),n.d(p,"constant",function(){return H.l}),n.d(p,"debounce",function(){return H.m}),n.d(p,"error",function(){return H.n}),n.d(p,"extend",function(){return H.o}),n.d(p,"extent",function(){return H.p}),n.d(p,"extentIndex",function(){return H.q}),n.d(p,"fastmap",function(){return H.s}),n.d(p,"field",function(){return H.t}),n.d(p,"flush",function(){return H.u}),n.d(p,"hasOwnProperty",function(){return H.v}),n.d(p,"inherits",function(){return H.y}),n.d(p,"inrange",function(){return H.z}),n.d(p,"isArray",function(){return H.A}),n.d(p,"isBoolean",function(){return H.B}),n.d(p,"isDate",function(){return H.C}),n.d(p,"isFunction",function(){return H.D}),n.d(p,"isNumber",function(){return H.E}),n.d(p,"isObject",function(){return H.F}),n.d(p,"isRegExp",function(){return H.G}),n.d(p,"isString",function(){return H.H}),n.d(p,"key",function(){return H.I}),n.d(p,"lerp",function(){return H.J}),n.d(p,"merge",function(){return H.L}),n.d(p,"pad",function(){return H.N}),n.d(p,"peek",function(){return H.S}),n.d(p,"repeat",function(){return H.U}),n.d(p,"span",function(){return H.V}),n.d(p,"splitAccessPath",function(){return H.W}),n.d(p,"stringValue",function(){return H.X}),n.d(p,"toBoolean",function(){return H.Y}),n.d(p,"toDate",function(){return H.Z}),n.d(p,"toNumber",function(){return H.Aa}),n.d(p,"toString",function(){return H.Ca}),n.d(p,"toSet",function(){return H.Ba}),n.d(p,"truncate",function(){return H.Da}),n.d(p,"visitArray",function(){return H.Ga}),n.d(p,"Dataflow",function(){return Cr}),n.d(p,"EventStream",function(){return ht}),n.d(p,"Parameters",function(){return ot}),n.d(p,"Pulse",function(){return mr}),n.d(p,"MultiPulse",function(){return wr}),n.d(p,"Operator",function(){return ct}),n.d(p,"Transform",function(){return Tr}),n.d(p,"changeset",function(){return rt}),n.d(p,"ingest",function(){return Z}),n.d(p,"isTuple",function(){return X}),n.d(p,"definition",function(){return jr}),n.d(p,"transform",function(){return Rr}),n.d(p,"transforms",function(){return Dr}),n.d(p,"tupleid",function(){return Y}),n.d(p,"scale",function(){return Vp}),n.d(p,"scheme",function(){return Rg}),n.d(p,"schemeDiscretized",function(){return Fg}),n.d(p,"interpolate",function(){return Yp}),n.d(p,"interpolateRange",function(){return Gp}),n.d(p,"timeInterval",function(){return Lg}),n.d(p,"utcInterval",function(){return Bg}),n.d(p,"projection",function(){return p_}),n.d(p,"View",function(){return SI}),n.d(p,"parse",function(){return QT}),n.d(p,"expressionFunction",function(){return QC}),n.d(p,"formatLocale",function(){return mp.formatDefaultLocale}),n.d(p,"timeFormatLocale",function(){return fr}),n.d(p,"runtime",function(){return sI}),n.d(p,"runtimeContext",function(){return cI}),n.d(p,"bin",function(){return Vr}),n.d(p,"bootstrapCI",function(){return Zr}),n.d(p,"quartiles",function(){return Qr}),n.d(p,"random",function(){return $r}),n.d(p,"setRandom",function(){return Gr}),n.d(p,"randomLCG",function(){return ti}),n.d(p,"randomInteger",function(){return ei}),n.d(p,"randomKDE",function(){return ri}),n.d(p,"randomMixture",function(){return ii}),n.d(p,"randomNormal",function(){return ni}),n.d(p,"randomUniform",function(){return oi}),n.d(p,"regressionLinear",function(){return li}),n.d(p,"regressionLog",function(){return fi}),n.d(p,"regressionExp",function(){return di}),n.d(p,"regressionPow",function(){return hi}),n.d(p,"regressionQuad",function(){return pi}),n.d(p,"regressionPoly",function(){return mi}),n.d(p,"regressionLoess",function(){return yi}),n.d(p,"sampleCurve",function(){return ki}),n.d(p,"loader",function(){return bt}),n.d(p,"read",function(){return dr}),n.d(p,"inferType",function(){return Ct}),n.d(p,"inferTypes",function(){return Mt}),n.d(p,"typeParsers",function(){return Et}),n.d(p,"format",function(){return Qt}),n.d(p,"formats",function(){return te}),n.d(p,"Bounds",function(){return fa}),n.d(p,"Gradient",function(){return pa}),n.d(p,"GroupItem",function(){return ga}),n.d(p,"ResourceLoader",function(){return ba}),n.d(p,"Item",function(){return ma}),n.d(p,"Scenegraph",function(){return jc}),n.d(p,"Handler",function(){return qc}),n.d(p,"Renderer",function(){return $c}),n.d(p,"CanvasHandler",function(){return Xc}),n.d(p,"CanvasRenderer",function(){return tl}),n.d(p,"SVGHandler",function(){return il}),n.d(p,"SVGRenderer",function(){return hl}),n.d(p,"SVGStringRenderer",function(){return Ol}),n.d(p,"RenderType",function(){return Il}),n.d(p,"renderModule",function(){return jl}),n.d(p,"Marks",function(){return Ac}),n.d(p,"boundClip",function(){return Fl}),n.d(p,"boundContext",function(){return _u}),n.d(p,"boundStroke",function(){return bu}),n.d(p,"boundItem",function(){return Cc}),n.d(p,"boundMark",function(){return Nc}),n.d(p,"pathCurves",function(){return js}),n.d(p,"pathSymbols",function(){return Xs}),n.d(p,"pathRectangle",function(){return nu}),n.d(p,"pathTrail",function(){return iu}),n.d(p,"pathParse",function(){return Ps}),n.d(p,"pathRender",function(){return Vs}),n.d(p,"point",function(){return Wc}),n.d(p,"domCreate",function(){return Pc}),n.d(p,"domFind",function(){return zc}),n.d(p,"domChild",function(){return Lc}),n.d(p,"domClear",function(){return Bc}),n.d(p,"openTag",function(){return sl}),n.d(p,"closeTag",function(){return ul}),n.d(p,"font",function(){return _c}),n.d(p,"fontFamily",function(){return xc}),n.d(p,"fontSize",function(){return bc}),n.d(p,"textMetrics",function(){return hc}),n.d(p,"resetSVGClipId",function(){return $u}),n.d(p,"sceneEqual",function(){return zl}),n.d(p,"pathEqual",function(){return Ll}),n.d(p,"sceneToJSON",function(){return Ic}),n.d(p,"sceneFromJSON",function(){return Dc}),n.d(p,"sceneZOrder",function(){return Nu}),n.d(p,"sceneVisit",function(){return Tu}),n.d(p,"scenePickVisit",function(){return Iu});var m={};n.d(m,"deepEqual",function(){return BI}),n.d(m,"duplicate",function(){return UI}),n.d(m,"globalWholeWordRegExp",function(){return WI}),n.d(m,"pick",function(){return qI}),n.d(m,"omit",function(){return VI}),n.d(m,"stringify",function(){return HI}),n.d(m,"hash",function(){return $I}),n.d(m,"contains",function(){return GI}),n.d(m,"without",function(){return KI}),n.d(m,"union",function(){return XI}),n.d(m,"some",function(){return YI}),n.d(m,"every",function(){return JI}),n.d(m,"flatten",function(){return ZI}),n.d(m,"fill",function(){return QI}),n.d(m,"mergeDeep",function(){return tD}),n.d(m,"unique",function(){return nD}),n.d(m,"isEqual",function(){return rD}),n.d(m,"setEqual",function(){return iD}),n.d(m,"hasIntersection",function(){return oD}),n.d(m,"prefixGenerator",function(){return aD}),n.d(m,"fieldIntersection",function(){return sD}),n.d(m,"isNumeric",function(){return uD}),n.d(m,"differArray",function(){return cD}),n.d(m,"keys",function(){return lD}),n.d(m,"vals",function(){return fD}),n.d(m,"entries",function(){return dD}),n.d(m,"flagKeys",function(){return hD}),n.d(m,"isBoolean",function(){return pD}),n.d(m,"varName",function(){return mD}),n.d(m,"logicalExpr",function(){return gD}),n.d(m,"deleteNestedProperty",function(){return vD}),n.d(m,"titlecase",function(){return bD}),n.d(m,"accessPathWithDatum",function(){return yD}),n.d(m,"flatAccessWithDatum",function(){return wD}),n.d(m,"replacePathInField",function(){return xD}),n.d(m,"removePathFromField",function(){return _D}),n.d(m,"accessPathDepth",function(){return kD}),n.d(m,"getFirstDefined",function(){return SD}),n.d(m,"uniqueId",function(){return OD}),n.d(m,"resetIdCounter",function(){return AD});var g={};n.d(g,"AGGREGATE_OPS",function(){return MD}),n.d(g,"isAggregateOp",function(){return ND}),n.d(g,"COUNTING_OPS",function(){return TD}),n.d(g,"isCountingAggregateOp",function(){return ID}),n.d(g,"isMinMaxOp",function(){return DD}),n.d(g,"SUM_OPS",function(){return jD}),n.d(g,"SHARED_DOMAIN_OPS",function(){return RD}),n.d(g,"SHARED_DOMAIN_OP_INDEX",function(){return FD});var v={};n.d(v,"AXIS_PARTS",function(){return PD}),n.d(v,"AXIS_PROPERTY_TYPE",function(){return zD}),n.d(v,"isAxisProperty",function(){return UD}),n.d(v,"VG_AXIS_PROPERTIES",function(){return WD}),n.d(v,"AXIS_PROPERTIES",function(){return qD});var b={};n.d(b,"Channel",function(){return VD}),n.d(b,"X",function(){return HD}),n.d(b,"Y",function(){return $D}),n.d(b,"X2",function(){return GD}),n.d(b,"Y2",function(){return KD}),n.d(b,"XERROR",function(){return XD}),n.d(b,"YERROR",function(){return YD}),n.d(b,"XERROR2",function(){return JD}),n.d(b,"YERROR2",function(){return ZD}),n.d(b,"LATITUDE",function(){return QD}),n.d(b,"LATITUDE2",function(){return tj}),n.d(b,"LONGITUDE",function(){return ej}),n.d(b,"LONGITUDE2",function(){return nj}),n.d(b,"ROW",function(){return rj}),n.d(b,"COLUMN",function(){return ij}),n.d(b,"SHAPE",function(){return oj}),n.d(b,"SIZE",function(){return aj}),n.d(b,"COLOR",function(){return sj}),n.d(b,"FILL",function(){return uj}),n.d(b,"STROKE",function(){return cj}),n.d(b,"TEXT",function(){return lj}),n.d(b,"DETAIL",function(){return fj}),n.d(b,"KEY",function(){return dj}),n.d(b,"ORDER",function(){return hj}),n.d(b,"OPACITY",function(){return pj}),n.d(b,"FILLOPACITY",function(){return mj}),n.d(b,"STROKEOPACITY",function(){return gj}),n.d(b,"STROKEWIDTH",function(){return vj}),n.d(b,"TOOLTIP",function(){return bj}),n.d(b,"HREF",function(){return yj}),n.d(b,"GEOPOSITION_CHANNEL_INDEX",function(){return wj}),n.d(b,"GEOPOSITION_CHANNELS",function(){return xj}),n.d(b,"isColorChannel",function(){return kj}),n.d(b,"CHANNELS",function(){return Ej}),n.d(b,"SINGLE_DEF_CHANNELS",function(){return Cj}),n.d(b,"isChannel",function(){return Mj}),n.d(b,"isSecondaryRangeChannel",function(){return Nj}),n.d(b,"getMainRangeChannel",function(){return Tj}),n.d(b,"UNIT_CHANNELS",function(){return Ij}),n.d(b,"NONPOSITION_CHANNELS",function(){return $j}),n.d(b,"POSITION_SCALE_CHANNELS",function(){return Kj}),n.d(b,"NONPOSITION_SCALE_CHANNELS",function(){return nR}),n.d(b,"isNonPositionScaleChannel",function(){return rR}),n.d(b,"SCALE_CHANNELS",function(){return oR}),n.d(b,"isScaleChannel",function(){return aR}),n.d(b,"supportMark",function(){return sR}),n.d(b,"rangeType",function(){return uR});var y={};n.d(y,"binToString",function(){return cR}),n.d(y,"isBinning",function(){return lR}),n.d(y,"isBinned",function(){return fR}),n.d(y,"isBinParams",function(){return dR}),n.d(y,"autoMaxBins",function(){return hR});var w={};n.d(w,"Mark",function(){return pR}),n.d(w,"AREA",function(){return mR}),n.d(w,"BAR",function(){return gR}),n.d(w,"LINE",function(){return vR}),n.d(w,"POINT",function(){return bR}),n.d(w,"TEXT",function(){return yR}),n.d(w,"TICK",function(){return wR}),n.d(w,"TRAIL",function(){return xR}),n.d(w,"RECT",function(){return _R}),n.d(w,"RULE",function(){return kR}),n.d(w,"GEOSHAPE",function(){return SR}),n.d(w,"CIRCLE",function(){return ER}),n.d(w,"SQUARE",function(){return OR}),n.d(w,"isMark",function(){return CR}),n.d(w,"isPathMark",function(){return MR}),n.d(w,"PRIMITIVE_MARKS",function(){return NR}),n.d(w,"isMarkDef",function(){return TR}),n.d(w,"isPrimitiveMark",function(){return DR}),n.d(w,"STROKE_CONFIG",function(){return jR}),n.d(w,"FILL_CONFIG",function(){return RR}),n.d(w,"FILL_STROKE_CONFIG",function(){return FR}),n.d(w,"VL_ONLY_MARK_CONFIG_PROPERTIES",function(){return PR}),n.d(w,"VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX",function(){return zR}),n.d(w,"defaultMarkConfig",function(){return LR}),n.d(w,"defaultBarConfig",function(){return BR}),n.d(w,"defaultTickConfig",function(){return UR});var x={};n.d(x,"isDateTime",function(){return GR}),n.d(x,"MONTHS",function(){return KR}),n.d(x,"SHORT_MONTHS",function(){return XR}),n.d(x,"DAYS",function(){return YR}),n.d(x,"SHORT_DAYS",function(){return JR}),n.d(x,"dateTimeExpr",function(){return ZR});var _={};n.d(_,"TimeUnit",function(){return tF}),n.d(_,"TIMEUNIT_PARTS",function(){return nF}),n.d(_,"isLocalSingleTimeUnit",function(){return rF}),n.d(_,"isUtcSingleTimeUnit",function(){return oF}),n.d(_,"isUTCTimeUnit",function(){return uF}),n.d(_,"getLocalTimeUnit",function(){return cF}),n.d(_,"TIMEUNITS",function(){return fF}),n.d(_,"isTimeUnit",function(){return dF}),n.d(_,"convert",function(){return pF}),n.d(_,"getTimeUnitParts",function(){return gF}),n.d(_,"containsTimeUnit",function(){return vF}),n.d(_,"fieldExpr",function(){return bF}),n.d(_,"getDateTimeComponents",function(){return yF}),n.d(_,"formatExpression",function(){return wF}),n.d(_,"normalizeTimeUnit",function(){return xF});var k={};n.d(k,"Type",function(){return _F}),n.d(k,"TYPE_INDEX",function(){return kF}),n.d(k,"isType",function(){return SF}),n.d(k,"QUANTITATIVE",function(){return EF}),n.d(k,"ORDINAL",function(){return OF}),n.d(k,"TEMPORAL",function(){return AF}),n.d(k,"NOMINAL",function(){return CF}),n.d(k,"GEOJSON",function(){return MF}),n.d(k,"getFullName",function(){return NF});var S={};n.d(S,"isConditionalSelection",function(){return TF}),n.d(S,"isRepeatRef",function(){return IF}),n.d(S,"toFieldDefBase",function(){return DF}),n.d(S,"isSortableFieldDef",function(){return jF}),n.d(S,"isConditionalDef",function(){return RF}),n.d(S,"hasConditionalFieldDef",function(){return FF}),n.d(S,"hasConditionalValueDef",function(){return PF}),n.d(S,"isFieldDef",function(){return zF}),n.d(S,"isTypedFieldDef",function(){return LF}),n.d(S,"isStringFieldDef",function(){return BF}),n.d(S,"isValueDef",function(){return UF}),n.d(S,"isScaleFieldDef",function(){return WF}),n.d(S,"isPositionFieldDef",function(){return qF}),n.d(S,"isMarkPropFieldDef",function(){return VF}),n.d(S,"isTextFieldDef",function(){return HF}),n.d(S,"vgField",function(){return $F}),n.d(S,"isDiscrete",function(){return GF}),n.d(S,"isContinuous",function(){return KF}),n.d(S,"isCount",function(){return XF}),n.d(S,"verbalTitleFormatter",function(){return YF}),n.d(S,"functionalTitleFormatter",function(){return JF}),n.d(S,"defaultTitleFormatter",function(){return ZF}),n.d(S,"setTitleFormatter",function(){return tP}),n.d(S,"resetTitleFormatter",function(){return eP}),n.d(S,"title",function(){return nP}),n.d(S,"getGuide",function(){return rP}),n.d(S,"defaultTitle",function(){return iP}),n.d(S,"format",function(){return oP}),n.d(S,"defaultType",function(){return aP}),n.d(S,"getFieldDef",function(){return sP}),n.d(S,"getTypedFieldDef",function(){return uP}),n.d(S,"normalize",function(){return cP}),n.d(S,"normalizeFieldDef",function(){return lP}),n.d(S,"normalizeBin",function(){return fP}),n.d(S,"channelCompatibility",function(){return hP}),n.d(S,"isNumberFieldDef",function(){return pP}),n.d(S,"isTimeFieldDef",function(){return mP}),n.d(S,"valueExpr",function(){return gP}),n.d(S,"valueArray",function(){return vP}),n.d(S,"binRequiresRange",function(){return bP});var E={};n.d(E,"channelHasField",function(){return yP}),n.d(E,"isAggregate",function(){return wP}),n.d(E,"extractTransformsFromEncoding",function(){return xP}),n.d(E,"markChannelCompatible",function(){return _P}),n.d(E,"normalizeEncoding",function(){return kP}),n.d(E,"isRanged",function(){return SP}),n.d(E,"fieldDefs",function(){return EP}),n.d(E,"forEach",function(){return OP}),n.d(E,"reduce",function(){return AP});var O={};n.d(O,"add",function(){return GP}),n.d(O,"remove",function(){return KP}),n.d(O,"getAllCompositeMarks",function(){return XP}),n.d(O,"getCompositeMarkParts",function(){return YP}),n.d(O,"normalize",function(){return JP});var A={};n.d(A,"defaultLegendConfig",function(){return tz}),n.d(A,"LEGEND_PROPERTIES",function(){return rz}),n.d(A,"VG_LEGEND_PROPERTIES",function(){return iz});var C={};n.d(C,"ScaleType",function(){return oz}),n.d(C,"SCALE_TYPES",function(){return sz}),n.d(C,"scaleCompatible",function(){return uz}),n.d(C,"scaleTypePrecedence",function(){return lz}),n.d(C,"CONTINUOUS_TO_CONTINUOUS_SCALES",function(){return fz}),n.d(C,"CONTINUOUS_TO_DISCRETE_SCALES",function(){return hz}),n.d(C,"CONTINUOUS_DOMAIN_SCALES",function(){return mz}),n.d(C,"DISCRETE_DOMAIN_SCALES",function(){return vz}),n.d(C,"TIME_SCALE_TYPES",function(){return wz}),n.d(C,"hasDiscreteDomain",function(){return xz}),n.d(C,"isBinScale",function(){return _z}),n.d(C,"hasContinuousDomain",function(){return kz}),n.d(C,"isContinuousToContinuous",function(){return Sz}),n.d(C,"isContinuousToDiscrete",function(){return Ez}),n.d(C,"defaultScaleConfig",function(){return Oz}),n.d(C,"isExtendedScheme",function(){return Az}),n.d(C,"isSelectionDomain",function(){return Cz}),n.d(C,"SCALE_PROPERTIES",function(){return Nz}),n.d(C,"NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES",function(){return Fz}),n.d(C,"SCALE_TYPE_INDEX",function(){return Pz}),n.d(C,"scaleTypeSupportProperty",function(){return zz}),n.d(C,"channelScalePropertyIncompatability",function(){return Lz}),n.d(C,"scaleTypeSupportDataType",function(){return Bz}),n.d(C,"channelSupportScaleType",function(){return Uz}),n.d(C,"getSupportedScaleType",function(){return Wz});var M={};n.d(M,"defaultViewConfig",function(){return $z}),n.d(M,"isVgScheme",function(){return Gz}),n.d(M,"defaultConfig",function(){return Kz}),n.d(M,"initConfig",function(){return Xz}),n.d(M,"stripAndRedirectConfig",function(){return Qz});var N={};n.d(N,"isUrlData",function(){return eL}),n.d(N,"isInlineData",function(){return nL}),n.d(N,"isNamedData",function(){return rL}),n.d(N,"MAIN",function(){return iL}),n.d(N,"RAW",function(){return oL});var T={};n.d(T,"HEADER_TITLE_PROPERTIES_MAP",function(){return aL}),n.d(T,"HEADER_LABEL_PROPERTIES_MAP",function(){return sL}),n.d(T,"HEADER_TITLE_PROPERTIES",function(){return uL}),n.d(T,"HEADER_LABEL_PROPERTIES",function(){return cL});var I={};n.d(I,"isSortField",function(){return lL}),n.d(I,"isSortArray",function(){return fL});var D={};n.d(D,"isStackOffset",function(){return hL}),n.d(D,"STACKABLE_MARKS",function(){return pL}),n.d(D,"STACK_BY_DEFAULT_MARKS",function(){return mL}),n.d(D,"stack",function(){return gL});var j={};n.d(j,"normalize",function(){return _L}),n.d(j,"isConcatSpec",function(){return vL}),n.d(j,"isHConcatSpec",function(){return yL}),n.d(j,"isVConcatSpec",function(){return bL}),n.d(j,"isFacetSpec",function(){return QR}),n.d(j,"isLayerSpec",function(){return wL}),n.d(j,"isRepeatSpec",function(){return xL}),n.d(j,"isUnitSpec",function(){return AL}),n.d(j,"fieldDefs",function(){return ML}),n.d(j,"isStacked",function(){return NL}),n.d(j,"usedFields",function(){return TL});var R={};n.d(R,"isFilter",function(){return qL}),n.d(R,"isImputeSequence",function(){return VL}),n.d(R,"isLookup",function(){return HL}),n.d(R,"isSample",function(){return $L}),n.d(R,"isWindow",function(){return GL}),n.d(R,"isFlatten",function(){return KL}),n.d(R,"isCalculate",function(){return XL}),n.d(R,"isBin",function(){return YL}),n.d(R,"isImpute",function(){return JL}),n.d(R,"isTimeUnit",function(){return ZL}),n.d(R,"isAggregate",function(){return QL}),n.d(R,"isStack",function(){return tB}),n.d(R,"isFold",function(){return eB}),n.d(R,"normalizeTransform",function(){return nB});var F={};n.d(F,"DEFAULT_REQUIRED_CHANNEL_MAP",function(){return rB}),n.d(F,"DEFAULT_SUPPORTED_CHANNEL_TYPE",function(){return iB}),n.d(F,"getEncodingMappingError",function(){return oB});var P={};n.d(P,"symbols",function(){return sW}),n.d(P,"gradient",function(){return uW}),n.d(P,"labels",function(){return cW});var z={};n.d(z,"compile",function(){return fV}),n.d(z,"extractTransforms",function(){return dV}),n.d(z,"aggregate",function(){return g}),n.d(z,"axis",function(){return v}),n.d(z,"bin",function(){return y}),n.d(z,"channel",function(){return b}),n.d(z,"compositeMark",function(){return O}),n.d(z,"config",function(){return M}),n.d(z,"data",function(){return N}),n.d(z,"datetime",function(){return x}),n.d(z,"encoding",function(){return E}),n.d(z,"fieldDef",function(){return S}),n.d(z,"header",function(){return T}),n.d(z,"legend",function(){return A}),n.d(z,"mark",function(){return w}),n.d(z,"scale",function(){return C}),n.d(z,"sort",function(){return I}),n.d(z,"spec",function(){return j}),n.d(z,"stack",function(){return D}),n.d(z,"timeUnit",function(){return _}),n.d(z,"transform",function(){return R}),n.d(z,"type",function(){return k}),n.d(z,"util",function(){return m}),n.d(z,"validate",function(){return F}),n.d(z,"version",function(){return hV});var L={};function B(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]])}return n}n.d(L,"dark",function(){return vV}),n.d(L,"excel",function(){return bV}),n.d(L,"fivethirtyeight",function(){return yV}),n.d(L,"ggplot2",function(){return wV}),n.d(L,"latimes",function(){return kV}),n.d(L,"quartz",function(){return SV}),n.d(L,"vox",function(){return EV}),n.d(L,"version",function(){return OV});var U=n(89),W=n(172),q=n.n(W),V=n(257),H=n(1);function $(t){var e=t||H.x,n=[],r={};return n.add=function(t){var i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=function(t){var i,o=e(t);return r[o]&&(r[o]=0,(i=n.indexOf(t))>=0&&n.splice(i,1)),n},n}var G=Symbol("vega_id"),K=1;function X(t){return!(!t||!Y(t))}function Y(t){return t[G]}function J(t,e){return t[G]=e,t}function Z(t){var e=t===Object(t)?t:{data:t};return Y(e)?e:J(e,K++)}function Q(t){return tt(t,Z({}))}function tt(t,e){for(var n in t)e[n]=t[n];return e}function et(t,e){return J(e,Y(t))}function nt(t){return t&&t.constructor===rt}function rt(){var t=[],e=[],n=[],r=[],i=[],o=!1;return{constructor:rt,insert:function(e){for(var n=Object(H.i)(e),r=0,i=n.length;r<i;++r)t.push(n[r]);return this},remove:function(t){for(var n=Object(H.D)(t)?r:e,i=Object(H.i)(t),o=0,a=i.length;o<a;++o)n.push(i[o]);return this},modify:function(t,e,r){var o={field:e,value:Object(H.l)(r)};return Object(H.D)(t)?(o.filter=t,i.push(o)):(o.tuple=t,n.push(o)),this},encode:function(t,e){return Object(H.D)(t)?i.push({filter:t,field:e}):n.push({tuple:t,field:e}),this},reflow:function(){return o=!0,this},pulse:function(a,s){var u,c,l,f,d,h,p={},m={};for(u=0,c=s.length;u<c;++u)p[Y(s[u])]=1;for(u=0,c=e.length;u<c;++u)p[Y(d=e[u])]=-1;for(u=0,c=r.length;u<c;++u)f=r[u],s.forEach(function(t){f(t)&&(p[Y(t)]=-1)});for(u=0,c=t.length;u<c;++u)h=Y(d=t[u]),p[h]?p[h]=1:a.add.push(Z(t[u]));for(u=0,c=s.length;u<c;++u)d=s[u],p[Y(d)]<0&&a.rem.push(d);function g(t,e,n){n?t[e]=n(t):a.encode=e,o||(m[Y(t)]=t)}for(u=0,c=n.length;u<c;++u)d=(l=n[u]).tuple,f=l.field,(h=p[Y(d)])>0&&(g(d,f,l.value),a.modifies(f));for(u=0,c=i.length;u<c;++u)l=i[u],f=l.filter,s.forEach(function(t){f(t)&&p[Y(t)]>0&&g(t,l.field,l.value)}),a.modifies(l.field);if(o)a.mod=e.length||r.length?s.filter(function(t){return p[Y(t)]>0}):s.slice();else for(h in m)a.mod.push(m[h]);return a}}}var it="_:mod:_";function ot(){Object.defineProperty(this,it,{writable:!0,value:{}})}var at=ot.prototype;at.set=function(t,e,n,r){var i=this,o=i[t],a=i[it];return null!=e&&e>=0?(o[e]!==n||r)&&(o[e]=n,a[e+":"+t]=-1,a[t]=-1):(o!==n||r)&&(i[t]=n,a[t]=Object(H.A)(n)?1+n.length:-1),i},at.modified=function(t,e){var n,r=this[it];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(Object(H.A)(t)){for(n=0;n<t.length;++n)if(r[t[n]])return!0;return!1}return null!=e&&e>=0?e+1<r[t]||!!r[e+":"+t]:!!r[t]},at.clear=function(){return this[it]={},this};var st=0,ut=new ot;function ct(t,e,n,r){this.id=++st,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}var lt=ct.prototype;function ft(t){return function(e){var n=this.flags;return 0===arguments.length?!!(n&t):(this.flags=e?n|t:n&~t,this)}}lt.targets=function(){return this._targets||(this._targets=$(H.w))},lt.set=function(t){return this.value!==t?(this.value=t,1):0},lt.skip=ft(1),lt.modified=ft(2),lt.parameters=function(t,e,n){e=!1!==e;var r,i,o,a,s=this,u=s._argval=s._argval||new ot,c=s._argops=s._argops||[],l=[];function f(t,n,r){r instanceof ct?(r!==s&&(e&&r.targets().add(s),l.push(r)),c.push({op:r,name:t,index:n})):u.set(t,n,r)}for(r in t)if(i=t[r],"pulse"===r)Object(H.i)(i).forEach(function(t){t instanceof ct?t!==s&&(t.targets().add(s),l.push(t)):Object(H.n)("Pulse parameters must be operator instances.")}),s.source=i;else if(Object(H.A)(i))for(u.set(r,-1,Array(o=i.length)),a=0;a<o;++a)f(r,a,i[a]);else f(r,-1,i);return this.marshall().clear(),n&&(c.initonly=!0),l},lt.marshall=function(t){var e,n,r,i,o,a=this._argval||ut,s=this._argops;if(s){for(n=0,r=s.length;n<r;++n)o=(i=(e=s[n]).op).modified()&&i.stamp===t,a.set(e.name,e.index,i.value,o);if(s.initonly){for(n=0;n<r;++n)(e=s[n]).op.targets().remove(this);this._argops=null,this._update=null}}return a},lt.evaluate=function(t){var e=this._update;if(e){var n=this.marshall(t.stamp),r=e.call(this,n,t);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},lt.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.stamp=t.stamp,this.pulse=e||t);var e};var dt=0;function ht(t,e,n){this.id=++dt,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function pt(t,e,n){return new ht(t,e,n)}var mt=ht.prototype;mt._filter=H.Ea,mt._apply=H.x,mt.targets=function(){return this._targets||(this._targets=$(H.w))},mt.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},mt.receive=function(t){if(this._filter(t)){for(var e=this.value=this._apply(t),n=this._targets,r=n?n.length:0,i=0;i<r;++i)n[i].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},mt.filter=function(t){var e=pt(t);return this.targets().add(e),e},mt.apply=function(t){var e=pt(null,t);return this.targets().add(e),e},mt.merge=function(){var t=pt();this.targets().add(t);for(var e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},mt.throttle=function(t){var e=-1;return this.filter(function(){var n=Date.now();return n-e>t?(e=n,1):0})},mt.debounce=function(t){var e=pt();return this.targets().add(pt(null,null,Object(H.m)(t,function(t){var n=t.dataflow;e.receive(t),n&&n.run&&n.run()}))),e},mt.between=function(t,e){var n=!1;return t.targets().add(pt(null,null,function(){n=!0})),e.targets().add(pt(null,null,function(){n=!1})),this.filter(function(){return n})};var gt=/^([A-Za-z]+:)?\/\//,vt="file://",bt=function(t){return{options:t||{},sanitize:wt,load:yt,file:_t,http:xt}};function yt(t,e){var n=this;return n.sanitize(t,e).then(function(t){var r=t.href;return t.localFile?n.file(r):n.http(r,e)})}function wt(t,e){return e=Object(H.o)({},this.options,e),new Promise(function(n,r){var i,o,a,s,u={href:null};null!=t&&"string"==typeof t?(o=gt.test(t),(s=e.baseURL)&&!o&&(St(t,"/")||"/"===s[s.length-1]||(t="/"+t),t=s+t),a=(i=St(t,vt))||"file"===e.mode||"http"!==e.mode&&!o&&kt(),i?t=t.slice(vt.length):St(t,"//")&&("file"===e.defaultProtocol?(t=t.slice(2),a=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(u,"localFile",{value:!!a}),u.href=t,e.target&&(u.target=e.target+""),n(u)):r("Sanitize failure, invalid URI: "+Object(H.X)(t))})}function xt(t,e){return function(t,e){var r="function"==typeof fetch?fetch:n(670);return r?r(t,e):Promise.reject("No fetch method available.")}(t,Object(H.o)({},this.options.http,e)).then(function(t){if(!t.ok)throw t.status+""+t.statusText;return t.text()})}function _t(t){return new Promise(function(e,n){var r=kt();r?r.readFile(t,function(t,r){t?n(t):e(r)}):n("No file system access for "+t)})}function kt(){var t=n(669);return t&&Object(H.D)(t.readFile)?t:null}function St(t,e){return null!=t&&0===t.lastIndexOf(e,0)}var Et={boolean:H.Y,integer:H.Aa,number:H.Aa,date:H.Z,string:H.Ca,unknown:H.x},Ot=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return Tt(t)&&(t=+t)==~~t},Tt,function(t){return!isNaN(Date.parse(t))}],At=["boolean","integer","number","date"];function Ct(t,e){if(!t||!t.length)return"unknown";var n,r,i,o=0,a=t.length,s=Ot.length,u=Ot.map(function(t,e){return e+1});for(r=0,a=t.length;r<a;++r)for(n=e?t[r][e]:t[r],i=0;i<s;++i)if(u[i]&&Nt(n)&&!Ot[i](n)&&(u[i]=0,++o===Ot.length))return"string";return o=u.reduce(function(t,e){return 0===t?e:t},0)-1,At[o]}function Mt(t,e){return e.reduce(function(e,n){return e[n]=Ct(t,n),e},{})}function Nt(t){return null!=t&&t==t}function Tt(t){return!(isNaN(+t)||t instanceof Date)}var It={},Dt={},jt=34,Rt=10,Ft=13;function Pt(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function zt(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function Lt(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}var Bt=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,u=o<=0,c=!1;function l(){if(u)return Dt;if(c)return c=!1,It;var e,r,i=a;if(t.charCodeAt(i)===jt){for(;a++<o&&t.charCodeAt(a)!==jt||t.charCodeAt(++a)===jt;);return(e=a)>=o?u=!0:(r=t.charCodeAt(a++))===Rt?c=!0:r===Ft&&(c=!0,t.charCodeAt(a)===Rt&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if((r=t.charCodeAt(e=a++))===Rt)c=!0;else if(r===Ft)c=!0,t.charCodeAt(a)===Rt&&++a;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,o)}for(t.charCodeAt(o-1)===Rt&&--o,t.charCodeAt(o-1)===Ft&&--o;(r=l())!==Dt;){for(var f=[];r!==It&&r!==Dt;)f.push(r),r=l();e&&null==(f=e(f,s++))||i.push(f)}return i}function i(e,n){return e.map(function(e){return n.map(function(t){return a(e[t])}).join(t)})}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?function(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Lt(-t,6):t>9999?"+"+Lt(t,6):Lt(t,4)}(t.getUTCFullYear())+"-"+Lt(t.getUTCMonth()+1,2)+"-"+Lt(t.getUTCDate(),2)+(i?"T"+Lt(e,2)+":"+Lt(n,2)+":"+Lt(r,2)+"."+Lt(i,3)+"Z":r?"T"+Lt(e,2)+":"+Lt(n,2)+":"+Lt(r,2)+"Z":n||e?"T"+Lt(e,2)+":"+Lt(n,2)+"Z":"")}(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Pt(t);return function(r,i){return e(n(r),i,t)}}(t,e):Pt(t)});return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=zt(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=zt(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")}}},Ut=Bt(","),Wt=(Ut.parse,Ut.parseRows,Ut.format,Ut.formatBody,Ut.formatRows,Bt("\t"));function qt(t){return function(e,n){var r={delimiter:t};return Vt(e,n?Object(H.o)(n,r):r)}}function Vt(t,e){return e.header&&(t=e.header.map(H.X).join(e.delimiter)+"\n"+t),Bt(e.delimiter).parse(t+"")}Wt.parse,Wt.parseRows,Wt.format,Wt.formatBody,Wt.formatRows;var Ht=n(170),$t=function(t){return t},Gt=function(t){if(null==t)return $t;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=n=0);var u=2,c=t.length,l=new Array(c);for(l[0]=(e+=t[0])*r+o,l[1]=(n+=t[1])*i+a;u<c;)l[u]=t[u],++u;return l}},Kt=function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n},Xt=function(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map(function(e){return Yt(t,e)})}:Yt(t,e)};function Yt(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,o=Jt(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function Jt(t,e){var n=Gt(t.transform),r=t.arcs;function i(t,e){e.length&&e.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)e.push(n(i[o],o));t<0&&Kt(e,a)}function o(t){return n(t)}function a(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function u(t){return t.map(s)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=o(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(o);break;case"LineString":n=a(e.arcs);break;case"MultiLineString":n=e.arcs.map(a);break;case"Polygon":n=u(e.arcs);break;case"MultiPolygon":n=e.arcs.map(u);break;default:return null}return{type:r,coordinates:n}}(e)}var Zt=function(t){return Jt(t,function(t,e,n){var r,i,o;if(arguments.length>1)r=function(t,e,n){var r,i=[],o=[];function a(t){var e=t<0?~t:t;(o[e]||(o[e]=[])).push({i:t,g:r})}function s(t){t.forEach(a)}function u(t){t.forEach(s)}return function t(e){switch(r=e,e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":s(e.arcs);break;case"MultiLineString":case"Polygon":u(e.arcs);break;case"MultiPolygon":e.arcs.forEach(u)}}(e),o.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,n);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:function(t,e){var n={},r={},i={},o=[],a=-1;function s(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach(function(t){n[t<0?~t:t]=1}),o.push(i)}}return e.forEach(function(n,r){var i,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++a],e[a]=n,e[r]=i)}),e.forEach(function(e){var n,o,a=function(e){var n,r=t.arcs[e<0?~e:e],i=r[0];return t.transform?(n=[0,0],r.forEach(function(t){n[0]+=t[0],n[1]+=t[1]})):n=r[r.length-1],e<0?[n,i]:[i,n]}(e),s=a[0],u=a[1];if(n=i[s])if(delete i[n.end],n.push(e),n.end=u,o=r[u]){delete r[o.start];var c=o===n?n:n.concat(o);r[c.start=n.start]=i[c.end=o.end]=c}else r[n.start]=i[n.end]=n;else if(n=r[u])if(delete r[n.start],n.unshift(e),n.start=s,o=i[s]){delete i[o.end];var l=o===n?n:o.concat(n);r[l.start=o.start]=i[l.end=n.end]=l}else r[n.start]=i[n.end]=n;else r[(n=[e]).start=s]=i[n.end=u]=n}),s(i,r),s(r,i),e.forEach(function(t){n[t<0?~t:t]||o.push([t])}),o}(t,r)}}.apply(this,arguments))},Qt={dsv:Vt,csv:qt(","),tsv:qt("\t"),json:Ht.a,topojson:function(t,e){var n,r,i;return t=Object(Ht.a)(t,e),n=e&&(i=e.feature)?Xt:e&&(i=e.mesh)?Zt:Object(H.n)("Missing TopoJSON feature or mesh parameter."),(r=(r=t.objects[i])?n(t,r):Object(H.n)("Invalid TopoJSON object: "+i))&&r.features||[r]}};function te(t,e){return arguments.length>1?(Qt[t]=e,this):Qt.hasOwnProperty(t)?Qt[t]:null}var ee=new Date,ne=new Date;function re(t,e,n,r){function i(e){return t(e=new Date(+e)),e}return i.floor=i,i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,o){var a,s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return s},i.filter=function(n){return re(function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})},n&&(i.count=function(e,r){return ee.setTime(+e),ne.setTime(+r),t(ee),t(ne),Math.floor(n(ee,ne))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var ie=re(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});ie.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?re(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):ie:null};var oe=ie,ae=(ie.range,6e4),se=6048e5,ue=re(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}),ce=ue,le=(ue.range,re(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,e){t.setTime(+t+e*ae)},function(t,e){return(e-t)/ae},function(t){return t.getMinutes()})),fe=le,de=(le.range,re(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*ae)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getHours()})),he=de,pe=(de.range,re(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ae)/864e5},function(t){return t.getDate()-1})),me=pe;function ge(t){return re(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ae)/se})}pe.range;var ve=ge(0),be=ge(1),ye=ge(2),we=ge(3),xe=ge(4),_e=ge(5),ke=ge(6),Se=(ve.range,be.range,ye.range,we.range,xe.range,_e.range,ke.range,re(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()})),Ee=Se,Oe=(Se.range,re(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()}));Oe.every=function(t){return isFinite(t=Math.floor(t))&&t>0?re(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)}):null};var Ae=Oe,Ce=(Oe.range,re(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*ae)},function(t,e){return(e-t)/ae},function(t){return t.getUTCMinutes()})),Me=Ce,Ne=(Ce.range,re(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getUTCHours()})),Te=Ne,Ie=(Ne.range,re(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1})),De=Ie;function je(t){return re(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/se})}Ie.range;var Re=je(0),Fe=je(1),Pe=je(2),ze=je(3),Le=je(4),Be=je(5),Ue=je(6),We=(Re.range,Fe.range,Pe.range,ze.range,Le.range,Be.range,Ue.range,re(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()})),qe=We,Ve=(We.range,re(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()}));Ve.every=function(t){return isFinite(t=Math.floor(t))&&t>0?re(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null};var He=Ve;function $e(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ge(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ke(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}Ve.range;var Xe,Ye,Je,Ze,Qe,tn={"-":"",_:" ",0:"0"},en=/^\s*\d+/,nn=/^%/,rn=/[\\^$*+?|[\]().{}]/g;function on(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function an(t){return t.replace(rn,"\\$&")}function sn(t){return new RegExp("^(?:"+t.map(an).join("|")+")","i")}function un(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function cn(t,e,n){var r=en.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ln(t,e,n){var r=en.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function fn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function dn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function hn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function pn(t,e,n){var r=en.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function mn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function gn(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function vn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function bn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function yn(t,e,n){var r=en.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function wn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function xn(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function _n(t,e,n){var r=en.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function kn(t,e,n){var r=en.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Sn(t,e,n){var r=en.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function En(t,e,n){var r=nn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function On(t,e,n){var r=en.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function An(t,e,n){var r=en.exec(e.slice(n));return r?(t.Q=1e3*+r[0],n+r[0].length):-1}function Cn(t,e){return on(t.getDate(),e,2)}function Mn(t,e){return on(t.getHours(),e,2)}function Nn(t,e){return on(t.getHours()%12||12,e,2)}function Tn(t,e){return on(1+me.count(Ae(t),t),e,3)}function In(t,e){return on(t.getMilliseconds(),e,3)}function Dn(t,e){return In(t,e)+"000"}function jn(t,e){return on(t.getMonth()+1,e,2)}function Rn(t,e){return on(t.getMinutes(),e,2)}function Fn(t,e){return on(t.getSeconds(),e,2)}function Pn(t){var e=t.getDay();return 0===e?7:e}function zn(t,e){return on(ve.count(Ae(t),t),e,2)}function Ln(t,e){var n=t.getDay();return t=n>=4||0===n?xe(t):xe.ceil(t),on(xe.count(Ae(t),t)+(4===Ae(t).getDay()),e,2)}function Bn(t){return t.getDay()}function Un(t,e){return on(be.count(Ae(t),t),e,2)}function Wn(t,e){return on(t.getFullYear()%100,e,2)}function qn(t,e){return on(t.getFullYear()%1e4,e,4)}function Vn(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+on(e/60|0,"0",2)+on(e%60,"0",2)}function Hn(t,e){return on(t.getUTCDate(),e,2)}function $n(t,e){return on(t.getUTCHours(),e,2)}function Gn(t,e){return on(t.getUTCHours()%12||12,e,2)}function Kn(t,e){return on(1+De.count(He(t),t),e,3)}function Xn(t,e){return on(t.getUTCMilliseconds(),e,3)}function Yn(t,e){return Xn(t,e)+"000"}function Jn(t,e){return on(t.getUTCMonth()+1,e,2)}function Zn(t,e){return on(t.getUTCMinutes(),e,2)}function Qn(t,e){return on(t.getUTCSeconds(),e,2)}function tr(t){var e=t.getUTCDay();return 0===e?7:e}function er(t,e){return on(Re.count(He(t),t),e,2)}function nr(t,e){var n=t.getUTCDay();return t=n>=4||0===n?Le(t):Le.ceil(t),on(Le.count(He(t),t)+(4===He(t).getUTCDay()),e,2)}function rr(t){return t.getUTCDay()}function ir(t,e){return on(Fe.count(He(t),t),e,2)}function or(t,e){return on(t.getUTCFullYear()%100,e,2)}function ar(t,e){return on(t.getUTCFullYear()%1e4,e,4)}function sr(){return"+0000"}function ur(){return"%"}function cr(t){return+t}function lr(t){return Math.floor(+t/1e3)}function fr(t){return Xe=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,c=sn(i),l=un(i),f=sn(o),d=un(o),h=sn(a),p=un(a),m=sn(s),g=un(s),v=sn(u),b=un(u),y={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Cn,e:Cn,f:Dn,H:Mn,I:Nn,j:Tn,L:In,m:jn,M:Rn,p:function(t){return i[+(t.getHours()>=12)]},Q:cr,s:lr,S:Fn,u:Pn,U:zn,V:Ln,w:Bn,W:Un,x:null,X:null,y:Wn,Y:qn,Z:Vn,"%":ur},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Hn,e:Hn,f:Yn,H:$n,I:Gn,j:Kn,L:Xn,m:Jn,M:Zn,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:cr,s:lr,S:Qn,u:tr,U:er,V:nr,w:rr,W:ir,x:null,X:null,y:or,Y:ar,Z:sr,"%":ur},x={a:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=d[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=b[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return S(t,e,n,r)},d:bn,e:bn,f:Sn,H:wn,I:wn,j:yn,L:kn,m:vn,M:xn,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=l[r[0].toLowerCase()],n+r[0].length):-1},Q:On,s:An,S:_n,u:ln,U:fn,V:dn,w:cn,W:hn,x:function(t,e,r){return S(t,n,e,r)},X:function(t,e,n){return S(t,r,e,n)},y:mn,Y:pn,Z:gn,"%":En};function _(t,e){return function(n){var r,i,o,a=[],s=-1,u=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(u,s)),null!=(i=tn[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),u=s+1);return a.push(t.slice(u,s)),a.join("")}}function k(t,e){return function(n){var r,i,o=Ke(1900);if(S(o,t,n+="",0)!=n.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?(r=(i=(r=Ge(Ke(o.y))).getUTCDay())>4||0===i?Fe.ceil(r):Fe(r),r=De.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(r=(i=(r=e(Ke(o.y))).getDay())>4||0===i?be.ceil(r):be(r),r=me.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?Ge(Ke(o.y)).getUTCDay():e(Ke(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,Ge(o)):e(o)}}function S(t,e,n,r){for(var i,o,a=0,s=e.length,u=n.length;a<s;){if(r>=u)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=x[i in tn?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return y.x=_(n,y),y.X=_(r,y),y.c=_(e,y),w.x=_(n,w),w.X=_(r,w),w.c=_(e,w),{format:function(t){var e=_(t+="",y);return e.toString=function(){return t},e},parse:function(t){var e=k(t+="",$e);return e.toString=function(){return t},e},utcFormat:function(t){var e=_(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t,Ge);return e.toString=function(){return t},e}}}(t),Ye=Xe.format,Je=Xe.parse,Ze=Xe.utcFormat,Qe=Xe.utcParse,Xe}fr({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"]}),Date.prototype.toISOString||Ze("%Y-%m-%dT%H:%M:%S.%LZ"),+new Date("2000-01-01T00:00:00.000Z")||Qe("%Y-%m-%dT%H:%M:%S.%LZ");var dr=function(t,e,n){var r=te((e=e||{}).type||"json");return r||Object(H.n)("Unknown data format type: "+e.type),t=r(t,e),e.parse&&function(t,e,n){if(t.length){n=n||Je;var r,i,o,a,s,u,c,l=t.columns||Object.keys(t[0]);for("auto"===e&&(e=Mt(t,l)),r=(l=Object.keys(e)).map(function(t){var r,i,o=e[t];if(o&&(0===o.indexOf("date:")||0===o.indexOf("utc:")))return("'"===(i=(r=o.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?Qe(i):n(i);if(!Et[o])throw Error("Illegal format pattern: "+t+":"+o);return Et[o]}),a=0,u=t.length,c=l.length;a<u;++a)for(i=t[a],s=0;s<c;++s)i[o=l[s]]=r[s](i[o])}}(t,e.parse,n),t.hasOwnProperty("columns")&&delete t.columns,t},hr={skip:!0};var pr={};function mr(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}var gr=mr.prototype;function vr(t,e){return t?function(n,r){return t(n,r)&&e(n,r)}:e}function br(t,e){var n=[];return Object(H.Ga)(t,e,function(t){n.push(t)}),n}function yr(t,e){var n={};return t.visit(e,function(t){n[Y(t)]=1}),function(t){return n[Y(t)]?null:t}}function wr(t,e,n,r){var i,o,a,s,u,c=this,l=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n,a=0,s=n.length;a<s;++a)if((i=n[a]).stamp===e){if(i.fields)for(u in o=c.fields||(c.fields={}),i.fields)o[u]=1;i.changed(c.ADD)&&(l|=c.ADD),i.changed(c.REM)&&(l|=c.REM),i.changed(c.MOD)&&(l|=c.MOD)}this.changes=l}gr.StopPropagation=pr,gr.ADD=1,gr.REM=2,gr.MOD=4,gr.ADD_REM=3,gr.ADD_MOD=5,gr.ALL=7,gr.REFLOW=8,gr.SOURCE=16,gr.NO_SOURCE=32,gr.NO_FIELDS=64,gr.fork=function(t){return new mr(this.dataflow).init(this,t)},gr.clone=function(){var t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},gr.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length?((t=new mr(this.dataflow).init(this)).add=t.source,t):t},gr.init=function(t,e){var n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source),n},gr.runAfter=function(t){this.dataflow.runAfter(t)},gr.changed=function(t){var e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},gr.reflow=function(t){if(t)return this.fork(7).reflow();var e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,yr(this,1))),this},gr.modifies=function(t){var e=Object(H.i)(t),n=this.fields||(this.fields={});return e.forEach(function(t){n[t]=!0}),this},gr.modified=function(t){var e=this.fields;return!(!this.mod.length||!e)&&(arguments.length?Object(H.A)(t)?t.some(function(t){return e[t]}):e[t]:!!e)},gr.filter=function(t,e){var n=this;return 1&t&&(n.addF=vr(n.addF,e)),2&t&&(n.remF=vr(n.remF,e)),4&t&&(n.modF=vr(n.modF,e)),16&t&&(n.srcF=vr(n.srcF,e)),n},gr.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=br(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=br(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=br(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},gr.visit=function(t,e){var n,r,i=this,o=e;return 16&t?(Object(H.Ga)(i.source,i.srcF,o),i):(1&t&&Object(H.Ga)(i.add,i.addF,o),2&t&&Object(H.Ga)(i.rem,i.remF,o),4&t&&Object(H.Ga)(i.mod,i.modF,o),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||(r?Object(H.Ga)(n,yr(i,5),o):Object(H.Ga)(n,i.srcF,o))),i)};var xr=Object(H.y)(wr,mr);function _r(t,e){try{e(t)}catch(e){t.error(e)}}xr.fork=function(t){var e=new mr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,function(t){return e.add.push(t)}),t&e.REM&&this.visit(e.REM,function(t){return e.rem.push(t)}),t&e.MOD&&this.visit(e.MOD,function(t){return e.mod.push(t)})),e},xr.changed=function(t){return this.changes&t},xr.modified=function(t){var e=this,n=e.fields;return n&&e.changes&e.MOD?Object(H.A)(t)?t.some(function(t){return n[t]}):n[t]:0},xr.filter=function(){Object(H.n)("MultiPulse does not support filtering.")},xr.materialize=function(){Object(H.n)("MultiPulse does not support materialization.")},xr.visit=function(t,e){var n=this,r=n.pulses,i=r.length,o=0;if(t&n.SOURCE)for(;o<i;++o)r[o].visit(t,e);else for(;o<i;++o)r[o].stamp===n.stamp&&r[o].visit(t,e);return n};var kr={skip:!1,force:!1};function Sr(t){this.cmp=t,this.nodes=[]}var Er=Sr.prototype;function Or(t,e,n,r){var i,o,a;for(i=t[n];n>e&&r(i,o=t[a=n-1>>1])<0;)t[n]=o,n=a;return t[n]=i}function Ar(t,e,n){for(var r,i=e,o=t.length,a=t[e],s=2*e+1;s<o;)(r=s+1)<o&&n(t[s],t[r])>=0&&(s=r),t[e]=t[s],s=2*(e=s)+1;return t[e]=a,Or(t,i,e,n)}function Cr(){this._log=Object(H.K)(),this.logLevel(H.b),this._clock=0,this._rank=0;try{this._loader=bt()}catch(t){}this._touched=$(H.w),this._pulses={},this._pulse=null,this._heap=new Sr(function(t,e){return t.qrank-e.qrank}),this._postrun=[]}Er.size=function(){return this.nodes.length},Er.clear=function(){return this.nodes=[],this},Er.peek=function(){return this.nodes[0]},Er.push=function(t){var e=this.nodes;return e.push(t),Or(e,0,e.length-1,this.cmp)},Er.pop=function(){var t,e=this.nodes,n=e.pop();return e.length?(t=e[0],e[0]=n,Ar(e,0,this.cmp)):t=n,t},Er.replace=function(t){var e=this.nodes,n=e[0];return e[0]=t,Ar(e,0,this.cmp),n},Er.pushpop=function(t){var e=this.nodes,n=e[0];return e.length&&this.cmp(n,t)<0&&(e[0]=t,t=n,Ar(e,0,this.cmp)),t};var Mr=Cr.prototype;function Nr(t){return function(){return this._log[t].apply(this,arguments)}}function Tr(t,e){ct.call(this,t,null,e)}Mr.stamp=function(){return this._clock},Mr.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},Mr.cleanThreshold=1e4,Mr.add=function(t,e,n,r){var i,o=1;return t instanceof ct?i=t:t&&t.prototype instanceof ct?i=new t:Object(H.D)(t)?i=new ct(null,t):(o=0,i=new ct(t,e)),this.rank(i),o&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},Mr.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n<r;++n)if(i<e[n].rank)return void this.rerank(t)},Mr.rank=function(t){t.rank=++this._rank},Mr.rerank=function(t){for(var e,n,r,i=[t];i.length;)if(this.rank(e=i.pop()),n=e._targets)for(r=n.length;--r>=0;)i.push(e=n[r]),e===t&&Object(H.n)("Cycle detected in dataflow graph.")},Mr.pulse=function(t,e,n){this.touch(t,n||kr);var r=new mr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._pulses[t.id]=e.pulse(r,i),this},Mr.touch=function(t,e){var n=e||kr;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},Mr.update=function(t,e,n){var r=n||kr;return(t.set(e)||r.force)&&this.touch(t,r),this},Mr.changeset=rt,Mr.ingest=function(t,e,n){return this.pulse(t,this.changeset().insert(dr(e,n)))},Mr.request=function(t,e,n){var r=this,i=0,o=r._pending||function(t){var e,n,r=new Promise(function(r,i){e=function(){r(t)},n=i});return r.requests=0,r.done=function(){0==--r.requests&&t.runAfter(function(){t._pending=null;try{t.run(),t._pending?t._pending.then(e):e()}catch(t){n(t)}})},t._pending=r}(r);return o.requests+=1,r.loader().load(e,{context:"dataflow"}).then(function(t){return dr(t,n)},function(t){i=-1,r.error("Loading failed",e,t)}).catch(function(t){i=-2,r.error("Data ingestion failed",e,t)}).then(function(e){return r.pulse(t,r.changeset().remove(H.Ea).insert(e||[])),o.done(),i})},Mr.events=function(t,e,n,r){for(var i,o=this,a=pt(n,r),s=function(t){t.dataflow=o;try{a.receive(t)}catch(t){o.error(t)}finally{o.run()}},u=0,c=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):Object(H.i)(t)).length;u<c;++u)i[u].addEventListener(e,s);return a},Mr.on=function(t,e,n,r,i){return(t instanceof ct?function(t,e,n,r,i,o){var a,s;void 0===r?s=n:(a=Object(H.D)(r)?r:Object(H.l)(r),(s=new ct(null,r=n?function(t,e){var r=a(t,e);return n.skip()||(n.skip(r!==this.value).value=r),r}:a,i,!1)).modified(o&&o.force),s.rank=0,n&&(s.skip(!0),s.value=n.value,s.targets().add(n))),e.targets().add(s)}:function(t,e,n,r,i,o){var a,s,u=Object(H.o)({},o,hr);Object(H.D)(n)||(n=Object(H.l)(n)),void 0===r?a=function(e){t.touch(n(e))}:Object(H.D)(r)?(s=new ct(null,r,i,!1),a=function(e){var r,i=n(e);s.evaluate(e),nt(r=s.value)?t.pulse(i,r,o):t.update(i,r,u)}):a=function(e){t.update(n(e),r,u)},e.apply(a)})(this,t,e,n,r,i),this},Mr.run=function(t){var e,n,r,i,o=this,a=0,s=o.logLevel();if(o._pending)return o.info("Awaiting requests, delaying dataflow run."),0;if(o._pulse)return o.error("Dataflow invoked recursively. Use the runAfter method to queue invocation."),0;if(!o._touched.length)return o.info("Dataflow invoked, but nothing to do."),0;o._pulse=new mr(o,++o._clock,t),s>=H.c&&(r=Date.now(),o.debug("-- START PROPAGATION ("+o._clock+") -----")),o._touched.forEach(function(t){o._enqueue(t,!0)}),o._touched=$(H.w);try{for(;o._heap.size()>0;)(e=o._heap.pop()).rank===e.qrank?(n=e.run(o._getPulse(e,t)),s>=H.a&&o.debug(e.id,n===pr?"STOP":n,e),n!==pr&&(o._pulse=n,e._targets&&e._targets.forEach(function(t){o._enqueue(t)})),++a):o._enqueue(e,!0)}catch(t){i=t}if(o._pulses={},o._pulse=null,s>=H.c&&(r=Date.now()-r,o.info("> Pulse "+o._clock+": "+a+" operators; "+r+"ms")),i&&(o._postrun=[],o.error(i)),o._onrun)try{o._onrun(o,a,i)}catch(t){o.error(t)}if(o._postrun.length){var u=o._postrun;o._postrun=[],u.sort(function(t,e){return e.priority-t.priority}).forEach(function(t){_r(o,t.callback)})}return this},Mr.runAsync=function(){return this._pending||this.run()&&this._pending||Promise.resolve(this)},Mr.runAfter=function(t,e,n){this._pulse||e?this._postrun.push({priority:n||0,callback:t}):_r(this,t)},Mr._enqueue=function(t,e){var n=!this._pulses[t.id];n&&(this._pulses[t.id]=this._pulse),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},Mr._getPulse=function(t,e){var n,r=t.source,i=this._clock;return r&&Object(H.A)(r)?new wr(this,i,n=r.map(function(t){return t.pulse}),e):(n=this._pulses[t.id],r&&((r=r.pulse)&&r!==pr?r.stamp===i&&n.target!==t?n=r:n.source=r.source:n.source=[]),n)},Mr.error=Nr("error"),Mr.warn=Nr("warn"),Mr.info=Nr("info"),Mr.debug=Nr("debug"),Mr.logLevel=Nr("level");var Ir=Object(H.y)(Tr,ct);Ir.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?this.skip(!1):e=this.evaluate(t),(e=e||t)!==t.StopPropagation&&(this.pulse=e),this.stamp=t.stamp,e);var e},Ir.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Ir.transform=function(){};var Dr={};function jr(t){var e=Rr(t);return e&&e.Definition||null}function Rr(t){return t=t&&t.toLowerCase(),Dr.hasOwnProperty(t)?Dr[t]:null}function Fr(t){return t&&t.length?1===t.length?t[0]:function(t){return function(e){for(var n=t.length,r=1,i=String(t[0](e));r<n;++r)i+="|"+t[r](e);return i}}(t):function(){return""}}function Pr(t,e,n){return n||t+(e?"_"+e:"")}var zr={values:Ur({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:Ur({name:"count",set:"cell.num"}),__count__:Ur({name:"count",set:"this.missing + this.valid"}),missing:Ur({name:"missing",set:"this.missing"}),valid:Ur({name:"valid",set:"this.valid"}),sum:Ur({name:"sum",init:"this.sum = 0;",add:"this.sum += +v;",rem:"this.sum -= v;",set:"this.sum"}),mean:Ur({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.valid ? this.mean : undefined"}),average:Ur({name:"average",set:"this.valid ? this.mean : undefined",req:["mean"],idx:1}),variance:Ur({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:Ur({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:Ur({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:Ur({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:Ur({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:Ur({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:Ur({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:Ur({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:Ur({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:Ur({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:Ur({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:Ur({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:Ur({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:Ur({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:Ur({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Lr=Object.keys(zr);function Br(t,e){return zr[t](e)}function Ur(t){return function(e){var n=Object(H.o)({init:"",add:"",rem:"",idx:0},t);return n.out=e||t.name,n}}function Wr(t,e){return t.idx-e.idx}function qr(t,e){var n=e||H.x,r="var cell = this.cell; this.valid = 0; this.missing = 0;",i="this.cell = cell; this.init();",o="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",a="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return function(t,e){var n,r=t.reduce(function t(e,n){function r(n){e[n]||t(e,e[n]=zr[n]())}return n.req&&n.req.forEach(r),n.str&&n.str.forEach(r),e},t.reduce(function(t,e){return t[e.name]=e,t},{})),i=[];for(n in r)i.push(r[n]);return i.sort(Wr)}(t).forEach(function(t){r+=t.init,o+=t.add,a+=t.rem}),t.slice().sort(Wr).forEach(function(t){s+="t['"+t.out+"']="+t.set+";"}),s+="return t;",(i=Function("cell",i)).prototype.init=Function(r),i.prototype.add=Function("v","t",o),i.prototype.rem=Function("v","t",a),i.prototype.set=Function("t",s),i.prototype.get=n,i.fields=t.map(function(t){return t.out}),i}var Vr=function(t){var e,n,r,i,o,a,s,u,c=t.maxbins||20,l=t.base||10,f=Math.log(l),d=t.divide||[5,2],h=t.extent[0],p=t.extent[1],m=t.span||p-h||Math.abs(h)||1;if(t.step)e=t.step;else if(t.steps){for(o=m/c,a=0,s=t.steps.length;a<s&&t.steps[a]<o;++a);e=t.steps[Math.max(0,a-1)]}else{for(n=Math.ceil(Math.log(c)/f),r=t.minstep||0,e=Math.max(r,Math.pow(l,Math.round(Math.log(m)/f)-n));Math.ceil(m/e)>c;)e*=l;for(a=0,s=d.length;a<s;++a)(o=e/d[a])>=r&&m/o<=c&&(e=o)}return i=(o=Math.log(e))>=0?0:1+~~(-o/f),u=Math.pow(l,-i-1),(t.nice||void 0===t.nice)&&(h=h<(o=Math.floor(h/e+u)*e)?o-e:o,p=Math.ceil(p/e)*e),{start:h,stop:p===h?h+e:p,step:e}},Hr=function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}},$r=Math.random;function Gr(t){$r=t}var Kr=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},Xr=function(t){return null===t?NaN:+t};function*Yr(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}function Jr(t,e,n){return function(t,e,n=Xr){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}(Float64Array.from(Yr(t,n)).sort(Kr),e)}var Zr=function(t,e,n,r){if(!t.length)return[void 0,void 0];var i,o,a,s,u=Float64Array.from(Hr(t,r)),c=u.length,l=e;for(a=0,s=Array(l);a<l;++a){for(i=0,o=0;o<c;++o)i+=u[~~($r()*c)];s[a]=i/c}return s.sort(Kr),[Jr(s,n/2),Jr(s,1-n/2)]},Qr=function(t,e){var n=Float64Array.from(Hr(t,e));return n.sort(Kr),[Jr(n,.25),Jr(n,.5),Jr(n,.75)]},ti=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},ei=function(t,e){null==e&&(e=t,t=0);var n,r,i,o={min:function(t){return arguments.length?(i=r-(n=t||0),o):n},max:function(t){return arguments.length?(i=(r=t||0)-n,o):r},sample:function(){return n+Math.floor(i*$r())},pdf:function(t){return t===Math.floor(t)&&t>=n&&t<r?1/i:0},cdf:function(t){var e=Math.floor(t);return e<n?0:e>=r?1:(e-n+1)/i},icdf:function(t){return t>=0&&t<=1?n-1+Math.floor(t*i):NaN}};return o.min(t).max(e)},ni=function(t,e){var n,r,i=NaN,o={mean:function(t){return arguments.length?(n=t||0,i=NaN,o):n},stdev:function(t){return arguments.length?(r=null==t?1:t,i=NaN,o):r},sample:function(){var t,e,o=0,a=0;if(i==i)return o=i,i=NaN,o;do{t=(o=2*$r()-1)*o+(a=2*$r()-1)*a}while(0===t||t>1);return e=Math.sqrt(-2*Math.log(t)/t),i=n+a*e*r,n+o*e*r},pdf:function(t){var e=Math.exp(Math.pow(t-n,2)/(-2*Math.pow(r,2)));return 1/(r*Math.sqrt(2*Math.PI))*e},cdf:function(t){var e,i=(t-n)/r,o=Math.abs(i);if(o>37)e=0;else{var a=Math.exp(-o*o/2);o<7.07106781186547?(e=a*((((((.0352624965998911*o+.700383064443688)*o+6.37396220353165)*o+33.912866078383)*o+112.079291497871)*o+221.213596169931)*o+220.206867912376),e/=((((((.0883883476483184*o+1.75566716318264)*o+16.064177579207)*o+86.7807322029461)*o+296.564248779674)*o+637.333633378831)*o+793.826512519948)*o+440.413735824752):e=a/(o+1/(o+2/(o+3/(o+4/(o+.65)))))/2.506628274631}return i>0?1-e:e},icdf:function(t){if(t<=0||t>=1)return NaN;var e=2*t-1,i=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),o=2/(Math.PI*i)+Math.log(1-Math.pow(e,2))/2,a=Math.log(1-e*e)/i,s=(e>0?1:-1)*Math.sqrt(Math.sqrt(o*o-a)-o);return n+r*Math.SQRT2*s}};return o.mean(t).stdev(e)},ri=function(t,e){var n=ni(),r={},i=0;return r.data=function(n){return arguments.length?(t=n,i=n?n.length:0,r.bandwidth(e)):t},r.bandwidth=function(n){return arguments.length?(!(e=n)&&t&&(e=function(t){var e=t.length,n=Qr(t),r=(n[2]-n[0])/1.34;return 1.06*Math.min(Math.sqrt(function(t,e){let n,r=0,i=0,o=0;for(let e of t)null!=e&&(e=+e)>=e&&(o+=(n=e-i)*(e-(i+=n/++r)));if(r>1)return o/(r-1)}(t)),r)*Math.pow(e,-.2)}(t)),r):e},r.sample=function(){return t[~~($r()*i)]+e*n.sample()},r.pdf=function(r){for(var o=0,a=0;a<i;++a)o+=n.pdf((r-t[a])/e);return o/e/i},r.cdf=function(r){for(var o=0,a=0;a<i;++a)o+=n.cdf((r-t[a])/e);return o/i},r.icdf=function(){throw Error("KDE icdf not supported.")},r.data(t)},ii=function(t,e){var n,r={},i=0;return r.weights=function(t){return arguments.length?(n=function(t){var e,n=[],r=0;for(e=0;e<i;++e)r+=n[e]=null==t[e]?1:+t[e];for(e=0;e<i;++e)n[e]/=r;return n}(e=t||[]),r):e},r.distributions=function(n){return arguments.length?(n?(i=n.length,t=n):(i=0,t=[]),r.weights(e)):t},r.sample=function(){for(var e=$r(),r=t[i-1],o=n[0],a=0;a<i-1;o+=n[++a])if(e<o){r=t[a];break}return r.sample()},r.pdf=function(e){for(var r=0,o=0;o<i;++o)r+=n[o]*t[o].pdf(e);return r},r.cdf=function(e){for(var r=0,o=0;o<i;++o)r+=n[o]*t[o].cdf(e);return r},r.icdf=function(){throw Error("Mixture icdf not supported.")},r.distributions(t).weights(e)},oi=function(t,e){null==e&&(e=null==t?1:t,t=0);var n,r,i,o={min:function(t){return arguments.length?(i=r-(n=t||0),o):n},max:function(t){return arguments.length?(i=(r=t||0)-n,o):r},sample:function(){return n+i*$r()},pdf:function(t){return t>=n&&t<=r?1/i:0},cdf:function(t){return t<n?0:t>r?1:(t-n)/i},icdf:function(t){return t>=0&&t<=1?n+t*i:NaN}};return o.min(t).max(e)},ai=function(t,e,n,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-o*t,o]};function si(t,e,n,r){t=t.filter(t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&t.sort((t,n)=>e(t)-e(n));const i=new Float64Array(t.length),o=new Float64Array(t.length);let a=0;for(let r of t)i[a]=e(r),o[a]=n(r),++a;return[i,o]}function ui(t,e,n,r){let i,o,a=-1,s=-1;for(let u of t)i=e(u,++a,t),o=n(u,a,t),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++s)}var ci=function(t,e,n,r,i){let o=0,a=0;return ui(t,e,n,(t,e)=>{const n=e-i(t),s=e-r;o+=n*n,a+=s*s}),1-o/a},li=function(t,e,n){let r=0,i=0,o=0,a=0,s=0;ui(t,e,n,(t,e)=>{r+=t,i+=e,o+=t*e,a+=t*t,++s});const u=ai(r/s,i/s,o/s,a/s),c=t=>u[0]+u[1]*t;return{coef:u,predict:c,rSquared:ci(t,e,n,i/s,c)}},fi=function(t,e,n){let r=0,i=0,o=0,a=0,s=0;ui(t,e,n,(t,e)=>{t=Math.log(t),r+=t,i+=e,o+=t*e,a+=t*t,++s});const u=ai(r/s,i/s,o/s,a/s),c=t=>u[0]+u[1]*Math.log(t);return{coef:u,predict:c,rSquared:ci(t,e,n,i/s,c)}},di=function(t,e,n){let r=0,i=0,o=0,a=0,s=0,u=0;ui(t,e,n,(t,e)=>{const n=Math.log(e),c=t*e;r+=e,o+=c,s+=t*c,i+=e*n,a+=c*n,++u});const c=ai(o/r,i/r,a/r,s/r),l=t=>c[0]*Math.exp(c[1]*t);return c[0]=Math.exp(c[0]),{coef:c,predict:l,rSquared:ci(t,e,n,r/u,l)}},hi=function(t,e,n){let r=0,i=0,o=0,a=0,s=0,u=0;ui(t,e,n,(t,e)=>{const n=Math.log(t),c=Math.log(e);r+=n,i+=c,o+=n*c,a+=n*n,s+=e,++u});const c=ai(r/u,i/u,o/u,a/u),l=t=>c[0]*Math.pow(t,c[1]);return c[0]=Math.exp(c[0]),{coef:c,predict:l,rSquared:ci(t,e,n,s/u,l)}},pi=function(t,e,n){let r=0,i=0,o=0,a=0,s=0,u=0,c=0,l=0;ui(t,e,n,(t,e)=>{const n=t*t;r+=t,i+=e,o+=n,a+=n*t,s+=n*n,u+=t*e,c+=n*e,++l});const f=o-r*r/l,d=a-o*r/l,h=s-o*o/l,p=f*h-d*d,m=((c-=o*(i/=l))*f-(u-=r*i)*d)/p,g=(u*h-c*d)/p,v=i-g*(r/l)-m*(o/l),b=t=>m*t*t+g*t+v;return{coef:[v,g,m],predict:b,rSquared:ci(t,e,n,i,b)}},mi=function(t,e,n,r){if(1===r)return li(t,e,n);if(2===r)return pi(t,e,n);const[i,o]=si(t,e,n),a=i.length,s=[],u=[],c=r+1;let l,f,d,h,p,m=0;for(l=0;l<a;++l)m+=o[l];for(l=0;l<c;++l){for(d=0,h=0;d<a;++d)h+=Math.pow(i[d],l)*o[d];for(s.push(h),p=new Float64Array(c),f=0;f<c;++f){for(d=0,h=0;d<a;++d)h+=Math.pow(i[d],l+f);p[f]=h}u.push(p)}u.push(s);const g=function(t){const e=t.length-1,n=[];let r,i,o,a,s;for(r=0;r<e;++r){for(a=r,i=r+1;i<e;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<e+1;++o)s=t[o][r],t[o][r]=t[o][a],t[o][a]=s;for(i=r+1;i<e;++i)for(o=e;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(s=0,o=i+1;o<e;++o)s+=t[o][i]*n[o];n[i]=(t[e][i]-s)/t[i][i]}return n}(u),v=t=>{let e=0,n=0,r=g.length;for(;n<r;++n)e+=g[n]*Math.pow(t,n);return e};return{coef:g,predict:v,rSquared:ci(t,e,n,m/a,v)}};function gi(t,e,n=0,r=t.length-1,i=Kr){for(;r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,s=Math.log(o),u=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);gi(t,e,Math.max(n,Math.floor(e-a*u/o+c)),Math.min(r,Math.floor(e+(o-a)*u/o+c)),i)}const o=t[e];let a=n,s=r;for(vi(t,n,e),i(t[r],o)>0&&vi(t,n,r);a<s;){for(vi(t,a,s),++a,--s;i(t[a],o)<0;)++a;for(;i(t[s],o)>0;)--s}0===i(t[n],o)?vi(t,n,s):vi(t,++s,r),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function vi(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}var bi=function(t,e){if(!(t=Float64Array.from(Yr(t,e))).length)return;const n=t.length,r=n>>1;return gi(t,r-1,0),0==(1&n)&&gi(t,r,r),Jr(t,.5)},yi=function(t,e,n,r){const[i,o]=si(t,e,n,!0),a=i.length,s=Math.max(2,~~(r*a)),u=new Float64Array(a),c=new Float64Array(a),l=new Float64Array(a).fill(1);for(let t=-1;++t<=2;){const e=[0,s-1];for(let t=0;t<a;++t){const n=i[t],r=e[0],a=e[1],s=n-i[r]>i[a]-n?r:a;let f=0,d=0,h=0,p=0,m=0,g=1/Math.abs(i[s]-n||1);for(let t=r;t<=a;++t){const e=i[t],r=o[t],a=wi(Math.abs(n-e)*g)*l[t],s=e*a;f+=a,d+=s,h+=r*a,p+=r*s,m+=e*s}const[v,b]=ai(d/f,h/f,p/f,m/f);u[t]=v+b*n,c[t]=Math.abs(o[t]-u[t]),xi(i,t+1,e)}if(2===t)break;const n=bi(c);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r<a;++r)t=c[r]/(6*n),l[r]=t>=1?1e-12:(e=1-t*t)*e}return function(t,e){const n=t.length,r=[];for(let i,o=0,a=0,s=[];o<n;++o)i=t[o],s[0]===i?s[1]+=(e[o]-s[1])/++a:(a=0,s=[i,e[o]],r.push(s));return r}(i,u)};function wi(t){return(t=1-t*t*t)*t*t}function xi(t,e,n){let r=t[e],i=n[0],o=n[1]+1;if(!(o>=t.length))for(;e>i&&t[o]-r<=r-t[i];)n[0]=++i,n[1]=o,++o}const _i=.1*Math.PI/180;var ki=function(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],o=e[0],a=e[1],s=a-o,u=s/r,c=[i(o)],l=[];if(n===r){for(let t=1;t<r;++t)c.push(i(o+t/n*s));return c.push(i(a)),c}l.push(i(a));for(let t=n;--t>0;)l.push(i(o+t/n*s));let f=c[0],d=l[l.length-1];for(;d;){const t=i((f[0]+d[0])/2);t[0]-f[0]>=u&&Si(f,t,d)>_i?l.push(t):(f=d,c.push(d),l.pop()),d=l[l.length-1]}return c};function Si(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function Ei(t){this._key=t?Object(H.t)(t):Y,this.reset()}var Oi=Ei.prototype;function Ai(t){Tr.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Oi.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Oi.add=function(t){this._add.push(t)},Oi.rem=function(t){this._rem.push(t)},Oi.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,n,r=this._add,i=this._rem,o=this._key,a=r.length,s=i.length,u=Array(a-s),c={};for(t=0;t<s;++t)c[o(i[t])]=1;for(t=0,e=0;t<a;++t)c[o(n=r[t])]?c[o(n)]=0:u[e++]=n;return this._rem=[],this._add=u},Oi.distinct=function(t){for(var e,n=this.values(),r=n.length,i={},o=0;--r>=0;)e=t(n[r])+"",i.hasOwnProperty(e)||(i[e]=1,++o);return o},Oi.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=Object(H.q)(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},Oi.argmin=function(t){return this.extent(t)[0]||{}},Oi.argmax=function(t){return this.extent(t)[1]||{}},Oi.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):void 0},Oi.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):void 0},Oi.quartile=function(t){return this._get===t&&this._q||(this._q=Qr(this.values(),t),this._get=t),this._q},Oi.q1=function(t){return this.quartile(t)[0]},Oi.q2=function(t){return this.quartile(t)[1]},Oi.q3=function(t){return this.quartile(t)[2]},Oi.ci=function(t){return this._get===t&&this._ci||(this._ci=Zr(this.values(),1e3,.05,t),this._get=t),this._ci},Oi.ci0=function(t){return this.ci(t)[0]},Oi.ci1=function(t){return this.ci(t)[1]},Ai.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Lr},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var Ci=Object(H.y)(Ai,Tr);function Mi(t){Tr.call(this,null,t)}Ci.transform=function(t,e){var n,r=this,i=e.fork(e.NO_SOURCE|e.NO_FIELDS);return this.stamp=i.stamp,this.value&&((n=t.modified())||e.modified(this._inputs))?(this._prev=this.value,this.value=n?this.init(t):{},e.visit(e.SOURCE,function(t){r.add(t)})):(this.value=this.value||this.init(t),e.visit(e.REM,function(t){r.rem(t)}),e.visit(e.ADD,function(t){r.add(t)})),i.modifies(this._outputs),r._drop=!1!==t.drop,t.cross&&r._dims.length>1&&(r._drop=!1,this.cross()),r.changes(i)},Ci.cross=function(){var t=this,e=t.value,n=t._dnames,r=n.map(function(){return{}}),i=n.length;function o(t){var e,o,a,s;for(e in t)for(a=t[e].tuple,o=0;o<i;++o)r[o][s=a[n[o]]]=s}o(t._prev),o(e),function o(a,s,u){var c,l,f=n[u],d=r[u++];for(c in d)s[f]=d[c],l=a?a+"|"+c:c,u<i?o(l,s,u):e[l]||t.cell(l,s)}("",{},0)},Ci.init=function(t){var e=this._inputs=[],n=this._outputs=[],r={};function i(t){for(var n,i=Object(H.i)(Object(H.g)(t)),o=0,a=i.length;o<a;++o)r[n=i[o]]||(r[n]=1,e.push(n))}this._dims=Object(H.i)(t.groupby),this._dnames=this._dims.map(function(t){var e=Object(H.h)(t);return i(t),n.push(e),e}),this.cellkey=t.key?t.key:Fr(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];var o,a,s,u,c,l,f=t.fields||[null],d=t.ops||["count"],h=t.as||[],p=f.length,m={};for(p!==d.length&&Object(H.n)("Unmatched number of fields and aggregate ops."),l=0;l<p;++l)o=f[l],a=d[l],null==o&&"count"!==a&&Object(H.n)("Null aggregate field specified."),c=Pr(a,u=Object(H.h)(o),h[l]),n.push(c),"count"!==a?((s=m[u])||(i(o),(s=m[u]=[]).field=o,this._measures.push(s)),"count"!==a&&(this._countOnly=!1),s.push(Br(a,c))):this._counts.push(c);return this._measures=this._measures.map(function(t){return qr(t,t.field)}),{}},Ci.cellkey=Fr(),Ci.cell=function(t,e){var n=this.value[t];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[t]=this.newcell(t,e),this._adds[this._alen++]=n),n},Ci.newcell=function(t,e){var n={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var r,i=this._measures,o=i.length;for(n.agg=Array(o),r=0;r<o;++r)n.agg[r]=new i[r](n)}return n.store&&(n.data=new Ei),n},Ci.newtuple=function(t,e){var n,r,i=this._dnames,o=this._dims,a={};for(n=0,r=o.length;n<r;++n)a[i[n]]=o[n](t);return e?et(e.tuple,a):Z(a)},Ci.add=function(t){var e,n,r,i=this.cellkey(t),o=this.cell(i,t);if(o.num+=1,!this._countOnly)for(o.store&&o.data.add(t),n=0,r=(e=o.agg).length;n<r;++n)e[n].add(e[n].get(t),t)},Ci.rem=function(t){var e,n,r,i=this.cellkey(t),o=this.cell(i,t);if(o.num-=1,!this._countOnly)for(o.store&&o.data.rem(t),n=0,r=(e=o.agg).length;n<r;++n)e[n].rem(e[n].get(t),t)},Ci.celltuple=function(t){var e,n,r,i=t.tuple,o=this._counts;for(t.store&&t.data.values(),n=0,r=o.length;n<r;++n)i[o[n]]=t.num;if(!this._countOnly)for(n=0,r=(e=t.agg).length;n<r;++n)e[n].set(i);return i},Ci.changes=function(t){var e,n,r,i,o=this._adds,a=this._mods,s=this._prev,u=this._drop,c=t.add,l=t.rem,f=t.mod;if(s)for(n in s)e=s[n],u&&!e.num||l.push(e.tuple);for(r=0,i=this._alen;r<i;++r)c.push(this.celltuple(o[r])),o[r]=null;for(r=0,i=this._mlen;r<i;++r)(0===(e=a[r]).num&&u?l:f).push(this.celltuple(e)),a[r]=null;return this._alen=this._mlen=0,this._prev=null,t},Mi.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]};var Ni=Object(H.y)(Mi,Tr);Ni.transform=function(t,e){var n,r=this._bins(t),i=r.start,o=r.step,a=t.as||["bin0","bin1"],s=a[0],u=a[1];return n=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(Object(H.g)(t.field))?e.ADD_MOD:e.ADD,e.visit(n,function(t){var e=r(t);t[s]=e,t[u]=null==e?null:i+o*(1+(e-i)/o)}),e.modifies(a)},Ni._bins=function(t){if(this.value&&!t.modified())return this.value;var e,n,r=t.field,i=Vr(t),o=i.start,a=i.stop,s=i.step;null!=(e=t.anchor)&&(n=e-(o+s*Math.floor((e-o)/s)),o+=n,a+=n);var u=function(t){var e=r(t);return null==e?null:(e=Math.max(o,Math.min(+e,a-s)),o+s*Math.floor((e-o)/s))};return u.start=o,u.stop=a,u.step=s,this.value=Object(H.f)(u,Object(H.g)(r),t.name||"bin_"+Object(H.h)(r))};var Ti=function(t,e,n){var r=t,i=e||[],o=n||[],a={},s=0;return{add:function(t){o.push(t)},remove:function(t){a[r(t)]=++s},size:function(){return i.length},data:function(t,e){return s&&(i=i.filter(function(t){return!a[r(t)]}),a={},s=0),e&&t&&i.sort(t),o.length&&(i=t?Object(H.L)(t,i,o.sort(t)):i.concat(o),o=[]),i}}};function Ii(t){Tr.call(this,[],t)}function Di(t){ct.call(this,null,ji,t)}function ji(t){return this.value&&!t.modified()?this.value:Object(H.k)(t.fields,t.orders)}function Ri(t){Tr.call(this,null,t)}Ii.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Object(H.y)(Ii,Tr).transform=function(t,e){var n=e.fork(e.ALL),r=Ti(Y,this.value,n.materialize(n.ADD).add),i=t.sort,o=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(i,o),e.source&&e.source.root&&(this.value.root=e.source.root),n},Object(H.y)(Di,ct),Ri.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var Fi=Object(H.y)(Ri,Tr);function Pi(t){Tr.call(this,null,t)}Fi.transform=function(t,e){function n(e){return function(n){for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(s(n),t.case,o)||[],u=0,c=i.length;u<c;++u)a.test(r=i[u])||e(r)}}var r=this._parameterCheck(t,e),i=this._counts,o=this._match,a=this._stop,s=t.field,u=t.as||["text","count"],c=n(function(t){i[t]=1+(i[t]||0)}),l=n(function(t){i[t]-=1});return r?e.visit(e.SOURCE,c):(e.visit(e.ADD,c),e.visit(e.REM,l)),this._finish(e,u)},Fi._parameterCheck=function(t,e){var n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},Fi._finish=function(t,e){var n,r,i,o=this._counts,a=this._tuples||(this._tuples={}),s=e[0],u=e[1],c=t.fork(t.NO_SOURCE|t.NO_FIELDS);for(n in o)r=a[n],i=o[n]||0,!r&&i?(a[n]=r=Z({}),r[s]=n,r[u]=i,c.add.push(r)):0===i?(r&&c.rem.push(r),o[n]=null,a[n]=null):r[u]!==i&&(r[u]=i,c.mod.push(r));return c.modifies(e)},Pi.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},Object(H.y)(Pi,Tr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=this.value,i=t.as||["a","b"],o=i[0],a=i[1];return!r||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter")?(r&&(n.rem=r),r=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,o,a=[],s={},u=t.length,c=0;c<u;++c)for(s[e]=o=t[c],i=0;i<u;++i)s[n]=t[i],r(s)&&(a.push(Z(s)),(s={})[e]=o);return a}(r,o,a,t.filter||H.Ea)):n.mod=r,n.source=this.value,n.modifies(i)};var zi={kde:ri,mixture:ii,normal:ni,uniform:oi},Li="function",Bi=function(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(void 0===n?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]},Ui=function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o};function Wi(t){Tr.call(this,null,t)}var qi=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Vi={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:qi},{name:"weights",type:"number",array:!0}]};function Hi(t){ct.call(this,null,$i,t),this.modified(!0)}function $i(t){var e=t.expr;return this.value&&!t.modified("expr")?this.value:Object(H.f)(function(n){return e(n,t)},Object(H.g)(e),Object(H.h)(e))}function Gi(t){Tr.call(this,[void 0,void 0],t)}function Ki(t,e){ct.call(this,t),this.parent=e}Wi.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number",default:100},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:qi.concat(Vi)},{name:"as",type:"string",array:!0,default:["value","density"]}]},Object(H.y)(Wi,Tr).transform=function(t,e){var n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){var r=function t(e,n){var r=e[Li];zi.hasOwnProperty(r)||Object(H.n)("Unknown distribution function: "+r);var i=zi[r]();for(var o in e)"field"===o?i.data((e.from||n()).map(e[o])):"distributions"===o?i[o](e[o].map(function(e){return t(e,n)})):typeof i[o]===Li&&i[o](e[o]);return i}(t.distribution,function(t){return function(){return t.materialize(t.SOURCE).source}}(e)),i=t.method||"pdf";"pdf"!==i&&"cdf"!==i&&Object(H.n)("Invalid density method: "+i),t.extent||r.data||Object(H.n)("Missing density extent parameter."),i=r[i];var o=t.as||["value","density"],a=t.extent||Bi(r.data()),s=(a[1]-a[0])/(t.steps||100),u=Ui(a[0],a[1]+s/2,s).map(function(t){var e={};return e[o[0]]=t,e[o[1]]=i(t),Z(e)});this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n},Object(H.y)(Hi,ct),Gi.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},Object(H.y)(Gi,Tr).transform=function(t,e){var n,r=this.value,i=t.field,o=r[0],a=r[1];((n=e.changed()||e.modified(i.fields)||t.modified("field"))||null==o)&&(o=1/0,a=-1/0),e.visit(n?e.SOURCE:e.ADD,function(t){var e=i(t);null!=e&&((e=+e)<o&&(o=e),e>a&&(a=e))}),isFinite(o)&&isFinite(a)||(o=a=void 0),this.value=[o,a]};var Xi=Object(H.y)(Ki,ct);function Yi(t){Tr.call(this,{},t),this._keys=Object(H.s)();var e=this._targets=[];e.active=0,e.forEach=function(t){for(var n=0,r=e.active;n<r;++n)t(e[n],n,e)}}Xi.connect=function(t){return this.targets().add(t),t.source=this},Xi.add=function(t){this.value.add.push(t)},Xi.rem=function(t){this.value.rem.push(t)},Xi.mod=function(t){this.value.mod.push(t)},Xi.init=function(t){this.value.init(t,t.NO_SOURCE)},Xi.evaluate=function(){return this.value};var Ji=Object(H.y)(Yi,Tr);function Zi(t){ct.call(this,null,Qi,t)}function Qi(t){return this.value&&!t.modified()?this.value:Object(H.A)(t.name)?Object(H.i)(t.name).map(function(t){return Object(H.t)(t)}):Object(H.t)(t.name,t.as)}function to(t){Tr.call(this,Object(H.s)(),t)}function eo(t,e){return t?t.map(function(t,n){return e[n]||Object(H.h)(t)}):null}function no(t){Tr.call(this,[],t)}function ro(t){Tr.call(this,[],t)}function io(t){Tr.call(this,null,t)}function oo(t){Tr.call(this,[],t)}Ji.activate=function(t){this._targets[this._targets.active++]=t},Ji.subflow=function(t,e,n,r){var i,o,a=this.value,s=a.hasOwnProperty(t)&&a[t];return s?s.value.stamp<n.stamp&&(s.init(n),this.activate(s)):(o=r||(o=this._group[t])&&o.tuple,s=(i=n.dataflow).add(new Ki(n.fork(n.NO_SOURCE),this)).connect(e(i,t,o)),a[t]=s,this.activate(s)),s},Ji.transform=function(t,e){var n=e.dataflow,r=this,i=t.key,o=t.subflow,a=this._keys,s=t.modified("key");function u(t){return r.subflow(t,o,e)}return this._group=t.group||{},this._targets.active=0,e.visit(e.REM,function(t){var e=Y(t),n=a.get(e);void 0!==n&&(a.delete(e),u(n).rem(t))}),e.visit(e.ADD,function(t){var e=i(t);a.set(Y(t),e),u(e).add(t)}),s||e.modified(i.fields)?e.visit(e.MOD,function(t){var e=Y(t),n=a.get(e),r=i(t);n===r?u(r).mod(t):(a.set(e,r),u(n).rem(t),u(r).add(t))}):e.changed(e.MOD)&&e.visit(e.MOD,function(t){u(a.get(Y(t))).mod(t)}),s&&e.visit(e.REFLOW,function(t){var e=Y(t),n=a.get(e),r=i(t);n!==r&&(a.set(e,r),u(n).rem(t),u(r).add(t))}),a.empty>n.cleanThreshold&&n.runAfter(a.clean),e},Object(H.y)(Zi,ct),to.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},Object(H.y)(to,Tr).transform=function(t,e){var n=e.dataflow,r=this.value,i=e.fork(),o=i.add,a=i.rem,s=i.mod,u=t.expr,c=!0;function l(e){var n=Y(e),i=u(e,t),l=r.get(n);i&&l?(r.delete(n),o.push(e)):i||l?c&&i&&!l&&s.push(e):(r.set(n,1),a.push(e))}return e.visit(e.REM,function(t){var e=Y(t);r.has(e)?r.delete(e):a.push(t)}),e.visit(e.ADD,function(e){u(e,t)?o.push(e):r.set(Y(e),1)}),e.visit(e.MOD,l),t.modified()&&(c=!1,e.visit(e.REFLOW,l)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},no.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0}]},Object(H.y)(no,Tr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.fields,i=eo(r,t.as||[]),o=i.length;return n.rem=this.value,e.visit(e.SOURCE,function(t){for(var e,a,s,u=r.map(function(e){return e(t)}),c=u.reduce(function(t,e){return Math.max(t,e.length)},0),l=0;l<c;++l){for(a=Q(t),e=0;e<o;++e)a[i[e]]=null==(s=u[e][l])?null:s;n.add.push(a)}}),this.value=n.source=n.add,n.modifies(i)},ro.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},Object(H.y)(ro,Tr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.fields,i=r.map(H.h),o=t.as||["key","value"],a=o[0],s=o[1],u=r.length;return n.rem=this.value,e.visit(e.SOURCE,function(t){for(var e,o=0;o<u;++o)(e=Q(t))[a]=i[o],e[s]=r[o](t),n.add.push(e)}),this.value=n.source=n.add,n.modifies(o)},io.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},Object(H.y)(io,Tr).transform=function(t,e){var n=t.expr,r=t.as,i=t.modified(),o=t.initonly?e.ADD:i?e.SOURCE:e.modified(n.fields)?e.ADD_MOD:e.ADD;return i&&(e=e.materialize().reflow(!0)),t.initonly||e.modifies(r),e.visit(o,function(e){e[r]=n(e,t)})},Object(H.y)(oo,Tr).transform=function(t,e){var n,r,i,o=this.value,a=e.fork(e.ALL),s=t.size-o.length,u=t.generator;if(s>0){for(n=[];--s>=0;)n.push(i=Z(u(t))),o.push(i);a.add=a.add.length?a.materialize(a.ADD).add.concat(n):n}else r=o.slice(0,-s),a.rem=a.rem.length?a.materialize(a.REM).rem.concat(r):r,o=o.slice(-s);return a.source=this.value=o,a};var ao={value:"value",median:bi,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:function(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n},max:function(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}},so=[];function uo(t){Tr.call(this,[],t)}function co(t){Ai.call(this,t)}uo.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},Object(H.y)(uo,Tr).transform=function(t,e){var n,r,i,o,a,s,u,c,l,f,d=e.fork(e.ALL),h=function(t){var e,n=t.method||ao.value;if(null!=ao[n])return n===ao.value?(e=void 0!==t.value?t.value:0,function(){return e}):ao[n];Object(H.n)("Unrecognized imputation method: "+n)}(t),p=function(t){var e=t.field;return function(t){return t?e(t):NaN}}(t),m=Object(H.h)(t.field),g=Object(H.h)(t.key),v=(t.groupby||[]).map(H.h),b=function(t,e,n,r){var i,o,a,s,u,c,l,f,d=function(t){return t(f)},h=[],p=r?r.slice():[],m={},g={};for(p.forEach(function(t,e){m[t]=e+1}),s=0,l=t.length;s<l;++s)c=n(f=t[s]),u=m[c]||(m[c]=p.push(c)),(a=g[o=(i=e?e.map(d):so)+""])||(a=g[o]=[],h.push(a),a.values=i),a[u-1]=f;return h.domain=p,h}(e.source,t.groupby,t.key,t.keyvals),y=[],w=this.value,x=b.domain.length;for(a=0,c=b.length;a<c;++a)for(i=(n=b[a]).values,r=NaN,u=0;u<x;++u)if(null==n[u]){for(o=b.domain[u],f={_impute:!0},s=0,l=i.length;s<l;++s)f[v[s]]=i[s];f[g]=o,f[m]=isNaN(r)?r=h(n,p):r,y.push(Z(f))}return y.length&&(d.add=d.materialize(d.ADD).add.concat(y)),w.length&&(d.rem=d.materialize(d.REM).rem.concat(w)),this.value=y,d},co.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Lr},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]};var lo=Object(H.y)(co,Ai);function fo(t){ct.call(this,null,ho,t)}function ho(t){return this.value&&!t.modified()?this.value:Object(H.I)(t.fields,t.flat)}function po(t){Tr.call(this,null,t)}function mo(t){Tr.call(this,{},t)}function go(t){ct.call(this,null,vo,t)}function vo(t){if(this.value&&!t.modified())return this.value;var e,n,r,i=1/0,o=-1/0,a=t.extents;for(e=0,n=a.length;e<n;++e)(r=a[e])[0]<i&&(i=r[0]),r[1]>o&&(o=r[1]);return[i,o]}function bo(t){ct.call(this,null,yo,t)}function yo(t){return this.value&&!t.modified()?this.value:t.values.reduce(function(t,e){return t.concat(e)},[])}function wo(t){Tr.call(this,null,t)}function xo(t){Ai.call(this,t)}lo.transform=function(t,e){var n,r=this,i=t.modified();return r.value&&(i||e.modified(r._inputs))?(n=r.value=i?r.init(t):{},e.visit(e.SOURCE,function(t){r.add(t)})):(n=r.value=r.value||this.init(t),e.visit(e.REM,function(t){r.rem(t)}),e.visit(e.ADD,function(t){r.add(t)})),r.changes(),e.visit(e.SOURCE,function(t){Object(H.o)(t,n[r.cellkey(t)].tuple)}),e.reflow(i).modifies(this._outputs)},lo.changes=function(){var t,e,n=this._adds,r=this._mods;for(t=0,e=this._alen;t<e;++t)this.celltuple(n[t]),n[t]=null;for(t=0,e=this._mlen;t<e;++t)this.celltuple(r[t]),r[t]=null;this._alen=this._mlen=0},Object(H.y)(fo,ct),Object(H.y)(po,Tr).transform=function(t,e){e.dataflow.request(this.target,t.url,t.format)},mo.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},Object(H.y)(mo,Tr).transform=function(t,e){var n,r,i=e,o=t.as,a=t.fields,s=t.index,u=t.values,c=null==t.default?null:t.default,l=t.modified(),f=l?e.SOURCE:e.ADD,d=a.length;return u?(r=u.length,d>1&&!o&&Object(H.n)('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==d*r&&Object(H.n)('The "as" parameter has too few output field names.'),o=o||u.map(H.h),n=function(t){for(var e,n,i=0,l=0;i<d;++i)if(null==(n=s.get(a[i](t))))for(e=0;e<r;++e,++l)t[o[l]]=c;else for(e=0;e<r;++e,++l)t[o[l]]=u[e](n)}):(o||Object(H.n)("Missing output field names."),n=function(t){for(var e,n=0;n<d;++n)e=s.get(a[n](t)),t[o[n]]=null==e?c:e}),l?i=e.reflow(!0):f|=a.some(function(t){return e.modified(t.fields)})?e.MOD:0,e.visit(f,n),i.modifies(o)},Object(H.y)(go,ct),Object(H.y)(bo,ct),Object(H.y)(wo,Tr),wo.prototype.transform=function(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)},xo.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Lr,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};var _o=Object(H.y)(xo,Ai);function ko(t){Yi.call(this,t)}function So(t){Tr.call(this,null,t)}function Eo(t){Tr.call(this,null,t)}function Oo(t){Tr.call(this,null,t)}function Ao(t){Tr.call(this,[],t),this.count=0}function Co(t){Tr.call(this,null,t)}function Mo(t){Tr.call(this,null,t),this.modified(!0)}function No(t){Tr.call(this,Object(H.s)(),t)}function To(t){Tr.call(this,null,t)}_o._transform=_o.transform,_o.transform=function(t,e){return this._transform(function(t,e){var n=t.field,r=t.value,i=("count"===t.op?"__count__":t.op)||"sum",o=Object(H.g)(n).concat(Object(H.g)(r)),a=function(t,e,n){var r={},i=[];return n.visit(n.SOURCE,function(e){var n=t(e);r[n]||(r[n]=1,i.push(n))}),i.sort(function(t,e){return(t<e||null==t)&&null!=e?-1:(t>e||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0)}),e?i.slice(0,e):i}(n,t.limit||0,e);return{key:t.key,groupby:t.groupby,ops:a.map(function(){return i}),fields:a.map(function(t){return function(t,e,n,r){return Object(H.f)(function(r){return e(r)===t?n(r):NaN},r,t+"")}(t,n,r,o)}),as:a.map(function(t){return t+""}),modified:t.modified.bind(t)}}(t,e),e)},Object(H.y)(ko,Yi).transform=function(t,e){var n=this,r=t.subflow,i=t.field;return(t.modified("field")||i&&e.modified(Object(H.g)(i)))&&Object(H.n)("PreFacet does not support field modification."),this._targets.active=0,e.visit(e.MOD,function(t){var o=n.subflow(Y(t),r,e,t);i?i(t).forEach(function(t){o.mod(t)}):o.mod(t)}),e.visit(e.ADD,function(t){var o=n.subflow(Y(t),r,e,t);i?i(t).forEach(function(t){o.add(Z(t))}):o.add(t)}),e.visit(e.REM,function(t){var o=n.subflow(Y(t),r,e,t);i?i(t).forEach(function(t){o.rem(t)}):o.rem(t)}),e},So.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},Object(H.y)(So,Tr).transform=function(t,e){var n,r,i=t.fields,o=eo(t.fields,t.as||[]),a=i?function(t,e){return function(t,e,n,r){for(var i=0,o=n.length;i<o;++i)e[r[i]]=n[i](t);return e}(t,e,i,o)}:tt;return this.value?r=this.value:(e=e.addAll(),r=this.value={}),n=e.fork(e.NO_SOURCE),e.visit(e.REM,function(t){var e=Y(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,function(t){var e=a(t,Z({}));r[Y(t)]=e,n.add.push(e)}),e.visit(e.MOD,function(t){n.mod.push(a(t,r[Y(t)]))}),n},Object(H.y)(Eo,Tr).transform=function(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation},Object(H.y)(Oo,Tr).transform=function(t,e){var n,r;return this.value?r=this.value:(n=e=e.addAll(),r=this.value={}),t.derive&&(n=e.fork(e.NO_SOURCE),e.visit(e.REM,function(t){var e=Y(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,function(t){var e=Q(t);r[Y(t)]=e,n.add.push(e)}),e.visit(e.MOD,function(t){n.mod.push(tt(t,r[Y(t)]))})),n},Ao.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},Object(H.y)(Ao,Tr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.modified("size"),i=t.size,o=this.value,a=this.count,s=0,u=o.reduce(function(t,e){return t[Y(e)]=1,t},{});function c(t){var e,r;o.length<i?o.push(t):(r=~~((a+1)*$r()))<o.length&&r>=s&&(e=o[r],u[Y(e)]&&n.rem.push(e),o[r]=t),++a}if(e.rem.length&&(e.visit(e.REM,function(t){var e=Y(t);u[e]&&(u[e]=-1,n.rem.push(t)),--a}),o=o.filter(function(t){return-1!==u[Y(t)]})),(e.rem.length||r)&&o.length<i&&e.source&&(s=a=o.length,e.visit(e.SOURCE,function(t){u[Y(t)]||c(t)}),s=-1),r&&o.length>i){for(var l=0,f=o.length-i;l<f;++l)u[Y(o[l])]=-1,n.rem.push(o[l]);o=o.slice(f)}return e.mod.length&&e.visit(e.MOD,function(t){u[Y(t)]&&n.mod.push(t)}),e.add.length&&e.visit(e.ADD,c),(e.add.length||s<0)&&(n.add=o.filter(function(t){return!u[Y(t)]})),this.count=a,this.value=n.source=o,n},Co.Definition={type:"Sequence",metadata:{changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},Object(H.y)(Co,Tr).transform=function(t,e){if(!this.value||t.modified()){var n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=Ui(t.start,t.stop,t.step||1).map(function(t){var e={};return e[r]=t,Z(e)}),n.add=e.add.concat(this.value),n}},Object(H.y)(Mo,Tr).transform=function(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation},Object(H.y)(No,Tr).transform=function(t,e){var n=e.dataflow,r=t.field,i=this.value,o=!0;function a(t){i.set(r(t),t)}return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,a)):e.changed()?(e.visit(e.REM,function(t){i.delete(r(t))}),e.visit(e.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()},Object(H.y)(To,Tr).transform=function(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(t.sort):e.source).map(t.field))};var Io={row_number:function(){return{next:function(t){return t.index+1}}},rank:function(){var t;return{init:function(){t=1},next:function(e){var n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){var t;return{init:function(){t=1},next:function(e){var n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){var t=Io.rank(),e=t.next;return{init:t.init,next:function(t){return(e(t)-1)/(t.data.length-1)}}},cume_dist:function(){var t;return{init:function(){t=0},next:function(e){var n=e.index,r=e.data,i=e.compare;if(t<n){for(;n+1<r.length&&!i(r[n],r[n+1]);)++n;t=n}return(1+t)/r.length}}},ntile:function(t,e){(e=+e)>0||Object(H.n)("ntile num must be greater than zero.");var n=Io.cume_dist(),r=n.next;return{init:n.init,next:function(t){return Math.ceil(e*r(t))}}},lag:function(t,e){return e=+e||1,{next:function(n){var r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:function(n){var r=n.index+e,i=n.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:function(e){return t(e.data[e.i0])}}},last_value:function(t){return{next:function(e){return t(e.data[e.i1-1])}}},nth_value:function(t,e){return(e=+e)>0||Object(H.n)("nth_value nth must be greater than zero."),{next:function(n){var r=n.i0+(e-1);return r<n.i1?t(n.data[r]):null}}}},Do=Object.keys(Io);function jo(t){var e=Object(H.i)(t.ops),n=Object(H.i)(t.fields),r=Object(H.i)(t.params),i=Object(H.i)(t.as),o=this.outputs=[],a=this.windows=[],s={},u={},c=!0,l=[],f=[];function d(t){Object(H.i)(Object(H.g)(t)).forEach(function(t){s[t]=1})}d(t.sort),e.forEach(function(t,e){var s=n[e],h=Object(H.h)(s),p=Pr(t,h,i[e]);if(d(s),o.push(p),Io.hasOwnProperty(t))a.push(function(t,e,n,r){var i=Io[t](e,n);return{init:i.init||H.Ha,update:function(t,e){e[r]=i.next(t)}}}(t,n[e],r[e],p));else{if(null==s&&"count"!==t&&Object(H.n)("Null aggregate field specified."),"count"===t)return void l.push(p);c=!1;var m=u[h];m||((m=u[h]=[]).field=s,f.push(m)),m.push(Br(t,p))}}),(l.length||f.length)&&(this.cell=function(t,e,n){t=t.map(function(t){return qr(t,t.field)});var r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,o=r.agg=Array(i),a=0;a<i;++a)o[a]=new t[a](r);if(r.store)var s=r.data=new Ei;return r.add=function(t){if(r.num+=1,!n){s&&s.add(t);for(var e=0;e<i;++e)o[e].add(o[e].get(t),t)}},r.rem=function(t){if(r.num-=1,!n){s&&s.rem(t);for(var e=0;e<i;++e)o[e].rem(o[e].get(t),t)}},r.set=function(t){var i,a;for(s&&s.values(),i=0,a=e.length;i<a;++i)t[e[i]]=r.num;if(!n)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,s&&s.reset();for(var t=0;t<i;++t)o[t].init()},r}(f,l,c)),this.inputs=Object.keys(s)}var Ro=jo.prototype;Ro.init=function(){this.windows.forEach(function(t){t.init()}),this.cell&&this.cell.init()},Ro.update=function(t,e){var n,r=this.cell,i=this.windows,o=t.data,a=i&&i.length;if(r){for(n=t.p0;n<t.i0;++n)r.rem(o[n]);for(n=t.p1;n<t.i1;++n)r.add(o[n]);r.set(e)}for(n=0;n<a;++n)i[n].update(t,e)};var Fo=function(t){return 1===t.length&&(t=function(t){return function(e,n){return Kr(t(e),n)}}(t)),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}};function Po(t){Tr.call(this,{},t),this._mlen=0,this._mods=[]}Po.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Do.concat(Lr)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]};var zo=Object(H.y)(Po,Tr);function Lo(t,e,n){var r=n.sort,i=r&&!n.ignorePeers,o=n.frame||[null,0],a=t.data(r),s=a.length,u=0,c=i?Fo(r):null,l={i0:0,i1:0,p0:0,p1:0,index:0,data:a,compare:r||Object(H.l)(-1)};for(e.init();u<s;++u)Bo(l,o,u,s),i&&Uo(l,c),e.update(l,a[u])}function Bo(t,e,n,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==e[0]?0:Math.max(0,n-Math.abs(e[0])),t.i1=null==e[1]?r:Math.min(r,n+Math.abs(e[1])+1),t.index=n}function Uo(t,e){var n=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;n>0&&!i(o[n],o[n-1])&&(t.i0=e.left(o,o[n])),r<a&&!i(o[r],o[r+1])&&(t.i1=e.right(o,o[r]))}zo.transform=function(t,e){var n,r,i=this,o=i.state,a=t.modified();this.stamp=e.stamp,o&&!a||(o=i.state=new jo(t));var s=Fr(t.groupby);function u(t){return i.group(s(t))}for(a||e.modified(o.inputs)?(i.value={},e.visit(e.SOURCE,function(t){u(t).add(t)})):(e.visit(e.REM,function(t){u(t).remove(t)}),e.visit(e.ADD,function(t){u(t).add(t)})),n=0,r=i._mlen;n<r;++n)Lo(i._mods[n],o,t);return i._mlen=0,i._mods=[],e.reflow(a).modifies(o.outputs)},zo.group=function(t){var e=this.value[t];return e||((e=this.value[t]=Ti(Y)).stamp=-1),e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e),e};var Wo="top",qo="left",Vo="right",Ho="bottom",$o="top-left",Go="top-right",Ko="bottom-left",Xo="bottom-right",Yo="group",Jo="axis",Zo="legend",Qo="row-header",ta="row-footer",ea="row-title",na="column-header",ra="column-footer",ia="column-title",oa="symbol",aa="all",sa="each",ua="flush",ca="column",la="row";function fa(t){this.clear(),t&&this.union(t)}var da=fa.prototype;da.clone=function(){return new fa(this)},da.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},da.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},da.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},da.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},da.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},da.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},da.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},da.rotate=function(t,e,n){var r=Math.cos(t),i=Math.sin(t),o=e-e*r+n*i,a=n-e*i-n*r,s=this.x1,u=this.x2,c=this.y1,l=this.y2;return this.clear().add(r*s-i*c+o,i*s+r*c+a).add(r*s-i*l+o,i*s+r*l+a).add(r*u-i*c+o,i*u+r*c+a).add(r*u-i*l+o,i*u+r*l+a)},da.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},da.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},da.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},da.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},da.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},da.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},da.width=function(){return this.x2-this.x1},da.height=function(){return this.y2-this.y1};var ha=0,pa=function(t,e){var n,r=[];return n={id:"gradient_"+ha++,x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}};function ma(t){this.mark=t,this.bounds=this.bounds||new fa}function ga(t){ma.call(this,t),this.items=this.items||[]}function va(t,e){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}function ba(t){this._pending=0,this._loader=t||bt()}Object(H.y)(ga,ma);var ya=ba.prototype;function wa(t){t._pending+=1}function xa(t){t._pending-=1}ya.pending=function(){return this._pending},ya.sanitizeURL=function(t){var e=this;return wa(e),e._loader.sanitize(t,{context:"href"}).then(function(t){return xa(e),t}).catch(function(){return xa(e),null})},ya.loadImage=function(t){var e=this,n="undefined"!=typeof Image?Image:null;return wa(e),e._loader.sanitize(t,{context:"image"}).then(function(t){var r=t.href;if(!r||!n)throw{url:r};var i=new n;return i.onload=function(){xa(e),i.loaded=!0},i.onerror=function(){xa(e),i.loaded=!1},i.src=r,i}).catch(function(t){return xa(e),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},ya.ready=function(){var t=this;return new Promise(function(e){!function n(r){t.pending()?setTimeout(function(){n(!0)},10):e(r)}(!1)})};var _a=Math.PI,ka=2*_a,Sa=ka-1e-6;function Ea(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Oa(){return new Ea}Ea.prototype=Oa.prototype={constructor:Ea,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var o=this._x1,a=this._y1,s=n-t,u=r-e,c=o-t,l=a-e,f=c*c+l*l;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>1e-6)if(Math.abs(l*s-u*c)>1e-6&&i){var d=n-o,h=r-a,p=s*s+u*u,m=d*d+h*h,g=Math.sqrt(p),v=Math.sqrt(f),b=i*Math.tan((_a-Math.acos((p+f-m)/(2*g*v)))/2),y=b/v,w=b/g;Math.abs(y-1)>1e-6&&(this._+="L"+(t+y*c)+","+(e+y*l)),this._+="A"+i+","+i+",0,0,"+ +(l*d>c*h)+","+(this._x1=t+w*s)+","+(this._y1=e+w*u)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),s=n*Math.sin(r),u=t+a,c=e+s,l=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+u+","+c:(Math.abs(this._x1-u)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+u+","+c),n&&(f<0&&(f=f%ka+ka),f>Sa?this._+="A"+n+","+n+",0,1,"+l+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+l+","+(this._x1=u)+","+(this._y1=c):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=_a)+","+l+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var Aa=Oa,Ca=function(t){return function(){return t}},Ma=Math.abs,Na=Math.atan2,Ta=Math.cos,Ia=Math.max,Da=Math.min,ja=Math.sin,Ra=Math.sqrt,Fa=1e-12,Pa=Math.PI,za=Pa/2,La=2*Pa;function Ba(t){return t>=1?za:t<=-1?-za:Math.asin(t)}function Ua(t){return t.innerRadius}function Wa(t){return t.outerRadius}function qa(t){return t.startAngle}function Va(t){return t.endAngle}function Ha(t){return t&&t.padAngle}function $a(t,e,n,r,i,o,a){var s=t-n,u=e-r,c=(a?o:-o)/Ra(s*s+u*u),l=c*u,f=-c*s,d=t+l,h=e+f,p=n+l,m=r+f,g=(d+p)/2,v=(h+m)/2,b=p-d,y=m-h,w=b*b+y*y,x=i-o,_=d*m-p*h,k=(y<0?-1:1)*Ra(Ia(0,x*x*w-_*_)),S=(_*y-b*k)/w,E=(-_*b-y*k)/w,O=(_*y+b*k)/w,A=(-_*b+y*k)/w,C=S-g,M=E-v,N=O-g,T=A-v;return C*C+M*M>N*N+T*T&&(S=O,E=A),{cx:S,cy:E,x01:-l,y01:-f,x11:S*(i/x-1),y11:E*(i/x-1)}}function Ga(t){this._context=t}Ga.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Ka=function(t){return new Ga(t)};function Xa(t){return t[0]}function Ya(t){return t[1]}var Ja=function(){var t=Xa,e=Ya,n=Ca(!0),r=null,i=Ka,o=null;function a(a){var s,u,c,l=a.length,f=!1;for(null==r&&(o=i(c=Aa())),s=0;s<=l;++s)!(s<l&&n(u=a[s],s,a))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(u,s,a),+e(u,s,a));if(c)return o=null,c+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:Ca(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:Ca(+t),a):e},a.defined=function(t){return arguments.length?(n="function"==typeof t?t:Ca(!!t),a):n},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},Za=function(){var t=Xa,e=null,n=Ca(0),r=Ya,i=Ca(!0),o=null,a=Ka,s=null;function u(u){var c,l,f,d,h,p=u.length,m=!1,g=new Array(p),v=new Array(p);for(null==o&&(s=a(h=Aa())),c=0;c<=p;++c){if(!(c<p&&i(d=u[c],c,u))===m)if(m=!m)l=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=c-1;f>=l;--f)s.point(g[f],v[f]);s.lineEnd(),s.areaEnd()}m&&(g[c]=+t(d,c,u),v[c]=+n(d,c,u),s.point(e?+e(d,c,u):g[c],r?+r(d,c,u):v[c]))}if(h)return s=null,h+""||null}function c(){return Ja().defined(i).curve(a).context(o)}return u.x=function(n){return arguments.length?(t="function"==typeof n?n:Ca(+n),e=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:Ca(+e),u):t},u.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:Ca(+t),u):e},u.y=function(t){return arguments.length?(n="function"==typeof t?t:Ca(+t),r=null,u):n},u.y0=function(t){return arguments.length?(n="function"==typeof t?t:Ca(+t),u):n},u.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Ca(+t),u):r},u.lineX0=u.lineY0=function(){return c().x(t).y(n)},u.lineY1=function(){return c().x(t).y(r)},u.lineX1=function(){return c().x(e).y(n)},u.defined=function(t){return arguments.length?(i="function"==typeof t?t:Ca(!!t),u):i},u.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),u):a},u.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),u):o},u};function Qa(t){this._curve=t}!function(t){function e(e){return new Qa(t(e))}e._curve=t}(Ka),Qa.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}},Array.prototype.slice;var ts={draw:function(t,e){var n=Math.sqrt(e/Pa);t.moveTo(n,0),t.arc(0,0,n,0,La)}},es=(Math.sqrt(1/3),Math.sin(Pa/10),Math.sin(7*Pa/10),Math.sin(La/10),Math.cos(La/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12),function(){});function ns(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function rs(t){this._context=t}function is(t){this._context=t}function os(t){this._context=t}function as(t,e){this._basis=new rs(t),this._beta=e}rs.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:ns(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ns(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},is.prototype={areaStart:es,areaEnd:es,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ns(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},os.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ns(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},as.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,u=-1;++u<=n;)r=u/n,this._basis.point(this._beta*t[u]+(1-this._beta)*(i+r*a),this._beta*e[u]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var ss=function t(e){function n(t){return 1===e?new rs(t):new as(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function us(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function cs(t,e){this._context=t,this._k=(1-e)/6}cs.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:us(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var ls=function t(e){function n(t){return new cs(t,e)}return n.tension=function(e){return t(+e)},n}(0);function fs(t,e){this._context=t,this._k=(1-e)/6}fs.prototype={areaStart:es,areaEnd:es,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var ds=function t(e){function n(t){return new fs(t,e)}return n.tension=function(e){return t(+e)},n}(0);function hs(t,e){this._context=t,this._k=(1-e)/6}hs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var ps=function t(e){function n(t){return new hs(t,e)}return n.tension=function(e){return t(+e)},n}(0);function ms(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Fa){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>Fa){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/l,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function gs(t,e){this._context=t,this._alpha=e}gs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:ms(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var vs=function t(e){function n(t){return e?new gs(t,e):new cs(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function bs(t,e){this._context=t,this._alpha=e}bs.prototype={areaStart:es,areaEnd:es,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ms(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var ys=function t(e){function n(t){return e?new bs(t,e):new fs(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function ws(t,e){this._context=t,this._alpha=e}ws.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ms(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var xs=function t(e){function n(t){return e?new ws(t,e):new hs(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function _s(t){this._context=t}function ks(t){return t<0?-1:1}function Ss(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(ks(o)+ks(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Es(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Os(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function As(t){this._context=t}function Cs(t){this._context=new Ms(t)}function Ms(t){this._context=t}function Ns(t){this._context=t}function Ts(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function Is(t,e){this._context=t,this._t=e}_s.prototype={areaStart:es,areaEnd:es,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},As.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:Os(this,this._t0,Es(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Os(this,Es(this,n=Ss(this,t,e)),n);break;default:Os(this,this._t0,n=Ss(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Cs.prototype=Object.create(As.prototype)).point=function(t,e){As.prototype.point.call(this,e,t)},Ms.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},Ns.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=Ts(t),i=Ts(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},Is.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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Ds={basis:{curve:function(t){return new rs(t)}},"basis-closed":{curve:function(t){return new is(t)}},"basis-open":{curve:function(t){return new os(t)}},bundle:{curve:ss,tension:"beta",value:.85},cardinal:{curve:ls,tension:"tension",value:0},"cardinal-open":{curve:ps,tension:"tension",value:0},"cardinal-closed":{curve:ds,tension:"tension",value:0},"catmull-rom":{curve:vs,tension:"alpha",value:.5},"catmull-rom-closed":{curve:ys,tension:"alpha",value:.5},"catmull-rom-open":{curve:xs,tension:"alpha",value:.5},linear:{curve:Ka},"linear-closed":{curve:function(t){return new _s(t)}},monotone:{horizontal:function(t){return new Cs(t)},vertical:function(t){return new As(t)}},natural:{curve:function(t){return new Ns(t)}},step:{curve:function(t){return new Is(t,.5)}},"step-after":{curve:function(t){return new Is(t,1)}},"step-before":{curve:function(t){return new Is(t,0)}}};function js(t,e,n){var r=Ds.hasOwnProperty(t)&&Ds[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var Rs={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},Fs=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/],Ps=function(t){var e,n,r,i,o,a,s,u,c,l,f,d=[];for(u=0,l=(e=t.slice().replace(Fs[0],"###$1").split(Fs[1]).slice(1)).length;u<l;++u){for(r=(n=e[u]).slice(1).trim().replace(Fs[2],"$1###$2").split(Fs[3]),i=[a=n.charAt(0)],c=0,f=r.length;c<f;++c)(o=+r[c])===o&&i.push(o);if(s=Rs[a.toLowerCase()],i.length-1>s)for(c=1,f=i.length;c<f;c+=s)d.push([a].concat(i.slice(c,c+s)));else d.push(i)}return d},zs={},Ls={},Bs=[].join;function Us(t){var e=Bs.call(t);if(Ls[e])return Ls[e];var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],l=c*a,f=-u*s,d=u*a,h=c*s,p=Math.cos(i),m=Math.sin(i),g=Math.cos(o),v=Math.sin(o),b=.5*(o-i),y=Math.sin(.5*b),w=8/3*y*y/Math.sin(b),x=n+p-w*m,_=r+m+w*p,k=n+g,S=r+v,E=k+w*v,O=S-w*g;return Ls[e]=[l*x+f*_,d*x+h*_,l*E+f*O,d*E+h*O,l*k+f*S,d*k+h*S]}var Ws=["l",0,0,0,0,0,0,0];function qs(t,e){var n=Ws[0]=t[0];if("a"===n||"A"===n)Ws[1]=e*t[1],Ws[2]=e*t[2],Ws[3]=t[3],Ws[4]=t[4],Ws[5]=t[5],Ws[6]=e*t[6],Ws[7]=e*t[7];else for(var r=1,i=t.length;r<i;++r)Ws[r]=e*t[r];return Ws}var Vs=function(t,e,n,r,i){var o,a,s,u,c,l=null,f=0,d=0,h=0,p=0;null==n&&(n=0),null==r&&(r=0),null==i&&(i=1),t.beginPath&&t.beginPath();for(var m=0,g=e.length;m<g;++m){switch(o=e[m],1!==i&&(o=qs(o,i)),o[0]){case"l":f+=o[1],d+=o[2],t.lineTo(f+n,d+r);break;case"L":f=o[1],d=o[2],t.lineTo(f+n,d+r);break;case"h":f+=o[1],t.lineTo(f+n,d+r);break;case"H":f=o[1],t.lineTo(f+n,d+r);break;case"v":d+=o[1],t.lineTo(f+n,d+r);break;case"V":d=o[1],t.lineTo(f+n,d+r);break;case"m":f+=o[1],d+=o[2],t.moveTo(f+n,d+r);break;case"M":f=o[1],d=o[2],t.moveTo(f+n,d+r);break;case"c":a=f+o[5],s=d+o[6],h=f+o[3],p=d+o[4],t.bezierCurveTo(f+o[1]+n,d+o[2]+r,h+n,p+r,a+n,s+r),f=a,d=s;break;case"C":f=o[5],d=o[6],h=o[3],p=o[4],t.bezierCurveTo(o[1]+n,o[2]+r,h+n,p+r,f+n,d+r);break;case"s":a=f+o[3],s=d+o[4],h=2*f-h,p=2*d-p,t.bezierCurveTo(h+n,p+r,f+o[1]+n,d+o[2]+r,a+n,s+r),h=f+o[1],p=d+o[2],f=a,d=s;break;case"S":a=o[3],s=o[4],h=2*f-h,p=2*d-p,t.bezierCurveTo(h+n,p+r,o[1]+n,o[2]+r,a+n,s+r),f=a,d=s,h=o[1],p=o[2];break;case"q":a=f+o[3],s=d+o[4],h=f+o[1],p=d+o[2],t.quadraticCurveTo(h+n,p+r,a+n,s+r),f=a,d=s;break;case"Q":a=o[3],s=o[4],t.quadraticCurveTo(o[1]+n,o[2]+r,a+n,s+r),f=a,d=s,h=o[1],p=o[2];break;case"t":a=f+o[1],s=d+o[2],null===l[0].match(/[QqTt]/)?(h=f,p=d):"t"===l[0]?(h=2*f-u,p=2*d-c):"q"===l[0]&&(h=2*f-h,p=2*d-p),u=h,c=p,t.quadraticCurveTo(h+n,p+r,a+n,s+r),d=s,h=(f=a)+o[1],p=d+o[2];break;case"T":a=o[1],s=o[2],h=2*f-h,p=2*d-p,t.quadraticCurveTo(h+n,p+r,a+n,s+r),f=a,d=s;break;case"a":Hs(t,f+n,d+r,[o[1],o[2],o[3],o[4],o[5],o[6]+f+n,o[7]+d+r]),f+=o[6],d+=o[7];break;case"A":Hs(t,f+n,d+r,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+r]),f=o[6],d=o[7];break;case"z":case"Z":t.closePath()}l=o}};function Hs(t,e,n,r){for(var i=function(t,e,n,r,i,o,a,s,u){var c=Bs.call(arguments);if(zs[c])return zs[c];var l=a*(Math.PI/180),f=Math.sin(l),d=Math.cos(l),h=d*(s-t)*.5+f*(u-e)*.5,p=d*(u-e)*.5-f*(s-t)*.5,m=h*h/((n=Math.abs(n))*n)+p*p/((r=Math.abs(r))*r);m>1&&(n*=m=Math.sqrt(m),r*=m);var g=d/n,v=f/n,b=-f/r,y=d/r,w=g*s+v*u,x=b*s+y*u,_=g*t+v*e,k=b*t+y*e,S=1/((_-w)*(_-w)+(k-x)*(k-x))-.25;S<0&&(S=0);var E=Math.sqrt(S);o==i&&(E=-E);var O=.5*(w+_)-E*(k-x),A=.5*(x+k)+E*(_-w),C=Math.atan2(x-A,w-O),M=Math.atan2(k-A,_-O)-C;M<0&&1===o?M+=2*Math.PI:M>0&&0===o&&(M-=2*Math.PI);for(var N=Math.ceil(Math.abs(M/(.5*Math.PI+.001))),T=[],I=0;I<N;++I){var D=C+I*M/N,j=C+(I+1)*M/N;T[I]=[O,A,D,j,n,r,f,d]}return zs[c]=T}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,n),o=0;o<i.length;++o){var a=Us(i[o]);t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5])}}var $s=2*Math.PI,Gs=Math.sqrt(3)/2,Ks={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,$s)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/2.5;t.moveTo(-n,-r),t.lineTo(-n,r),t.lineTo(-r,r),t.lineTo(-r,n),t.lineTo(r,n),t.lineTo(r,r),t.lineTo(n,r),t.lineTo(n,-r),t.lineTo(r,-r),t.lineTo(r,-n),t.lineTo(-r,-n),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Gs*n;t.moveTo(0,-r),t.lineTo(-n,r),t.lineTo(n,r),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Gs*n;t.moveTo(0,r),t.lineTo(-n,-r),t.lineTo(n,-r),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Gs*n;t.moveTo(r,0),t.lineTo(-r,-n),t.lineTo(-r,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Gs*n;t.moveTo(-r,0),t.lineTo(r,-n),t.lineTo(r,n),t.closePath()}}};function Xs(t){return Ks.hasOwnProperty(t)?Ks[t]:function(t){if(!Ys.hasOwnProperty(t)){var e=Ps(t);Ys[t]={draw:function(t,n){Vs(t,e,0,0,Math.sqrt(n)/2)}}}return Ys[t]}(t)}var Ys={};function Js(t){return t.x}function Zs(t){return t.y}function Qs(t){return t.width}function tu(t){return t.height}function eu(t){return function(){return t}}var nu=function(){var t=Js,e=Zs,n=Qs,r=tu,i=eu(0),o=null;function a(a,s,u){var c,l=null!=s?s:+t.call(this,a),f=null!=u?u:+e.call(this,a),d=+n.call(this,a),h=+r.call(this,a),p=+i.call(this,a);if(o||(o=c=Aa()),p<=0)o.rect(l,f,d,h);else{var m=l+d,g=f+h;o.moveTo(l+p,f),o.lineTo(m-p,f),o.quadraticCurveTo(m,f,m,f+p),o.lineTo(m,g-p),o.quadraticCurveTo(m,g,m-p,g),o.lineTo(l+p,g),o.quadraticCurveTo(l,g,l,g-p),o.lineTo(l,f+p),o.quadraticCurveTo(l,f,l+p,f),o.closePath()}if(c)return o=null,c+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:eu(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:eu(+t),a):e},a.width=function(t){return arguments.length?(n="function"==typeof t?t:eu(+t),a):n},a.height=function(t){return arguments.length?(r="function"==typeof t?t:eu(+t),a):r},a.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:eu(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},ru=Math.PI,iu=function(){var t,e,n,r,i,o,a,s,u=null;function c(t,e,n){var r=n/2;if(i){var c=a-e,l=t-o;if(c||l){var f=Math.sqrt(c*c+l*l),d=(c/=f)*s,h=(l/=f)*s,p=Math.atan2(l,c);u.moveTo(o-d,a-h),u.lineTo(t-c*r,e-l*r),u.arc(t,e,r,p-ru,p),u.lineTo(o+d,a+h),u.arc(o,a,s,p,p+ru)}else u.arc(t,e,r,0,2*ru);u.closePath()}else i=1;o=t,a=e,s=r}function l(o){var a,s,l,f=o.length,d=!1;for(null==u&&(u=l=Aa()),a=0;a<=f;++a)!(a<f&&r(s=o[a],a,o))===d&&(d=!d)&&(i=0),d&&c(+t(s,a,o),+e(s,a,o),+n(s,a,o));if(l)return u=null,l+""||null}return l.x=function(e){return arguments.length?(t=e,l):t},l.y=function(t){return arguments.length?(e=t,l):e},l.size=function(t){return arguments.length?(n=t,l):n},l.defined=function(t){return arguments.length?(r=t,l):r},l.context=function(t){return arguments.length?(u=null==t?null:t,l):u},l};function ou(t){return t.x||0}function au(t){return t.y||0}function su(t){return t.cornerRadius||0}function uu(t){return!(!1===t.defined)}var cu=function(){var t=Ua,e=Wa,n=Ca(0),r=null,i=qa,o=Va,a=Ha,s=null;function u(){var u,c,l=+t.apply(this,arguments),f=+e.apply(this,arguments),d=i.apply(this,arguments)-za,h=o.apply(this,arguments)-za,p=Ma(h-d),m=h>d;if(s||(s=u=Aa()),f<l&&(c=f,f=l,l=c),f>Fa)if(p>La-Fa)s.moveTo(f*Ta(d),f*ja(d)),s.arc(0,0,f,d,h,!m),l>Fa&&(s.moveTo(l*Ta(h),l*ja(h)),s.arc(0,0,l,h,d,m));else{var g,v,b=d,y=h,w=d,x=h,_=p,k=p,S=a.apply(this,arguments)/2,E=S>Fa&&(r?+r.apply(this,arguments):Ra(l*l+f*f)),O=Da(Ma(f-l)/2,+n.apply(this,arguments)),A=O,C=O;if(E>Fa){var M=Ba(E/l*ja(S)),N=Ba(E/f*ja(S));(_-=2*M)>Fa?(w+=M*=m?1:-1,x-=M):(_=0,w=x=(d+h)/2),(k-=2*N)>Fa?(b+=N*=m?1:-1,y-=N):(k=0,b=y=(d+h)/2)}var T=f*Ta(b),I=f*ja(b),D=l*Ta(x),j=l*ja(x);if(O>Fa){var R,F=f*Ta(y),P=f*ja(y),z=l*Ta(w),L=l*ja(w);if(p<Pa&&(R=function(t,e,n,r,i,o,a,s){var u=z-T,c=L-I,l=D-F,f=j-P,d=f*u-l*c;if(!(d*d<Fa))return[T+(d=(l*(I-P)-f*(T-F))/d)*u,I+d*c]}())){var B=T-R[0],U=I-R[1],W=F-R[0],q=P-R[1],V=1/ja(function(t){return t>1?0:t<-1?Pa:Math.acos(t)}((B*W+U*q)/(Ra(B*B+U*U)*Ra(W*W+q*q)))/2),H=Ra(R[0]*R[0]+R[1]*R[1]);A=Da(O,(l-H)/(V-1)),C=Da(O,(f-H)/(V+1))}}k>Fa?C>Fa?(g=$a(z,L,T,I,f,C,m),v=$a(F,P,D,j,f,C,m),s.moveTo(g.cx+g.x01,g.cy+g.y01),C<O?s.arc(g.cx,g.cy,C,Na(g.y01,g.x01),Na(v.y01,v.x01),!m):(s.arc(g.cx,g.cy,C,Na(g.y01,g.x01),Na(g.y11,g.x11),!m),s.arc(0,0,f,Na(g.cy+g.y11,g.cx+g.x11),Na(v.cy+v.y11,v.cx+v.x11),!m),s.arc(v.cx,v.cy,C,Na(v.y11,v.x11),Na(v.y01,v.x01),!m))):(s.moveTo(T,I),s.arc(0,0,f,b,y,!m)):s.moveTo(T,I),l>Fa&&_>Fa?A>Fa?(g=$a(D,j,F,P,l,-A,m),v=$a(T,I,z,L,l,-A,m),s.lineTo(g.cx+g.x01,g.cy+g.y01),A<O?s.arc(g.cx,g.cy,A,Na(g.y01,g.x01),Na(v.y01,v.x01),!m):(s.arc(g.cx,g.cy,A,Na(g.y01,g.x01),Na(g.y11,g.x11),!m),s.arc(0,0,l,Na(g.cy+g.y11,g.cx+g.x11),Na(v.cy+v.y11,v.cx+v.x11),m),s.arc(v.cx,v.cy,A,Na(v.y11,v.x11),Na(v.y01,v.x01),!m))):s.arc(0,0,l,x,w,m):s.lineTo(D,j)}else s.moveTo(0,0);if(s.closePath(),u)return s=null,u+""||null}return u.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-Pa/2;return[Ta(r)*n,ja(r)*n]},u.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Ca(+e),u):t},u.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Ca(+t),u):e},u.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Ca(+t),u):n},u.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Ca(+t),u):r},u.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Ca(+t),u):i},u.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:Ca(+t),u):o},u.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ca(+t),u):a},u.context=function(t){return arguments.length?(s=null==t?null:t,u):s},u}().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(su),lu=Za().x(ou).y1(au).y0(function(t){return(t.y||0)+(t.height||0)}).defined(uu),fu=Za().y(au).x1(ou).x0(function(t){return(t.x||0)+(t.width||0)}).defined(uu),du=Ja().x(ou).y(au).defined(uu),hu=nu().x(ou).y(au).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(su),pu=function(){var t=Ca(ts),e=Ca(64),n=null;function r(){var r;if(n||(n=r=Aa()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(e){return arguments.length?(t="function"==typeof e?e:Ca(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:Ca(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type(function(t){return Xs(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),mu=iu().x(ou).y(au).defined(uu).size(function(t){return t.size||1});function gu(t,e,n,r){return hu.context(t)(e,n,r)}var vu,bu=function(t,e){return e.stroke&&0!==e.opacity&&0!==e.strokeOpacity&&t.expand(null!=e.strokeWidth?+e.strokeWidth:1),t},yu=2*Math.PI,wu=yu/4,xu=yu-1e-8;function _u(t){return vu=t,_u}function ku(){}function Su(t,e){vu.add(t,e)}_u.beginPath=ku,_u.closePath=ku,_u.moveTo=Su,_u.lineTo=Su,_u.rect=function(t,e,n,r){Su(t,e),Su(t+n,e+r)},_u.quadraticCurveTo=function(t,e,n,r){Su(t,e),Su(n,r)},_u.bezierCurveTo=function(t,e,n,r,i,o){Su(t,e),Su(n,r),Su(i,o)},_u.arc=function(t,e,n,r,i,o){if(Math.abs(i-r)>xu)return Su(t-n,e-n),void Su(t+n,e+n);var a,s,u,c,l=1/0,f=-1/0,d=1/0,h=-1/0;function p(t){u=n*Math.cos(t),c=n*Math.sin(t),u<l&&(l=u),u>f&&(f=u),c<d&&(d=c),c>h&&(h=c)}if(p(r),p(i),i!==r)if((r%=yu)<0&&(r+=yu),(i%=yu)<0&&(i+=yu),i<r&&(o=!o,a=r,r=i,i=a),o)for(i-=yu,a=r-r%wu,s=0;s<4&&a>i;++s,a-=wu)p(a);else for(a=r-r%wu+wu,s=0;s<4&&a<i;++s,a+=wu)p(a);Su(t+l,e+d),Su(t+f,e+h)};var Eu=function(t,e,n){return n.id?function(t,e,n){for(var r=n.width(),i=n.height(),o=n.x1+e.x1*r,a=n.y1+e.y1*i,s=n.x1+e.x2*r,u=n.y1+e.y2*i,c=e.stops,l=0,f=c.length,d=t.createLinearGradient(o,a,s,u);l<f;++l)d.addColorStop(c[l].offset,c[l].color);return d}(t,n,e.bounds):n},Ou=function(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=Eu(t,e,e.fill),!0)},Au=[],Cu=function(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&(n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Eu(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||Au),t.lineDashOffset=e.strokeDashOffset||0),!0)};function Mu(t,e){return t.zindex-e.zindex||t.index-e.index}function Nu(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,o=[];for(n=0,r=i.length;n<r;++n)(e=i[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(Mu)}function Tu(t,e){var n,r,i=t.items;if(i&&i.length){var o=Nu(t);if(o&&o.length){for(n=0,r=i.length;n<r;++n)i[n].zindex||e(i[n]);i=o}for(n=0,r=i.length;n<r;++n)e(i[n])}}function Iu(t,e){var n,r,i=t.items;if(!i||!i.length)return null;var o=Nu(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(n=e(i[r]))return n;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Du(t){return function(e,n,r){Tu(n,function(n){r&&!r.intersects(n.bounds)||ju(t,e,n,n)})}}function ju(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(n.fill&&Ou(e,n,i)&&e.fill(),n.stroke&&Cu(e,n,i)&&e.stroke()))}var Ru=function(){return!0};function Fu(t){return t||(t=Ru),function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,Iu(n,function(n){var s=n.bounds;if((!s||s.contains(o,a))&&s)return t(e,n,r,i,o,a)?n:void 0})}}function Pu(t,e){return function(n,r,i,o){var a,s,u=Array.isArray(r)?r[0]:r,c=null==e?u.fill:e,l=u.stroke&&n.isPointInStroke;return l&&(a=u.strokeWidth,s=u.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!t(n,r)&&(c&&n.isPointInPath(i,o)||l&&n.isPointInStroke(i,o))}}function zu(t){return Fu(Pu(t))}var Lu=function(t,e){return"translate("+t+","+e+")"},Bu=function(t){return Lu(t.x||0,t.y||0)},Uu=function(t,e){function n(t,n){var r=n.x||0,i=n.y||0;t.translate(r,i),t.beginPath(),e(t,n),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",Bu(n)),t("d",e(null,n))},bound:function(t,n){return e(_u(t),n),bu(t,n).translate(n.x||0,n.y||0)},draw:Du(n),pick:zu(n)}},Wu=Uu("arc",function(t,e){return cu.context(t)(e)}),qu=function(t,e,n){function r(t,n){t.beginPath(),e(t,n)}var i=Pu(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(_u(t),r),bu(t,r[0]))},draw:function(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||ju(t,e,n.items[0],n.items)}}(r),pick:function(t,e,n,r,o,a){var s=e.items,u=e.bounds;return!s||!s.length||u&&!u.contains(o,a)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,s,n,r)?s[0]:null)},tip:n}},Vu=qu("area",function(t,e){var n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?fu:lu).curve(js(r,n.orient,n.tension)).context(t)(e)},function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,s=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<s&&(s=r,n=t[a]);return n}),Hu=1;function $u(){Hu=1}var Gu=function(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+Hu++),a=i.clipping[o]||(i.clipping[o]={id:o});return Object(H.D)(r)?a.path=r(null):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"},Ku=.5;function Xu(t,e){var n=e.stroke?Ku:0;t.beginPath(),gu(t,e,n,n)}var Yu=Pu(Xu),Ju={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Bu(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,r=0,i=n.length;r<i;++r)t.union(n[r].bounds);return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),bu(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var r=this;Tu(e,function(e){var i,o=e.x||0,a=e.y||0,s=e.width||0,u=e.height||0;t.save(),t.translate(o,a),(e.stroke||e.fill)&&(i=null==e.opacity?1:e.opacity)>0&&(Xu(t,e),e.fill&&Ou(t,e,i)&&t.fill(),e.stroke&&Cu(t,e,i)&&t.stroke()),e.clip&&(t.beginPath(),t.rect(0,0,s,u),t.clip()),n&&n.translate(-o,-a),Tu(e,function(e){r.draw(t,e,n)}),n&&n.translate(o,a),t.restore()})},pick:function(t,e,n,r,i,o){if(e.bounds&&!e.bounds.contains(i,o)||!e.items)return null;var a=this,s=n*t.pixelRatio,u=r*t.pixelRatio;return Iu(e,function(c){var l,f,d,h;if(!(h=c.bounds)||h.contains(i,o))return f=c.x||0,d=c.y||0,t.save(),t.translate(f,d),f=i-f,d=o-d,!(l=Iu(c,function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,f,d)?a.pick(t,n,r,f,d):null}))&&!1!==e.interactive&&(c.fill||c.stroke)&&Yu(t,c,s,u)&&(l=c),t.restore(),l||null})},background:function(t,e){var n=e.stroke?Ku:0;t("class","background"),t("d",gu(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Gu(n,e,e):null)}};function Zu(t,e){var n=t.image;return n&&n.url===t.url||(n={loaded:!1,width:0,height:0},e.loadImage(t.url).then(function(e){t.image=e,t.image.url=t.url})),n}function Qu(t,e){return"center"===t?e/2:"right"===t?e:0}function tc(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var ec={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var r=Zu(e,n),i=e.x||0,o=e.y||0,a=(null!=e.width?e.width:r.width)||0,s=(null!=e.height?e.height:r.height)||0,u=!1===e.aspect?"none":"xMidYMid";i-=Qu(e.align,a),o-=tc(e.baseline,s),t("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Lu(i,o)),t("width",a),t("height",s),t("preserveAspectRatio",u)},bound:function(t,e){var n=e.image,r=e.x||0,i=e.y||0,o=(null!=e.width?e.width:n&&n.width)||0,a=(null!=e.height?e.height:n&&n.height)||0;return r-=Qu(e.align,o),i-=tc(e.baseline,a),t.set(r,i,r+o,i+a)},draw:function(t,e,n){var r=this;Tu(e,function(e){if(!n||n.intersects(e.bounds)){var i,o,a,s,u=Zu(e,r),c=e.x||0,l=e.y||0,f=(null!=e.width?e.width:u.width)||0,d=(null!=e.height?e.height:u.height)||0;c-=Qu(e.align,f),l-=tc(e.baseline,d),!1!==e.aspect&&(o=u.width/u.height,a=e.width/e.height,o==o&&a==a&&o!==a&&(a<o?(l+=(d-(s=f/o))/2,d=s):(c+=(f-(s=d*o))/2,f=s))),u.loaded&&(t.globalAlpha=null!=(i=e.opacity)?i:1,t.drawImage(u,c,l,f,d))}})},pick:Fu(),get:Zu,xOffset:Qu,yOffset:tc},nc=qu("line",function(t,e){var n=e[0],r=n.interpolate||"linear";return du.curve(js(r,n.orient,n.tension)).context(t)(e)},function(t,e){for(var n,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(r=t[o].y-e[1])*r<i)return t[o];return null});function rc(t,e){var n=e.path;if(null==n)return!0;var r=e.pathCache;r&&r.path===n||((e.pathCache=r=Ps(n)).path=n),Vs(t,r,e.x,e.y)}var ic={type:"path",tag:"path",nested:!1,attr:function(t,e){t("transform",Bu(e)),t("d",e.path)},bound:function(t,e){return rc(_u(t),e)?t.set(0,0,0,0):bu(t,e)},draw:Du(rc),pick:zu(rc)};function oc(t,e){t.beginPath(),gu(t,e)}var ac={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",gu(null,e))},bound:function(t,e){var n,r;return bu(t.set(n=e.x||0,r=e.y||0,n+e.width||0,r+e.height||0),e)},draw:Du(oc),pick:zu(oc)};function sc(t,e,n){var r,i,o,a;return!(!e.stroke||!Cu(t,e,n)||(r=e.x||0,i=e.y||0,o=null!=e.x2?e.x2:r,a=null!=e.y2?e.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),0))}var uc,cc,lc={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",Bu(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,r;return bu(t.set(n=e.x||0,r=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:r),e)},draw:function(t,e,n){Tu(e,function(e){if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&sc(t,e,r)&&t.stroke()}})},pick:Fu(function(t,e,n,r){return!!t.isPointInStroke&&sc(t,e,1)&&t.isPointInStroke(n,r)})},fc=Uu("shape",function(t,e){return(e.mark.shape||e.shape).context(t)(e)}),dc=Uu("symbol",function(t,e){return pu.context(t)(e)}),hc={height:bc,measureWidth:gc,estimateWidth:pc,width:pc,canvas:yc};function pc(t){return cc=bc(t),mc(wc(t))}function mc(t){return~~(.8*t.length*cc)}function gc(t){return uc.font=_c(t),vc(wc(t))}function vc(t){return uc.measureText(t).width}function bc(t){return null!=t.fontSize?t.fontSize:11}function yc(t){uc=t&&(uc=va(1,1))?uc.getContext("2d"):null,hc.width=uc?gc:pc}function wc(t){var e=t.text;return null==e?"":t.limit>0?function(t){var e,n=+t.limit,r=t.text+"";if(uc?(uc.font=_c(t),e=vc):(cc=bc(t),e=mc),e(r)<n)return r;var i,o=t.ellipsis||"…",a="rtl"===t.dir,s=0,u=r.length;if(n-=e(o),a){for(;s<u;)i=s+u>>>1,e(r.slice(i))>n?s=i+1:u=i;return o+r.slice(s)}for(;s<u;)i=1+(s+u>>>1),e(r.slice(0,i))<n?s=i:u=i-1;return r.slice(0,s)+o}(t):e+""}function xc(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function _c(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+bc(t)+"px "+xc(t,e)}function kc(t){var e=t.baseline,n=bc(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}yc(!0);var Sc={left:"start",center:"middle",right:"end"},Ec=new fa;function Oc(t,e,n){var r,i,o=hc.height(e),a=e.align,s=e.radius||0,u=e.x||0,c=e.y||0,l=e.dx||0,f=(e.dy||0)+kc(e)-Math.round(.8*o);return s&&(i=(e.theta||0)-Math.PI/2,u+=s*Math.cos(i),c+=s*Math.sin(i)),r=hc.width(e),"center"===a?l-=r/2:"right"===a&&(l-=r),t.set(l+=u,f+=c,l+r,f+o),e.angle&&!n&&t.rotate(e.angle*Math.PI/180,u,c),t.expand(n||!r?0:1)}var Ac={arc:Wu,area:Vu,group:Ju,image:ec,line:nc,path:ic,rect:ac,rule:lc,shape:fc,symbol:dc,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+kc(e),o=e.x||0,a=e.y||0,s=e.angle||0,u=e.radius||0;u&&(n=(e.theta||0)-Math.PI/2,o+=u*Math.cos(n),a+=u*Math.sin(n)),t("text-anchor",Sc[e.align]||"start"),s?(n=Lu(o,a)+" rotate("+s+")",(r||i)&&(n+=" "+Lu(r,i))):n=Lu(o+r,a+i),t("transform",n)},bound:Oc,draw:function(t,e,n){Tu(e,function(e){var r,i,o,a,s,u;n&&!n.intersects(e.bounds)||(u=wc(e))&&0!==(r=null==e.opacity?1:e.opacity)&&(t.font=_c(e),t.textAlign=e.align||"left",i=e.x||0,o=e.y||0,(a=e.radius)&&(s=(e.theta||0)-Math.PI/2,i+=a*Math.cos(s),o+=a*Math.sin(s)),e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*Math.PI/180),i=o=0),i+=e.dx||0,o+=(e.dy||0)+kc(e),e.fill&&Ou(t,e,r)&&t.fillText(u,i,o),e.stroke&&Cu(t,e,r)&&t.strokeText(u,i,o),e.angle&&t.restore())})},pick:Fu(function(t,e,n,r,i,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var a=Oc(Ec,e,!0),s=-e.angle*Math.PI/180,u=Math.cos(s),c=Math.sin(s),l=e.x,f=e.y,d=u*i-c*o+(l-l*u+f*c),h=c*i+u*o+(f-l*c-f*u);return a.contains(d,h)})},trail:qu("trail",function(t,e){return mu.context(t)(e)},function(t,e){for(var n,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null})},Cc=function(t,e,n){var r=Ac[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new fa),t,n)},Mc={mark:null},Nc=function(t,e,n){var r,i,o,a,s=Ac[t.marktype],u=s.bound,c=t.items,l=c&&c.length;if(s.nested)return l?o=c[0]:(Mc.mark=t,o=Mc),a=Cc(o,u,n),e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new fa,l)for(r=0,i=c.length;r<i;++r)e.union(Cc(c[r],u,n));return t.bounds=e},Tc=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function Ic(t,e){return JSON.stringify(t,Tc,e)}function Dc(t){return function t(e){var n,r,i,o=e.marktype,a=e.items;if(a)for(r=0,i=a.length;r<i;++r)n=o?"mark":"group",a[r][n]=e,a[r].zindex&&(a[r][n].zdirty=!0),"group"===(o||n)&&t(a[r]);return o&&Nc(e),e}("string"==typeof t?JSON.parse(t):t)}function jc(t){arguments.length?this.root=Dc(t):(this.root=Fc({marktype:"group",name:"root",role:"frame"}),this.root.items=[new ga(this.root)])}var Rc=jc.prototype;function Fc(t,e){return{bounds:new fa,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Pc(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function zc(t,e){e=e.toLowerCase();for(var n=t.childNodes,r=0,i=n.length;r<i;++r)if(n[r].tagName.toLowerCase()===e)return n[r]}function Lc(t,e,n,r){var i,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(i=o||null,o=Pc(t.ownerDocument,n,r),t.insertBefore(o,i)),o}function Bc(t,e){for(var n=t.childNodes,r=n.length;r>e;)t.removeChild(n[--r]);return t}function Uc(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}Rc.toJSON=function(t){return Ic(this.root,t||0)},Rc.mark=function(t,e,n){var r=Fc(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};var Wc=function(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]};function qc(t,e){this._active=null,this._handlers={},this._loader=t||bt(),this._tooltip=e||Vc}function Vc(t,e,n,r){t.element().setAttribute("title",r||"")}var Hc=qc.prototype;function $c(t){this._el=null,this._bgcolor=null,this._loader=new ba(t)}Hc.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Hc.element=function(){return this._el},Hc.canvas=function(){return this._el&&this._el.firstChild},Hc.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Hc.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Hc.on=function(){},Hc.off=function(){},Hc._handlerIndex=function(t,e,n){for(var r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},Hc.handlers=function(t){var e,n=this._handlers,r=[];if(t)r.push.apply(r,n[this.eventName(t)]);else for(e in n)r.push.apply(r,n[e]);return r},Hc.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Hc.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(function(e){var n=new MouseEvent(t.type,t),r=Pc(null,"a");for(var i in e)r.setAttribute(i,e[i]);r.dispatchEvent(n)}).catch(function(){})},Hc.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,o,a=t&&t.mark;if(a&&(i=Ac[a.marktype]).tip){for((o=Wc(e,n))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(e,t,this.canvas(),this._origin);var r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},Hc.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.x1+r[0]+n.left,a=i.y1+r[1]+n.top,s=i.width(),u=i.height();t.mark&&(t=t.mark.group);)o+=t.x||0,a+=t.y||0;return{x:o,y:a,width:s,height:u,left:o,top:a,right:o+s,bottom:a+u}}};var Gc=$c.prototype;Gc.initialize=function(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},Gc.element=function(){return this._el},Gc.canvas=function(){return this._el&&this._el.firstChild},Gc.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Gc.resize=function(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},Gc.dirty=function(){},Gc.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Gc._render=function(){},Gc.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then(function(){return e}):Promise.resolve(e)},Gc._load=function(t,e){var n=this,r=n._loader[t](e);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then(function(t){t&&i(),n._ready=null})}return r},Gc.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Gc.loadImage=function(t){return this._load("loadImage",t)};var Kc="mouseout";function Xc(t,e){qc.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var Yc=Object(H.y)(Xc,qc);function Jc(t,e,n){return function(r){var i=this._active,o=this.pickEvent(r);o===i?this.fire(t,r):(i&&i.exit||this.fire(n,r),this._active=o,this.fire(e,r),this.fire(t,r))}}function Zc(t){return function(e){this.fire(t,e),this._active=null}}Yc.initialize=function(t,e,n){var r=this._canvas=t&&zc(t,"canvas");if(r){var i=this;this.events.forEach(function(t){r.addEventListener(t,function(e){Yc[t]?Yc[t].call(i,e):i.fire(t,e)})})}return qc.prototype.initialize.call(this,t,e,n)},Yc.canvas=function(){return this._canvas},Yc.context=function(){return this._canvas.getContext("2d")},Yc.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Yc.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Yc.mousemove=Jc("mousemove","mouseover","mouseout"),Yc.dragover=Jc("dragover","dragenter","dragleave"),Yc.mouseout=Zc("mouseout"),Yc.dragleave=Zc("dragleave"),Yc.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Yc.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Yc.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Yc.touchmove=function(t){this.fire("touchmove",t,!0)},Yc.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Yc.fire=function(t,e,n){var r,i,o=n?this._touch:this._active,a=this._handlers[t];if(e.vegaType=t,"click"===t&&o&&o.href?this.handleHref(e,o,o.href):"mousemove"!==t&&t!==Kc||this.handleTooltip(e,o,t!==Kc),a)for(r=0,i=a.length;r<i;++r)a[r].handler.call(this._obj,e,o)},Yc.on=function(t,e){var n=this.eventName(t),r=this._handlers;return this._handlerIndex(r[n],t,e)<0&&(r[n]||(r[n]=[])).push({type:t,handler:e}),this},Yc.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&r.splice(i,1),this},Yc.pickEvent=function(t){var e=Wc(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Yc.pick=function(t,e,n,r,i){var o=this.context();return Ac[t.marktype].pick.call(this,o,t,e,n,r,i)};var Qc="undefined"!=typeof window&&window.devicePixelRatio||1;function tl(t){$c.call(this,t),this._redraw=!1,this._dirty=new fa}var el=Object(H.y)(tl,$c),nl=$c.prototype,rl=new fa;function il(t,e){qc.call(this,t,e);var n=this;n._hrefHandler=al(n,function(t,e){e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=al(n,function(t,e){n.handleTooltip(t,e,t.type!==Kc)})}el.initialize=function(t,e,n,r,i){return this._canvas=va(1,1),t&&(Bc(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),nl.initialize.call(this,t,e,n,r,i)},el.resize=function(t,e,n,r){return nl.resize.call(this,t,e,n,r),function(t,e,n,r,i){var o="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,a=t.getContext("2d"),s=o?Qc:i;t.width=e*s,t.height=n*s,o&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),a.pixelRatio=s,a.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale),this._redraw=!0,this},el.canvas=function(){return this._canvas},el.context=function(){return this._canvas?this._canvas.getContext("2d"):null},el.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=rl.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},el._render=function(t){var e=this.context(),n=this._origin,r=this._width,i=this._height,o=this._dirty;return e.save(),this._redraw||o.empty()?(this._redraw=!1,o=null):o=function(t,e,n){return e.expand(1).round(),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o,n),this.clear(-n[0],-n[1],r,i),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},el.draw=function(t,e,n){var r=Ac[e.marktype];e.clip&&function(t,e){var n=e.clip;if(t.save(),t.beginPath(),Object(H.D)(n))n(t);else{var r=e.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},el.clear=function(t,e,n,r){var i=this.context();i.clearRect(t,e,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,e,n,r))};var ol=Object(H.y)(il,qc);function al(t,e){return function(n){var r=n.target.__data__;n.vegaType=n.type,r=Array.isArray(r)?r[0]:r,e.call(t._obj,n,r)}}function sl(t,e,n){var r,i,o="<"+t;if(e)for(r in e)null!=(i=e[r])&&(o+=" "+r+'="'+i+'"');return n&&(o+=" "+n),o+">"}function ul(t){return"</"+t+">"}ol.initialize=function(t,e,n){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener(Kc,this._tooltipHandler)),this._svg=r=t&&zc(t,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener(Kc,this._tooltipHandler)),qc.prototype.initialize.call(this,t,e,n)},ol.canvas=function(){return this._svg},ol.on=function(t,e){var n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){var i={type:t,handler:e,listener:al(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},ol.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var cl={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},ll={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},fl=Object.keys(ll),dl=cl.xmlns;function hl(t){$c.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var pl=Object(H.y)(hl,$c),ml=$c.prototype;function gl(t,e,n){var r,i,o;for((t=Lc(t,n,"linearGradient",dl)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2),r=0,i=e.stops.length;r<i;++r)(o=Lc(t,r,"stop",dl)).setAttribute("offset",e.stops[r].offset),o.setAttribute("stop-color",e.stops[r].color);Bc(t,r)}function vl(t,e,n){var r;(t=Lc(t,n,"clipPath",dl)).setAttribute("id",e.id),e.path?(r=Lc(t,0,"path",dl)).setAttribute("d",e.path):((r=Lc(t,0,"rect",dl)).setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",e.width),r.setAttribute("height",e.height))}function bl(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function yl(t,e,n,r,i){var o,a=t._svg;if(!a&&(a=Pc(o=e.ownerDocument,r,dl),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){var s=Pc(o,"path",dl);s.setAttribute("class","background"),a.appendChild(s),s.__data__=t;var u=Pc(o,"g",dl);a.appendChild(u),u.__data__=t}return(a.ownerSVGElement!==i||function(t){var e=t.mark||t.group;return e&&e.items.length>1}(t)&&a.previousSibling!==n)&&e.insertBefore(a,n?n.nextSibling:e.firstChild),a}pl.initialize=function(t,e,n,r){return t&&(this._svg=Lc(t,0,"svg",dl),this._svg.setAttribute("class","marks"),Bc(t,1),this._root=Lc(this._svg,0,"g",dl),Bc(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),ml.initialize.call(this,t,e,n,r)},pl.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),ml.background.apply(this,arguments)},pl.resize=function(t,e,n,r){return ml.resize.call(this,t,e,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},pl.canvas=function(){return this._svg},pl.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in cl)t[e]=cl[e];var n=this._bgcolor?sl("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+ul("rect"):"";return sl("svg",t)+n+this._svg.innerHTML+ul("svg")},pl._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Bc(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},pl.updateDefs=function(){var t,e=this._svg,n=this._defs,r=n.el,i=0;for(t in n.gradient)r||(n.el=r=Lc(e,0,"defs",dl)),gl(r,n.gradient[t],i++);for(t in n.clipping)r||(n.el=r=Lc(e,0,"defs",dl)),vl(r,n.clipping[t],i++);r&&(0===i?(e.removeChild(r),n.el=null):Bc(r,i))},pl._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},pl.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},pl.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},pl._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)return!0;var e,n,r,i,o,a,s,u=++this._dirtyID;for(o=0,a=t.length;o<a;++o)(n=(e=t[o]).mark).marktype!==r&&(r=n.marktype,i=Ac[r]),n.zdirty&&n.dirty!==u&&(this._dirtyAll=!1,bl(e,u),n.items.forEach(function(t){t.dirty=u})),n.zdirty||(e.exit?(i.nested&&n.items.length?(s=n.items[0])._svg&&this._update(i,s._svg,s):e._svg&&(s=e._svg.parentNode)&&s.removeChild(e._svg),e._svg=null):(e=i.nested?n.items[0]:e)._update!==u&&(e._svg&&e._svg.ownerSVGElement?this._update(i,e._svg,e):(this._dirtyAll=!1,bl(e,u)),e._update=u));return!this._dirtyAll},pl.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var r,i=this,o=this._svg,a=Ac[e.marktype],s=!1===e.interactive?"none":null,u="g"===a.tag,c=null,l=0;function f(t){var e=i.isDirty(t),n=yl(t,r,c,a.tag,o);e&&(i._update(a,n,t),u&&function(t,e,n){e=e.lastChild;var r,i=0;Tu(n,function(n){r=t.draw(e,n,r),++i}),Bc(e,1+i)}(i,n,t)),c=n,++l}return(r=yl(e,t,n,"g",o)).setAttribute("class",Uc(e)),u||r.style.setProperty("pointer-events",s),e.clip?r.setAttribute("clip-path",Gu(i,e,e.group)):r.removeAttribute("clip-path"),a.nested?e.items.length&&f(e.items[0]):Tu(e,f),Bc(r,l),r};var wl=null,xl=null,_l={group:function(t,e,n){xl=e.__values__,wl=e.childNodes[1],t.foreground(Sl,n,this),wl=e.childNodes[0],t.background(Sl,n,this);var r=!1===n.mark.interactive?"none":null;r!==xl.events&&(wl.style.setProperty("pointer-events",r),xl.events=r)},text:function(t,e,n){var r;(r=wc(n))!==xl.text&&(e.textContent=r,xl.text=r),kl(e,"font-family",xc(n)),kl(e,"font-size",bc(n)+"px"),kl(e,"font-style",n.fontStyle),kl(e,"font-variant",n.fontVariant),kl(e,"font-weight",n.fontWeight)}};function kl(t,e,n){n!==xl[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),xl[e]=n)}function Sl(t,e,n){e!==xl[t]&&(null!=e?n?wl.setAttributeNS(n,t,e):wl.setAttribute(t,e):n?wl.removeAttributeNS(n,t):wl.removeAttribute(t),xl[t]=e)}function El(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function Ol(t){$c.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}pl._update=function(t,e,n){wl=e,xl=e.__values__,t.attr(Sl,n,this);var r=_l[t.type];r&&r.call(this,t,e,n),this.style(wl,n)},pl.style=function(t,e){var n,r,i,o,a;if(null!=e)for(n=0,r=fl.length;n<r;++n)a=e[i=fl[n]],"font"===i&&(a=xc(e)),a!==xl[i]&&(o=ll[i],null==a?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(a.id&&(this._defs.gradient[a.id]=a,a="url("+El()+"#"+a.id+")"),t.style.setProperty(o,a+"")),xl[i]=a)};var Al,Cl=Object(H.y)(Ol,$c),Ml=$c.prototype;function Nl(t,e,n,r){Al[r||t]=e}function Tl(t,e,n,r){if(null==t)return"";var i,o,a,s,u,c="";for("bgrect"===n&&!1===e.interactive&&(c+="pointer-events: none; "),"text"===n&&(c+="font-family: "+xc(t)+"; ",c+="font-size: "+bc(t)+"px; ",t.fontStyle&&(c+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(c+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(c+="font-weight: "+t.fontWeight+"; ")),i=0,o=fl.length;i<o;++i)a=fl[i],s=ll[a],null==(u=t[a])?"fill"===s&&(c+="fill: none; "):"transparent"!==u||"fill"!==s&&"stroke"!==s?(u.id&&(r.gradient[u.id]=u,u="url(#"+u.id+")"),c+=s+": "+u+"; "):c+=s+": none; ";return c?'style="'+c.trim()+'"':null}Cl.resize=function(t,e,n,r){Ml.resize.call(this,t,e,n,r);var i=this._origin,o=this._text,a={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var s in cl)a[s]=cl[s];o.head=sl("svg",a);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?sl("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+ul("rect"):"",o.root=sl("g",{transform:"translate("+i+")"}),o.foot=ul("g")+ul("svg"),this},Cl.background=function(){var t=Ml.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},Cl.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},Cl._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},Cl.buildDefs=function(){var t,e,n,r,i=this._defs,o="";for(e in i.gradient){for(r=(n=i.gradient[e]).stops,o+=sl("linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<r.length;++t)o+=sl("stop",{offset:r[t].offset,"stop-color":r[t].color})+ul("stop");o+=ul("linearGradient")}for(e in i.clipping)n=i.clipping[e],o+=sl("clipPath",{id:e}),n.path?o+=sl("path",{d:n.path})+ul("path"):o+=sl("rect",{x:0,y:0,width:n.width,height:n.height})+ul("rect"),o+=ul("clipPath");return o.length>0?sl("defs")+o+ul("defs"):""},Cl.attributes=function(t,e){return Al={},t(Nl,e,this),Al},Cl.href=function(t){var e,n=this,r=t.href;if(r){if(e=n._hrefs&&n._hrefs[r])return e;n.sanitizeURL(r).then(function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[r]=t})}return null},Cl.mark=function(t){var e,n=this,r=Ac[t.marktype],i=r.tag,o=this._defs,a="";function s(s){var u=n.href(s);u&&(a+=sl("a",u)),e="g"!==i?Tl(s,t,i,o):null,a+=sl(i,n.attributes(r.attr,s),e),"text"===i?a+=wc(s).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"):"g"===i&&(a+=sl("path",n.attributes(r.background,s),Tl(s,t,"bgrect",o))+ul("path"),a+=sl("g",n.attributes(r.foreground,s))+n.markGroup(s)+ul("g")),a+=ul(i),u&&(a+=ul("a"))}return"g"!==i&&!1===t.interactive&&(e='style="pointer-events: none;"'),a+=sl("g",{class:Uc(t),"clip-path":t.clip?Gu(n,t,t.group):null},e),r.nested?t.items&&t.items.length&&s(t.items[0]):Tu(t,s),a+ul("g")},Cl.markGroup=function(t){var e=this,n="";return Tu(t,function(t){n+=e.mark(t)}),n};var Il={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},Dl={};function jl(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(Dl[t]=e,this):Dl[t]}Dl.canvas=Dl.png={renderer:tl,headless:tl,handler:Xc},Dl.svg={renderer:hl,headless:Ol,handler:il},Dl.none={};var Rl=new fa,Fl=function(t){var e=t.clip;if(Object(H.D)(e))e(_u(Rl.clear()));else{if(!e)return;Rl.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Rl)},Pl=1e-9;function zl(t,e,n){return t===e||("path"===n?Ll(t,e):t instanceof Date&&e instanceof Date?+t==+e:Object(H.E)(t)&&Object(H.E)(e)?Math.abs(t-e)<=Pl:t&&e&&(Object(H.F)(t)||Object(H.F)(e))?null!=t&&null!=e&&function(t,e){var n,r,i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(i.sort(),o.sort(),r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!zl(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Ll(t,e){return zl(Ps(t),Ps(e))}function Bl(t){Tr.call(this,null,t)}function Ul(t,e,n){return e(t.bounds.clear(),t,n)}Object(H.y)(Bl,Tr).transform=function(t,e){var n,r=e.dataflow,i=t.mark,o=i.marktype,a=Ac[o],s=a.bound,u=i.bounds;return a.nested?(i.items.length&&r.dirty(i.items[0]),u=Ul(i,s),i.items.forEach(function(t){t.bounds.clear().union(u)})):o===Yo||t.modified()?(e.visit(e.MOD,function(t){r.dirty(t)}),u.clear(),i.items.forEach(function(t){u.union(Ul(t,s))}),i.role===Zo&&e.reflow()):(n=e.changed(e.REM),e.visit(e.ADD,function(t){u.union(Ul(t,s))}),e.visit(e.MOD,function(t){n=n||u.alignsWith(t.bounds),r.dirty(t),u.union(Ul(t,s))}),n&&(u.clear(),i.items.forEach(function(t){u.union(t.bounds)}))),Fl(i),e.modifies("bounds")};var Wl=":vega_identifier:";function ql(t){Tr.call(this,0,t)}function Vl(t){Tr.call(this,null,t)}function Hl(t){Tr.call(this,null,t)}ql.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Object(H.y)(ql,Tr).transform=function(t,e){var n=function(t){var e=t._signals[Wl];return e||(t._signals[Wl]=e=t.add(0)),e}(e.dataflow),r=n.value,i=t.as;return e.visit(e.ADD,function(t){t[i]||(t[i]=++r)}),n.set(this.value=r),e},Object(H.y)(Vl,Tr).transform=function(t,e){var n=this.value;n||((n=e.dataflow.scenegraph().mark(t.markdef,function(t){var e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this,n.clip=t.clip,n.interactive=t.interactive,this.value=n);var r=n.marktype===Yo?ga:ma;return e.visit(e.ADD,function(t){r.call(t,n)}),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e};var $l={parity:function(t){return t.filter(function(t,e){return e%2?t.opacity=0:1})},greedy:function(t){var e;return t.filter(function(t,n){return n&&Gl(e.bounds,t.bounds)?t.opacity=0:(e=t,1)})}};function Gl(t,e){return!(t.x2-1<e.x1||t.x1+1>e.x2||t.y2-1<e.y1||t.y1+1>e.y2)}function Kl(t){for(var e,n=1,r=t.length,i=t[0].bounds;n<r;i=e,++n)if(Gl(i,e=t[n].bounds))return!0}function Xl(t){var e=t.bounds;return e.width()>1&&e.height()>1}function Yl(t){return t.forEach(function(t){t.opacity=1}),t}function Jl(t,e){return t.reflow(e.modified()).modifies("opacity")}function Zl(t){Tr.call(this,null,t)}function Ql(t,e){for(var n=0,r=t.length;n<r;++n)e.push(t[n])}function tf(t){return{x1:0,y1:0,x2:t.width||0,y2:t.height||0}}function ef(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function nf(t,e){return"x1"===e?t.x||0:"y1"===e?t.y||0:"x2"===e?(t.x||0)+(t.width||0):"y2"===e?(t.y||0)+(t.height||0):void 0}function rf(t,e){return t.bounds[e]}function of(t,e,n){var r=Object(H.F)(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function af(t){return t<0?Math.ceil(-t):0}function sf(t,e,n,r,i,o,a,s,u,c,l,f,d,h){var p,m,g,v,b,y,w,x,_,k=n.length,S=0,E=0;if(!k)return S;for(p=l;p<k;p+=f)n[p]&&(S=a(S,u(n[p],c)));if(!e.length)return S;for(e.length>i&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),S+=o,m=0,v=e.length;m<v;++m)t.dirty(e[m]),e[m].mark.bounds.clear();for(p=l,m=0,v=e.length;m<v;++m,p+=f){for(b=(y=e[m]).mark.bounds,g=p;g>=0&&null==(w=n[g]);g-=d);s?(x=null==h?w.x:Math.round(w.bounds.x1+h*w.bounds.width()),_=S):(x=S,_=null==h?w.y:Math.round(w.bounds.y1+h*w.bounds.height())),b.union(y.bounds.translate(x-(y.x||0),_-(y.y||0))),y.x=x,y.y=_,t.dirty(y),E=a(E,b[c])}return E}function uf(t,e,n,r,i,o){if(e){t.dirty(e);var a=n,s=n;r?a=Math.round(i.x1+o*i.width()):s=Math.round(i.y1+o*i.height()),e.bounds.translate(a-(e.x||0),s-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=a,e.y=s,t.dirty(e)}}Object(H.y)(Hl,Tr).transform=function(t,e){var n,r,i=$l[t.method]||$l.parity,o=e.materialize(e.SOURCE).source;if(o){if(!t.method)return t.modified("method")&&(Yl(o),e=Jl(e,t)),e;if(t.sort&&(o=o.slice().sort(t.sort)),"greedy"===t.method&&(o=o.filter(Xl)),n=Yl(o),e=Jl(e,t),n.length>=3&&Kl(n)){do{n=i(n)}while(n.length>=3&&Kl(n));n.length<3&&!Object(H.S)(o).opacity&&(n.length>1&&(Object(H.S)(n).opacity=0),Object(H.S)(o).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,e,n){var r=t.range(),i=new fa;return e===Wo||e===Ho?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),function(t){return i.encloses(t.bounds)}}(t.boundScale,t.boundOrient,+t.boundTolerance),o.forEach(function(t){r(t)||(t.opacity=0)})),e}},Object(H.y)(Zl,Tr).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,function(t){n.dirty(t)}),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};var cf=.5,lf=new fa;function ff(t){Tr.call(this,null,t)}function df(t,e,n){return t[e]===n?0:(t[e]=n,1)}function hf(t){var e=t.items[0].datum.orient;return e===qo||e===Vo}function pf(t,e,n,r){var i,o,a=e.items[0],s=a.datum,u=s.orient,c=function(t){var e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(s),l=a.range,f=a.offset,d=a.position,h=a.minExtent,p=a.maxExtent,m=s.title&&a.items[c[2]].items[0],g=a.titlePadding,v=a.bounds,b=0,y=0;switch(lf.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(a.items[i].bounds),(i=c[1])>-1&&v.union(a.items[i].bounds),u){case Wo:b=d||0,y=-f,o=Math.max(h,Math.min(p,-v.y1)),m&&(o=mf(m,o,g,0,-1,v)),v.add(0,-o).add(l,0);break;case qo:b=-f,y=d||0,o=Math.max(h,Math.min(p,-v.x1)),m&&(o=mf(m,o,g,1,-1,v)),v.add(-o,0).add(0,l);break;case Vo:b=n+f,y=d||0,o=Math.max(h,Math.min(p,v.x2)),m&&(o=mf(m,o,g,1,1,v)),v.add(0,0).add(o,l);break;case Ho:b=d||0,y=r+f,o=Math.max(h,Math.min(p,v.y2)),m&&(o=mf(m,o,g,0,1,v)),v.add(0,0).add(l,o);break;default:b=a.x,y=a.y}return bu(v.translate(b,y),a),df(a,"x",b+cf)|df(a,"y",y+cf)&&(a.bounds=lf,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function mf(t,e,n,r,i,o){var a=t.bounds,s=0,u=0;return t.auto?(e+=n,r?s=(t.x||0)-(t.x=i*e):u=(t.y||0)-(t.y=i*e),a.translate(-s,-u),t.mark.bounds.set(a.x1,a.y1,a.x2,a.y2),r?(o.add(0,a.y1).add(0,a.y2),e+=a.width()):(o.add(a.x1,0).add(a.x2,0),e+=a.height())):o.union(a),e}function gf(t,e,n,r,i,o,a){var s,u,c,l=e.items[0],f=l.datum,d=f.orient,h=l.offset,p=l.bounds,m=0,g=0;switch(d===Wo||d===Ho?(c=i,m=n[d]):d!==qo&&d!==Vo||(c=r,g=n[d]),lf.clear().union(p),p.clear(),l.items.forEach(function(t){p.union(t.bounds)}),s=2*l.padding-1,u=2*l.padding-1,p.empty()||(s=Math.ceil(p.width()+s),u=Math.ceil(p.height()+u)),f.type===oa&&function(t){var e=t.reduce(function(t,e){return t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t},{});t.forEach(function(t){t.width=e[t.column],t.height=t.bounds.y2-t.y})}(l.items[0].items[0].items[0].items),d){case qo:m-=n.leftWidth+h-Math.floor(c.x1),n.left+=u+n.margin;break;case Vo:m+=h+Math.ceil(c.x2),n.right+=u+n.margin;break;case Wo:g-=u+h-Math.floor(c.y1),n.top+=s+n.margin;break;case Ho:g+=h+Math.ceil(c.y2),n.bottom+=s+n.margin;break;case $o:m+=h,g+=h;break;case Go:m+=o-s-h,g+=h;break;case Ko:m+=h,g+=a-u-h;break;case Xo:m+=o-s-h,g+=a-u-h;break;default:m=l.x,g=l.y}return bu(p.set(m,g,m+s,g+u),l),df(l,"x",m)|df(l,"width",s)|df(l,"y",g)|df(l,"height",u)&&(l.bounds=lf,t.dirty(l),l.bounds=p,t.dirty(l)),l.mark.bounds.clear().union(p)}Object(H.y)(ff,Tr).transform=function(t,e){var n=e.dataflow;return t.mark.items.forEach(function(e){t.layout&&function(t,e,n){var r,i,o,a,s,u,c,l,f,d,h,p,m=function(t){for(var e,n,r=t.items,i=r.length,o=0,a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};o<i;++o)if(n=(e=r[o]).items,e.marktype===Yo)switch(e.role){case Jo:case Zo:break;case Qo:Ql(n,a.rowheaders);break;case ta:Ql(n,a.rowfooters);break;case na:Ql(n,a.colheaders);break;case ra:Ql(n,a.colfooters);break;case ea:a.rowtitle=n[0];break;case ia:a.coltitle=n[0];break;default:Ql(n,a.marks)}return a}(e),g=m.marks,v=n.bounds===ua,b=v?tf:ef,y=new fa(0,0,0,0),w=of(n.align,ca),x=of(n.align,la),_=of(n.padding,ca),k=of(n.padding,la),S=n.offset,E=e.columns||n.columns||g.length,O=E<0?1:Math.ceil(g.length/E),A=O*E,C=[],M=[],N=0,T=[],I=[],D=0,j=g.length;for(i=0;i<E;++i)M[i]=0;for(i=0;i<O;++i)I[i]=0;for(i=0;i<j;++i)s=b(g[i]),o=i%E,a=~~(i/E),c=Math.ceil(b(g[i]).x2),l=Math.ceil(b(g[i]).y2),N=Math.max(N,c),D=Math.max(D,l),M[o]=Math.max(M[o],c),I[a]=Math.max(I[a],l),C.push(_+af(s.x1)),T.push(k+af(s.y1)),t.dirty(g[i]);for(i=0;i<j;++i)i%E==0&&(C[i]=0),i<E&&(T[i]=0);if(w===sa)for(o=1;o<E;++o){for(p=0,i=o;i<j;i+=E)p<C[i]&&(p=C[i]);for(i=o;i<j;i+=E)C[i]=p+M[o-1]}else if(w===aa){for(p=0,i=0;i<j;++i)i%E&&p<C[i]&&(p=C[i]);for(i=0;i<j;++i)i%E&&(C[i]=p+N)}else for(w=!1,o=1;o<E;++o)for(i=o;i<j;i+=E)C[i]+=M[o-1];if(x===sa)for(a=1;a<O;++a){for(p=0,r=(i=a*E)+E;i<r;++i)p<T[i]&&(p=T[i]);for(i=a*E;i<r;++i)T[i]=p+I[a-1]}else if(x===aa){for(p=0,i=E;i<j;++i)p<T[i]&&(p=T[i]);for(i=E;i<j;++i)T[i]=p+D}else for(x=!1,a=1;a<O;++a)for(r=(i=a*E)+E;i<r;++i)T[i]+=I[a-1];for(f=0,i=0;i<j;++i)c=(u=g[i]).x||0,u.x=f=C[i]+(i%E?f:0),u.bounds.translate(f-c,0);for(o=0;o<E;++o)for(d=0,i=o;i<j;i+=E)l=(u=g[i]).y||0,u.y=d+=T[i],u.bounds.translate(0,d-l);if(of(n.center,ca)&&O>1&&w)for(i=0;i<j;++i)u=g[i],(f=(s=w===aa?N:M[i%E])-b(u).x2)>0&&(u.x+=c=f/2,u.bounds.translate(c,0));if(of(n.center,la)&&1!==E&&x)for(i=0;i<j;++i)u=g[i],(d=(s=x===aa?D:I[~~(i/E)])-b(u).y2)>0&&(u.y+=l=d/2,u.bounds.translate(0,l));for(i=0;i<j;++i)g[i].mark.bounds.clear();for(i=0;i<j;++i)u=g[i],t.dirty(u),y.union(u.mark.bounds.union(u.bounds));function R(t,e){return Math.floor(Math.min(t,e))}function F(t,e){return Math.ceil(Math.max(t,e))}b=v?nf:rf,h=of(n.headerBand,la,null),f=sf(t,m.rowheaders,g,0,O,-of(S,"rowHeader"),R,0,b,"x1",0,E,1,h),h=of(n.headerBand,ca,null),d=sf(t,m.colheaders,g,0,E,-of(S,"columnHeader"),R,1,b,"y1",0,1,E,h),h=of(n.footerBand,la,null),sf(t,m.rowfooters,g,0,O,of(S,"rowFooter"),F,0,b,"x2",E-1,E,1,h),h=of(n.footerBand,ca,null),sf(t,m.colfooters,g,0,E,of(S,"columnFooter"),F,1,b,"y2",A-E,1,E,h),m.rowtitle&&(p=f-of(S,"rowTitle"),h=of(n.titleBand,la,.5),uf(t,m.rowtitle,p,0,y,h)),m.coltitle&&(p=d-of(S,"columnTitle"),h=of(n.titleBand,ca,.5),uf(t,m.coltitle,p,1,y,h))}(n,e,t.layout),function(t,e,n){var r,i,o,a,s,u,c=e.items,l=Math.max(0,e.width||0),f=Math.max(0,e.height||0),d=(new fa).set(0,0,l,f),h=d.clone(),p=d.clone(),m=[];for(s=0,u=c.length;s<u;++s)switch((i=c[s]).role){case Jo:(a=hf(i)?h:p).union(pf(t,i,l,f));break;case"title":r=i;break;case Zo:m.push(i);break;case"frame":case"scope":case Qo:case ta:case ea:case na:case ra:case ia:h.union(i.bounds),p.union(i.bounds);break;default:d.union(i.bounds)}if(m.length)for(o={leftWidth:function(t,e){return m.reduce(function(e,n){var r=n.items[0];if(function(t,e,n){var r=e.padding-n.x,i=e.padding-n.y;if(e.datum.title){var o=e.items[1].items[0];i+=e.titlePadding+o.fontSize}(r||i)&&(n.x+=r,n.y+=i,n.bounds.translate(r,i),n.mark.bounds.translate(r,i),t.dirty(n))}(t,r,r.items[0].items[0]),r.datum.orient===qo){var i=lf.clear();r.items.forEach(function(t){i.union(t.bounds)}),e=Math.max(e,Math.ceil(i.width()+2*r.padding-1))}return e},0)}(t),margin:n.legendMargin||8,left:0,right:0,top:0,bottom:0},s=0,u=m.length;s<u;++s)if(a=gf(t,m[s],o,h,p,l,f),n.autosize&&"fit"===n.autosize.type){var g=m[s].items[0].datum.orient;g===qo||g===Vo?d.add(a.x1,0).add(a.x2,0):g!==Wo&&g!==Ho||d.add(0,a.y1).add(0,a.y2)}else d.union(a);d.union(h).union(p),r&&d.union(function(t,e,n,r,i){var o,a=e.items[0],s=a.orient,u=a.frame,c=a.anchor,l=a.offset,f=a.bounds,d=0,h=s===qo||s===Vo?r:n,p=0,m=0;switch(u!==Yo?s===qo?(d=i.y2,h=i.y1):s===Vo?(d=i.y1,h=i.y2):(d=i.x1,h=i.x2):s===qo&&(d=r,h=0),o="start"===c?d:"end"===c?h:(d+h)/2,lf.clear().union(f),s){case Wo:p=o,m=i.y1-l;break;case qo:p=i.x1-l,m=o;break;case Vo:p=i.x2+l,m=o;break;case Ho:p=o,m=i.y2+l;break;default:p=a.x,m=a.y}return f.translate(p-a.x,m-a.y),df(a,"x",p)|df(a,"y",m)&&(a.bounds=lf,t.dirty(a),a.bounds=f,t.dirty(a)),e.bounds.clear().union(f)}(t,r,l,f,d)),function(t,e,n,r){var i=r.autosize||{},o=i.type,a=t._width,s=t._height,u=t.padding();if(!(t._autosize<1)&&o){var c=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),f=Math.max(0,Math.ceil(n.x2-c)),d=Math.max(0,e.height||0),h=Math.max(0,Math.ceil(-n.y1)),p=Math.max(0,Math.ceil(n.y2-d));"padding"===i.contains&&(a-=u.left+u.right,s-=u.top+u.bottom),"none"===o?(l=0,h=0,c=a,d=s):"fit"===o?(c=Math.max(0,a-l-f),d=Math.max(0,s-h-p)):"fit-x"===o?(c=Math.max(0,a-l-f),s=d+h+p):"fit-y"===o?(a=c+l+f,d=Math.max(0,s-h-p)):"pad"===o&&(a=c+l+f,s=d+h+p),t._resizeView(a,s,c,d,[l,h],i.resize)}}(t,e,d,n)}(n,e,t)}),t.modified()&&e.reflow(),e};var vf="log",bf="sqrt",yf="ordinal",wf="quantile",xf="quantize",_f="threshold",kf="bin-ordinal",Sf="sequential",Ef=function(t,e,n){var r=t-e+2*n;return t?r>0?r:1:0},Of=function(t){return function(e){var n,r=e[0],i=e[1];return i<r&&(n=r,r=i,i=n),[t.invert(r),t.invert(i)]}},Af=function(t){return function(e){var n,r,i,o,a=t.range(),s=e[0],u=e[1],c=-1;for(u<s&&(r=s,s=u,u=r),i=0,o=a.length;i<o;++i)a[i]>=s&&a[i]<=u&&(c<0&&(c=i),n=i);if(!(c<0))return s=t.invertExtent(a[c]),u=t.invertExtent(a[n]),[void 0===s[0]?s[1]:s[0],void 0===u[1]?u[0]:u[1]]}},Cf=Fo(Kr),Mf=Cf.right,Nf=Cf.left,Tf=Mf,If=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},Df=function(t){return 1===t.length&&(t=function(t){return function(e,n){return If(t(e),n)}}(t)),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}},jf=Df(If),Rf=jf.right,Ff=(jf.left,Rf),Pf=function(t){return null===t?NaN:+t},zf=Array.prototype,Lf=(zf.slice,zf.map,Math.sqrt(50)),Bf=Math.sqrt(10),Uf=Math.sqrt(2),Wf=function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(a=qf(t,e,n))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s<i;)o[s]=(t+s)*a;else for(t=Math.floor(t*a),e=Math.ceil(e*a),o=new Array(i=Math.ceil(t-e+1));++s<i;)o[s]=(t-s)/a;return r&&o.reverse(),o};function qf(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Lf?10:o>=Bf?5:o>=Uf?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Lf?10:o>=Bf?5:o>=Uf?2:1)}function Vf(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Lf?i*=10:o>=Bf?i*=5:o>=Uf&&(i*=2),e<t?-i:i}var Hf=function(t,e,n){if(null==n&&(n=Pf),r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}};function $f(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Gf(){}function Kf(t,e){var n=new Gf;if(t instanceof Gf)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}Gf.prototype=Kf.prototype={constructor:Gf,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var Xf=Kf;function Yf(){return{}}function Jf(t,e,n){t[e]=n}function Zf(){return Xf()}function Qf(t,e,n){t.set(e,n)}function td(){}var ed=Xf.prototype;td.prototype=function(t,e){var n=new td;if(t instanceof td)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r<i;)n.add(t[r]);else for(;++r<i;)n.add(e(t[r],r,t))}return n}.prototype={constructor:td,has:ed.has,add:function(t){return this["$"+(t+="")]=t,this},remove:ed.remove,clear:ed.clear,values:ed.keys,size:ed.size,empty:ed.empty,each:ed.each};var nd=Array.prototype,rd=nd.map,id=nd.slice,od={name:"implicit"};function ad(){var t=Xf(),e=[],n=[],r=od;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==od)return r;t.set(o,a=e.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=Xf();for(var r,o,a=-1,s=n.length;++a<s;)t.has(o=(r=n[a])+"")||t.set(o,e.push(r));return i},i.range=function(t){return arguments.length?(n=id.call(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return ad(e,n).unknown(r)},$f.apply(i,arguments),i}var sd=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function ud(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function cd(){}var ld="\\s*([+-]?\\d+)\\s*",fd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",dd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hd=/^#([0-9a-f]{3})$/,pd=/^#([0-9a-f]{6})$/,md=new RegExp("^rgb\\("+[ld,ld,ld]+"\\)$"),gd=new RegExp("^rgb\\("+[dd,dd,dd]+"\\)$"),vd=new RegExp("^rgba\\("+[ld,ld,ld,fd]+"\\)$"),bd=new RegExp("^rgba\\("+[dd,dd,dd,fd]+"\\)$"),yd=new RegExp("^hsl\\("+[fd,dd,dd]+"\\)$"),wd=new RegExp("^hsla\\("+[fd,dd,dd,fd]+"\\)$"),xd={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 _d(){return this.rgb().formatHex()}function kd(){return this.rgb().formatRgb()}function Sd(t){var e;return t=(t+"").trim().toLowerCase(),(e=hd.exec(t))?new Md((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=pd.exec(t))?Ed(parseInt(e[1],16)):(e=md.exec(t))?new Md(e[1],e[2],e[3],1):(e=gd.exec(t))?new Md(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=vd.exec(t))?Od(e[1],e[2],e[3],e[4]):(e=bd.exec(t))?Od(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=yd.exec(t))?Dd(e[1],e[2]/100,e[3]/100,1):(e=wd.exec(t))?Dd(e[1],e[2]/100,e[3]/100,e[4]):xd.hasOwnProperty(t)?Ed(xd[t]):"transparent"===t?new Md(NaN,NaN,NaN,0):null}function Ed(t){return new Md(t>>16&255,t>>8&255,255&t,1)}function Od(t,e,n,r){return r<=0&&(t=e=n=NaN),new Md(t,e,n,r)}function Ad(t){return t instanceof cd||(t=Sd(t)),t?new Md((t=t.rgb()).r,t.g,t.b,t.opacity):new Md}function Cd(t,e,n,r){return 1===arguments.length?Ad(t):new Md(t,e,n,null==r?1:r)}function Md(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Nd(){return"#"+Id(this.r)+Id(this.g)+Id(this.b)}function Td(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Id(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Dd(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fd(t,e,n,r)}function jd(t){if(t instanceof Fd)return new Fd(t.h,t.s,t.l,t.opacity);if(t instanceof cd||(t=Sd(t)),!t)return new Fd;if(t instanceof Fd)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Fd(a,s,u,t.opacity)}function Rd(t,e,n,r){return 1===arguments.length?jd(t):new Fd(t,e,n,null==r?1:r)}function Fd(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Pd(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}sd(cd,Sd,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:_d,formatHex:_d,formatHsl:function(){return jd(this).formatHsl()},formatRgb:kd,toString:kd}),sd(Md,Cd,ud(cd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Md(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Md(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Nd,formatHex:Nd,formatRgb:Td,toString:Td})),sd(Fd,Rd,ud(cd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Fd(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Fd(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Md(Pd(t>=240?t-240:t+120,i,r),Pd(t,i,r),Pd(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var zd=Math.PI/180,Ld=180/Math.PI,Bd=.96422,Ud=1,Wd=.82521,qd=4/29,Vd=6/29,Hd=3*Vd*Vd,$d=Vd*Vd*Vd;function Gd(t){if(t instanceof Xd)return new Xd(t.l,t.a,t.b,t.opacity);if(t instanceof eh)return nh(t);t instanceof Md||(t=Ad(t));var e,n,r=Qd(t.r),i=Qd(t.g),o=Qd(t.b),a=Yd((.2225045*r+.7168786*i+.0606169*o)/Ud);return r===i&&i===o?e=n=a:(e=Yd((.4360747*r+.3850649*i+.1430804*o)/Bd),n=Yd((.0139322*r+.0971045*i+.7141733*o)/Wd)),new Xd(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Kd(t,e,n,r){return 1===arguments.length?Gd(t):new Xd(t,e,n,null==r?1:r)}function Xd(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Yd(t){return t>$d?Math.pow(t,1/3):t/Hd+qd}function Jd(t){return t>Vd?t*t*t:Hd*(t-qd)}function Zd(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Qd(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function th(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof eh)return new eh(t.h,t.c,t.l,t.opacity);if(t instanceof Xd||(t=Gd(t)),0===t.a&&0===t.b)return new eh(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Ld;return new eh(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new eh(t,e,n,null==r?1:r)}function eh(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function nh(t){if(isNaN(t.h))return new Xd(t.l,0,0,t.opacity);var e=t.h*zd;return new Xd(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}sd(Xd,Kd,ud(cd,{brighter:function(t){return new Xd(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Xd(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Md(Zd(3.1338561*(e=Bd*Jd(e))-1.6168667*(t=Ud*Jd(t))-.4906146*(n=Wd*Jd(n))),Zd(-.9787684*e+1.9161415*t+.033454*n),Zd(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),sd(eh,th,ud(cd,{brighter:function(t){return new eh(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new eh(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return nh(this).rgb()}}));var rh=-.29227,ih=-.90649,oh=1.97294,ah=oh*ih,sh=1.78277*oh,uh=1.78277*rh- -.14861*ih;function ch(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof lh)return new lh(t.h,t.s,t.l,t.opacity);t instanceof Md||(t=Ad(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(uh*r+ah*e-sh*n)/(uh+ah-sh),o=r-i,a=(oh*(n-i)-rh*o)/ih,s=Math.sqrt(a*a+o*o)/(oh*i*(1-i)),u=s?Math.atan2(a,o)*Ld-120:NaN;return new lh(u<0?u+360:u,s,i,t.opacity)}(t):new lh(t,e,n,null==r?1:r)}function lh(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function fh(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}sd(lh,ch,ud(cd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new lh(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new lh(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*zd,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Md(255*(e+n*(-.14861*r+1.78277*i)),255*(e+n*(rh*r+ih*i)),255*(e+n*(oh*r)),this.opacity)}}));var dh=function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return fh((n-r/e)*e,a,i,o,s)}},hh=function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return fh((n-r/e)*e,i,o,a,s)}},ph=function(t){return function(){return t}};function mh(t,e){return function(n){return t+n*e}}function gh(t,e){var n=e-t;return n?mh(t,n>180||n<-180?n-360*Math.round(n/360):n):ph(isNaN(t)?e:t)}function vh(t,e){var n=e-t;return n?mh(t,n):ph(isNaN(t)?e:t)}var bh=function t(e){var n=function(t){return 1==(t=+t)?vh:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):ph(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Cd(t)).r,(e=Cd(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=vh(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function yh(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=Cd(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}var wh,xh,_h,kh,Sh=yh(dh),Eh=yh(hh),Oh=function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Dh(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}},Ah=function(t,e){var n=new Date;return e-=t=+t,function(r){return n.setTime(t+e*r),n}},Ch=function(t,e){return e-=t=+t,function(n){return t+e*n}},Mh=function(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Dh(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}},Nh=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Th=new RegExp(Nh.source,"g"),Ih=function(t,e){var n,r,i,o=Nh.lastIndex=Th.lastIndex=0,a=-1,s=[],u=[];for(t+="",e+="";(n=Nh.exec(t))&&(r=Th.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Ch(n,r)})),o=Th.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r<e;++r)s[(n=u[r]).i]=n.x(t);return s.join("")})},Dh=function(t,e){var n,r=typeof e;return null==e||"boolean"===r?ph(e):("number"===r?Ch:"string"===r?(n=Sd(e))?(e=n,bh):Ih:e instanceof Sd?bh:e instanceof Date?Ah:Array.isArray(e)?Oh:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Mh:Ch)(t,e)},jh=function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},Rh=function(t,e){var n=gh(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},Fh=function(t,e){return e-=t=+t,function(n){return Math.round(t+e*n)}},Ph=180/Math.PI,zh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Lh=function(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Ph,skewX:Math.atan(u)*Ph,scaleX:a,scaleY:s}};function Bh(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,e,null,n);s.push({i:u-4,x:Ch(t,i)},{i:u-2,x:Ch(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),u.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ch(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s),function(t,e,n,o){t!==e?u.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ch(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ch(t,n)},{i:s-2,x:Ch(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n<r;)s[(e=u[n]).i]=e.x(t);return s.join("")}}}var Uh=Bh(function(t){return"none"===t?zh:(wh||(wh=document.createElement("DIV"),xh=document.documentElement,_h=document.defaultView),wh.style.transform=t,t=_h.getComputedStyle(xh.appendChild(wh),null).getPropertyValue("transform"),xh.removeChild(wh),t=t.slice(7,-1).split(","),Lh(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Wh=Bh(function(t){return null==t?zh:(kh||(kh=document.createElementNS("http://www.w3.org/2000/svg","g")),kh.setAttribute("transform",t),(t=kh.transform.baseVal.consolidate())?(t=t.matrix,Lh(t.a,t.b,t.c,t.d,t.e,t.f)):zh)},", ",")",")"),qh=Math.SQRT2;function Vh(t){return((t=Math.exp(t))+1/t)/2}var Hh=function(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],u=e[1],c=e[2],l=s-i,f=u-o,d=l*l+f*f;if(d<1e-12)r=Math.log(c/a)/qh,n=function(t){return[i+t*l,o+t*f,a*Math.exp(qh*t*r)]};else{var h=Math.sqrt(d),p=(c*c-a*a+4*d)/(2*a*2*h),m=(c*c-a*a-4*d)/(2*c*2*h),g=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/qh,n=function(t){var e=t*r,n=Vh(g),s=a/(2*h)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(qh*e+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+s*l,o+s*f,a*n/Vh(qh*e+g)]}}return n.duration=1e3*r,n};function $h(t){return function(e,n){var r=t((e=Rd(e)).h,(n=Rd(n)).h),i=vh(e.s,n.s),o=vh(e.l,n.l),a=vh(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var Gh=$h(gh),Kh=$h(vh);function Xh(t,e){var n=vh((t=Kd(t)).l,(e=Kd(e)).l),r=vh(t.a,e.a),i=vh(t.b,e.b),o=vh(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}}function Yh(t){return function(e,n){var r=t((e=th(e)).h,(n=th(n)).h),i=vh(e.c,n.c),o=vh(e.l,n.l),a=vh(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var Jh=Yh(gh),Zh=Yh(vh);function Qh(t){return function e(n){function r(e,r){var i=t((e=ch(e)).h,(r=ch(r)).h),o=vh(e.s,r.s),a=vh(e.l,r.l),s=vh(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=o(t),e.l=a(Math.pow(t,n)),e.opacity=s(t),e+""}}return n=+n,r.gamma=e,r}(1)}var tp=Qh(gh),ep=Qh(vh);function np(t,e){for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n<r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}}var rp=function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n},ip=function(t){return function(){return t}},op=function(t){return+t},ap=[0,1];function sp(t){return t}function up(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:ip(isNaN(e)?NaN:.5)}function cp(t){var e,n=t[0],r=t[t.length-1];return n>r&&(e=n,n=r,r=e),function(t){return Math.max(n,Math.min(r,t))}}function lp(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=up(i,r),o=n(a,o)):(r=up(r,i),o=n(o,a)),function(t){return o(r(t))}}function fp(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=up(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=Ff(t,e,1,r)-1;return o[n](i[n](e))}}function dp(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function hp(){var t,e,n,r,i,o,a=ap,s=ap,u=Dh,c=sp;function l(){return r=Math.min(a.length,s.length)>2?fp:lp,i=o=null,f}function f(e){return isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(c(e)))}return f.invert=function(n){return c(e((o||(o=r(s,a.map(t),Ch)))(n)))},f.domain=function(t){return arguments.length?(a=rd.call(t,op),c===sp||(c=cp(a)),l()):a.slice()},f.range=function(t){return arguments.length?(s=id.call(t),l()):s.slice()},f.rangeRound=function(t){return s=id.call(t),u=Fh,l()},f.clamp=function(t){return arguments.length?(c=t?cp(a):sp,f):c!==sp},f.interpolate=function(t){return arguments.length?(u=t,l()):u},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,l()}}function pp(t,e){return hp()(t,e)}var mp=n(23),gp=function(t,e,n,r){var i,o=Vf(t,e,n);switch((r=Object(mp.formatSpecifier)(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Object(mp.precisionPrefix)(o,a))||(r.precision=i),Object(mp.formatPrefix)(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Object(mp.precisionRound)(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Object(mp.precisionFixed)(o))||(r.precision=i-2*("%"===r.type))}return Object(mp.format)(r)};function vp(t){var e=t.domain;return t.ticks=function(t){var n=e();return Wf(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return gp(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i=e(),o=0,a=i.length-1,s=i[o],u=i[a];return u<s&&(r=s,s=u,u=r,r=o,o=a,a=r),(r=qf(s,u,n))>0?r=qf(s=Math.floor(s/r)*r,u=Math.ceil(u/r)*r,n):r<0&&(r=qf(s=Math.ceil(s*r)/r,u=Math.floor(u*r)/r,n)),r>0?(i[o]=Math.floor(s/r)*r,i[a]=Math.ceil(u/r)*r,e(i)):r<0&&(i[o]=Math.ceil(s*r)/r,i[a]=Math.floor(u*r)/r,e(i)),t},t}function bp(){var t=pp(sp,sp);return t.copy=function(){return dp(t,bp())},$f.apply(t,arguments),vp(t)}var yp=function(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t};function wp(t){return Math.log(t)}function xp(t){return Math.exp(t)}function _p(t){return-Math.log(-t)}function kp(t){return-Math.exp(-t)}function Sp(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Ep(t){return function(e){return-t(-e)}}function Op(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Ap(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Cp(t){return t<0?-t*t:t*t}function Mp(){var t=function(t){var e=t(sp,sp),n=1;return e.exponent=function(e){return arguments.length?1==(n=+e)?t(sp,sp):.5===n?t(Ap,Cp):t(Op(n),Op(1/n)):n},vp(e)}(hp());return t.copy=function(){return dp(t,Mp()).exponent(t.exponent())},$f.apply(t,arguments),t}var Np=1e3,Tp=60*Np,Ip=60*Tp,Dp=24*Ip,jp=7*Dp,Rp=30*Dp,Fp=365*Dp;function Pp(t){return new Date(t)}function zp(t){return t instanceof Date?+t:+new Date(+t)}function Lp(t,e,n,r,i,o,a,s,u){var c=pp(sp,sp),l=c.invert,f=c.domain,d=u(".%L"),h=u(":%S"),p=u("%I:%M"),m=u("%I %p"),g=u("%a %d"),v=u("%b %d"),b=u("%B"),y=u("%Y"),w=[[a,1,Np],[a,5,5*Np],[a,15,15*Np],[a,30,30*Np],[o,1,Tp],[o,5,5*Tp],[o,15,15*Tp],[o,30,30*Tp],[i,1,Ip],[i,3,3*Ip],[i,6,6*Ip],[i,12,12*Ip],[r,1,Dp],[r,2,2*Dp],[n,1,jp],[e,1,Rp],[e,3,3*Rp],[t,1,Fp]];function x(s){return(a(s)<s?d:o(s)<s?h:i(s)<s?p:r(s)<s?m:e(s)<s?n(s)<s?g:v:t(s)<s?b:y)(s)}function _(e,n,r,i){if(null==e&&(e=10),"number"==typeof e){var o=Math.abs(r-n)/e,a=Df(function(t){return t[2]}).right(w,o);a===w.length?(i=Vf(n/Fp,r/Fp,e),e=t):a?(i=(a=w[o/w[a-1][2]<w[a][2]/o?a-1:a])[1],e=a[0]):(i=Math.max(Vf(n,r,e),1),e=s)}return null==i?e:e.every(i)}return c.invert=function(t){return new Date(l(t))},c.domain=function(t){return arguments.length?f(rd.call(t,zp)):f().map(Pp)},c.ticks=function(t,e){var n,r=f(),i=r[0],o=r[r.length-1],a=o<i;return a&&(n=i,i=o,o=n),n=(n=_(t,i,o,e))?n.range(i,o+1):[],a?n.reverse():n},c.tickFormat=function(t,e){return null==e?x:u(e)},c.nice=function(t,e){var n=f();return(t=_(t,n[0],n[n.length-1],e))?f(yp(n,t)):c},c.copy=function(){return dp(c,Lp(t,e,n,r,i,o,a,s,u))},c}function Bp(){var t,e,n=ad().unknown(void 0),r=n.domain,i=n.range,o=[0,1],a=!1,s=0,u=0,c=.5;function l(){var n=r().length,l=o[1]<o[0],f=o[l-0],d=o[1-l],h=Ef(n,s,u);t=(d-f)/(h||1),a&&(t=Math.floor(t)),f+=(d-f-t*(n-s))*c,e=t*(1-s),a&&(f=Math.round(f),e=Math.round(e));var p=Ui(n).map(function(e){return f+t*e});return i(l?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),l()):r()},n.range=function(t){return arguments.length?(o=[+t[0],+t[1]],l()):o.slice()},n.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,l()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(a=!!t,l()):a},n.padding=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),s=u,l()):s},n.paddingInner=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),l()):s},n.paddingOuter=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),l()):u},n.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),l()):c},n.invertRange=function(t){if(null!=t[0]&&null!=t[1]){var n,a,s,u=+t[0],c=+t[1],l=o[1]<o[0],f=l?i().reverse():i(),d=f.length-1;if(u==u&&c==c&&(c<u&&(s=u,u=c,c=s),!(c<f[0]||u>o[1-l])))return n=Math.max(0,Mf(f,u)-1),a=u===c?n:Mf(f,c)-1,u-f[n]>e+1e-10&&++n,l&&(s=n,n=d-a,a=d-s),n>a?void 0:r().slice(n,a+1)}},n.invert=function(t){var e=n.invertRange([t,t]);return e?e[0]:e},n.copy=function(){return Bp().domain(r()).range(o).round(a).paddingInner(s).paddingOuter(u).align(c)},l()}var Up=Array.prototype.map,Wp=Array.prototype.slice;function qp(t){return Up.call(t,function(t){return+t})}function Vp(t,e){return arguments.length>1?(Hp[t]=function(t,e){return function(){var n=e();return n.invertRange||(n.invertRange=n.invert?Of(n):n.invertExtent?Af(n):void 0),n.type=t,n}}(t,e),this):Hp.hasOwnProperty(t)?Hp[t]:void 0}var Hp={identity:function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=rd.call(t,op),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?rd.call(e,op):[0,1],vp(r)},linear:bp,log:function t(){var e=function(t){var e,n,r=t(wp,xp),i=r.domain,o=10;function a(){return e=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(e){return Math.log(e)/t})}(o),n=function(t){return 10===t?Sp:t===Math.E?Math.exp:function(e){return Math.pow(t,e)}}(o),i()[0]<0?(e=Ep(e),n=Ep(n),t(_p,kp)):t(wp,xp),r}return r.base=function(t){return arguments.length?(o=+t,a()):o},r.domain=function(t){return arguments.length?(i(t),a()):i()},r.ticks=function(t){var r,a=i(),s=a[0],u=a[a.length-1];(r=u<s)&&(d=s,s=u,u=d);var c,l,f,d=e(s),h=e(u),p=null==t?10:+t,m=[];if(!(o%1)&&h-d<p){if(d=Math.round(d)-1,h=Math.round(h)+1,s>0){for(;d<h;++d)for(l=1,c=n(d);l<o;++l)if(!((f=c*l)<s)){if(f>u)break;m.push(f)}}else for(;d<h;++d)for(l=o-1,c=n(d);l>=1;--l)if(!((f=c*l)<s)){if(f>u)break;m.push(f)}}else m=Wf(d,h,Math.min(h-d,p)).map(n);return r?m.reverse():m},r.tickFormat=function(t,i){if(null==i&&(i=10===o?".0e":","),"function"!=typeof i&&(i=Object(mp.format)(i)),t===1/0)return i;null==t&&(t=10);var a=Math.max(1,o*t/r.ticks().length);return function(t){var r=t/n(Math.round(e(t)));return r*o<o-.5&&(r*=o),r<=a?i(t):""}},r.nice=function(){return i(yp(i(),{floor:function(t){return n(Math.floor(e(t)))},ceil:function(t){return n(Math.ceil(e(t)))}}))},r}(hp()).domain([1,10]);return e.copy=function(){return dp(e,t()).base(e.base())},$f.apply(e,arguments),e},ordinal:ad,pow:Mp,sqrt:function(){return Mp.apply(null,arguments).exponent(.5)},quantile:function t(){var e,n=[],r=[],i=[];function o(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t<e;)i[t-1]=Hf(n,t/e);return a}function a(t){return isNaN(t=+t)?e:r[Ff(i,t)]}return a.invertExtent=function(t){var e=r.indexOf(t);return e<0?[NaN,NaN]:[e>0?i[e-1]:n[0],e<i.length?i[e]:n[n.length-1]]},a.domain=function(t){if(!arguments.length)return n.slice();n=[];for(var e,r=0,i=t.length;r<i;++r)null==(e=t[r])||isNaN(e=+e)||n.push(e);return n.sort(If),o()},a.range=function(t){return arguments.length?(r=id.call(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(n).range(r).unknown(e)},$f.apply(a,arguments)},quantize:function t(){var e,n=0,r=1,i=1,o=[.5],a=[0,1];function s(t){return t<=t?a[Ff(o,t,0,i)]:e}function u(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*n)/(i+1);return s}return s.domain=function(t){return arguments.length?(n=+t[0],r=+t[1],u()):[n,r]},s.range=function(t){return arguments.length?(i=(a=id.call(t)).length-1,u()):a.slice()},s.invertExtent=function(t){var e=a.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,o[0]]:e>=i?[o[i-1],r]:[o[e-1],o[e]]},s.unknown=function(t){return arguments.length?(e=t,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return t().domain([n,r]).range(a).unknown(e)},$f.apply(vp(s),arguments)},threshold:function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return t<=t?r[Ff(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=id.call(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=id.call(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},$f.apply(o,arguments)},time:function(){return $f.apply(Lp(Ae,Ee,ve,me,he,fe,ce,oe,Ye).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},utc:function(){return $f.apply(Lp(He,qe,Re,De,Te,Me,ce,oe,Ze).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},band:Bp,point:function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return t(n())},e}(Bp().paddingInner(1))},sequential:function t(e){var n=bp(),r=0,i=1,o=!1;function a(){var t=n.domain();r=t[0],i=Object(H.S)(t)-r}function s(t){var n=(t-r)/i;return e(o?Math.max(0,Math.min(1,n)):n)}return s.clamp=function(t){return arguments.length?(o=!!t,s):o},s.domain=function(t){return arguments.length?(n.domain(t),a(),s):n.domain()},s.interpolator=function(t){return arguments.length?(e=t,s):e},s.copy=function(){return t().domain(n.domain()).clamp(o).interpolator(e)},s.ticks=function(t){return n.ticks(t)},s.tickFormat=function(t,e){return n.tickFormat(t,e)},s.nice=function(t){return n.nice(t),a(),s},s},"bin-linear":function t(){var e=bp(),n=[];function r(t){return e(t)}return r.domain=function(t){return arguments.length?(function(t){n=qp(t),e.domain([n[0],Object(H.S)(n)])}(t),r):n.slice()},r.range=function(t){return arguments.length?(e.range(t),r):e.range()},r.rangeRound=function(t){return arguments.length?(e.rangeRound(t),r):e.rangeRound()},r.interpolate=function(t){return arguments.length?(e.interpolate(t),r):e.interpolate()},r.invert=function(t){return e.invert(t)},r.ticks=function(t){var e=n.length,i=~~(e/(t||e));return i<2?r.domain():n.filter(function(t,e){return!(e%i)})},r.tickFormat=function(){return e.tickFormat.apply(e,arguments)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r},"bin-ordinal":function t(){var e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(Tf(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=qp(t),r):e.slice()},r.range=function(t){return arguments.length?(n=Wp.call(t),r):n.slice()},r.tickFormat=function(){var t=bp().domain([e[0],Object(H.S)(e)]);return t.tickFormat.apply(t,arguments)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}};for(var $p in Hp)Vp($p,Hp[$p]);function Gp(t,e){var n=e[0],r=Object(H.S)(e)-n;return function(e){return t(n+e*r)}}function Kp(t,e,n){var r=n-e;return r&&isFinite(r)?"linear"===t.type||"sequential"===t.type?function(t){return(t-e)/r}:t.copy().domain([e,n]).range([0,1]).interpolate(Xp):Object(H.l)(0)}function Xp(t,e){var n=e-t;return function(e){return t+e*n}}function Yp(t,e){var n=o[function(t){return"interpolate"+t.toLowerCase().split("-").map(function(t){return t[0].toUpperCase()+t.slice(1)}).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function Jp(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Zp=Jp("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),Qp=Jp("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),tm=Jp("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),em=Jp("4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac"),nm=Jp("4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),rm=new Array(3).concat("67a9cff7f7f7f1a340","0571b092c5defdb863e66101","0571b092c5def7f7f7fdb863e66101","2166ac67a9cfd1e5f0fee0b6f1a340b35806","2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806","2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806","2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806","0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08","0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08").map(Jp),im=function(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n},om=im("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),am=im("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),sm=im("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),um=im("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),cm=im("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),lm=im("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),fm=im("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),dm=im("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),hm=im("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function pm(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var mm=pm(im("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),gm=pm(im("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),vm=pm(im("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),bm=pm(im("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),ym=ep(ch(-100,.75,.35),ch(80,1.5,.8)),wm=ep(ch(260,.75,.35),ch(80,1.5,.8)),xm=ch(),_m=function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return xm.h=360*t-100,xm.s=1.5-1.5*e,xm.l=.8-.9*e,xm+""},km=Cd(),Sm=Math.PI/3,Em=2*Math.PI/3,Om=function(t){var e;return t=(.5-t)*Math.PI,km.r=255*(e=Math.sin(t))*e,km.g=255*(e=Math.sin(t+Sm))*e,km.b=255*(e=Math.sin(t+Em))*e,km+""},Am=im("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Cm=function(t){return Sh(t[t.length-1])},Mm=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(im),Nm=Cm(Mm),Tm=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(im),Im=Cm(Tm),Dm=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(im),jm=Cm(Dm),Rm=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(im),Fm=Cm(Rm),Pm=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(im),zm=Cm(Pm),Lm=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(im),Bm=Cm(Lm),Um=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(im),Wm=Cm(Um),qm=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(im),Vm=Cm(qm),Hm=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(im),$m=Cm(Hm),Gm=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(im),Km=Cm(Gm),Xm=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(im),Ym=Cm(Xm),Jm=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(im),Zm=Cm(Jm),Qm=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(im),tg=Cm(Qm),eg=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(im),ng=Cm(eg),rg=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(im),ig=Cm(rg),og=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(im),ag=Cm(og),sg=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(im),ug=Cm(sg),cg=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(im),lg=Cm(cg),fg=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(im),dg=Cm(fg),hg=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(im),pg=Cm(hg),mg=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(im),gg=Cm(mg),vg=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(im),bg=Cm(vg),yg=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(im),wg=Cm(yg),xg=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(im),_g=Cm(xg),kg=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(im),Sg=Cm(kg),Eg=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(im),Og=Cm(Eg),Ag=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(im),Cg=Cm(Ag),Mg=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},Ng=ep(ch(300,.5,0),ch(-240,.5,1)),Tg=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"},Ig={blueorange:rm},Dg={category10:om,accent:am,dark2:sm,paired:um,pastel1:cm,pastel2:lm,set1:fm,set2:dm,set3:hm,category20:Zp,category20b:Qp,category20c:tm,tableau10:em,tableau20:nm,viridis:mm,magma:gm,inferno:vm,plasma:bm,rainbow:_m,sinebow:Om,blueorange:Sh(Object(H.S)(rm))};function jg(t,e){Dg[t]=a["interpolate"+e],Ig[t]=a["scheme"+e]}function Rg(t,e){if(arguments.length>1)return Dg[t]=e,this;var n=t.split("-");return t=n[0],(n=+n[1]+1)&&Ig.hasOwnProperty(t)?Ig[t][n-1]:!n&&Dg.hasOwnProperty(t)?Dg[t]:void 0}function Fg(t,e,n){return arguments.length>1?(Ig[t]=e,Dg[t]=n||Sh(Object(H.S)(e)),this):Ig.hasOwnProperty(t)?Ig[t]:void 0}jg("blues","Blues"),jg("greens","Greens"),jg("greys","Greys"),jg("purples","Purples"),jg("reds","Reds"),jg("oranges","Oranges"),jg("brownbluegreen","BrBG"),jg("purplegreen","PRGn"),jg("pinkyellowgreen","PiYG"),jg("purpleorange","PuOr"),jg("redblue","RdBu"),jg("redgrey","RdGy"),jg("redyellowblue","RdYlBu"),jg("redyellowgreen","RdYlGn"),jg("spectral","Spectral"),jg("bluegreen","BuGn"),jg("bluepurple","BuPu"),jg("greenblue","GnBu"),jg("orangered","OrRd"),jg("purplebluegreen","PuBuGn"),jg("purpleblue","PuBu"),jg("purplered","PuRd"),jg("redpurple","RdPu"),jg("yellowgreenblue","YlGnBu"),jg("yellowgreen","YlGn"),jg("yelloworangebrown","YlOrBr"),jg("yelloworangered","YlOrRd");var Pg={millisecond:oe,second:ce,minute:fe,hour:he,day:me,week:ve,month:Ee,year:Ae},zg={millisecond:oe,second:ce,minute:Me,hour:Te,day:De,week:Re,month:qe,year:He};function Lg(t){return Pg.hasOwnProperty(t)&&Pg[t]}function Bg(t){return zg.hasOwnProperty(t)&&zg[t]}function Ug(t,e){var n;return Object(H.F)(e)&&(n=e.step,e=e.interval),Object(H.H)(e)&&(e="time"===t.type?Lg(e):"utc"===t.type?Bg(e):Object(H.n)("Only time and utc scales accept interval strings."),n&&(e=e.every(n))),e}function Wg(t,e,n){var r=t.range(),i=r[0],o=Object(H.S)(r);if(i>o&&(r=o,o=i,i=r),e=e.filter(function(e){return!((e=t(e))<i||e>o)}),n>0&&e.length>1){for(var a=[e[0],Object(H.S)(e)];e.length>n&&e.length>=3;)e=e.filter(function(t,e){return!(e%2)});e.length<3&&(e=a)}return e}function qg(t,e){return t.ticks?t.ticks(e):t.domain()}function Vg(t,e,n){var r=t.tickFormat?t.tickFormat(e,n):n?Object(mp.format)(n):String;return t.type===vf?function(t,e){return function(n){return t(n)?e(n):""}}(r,function(t){var e=Object(mp.formatSpecifier)(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,e){return function(n){var r,i,o=t(n),a=o.indexOf(e);if(a<0)return o;for(i=(r=function(t,e){var n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if((n=t.charCodeAt(r))>=48&&n<=57)return r+1}(o,a))<o.length?o.slice(r):"";--r>a;)if("0"!==o[r]){++r;break}return o.slice(0,r)+i}}(Object(mp.format)(e),Object(mp.format)(".1f")(1)[1])}return Object(mp.format)(e)}(n)):r}function Hg(t){Tr.call(this,null,t)}function $g(t){Tr.call(this,null,t)}function Gg(){return Z({})}function Kg(t){return t.exit}function Xg(t){Tr.call(this,null,t)}Object(H.y)(Hg,Tr).transform=function(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=this.value,i=t.scale,o=null==t.count?t.values?t.values.length:10:Ug(i,t.count),a=t.format||Vg(i,o,t.formatSpecifier),s=t.values?Wg(i,t.values,o):qg(i,o);return r&&(n.rem=r),r=s.map(function(t,e){return Z({index:e/(s.length-1),value:t,label:a(t)})}),t.extra&&r.length&&r.push(Z({index:-1,extra:{value:r[0].value},label:""})),n.source=r,n.add=r,this.value=r,n},Object(H.y)($g,Tr).transform=function(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||Gg,o=t.key||Y,a=this.value;return Object(H.A)(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&Object(H.n)("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=Object(H.s)().test(Kg),a.lookup=function(t){return a.get(o(t))}),e.visit(e.ADD,function(t){var e=o(t),n=a.get(e);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(a.set(e,n=i(t)),r.add.push(n)),n.datum=t,n.exit=!1}),e.visit(e.MOD,function(t){var e=o(t),n=a.get(e);n&&(n.datum=t,r.mod.push(n))}),e.visit(e.REM,function(t){var e=o(t),n=a.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)}),e.changed(e.ADD_MOD)&&r.modifies("datum"),t.clean&&a.empty>n.cleanThreshold&&n.runAfter(a.clean),r},Object(H.y)(Xg,Tr).transform=function(t,e){var n=e.fork(e.ADD_REM),r=t.encoders,i=e.encode;if(Object(H.A)(i)){if(!n.changed()&&!i.every(function(t){return r[t]}))return e.StopPropagation;i=i[0],n.encode=null}var o="enter"===i,a=r.update||H.r,s=r.enter||H.r,u=r.exit||H.r,c=(i&&!o?r[i]:a)||H.r;if(e.changed(e.ADD)&&(e.visit(e.ADD,function(e){s(e,t),a(e,t),c!==H.r&&c!==a&&c(e,t)}),n.modifies(s.output),n.modifies(a.output),c!==H.r&&c!==a&&n.modifies(c.output)),e.changed(e.REM)&&u!==H.r&&(e.visit(e.REM,function(e){u(e,t)}),n.modifies(u.output)),o||c!==H.r){var l=e.MOD|(t.modified()?e.REFLOW:0);o?(e.visit(l,function(e){var r=s(e,t);(c(e,t)||r)&&n.mod.push(e)}),n.mod.length&&n.modifies(s.output)):e.visit(l,function(e){c(e,t)&&n.mod.push(e)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation};var Yg="symbol",Jg="discrete",Zg={};function Qg(t,e){return isFinite(t)?e(t):null}function tv(t){Tr.call(this,[],t)}Zg[wf]=function(t){var e=[-1/0].concat(t.quantiles());return e.max=1/0,e},Zg[xf]=function(t){var e=t.domain(),n=e[0],r=Object(H.S)(e),i=t.range().length,o=new Array(i),a=0;for(o[0]=-1/0;++a<i;)o[a]=(a*r-(a-i)*n)/i;return o.max=1/0,o},Zg[_f]=function(t){var e=[-1/0].concat(t.domain());return e.max=1/0,e},Zg["bin-linear"]=Zg[kf]=function(t){var e=t.domain();return e.max=e.pop(),e},Object(H.y)(tv,Tr).transform=function(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,o,a=e.fork(e.NO_SOURCE|e.NO_FIELDS),s=this.value,u=t.type||Yg,c=t.scale,l=null==t.count?5:Ug(c,t.count),f=t.format||Vg(c,l,t.formatSpecifier),d=t.values||function(t,e){var n=Zg[t.type];return n?n(t):qg(t,e)}(c,l);return f=function(t,e,n){return n===Yg&&Zg[t.type]?function(t){return function(e,n,r){var i=r[n+1]||r.max||1/0,o=Qg(e,t),a=Qg(i,t);return o&&a?o+"–"+a:a?"< "+a:"≥ "+o}}(e):n===Jg?function(t){return function(e,n){return n?t(e):null}}(e):function(t){return function(e){return t(e)}}(e)}(c,f,u),s&&(a.rem=s),u===Yg?(Object(H.D)(i=t.size)?(t.values||0!==c(d[0])||(d=d.slice(1)),o=d.reduce(function(e,n){return Math.max(e,i(n,t))},0)):i=Object(H.l)(o=i||8),s=d.map(function(e,n){return Z({index:n,label:f(e,n,d),value:e,offset:o,size:i(e,t)})})):"gradient"===u?(n=c.domain(),r=Kp(c,n[0],Object(H.S)(n)),d.length<3&&!t.values&&n[0]!==Object(H.S)(n)&&(d=[n[0],Object(H.S)(n)]),s=d.map(function(t,e){return Z({index:e,label:f(t,e,d),value:t,perc:r(t)})})):(i=d.length-1,r=function(t){var e=t.domain(),n=e.length-1,r=+e[0],i=+Object(H.S)(e),o=i-r;if(t.type===_f){var a=n?o/n:.1;o=(i+=a)-(r-=a)}return function(t){return(t-r)/o}}(c),s=d.map(function(t,e){return Z({index:e,label:f(t,e,d),value:t,perc:e?r(t):0,perc2:e===i?1:r(d[e+1])})})),a.source=s,a.add=s,this.value=s,a};var ev=Object(H.s)({line:sv,"line-radial":function(t,e,n,r){return sv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},arc:uv,"arc-radial":function(t,e,n,r){return uv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},curve:cv,"curve-radial":function(t,e,n,r){return cv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(t,e,n,r){return"M"+t+","+e+"V"+r+"H"+n},"orthogonal-vertical":function(t,e,n,r){return"M"+t+","+e+"H"+n+"V"+r},"orthogonal-radial":function(t,e,n,r){var i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),s=Math.sin(n);return"M"+e*i+","+e*o+"A"+e+","+e+" 0 0,"+((Math.abs(n-t)>Math.PI?n<=t:n>t)?1:0)+" "+e*a+","+e*s+"L"+r*a+","+r*s},"diagonal-horizontal":function(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(t,e,n,r){var i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),s=Math.sin(n),u=(e+r)/2;return"M"+e*i+","+e*o+"C"+u*i+","+u*o+" "+u*a+","+u*s+" "+r*a+","+r*s}});function nv(t){return t.source.x}function rv(t){return t.source.y}function iv(t){return t.target.x}function ov(t){return t.target.y}function av(t){Tr.call(this,{},t)}function sv(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function uv(t,e,n,r){var i=n-t,o=r-e,a=Math.sqrt(i*i+o*o)/2;return"M"+t+","+e+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r}function cv(t,e,n,r){var i=n-t,o=r-e,a=.2*(i+o),s=.2*(o-i);return"M"+t+","+e+"C"+(t+a)+","+(e+s)+" "+(n+s)+","+(r-a)+" "+n+","+r}function lv(t){Tr.call(this,null,t)}av.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},Object(H.y)(av,Tr).transform=function(t,e){var n=t.sourceX||nv,r=t.sourceY||rv,i=t.targetX||iv,o=t.targetY||ov,a=t.as||"path",s=t.orient||"vertical",u=t.shape||"line",c=ev.get(u+"-"+s)||ev.get(u);return c||Object(H.n)("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,function(t){t[a]=c(n(t),r(t),i(t),o(t))}),e.reflow(t.modified()).modifies(a)},lv.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},Object(H.y)(lv,Tr).transform=function(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],s=o[1],u=t.field||H.M,c=t.startAngle||0,l=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,d=f.map(u),h=d.length,p=c,m=(l-c)/function(t,e){let n=0;for(let e of t)(e=+e)&&(n+=e);return n}(d),g=Ui(h);for(t.sort&&g.sort(function(t,e){return d[t]-d[e]}),n=0;n<h;++n)i=d[g[n]],(r=f[g[n]])[a]=p,r[s]=p+=i*m;return this.value=d,e.reflow(t.modified()).modifies(o)};var fv=Object(H.Ba)(["linear","pow",bf]),dv=Object(H.Ba)(["linear",vf,"pow",bf,"time","utc"]),hv=Object(H.Ba)(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function pv(t){Tr.call(this,null,t),this.modified(!0)}function mv(t,e,n){return t===vf&&Math.abs(e.reduce(function(t,e){return t+(e<0?-1:e>0?1:0)},0))!==e.length&&n.warn("Log scale domain includes zero: "+Object(H.X)(e)),e}function gv(t,e,n){return Object(H.D)(t)&&(e||n)?Gp(t,vv(e||[0,1],n)):t}function vv(t,e){return e?t.slice().reverse():t}function bv(t){Tr.call(this,null,t)}Object(H.y)(pv,Tr).transform=function(t,e){var n,r=e.dataflow,i=this.value;for(n in i&&!t.modified("type")||(this.value=i=Vp((t.type||"linear").toLowerCase())()),t)if(!hv[n]){if("padding"===n&&dv[i.type])continue;Object(H.D)(i[n])?i[n](t[n]):r.warn("Unsupported scale property: "+n)}return function(t,e,n){var r=e.round||!1,i=e.range;if(null!=e.rangeStep)i=function(t,e,n){"band"!==t&&"point"!==t&&Object(H.n)("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i="point"===t?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Ef(n,i,r)]}(t.type,e,n);else if(e.scheme){if(i=function(t,e,n){var r,i=e.scheme.toLowerCase(),o=Rg(i),a=e.schemeExtent;return o||Object(H.n)("Unrecognized scheme name: "+e.scheme),n=t===_f?n+1:t===kf?n-1:t===wf||t===xf?+e.schemeCount||5:n,t===Sf?gv(o,a,e.reverse):!a&&(r=Rg(i+"-"+n))?r:Object(H.D)(o)?function(t,e){for(var n=new Array(e),r=e+1,i=0;i<e;)n[i]=t(++i/r);return n}(gv(o,a),n):t===yf?o:o.slice(0,n)}(t.type,e,n),Object(H.D)(i))return t.interpolator(i)}else if(i&&t.type===Sf)return t.interpolator(Sh(vv(i,e.reverse)));i&&e.interpolate&&t.interpolate?t.interpolate(Yp(e.interpolate,e.interpolateGamma)):Object(H.D)(t.round)?t.round(r):Object(H.D)(t.rangeRound)&&t.interpolate(r?Fh:Dh),i&&t.range(vv(i,e.reverse))}(i,t,function(t,e,n){var r=function(t,e,n){return e?(t.domain(mv(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,o,a=e.domain,s=t.type,u=e.zero||void 0===e.zero&&fv[s];return a?(dv[s]&&e.padding&&a[0]!==Object(H.S)(a)&&(a=function(t,e,n,r,i){var o=Math.abs(Object(H.S)(n)-n[0]),a=o/(o-2*r),s=t===vf?Object(H.Ja)(e,null,a):t===bf?Object(H.Ka)(e,null,a,.5):"pow"===t?Object(H.Ka)(e,null,a,i):Object(H.Ia)(e,null,a);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(s,a,e.range,e.padding,e.exponent)),(u||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(a=a.slice()).length-1||1,u&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=e.domainMin&&(a[0]=e.domainMin),null!=e.domainMax&&(a[i]=e.domainMax),null!=e.domainMid&&(((o=e.domainMid)<a[0]||o>a[i])&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(i,0,o))),t.domain(mv(s,a,n)),s===yf&&t.unknown(e.domainImplicit?od:void 0),e.nice&&t.nice&&t.nice(!0!==e.nice&&Ug(t,e.nice)||null),a.length):0}(i,t,r)),e.fork(e.NO_SOURCE|e.NO_FIELDS)},Object(H.y)(bv,Tr).transform=function(t,e){var n=t.modified("sort")||e.changed(e.ADD)||e.modified(t.sort.fields)||e.modified("datum");return n&&e.source.sort(t.sort),this.modified(n),e};var yv=["y0","y1"];function wv(t){Tr.call(this,null,t)}function xv(t,e,n,r,i){for(var o,a=(e-t.sum)/2,s=t.length,u=0;u<s;++u)(o=t[u])[r]=a,o[i]=a+=Math.abs(n(o))}function _v(t,e,n,r,i){for(var o,a=1/t.sum,s=0,u=t.length,c=0,l=0;c<u;++c)(o=t[c])[r]=s,o[i]=s=a*(l+=Math.abs(n(o)))}function kv(t,e,n,r,i){for(var o,a,s=0,u=0,c=t.length,l=0;l<c;++l)(o=n(a=t[l]))<0?(a[r]=u,a[i]=u+=o):(a[r]=s,a[i]=s+=o)}wv.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:"zero",values:["zero","center","normalize"]},{name:"as",type:"string",array:!0,length:2,default:yv}]},Object(H.y)(wv,Tr).transform=function(t,e){var n,r,i,o,a=t.as||yv,s=a[0],u=a[1],c=t.field||H.M,l="center"===t.offset?xv:"normalize"===t.offset?_v:kv;for(n=function(t,e,n,r){var i,o,a,s,u,c,l,f,d,h=[],p=function(t){return t(u)};if(null==e)h.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)u=t[o],(l=i[c=e.map(p)])||(i[c]=l=[],h.push(l)),l.push(u);for(c=0,d=0,s=h.length;c<s;++c){for(o=0,f=0,a=(l=h[c]).length;o<a;++o)f+=Math.abs(r(l[o]));l.sum=f,f>d&&(d=f),n&&l.sort(n)}return h.max=d,h}(e.source,t.groupby,t.sort,c),r=0,i=n.length,o=n.max;r<i;++r)l(n[r],o,c,s,u);return e.reflow(t.modified()).modifies(a)};var Sv=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},Ev=function(t){return 1===t.length&&(t=function(t){return function(e,n){return Sv(t(e),n)}}(t)),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}(Sv);Ev.right,Ev.left;var Ov=function(t,e){var n,r,i,o=t.length,a=-1;if(null==e){for(;++a<o;)if(null!=(n=t[a])&&n>=n)for(r=i=n;++a<o;)null!=(n=t[a])&&(r>n&&(r=n),i<n&&(i=n))}else for(;++a<o;)if(null!=(n=e(t[a],a,t))&&n>=n)for(r=i=n;++a<o;)null!=(n=e(t[a],a,t))&&(r>n&&(r=n),i<n&&(i=n));return[r,i]},Av=Array.prototype,Cv=(Av.slice,Av.map,function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}),Mv=Math.sqrt(50),Nv=Math.sqrt(10),Tv=Math.sqrt(2);function Iv(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Mv?i*=10:o>=Nv?i*=5:o>=Tv&&(i*=2),e<t?-i:i}var Dv=function(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1},jv=function(t,e){var n,r,i=t.length,o=-1;if(null==e){for(;++o<i;)if(null!=(n=t[o])&&n>=n)for(r=n;++o<i;)null!=(n=t[o])&&n>r&&(r=n)}else for(;++o<i;)if(null!=(n=e(t[o],o,t))&&n>=n)for(r=n;++o<i;)null!=(n=e(t[o],o,t))&&n>r&&(r=n);return r},Rv=Array.prototype.slice,Fv=function(t,e){return t-e},Pv=function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r},zv=function(t){return function(){return t}},Lv=function(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Bv(t,e[r]))return n;return 0};function Bv(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,s=a-1;o<a;s=o++){var u=t[o],c=u[0],l=u[1],f=t[s],d=f[0],h=f[1];if(Uv(u,f,e))return 0;l>r!=h>r&&n<(d-c)*(r-l)/(h-l)+c&&(i=-i)}return i}function Uv(t,e,n){var r;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&function(t,e,n){return t<=e&&e<=n||n<=e&&e<=t}(t[r=+(t[0]===e[0])],n[r],e[r])}var Wv=function(){},qv=[[],[[[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]]],[]],Vv=function(){var t=1,e=1,n=Dv,r=s;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Fv);else{var r=Ov(t),i=r[0],a=r[1];e=Iv(i,a,e),e=Cv(Math.floor(i/e)*e,Math.floor(a/e)*e,e)}return e.map(function(e){return o(t,e)})}function o(n,i){var o=[],s=[];return function(n,r,i){var o,s,u,c,l,f,d=new Array,h=new Array;for(o=s=-1,c=n[0]>=r,qv[c<<1].forEach(p);++o<t-1;)u=c,c=n[o+1]>=r,qv[u|c<<1].forEach(p);for(qv[c<<0].forEach(p);++s<e-1;){for(o=-1,c=n[s*t+t]>=r,l=n[s*t]>=r,qv[c<<1|l<<2].forEach(p);++o<t-1;)u=c,c=n[s*t+t+o+1]>=r,f=l,l=n[s*t+o+1]>=r,qv[u|c<<1|l<<2|f<<3].forEach(p);qv[c|l<<3].forEach(p)}for(o=-1,l=n[s*t]>=r,qv[l<<2].forEach(p);++o<t-1;)f=l,l=n[s*t+o+1]>=r,qv[l<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+s],u=[t[1][0]+o,t[1][1]+s],c=a(r),l=a(u);(e=h[c])?(n=d[l])?(delete h[e.end],delete d[n.start],e===n?(e.ring.push(u),i(e.ring)):d[e.start]=h[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[e.end],e.ring.push(u),h[e.end=l]=e):(e=d[l])?(n=h[c])?(delete d[e.start],delete h[n.end],e===n?(e.ring.push(u),i(e.ring)):d[n.start]=h[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(r),d[e.start=c]=e):d[c]=h[l]={start:c,end:l,ring:[r,u]}}qv[l<<3].forEach(p)}(n,i,function(t){r(t,n,i),Pv(t)>0?o.push([t]):s.push(t)}),s.forEach(function(t){for(var e,n=0,r=o.length;n<r;++n)if(-1!==Lv((e=o[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:i,coordinates:o}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function s(n,r,i){n.forEach(function(n){var o,a=n[0],s=n[1],u=0|a,c=0|s,l=r[c*t+u];a>0&&a<t&&u===a&&(o=r[c*t+u-1],n[0]=a+(i-o)/(l-o)-.5),s>0&&s<e&&c===s&&(o=r[(c-1)*t+u],n[1]=s+(i-o)/(l-o)-.5)})}return i.contour=o,i.size=function(n){if(!arguments.length)return[t,e];var r=Math.ceil(n[0]),o=Math.ceil(n[1]);if(!(r>0&&o>0))throw new Error("invalid size");return t=r,e=o,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?zv(Rv.call(t)):zv(t),i):n},i.smooth=function(t){return arguments.length?(r=t?s:Wv,i):r===s},i};function Hv(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a<i;++a)for(var s=0,u=0;s<r+n;++s)s<r&&(u+=t.data[s+a*r]),s>=n&&(s>=o&&(u-=t.data[s-o+a*r]),e.data[s-n+a*r]=u/Math.min(s+1,r-1+o-s,o))}function $v(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a<r;++a)for(var s=0,u=0;s<i+n;++s)s<i&&(u+=t.data[a+s*r]),s>=n&&(s>=o&&(u-=t.data[a+(s-o)*r]),e.data[a+(s-n)*r]=u/Math.min(s+1,i-1+o-s,o))}function Gv(t){return t[0]}function Kv(t){return t[1]}function Xv(){return 1}var Yv=["size","smooth"],Jv=["x","y","weight","size","cellSize","bandwidth"];function Zv(t){Tr.call(this,null,t)}Zv.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"smooth",type:"boolean"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0}]},Object(H.y)(Zv,Tr).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,r,i,o=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=t.count||10;return t.values?(n=Vv(),r=Yv,i=t.values):(n=function(){var t=Gv,e=Kv,n=Xv,r=960,i=500,o=20,a=2,s=3*o,u=r+2*s>>a,c=i+2*s>>a,l=zv(20);function f(r){var i=new Float32Array(u*c),f=new Float32Array(u*c);r.forEach(function(r,o,l){var f=+t(r,o,l)+s>>a,d=+e(r,o,l)+s>>a,h=+n(r,o,l);f>=0&&f<u&&d>=0&&d<c&&(i[f+d*u]+=h)}),Hv({width:u,height:c,data:i},{width:u,height:c,data:f},o>>a),$v({width:u,height:c,data:f},{width:u,height:c,data:i},o>>a),Hv({width:u,height:c,data:i},{width:u,height:c,data:f},o>>a),$v({width:u,height:c,data:f},{width:u,height:c,data:i},o>>a),Hv({width:u,height:c,data:i},{width:u,height:c,data:f},o>>a),$v({width:u,height:c,data:f},{width:u,height:c,data:i},o>>a);var h=l(i);if(!Array.isArray(h)){var p=jv(i);h=Iv(0,p,h),(h=Cv(0,Math.floor(p/h)*h,h)).shift()}return Vv().thresholds(h).size([u,c])(i).map(d)}function d(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(h),t}function h(t){t.forEach(p)}function p(t){t.forEach(m)}function m(t){t[0]=t[0]*Math.pow(2,a)-s,t[1]=t[1]*Math.pow(2,a)-s}function g(){return u=r+2*(s=3*o)>>a,c=i+2*s>>a,f}return f.x=function(e){return arguments.length?(t="function"==typeof e?e:zv(+e),f):t},f.y=function(t){return arguments.length?(e="function"==typeof t?t:zv(+t),f):e},f.weight=function(t){return arguments.length?(n="function"==typeof t?t:zv(+t),f):n},f.size=function(t){if(!arguments.length)return[r,i];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return r=e,i=n,g()},f.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),g()},f.thresholds=function(t){return arguments.length?(l="function"==typeof t?t:Array.isArray(t)?zv(Rv.call(t)):zv(t),f):l},f.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),g()},f}(),r=Jv,i=e.materialize(e.SOURCE).source),n.thresholds(t.thresholds||(t.nice?a:function(t){return function(e){for(var n=Bi(e),r=n[0],i=n[1]-r,o=[],a=1;a<=t;++a)o.push(r+i*a/(t+1));return o}}(a))),r.forEach(function(e){null!=t[e]&&n[e](t[e])}),this.value&&(o.rem=this.value),i=i&&i.length?n(i).map(Z):[],this.value=o.source=o.add=i,o};var Qv="FeatureCollection";function tb(t){Tr.call(this,null,t)}tb.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},Object(H.y)(tb,Tr).transform=function(t,e){var n,r=this._features,i=this._points,o=t.fields,a=o&&o[0],s=o&&o[1],u=t.geojson,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(Object(H.g)(u))||a&&e.modified(Object(H.g)(a))||s&&e.modified(Object(H.g)(s)),this.value&&!n||(c=e.SOURCE,this._features=r=[],this._points=i=[]),u&&e.visit(c,function(t){r.push(u(t))}),a&&s&&(e.visit(c,function(t){var e=a(t),n=s(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&i.push([e,n])}),r=r.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:Qv,features:r}};var eb=function(){return new nb};function nb(){this.reset()}nb.prototype={constructor:nb,reset:function(){this.s=this.t=0},add:function(t){ib(rb,t,this.t),ib(this,rb.s,this.s),this.s?this.t+=rb.t:this.s=rb.t},valueOf:function(){return this.s}};var rb=new nb;function ib(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var ob=1e-6,ab=Math.PI,sb=ab/2,ub=ab/4,cb=2*ab,lb=180/ab,fb=ab/180,db=Math.abs,hb=Math.atan,pb=Math.atan2,mb=Math.cos,gb=Math.ceil,vb=Math.exp,bb=(Math.floor,Math.log),yb=Math.pow,wb=Math.sin,xb=Math.sign||function(t){return t>0?1:t<0?-1:0},_b=Math.sqrt,kb=Math.tan;function Sb(t){return t>1?0:t<-1?ab:Math.acos(t)}function Eb(t){return t>1?sb:t<-1?-sb:Math.asin(t)}function Ob(){}function Ab(t,e){t&&Mb.hasOwnProperty(t.type)&&Mb[t.type](t,e)}var Cb={Feature:function(t,e){Ab(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Ab(n[r].geometry,e)}},Mb={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Nb(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Nb(n[r],e,0)},Polygon:function(t,e){Tb(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Tb(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Ab(n[r],e)}};function Nb(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Tb(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Nb(t[n],e,1);e.polygonEnd()}var Ib,Db,jb,Rb,Fb,Pb=function(t,e){t&&Cb.hasOwnProperty(t.type)?Cb[t.type](t,e):Ab(t,e)},zb=eb(),Lb=eb(),Bb={point:Ob,lineStart:Ob,lineEnd:Ob,polygonStart:function(){zb.reset(),Bb.lineStart=Ub,Bb.lineEnd=Wb},polygonEnd:function(){var t=+zb;Lb.add(t<0?cb+t:t),this.lineStart=this.lineEnd=this.point=Ob},sphere:function(){Lb.add(cb)}};function Ub(){Bb.point=qb}function Wb(){Vb(Ib,Db)}function qb(t,e){Bb.point=Vb,Ib=t,Db=e,jb=t*=fb,Rb=mb(e=(e*=fb)/2+ub),Fb=wb(e)}function Vb(t,e){e=(e*=fb)/2+ub;var n=(t*=fb)-jb,r=n>=0?1:-1,i=r*n,o=mb(e),a=wb(e),s=Fb*a,u=Rb*o+s*mb(i),c=s*r*wb(i);zb.add(pb(c,u)),jb=t,Rb=o,Fb=a}function Hb(t){return[pb(t[1],t[0]),Eb(t[2])]}function $b(t){var e=t[0],n=t[1],r=mb(n);return[r*mb(e),r*wb(e),wb(n)]}function Gb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Kb(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Xb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Yb(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Jb(t){var e=_b(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Zb,Qb,ty,ey,ny,ry,iy,oy,ay,sy,uy=eb(),cy={point:ly,lineStart:dy,lineEnd:hy,polygonStart:function(){cy.point=py,cy.lineStart=my,cy.lineEnd=gy,uy.reset(),Bb.polygonStart()},polygonEnd:function(){Bb.polygonEnd(),cy.point=ly,cy.lineStart=dy,cy.lineEnd=hy,zb<0?(Zb=-(ty=180),Qb=-(ey=90)):uy>ob?ey=90:uy<-ob&&(Qb=-90),sy[0]=Zb,sy[1]=ty},sphere:function(){Zb=-(ty=180),Qb=-(ey=90)}};function ly(t,e){ay.push(sy=[Zb=t,ty=t]),e<Qb&&(Qb=e),e>ey&&(ey=e)}function fy(t,e){var n=$b([t*fb,e*fb]);if(oy){var r=Kb(oy,n),i=Kb([r[1],-r[0],0],r);Jb(i),i=Hb(i);var o,a=t-ny,s=a>0?1:-1,u=i[0]*lb*s,c=db(a)>180;c^(s*ny<u&&u<s*t)?(o=i[1]*lb)>ey&&(ey=o):c^(s*ny<(u=(u+360)%360-180)&&u<s*t)?(o=-i[1]*lb)<Qb&&(Qb=o):(e<Qb&&(Qb=e),e>ey&&(ey=e)),c?t<ny?vy(Zb,t)>vy(Zb,ty)&&(ty=t):vy(t,ty)>vy(Zb,ty)&&(Zb=t):ty>=Zb?(t<Zb&&(Zb=t),t>ty&&(ty=t)):t>ny?vy(Zb,t)>vy(Zb,ty)&&(ty=t):vy(t,ty)>vy(Zb,ty)&&(Zb=t)}else ay.push(sy=[Zb=t,ty=t]);e<Qb&&(Qb=e),e>ey&&(ey=e),oy=n,ny=t}function dy(){cy.point=fy}function hy(){sy[0]=Zb,sy[1]=ty,cy.point=ly,oy=null}function py(t,e){if(oy){var n=t-ny;uy.add(db(n)>180?n+(n>0?360:-360):n)}else ry=t,iy=e;Bb.point(t,e),fy(t,e)}function my(){Bb.lineStart()}function gy(){py(ry,iy),Bb.lineEnd(),db(uy)>ob&&(Zb=-(ty=180)),sy[0]=Zb,sy[1]=ty,oy=null}function vy(t,e){return(e-=t)<0?e+360:e}function by(t,e){return t[0]-e[0]}function yy(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var wy,xy,_y,ky,Sy,Ey,Oy,Ay,Cy,My,Ny,Ty,Iy,Dy,jy,Ry,Fy={sphere:Ob,point:Py,lineStart:Ly,lineEnd:Wy,polygonStart:function(){Fy.lineStart=qy,Fy.lineEnd=Vy},polygonEnd:function(){Fy.lineStart=Ly,Fy.lineEnd=Wy}};function Py(t,e){t*=fb;var n=mb(e*=fb);zy(n*mb(t),n*wb(t),wb(e))}function zy(t,e,n){_y+=(t-_y)/++wy,ky+=(e-ky)/wy,Sy+=(n-Sy)/wy}function Ly(){Fy.point=By}function By(t,e){t*=fb;var n=mb(e*=fb);Dy=n*mb(t),jy=n*wb(t),Ry=wb(e),Fy.point=Uy,zy(Dy,jy,Ry)}function Uy(t,e){t*=fb;var n=mb(e*=fb),r=n*mb(t),i=n*wb(t),o=wb(e),a=pb(_b((a=jy*o-Ry*i)*a+(a=Ry*r-Dy*o)*a+(a=Dy*i-jy*r)*a),Dy*r+jy*i+Ry*o);xy+=a,Ey+=a*(Dy+(Dy=r)),Oy+=a*(jy+(jy=i)),Ay+=a*(Ry+(Ry=o)),zy(Dy,jy,Ry)}function Wy(){Fy.point=Py}function qy(){Fy.point=Hy}function Vy(){$y(Ty,Iy),Fy.point=Py}function Hy(t,e){Ty=t,Iy=e,t*=fb,e*=fb,Fy.point=$y;var n=mb(e);Dy=n*mb(t),jy=n*wb(t),Ry=wb(e),zy(Dy,jy,Ry)}function $y(t,e){t*=fb;var n=mb(e*=fb),r=n*mb(t),i=n*wb(t),o=wb(e),a=jy*o-Ry*i,s=Ry*r-Dy*o,u=Dy*i-jy*r,c=_b(a*a+s*s+u*u),l=Eb(c),f=c&&-l/c;Cy+=f*a,My+=f*s,Ny+=f*u,xy+=l,Ey+=l*(Dy+(Dy=r)),Oy+=l*(jy+(jy=i)),Ay+=l*(Ry+(Ry=o)),zy(Dy,jy,Ry)}var Gy=function(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n};function Ky(t,e){return[db(t)>ab?t+Math.round(-t/cb)*cb:t,e]}function Xy(t,e,n){return(t%=cb)?e||n?Gy(Jy(t),Zy(e,n)):Jy(t):e||n?Zy(e,n):Ky}function Yy(t){return function(e,n){return[(e+=t)>ab?e-cb:e<-ab?e+cb:e,n]}}function Jy(t){var e=Yy(t);return e.invert=Yy(-t),e}function Zy(t,e){var n=mb(t),r=wb(t),i=mb(e),o=wb(e);function a(t,e){var a=mb(e),s=mb(t)*a,u=wb(t)*a,c=wb(e),l=c*n+s*r;return[pb(u*i-l*o,s*n-c*r),Eb(l*i+u*o)]}return a.invert=function(t,e){var a=mb(e),s=mb(t)*a,u=wb(t)*a,c=wb(e),l=c*i-u*o;return[pb(u*i+c*o,s*n+l*r),Eb(l*n-s*r)]},a}Ky.invert=Ky;var Qy=function(t){function e(e){return(e=t(e[0]*fb,e[1]*fb))[0]*=lb,e[1]*=lb,e}return t=Xy(t[0]*fb,t[1]*fb,t.length>2?t[2]*fb:0),e.invert=function(e){return(e=t.invert(e[0]*fb,e[1]*fb))[0]*=lb,e[1]*=lb,e},e};function tw(t,e){(e=$b(e))[0]-=t,Jb(e);var n=Sb(-e[1]);return((-e[2]<0?-n:n)+cb-ob)%cb}var ew=function(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:Ob,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}},nw=function(t,e){return db(t[0]-e[0])<ob&&db(t[1]-e[1])<ob};function rw(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}var iw=function(t,e,n,r,i){var o,a,s=[],u=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(nw(r,a)){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else s.push(n=new rw(r,t,null,!0)),u.push(n.o=new rw(r,null,n,!1)),s.push(n=new rw(a,t,null,!1)),u.push(n.o=new rw(a,null,n,!0))}}),s.length){for(u.sort(e),ow(s),ow(u),o=0,a=u.length;o<a;++o)u[o].e=n=!n;for(var c,l,f=s[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=c.length;o<a;++o)i.point((l=c[o])[0],l[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(c=d.p.z,o=c.length-1;o>=0;--o)i.point((l=c[o])[0],l[1]);else r(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}};function ow(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}var aw=eb();function sw(t){return db(t[0])<=ab?t[0]:xb(t[0])*((db(t[0])+ab)%cb-ab)}var uw=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},cw=function(t){return 1===t.length&&(t=function(t){return function(e,n){return uw(t(e),n)}}(t)),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}(uw);cw.right,cw.left;var lw=Array.prototype,fw=(lw.slice,lw.map,function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o});Math.sqrt(50),Math.sqrt(10),Math.sqrt(2);var dw=function(t){for(var e,n,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(n=new Array(a);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--a]=r[e];return n},hw=function(t,e,n,r){return function(i){var o,a,s,u=e(i),c=ew(),l=e(c),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=v,d.lineStart=b,d.lineEnd=y,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=dw(a);var t=function(t,e){var n=sw(e),r=e[1],i=wb(r),o=[wb(n),-mb(n),0],a=0,s=0;aw.reset(),1===i?r=sb+ob:-1===i&&(r=-sb-ob);for(var u=0,c=t.length;u<c;++u)if(f=(l=t[u]).length)for(var l,f,d=l[f-1],h=sw(d),p=d[1]/2+ub,m=wb(p),g=mb(p),v=0;v<f;++v,h=y,m=x,g=_,d=b){var b=l[v],y=sw(b),w=b[1]/2+ub,x=wb(w),_=mb(w),k=y-h,S=k>=0?1:-1,E=S*k,O=E>ab,A=m*x;if(aw.add(pb(A*S*wb(E),g*_+A*mb(E))),a+=O?k+S*cb:k,O^h>=n^y>=n){var C=Kb($b(d),$b(b));Jb(C);var M=Kb(o,C);Jb(M);var N=(O^k>=0?-1:1)*Eb(M[2]);(r>N||r===N&&(C[0]||C[1]))&&(s+=O^k>=0?1:-1)}}return(a<-ob||a<ob&&aw<-ob)^1&s}(o,r);a.length?(f||(i.polygonStart(),f=!0),iw(a,mw,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(e,n){t(e,n)&&i.point(e,n)}function p(t,e){u.point(t,e)}function m(){d.point=p,u.lineStart()}function g(){d.point=h,u.lineEnd()}function v(t,e){s.push([t,e]),l.point(t,e)}function b(){l.lineStart(),s=[]}function y(){v(s[0][0],s[0][1]),l.lineEnd();var t,e,n,r,u=l.clean(),d=c.result(),h=d.length;if(s.pop(),o.push(s),s=null,h)if(1&u){if((e=(n=d[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else h>1&&2&u&&d.push(d.pop().concat(d.shift())),a.push(d.filter(pw))}return d}};function pw(t){return t.length>1}function mw(t,e){return((t=t.x)[0]<0?t[1]-sb-ob:sb-t[1])-((e=e.x)[0]<0?e[1]-sb-ob:sb-e[1])}var gw=hw(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?ab:-ab,u=db(o-n);db(u-ab)<ob?(t.point(n,r=(r+a)/2>0?sb:-sb),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&u>=ab&&(db(n-i)<ob&&(n-=i*ob),db(o-s)<ob&&(o-=s*ob),r=function(t,e,n,r){var i,o,a=wb(t-n);return db(a)>ob?hb((wb(e)*(o=mb(r))*wb(n)-wb(r)*(i=mb(e))*wb(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*sb,r.point(-ab,i),r.point(0,i),r.point(ab,i),r.point(ab,0),r.point(ab,-i),r.point(0,-i),r.point(-ab,-i),r.point(-ab,0),r.point(-ab,i);else if(db(t[0]-e[0])>ob){var o=t[0]<e[0]?ab:-ab;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])},[-ab,-sb]),vw=function(t){var e=mb(t),n=6*fb,r=e>0,i=db(e)>ob;function o(t,n){return mb(t)*mb(n)>e}function a(t,n,r){var i=[1,0,0],o=Kb($b(t),$b(n)),a=Gb(o,o),s=o[0],u=a-s*s;if(!u)return!r&&t;var c=e*a/u,l=-e*s/u,f=Kb(i,o),d=Yb(i,c);Xb(d,Yb(o,l));var h=f,p=Gb(d,h),m=Gb(h,h),g=p*p-m*(Gb(d,d)-1);if(!(g<0)){var v=_b(g),b=Yb(h,(-p-v)/m);if(Xb(b,d),b=Hb(b),!r)return b;var y,w=t[0],x=n[0],_=t[1],k=n[1];x<w&&(y=w,w=x,x=y);var S=x-w,E=db(S-ab)<ob;if(!E&&k<_&&(y=_,_=k,k=y),E||S<ob?E?_+k>0^b[1]<(db(b[0]-w)<ob?_:k):_<=b[1]&&b[1]<=k:S>ab^(w<=b[0]&&b[0]<=x)){var O=Yb(h,(-p+v)/m);return Xb(O,d),[b,Hb(O)]}}}function s(e,n){var i=r?t:ab-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return hw(o,function(t){var e,n,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=r?m?0:s(f,d):m?s(f+(f<0?ab:-ab),d):0;if(!e&&(c=u=m)&&t.lineStart(),m!==u&&(!(h=a(e,p))||nw(e,h)||nw(p,h))&&(p[0]+=ob,p[1]+=ob,m=o(p[0],p[1])),m!==u)l=0,m?(t.lineStart(),h=a(p,e),t.point(h[0],h[1])):(h=a(e,p),t.point(h[0],h[1]),t.lineEnd()),e=h;else if(i&&e&&r^m){var v;g&n||!(v=a(p,e,!0))||(l=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||e&&nw(e,p)||t.point(p[0],p[1]),e=p,u=m,n=g},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return l|(c&&u)<<1}}},function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var a=mb(e),s=wb(e),u=r*n;null==i?(i=e+r*cb,o=e-u/2):(i=tw(a,i),o=tw(a,o),(r>0?i<o:i>o)&&(i+=r*cb));for(var c,l=i;r>0?l>o:l<o;l-=u)c=Hb([a,-s*mb(l),-s*wb(l)]),t.point(c[0],c[1])}}(o,t,n,i,e,r)},r?[0,-t]:[-ab,t-ab])},bw=function(t,e,n,r,i,o){var a,s=t[0],u=t[1],c=0,l=1,f=e[0]-s,d=e[1]-u;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<l&&(l=a)}else if(f>0){if(a>l)return;a>c&&(c=a)}if(a=i-s,f||!(a<0)){if(a/=f,f<0){if(a>l)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<l&&(l=a)}if(a=r-u,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<l&&(l=a)}else if(d>0){if(a>l)return;a>c&&(c=a)}if(a=o-u,d||!(a<0)){if(a/=d,d<0){if(a>l)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<l&&(l=a)}return c>0&&(t[0]=s+c*f,t[1]=u+c*d),l<1&&(e[0]=s+l*f,e[1]=u+l*d),!0}}}}},yw=1e9,ww=-yw;function xw(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,c){var l=0,f=0;if(null==i||(l=a(i,s))!==(f=a(o,s))||u(i,o)<0^s>0)do{c.point(0===l||3===l?t:n,l>1?r:e)}while((l=(l+s+4)%4)!==f);else c.point(o[0],o[1])}function a(r,i){return db(r[0]-t)<ob?i>0?0:3:db(r[0]-n)<ob?i>0?2:1:db(r[1]-e)<ob?i>0?1:0:i>0?3:2}function s(t,e){return u(t.x,e.x)}function u(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var u,c,l,f,d,h,p,m,g,v,b,y=a,w=ew(),x={point:_,lineStart:function(){x.point=k,c&&c.push(l=[]),v=!0,g=!1,p=m=NaN},lineEnd:function(){u&&(k(f,d),h&&g&&w.rejoin(),u.push(w.result())),x.point=_,g&&y.lineEnd()},polygonStart:function(){y=w,u=[],c=[],b=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var o,a,s=c[n],u=1,l=s.length,f=s[0],d=f[0],h=f[1];u<l;++u)o=d,a=h,d=(f=s[u])[0],h=f[1],a<=r?h>r&&(d-o)*(r-a)>(h-a)*(t-o)&&++e:h<=r&&(d-o)*(r-a)<(h-a)*(t-o)&&--e;return e}(),n=b&&e,i=(u=dw(u)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&iw(u,s,e,o,a),a.polygonEnd()),y=a,u=c=l=null}};function _(t,e){i(t,e)&&y.point(t,e)}function k(o,a){var s=i(o,a);if(c&&l.push([o,a]),v)f=o,d=a,h=s,v=!1,s&&(y.lineStart(),y.point(o,a));else if(s&&g)y.point(o,a);else{var u=[p=Math.max(ww,Math.min(yw,p)),m=Math.max(ww,Math.min(yw,m))],w=[o=Math.max(ww,Math.min(yw,o)),a=Math.max(ww,Math.min(yw,a))];bw(u,w,t,e,n,r)?(g||(y.lineStart(),y.point(u[0],u[1])),y.point(w[0],w[1]),s||y.lineEnd(),b=!1):s&&(y.lineStart(),y.point(o,a),b=!1)}p=o,m=a,g=s}return x}}function _w(t,e,n){var r=fw(t,e-ob,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function kw(t,e,n){var r=fw(t,e-ob,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}eb();var Sw,Ew,Ow,Aw,Cw=function(t){return t},Mw=eb(),Nw=eb(),Tw={point:Ob,lineStart:Ob,lineEnd:Ob,polygonStart:function(){Tw.lineStart=Iw,Tw.lineEnd=Rw},polygonEnd:function(){Tw.lineStart=Tw.lineEnd=Tw.point=Ob,Mw.add(db(Nw)),Nw.reset()},result:function(){var t=Mw/2;return Mw.reset(),t}};function Iw(){Tw.point=Dw}function Dw(t,e){Tw.point=jw,Sw=Ow=t,Ew=Aw=e}function jw(t,e){Nw.add(Aw*t-Ow*e),Ow=t,Aw=e}function Rw(){jw(Sw,Ew)}var Fw,Pw,zw,Lw,Bw=Tw,Uw=1/0,Ww=Uw,qw=-Uw,Vw=qw,Hw={point:function(t,e){t<Uw&&(Uw=t),t>qw&&(qw=t),e<Ww&&(Ww=e),e>Vw&&(Vw=e)},lineStart:Ob,lineEnd:Ob,polygonStart:Ob,polygonEnd:Ob,result:function(){var t=[[Uw,Ww],[qw,Vw]];return qw=Vw=-(Ww=Uw=1/0),t}},$w=0,Gw=0,Kw=0,Xw=0,Yw=0,Jw=0,Zw=0,Qw=0,tx=0,ex={point:nx,lineStart:rx,lineEnd:ax,polygonStart:function(){ex.lineStart=sx,ex.lineEnd=ux},polygonEnd:function(){ex.point=nx,ex.lineStart=rx,ex.lineEnd=ax},result:function(){var t=tx?[Zw/tx,Qw/tx]:Jw?[Xw/Jw,Yw/Jw]:Kw?[$w/Kw,Gw/Kw]:[NaN,NaN];return $w=Gw=Kw=Xw=Yw=Jw=Zw=Qw=tx=0,t}};function nx(t,e){$w+=t,Gw+=e,++Kw}function rx(){ex.point=ix}function ix(t,e){ex.point=ox,nx(zw=t,Lw=e)}function ox(t,e){var n=t-zw,r=e-Lw,i=_b(n*n+r*r);Xw+=i*(zw+t)/2,Yw+=i*(Lw+e)/2,Jw+=i,nx(zw=t,Lw=e)}function ax(){ex.point=nx}function sx(){ex.point=cx}function ux(){lx(Fw,Pw)}function cx(t,e){ex.point=lx,nx(Fw=zw=t,Pw=Lw=e)}function lx(t,e){var n=t-zw,r=e-Lw,i=_b(n*n+r*r);Xw+=i*(zw+t)/2,Yw+=i*(Lw+e)/2,Jw+=i,Zw+=(i=Lw*t-zw*e)*(zw+t),Qw+=i*(Lw+e),tx+=3*i,nx(zw=t,Lw=e)}var fx=ex;function dx(t){this._context=t}dx.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,cb)}},result:Ob};var hx,px,mx,gx,vx,bx=eb(),yx={point:Ob,lineStart:function(){yx.point=wx},lineEnd:function(){hx&&xx(px,mx),yx.point=Ob},polygonStart:function(){hx=!0},polygonEnd:function(){hx=null},result:function(){var t=+bx;return bx.reset(),t}};function wx(t,e){yx.point=xx,px=gx=t,mx=vx=e}function xx(t,e){gx-=t,vx-=e,bx.add(_b(gx*gx+vx*vx)),gx=t,vx=e}var _x=yx;function kx(){this._string=[]}function Sx(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}kx.prototype={_radius:4.5,_circle:Sx(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Sx(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}};var Ex=function(t,e){var n,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),Pb(t,n(r))),r.result()}return o.area=function(t){return Pb(t,n(Bw)),Bw.result()},o.measure=function(t){return Pb(t,n(_x)),_x.result()},o.bounds=function(t){return Pb(t,n(Hw)),Hw.result()},o.centroid=function(t){return Pb(t,n(fx)),fx.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,Cw):(t=e).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(e=null,new kx):new dx(e=t),"function"!=typeof i&&r.pointRadius(i),o):e},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(e)};function Ox(t){return function(e){var n=new Ax;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Ax(){}function Cx(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Pb(n,t.stream(Hw)),e(Hw.result()),null!=r&&t.clipExtent(r),t}function Mx(t,e,n){return Cx(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])},n)}function Nx(t,e,n){return Mx(t,[[0,0],e],n)}function Tx(t,e,n){return Cx(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])},n)}function Ix(t,e,n){return Cx(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])},n)}Ax.prototype={constructor:Ax,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Dx=16,jx=mb(30*fb),Rx=function(t,e){return+e?function(t,e){function n(r,i,o,a,s,u,c,l,f,d,h,p,m,g){var v=c-r,b=l-i,y=v*v+b*b;if(y>4*e&&m--){var w=a+d,x=s+h,_=u+p,k=_b(w*w+x*x+_*_),S=Eb(_/=k),E=db(db(_)-1)<ob||db(o-f)<ob?(o+f)/2:pb(x,w),O=t(E,S),A=O[0],C=O[1],M=A-r,N=C-i,T=b*M-v*N;(T*T/y>e||db((v*M+b*N)/y-.5)>.3||a*d+s*h+u*p<jx)&&(n(r,i,o,a,s,u,A,C,E,w/=k,x/=k,_,m,g),g.point(A,C),n(A,C,E,w,x,_,c,l,f,d,h,p,m,g))}}return function(e){var r,i,o,a,s,u,c,l,f,d,h,p,m={point:g,lineStart:v,lineEnd:y,polygonStart:function(){e.polygonStart(),m.lineStart=w},polygonEnd:function(){e.polygonEnd(),m.lineStart=v}};function g(n,r){n=t(n,r),e.point(n[0],n[1])}function v(){l=NaN,m.point=b,e.lineStart()}function b(r,i){var o=$b([r,i]),a=t(r,i);n(l,f,c,d,h,p,l=a[0],f=a[1],c=r,d=o[0],h=o[1],p=o[2],Dx,e),e.point(l,f)}function y(){m.point=g,e.lineEnd()}function w(){v(),m.point=x,m.lineEnd=_}function x(t,e){b(r=t,e),i=l,o=f,a=d,s=h,u=p,m.point=b}function _(){n(l,f,c,d,h,p,i,o,r,a,s,u,Dx,e),m.lineEnd=y,y()}return m}}(t,e):function(t){return Ox({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)},Fx=Ox({point:function(t,e){this.stream.point(t*fb,e*fb)}});function Px(t,e,n,r){var i=mb(r),o=wb(r),a=i*t,s=o*t,u=i/t,c=o/t,l=(o*n-i*e)/t,f=(o*e+i*n)/t;function d(t,r){return[a*t-s*r+e,n-s*t-a*r]}return d.invert=function(t,e){return[u*t-c*e+l,f-c*t-u*e]},d}function zx(t){return Lx(function(){return t})()}function Lx(t){var e,n,r,i,o,a,s,u,c,l,f=150,d=480,h=250,p=0,m=0,g=0,v=0,b=0,y=0,w=null,x=gw,_=null,k=Cw,S=.5;function E(t){return u(t[0]*fb,t[1]*fb)}function O(t){return(t=u.invert(t[0],t[1]))&&[t[0]*lb,t[1]*lb]}function A(){var t=Px(f,0,0,y).apply(null,e(p,m)),r=(y?Px:function(t,e,n){function r(r,i){return[e+t*r,n-t*i]}return r.invert=function(r,i){return[(r-e)/t,(n-i)/t]},r})(f,d-t[0],h-t[1],y);return n=Xy(g,v,b),s=Gy(e,r),u=Gy(n,s),a=Rx(s,S),C()}function C(){return c=l=null,E}return E.stream=function(t){return c&&l===t?c:c=Fx(function(t){return Ox({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(x(a(k(l=t)))))},E.preclip=function(t){return arguments.length?(x=t,w=void 0,C()):x},E.postclip=function(t){return arguments.length?(k=t,_=r=i=o=null,C()):k},E.clipAngle=function(t){return arguments.length?(x=+t?vw(w=t*fb):(w=null,gw),C()):w*lb},E.clipExtent=function(t){return arguments.length?(k=null==t?(_=r=i=o=null,Cw):xw(_=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),C()):null==_?null:[[_,r],[i,o]]},E.scale=function(t){return arguments.length?(f=+t,A()):f},E.translate=function(t){return arguments.length?(d=+t[0],h=+t[1],A()):[d,h]},E.center=function(t){return arguments.length?(p=t[0]%360*fb,m=t[1]%360*fb,A()):[p*lb,m*lb]},E.rotate=function(t){return arguments.length?(g=t[0]%360*fb,v=t[1]%360*fb,b=t.length>2?t[2]%360*fb:0,A()):[g*lb,v*lb,b*lb]},E.angle=function(t){return arguments.length?(y=t%360*fb,A()):y*lb},E.precision=function(t){return arguments.length?(a=Rx(s,S=t*t),C()):_b(S)},E.fitExtent=function(t,e){return Mx(E,t,e)},E.fitSize=function(t,e){return Nx(E,t,e)},E.fitWidth=function(t,e){return Tx(E,t,e)},E.fitHeight=function(t,e){return Ix(E,t,e)},function(){return e=t.apply(this,arguments),E.invert=e.invert&&O,A()}}function Bx(t){var e=0,n=ab/3,r=Lx(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*fb,n=t[1]*fb):[e*lb,n*lb]},i}function Ux(t,e){var n=wb(t),r=(n+wb(e))/2;if(db(r)<ob)return function(t){var e=mb(t);function n(t,n){return[t*e,wb(n)/e]}return n.invert=function(t,n){return[t/e,Eb(n*e)]},n}(t);var i=1+n*(2*r-n),o=_b(i)/r;function a(t,e){var n=_b(i-2*r*wb(e))/r;return[n*wb(t*=r),o-n*mb(t)]}return a.invert=function(t,e){var n=o-e;return[pb(t,db(n))/r*xb(n),Eb((i-(t*t+n*n)*r*r)/(2*r))]},a}var Wx=function(){return Bx(Ux).scale(155.424).center([0,33.6442])},qx=function(){return Wx().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])};function Vx(t){return function(e,n){var r=mb(e),i=mb(n),o=t(r*i);return[o*i*wb(e),o*wb(n)]}}function Hx(t){return function(e,n){var r=_b(e*e+n*n),i=t(r),o=wb(i),a=mb(i);return[pb(e*o,r*a),Eb(r&&n*o/r)]}}var $x=Vx(function(t){return _b(2/(1+t))});$x.invert=Hx(function(t){return 2*Eb(t/2)});var Gx=Vx(function(t){return(t=Sb(t))&&t/wb(t)});function Kx(t,e){return[t,bb(kb((sb+e)/2))]}function Xx(t){var e,n,r,i=zx(t),o=i.center,a=i.scale,s=i.translate,u=i.clipExtent,c=null;function l(){var o=ab*a(),s=i(Qy(i.rotate()).invert([0,0]));return u(null==c?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===Kx?[[Math.max(s[0]-o,c),e],[Math.min(s[0]+o,n),r]]:[[c,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),l()):a()},i.translate=function(t){return arguments.length?(s(t),l()):s()},i.center=function(t){return arguments.length?(o(t),l()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=e=n=r=null:(c=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),l()):null==c?null:[[c,e],[n,r]]},l()}function Yx(t){return kb((sb+t)/2)}function Jx(t,e){var n=mb(t),r=t===e?wb(t):bb(n/mb(e))/bb(Yx(e)/Yx(t)),i=n*yb(Yx(t),r)/r;if(!r)return Kx;function o(t,e){i>0?e<-sb+ob&&(e=-sb+ob):e>sb-ob&&(e=sb-ob);var n=i/yb(Yx(e),r);return[n*wb(r*t),i-n*mb(r*t)]}return o.invert=function(t,e){var n=i-e,o=xb(r)*_b(t*t+n*n);return[pb(t,db(n))/r*xb(n),2*hb(yb(i/o,1/r))-sb]},o}function Zx(t,e){return[t,e]}function Qx(t,e){var n=mb(t),r=t===e?wb(t):(n-mb(e))/(e-t),i=n/r+t;if(db(r)<ob)return Zx;function o(t,e){var n=i-e,o=r*t;return[n*wb(o),i-n*mb(o)]}return o.invert=function(t,e){var n=i-e;return[pb(t,db(n))/r*xb(n),i-xb(r)*_b(t*t+n*n)]},o}Gx.invert=Hx(function(t){return t}),Kx.invert=function(t,e){return[t,2*hb(vb(e))-sb]},Zx.invert=Zx;var t_=1.340264,e_=-.081106,n_=893e-6,r_=.003796,i_=_b(3)/2;function o_(t,e){var n=Eb(i_*wb(e)),r=n*n,i=r*r*r;return[t*mb(n)/(i_*(t_+3*e_*r+i*(7*n_+9*r_*r))),n*(t_+e_*r+i*(n_+r_*r))]}function a_(t,e){var n=mb(e),r=mb(t)*n;return[n*wb(t)/r,wb(e)/r]}function s_(t,e,n,r){return 1===t&&1===e&&0===n&&0===r?Cw:Ox({point:function(i,o){this.stream.point(i*t+n,o*e+r)}})}function u_(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function c_(t,e){return[mb(e)*wb(t),wb(e)]}function l_(t,e){var n=mb(e),r=1+mb(t)*n;return[n*wb(t)/r,wb(e)/r]}function f_(t,e){return[bb(kb((sb+e)/2)),-t]}o_.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(t_+e_*i+o*(n_+r_*i))-e)/(t_+3*e_*i+o*(7*n_+9*r_*i)))*r)*i*i,!(db(n)<1e-12));++a);return[i_*t*(t_+3*e_*i+o*(7*n_+9*r_*i))/mb(r),Eb(wb(r)/i_)]},a_.invert=Hx(hb),u_.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-e)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(db(n)>ob&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},c_.invert=Hx(Eb),l_.invert=Hx(function(t){return 2*hb(t)}),f_.invert=function(t,e){return[-e,2*hb(vb(t))-sb]};var d_=Ex(),h_=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function p_(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(g_[t]=function(t,e){return function n(){var r=e();return r.type=t,r.path=Ex().projection(r),r.copy=r.copy||function(){var t=n();return h_.forEach(function(e){r[e]&&t[e](r[e]())}),t.path.pointRadius(r.path.pointRadius()),t},r}}(t,e),this):g_[t]||null}function m_(t){return t&&t.path||d_}var g_={albers:qx,albersusa:function(){var t,e,n,r,i,o,a=qx(),s=Wx().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=Wx().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){o=[t,e]}};function l(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function f(){return t=e=null,l}return l.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?u:a).invert(t)},l.stream=function(n){return t&&e===n?t:t=function(t){var e=t.length;return{point:function(n,r){for(var i=-1;++i<e;)t[i].point(n,r)},sphere:function(){for(var n=-1;++n<e;)t[n].sphere()},lineStart:function(){for(var n=-1;++n<e;)t[n].lineStart()},lineEnd:function(){for(var n=-1;++n<e;)t[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<e;)t[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<e;)t[n].polygonEnd()}}}([a.stream(e=n),s.stream(n),u.stream(n)])},l.precision=function(t){return arguments.length?(a.precision(t),s.precision(t),u.precision(t),f()):a.precision()},l.scale=function(t){return arguments.length?(a.scale(t),s.scale(.35*t),u.scale(t),l.translate(a.translate())):a.scale()},l.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),o=+t[0],l=+t[1];return n=a.translate(t).clipExtent([[o-.455*e,l-.238*e],[o+.455*e,l+.238*e]]).stream(c),r=s.translate([o-.307*e,l+.201*e]).clipExtent([[o-.425*e+ob,l+.12*e+ob],[o-.214*e-ob,l+.234*e-ob]]).stream(c),i=u.translate([o-.205*e,l+.212*e]).clipExtent([[o-.214*e+ob,l+.166*e+ob],[o-.115*e-ob,l+.234*e-ob]]).stream(c),f()},l.fitExtent=function(t,e){return Mx(l,t,e)},l.fitSize=function(t,e){return Nx(l,t,e)},l.fitWidth=function(t,e){return Tx(l,t,e)},l.fitHeight=function(t,e){return Ix(l,t,e)},l.scale(1070)},azimuthalequalarea:function(){return zx($x).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return zx(Gx).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return Bx(Jx).scale(109.5).parallels([30,30])},conicequalarea:Wx,conicequidistant:function(){return Bx(Qx).scale(131.154).center([0,13.9389])},equalEarth:function(){return zx(o_).scale(177.158)},equirectangular:function(){return zx(Zx).scale(152.63)},gnomonic:function(){return zx(a_).scale(144.049).clipAngle(60)},identity:function(){var t,e,n,r,i,o,a=1,s=0,u=0,c=1,l=1,f=Cw,d=null,h=Cw;function p(){return r=i=null,o}return o={stream:function(t){return r&&i===t?r:r=f(h(i=t))},postclip:function(r){return arguments.length?(h=r,d=t=e=n=null,p()):h},clipExtent:function(r){return arguments.length?(h=null==r?(d=t=e=n=null,Cw):xw(d=+r[0][0],t=+r[0][1],e=+r[1][0],n=+r[1][1]),p()):null==d?null:[[d,t],[e,n]]},scale:function(t){return arguments.length?(f=s_((a=+t)*c,a*l,s,u),p()):a},translate:function(t){return arguments.length?(f=s_(a*c,a*l,s=+t[0],u=+t[1]),p()):[s,u]},reflectX:function(t){return arguments.length?(f=s_(a*(c=t?-1:1),a*l,s,u),p()):c<0},reflectY:function(t){return arguments.length?(f=s_(a*c,a*(l=t?-1:1),s,u),p()):l<0},fitExtent:function(t,e){return Mx(o,t,e)},fitSize:function(t,e){return Nx(o,t,e)},fitWidth:function(t,e){return Tx(o,t,e)},fitHeight:function(t,e){return Ix(o,t,e)}}},mercator:function(){return Xx(Kx).scale(961/cb)},naturalEarth1:function(){return zx(u_).scale(175.295)},orthographic:function(){return zx(c_).scale(249.5).clipAngle(90+ob)},stereographic:function(){return zx(l_).scale(250).clipAngle(142)},transversemercator:function(){var t=Xx(f_),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(var v_ in g_)p_(v_,g_[v_]);function b_(t){Tr.call(this,null,t)}function y_(t){Tr.call(this,null,t)}function w_(t){Tr.call(this,null,t)}function x_(t){Tr.call(this,[],t),this.generator=function(){var t,e,n,r,i,o,a,s,u,c,l,f,d=10,h=d,p=90,m=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:b()}}function b(){return fw(gb(r/p)*p,n,p).map(l).concat(fw(gb(s/m)*m,a,m).map(f)).concat(fw(gb(e/d)*d,t,d).filter(function(t){return db(t%p)>ob}).map(u)).concat(fw(gb(o/h)*h,i,h).filter(function(t){return db(t%m)>ob}).map(c))}return v.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},v.outline=function(){return{type:"Polygon",coordinates:[l(r).concat(f(a).slice(1),l(n).reverse().slice(1),f(s).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),v.precision(g)):[[r,s],[n,a]]},v.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),v.precision(g)):[[e,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],m=+t[1],v):[p,m]},v.stepMinor=function(t){return arguments.length?(d=+t[0],h=+t[1],v):[d,h]},v.precision=function(d){return arguments.length?(g=+d,u=_w(o,i,90),c=kw(e,t,g),l=_w(s,a,90),f=kw(r,n,g),v):g},v.extentMajor([[-180,-90+ob],[180,90-ob]]).extentMinor([[-180,-80-ob],[180,80+ob]])}()}function __(t){Tr.call(this,null,t),this.modified(!0)}function k_(t,e,n){Object(H.D)(t[e])&&t[e](n)}b_.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},Object(H.y)(b_,Tr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||H.x,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=m_(t.projection),n.materialize().reflow()):a=i===H.x||e.modified(i.fields)?n.ADD_MOD:n.ADD;var s=function(t,e){var n=t.pointRadius();return t.context(null),null!=e&&t.pointRadius(e),n}(r,t.pointRadius);return n.visit(a,function(t){t[o]=r(i(t))}),r.pointRadius(s),n.modifies(o)},y_.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},Object(H.y)(y_,Tr).transform=function(t,e){var n,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],s=a[0],u=a[1];function c(t){var e=r([i(t),o(t)]);e?(t[s]=e[0],t[u]=e[1]):(t[s]=void 0,t[u]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,c):(n=e.modified(i.fields)||e.modified(o.fields),e.visit(n?e.ADD_MOD:e.ADD,c)),e.modifies(a)},w_.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},Object(H.y)(w_,Tr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||Object(H.t)("datum"),o=t.as||"shape",a=n.ADD_MOD;return r&&!t.modified()||(this.value=r=function(t,e,n){var r=null==n?function(n){return t(e(n))}:function(r){var i=t.pointRadius(),o=t.pointRadius(n)(e(r));return t.pointRadius(i),o};return r.context=function(e){return t.context(e),r},r}(m_(t.projection),i,t.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,function(t){t[o]=r}),n.modifies(o)},x_.Definition={type:"Graticule",metadata:{changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},Object(H.y)(x_,Tr).transform=function(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(var o in t)Object(H.D)(i[o])&&i[o](t[o]);return n=i(),r.length?e.mod.push(et(r[0],n)):e.add.push(Z(n)),r[0]=n,e},Object(H.y)(__,Tr).transform=function(t,e){var n=this.value;return!n||t.modified("type")?(this.value=n=function(t){var e=p_((t||"mercator").toLowerCase());return e||Object(H.n)("Unrecognized projection type: "+t),e()}(t.type),h_.forEach(function(e){null!=t[e]&&k_(n,e,t[e])})):h_.forEach(function(e){t.modified(e)&&k_(n,e,t[e])}),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){var n=function(t){return 1===(t=Object(H.i)(t)).length?t[0]:{type:Qv,features:t.reduce(function(t,e){return e&&e.type===Qv?t.push.apply(t,e.features):Object(H.A)(e)?t.push.apply(t,e):t.push(e),t},[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)};var S_=function(t){return function(){return t}},E_=function(){return 1e-6*(Math.random()-.5)};function O_(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,u,c,l,f,d,h=t._root,p={data:r},m=t._x0,g=t._y0,v=t._x1,b=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((c=e>=(o=(m+v)/2))?m=o:v=o,(l=n>=(a=(g+b)/2))?g=a:b=a,i=h,!(h=h[f=l<<1|c]))return i[f]=p,t;if(s=+t._x.call(null,h.data),u=+t._y.call(null,h.data),e===s&&n===u)return p.next=h,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(o=(m+v)/2))?m=o:v=o,(l=n>=(a=(g+b)/2))?g=a:b=a}while((f=l<<1|c)==(d=(u>=a)<<1|s>=o));return i[d]=h,i[f]=p,t}var A_=function(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i};function C_(t){return t[0]}function M_(t){return t[1]}function N_(t,e,n){var r=new T_(null==e?C_:e,null==n?M_:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function T_(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function I_(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var D_=N_.prototype=T_.prototype;function j_(t){return t.x+t.vx}function R_(t){return t.y+t.vy}function F_(t){return t.index}function P_(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}D_.copy=function(){var t,e,n=new T_(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=I_(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=I_(e));return n},D_.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return O_(this.cover(e,n),e,n,t)},D_.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),u=1/0,c=1/0,l=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<u&&(u=r),r>l&&(l=r),i<c&&(c=i),i>f&&(f=i));if(u>l||c>f)return this;for(this.cover(u,c).cover(l,f),n=0;n<o;++n)O_(this,a[n],s[n],t[n]);return this},D_.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,u=i-n,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=c,c=a,u*=2,s){case 0:i=n+u,o=r+u;break;case 1:n=i-u,o=r+u;break;case 2:i=n+u,r=o-u;break;case 3:n=i-u,r=o-u}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},D_.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},D_.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]]},D_.find=function(t,e,n){var r,i,o,a,s,u,c,l=this._x0,f=this._y0,d=this._x1,h=this._y1,p=[],m=this._root;for(m&&p.push(new A_(m,l,f,d,h)),null==n?n=1/0:(l=t-n,f=e-n,d=t+n,h=e+n,n*=n);u=p.pop();)if(!(!(m=u.node)||(i=u.x0)>d||(o=u.y0)>h||(a=u.x1)<l||(s=u.y1)<f))if(m.length){var g=(i+a)/2,v=(o+s)/2;p.push(new A_(m[3],g,v,a,s),new A_(m[2],i,v,g,s),new A_(m[1],g,o,a,v),new A_(m[0],i,o,g,v)),(c=(e>=v)<<1|t>=g)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=u)}else{var b=t-+this._x.call(null,m.data),y=e-+this._y.call(null,m.data),w=b*b+y*y;if(w<n){var x=Math.sqrt(n=w);l=t-x,f=e-x,d=t+x,h=e+x,r=m.data}}return r},D_.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,u,c,l,f,d,h=this._root,p=this._x0,m=this._y0,g=this._x1,v=this._y1;if(!h)return this;if(h.length)for(;;){if((c=o>=(s=(p+g)/2))?p=s:g=s,(l=a>=(u=(m+v)/2))?m=u:v=u,e=h,!(h=h[f=l<<1|c]))return this;if(!h.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,d=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=i,this)},D_.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},D_.root=function(){return this._root},D_.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},D_.visit=function(t){var e,n,r,i,o,a,s=[],u=this._root;for(u&&s.push(new A_(u,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(u=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&u.length){var c=(r+o)/2,l=(i+a)/2;(n=u[3])&&s.push(new A_(n,c,l,o,a)),(n=u[2])&&s.push(new A_(n,r,l,c,a)),(n=u[1])&&s.push(new A_(n,c,i,o,l)),(n=u[0])&&s.push(new A_(n,r,i,c,l))}return this},D_.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new A_(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,u=e.x1,c=e.y1,l=(a+u)/2,f=(s+c)/2;(o=i[0])&&n.push(new A_(o,a,s,l,f)),(o=i[1])&&n.push(new A_(o,l,s,u,f)),(o=i[2])&&n.push(new A_(o,a,f,l,c)),(o=i[3])&&n.push(new A_(o,l,f,u,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},D_.x=function(t){return arguments.length?(this._x=t,this):this._x},D_.y=function(t){return arguments.length?(this._y=t,this):this._y};var z_={value:function(){}};function L_(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new B_(r)}function B_(t){this._=t}function U_(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function W_(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=z_,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}B_.prototype=L_.prototype={constructor:B_,on:function(t,e){var n,r=this._,i=function(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=W_(r[n],t.name,e);else if(null==e)for(n in r)r[n]=W_(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=U_(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new B_(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){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(e,n)}};var q_,V_,H_=L_,$_=0,G_=0,K_=0,X_=1e3,Y_=0,J_=0,Z_=0,Q_="object"==typeof performance&&performance.now?performance:Date,tk="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ek(){return J_||(tk(nk),J_=Q_.now()+Z_)}function nk(){J_=0}function rk(){this._call=this._time=this._next=null}function ik(t,e,n){var r=new rk;return r.restart(t,e,n),r}function ok(){J_=(Y_=Q_.now())+Z_,$_=G_=0;try{!function(){ek(),++$_;for(var t,e=q_;e;)(t=J_-e._time)>=0&&e._call.call(null,t),e=e._next;--$_}()}finally{$_=0,function(){for(var t,e,n=q_,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:q_=e);V_=t,sk(r)}(),J_=0}}function ak(){var t=Q_.now(),e=t-Y_;e>X_&&(Z_-=e,Y_=t)}function sk(t){$_||(G_&&(G_=clearTimeout(G_)),t-J_>24?(t<1/0&&(G_=setTimeout(ok,t-Q_.now()-Z_)),K_&&(K_=clearInterval(K_))):(K_||(Y_=Q_.now(),K_=setInterval(ak,X_)),$_=1,tk(ok)))}function uk(t){return t.x}function ck(t){return t.y}rk.prototype=ik.prototype={constructor:rk,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?ek():+n)+(null==e?0:+e),this._next||V_===this||(V_?V_._next=this:q_=this,V_=this),this._call=t,this._time=n,sk()},stop:function(){this._call&&(this._call=null,this._time=1/0,sk())}};var lk=10,fk=Math.PI*(3-Math.sqrt(5)),dk={center:function(t,e){var n;function r(){var r,i,o=n.length,a=0,s=0;for(r=0;r<o;++r)a+=(i=n[r]).x,s+=i.y;for(a=a/o-t,s=s/o-e,r=0;r<o;++r)(i=n[r]).x-=a,i.y-=s}return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r},collide:function(t){var e,n,r=1,i=1;function o(){for(var t,o,s,u,c,l,f,d=e.length,h=0;h<i;++h)for(o=N_(e,j_,R_).visitAfter(a),t=0;t<d;++t)s=e[t],l=n[s.index],f=l*l,u=s.x+s.vx,c=s.y+s.vy,o.visit(p);function p(t,e,n,i,o){var a=t.data,d=t.r,h=l+d;if(!a)return e>u+h||i<u-h||n>c+h||o<c-h;if(a.index>s.index){var p=u-a.x-a.vx,m=c-a.y-a.vy,g=p*p+m*m;g<h*h&&(0===p&&(g+=(p=E_())*p),0===m&&(g+=(m=E_())*m),g=(h-(g=Math.sqrt(g)))/g*r,s.vx+=(p*=g)*(h=(d*=d)/(f+d)),s.vy+=(m*=g)*h,a.vx-=p*(h=1-h),a.vy-=m*h)}}}function a(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function s(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=S_(null==t?1:+t)),o.initialize=function(t){e=t,s()},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(e){return arguments.length?(t="function"==typeof e?e:S_(+e),s(),o):t},o},nbody:function(){var t,e,n,r,i=S_(-30),o=1,a=1/0,s=.81;function u(r){var i,o=t.length,a=N_(t,uk,ck).visitAfter(l);for(n=r,i=0;i<o;++i)e=t[i],a.visit(f)}function c(){if(t){var e,n,o=t.length;for(r=new Array(o),e=0;e<o;++e)n=t[e],r[n.index]=+i(n,e,t)}}function l(t){var e,n,i,o,a,s=0,u=0;if(t.length){for(i=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,u+=n,i+=n*e.x,o+=n*e.y);t.x=i/u,t.y=o/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=r[e.data.index]}while(e=e.next)}t.value=s}function f(t,i,u,c){if(!t.value)return!0;var l=t.x-e.x,f=t.y-e.y,d=c-i,h=l*l+f*f;if(d*d/s<h)return h<a&&(0===l&&(h+=(l=E_())*l),0===f&&(h+=(f=E_())*f),h<o&&(h=Math.sqrt(o*h)),e.vx+=l*t.value*n/h,e.vy+=f*t.value*n/h),!0;if(!(t.length||h>=a)){(t.data!==e||t.next)&&(0===l&&(h+=(l=E_())*l),0===f&&(h+=(f=E_())*f),h<o&&(h=Math.sqrt(o*h)));do{t.data!==e&&(d=r[t.data.index]*n/h,e.vx+=l*d,e.vy+=f*d)}while(t=t.next)}}return u.initialize=function(e){t=e,c()},u.strength=function(t){return arguments.length?(i="function"==typeof t?t:S_(+t),c(),u):i},u.distanceMin=function(t){return arguments.length?(o=t*t,u):Math.sqrt(o)},u.distanceMax=function(t){return arguments.length?(a=t*t,u):Math.sqrt(a)},u.theta=function(t){return arguments.length?(s=t*t,u):Math.sqrt(s)},u},link:function(t){var e,n,r,i,o,a=F_,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},u=S_(30),c=1;function l(r){for(var i=0,a=t.length;i<c;++i)for(var s,u,l,f,d,h,p,m=0;m<a;++m)u=(s=t[m]).source,f=(l=s.target).x+l.vx-u.x-u.vx||E_(),d=l.y+l.vy-u.y-u.vy||E_(),f*=h=((h=Math.sqrt(f*f+d*d))-n[m])/h*r*e[m],d*=h,l.vx-=f*(p=o[m]),l.vy-=d*p,u.vx+=f*(p=1-p),u.vy+=d*p}function f(){if(r){var s,u,c=r.length,l=t.length,f=Xf(r,a);for(s=0,i=new Array(c);s<l;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=P_(f,u.source)),"object"!=typeof u.target&&(u.target=P_(f,u.target)),i[u.source.index]=(i[u.source.index]||0)+1,i[u.target.index]=(i[u.target.index]||0)+1;for(s=0,o=new Array(l);s<l;++s)u=t[s],o[s]=i[u.source.index]/(i[u.source.index]+i[u.target.index]);e=new Array(l),d(),n=new Array(l),h()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+s(t[n],n,t)}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+u(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t){r=t,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(a=t,l):a},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:S_(+t),d(),l):s},l.distance=function(t){return arguments.length?(u="function"==typeof t?t:S_(+t),h(),l):u},l},x:function(t){var e,n,r,i=S_(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=S_(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:S_(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:S_(+e),a(),o):t},o},y:function(t){var e,n,r,i=S_(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=S_(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:S_(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:S_(+e),a(),o):t},o}},hk="forces",pk=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],mk=["static","iterations"],gk=["x","y","vx","vy"];function vk(t){Tr.call(this,null,t)}vk.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:gk}]};var bk=Object(H.y)(vk,Tr);function yk(t,e,n,r){var i,o,a,s,u=Object(H.i)(e.forces);for(i=0,o=pk.length;i<o;++i)(a=pk[i])!==hk&&e.modified(a)&&t[a](e[a]);for(i=0,o=u.length;i<o;++i)s=hk+i,(a=n||e.modified(hk,i)?xk(u[i]):r&&wk(u[i],r)?t.force(s):null)&&t.force(s,a);for(o=t.numForces||0;i<o;++i)t.force(hk+i,null);return t.numForces=u.length,t}function wk(t,e){var n,r;for(n in t)if(Object(H.D)(r=t[n])&&e.modified(Object(H.g)(r)))return 1;return 0}function xk(t){var e,n;for(n in dk.hasOwnProperty(t.force)||Object(H.n)("Unrecognized force: "+t.force),e=dk[t.force](),t)Object(H.D)(e[n])&&_k(e[n],t[n],t);return e}function _k(t,e,n){t(Object(H.D)(e)?function(t){return e(t,n)}:e)}bk.transform=function(t,e){var n=this.value,r=e.changed(e.ADD_REM),i=t.modified(pk),o=t.iterations||300;if(n?(r&&(e.modifies("index"),n.nodes(e.source)),(i||e.changed(e.MOD))&&yk(n,t,0,e)):(this.value=n=function(t,e){var n=function(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=Xf(),u=ik(l),c=H_("tick","end");function l(){f(),c.call("tick",e),n<r&&(u.stop(),c.call("end",e))}function f(r){var u,c,l=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(n+=(o-n)*i,s.each(function(t){t(n)}),u=0;u<l;++u)null==(c=t[u]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=lk*Math.sqrt(n),o=n*fk;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function h(e){return e.initialize&&e.initialize(t),e}return null==t&&(t=[]),d(),e={tick:f,restart:function(){return u.restart(l),e},stop:function(){return u.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),s.each(h),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},force:function(t,n){return arguments.length>1?(null==n?s.remove(t):s.set(t,h(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,u,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(a=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(u=s,r=a);return u},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}(t),r=!1,i=n.stop,o=n.restart;return n.stopped=function(){return r},n.restart=function(){return r=!1,o()},n.stop=function(){return r=!0,i()},yk(n,e,!0).on("end",function(){r=!0})}(e.source,t),n.on("tick",function(t,e){return function(){t.touch(e).run()}}(e.dataflow,this)),t.static||(r=!0,n.tick()),e.modifies("index")),i||r||t.modified(mk)||e.changed()&&t.restart)if(n.alpha(Math.max(n.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(n.alphaMin(),1/o)),t.static)for(n.stop();--o>=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return e.StopPropagation;return this.finish(t,e)},bk.finish=function(t,e){for(var n,r=e.dataflow,i=this._argops,o=0,a=i.length;o<a;++o)if((n=i[o]).name===hk&&"link"===n.op._argval.force)for(var s,u=n.op._argops,c=0,l=u.length;c<l;++c)if("links"===u[c].name&&(s=u[c].op.source)){r.pulse(s,r.changeset().reflow());break}return e.reflow(t.modified()).modifies(gk)};var kk=function(t,e,n){var r={};return t.each(function(t){var i=t.data;n(i)&&(r[e(i)]=t)}),t.lookup=r,t};function Sk(t,e){return t.parent===e.parent?1:2}function Ek(t,e){return t+e.x}function Ok(t,e){return Math.max(t,e.y)}function Ak(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Ck(t,e){var n,r,i,o,a,s=new Ik(t),u=+t.value&&(s.value=t.value),c=[s];for(null==e&&(e=Mk);n=c.pop();)if(u&&(n.value=+n.data.value),(i=e(n.data))&&(a=i.length))for(n.children=new Array(a),o=a-1;o>=0;--o)c.push(r=n.children[o]=new Ik(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Tk)}function Mk(t){return t.children}function Nk(t){t.data=t.data.data}function Tk(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Ik(t){this.data=t,this.depth=this.height=0,this.parent=null}Ik.prototype=Ck.prototype={constructor:Ik,count:function(){return this.eachAfter(Ak)},each:function(t){var e,n,r,i,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r])}while(a.length);return this},eachAfter:function(t){for(var e,n,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n]);for(;i=a.pop();)t(i);return this},eachBefore:function(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n>=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return Ck(this).eachBefore(Nk)}};var Dk=Array.prototype.slice,jk=function(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(Dk.call(t))).length,o=[];r<i;)e=t[r],n&&Pk(n,e)?++r:(n=Lk(o=Rk(o,e)),r=0);return n};function Rk(t,e){var n,r;if(zk(e,t))return[e];for(n=0;n<t.length;++n)if(Fk(e,t[n])&&zk(Bk(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(Fk(Bk(t[n],t[r]),e)&&Fk(Bk(t[n],e),t[r])&&Fk(Bk(t[r],e),t[n])&&zk(Uk(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function Fk(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function Pk(t,e){var n=t.r-e.r+1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function zk(t,e){for(var n=0;n<e.length;++n)if(!Pk(t,e[n]))return!1;return!0}function Lk(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return Bk(t[0],t[1]);case 3:return Uk(t[0],t[1],t[2])}}function Bk(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,s=e.r,u=o-n,c=a-r,l=s-i,f=Math.sqrt(u*u+c*c);return{x:(n+o+u/f*l)/2,y:(r+a+c/f*l)/2,r:(f+i+s)/2}}function Uk(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,s=e.y,u=e.r,c=n.x,l=n.y,f=n.r,d=r-a,h=r-c,p=i-s,m=i-l,g=u-o,v=f-o,b=r*r+i*i-o*o,y=b-a*a-s*s+u*u,w=b-c*c-l*l+f*f,x=h*p-d*m,_=(p*w-m*y)/(2*x)-r,k=(m*g-p*v)/x,S=(h*y-d*w)/(2*x)-i,E=(d*v-h*g)/x,O=k*k+E*E-1,A=2*(o+_*k+S*E),C=_*_+S*S-o*o,M=-(O?(A+Math.sqrt(A*A-4*O*C))/(2*O):C/A);return{x:r+_+k*M,y:i+S+E*M,r:M}}function Wk(t,e,n){var r,i,o,a,s=t.x-e.x,u=t.y-e.y,c=s*s+u*u;c?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*s-o*u,n.y=t.y-r*u+o*s):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*s-o*u,n.y=e.y+r*u+o*s)):(n.x=e.x+n.r,n.y=e.y)}function qk(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Vk(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function Hk(t){this._=t,this.next=null,this.previous=null}function $k(t){if("function"!=typeof t)throw new Error;return t}function Gk(){return 0}var Kk=function(t){return function(){return t}};function Xk(t){return Math.sqrt(t.value)}function Yk(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function Jk(t,e){return function(n){if(r=n.children){var r,i,o,a=r.length,s=t(n)*e||0;if(s)for(i=0;i<a;++i)r[i].r+=s;if(o=function(t){if(!(i=t.length))return 0;var e,n,r,i,o,a,s,u,c,l,f;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;Wk(n,e,r=t[2]),e=new Hk(e),n=new Hk(n),r=new Hk(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(s=3;s<i;++s){Wk(e._,n._,r=t[s]),r=new Hk(r),u=n.next,c=e.previous,l=n._.r,f=e._.r;do{if(l<=f){if(qk(u._,r._)){n=u,e.next=n,n.previous=e,--s;continue t}l+=u._.r,u=u.next}else{if(qk(c._,r._)){(e=c).next=n,n.previous=e,--s;continue t}f+=c._.r,c=c.previous}}while(u!==c.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,o=Vk(e);(r=r.next)!==n;)(a=Vk(r))<o&&(e=r,o=a);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=jk(e),s=0;s<i;++s)(e=t[s]).x-=r.x,e.y-=r.y;return r.r}(r),s)for(i=0;i<a;++i)r[i].r-=s;n.r=o+s}}}function Zk(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}var Qk=function(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)},tS=function(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,c=t.value&&(r-e)/t.value;++s<u;)(o=a[s]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*c},eS="$",nS={depth:-1},rS={};function iS(t){return t.id}function oS(t){return t.parentId}var aS=function(){var t=iS,e=oS;function n(n){var r,i,o,a,s,u,c,l=n.length,f=new Array(l),d={};for(i=0;i<l;++i)r=n[i],s=f[i]=new Ik(r),null!=(u=t(r,i,n))&&(u+="")&&(d[c=eS+(s.id=u)]=c in d?rS:s);for(i=0;i<l;++i)if(s=f[i],null!=(u=e(n[i],i,n))&&(u+="")){if(!(a=d[eS+u]))throw new Error("missing: "+u);if(a===rS)throw new Error("ambiguous: "+u);a.children?a.children.push(s):a.children=[s],s.parent=a}else{if(o)throw new Error("multiple roots");o=s}if(!o)throw new Error("no root");if(o.parent=nS,o.eachBefore(function(t){t.depth=t.parent.depth+1,--l}).eachBefore(Tk),o.parent=null,l>0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=$k(e),n):t},n.parentId=function(t){return arguments.length?(e=$k(t),n):e},n};function sS(t,e){return t.parent===e.parent?1:2}function uS(t){var e=t.children;return e?e[0]:t.t}function cS(t){var e=t.children;return e?e[e.length-1]:t.t}function lS(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function fS(t,e,n){return t.a.parent===e.parent?t.a:n}function dS(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}dS.prototype=Object.create(Ik.prototype);var hS=function(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,c=t.value&&(i-n)/t.value;++s<u;)(o=a[s]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*c},pS=(1+Math.sqrt(5))/2;function mS(t,e,n,r,i,o){for(var a,s,u,c,l,f,d,h,p,m,g,v=[],b=e.children,y=0,w=0,x=b.length,_=e.value;y<x;){u=i-n,c=o-r;do{l=b[w++].value}while(!l&&w<x);for(f=d=l,g=l*l*(m=Math.max(c/u,u/c)/(_*t)),p=Math.max(d/g,g/f);w<x;++w){if(l+=s=b[w].value,s<f&&(f=s),s>d&&(d=s),g=l*l*m,(h=Math.max(d/g,g/f))>p){l-=s;break}p=h}v.push(a={value:l,dice:u<c,children:b.slice(y,w)}),a.dice?tS(a,n,r,i,_?r+=c*l/_:o):hS(a,n,r,_?n+=u*l/_:i,o),_-=l,y=w}return v}var gS=function t(e){function n(t,n,r,i,o){mS(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(pS),vS=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,u,c,l,f=-1,d=a.length,h=t.value;++f<d;){for(u=(s=a[f]).children,c=s.value=0,l=u.length;c<l;++c)s.value+=u[c].value;s.dice?tS(s,n,r,i,r+=(o-r)*s.value/h):hS(s,n,r,n+=(i-n)*s.value/h,o),h-=s.value}else t._squarify=a=mS(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(pS);function bS(t){Tr.call(this,null,t)}function yS(t){return t.values}function wS(t){Tr.call(this,null,t)}function xS(t,e){return t.parent===e.parent?1:2}bS.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},Object(H.y)(bS,Tr).transform=function(t,e){e.source||Object(H.n)("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),o=this.value;return(!o||r||e.changed())&&(o&&o.each(function(t){t.children&&X(t.data)&&i.rem.push(t.data)}),this.value=o=Ck({values:Object(H.i)(t.keys).reduce(function(t,e){return t.key(e),t},function(){var t,e,n,r=[],i=[];function o(n,i,a,s){if(i>=r.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var u,c,l,f=-1,d=n.length,h=r[i++],p=Xf(),m=a();++f<d;)(l=p.get(u=h(c=n[f])+""))?l.push(c):p.set(u,[c]);return p.each(function(t,e){s(m,e,o(t,i,a,s))}),m}return n={object:function(t){return o(t,0,Yf,Jf)},map:function(t){return o(t,0,Zf,Qf)},entries:function(t){return function t(n,o){if(++o>r.length)return n;var a,s=i[o-1];return null!=e&&o>=r.length?a=n.entries():(a=[],n.each(function(e,n){a.push({key:n,values:t(e,o)})})),null!=s?a.sort(function(t,e){return s(t.key,e.key)}):a}(o(t,0,Zf,Qf),0)},key:function(t){return r.push(t),n},sortKeys:function(t){return i[r.length-1]=t,n},sortValues:function(e){return t=e,n},rollup:function(t){return e=t,n}}}()).entries(i.source)},yS),n&&o.each(function(t){t.children&&(t=Z(t.data),i.add.push(t),i.source.push(t))}),kk(o,Y,Y)),i.source.root=o,i},Object(H.y)(wS,Tr).transform=function(t,e){e.source&&e.source.root||Object(H.n)(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(t.method),r=this.fields,i=e.source.root,o=t.as||r;t.field&&i.sum(t.field),t.sort&&i.sort(t.sort),function(t,e,n){for(var r,i=0,o=e.length;i<o;++i)(r=e[i])in n&&t[r](n[r])}(n,this.params,t),n.separation&&n.separation(!1!==t.separation?xS:H.M);try{this.value=n(i)}catch(t){Object(H.n)(t)}return i.each(function(t){!function(t,e,n){for(var r=t.data,i=0,o=e.length-1;i<o;++i)r[n[i]]=t[e[i]];r[n[o]]=t.children?t.children.length:0}(t,r,o)}),e.reflow(t.modified()).modifies(o).modifies("leaf")};var _S=["x","y","r","depth","children"];function kS(t){wS.call(this,t)}kS.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:_S.length,default:_S}]};var SS=Object(H.y)(kS,wS);SS.layout=function(){var t=null,e=1,n=1,r=Gk;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(Yk(t)).eachAfter(Jk(r,.5)).eachBefore(Zk(1)):i.eachBefore(Yk(Xk)).eachAfter(Jk(Gk,1)).eachAfter(Jk(r,i.r/Math.min(e,n))).eachBefore(Zk(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=null==e?null:$k(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Kk(+t),i):r},i},SS.params=["size","padding"],SS.fields=_S;var ES=["x0","y0","x1","y1","depth","children"];function OS(t){wS.call(this,t)}OS.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:ES.length,default:ES}]};var AS=Object(H.y)(OS,wS);function CS(t){Tr.call(this,null,t)}AS.layout=function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&tS(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a<i&&(i=a=(i+a)/2),s<o&&(o=s=(o+s)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=s}}(e,o)),r&&i.eachBefore(Qk),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},AS.params=["size","round","padding"],AS.fields=ES,CS.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},Object(H.y)(CS,Tr).transform=function(t,e){e.source||Object(H.n)("Stratify transform requires an upstream data source.");var n=this.value,r=t.modified(),i=e.fork(e.ALL).materialize(e.SOURCE),o=!this.value||r||e.changed(e.ADD_REM)||e.modified(t.key.fields)||e.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(n=i.source.length?kk(aS().id(t.key).parentId(t.parentKey)(i.source),t.key,H.Ea):kk(aS()([{}]),t.key,t.key)),i.source.root=this.value=n,i};var MS={tidy:function(){var t=sS,e=1,n=1,r=null;function i(i){var u=function(t){for(var e,n,r,i,o,a=new dS(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new dS(r[i],i)),n.parent=e;return(a.parent=new dS(null,0)).children=[a],a}(i);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),r)i.eachBefore(s);else{var c=i,l=i,f=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>l.x&&(l=t),t.depth>f.depth&&(f=t)});var d=c===l?1:t(c,l)/2,h=d-c.x,p=e/(l.x+d+h),m=n/(f.depth||1);i.eachBefore(function(t){t.x=(t.x+h)*p,t.y=t.depth*m})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,u=o.parent.children[0],c=o.m,l=a.m,f=s.m,d=u.m;s=cS(s),o=uS(o),s&&o;)u=uS(u),(a=cS(a)).a=e,(i=s.z+f-o.z-c+t(s._,o._))>0&&(lS(fS(s,e,r),e,i),c+=i,l+=i),f+=s.m,c+=o.m,d+=u.m,l+=a.m;s&&!cS(a)&&(a.t=s,a.m+=f-l),o&&!uS(u)&&(u.t=o,u.m+=c-d,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=Sk,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(Ek,0)/t.length}(n),e.y=1+n.reduce(Ok,0)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)});var s=function(t){for(var e;e=t.children;)t=e[0];return t}(i),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=s.x-t(s,u)/2,l=u.x+t(u,s)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(l-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},NS=["x","y","depth","children"];function TS(t){wS.call(this,t)}TS.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:NS.length,default:NS}]};var IS=Object(H.y)(TS,wS);function DS(t){Tr.call(this,[],t)}IS.layout=function(t){var e=t||"tidy";if(MS.hasOwnProperty(e))return MS[e]();Object(H.n)("Unrecognized Tree layout method: "+e)},IS.params=["size","nodeSize"],IS.fields=NS,DS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},Object(H.y)(DS,Tr).transform=function(t,e){var n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),o={};return r||Object(H.n)("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,function(t){o[Y(t)]=1}),r.each(function(t){var e=t.data,n=t.parent&&t.parent.data;n&&o[Y(e)]&&o[Y(n)]&&i.add.push(Z({source:n,target:e}))}),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,function(t){o[Y(t)]=1}),n.forEach(function(t){(o[Y(t.source)]||o[Y(t.target)])&&i.mod.push(t)})),i};var jS={binary:function(t,e,n,r,i){var o,a,s=t.children,u=s.length,c=new Array(u+1);for(c[0]=a=o=0;o<u;++o)c[o+1]=a+=s[o].value;!function t(e,n,r,i,o,a,u){if(e>=n-1){var l=s[e];return l.x0=i,l.y0=o,l.x1=a,void(l.y1=u)}for(var f=c[e],d=r/2+f,h=e+1,p=n-1;h<p;){var m=h+p>>>1;c[m]<d?h=m+1:p=m}d-c[h-1]<c[h]-d&&e+1<h&&--h;var g=c[h]-f,v=r-g;if(a-i>u-o){var b=(i*v+a*g)/r;t(e,h,g,i,o,b,u),t(h,n,v,b,o,a,u)}else{var y=(o*v+u*g)/r;t(e,h,g,i,o,a,y),t(h,n,v,i,y,a,u)}}(0,u,t.value,e,n,r,i)},dice:tS,slice:hS,slicedice:function(t,e,n,r,i){(1&t.depth?hS:tS)(t,e,n,r,i)},squarify:gS,resquarify:vS},RS=["x0","y0","x1","y1","depth","children"];function FS(t){wS.call(this,t)}FS.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:RS.length,default:RS}]};var PS=Object(H.y)(FS,wS);PS.layout=function(){var t=function(){var t=gS,e=!1,n=1,r=1,i=[0],o=Gk,a=Gk,s=Gk,u=Gk,c=Gk;function l(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(Qk),t}function f(e){var n=i[e.depth],r=e.x0+n,l=e.y0+n,f=e.x1-n,d=e.y1-n;f<r&&(r=f=(r+f)/2),d<l&&(l=d=(l+d)/2),e.x0=r,e.y0=l,e.x1=f,e.y1=d,e.children&&(n=i[e.depth+1]=o(e)/2,r+=c(e)-n,l+=a(e)-n,f-=s(e)-n,d-=u(e)-n,f<r&&(r=f=(r+f)/2),d<l&&(l=d=(l+d)/2),t(e,r,l,f,d))}return l.round=function(t){return arguments.length?(e=!!t,l):e},l.size=function(t){return arguments.length?(n=+t[0],r=+t[1],l):[n,r]},l.tile=function(e){return arguments.length?(t=$k(e),l):t},l.padding=function(t){return arguments.length?l.paddingInner(t).paddingOuter(t):l.paddingInner()},l.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:Kk(+t),l):o},l.paddingOuter=function(t){return arguments.length?l.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):l.paddingTop()},l.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:Kk(+t),l):a},l.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:Kk(+t),l):s},l.paddingBottom=function(t){return arguments.length?(u="function"==typeof t?t:Kk(+t),l):u},l.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:Kk(+t),l):c},l}();return t.ratio=function(e){var n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=function(e){jS.hasOwnProperty(e)?t.tile(jS[e]):Object(H.n)("Unrecognized Treemap layout method: "+e)},t},PS.params=["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],PS.fields=RS;var zS=function(t){return function(){return t}};function LS(t){return t[0]}function BS(t){return t[1]}function US(){this._=null}function WS(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function qS(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function VS(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function HS(t){for(;t.L;)t=t.L;return t}US.prototype={constructor:US,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=HS(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(qS(this,n),n=(t=n).U),n.C=!1,r.C=!0,VS(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(VS(this,n),n=(t=n).U),n.C=!1,r.C=!0,qS(this,r)),n=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 e,n,r,i=t.U,o=t.L,a=t.R;if(n=o?a?HS(a):o:a,i?i.L===t?i.L=n:i.R=n:this._=n,o&&a?(r=n.C,n.C=t.C,n.L=o,o.U=n,n!==a?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=a,a.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,qS(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,VS(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,qS(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,VS(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,qS(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,VS(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var $S=US;function GS(t,e,n,r){var i=[null,null],o=mE.push(i)-1;return i.left=t,i.right=e,n&&XS(i,t,e,n),r&&XS(i,e,t,r),hE[t.index].halfedges.push(o),hE[e.index].halfedges.push(o),i}function KS(t,e,n){var r=[e,n];return r.left=t,r}function XS(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function YS(t,e,n,r,i){var o,a=t[0],s=t[1],u=a[0],c=a[1],l=0,f=1,d=s[0]-u,h=s[1]-c;if(o=e-u,d||!(o>0)){if(o/=d,d<0){if(o<l)return;o<f&&(f=o)}else if(d>0){if(o>f)return;o>l&&(l=o)}if(o=r-u,d||!(o<0)){if(o/=d,d<0){if(o>f)return;o>l&&(l=o)}else if(d>0){if(o<l)return;o<f&&(f=o)}if(o=n-c,h||!(o>0)){if(o/=h,h<0){if(o<l)return;o<f&&(f=o)}else if(h>0){if(o>f)return;o>l&&(l=o)}if(o=i-c,h||!(o<0)){if(o/=h,h<0){if(o>f)return;o>l&&(l=o)}else if(h>0){if(o<l)return;o<f&&(f=o)}return!(l>0||f<1)||(l>0&&(t[0]=[u+l*d,c+l*h]),f<1&&(t[1]=[u+f*d,c+f*h]),!0)}}}}}function JS(t,e,n,r,i){var o=t[1];if(o)return!0;var a,s,u=t[0],c=t.left,l=t.right,f=c[0],d=c[1],h=l[0],p=l[1],m=(f+h)/2,g=(d+p)/2;if(p===d){if(m<e||m>=r)return;if(f>h){if(u){if(u[1]>=i)return}else u=[m,n];o=[m,i]}else{if(u){if(u[1]<n)return}else u=[m,i];o=[m,n]}}else if(s=g-(a=(f-h)/(p-d))*m,a<-1||a>1)if(f>h){if(u){if(u[1]>=i)return}else u=[(n-s)/a,n];o=[(i-s)/a,i]}else{if(u){if(u[1]<n)return}else u=[(i-s)/a,i];o=[(n-s)/a,n]}else if(d<p){if(u){if(u[0]>=r)return}else u=[e,a*e+s];o=[r,a*r+s]}else{if(u){if(u[0]<e)return}else u=[r,a*r+s];o=[e,a*e+s]}return t[0]=u,t[1]=o,!0}function ZS(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function QS(t,e){return e[+(e.left!==t.site)]}function tE(t,e){return e[+(e.left===t.site)]}var eE,nE=[];function rE(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var a=i[0],s=i[1],u=r[0]-a,c=r[1]-s,l=o[0]-a,f=o[1]-s,d=2*(u*f-c*l);if(!(d>=-vE)){var h=u*u+c*c,p=l*l+f*f,m=(f*h-c*p)/d,g=(u*p-l*h)/d,v=nE.pop()||new function(){WS(this),this.x=this.y=this.arc=this.site=this.cy=null};v.arc=t,v.site=i,v.x=m+a,v.y=(v.cy=g+s)+Math.sqrt(m*m+g*g),t.circle=v;for(var b=null,y=pE._;y;)if(v.y<y.y||v.y===y.y&&v.x<=y.x){if(!y.L){b=y.P;break}y=y.L}else{if(!y.R){b=y;break}y=y.R}pE.insert(b,v),b||(eE=v)}}}}function iE(t){var e=t.circle;e&&(e.P||(eE=e.N),pE.remove(e),nE.push(e),WS(e),t.circle=null)}var oE=[];function aE(t){var e=oE.pop()||new function(){WS(this),this.edge=this.site=this.circle=null};return e.site=t,e}function sE(t){iE(t),dE.remove(t),oE.push(t),WS(t)}function uE(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,a=t.N,s=[t];sE(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)<gE&&Math.abs(r-u.circle.cy)<gE;)o=u.P,s.unshift(u),sE(u),u=o;s.unshift(u),iE(u);for(var c=a;c.circle&&Math.abs(n-c.circle.x)<gE&&Math.abs(r-c.circle.cy)<gE;)a=c.N,s.push(c),sE(c),c=a;s.push(c),iE(c);var l,f=s.length;for(l=1;l<f;++l)c=s[l],u=s[l-1],XS(c.edge,u.site,c.site,i);u=s[0],(c=s[f-1]).edge=GS(u.site,c.site,null,i),rE(u),rE(c)}function cE(t){for(var e,n,r,i,o=t[0],a=t[1],s=dE._;s;)if((r=lE(s,a)-o)>gE)s=s.L;else{if(!((i=o-fE(s,a))>gE)){r>-gE?(e=s.P,n=s):i>-gE?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){hE[t.index]={site:t,halfedges:[]}}(t);var u=aE(t);if(dE.insert(e,u),e||n){if(e===n)return iE(e),n=aE(e.site),dE.insert(u,n),u.edge=n.edge=GS(e.site,u.site),rE(e),void rE(n);if(n){iE(e),iE(n);var c=e.site,l=c[0],f=c[1],d=t[0]-l,h=t[1]-f,p=n.site,m=p[0]-l,g=p[1]-f,v=2*(d*g-h*m),b=d*d+h*h,y=m*m+g*g,w=[(g*b-h*y)/v+l,(d*y-m*b)/v+f];XS(n.edge,c,p,w),u.edge=GS(c,t,null,w),n.edge=GS(t,p,null,w),rE(e),rE(n)}else u.edge=GS(e.site,u.site)}}function lE(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],u=n[1],c=u-e;if(!c)return s;var l=s-r,f=1/o-1/c,d=l/c;return f?(-d+Math.sqrt(d*d-2*f*(l*l/(-2*c)-u+c/2+i-o/2)))/f+r:(r+s)/2}function fE(t,e){var n=t.N;if(n)return lE(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var dE,hE,pE,mE,gE=1e-6,vE=1e-12;function bE(t,e,n){return(t[0]-n[0])*(e[1]-t[1])-(t[0]-e[0])*(n[1]-t[1])}function yE(t,e){return e[1]-t[1]||e[0]-t[0]}function wE(t,e){var n,r,i,o=t.sort(yE).pop();for(mE=[],hE=new Array(t.length),dE=new $S,pE=new $S;;)if(i=eE,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===n&&o[1]===r||(cE(o),n=o[0],r=o[1]),o=t.pop();else{if(!i)break;uE(i.arc)}if(function(){for(var t,e,n,r,i=0,o=hE.length;i<o;++i)if((t=hE[i])&&(r=(e=t.halfedges).length)){var a=new Array(r),s=new Array(r);for(n=0;n<r;++n)a[n]=n,s[n]=ZS(t,mE[e[n]]);for(a.sort(function(t,e){return s[e]-s[t]}),n=0;n<r;++n)s[n]=e[a[n]];for(n=0;n<r;++n)e[n]=s[n]}}(),e){var a=+e[0][0],s=+e[0][1],u=+e[1][0],c=+e[1][1];!function(t,e,n,r){for(var i,o=mE.length;o--;)JS(i=mE[o],t,e,n,r)&&YS(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>gE||Math.abs(i[0][1]-i[1][1])>gE)||delete mE[o]}(a,s,u,c),function(t,e,n,r){var i,o,a,s,u,c,l,f,d,h,p,m,g=hE.length,v=!0;for(i=0;i<g;++i)if(o=hE[i]){for(a=o.site,s=(u=o.halfedges).length;s--;)mE[u[s]]||u.splice(s,1);for(s=0,c=u.length;s<c;)p=(h=tE(o,mE[u[s]]))[0],m=h[1],f=(l=QS(o,mE[u[++s%c]]))[0],d=l[1],(Math.abs(p-f)>gE||Math.abs(m-d)>gE)&&(u.splice(s,0,mE.push(KS(a,h,Math.abs(p-t)<gE&&r-m>gE?[t,Math.abs(f-t)<gE?d:r]:Math.abs(m-r)<gE&&n-p>gE?[Math.abs(d-r)<gE?f:n,r]:Math.abs(p-n)<gE&&m-e>gE?[n,Math.abs(f-n)<gE?d:e]:Math.abs(m-e)<gE&&p-t>gE?[Math.abs(d-e)<gE?f:t,e]:null))-1),++c);c&&(v=!1)}if(v){var b,y,w,x=1/0;for(i=0,v=null;i<g;++i)(o=hE[i])&&(w=(b=(a=o.site)[0]-t)*b+(y=a[1]-e)*y)<x&&(x=w,v=o);if(v){var _=[t,e],k=[t,r],S=[n,r],E=[n,e];v.halfedges.push(mE.push(KS(a=v.site,_,k))-1,mE.push(KS(a,k,S))-1,mE.push(KS(a,S,E))-1,mE.push(KS(a,E,_))-1)}}for(i=0;i<g;++i)(o=hE[i])&&(o.halfedges.length||delete hE[i])}(a,s,u,c)}this.edges=mE,this.cells=hE,dE=pE=mE=hE=null}function xE(t){Tr.call(this,null,t)}wE.prototype={constructor:wE,polygons:function(){var t=this.edges;return this.cells.map(function(e){var n=e.halfedges.map(function(n){return QS(e,t[n])});return n.data=e.site.data,n})},triangles:function(){var t=[],e=this.edges;return this.cells.forEach(function(n,r){if(o=(i=n.halfedges).length)for(var i,o,a,s=n.site,u=-1,c=e[i[o-1]],l=c.left===s?c.right:c.left;++u<o;)a=l,l=(c=e[i[u]]).left===s?c.right:c.left,a&&l&&r<a.index&&r<l.index&&bE(s,a,l)<0&&t.push([s.data,a.data,l.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,e,n){for(var r,i,o=this,a=o._found||0,s=o.cells.length;!(i=o.cells[a]);)if(++a>=s)return null;var u=t-i.site[0],c=e-i.site[1],l=u*u+c*c;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(n){var r=o.edges[n],s=r.left;if(s!==i.site&&s||(s=r.right)){var u=t-s[0],c=e-s[1],f=u*u+c*c;f<l&&(l=f,a=s.index)}})}while(null!==a);return o._found=r,null==n||l<=n*n?i.site:null}},xE.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};var _E=[[-1e5,-1e5],[1e5,1e5]];Object(H.y)(xE,Tr).transform=function(t,e){var n,r,i,o,a=t.as||"path",s=e.source;for(n=function(){var t=LS,e=BS,n=null;function r(r){return new wE(r.map(function(n,i){var o=[Math.round(t(n,i,r)/gE)*gE,Math.round(e(n,i,r)/gE)*gE];return o.index=i,o.data=n,o}),n)}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(e){return arguments.length?(t="function"==typeof e?e:zS(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:zS(+t),r):e},r.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},r.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],r):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},r}().x(t.x).y(t.y),t.size?n.size(t.size):n.extent(t.extent||_E),this.value=n=n(s),r=n.polygons(),i=0,o=s.length;i<o;++i)s[i][a]=r[i]?"M"+r[i].join("L")+"Z":null;return e.reflow(t.modified()).modifies(a)};var kE=Math.PI/180,SE=64,EE=2048,OE=function(){var t,e,n,r,i,o,a,s=[256,256],u=TE,c=[],l=Math.random,f={};function d(t,e,n){for(var r,i,o,a=e.x,c=e.y,f=Math.sqrt(s[0]*s[0]+s[1]*s[1]),d=u(s),h=l()<.5?1:-1,p=-h;(r=d(p+=h))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=f));)if(e.x=a+i,e.y=c+o,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>s[0]||e.y+e.y1>s[1])&&(!n||!CE(e,t,s[0]))&&(!n||NE(e,n))){for(var m,g=e.sprite,v=e.width>>5,b=s[0]>>5,y=e.x-(v<<4),w=127&y,x=32-w,_=e.y1-e.y0,k=(e.y+e.y0)*b+(y>>5),S=0;S<_;S++){m=0;for(var E=0;E<=v;E++)t[k+E]|=m<<x|(E<v?(m=g[S*v+E])>>>w:0);k+=b}return e.sprite=null,!0}return!1}return f.layout=function(){for(var u=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=(SE<<5)/e,t.height=EE/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(va()),f=function(t){for(var e=[],n=-1;++n<t;)e[n]=0;return e}((s[0]>>5)*s[1]),h=null,p=c.length,m=-1,g=[],v=c.map(function(s){return{text:t(s),font:e(s),style:r(s),weight:i(s),rotate:o(s),size:~~n(s),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}}).sort(function(t,e){return e.size-t.size});++m<p;){var b=v[m];b.x=s[0]*(l()+.5)>>1,b.y=s[1]*(l()+.5)>>1,AE(u,b,v,m),b.hasText&&d(f,b,h)&&(g.push(b),h?ME(h,b):h=[{x:b.x+b.x0,y:b.y+b.y0},{x:b.x+b.x1,y:b.y+b.y1}],b.x-=s[0]>>1,b.y-=s[1]>>1)}return g},f.words=function(t){return arguments.length?(c=t,f):c},f.size=function(t){return arguments.length?(s=[+t[0],+t[1]],f):s},f.font=function(t){return arguments.length?(e=IE(t),f):e},f.fontStyle=function(t){return arguments.length?(r=IE(t),f):r},f.fontWeight=function(t){return arguments.length?(i=IE(t),f):i},f.rotate=function(t){return arguments.length?(o=IE(t),f):o},f.text=function(e){return arguments.length?(t=IE(e),f):t},f.spiral=function(t){return arguments.length?(u=DE[t]||t,f):u},f.fontSize=function(t){return arguments.length?(n=IE(t),f):n},f.padding=function(t){return arguments.length?(a=IE(t),f):a},f.random=function(t){return arguments.length?(l=t,f):l},f};function AE(t,e,n,r){if(!e.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,(SE<<5)/o,EE/o);var a,s,u,c,l,f=0,d=0,h=0,p=n.length;for(--r;++r<p;){if(e=n[r],i.save(),i.font=e.style+" "+e.weight+" "+~~((e.size+1)/o)+"px "+e.font,a=i.measureText(e.text+"m").width*o,u=e.size<<1,e.rotate){var m=Math.sin(e.rotate*kE),g=Math.cos(e.rotate*kE),v=a*g,b=a*m,y=u*g,w=u*m;a=Math.max(Math.abs(v+w),Math.abs(v-w))+31>>5<<5,u=~~Math.max(Math.abs(b+y),Math.abs(b-y))}else a=a+31>>5<<5;if(u>h&&(h=u),f+a>=SE<<5&&(f=0,d+=h,h=0),d+u>=EE)break;i.translate((f+(a>>1))/o,(d+(u>>1))/o),e.rotate&&i.rotate(e.rotate*kE),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=a,e.height=u,e.xoff=f,e.yoff=d,e.x1=a>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=a}for(var x=i.getImageData(0,0,(SE<<5)/o,EE/o).data,_=[];--r>=0;)if((e=n[r]).hasText){for(s=(a=e.width)>>5,u=e.y1-e.y0,c=0;c<u*s;c++)_[c]=0;if(null==(f=e.xoff))return;d=e.yoff;var k=0,S=-1;for(l=0;l<u;l++){for(c=0;c<a;c++){var E=s*l+(c>>5),O=x[(d+l)*(SE<<5)+(f+c)<<2]?1<<31-c%32:0;_[E]|=O,k|=O}k?S=l:(e.y0++,u--,l--,d++)}e.y1=e.y0+S,e.sprite=_.slice(0,(e.y1-e.y0)*s)}}}function CE(t,e,n){n>>=5;for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),s=127&a,u=32-s,c=t.y1-t.y0,l=(t.y+t.y0)*n+(a>>5),f=0;f<c;f++){r=0;for(var d=0;d<=o;d++)if((r<<u|(d<o?(r=i[f*o+d])>>>s:0))&e[l+d])return!0;l+=n}return!1}function ME(t,e){var n=t[0],r=t[1];e.x+e.x0<n.x&&(n.x=e.x+e.x0),e.y+e.y0<n.y&&(n.y=e.y+e.y0),e.x+e.x1>r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function NE(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function TE(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function IE(t){return"function"==typeof t?t:function(){return t}}var DE={archimedean:TE,rectangular:function(t){var e=4*t[0]/t[1],n=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:n+=e;break;case 1:r+=4;break;case 2:n-=e;break;default:r-=4}return[n,r]}}},jE=["x","y","font","fontSize","fontStyle","fontWeight","angle"],RE=["text","font","rotate","fontSize","fontStyle","fontWeight"];function FE(t){Tr.call(this,OE(),t)}function PE(t){return new Uint32Array(t)}function zE(t,e,n){var r=(e<257?function(t){return new Uint8Array(t)}:e<65537?function(t){return new Uint16Array(t)}:PE)(t);return n&&r.set(n),r}FE.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:jE}]},Object(H.y)(FE,Tr).transform=function(t,e){var n=t.modified();if(n||e.changed(e.ADD_REM)||RE.some(function(n){var r=t[n];return Object(H.D)(r)&&e.modified(r.fields)})){var r,i=e.materialize(e.SOURCE).source,o=this.value,a=t.as||jE,s=t.fontSize||14;if(Object(H.D)(s)?r=t.fontSizeRange:s=Object(H.l)(s),r){var u=s,c=Vp("sqrt")().domain(function(t,e){for(var n,r=1/0,i=-1/0,o=0,a=e.length;o<a;++o)(n=t(e[o]))<r&&(r=n),n>i&&(i=n);return[r,i]}(u,i)).range(r);s=function(t){return c(u(t))}}i.forEach(function(t){t[a[0]]=NaN,t[a[1]]=NaN,t[a[3]]=0});for(var l,f,d=o.words(i).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(s).random($r).layout(),h=o.size(),p=h[0]>>1,m=h[1]>>1,g=0,v=d.length;g<v;++g)(f=(l=d[g]).datum)[a[0]]=l.x+p,f[a[1]]=l.y+m,f[a[2]]=l.font,f[a[3]]=l.size,f[a[4]]=l.style,f[a[5]]=l.weight,f[a[6]]=l.rotate;return e.reflow(n).modifies(a)}};var LE=function(t,e,n){var r=1<<e;return{one:r,zero:~r,range:n.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd:function(t,e){var n,i=this.bisect(this.range,t.value),o=t.index,a=i[0],s=i[1],u=o.length;for(n=0;n<a;++n)e[o[n]]|=r;for(n=s;n<u;++n)e[o[n]]|=r;return this}}},BE=function(t,e){return Array.from(e,e=>t[e])};function UE(){var t=PE(0),e=[],n=0;return{insert:function(r,i,o){if(!i.length)return[];var a,s,u,c=n,l=i.length,f=Array(l),d=PE(l);for(u=0;u<l;++u)f[u]=r(i[u]),d[u]=u;if(f=function(t,e){return t.sort.call(e,function(e,n){var r=t[e],i=t[n];return r<i?-1:r>i?1:0}),BE(t,e)}(f,d),c)a=e,s=t,e=Array(c+l),t=PE(c+l),function(t,e,n,r,i,o,a,s,u){var c,l=0,f=0;for(c=0;l<r&&f<a;++c)e[l]<i[f]?(s[c]=e[l],u[c]=n[l++]):(s[c]=i[f],u[c]=o[f++]+t);for(;l<r;++l,++c)s[c]=e[l],u[c]=n[l];for(;f<a;++f,++c)s[c]=i[f],u[c]=o[f]+t}(o,a,s,c,f,d,l,e,t);else{if(o>0)for(u=0;u<l;++u)d[u]+=o;e=f,t=d}return n=c+l,{index:d,value:f}},remove:function(r,i){var o,a,s,u=n;for(a=0;!i[t[a]]&&a<u;++a);for(s=a;a<u;++a)i[o=t[a]]||(t[s]=o,e[s]=e[a],++s);n=u-r},bisect:function(t,r){var i;return r?i=r.length:(r=e,i=n),[Nf(r,t[0],0,i),Mf(r,t[1],0,i)]},reindex:function(e){for(var r=0,i=n;r<i;++r)t[r]=e[t[r]]},index:function(){return t},size:function(){return n}}}function WE(t){Tr.call(this,function(){var t=8,e=[],n=PE(0),r=zE(0,t),i=zE(0,t);return{data:function(){return e},seen:function(){return n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length)},add:function(t){for(var n,r=0,i=e.length,o=t.length;r<o;++r)(n=t[r])._index=i++,e.push(n)},remove:function(t,n){var o,a,s,u=e.length,c=Array(u-t),l=e;for(a=0;!n[a]&&a<u;++a)c[a]=e[a],l[a]=a;for(s=a;a<u;++a)o=e[a],n[a]?l[a]=-1:(l[a]=s,r[s]=r[a],i[s]=i[a],c[s]=o,o._index=s++),r[a]=0;return e=c,l},size:function(){return e.length},curr:function(){return r},prev:function(){return i},reset:function(t){i[t]=r[t]},all:function(){return t<257?255:t<65537?65535:4294967295},set:function(t,e){r[t]|=e},clear:function(t,e){r[t]&=~e},resize:function(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=zE(e,t,r),i=zE(e,t))}}}(),t),this._indices=null,this._dims=null}WE.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var qE=Object(H.y)(WE,Tr);function VE(t){Tr.call(this,null,t)}qE.transform=function(t,e){return this._dims?t.modified("fields")||t.fields.some(function(t){return e.modified(t.fields)})?this.reinit(t,e):this.eval(t,e):this.init(t,e)},qE.init=function(t,e){for(var n,r,i=t.fields,o=t.query,a=this._indices={},s=this._dims=[],u=o.length,c=0;c<u;++c)r=a[n=i[c].fname]||(a[n]=UE()),s.push(LE(r,c,o[c]));return this.eval(t,e)},qE.reinit=function(t,e){var n,r,i,o,a,s,u,c,l,f=e.materialize().fork(),d=t.fields,h=t.query,p=this._indices,m=this._dims,g=this.value,v=g.curr(),b=g.prev(),y=g.all(),w=f.rem=f.add,x=f.mod,_=h.length,k={};if(b.set(v),e.rem.length&&(a=this.remove(t,e,f)),e.add.length&&g.add(e.add),e.mod.length)for(s={},u=0,c=(o=e.mod).length;u<c;++u)s[o[u]._index]=1;for(u=0;u<_;++u)l=d[u],(!m[u]||t.modified("fields",u)||e.modified(l.fields))&&((n=k[i=l.fname])||(p[i]=r=UE(),k[i]=n=r.insert(l,e.source,0)),m[u]=LE(r,u,h[u]).onAdd(n,v));for(u=0,c=g.data().length;u<c;++u)a[u]||(b[u]!==v[u]?w.push(u):s[u]&&v[u]!==y&&x.push(u));return g.mask=(1<<_)-1,f},qE.eval=function(t,e){var n=e.materialize().fork(),r=this._dims.length,i=0;return e.rem.length&&(this.remove(t,e,n),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,e,n)),e.add.length&&(this.insert(t,e,n),i|=(1<<r)-1),e.mod.length&&(this.modify(e,n),i|=(1<<r)-1),this.value.mask=i,n},qE.insert=function(t,e,n){var r,i,o,a=e.add,s=this.value,u=this._dims,c=this._indices,l=t.fields,f={},d=n.add,h=s.size(),p=h+a.length,m=u.length;s.resize(p,m),s.add(a);var g=s.curr(),v=s.prev(),b=s.all();for(r=0;r<m;++r)o=f[i=l[r].fname]||(f[i]=c[i].insert(l[r],a,h)),u[r].onAdd(o,g);for(;h<p;++h)v[h]=b,g[h]!==b&&d.push(h)},qE.modify=function(t,e){var n,r,i,o=e.mod,a=this.value,s=a.curr(),u=a.all(),c=t.mod;for(n=0,r=c.length;n<r;++n)s[i=c[n]._index]!==u&&o.push(i)},qE.remove=function(t,e,n){var r,i,o,a,s=this._indices,u=this.value,c=u.curr(),l=u.prev(),f=u.all(),d={},h=n.rem,p=e.rem;for(r=0,i=p.length;r<i;++r)d[o=p[r]._index]=1,l[o]=a=c[o],c[o]=f,a!==f&&h.push(o);for(o in s)s[o].remove(i,d);return this.reindex(e,i,d),d},qE.reindex=function(t,e,n){var r=this._indices,i=this.value;t.runAfter(function(){var t=i.remove(e,n);for(var o in r)r[o].reindex(t)})},qE.update=function(t,e,n){var r,i,o=this._dims,a=t.query,s=e.stamp,u=o.length,c=0;for(n.filters=0,i=0;i<u;++i)t.modified("query",i)&&(r=i,++c);if(1===c)c=o[r].one,this.incrementOne(o[r],a[r],n.add,n.rem);else for(i=0,c=0;i<u;++i)t.modified("query",i)&&(c|=o[i].one,this.incrementAll(o[i],a[i],s,n.add),n.rem=n.add);return c},qE.incrementAll=function(t,e,n,r){var i,o,a,s=this.value,u=s.seen(),c=s.curr(),l=s.prev(),f=t.index(),d=t.bisect(t.range),h=t.bisect(e),p=h[0],m=h[1],g=d[0],v=d[1],b=t.one;if(p<g)for(i=p,o=Math.min(g,m);i<o;++i)u[a=f[i]]!==n&&(l[a]=c[a],u[a]=n,r.push(a)),c[a]^=b;else if(p>g)for(i=g,o=Math.min(p,v);i<o;++i)u[a=f[i]]!==n&&(l[a]=c[a],u[a]=n,r.push(a)),c[a]^=b;if(m>v)for(i=Math.max(p,v),o=m;i<o;++i)u[a=f[i]]!==n&&(l[a]=c[a],u[a]=n,r.push(a)),c[a]^=b;else if(m<v)for(i=Math.max(g,m),o=v;i<o;++i)u[a=f[i]]!==n&&(l[a]=c[a],u[a]=n,r.push(a)),c[a]^=b;t.range=e.slice()},qE.incrementOne=function(t,e,n,r){var i,o,a,s=this.value.curr(),u=t.index(),c=t.bisect(t.range),l=t.bisect(e),f=l[0],d=l[1],h=c[0],p=c[1],m=t.one;if(f<h)for(i=f,o=Math.min(h,d);i<o;++i)s[a=u[i]]^=m,n.push(a);else if(f>h)for(i=h,o=Math.min(f,p);i<o;++i)s[a=u[i]]^=m,r.push(a);if(d>p)for(i=Math.max(f,p),o=d;i<o;++i)s[a=u[i]]^=m,n.push(a);else if(d<p)for(i=Math.max(h,d),o=p;i<o;++i)s[a=u[i]]^=m,r.push(a);t.range=e.slice()},VE.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},Object(H.y)(VE,Tr).transform=function(t,e){var n=~(t.ignore||0),r=t.filter,i=r.mask;if(0==(i&n))return e.StopPropagation;var o=e.fork(e.ALL),a=r.data(),s=r.curr(),u=r.prev(),c=function(t){return s[t]&n?null:a[t]};return o.filter(o.MOD,c),i&i-1?(o.filter(o.ADD,function(t){var e=s[t]&n;return!e&&e^u[t]&n?a[t]:null}),o.filter(o.REM,function(t){var e=s[t]&n;return!e||e^e^u[t]&n?null:a[t]})):(o.filter(o.ADD,c),o.filter(o.REM,function(t){return(s[t]&n)===i?a[t]:null})),o.filter(o.SOURCE,function(t){return c(t._index)})};var HE=n(319),$E=function(t){var e=t._signals.cursor;e||(t._signals.cursor=e=t.add({user:"default",item:null})),t.on(t.events("view","mousemove"),e,function(t,n){var r=e.value,i=r?Object(H.H)(r)?r:r.user:"default",o=n.item&&n.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}}),t.add(null,function(t){var e=t.cursor,n=this.value;return Object(H.H)(e)||(n=e.item,e=e.user),function(t){"undefined"!=typeof document&&document.body&&(document.body.style.cursor=t)}(e&&"default"!==e?e:n||e),n},{cursor:e})};function GE(t,e){var n=t._runtime.data;return n.hasOwnProperty(e)||Object(H.n)("Unrecognized data set: "+e),n[e]}function KE(t,e){nt(e)||Object(H.n)("Second argument to changes must be a changeset.");var n=GE(this,t);return n.modified=!0,this.pulse(n.input,e)}function XE(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function YE(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function JE(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}var ZE={trap:!1};function QE(t){return t.item}function tO(t){var e=t.item.mark.source;return e.source||e}function eO(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}var nO=function(t,e,n){var r=document.createElement(t);for(var i in e)r.setAttribute(i,e[i]);return null!=n&&(r.textContent=n),r},rO=Math.sqrt(50),iO=Math.sqrt(10),oO=Math.sqrt(2),aO="vega-bind-radio",sO="vega-option-";function uO(t,e,n,r){var i=nO("input");for(var o in n)"signal"!==o&&"element"!==o&&i.setAttribute("input"===o?"type":o,n[o]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",function(){t.update(i.value)}),t.elements=[i],t.set=function(t){i.value=t}}function cO(t,e,n,r){var i={type:"checkbox",name:n.signal};r&&(i.checked=!0);var o=nO("input",i);e.appendChild(o),o.addEventListener("change",function(){t.update(o.checked)}),t.elements=[o],t.set=function(t){o.checked=!!t||null}}function lO(t,e,n,r){var i=nO("select",{name:n.signal});n.options.forEach(function(t){var e={value:t};hO(t,r)&&(e.selected=!0),i.appendChild(nO("option",e,t+""))}),e.appendChild(i),i.addEventListener("change",function(){t.update(n.options[i.selectedIndex])}),t.elements=[i],t.set=function(t){for(var e=0,r=n.options.length;e<r;++e)if(hO(n.options[e],t))return void(i.selectedIndex=e)}}function fO(t,e,n,r){var i=nO("span",{class:aO});e.appendChild(i),t.elements=n.options.map(function(e){var o=sO+n.signal+"-"+e,a={id:o,type:"radio",name:n.signal,value:e};hO(e,r)&&(a.checked=!0);var s=nO("input",a);return s.addEventListener("change",function(){t.update(e)}),i.appendChild(s),i.appendChild(nO("label",{for:o},e+"")),s}),t.set=function(e){for(var n=t.elements,r=0,i=n.length;r<i;++r)hO(n[r].value,e)&&(n[r].checked=!0)}}function dO(t,e,n,r){r=void 0!==r?r:(+n.max+ +n.min)/2;var i=n.min||Math.min(0,+r)||0,o=n.max||Math.max(100,+r)||100,a=n.step||function(t,e,n){var r=Math.abs(e-t)/Math.max(0,100),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=rO?i*=10:o>=iO?i*=5:o>=oO&&(i*=2),e<t?-i:i}(i,o),s=nO("input",{type:"range",name:n.signal,min:i,max:o,step:a});s.value=r;var u=nO("label",{},+r);function c(){u.textContent=s.value,t.update(+s.value)}e.appendChild(s),e.appendChild(u),s.addEventListener("input",c),s.addEventListener("change",c),t.elements=[s],t.set=function(t){s.value=t,u.textContent=t}}function hO(t,e){return t===e||t+""==e+""}var pO=function(t,e,n,r,i){return(e=e||new r(t.loader())).initialize(n,XE(t),YE(t),JE(t),i).background(t._background)},mO=function(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null};function gO(t,e){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e)try{e.innerHTML=""}catch(n){e=null,t.error(n)}return e}var vO=function(t,e,n){var r=jl(e),i=r&&r.headless;return i?t.runAsync().then(function(){return pO(t,null,null,i,n).renderAsync(t._scenegraph.root)}):Promise.reject("Unrecognized renderer type: "+e)};function bO(t){return+t||0}var yO=["value","update","init","react","bind"];function wO(t,e){Object(H.n)(t+' for "outer" push: '+Object(H.X)(e))}var xO,_O,kO,SO,EO,OO=function(t,e){var n=t.name;if("outer"===t.push)e.signals[n]||wO("No prior signal definition",n),yO.forEach(function(e){void 0!==t[e]&&wO("Invalid property ",e)});else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}};function AO(t){this.type=t}AO.prototype.visit=function(t){var e,n,r;if(t(this))return 1;for(n=0,r=(e=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case"CallExpression":var e=t.arguments.slice();return e.unshift(t.callee),e;case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n<r;++n)if(e[n].visit(t))return 1};var CO=1,MO=2,NO=3,TO=4,IO=5,DO=6,jO=7,RO=8;(xO={})[CO]="Boolean",xO[MO]="<end>",xO[NO]="Identifier",xO[TO]="Keyword",xO[IO]="Null",xO[DO]="Numeric",xO[jO]="Punctuator",xO[RO]="String",xO[9]="RegularExpression";var FO="ArrayExpression",PO="BinaryExpression",zO="CallExpression",LO="ConditionalExpression",BO="Identifier",UO="Literal",WO="LogicalExpression",qO="MemberExpression",VO="ObjectExpression",HO="Property",$O="UnaryExpression",GO="Unexpected token %0",KO="Unexpected number",XO="Unexpected string",YO="Unexpected identifier",JO="Unexpected reserved word",ZO="Unexpected end of input",QO="Invalid regular expression",tA="Invalid regular expression: missing /",eA="Octal literals are not allowed in strict mode.",nA="Duplicate data property in object literal not allowed in strict mode",rA="ILLEGAL",iA="Disabled.",oA=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),aA=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function sA(t,e){if(!t)throw new Error("ASSERT: "+e)}function uA(t){return t>=48&&t<=57}function cA(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function lA(t){return"01234567".indexOf(t)>=0}function fA(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function dA(t){return 10===t||13===t||8232===t||8233===t}function hA(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&oA.test(String.fromCharCode(t))}function pA(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&aA.test(String.fromCharCode(t))}var mA={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function gA(){for(var t;kO<SO&&(fA(t=_O.charCodeAt(kO))||dA(t));)++kO}function vA(t){var e,n,r,i=0;for(n="u"===t?4:2,e=0;e<n;++e)kO<SO&&cA(_O[kO])?(r=_O[kO++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):TA({},GO,rA);return String.fromCharCode(i)}function bA(){var t,e,n,r;for(e=0,"}"===(t=_O[kO])&&TA({},GO,rA);kO<SO&&cA(t=_O[kO++]);)e=16*e+"0123456789abcdef".indexOf(t.toLowerCase());return(e>1114111||"}"!==t)&&TA({},GO,rA),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function yA(){var t,e;for(t=_O.charCodeAt(kO++),e=String.fromCharCode(t),92===t&&(117!==_O.charCodeAt(kO)&&TA({},GO,rA),++kO,(t=vA("u"))&&"\\"!==t&&hA(t.charCodeAt(0))||TA({},GO,rA),e=t);kO<SO&&pA(t=_O.charCodeAt(kO));)++kO,e+=String.fromCharCode(t),92===t&&(e=e.substr(0,e.length-1),117!==_O.charCodeAt(kO)&&TA({},GO,rA),++kO,(t=vA("u"))&&"\\"!==t&&pA(t.charCodeAt(0))||TA({},GO,rA),e+=t);return e}function wA(){var t,e,n,r,i=kO,o=_O.charCodeAt(kO),a=_O[kO];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++kO,{type:jO,value:String.fromCharCode(o),start:i,end:kO};default:if(61===(t=_O.charCodeAt(kO+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return kO+=2,{type:jO,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:kO};case 33:case 61:return kO+=2,61===_O.charCodeAt(kO)&&++kO,{type:jO,value:_O.slice(i,kO),start:i,end:kO}}}return">>>="===(r=_O.substr(kO,4))?{type:jO,value:r,start:i,end:kO+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:jO,value:n,start:i,end:kO+=3}:a===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===e?{type:jO,value:e,start:i,end:kO+=2}:"<>=!+-*%&|^/".indexOf(a)>=0?{type:jO,value:a,start:i,end:++kO}:void TA({},GO,rA)}function xA(){var t,e,n;if(sA(uA((n=_O[kO]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=kO,t="","."!==n){if(t=_O[kO++],n=_O[kO],"0"===t){if("x"===n||"X"===n)return++kO,function(t){for(var e="";kO<SO&&cA(_O[kO]);)e+=_O[kO++];return 0===e.length&&TA({},GO,rA),hA(_O.charCodeAt(kO))&&TA({},GO,rA),{type:DO,value:parseInt("0x"+e,16),start:t,end:kO}}(e);if(lA(n))return function(t){for(var e="0"+_O[kO++];kO<SO&&lA(_O[kO]);)e+=_O[kO++];return(hA(_O.charCodeAt(kO))||uA(_O.charCodeAt(kO)))&&TA({},GO,rA),{type:DO,value:parseInt(e,8),octal:!0,start:t,end:kO}}(e);n&&uA(n.charCodeAt(0))&&TA({},GO,rA)}for(;uA(_O.charCodeAt(kO));)t+=_O[kO++];n=_O[kO]}if("."===n){for(t+=_O[kO++];uA(_O.charCodeAt(kO));)t+=_O[kO++];n=_O[kO]}if("e"===n||"E"===n)if(t+=_O[kO++],"+"!==(n=_O[kO])&&"-"!==n||(t+=_O[kO++]),uA(_O.charCodeAt(kO)))for(;uA(_O.charCodeAt(kO));)t+=_O[kO++];else TA({},GO,rA);return hA(_O.charCodeAt(kO))&&TA({},GO,rA),{type:DO,value:parseFloat(t),start:e,end:kO}}function _A(){var t;return gA(),kO>=SO?{type:MO,start:kO,end:kO}:hA(t=_O.charCodeAt(kO))?function(){var t,e;return t=kO,{type:1===(e=92===_O.charCodeAt(kO)?yA():function(){var t,e;for(t=kO++;kO<SO;){if(92===(e=_O.charCodeAt(kO)))return kO=t,yA();if(!pA(e))break;++kO}return _O.slice(t,kO)}()).length?NO:mA.hasOwnProperty(e)?TO:"null"===e?IO:"true"===e||"false"===e?CO:NO,value:e,start:t,end:kO}}():40===t||41===t||59===t?wA():39===t||34===t?function(){var t,e,n,r,i="",o=!1;for(sA("'"===(t=_O[kO])||'"'===t,"String literal must starts with a quote"),e=kO,++kO;kO<SO;){if((n=_O[kO++])===t){t="";break}if("\\"===n)if((n=_O[kO++])&&dA(n.charCodeAt(0)))"\r"===n&&"\n"===_O[kO]&&++kO;else switch(n){case"u":case"x":"{"===_O[kO]?(++kO,i+=bA()):i+=vA(n);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:lA(n)?(0!==(r="01234567".indexOf(n))&&(o=!0),kO<SO&&lA(_O[kO])&&(o=!0,r=8*r+"01234567".indexOf(_O[kO++]),"0123".indexOf(n)>=0&&kO<SO&&lA(_O[kO])&&(r=8*r+"01234567".indexOf(_O[kO++]))),i+=String.fromCharCode(r)):i+=n}else{if(dA(n.charCodeAt(0)))break;i+=n}}return""!==t&&TA({},GO,rA),{type:RO,value:i,octal:o,start:e,end:kO}}():46===t?uA(_O.charCodeAt(kO+1))?xA():wA():uA(t)?xA():wA()}function kA(){var t;return kO=(t=EO).end,EO=_A(),kO=t.end,t}function SA(){var t;t=kO,EO=_A(),kO=t}function EA(t,e,n){var r=new AO("||"===t||"&&"===t?WO:PO);return r.operator=t,r.left=e,r.right=n,r}function OA(t,e){var n=new AO(zO);return n.callee=t,n.arguments=e,n}function AA(t){var e=new AO(BO);return e.name=t,e}function CA(t){var e=new AO(UO);return e.value=t.value,e.raw=_O.slice(t.start,t.end),t.regex&&("//"===e.raw&&(e.raw="/(?:)/"),e.regex=t.regex),e}function MA(t,e,n){var r=new AO(qO);return r.computed="["===t,r.object=e,r.property=n,r.computed||(n.member=!0),r}function NA(t,e,n){var r=new AO(HO);return r.key=e,r.value=n,r.kind=t,r}function TA(t,e){var n,r=Array.prototype.slice.call(arguments,2),i=e.replace(/%(\d)/g,function(t,e){return sA(e<r.length,"Message reference must be in range"),r[e]});throw(n=new Error(i)).index=kO,n.description=i,n}function IA(t){t.type===MO&&TA(t,ZO),t.type===DO&&TA(t,KO),t.type===RO&&TA(t,XO),t.type===NO&&TA(t,YO),t.type===TO&&TA(t,JO),TA(t,GO,t.value)}function DA(t){var e=kA();e.type===jO&&e.value===t||IA(e)}function jA(t){return EO.type===jO&&EO.value===t}function RA(t){return EO.type===TO&&EO.value===t}function FA(){var t;return kO=EO.start,(t=kA()).type===RO||t.type===DO?(t.octal&&TA(t,eA),CA(t)):AA(t.value)}function PA(){var t,e,n;return kO=EO.start,(t=EO).type===NO?(n=FA(),DA(":"),NA("init",n,$A())):t.type!==MO&&t.type!==jO?(e=FA(),DA(":"),NA("init",e,$A())):void IA(t)}var zA={if:1,this:1};function LA(){var t,e,n;if(jA("("))return function(){var t;return DA("("),t=GA(),DA(")"),t}();if(jA("["))return function(){var t=[];for(kO=EO.start,DA("[");!jA("]");)jA(",")?(kA(),t.push(null)):(t.push($A()),jA("]")||DA(","));return kA(),function(t){var e=new AO(FO);return e.elements=t,e}(t)}();if(jA("{"))return function(){var t,e,n=[],r={},i=String;for(kO=EO.start,DA("{");!jA("}");)e="$"+((t=PA()).key.type===BO?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,e)?TA({},nA):r[e]=!0,n.push(t),jA("}")||DA(",");return DA("}"),function(t){var e=new AO(VO);return e.properties=t,e}(n)}();if(t=EO.type,kO=EO.start,t===NO||zA[EO.value])n=AA(kA().value);else if(t===RO||t===DO)EO.octal&&TA(EO,eA),n=CA(kA());else{if(t===TO)throw new Error(iA);t===CO?((e=kA()).value="true"===e.value,n=CA(e)):t===IO?((e=kA()).value=null,n=CA(e)):jA("/")||jA("/=")?(n=CA(function(){var t,e,n,r;return EO=null,gA(),t=kO,e=function(){var t,e,n,r;for(sA("/"===(t=_O[kO]),"Regular expression literal must start with a slash"),e=_O[kO++],n=!1,r=!1;kO<SO;)if(e+=t=_O[kO++],"\\"===t)dA((t=_O[kO++]).charCodeAt(0))&&TA({},tA),e+=t;else if(dA(t.charCodeAt(0)))TA({},tA);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||TA({},tA),{value:e.substr(1,e.length-2),literal:e}}(),n=function(){var t,e,n;for(e="",n="";kO<SO&&pA((t=_O[kO]).charCodeAt(0));)++kO,"\\"===t&&kO<SO?TA({},GO,rA):(n+=t,e+=t);return n.search(/[^gimuy]/g)>=0&&TA({},QO,n),{value:n,literal:e}}(),r=function(t,e){var n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,e){if(parseInt(e,16)<=1114111)return"x";TA({},QO)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){TA({},QO)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:kO}}()),SA()):IA(kA())}return n}function BA(){var t=[];if(DA("("),!jA(")"))for(;kO<SO&&(t.push($A()),!jA(")"));)DA(",");return DA(")"),t}function UA(){var t;return kO=EO.start,function(t){return t.type===NO||t.type===TO||t.type===CO||t.type===IO}(t=kA())||IA(t),AA(t.value)}function WA(){var t;return DA("["),t=GA(),DA("]"),t}function qA(){var t=function(){var t;for(t=LA();;)if(jA("."))DA("."),t=MA(".",t,UA());else if(jA("("))t=OA(t,BA());else{if(!jA("["))break;t=MA("[",t,WA())}return t}();if(EO.type===jO&&(jA("++")||jA("--")))throw new Error(iA);return t}function VA(){var t,e;if(EO.type!==jO&&EO.type!==TO)e=qA();else{if(jA("++")||jA("--"))throw new Error(iA);if(jA("+")||jA("-")||jA("~")||jA("!"))t=kA(),e=VA(),e=function(t,e){var n=new AO($O);return n.operator=t,n.argument=e,n.prefix=!0,n}(t.value,e);else{if(RA("delete")||RA("void")||RA("typeof"))throw new Error(iA);e=qA()}}return e}function HA(t){var e=0;if(t.type!==jO&&t.type!==TO)return 0;switch(t.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function $A(){var t,e;return t=function(){var t,e,n,r,i,o,a,s,u,c;if(t=EO,u=VA(),0===(i=HA(r=EO)))return u;for(r.prec=i,kA(),e=[t,EO],o=[u,r,a=VA()];(i=HA(EO))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),e.pop(),n=EA(s,u,a),o.push(n);(r=kA()).prec=i,o.push(r),e.push(EO),n=VA(),o.push(n)}for(n=o[c=o.length-1],e.pop();c>1;)e.pop(),n=EA(o[c-1].value,o[c-2],n),c-=2;return n}(),jA("?")&&(kA(),e=$A(),DA(":"),t=function(t,e,n){var r=new AO(LO);return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,$A())),t}function GA(){var t=$A();if(jA(","))throw new Error(iA);return t}var KA=function(t){kO=0,SO=(_O=t).length,EO=null,SA();var e=GA();if(EO.type!==MO)throw new Error("Unexpect token after expression.");return e},XA={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"},YA=function(t){function e(e,n,r){return function(i){return function(e,n,r,i){var o=t(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}}var n="new Date";return{isNaN:"isNaN",isFinite:"isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&Object(H.n)("Missing arguments to clamp function."),e.length>3&&Object(H.n)("Too many arguments to clamp function.");var n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),join:e("join",null),indexof:e("indexOf",null),lastindexof:e("lastIndexOf",null),slice:e("slice",null),reverse:function(e){return"("+t(e[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase","String",0),lower:e("toLowerCase","String",0),substring:e("substring","String"),split:e("split","String"),replace:e("replace","String"),trim:e("trim","String",0),regexp:"RegExp",test:e("test","RegExp"),if:function(e){e.length<3&&Object(H.n)("Missing arguments to if function."),e.length>3&&Object(H.n)("Too many arguments to if function.");var n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}},JA=function(t){var e=(t=t||{}).whitelist?Object(H.Ba)(t.whitelist):{},n=t.blacklist?Object(H.Ba)(t.blacklist):{},r=t.constants||XA,i=(t.functions||YA)(f),o=t.globalvar,a=t.fieldvar,s={},u={},c=0,l=Object(H.D)(o)?o:function(t){return o+'["'+t+'"]'};function f(t){if(Object(H.H)(t))return t;var e=d[t.type];return null==e&&Object(H.n)("Unsupported type: "+t.type),e(t)}var d={Literal:function(t){return t.raw},Identifier:function(t){var i=t.name;return c>0?i:Object(H.v)(n,i)?Object(H.n)("Illegal identifier: "+i):Object(H.v)(r,i)?r[i]:Object(H.v)(e,i)?i:(s[i]=1,l(i))},MemberExpression:function(t){var e=!t.computed,n=f(t.object);e&&(c+=1);var r=f(t.property);return n===a&&(u[function(t){var e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(c-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&Object(H.n)("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=Object(H.v)(i,e)&&i[e];return r||Object(H.n)("Unrecognized function: "+e),Object(H.D)(r)?r(n):r+"("+n.map(f).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(f).join(",")+"]"},BinaryExpression:function(t){return"("+f(t.left)+t.operator+f(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+f(t.argument)+")"},ConditionalExpression:function(t){return"("+f(t.test)+"?"+f(t.consequent)+":"+f(t.alternate)+")"},LogicalExpression:function(t){return"("+f(t.left)+t.operator+f(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(f).join(",")+"}"},Property:function(t){c+=1;var e=f(t.key);return c-=1,e+":"+f(t.value)}};function h(t){var e={code:f(t),globals:Object.keys(s),fields:Object.keys(u)};return s={},u={},e}return h.functions=i,h.constants=r,h},ZA={};function QA(t,e,n){var r=t+":"+n,i=ZA[r];return i&&i[0]===e||(ZA[r]=i=[e,e(n)]),i[1]}function tC(t,e){return QA("timeFormat",Ye,e)(t)}var eC=new Date(2e3,0,1);function nC(t,e,n){return eC.setMonth(t),eC.setDate(e),tC(eC,n)}function rC(t,e,n,r){var i,o=e[0],a=e[e.length-1];return o>a&&(i=o,o=a,a=i),n=void 0===n||n,r=void 0===r||r,(n?o<=t:o<t)&&(r?t<=a:t<a)}function iC(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}var oC="undefined"!=typeof window&&window||null,aC="Literal",sC="Identifier",uC="@",cC="%",lC=":";function fC(t,e){var n;return Object(H.D)(t)?t:Object(H.H)(t)?(n=e.scales[t])&&n.value:void 0}function dC(t,e,n){var r=cC+n;if(!e.hasOwnProperty(r))try{e[r]=t.scaleRef(n)}catch(t){}}function hC(t,e,n,r){if(e[0].type===aC)dC(n,r,e[0].value);else if(e[0].type===sC)for(t in n.scales)dC(n,r,t)}function pC(t,e){return function(n,r,i){if(n){var o=fC(n,(i||this).context);return o&&o.path[t](r)}return e(r)}}var mC=pC("area",function(t){return Lb.reset(),Pb(t,Bb),2*Lb}),gC=pC("bounds",function(t){var e,n,r,i,o,a,s;if(ey=ty=-(Zb=Qb=1/0),ay=[],Pb(t,cy),n=ay.length){for(ay.sort(by),e=1,o=[r=ay[0]];e<n;++e)yy(r,(i=ay[e])[0])||yy(r,i[1])?(vy(r[0],i[1])>vy(r[0],r[1])&&(r[1]=i[1]),vy(i[0],r[1])>vy(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=vy(r[1],i[0]))>a&&(a=s,Zb=i[0],ty=r[1])}return ay=sy=null,Zb===1/0||Qb===1/0?[[NaN,NaN],[NaN,NaN]]:[[Zb,Qb],[ty,ey]]}),vC=pC("centroid",function(t){wy=xy=_y=ky=Sy=Ey=Oy=Ay=Cy=My=Ny=0,Pb(t,Fy);var e=Cy,n=My,r=Ny,i=e*e+n*n+r*r;return i<1e-12&&(e=Ey,n=Oy,r=Ay,xy<ob&&(e=_y,n=ky,r=Sy),(i=e*e+n*n+r*r)<1e-12)?[NaN,NaN]:[pb(n,e)*lb,Eb(r/_b(i))*lb]});function bC(t){var e=this.context.data[t];return e?e.values.value:[]}function yC(t,e,n,r){e[0].type!==aC&&Object(H.n)("First argument to data functions must be a string literal.");var i=e[0].value,o=lC+i;r.hasOwnProperty(o)||(r[o]=n.getData(i).tuplesRef())}var wC={};function xC(t){return t.data}function _C(t,e){var n=bC.call(e,t);return n.root&&n.root.lookup||wC}function kC(t,e){return t===e||t!=t&&e!=e||!(!Object(H.A)(t)||!Object(H.A)(e)||t.length!==e.length)&&function(t,e){for(var n=0,r=t.length;n<r;++n)if(!kC(t[n],e[n]))return!1;return!0}(t,e)}function SC(t){return function(e){for(var n in t)if(!kC(e[n],t[n]))return!1;return!0}}var EC="E",OC="R",AC="R-E",CC="R-LE",MC="R-RE",NC="intersect",TC="index:unit";function IC(t,e){for(var n,r,i=e.fields,o=e.values,a=i.length,s=0;s<a;++s)if((r=i[s]).getter=H.t.getter||Object(H.t)(r.field),n=r.getter(t),Object(H.C)(n)&&(n=Object(H.Aa)(n)),Object(H.C)(o[s])&&(o[s]=Object(H.Aa)(o[s])),Object(H.C)(o[s][0])&&(o[s]=o[s].map(H.Aa)),r.type===EC){if(Object(H.A)(o[s])?o[s].indexOf(n)<0:n!==o[s])return!1}else if(r.type===OC){if(!rC(n,o[s]))return!1}else if(r.type===MC){if(!rC(n,o[s],!0,!1))return!1}else if(r.type===AC){if(!rC(n,o[s],!1,!1))return!1}else if(r.type===CC&&!rC(n,o[s],!1,!0))return!1;return!0}function DC(t,e,n,r){e[0].type!==aC&&Object(H.n)("First argument to indata must be a string literal.");var i=e[0].value,o=e.length>=2&&e[e.length-1].value,a=uC+"unit";o!==NC||r.hasOwnProperty(a)||(r[a]=n.getData(i).indataRef(n,"unit")),yC(0,e,n,r)}var jC={E_union:function(t,e){if(!t.length)return e;for(var n=0,r=e.length;n<r;++n)t.indexOf(e[n])<0&&t.push(e[n]);return t},E_intersect:function(t,e){return t.length?t.filter(function(t){return e.indexOf(t)>=0}):e},R_union:function(t,e){var n=Object(H.Aa)(e[0]),r=Object(H.Aa)(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]<r&&(t[1]=r),t):[n,r]},R_intersect:function(t,e){var n=Object(H.Aa)(e[0]),r=Object(H.Aa)(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?r<t[0]||t[1]<n?[]:(t[0]<n&&(t[0]=n),t[1]>r&&(t[1]=r),t):[n,r]}},RC="bin_",FC="intersect",PC="union",zC="index:unit";function LC(t,e){for(var n,r=e.fields,i=e.values,o=e.getter||(e.getter=[]),a=r.length,s=0;s<a;++s)if(o[s]=o[s]||Object(H.t)(r[s]),n=o[s](t),Object(H.C)(n)&&(n=Object(H.Aa)(n)),Object(H.C)(i[s])&&(i[s]=Object(H.Aa)(i[s])),e[RC+r[s]]){if(Object(H.C)(i[s][0])&&(i[s]=i[s].map(H.Aa)),!rC(n,i[s],!0,!1))return!1}else if(n!==i[s])return!1;return!0}function BC(t,e){for(var n,r,i=e.intervals,o=i.length,a=0;a<o;++a){if(n=i[a].extent,r=(i[a].getter||(i[a].getter=Object(H.t)(i[a].field)))(t),!n||n[0]===n[1])return!1;if(Object(H.C)(r)&&(r=Object(H.Aa)(r)),Object(H.C)(n[0])&&(n=i[a].extent=n.map(H.Aa)),Object(H.E)(n[0])&&!rC(r,n))return!1;if(Object(H.H)(n[0])&&n.indexOf(r)<0)return!1}return!0}function UC(t,e,n,r){for(var i,o,a,s,u,c=this.context.data[t],l=c?c.values.value:[],f=c?c[zC]&&c[zC].value:void 0,d=n===FC,h=l.length,p=0;p<h;++p)if(i=l[p],f&&d){if(-1===(a=(o=o||{})[s=i.unit]||0))continue;if(u=r(e,i),o[s]=u?-1:++a,u&&1===f.size)return!0;if(!u&&a===f.get(s).count)return!1}else if(d^(u=r(e,i)))return u;return h&&d}function WC(t,e,n){return UC.call(this,t,e,n,LC)}function qC(t,e,n,r){e[0].type!==aC&&Object(H.n)("First argument to indata must be a string literal.");var i=e[0].value,o=e.length>=2&&e[e.length-1].value,a=uC+"unit";o!==FC||r.hasOwnProperty(a)||(r[a]=n.getData(i).indataRef(n,"unit")),yC(0,e,n,r)}function VC(t,e,n,r){var i,o,a,s,u,c=this.context.data[t],l=c?c.values.value:[],f=c?c[zC]&&c[zC].value:void 0,d=l[0],h=0;if(d){for(i=e?d.encodings.length:d.fields.length;h<i;++h)if(e&&d.encodings[h]===e||n&&d.fields[h]===n){o=h,s=d[RC+d.fields[h]];break}return f&&1===f.size&&(r=PC),f&&r===FC?(u=l.reduce(function(t,e){return(t[e.unit]||(t[e.unit]=[])).push({unit:e.unit,value:e.values[o]}),t},{}),a=Object.keys(u).map(function(t){return{unit:t,value:s?$C(u[t],PC):HC(u[t],PC)}})):a=l.map(function(t){return{unit:t.unit,value:t.values[o]}}),s?$C(a,r):HC(a,r)}}function HC(t,e){for(var n,r,i,o,a={},s=0,u={},c=[],l=0,f=t.length;l<f;++l)r=(n=t[l]).unit,o=n.value,a[r]||(a[r]=++s),(i=u[o])||(u[o]=i={value:o,units:{},count:0}),i.units[r]||(i.units[r]=++i.count);for(o in u)i=u[o],e===FC&&i.count!==s||c.push(i.value);return c.length?c:void 0}function $C(t,e){for(var n,r,i,o,a=e===FC?KC:GC,s=0,u=t.length;s<u;++s)n=t[s].value,Object(H.C)(n[0])&&(n=n.map(H.Aa)),(i=n[0])>(o=n[1])&&(o=n[0],i=n[1]),r=r?a(r,i,o):[i,o];return r&&r.length&&+r[0]!=+r[1]?r:void 0}function GC(t,e,n){return t[0]>e&&(t[0]=e),t[1]<n&&(t[1]=n),t}function KC(t,e,n){return n<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>n&&(t[1]=n),t)}var XC={random:function(){return $r()},isArray:H.A,isBoolean:H.B,isDate:H.C,isNumber:H.E,isObject:H.F,isRegExp:H.G,isString:H.H,isTuple:X,toBoolean:H.Y,toDate:H.Z,toNumber:H.Aa,toString:H.Ca,pad:H.N,peek:H.S,truncate:H.Da,rgb:Cd,lab:Kd,hcl:th,hsl:Rd,sequence:Ui,format:function(t,e){return QA("format",mp.format,e)(t)},utcFormat:function(t,e){return QA("utcFormat",Ze,e)(t)},utcParse:function(t,e){return QA("utcParse",Qe,e)(t)},timeFormat:tC,timeParse:function(t,e){return QA("timeParse",Je,e)(t)},monthFormat:function(t){return nC(t,1,"%B")},monthAbbrevFormat:function(t){return nC(t,1,"%b")},dayFormat:function(t){return nC(0,2+t,"%A")},dayAbbrevFormat:function(t){return nC(0,2+t,"%a")},quarter:function(t){return 1+~~(new Date(t).getMonth()/3)},utcquarter:function(t){return 1+~~(new Date(t).getUTCMonth()/3)},warn:function(){return iC(this.context.dataflow,"warn",arguments)},info:function(){return iC(this.context.dataflow,"info",arguments)},debug:function(){return iC(this.context.dataflow,"debug",arguments)},extent:function(t){var e,n,r,i,o=0;if(t&&(e=t.length)){for(n=t[o];null==n||n!=n;n=t[++o]);for(r=i=n;o<e;++o)null!=(n=t[o])&&(n<r&&(r=n),n>i&&(i=n))}return[r,i]},inScope:function(t){var e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},clampRange:function(t,e,n){var r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),(r=o-i)>=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]},pinchDistance:function(t){var e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){var e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){return oC?oC.screen:{}},containerSize:function(){var t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){return oC?[oC.innerWidth,oC.innerHeight]:[void 0,void 0]},span:function(t){return t[t.length-1]-t[0]||0},merge:function(){var t=[].slice.call(arguments);return t.unshift({}),H.o.apply(null,t)},flush:function(t,e,n,r,i,o){if(!n&&0!==n)return o;var a,s,u=t[0],c=Object(H.S)(t),l=+n;return c<u&&(a=u,u=c,c=a),(a=Math.abs(e-u))<(s=Math.abs(c-e))&&a<=l?r:s<=l?i:o},bandspace:function(t,e,n){return Ef(t||0,e||0,n||0)},inrange:rC,setdata:function(t,e){var n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(H.Ea).insert(e)),1},pathShape:function(t){var e=null;return function(n){return n?Vs(n,e=e||Ps(t)):t}},panLinear:H.O,panLog:H.P,panPow:H.Q,zoomLinear:H.Ia,zoomLog:H.Ja,zoomPow:H.Ka,encode:function(t,e,n){if(t){var r=this.context.dataflow,i=t.mark.source;r.pulse(i,r.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,o){var a,s,u=this.context.dataflow,c=this.context.data[t],l=c.input,f=c.changes,d=u.stamp();if(!1===u._trigger||!(l.value.length||e||r))return 0;if((!f||f.stamp<d)&&(c.changes=f=u.changeset(),f.stamp=d,u.runAfter(function(){c.modified=!0,u.pulse(l,f).run()},!0,1)),n&&(a=!0===n?H.Ea:Object(H.A)(n)||X(n)?n:SC(n),f.remove(a)),e&&f.insert(e),r&&(a=SC(r),l.value.some(a)?f.remove(a):f.insert(r)),i)for(s in o)f.modify(i,s,o[s]);return 1}},YC=["view","item","group","xy","x","y"],JC="this.",ZC={};function QC(t,e,n){return 1===arguments.length?XC[t]:(XC[t]=e,n&&(ZC[t]=n),eM&&(eM.functions[t]=JC+t),this)}QC("bandwidth",function(t,e){var n=fC(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0},hC),QC("copy",function(t,e){var n=fC(t,(e||this).context);return n?n.copy():void 0},hC),QC("domain",function(t,e){var n=fC(t,(e||this).context);return n?n.domain():[]},hC),QC("range",function(t,e){var n=fC(t,(e||this).context);return n&&n.range?n.range():[]},hC),QC("invert",function(t,e,n){var r=fC(t,(n||this).context);return r?Object(H.A)(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0},hC),QC("scale",function(t,e,n){var r=fC(t,(n||this).context);return r?r(e):void 0},hC),QC("gradient",function(t,e,n,r,i){t=fC(t,(i||this).context);var o=pa(e,n),a=t.domain(),s=a[0],u=Object(H.S)(a),c=Kp(t,s,u);t.ticks&&(s!==(a=t.ticks(+r||15))[0]&&a.unshift(s),u!==Object(H.S)(a)&&a.push(u));for(var l=0,f=a.length;l<f;++l)o.stop(c(a[l]),t(a[l]));return o},hC),QC("geoArea",mC,hC),QC("geoBounds",gC,hC),QC("geoCentroid",vC,hC),QC("geoShape",function(t,e,n){var r=fC(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}},hC),QC("indata",function(t,e,n){var r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i},function(t,e,n,r){e[0].type!==aC&&Object(H.n)("First argument to indata must be a string literal."),e[1].type!==aC&&Object(H.n)("Second argument to indata must be a string literal.");var i=e[0].value,o=e[1].value,a=uC+o;r.hasOwnProperty(a)||(r[a]=n.getData(i).indataRef(n,o))}),QC("data",bC,yC),QC("treePath",function(t,e,n){var r=_C(t,this),i=r[e],o=r[n];return i&&o?i.path(o).map(xC):void 0},yC),QC("treeAncestors",function(t,e){var n=_C(t,this)[e];return n?n.ancestors().map(xC):void 0},yC),QC("vlSelectionTest",function(t,e,n){for(var r,i,o,a,s,u=this.context.data[t],c=u?u.values.value:[],l=u?u[TC]&&u[TC].value:void 0,f=n===NC,d=c.length,h=0;h<d;++h)if(r=c[h],l&&f){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(s=IC(e,r),i[a]=s?-1:++o,s&&1===l.size)return!0;if(!s&&o===l.get(a).count)return!1}else if(f^(s=IC(e,r)))return s;return d&&f},DC),QC("vlSelectionResolve",function(t,e){for(var n,r,i,o,a,s,u,c,l,f,d,h=this.context.data[t],p=h?h.values.value:[],m={},g={},v=p.length,b=0;b<v;++b)for(o=(n=p[b]).unit,r=n.fields,i=n.values,f=0,d=r.length;f<d;++f)a=r[f],u=(s=m[a.field]||(m[a.field]={}))[o]||(s[o]=[]),g[a.field]=c=a.type.charAt(0),l=jC[c+"_union"],s[o]=l(u,Object(H.i)(i[f]));return e=e||"union",Object.keys(m).forEach(function(t){m[t]=Object.keys(m[t]).map(function(e){return m[t][e]}).reduce(function(n,r){return void 0===n?r:jC[g[t]+"_"+e](n,r)})}),m},DC),QC("vlSingle",WC,yC),QC("vlSingleDomain",VC,yC),QC("vlMulti",WC,qC),QC("vlMultiDomain",VC,qC),QC("vlInterval",function(t,e,n){return UC.call(this,t,e,n,BC)},yC),QC("vlIntervalDomain",function(t,e,n,r){var i,o,a,s,u,c=this.context.data[t],l=c?c.values.value:[],f=l[0],d=0;if(f){for(i=f.intervals.length;d<i;++d)if(o=f.intervals[d],e&&o.encoding===e||n&&o.field===n){if(!o.extent)return;a=d,u=o.extent.length>2;break}return s=l.reduce(function(t,e){var n=e.intervals[a].extent,r=u?n.map(function(t){return{unit:e.unit,value:t}}):{unit:e.unit,value:n};return u?t.push.apply(t,r):t.push(r),t},[]),u?HC(s,r):$C(s,r)}},yC);var tM={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+Object(H.X)("$"+t)+"]"},functions:function(t){var e=YA(t);for(var n in YC.forEach(function(t){e[t]="event.vega."+t}),XC)e[n]=JC+n;return e},constants:XA,visitors:ZC},eM=JA(tM),nM=function(t,e,n){var r,i,o={};try{t=Object(H.H)(t)?t:Object(H.X)(t)+"",r=KA(t)}catch(e){Object(H.n)("Expression parse error: "+t)}return r.visit(function(t){if("CallExpression"===t.type){var n=t.callee.name,r=tM.visitors[n];r&&r(n,t.arguments,e,o)}}),(i=eM(r)).globals.forEach(function(t){var n="$"+t;!o.hasOwnProperty(n)&&e.getSignal(t)&&(o[n]=e.signalRef(t))}),{$expr:n?n+"return("+i.code+");":i.code,$fields:i.fields,$params:o}};function rM(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function iM(t,e,n,r){return new rM(t,e,n,r)}function oM(t,e){return iM("operator",t,e)}function aM(t){var e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}var sM={$tupleid:1,toString:function(){return":_tupleid_:"}};function uM(t,e){return e?{$field:t,$name:e}:{$field:t}}var cM=uM("key");function lM(t,e){return{$compare:t,$order:e}}var fM="descending";function dM(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}var hM="scope",pM="view";function mM(t){return t&&t.signal}function gM(t){if(mM(t))return!0;if(Object(H.F)(t))for(var e in t)if(gM(t[e]))return!0;return!1}function vM(t,e){return null!=t?t:e}function bM(t){return t&&t.signal||t}var yM="timer";function wM(t,e){return(t.merge?function(t,e){var n=xM({merge:t.merge.map(function(t){return wM(t,e)})},t,e);return e.addStream(n).id}:t.stream?function(t,e){var n=xM({stream:wM(t.stream,e)},t,e);return e.addStream(n).id}:t.type?function(t,e){var n,r;return t.type===yM?(n=e.event(yM,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return t===hM?pM:t||pM}(t.source),t.type),r=xM({stream:n},t,e),1===Object.keys(r).length?n:e.addStream(r).id}:Object(H.n)("Invalid stream specification: "+Object(H.X)(t)))(t,e)}function xM(t,e,n){var r=e.between;return r&&(2!==r.length&&Object(H.n)('Stream "between" parameter must have 2 entries: '+Object(H.X)(e)),t.between=[wM(r[0],n),wM(r[1],n)]),r=e.filter?Object(H.i)(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),e.source===hM&&r.push("inScope(event.item)"),r.length&&(t.filter=nM("("+r.join(")&&(")+")").$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}var _M,kM,SM=function(t,e,n){return _M=e||EM,kM=n||RM,PM(t.trim()).map(zM)},EM="view",OM="[",AM="]",CM="{",MM="}",NM=":",TM=",",IM="@",DM=">",jM=/[[\]{}]/,RM={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function FM(t,e,n,r,i){for(var o,a=0,s=t.length;e<s;++e){if(o=t[e],!a&&o===n)return e;i&&i.indexOf(o)>=0?--a:r&&r.indexOf(o)>=0&&++a}return e}function PM(t){for(var e=[],n=0,r=t.length,i=0;i<r;)i=FM(t,i,TM,OM+CM,AM+MM),e.push(t.substring(n,i).trim()),n=++i;if(0===e.length)throw"Empty event selector: "+t;return e}function zM(t){return"["===t[0]?function(t){var e,n,r=t.length,i=1;if((i=FM(t,i,AM,OM,AM))===r)throw"Empty between selector: "+t;if(2!==(e=PM(t.substring(1,i))).length)throw"Between selector must have two elements: "+t;if((t=t.slice(i+1).trim())[0]!==DM)throw"Expected '>' after between selector: "+t;return e=e.map(zM),(n=zM(t.slice(1).trim())).between?{between:e,stream:n}:(n.between=e,n)}(t):function(t){var e,n,r={source:_M},i=[],o=[0,0],a=0,s=0,u=t.length,c=0;if(t[u-1]===MM){if(!((c=t.lastIndexOf(CM))>=0))throw"Unmatched right brace: "+t;try{o=function(t){var e=t.split(TM);if(!t.length||e.length>2)throw t;return e.map(function(e){var n=+e;if(n!=n)throw t;return n})}(t.substring(c+1,u-1))}catch(e){throw"Invalid throttle specification: "+t}u=(t=t.slice(0,c).trim()).length,c=0}if(!u)throw t;if(t[0]===IM&&(a=++c),(e=FM(t,c,NM))<u&&(i.push(t.substring(s,e).trim()),s=c=++e),(c=FM(t,c,OM))===u)i.push(t.substring(s,u).trim());else if(i.push(t.substring(s,c).trim()),n=[],(s=++c)===u)throw"Unmatched left bracket: "+t;for(;c<u;){if((c=FM(t,c,AM))===u)throw"Unmatched left bracket: "+t;if(n.push(t.substring(s,c).trim()),c<u-1&&t[++c]!==OM)throw"Expected left bracket: "+t;s=++c}if(!(u=i.length)||jM.test(i[u-1]))throw"Invalid event selector: "+t;return u>1?(r.type=i[1],a?r.markname=i[0].slice(1):function(t){return kM[t]}(i[0])?r.marktype=i[0]:r.source=i[0]):r.type=i[0],"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1)),null!=n&&(r.filter=n),o[0]&&(r.throttle=o[0]),o[1]&&(r.debounce=o[1]),r}(t)}function LM(t){return function(e,n,r){return iM(t,n,e||void 0,r)}}var BM=LM("aggregate"),UM=LM("axisticks"),WM=LM("bound"),qM=LM("collect"),VM=LM("compare"),HM=LM("datajoin"),$M=LM("encode"),GM=LM("expression"),KM=(LM("extent"),LM("facet")),XM=LM("field"),YM=LM("key"),JM=LM("legendentries"),ZM=LM("load"),QM=LM("mark"),tN=LM("multiextent"),eN=LM("multivalues"),nN=LM("overlap"),rN=LM("params"),iN=LM("prefacet"),oN=LM("projection"),aN=LM("proxy"),sN=LM("relay"),uN=LM("render"),cN=LM("scale"),lN=LM("sieve"),fN=LM("sortitems"),dN=LM("viewlayout"),hN=LM("values"),pN=0,mN=["identity","ordinal","band","point","bin-linear","bin-ordinal","quantize","quantile","threshold","linear","pow","sqrt","log","sequential","time","utc"],gN=Object(H.Ba)(mN),vN=Object(H.Ba)(mN.slice(4,9)),bN=Object(H.Ba)(mN.slice(9)),yN=Object(H.Ba)(mN.slice(1,6));function wN(t){return yN.hasOwnProperty(t)}function xN(t){return vN.hasOwnProperty(t)}function _N(t){return"quantile"===t}function kN(t,e){return Object(H.F)(t)?t.signal?e.signalRef(t.signal):Object(H.n)("Unsupported object: "+Object(H.X)(t)):t}function SN(t){Object(H.n)("Can not find data set: "+Object(H.X)(t))}function EN(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(Object(H.A)(t)?function(t,e,n){return t.map(function(t){return kN(t,n)})}:t.fields?function(t,e,n){var r=t.data,i=t.fields.reduce(function(t,e){return e=Object(H.H)(e)?{data:r,field:e}:Object(H.A)(e)||e.signal?function(t,e){var n="_:vega:_"+pN++,r=qM({});if(Object(H.A)(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+Object(H.X)(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,lN({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t},[]);return(wN(e.type)?function(t,e,n){var r,i,o;return r=n.map(function(t){var n=e.getData(t.data);return n||SN(t.data),n.countsRef(e,t.field)}),i=e.add(BM({groupby:cM,ops:["sum"],fields:[e.fieldRef("count")],as:["count"],pulse:r})),o=e.add(qM({pulse:aM(i)})),aM(e.add(hN({field:cM,sort:e.sortRef(ON(t.sort,!0)),pulse:aM(o)})))}:_N(e.type)?function(t,e,n){var r=n.map(function(t){var n=e.getData(t.data);return n||SN(t.data),n.domainRef(e,t.field)});return aM(e.add(eN({values:r})))}:function(t,e,n){var r=n.map(function(t){var n=e.getData(t.data);return n||SN(t.data),n.extentRef(e,t.field)});return aM(e.add(tN({extents:r})))})(t,n,i)}:function(t,e,n){var r=n.getData(t.data);return r||SN(t.data),wN(e.type)?r.valuesRef(n,t.field,ON(t.sort,!1)):_N(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)})(t,e,n);null==e.domainMin&&null==e.domainMax||Object(H.n)("No scale domain defined for domainMin/domainMax to override.")}function ON(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field?Object(H.n)("Multiple domain scales can not sort by field."):e&&t.op&&"count"!==t.op&&Object(H.n)("Multiple domain scales support op count only."):Object(H.n)("No field provided for sort aggregate op: "+t.op):Object(H.F)(t)?t.field="key":t={field:"key"}),t}function AN(t,e,n){return Object(H.A)(t)?t.map(function(t){return AN(t,e,n)}):Object(H.F)(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:Object(H.n)("Unsupported parameter object: "+Object(H.X)(t)):t}var CN="top",MN="left",NN="bottom",TN="vertical",IN="start",DN="end",jN="value",RN="guide-label",FN="gradient",PN="discrete",zN=["size","shape","fill","stroke","strokeDash","opacity"],LN={name:1,interactive:1},BN=Object(H.Ba)(["rule"]),UN=Object(H.Ba)(["group","image","rect"]),WN=function(t,e){var n="";return BN[e]?n:(t.x2&&(t.x?(UN[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(UN[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;"),n)},qN=function(t,e,n,r){var i=nM(t,e);return i.$fields.forEach(function(t){r[t]=1}),Object(H.o)(n,i.$params),i.$expr},VN=function(t,e,n,r){return function t(e,n,r,i){var o,a,s;if(e.signal)o="datum",s=qN(e.signal,n,r,i);else if(e.group||e.parent){for(a=Math.max(1,e.level||1),o="item";a-- >0;)o+=".mark.group";e.parent?(s=e.parent,o+=".datum"):s=e.group}else e.datum?(o="datum",s=e.datum):Object(H.n)("Invalid field reference: "+Object(H.X)(e));return e.signal||(Object(H.H)(s)?(i[s]=1,s=Object(H.W)(s).map(H.X).join("][")):s=t(s,n,r,i)),o+"["+s+"]"}(Object(H.F)(t)?t:{datum:t},e,n,r)};function HN(t,e,n,r){var i;if(Object(H.H)(t))i=cC+t,n.hasOwnProperty(i)||(n[i]=e.scaleRef(t)),i=Object(H.X)(i);else{for(i in e.scales)n[cC+i]=e.scaleRef(i);i=Object(H.X)(cC)+"+"+(t.signal?"("+qN(t.signal,e,n,r)+")":VN(t,e,n,r))}return"_["+i+"]"}var $N=function(t,e,n,r){return Object(H.F)(t)?"("+GN(null,t,e,n,r)+")":t},GN=function(t,e,n,r,i){if(null!=e.gradient)return function(t,e,n,r){return"this.gradient("+HN(t.gradient,e,n,r)+","+Object(H.X)(t.start)+","+Object(H.X)(t.stop)+","+Object(H.X)(t.count)+")"}(e,n,r,i);var o=e.signal?qN(e.signal,n,r,i):e.color?function(t,e,n,r){function i(t,i,o,a){return"this."+t+"("+[GN(null,i,e,n,r),GN(null,o,e,n,r),GN(null,a,e,n,r)].join(",")+").toString()"}return t.c?i("hcl",t.h,t.c,t.l):t.h||t.s?i("hsl",t.h,t.s,t.l):t.l||t.a?i("lab",t.l,t.a,t.b):t.r||t.g||t.b?i("rgb",t.r,t.g,t.b):null}(e.color,n,r,i):null!=e.field?VN(e.field,n,r,i):void 0!==e.value?Object(H.X)(e.value):void 0;return null!=e.scale&&(o=function(t,e,n,r,i){var o,a,s,u=HN(t.scale,n,r,i);return null!=t.range?(a=u+".range()",e=0==(o=+t.range)?a+"[0]":"($="+a+","+(1===o?"$[$.length-1]":"$[0]+"+o+"*($[$.length-1]-$[0])")+")"):(void 0!==e&&(e=u+"("+e+")"),t.band&&(s=function(t,e){if(!Object(H.H)(t))return-1;var n=e.scaleType(t);return"band"===n||"point"===n?1:0}(t.scale,n))&&(o=(a=u+".bandwidth")+"()"+(1==(o=+t.band)?"":"*"+o),s<0&&(o="("+a+"?"+o+":0)"),e=(e?e+"+":"")+o,t.extra&&(e="(datum.extra?"+u+"(datum.extra.value):"+e+")")),null==e&&(e="0")),e}(e,o,n,r,i)),void 0===o&&(o=null),null!=e.exponent&&(o="Math.pow("+o+","+$N(e.exponent,n,r,i)+")"),null!=e.mult&&(o+="*"+$N(e.mult,n,r,i)),null!=e.offset&&(o+="+"+$N(e.offset,n,r,i)),e.round&&(o="Math.round("+o+")"),o},KN=function(t,e,n){return t+"["+Object(H.X)(e)+"]="+n+";"},XN=function(t,e,n,r,i){var o="";return e.forEach(function(e){var a=GN(t,e,n,r,i);o+=e.test?qN(e.test,n,r,i)+"?"+a+":":a}),":"===Object(H.S)(o)&&(o+="null"),KN("o",t,o)};function YN(t,e,n,r){var i,o,a,s={},u="var o=item,datum=o.datum,$;";for(i in t)o=t[i],Object(H.A)(o)?u+=XN(i,o,r,n,s):(a=GN(i,o,r,n,s),u+=KN("o",i,a));return u+=WN(t,e),{$expr:u+="return 1;",$fields:Object.keys(s),$output:Object.keys(t)}}var JN="mark",ZN="frame";function QN(t){return Object(H.F)(t)?Object(H.o)({},t):{value:t}}function tT(t,e,n,r){return null!=n?(Object(H.F)(n)&&!Object(H.A)(n)?t.update[e]=n:t[r||"enter"][e]={value:n},1):0}function eT(t,e,n){for(var r in e)n&&n.hasOwnProperty(r)||(t[r]=Object(H.o)(t[r]||{},e[r]));return t}function nT(t,e,n,r,i,o){var a,s;for(s in(o=o||{}).encoders={$encode:a={}},t=function(t,e,n,r,i){var o,a,s={};for(o in"legend"!=n&&0!==String(n).indexOf("axis")||(n=null),a=n===ZN?i.group:n===JN?Object(H.o)({},i.mark,i[e]):null)iT(o,t)||("fill"===o||"stroke"===o)&&(iT("fill",t)||iT("stroke",t))||(s[o]=rT(a[o]));return Object(H.i)(r).forEach(function(e){var n=i.style&&i.style[e];for(var r in n)iT(r,t)||(s[r]=rT(n[r]))}),(t=Object(H.o)({},t)).enter=Object(H.o)(s,t.enter),t}(t,e,n,r,i.config))a[s]=YN(t[s],e,o,i);return o}function rT(t){return t&&t.signal?{signal:t.signal}:{value:t}}function iT(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}var oT=function(t,e,n,r,i,o,a){return{type:t,name:a?a.name:void 0,role:e,style:a&&a.style||n,key:r,from:i,interactive:!(!a||!a.interactive),encode:eT(o,a,LN)}};function aT(t,e,n){return vM(e[t],n[t])}function sT(t,e){return vM(t.direction,e)===TN}function uT(t,e){return vM(t.gradientLength,e.gradientLength||e.gradientWidth)}function cT(t,e){return vM(t.gradientThickness,e.gradientThickness||e.gradientHeight)}function lT(t,e){var n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}var fT="group",dT="text",hT=function(t,e,n,r){var i,o,a,s,u,c={value:0},l=sT(t,e.gradientDirection),f=QN(cT(t,e)),d=uT(t,e),h=aT("labelOverlap",t,e),p="";return tT(i={enter:o={opacity:c},update:a={opacity:{value:1},text:{field:"label"}},exit:{opacity:c}},"fill",aT("labelColor",t,e)),tT(i,"font",aT("labelFont",t,e)),tT(i,"fontSize",aT("labelFontSize",t,e)),tT(i,"fontWeight",aT("labelFontWeight",t,e)),tT(i,"fillOpacity",aT("labelOpacity",t,e)),tT(i,"limit",vM(t.labelLimit,e.gradientLabelLimit)),l?(o.align={value:"left"},o.baseline=a.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},s="y",u="x",p="1-"):(o.align=a.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},o.baseline={value:"top"},s="x",u="y"),o[s]=a[s]={signal:p+"datum.perc",mult:d},o[u]=a[u]=f,f.offset=vM(t.labelOffset,e.gradientLabelOffset)||0,t=oT(dT,"legend-label",RN,jN,r,i,n),h&&(t.overlap={method:h,order:"datum.index"}),t},pT=function(t,e,n,r,i,o,a,s){return{type:fT,name:n,role:t,style:e,from:r,interactive:i||!1,encode:o,marks:a,layout:s}},mT={value:0};function gT(t){return Object(H.F)(t)&&t.signal?t.signal:Object(H.X)(t)}var vT=function(t){var e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")?t.type===fT?"scope":e||JN:e},bT=function(t,e){var n=jr(t.type);n||Object(H.n)("Unrecognized transform type: "+Object(H.X)(t.type));var r=iM(n.type.toLowerCase(),null,yT(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r};function yT(t,e,n){var r,i,o,a={};for(i=0,o=t.params.length;i<o;++i)a[(r=t.params[i]).name]=wT(r,e,n);return a}function wT(t,e,n){var r=t.type,i=e[t.name];return"index"===r?function(t,e,n){return Object(H.H)(e.from)||Object(H.n)('Lookup "from" parameter must be a string literal.'),n.getData(e.from).lookupRef(n,e.key)}(0,e,n):void 0!==i?"param"===r?function(t,e,n){var r=e[t.name];return t.array?(Object(H.A)(r)||Object(H.n)("Expected an array of sub-parameters. Instead: "+Object(H.X)(r)),r.map(function(e){return _T(t,e,n)})):_T(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!mM(i)?i.map(function(e){return xT(t,e,n)}):xT(t,i,n):void(t.required&&Object(H.n)("Missing required "+Object(H.X)(e.type)+" parameter: "+Object(H.X)(t.name)))}function xT(t,e,n){var r=t.type;if(mM(e))return kT(r)?Object(H.n)("Expression references can not be signals."):ST(r)?n.fieldRef(e):ET(r)?n.compareRef(e):n.signalRef(e.signal);var i=t.expr||ST(r);return i&&e&&e.expr?n.exprRef(e.expr,e.as):i&&e&&e.field?uM(e.field,e.as):kT(r)?nM(e,n):"data"===r?aM(n.getData(e).values):ST(r)?uM(e):ET(r)?n.compareRef(e):e}function _T(t,e,n){var r,i,o,a,s;for(a=0,s=t.params.length;a<s;++a){for(o in(i=t.params[a]).key)if(i.key[o]!==e[o]){i=null;break}if(i)break}return i||Object(H.n)("Unsupported parameter: "+Object(H.X)(e)),r=Object(H.o)(yT(i,e,n),i.key),aM(n.add(rN(r)))}function kT(t){return"expr"===t}function ST(t){return"field"===t}function ET(t){return"compare"===t}function OT(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:aM(e.getData(t.data).output)}function AT(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}AT.fromEntries=function(t,e){var n=e.length,r=1,i=e[0],o=e[n-1],a=e[n-2],s=null;for(t.add(e[0]);r<n;++r)e[r].params.pulse=aM(e[r-1]),t.add(e[r]),"aggregate"===e[r].type&&(s=e[r]);return new AT(t,i,a,o,s)};var CT=AT.prototype;function MT(t){return Object(H.H)(t)?t:null}function NT(t,e,n){var r,i=dM(n.op,n.field);if(e.ops){for(var o=0,a=e.as.length;o<a;++o)if(e.as[o]===i)return}else e.ops=["count"],e.fields=[null],e.as=["count"];n.op&&(e.ops.push((r=n.op.signal)?t.signalRef(r):n.op),e.fields.push(t.fieldRef(n.field)),e.as.push(i))}function TT(t,e,n,r,i,o,a){var s,u,c=e[n]||(e[n]={}),l=function(t){return Object(H.F)(t)?(t.order===fM?"-":"+")+dM(t.op,t.field):""}(o),f=MT(i);if(null!=f&&(t=e.scope,s=c[f+=l?"|"+l:""]),!s){var d=o?{field:cM,pulse:e.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:aM(e.output)};l&&(d.sort=t.sortRef(o)),u=t.add(iM(r,void 0,d)),a&&(e.index[i]=u),s=aM(u),null!=f&&(c[f]=s)}return s}CT.countsRef=function(t,e,n){var r,i,o,a=this.counts||(this.counts={}),s=MT(e);return null!=s&&(t=this.scope,r=a[s]),r?n&&n.field&&NT(t,r.agg.params,n):(o={groupby:t.fieldRef(e,"key"),pulse:aM(this.output)},n&&n.field&&NT(t,o,n),r={agg:i=t.add(BM(o)),ref:aM(r=t.add(qM({pulse:aM(i)})))},null!=s&&(a[s]=r)),r.ref},CT.tuplesRef=function(){return aM(this.values)},CT.extentRef=function(t,e){return TT(t,this,"extent","extent",e,!1)},CT.domainRef=function(t,e){return TT(t,this,"domain","values",e,!1)},CT.valuesRef=function(t,e,n){return TT(t,this,"vals","values",e,n||!0)},CT.lookupRef=function(t,e){return TT(t,this,"lookup","tupleindex",e,!1)},CT.indataRef=function(t,e){return TT(t,this,"indata","tupleindex",e,!0,!0)};var IT=function(t,e,n){var r,i,o=t.remove,a=t.insert,s=t.toggle,u=t.modify,c=t.values,l=e.add(oM());r="if("+t.trigger+',modify("'+n+'",'+[a,o,s,u,c].map(function(t){return null==t?"null":t}).join(",")+"),0)",i=nM(r,e),l.update=i.$expr,l.params=i.$params},DT=function(t,e){var n,r,i,o,a,s,u,c,l,f,d,h,p,m=vT(t),g=t.type===fT,v=t.from&&t.from.facet,b=t.layout||"scope"===m||m===ZN,y=m===JN||b||v,w=t.overlap;i=function(t,e,n){var r,i,o,a,s;return t?(r=t.facet)&&(e||Object(H.n)("Only group marks can be faceted."),null!=r.field?a=s=OT(r,n):(t.data?s=aM(n.getData(t.data).aggregate):((o=bT(Object(H.o)({type:"aggregate",groupby:Object(H.i)(r.groupby)},r.aggregate),n)).params.key=n.keyRef(r.groupby),o.params.pulse=OT(r,n),a=s=aM(n.add(o))),i=n.keyRef(r.groupby,!0))):a=aM(n.add(qM(null,[{}]))),a||(a=OT(t,n)),{key:i,pulse:a,parent:s}}(t.from,g,e),l=aM(r=e.add(HM({key:i.key||(t.key?uM(t.key):void 0),pulse:i.pulse,clean:!g}))),r=o=e.add(qM({pulse:l})),f=aM(r=e.add(QM({markdef:function(t){return{marktype:t.type,name:t.name||void 0,role:t.role||vT(t),zindex:+t.zindex||void 0}}(t),interactive:function(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}(t.interactive,e),clip:function(t,e){var n;return Object(H.F)(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+gT(t.path)+")":t.sphere&&(n="geoShape("+gT(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:aM(r)}))),(r=e.add($M(nT(t.encode,t.type,m,t.style,e,{pulse:f})))).params.parent=e.encode(),t.transform&&t.transform.forEach(function(t){var n=bT(t,e);(n.metadata.generates||n.metadata.changes)&&Object(H.n)("Mark transforms should not generate new data."),n.params.pulse=aM(r),e.add(r=n)}),t.sort&&(r=e.add(fN({sort:e.compareRef(t.sort,!0),pulse:aM(r)}))),d=aM(r),(v||b)&&(h=aM(b=e.add(dN({layout:e.objectProperty(t.layout),legendMargin:e.config.legendMargin,mark:f,pulse:d})))),p=aM(a=e.add(WM({mark:f,pulse:h||d}))),g&&(y&&((n=e.operators).pop(),b&&n.pop()),e.pushState(d,h||p,l),v?function(t,e,n){var r,i,o,a,s=t.from.facet,u=s.name,c=OT(s,e);s.name||Object(H.n)("Facet must have a name: "+Object(H.X)(s)),s.data||Object(H.n)("Facet must reference a data set: "+Object(H.X)(s)),s.field?a=e.add(iN({field:e.fieldRef(s.field),pulse:c})):s.groupby?a=e.add(KM({key:e.keyRef(s.groupby),group:aM(e.proxy(n.parent)),pulse:c})):Object(H.n)("Facet must specify groupby or field: "+Object(H.X)(s)),i=(r=e.fork()).add(qM()),o=r.add(lN({pulse:aM(i)})),r.addData(u,new AT(r,i,i,o)),r.addSignal("parent",null),a.params.subflow={$subflow:UT(t,r).toRuntime()}}(t,e,i):y?function(t,e,n){var r=e.add(iN({pulse:n.pulse})),i=e.fork();i.add(lN()),i.addSignal("parent",null),r.params.subflow={$subflow:UT(t,i).toRuntime()}}(t,e,i):UT(t,e),e.popState(),y&&(b&&n.push(b),n.push(a))),w&&(p=function(t,e,n){var r,i=t.method,o=t.bound,a={method:mM(i)?n.signalRef(i.signal):i,pulse:e};return t.order&&(a.sort=n.compareRef({field:t.order})),o&&(r=o.tolerance,a.boundTolerance=mM(r)?n.signalRef(r.signal):+r,a.boundScale=n.scaleRef(o.scale),a.boundOrient=o.orient),aM(n.add(nN(a)))}(w,p,e)),s=e.add(uN({pulse:p})),u=e.add(lN({pulse:aM(s)},void 0,e.parent())),null!=t.name&&(c=t.name,e.addData(c,new AT(e,o,s,u)),t.on&&t.on.forEach(function(t){(t.insert||t.remove||t.toggle)&&Object(H.n)("Marks only support modify triggers."),IT(t,e,c)}))},jT=function(t,e){var n,r,i,o,a,s,u,c,l,f=e.config.legend,d=t.encode||{},h=d.legend||{},p=h.name||void 0,m=h.interactive,g=h.style,v=zN.reduce(function(e,n){return e||t[n]},0);return v||Object(H.n)("Missing valid scale for legend."),a=function(t,e){var n=t.type||"symbol";return t.type||1!==function(t){return zN.reduce(function(e,n){return e+(t[n]?1:0)},0)}(t)||!t.fill&&!t.stroke||(n=function(t){return bN.hasOwnProperty(t)}(e)?FN:xN(e)?PN:"symbol"),n!==FN?n:xN(e)?PN:FN}(t,e.scaleType(v)),s={orient:aT("orient",t,f),title:null!=t.title,type:a},u=aM(e.add(qM(null,[s]))),h=eT(function(t,e){var n={enter:{},update:{}};return tT(n,"offset",aT("offset",t,e)),tT(n,"padding",aT("padding",t,e)),tT(n,"titlePadding",aT("titlePadding",t,e)),tT(n,"fill",aT("fillColor",t,e)),tT(n,"stroke",aT("strokeColor",t,e)),tT(n,"strokeWidth",aT("strokeWidth",t,e)),tT(n,"cornerRadius",aT("cornerRadius",t,e)),tT(n,"strokeDash",e.strokeDash),n}(t,f),h,LN),n={enter:{x:{value:0},y:{value:0}}},c=aM(e.add(JM(i={type:a,scale:e.scaleRef(v),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),formatSpecifier:e.property(t.format)}))),a===FN?(o=[function(t,e,n,r){var i,o,a,s,u,c,l={value:0},f=sT(t,n.gradientDirection),d=cT(t,n),h=uT(t,n);return f?(a=[0,1],s=[0,0],u=d,c=h):(a=[0,0],s=[1,0],u=h,c=d),tT(i={enter:o={opacity:l,x:l,y:l,width:QN(u),height:QN(c)},update:Object(H.o)({},o,{opacity:{value:1},fill:{gradient:e,start:a,stop:s}}),exit:{opacity:l}},"stroke",aT("gradientStrokeColor",t,n)),tT(i,"strokeWidth",aT("gradientStrokeWidth",t,n)),tT(i,"opacity",aT("gradientOpacity",t,n),"update"),oT("rect","legend-gradient",null,void 0,void 0,i,r)}(t,v,f,d.gradient),hT(t,f,d.labels,c)],i.count=i.count||e.signalRef("max(2,2*floor(("+bM(uT(t,f))+")/100))")):a===PN?o=[function(t,e,n,r,i){var o,a,s,u,c,l,f={value:0},d=sT(t,n.gradientDirection),h=cT(t,n),p=uT(t,n),m="";return d?(s="y",c="y2",u="x",l="width",m="1-"):(s="x",c="x2",u="y",l="height"),(a={opacity:f,fill:{scale:e,field:jN}})[s]={signal:m+"datum.perc",mult:p},a[u]=f,a[c]={signal:m+"datum.perc2",mult:p},a[l]=QN(h),tT(o={enter:a,update:Object(H.o)({},a,{opacity:{value:1}}),exit:{opacity:f}},"stroke",aT("gradientStrokeColor",t,n)),tT(o,"strokeWidth",aT("gradientStrokeWidth",t,n)),tT(o,"opacity",aT("gradientOpacity",t,n),"update"),oT("rect","legend-band",null,jN,i,o,r)}(t,v,f,d.gradient,c),hT(t,f,d.labels,c)]:(r=function(t,e){return{align:aT("gridAlign",t,e),center:{row:!0,column:!1},columns:function(t,e){return vM(t.columns,vM(e.columns,+sT(t,e.symbolDirection)))}(t,e),padding:{row:aT("rowPadding",t,e),column:aT("columnPadding",t,e)}}}(t,f),o=[function(t,e,n,r,i){var o,a,s,u,c,l,f,d=n.entries,h=!(!d||!d.interactive),p=d?d.name:void 0,m=aT("clipHeight",t,e),g=aT("symbolOffset",t,e),v={data:"value"},b={},y=i+"?datum.offset:datum.size",w=m?QN(m):{field:"size"},x="datum.index",_="max(1,"+i+")";return w.mult=.5,b={enter:o={opacity:mT,x:{signal:y,mult:.5,offset:g},y:w},update:a={opacity:{value:1},x:o.x,y:o.y},exit:{opacity:mT}},t.fill||(tT(b,"fill",e.symbolBaseFillColor),tT(b,"stroke",e.symbolBaseStrokeColor)),tT(b,"shape",aT("symbolType",t,e)),tT(b,"size",aT("symbolSize",t,e)),tT(b,"strokeWidth",aT("symbolStrokeWidth",t,e)),tT(b,"fill",aT("symbolFillColor",t,e)),tT(b,"stroke",aT("symbolStrokeColor",t,e)),tT(b,"opacity",aT("symbolOpacity",t,e),"update"),zN.forEach(function(e){t[e]&&(a[e]=o[e]={scale:t[e],field:jN})}),u=oT("symbol","legend-symbol",null,jN,v,b,n.symbols),m&&(u.clip=!0),(s=QN(g)).offset=aT("labelOffset",t,e),tT(b={enter:o={opacity:mT,x:{signal:y,offset:s},y:w},update:a={opacity:{value:1},text:{field:"label"},x:o.x,y:o.y},exit:{opacity:mT}},"align",aT("labelAlign",t,e)),tT(b,"baseline",aT("labelBaseline",t,e)),tT(b,"fill",aT("labelColor",t,e)),tT(b,"font",aT("labelFont",t,e)),tT(b,"fontSize",aT("labelFontSize",t,e)),tT(b,"fontWeight",aT("labelFontWeight",t,e)),tT(b,"limit",aT("labelLimit",t,e)),tT(b,"fillOpacity",aT("labelOpacity",t,e)),c=oT(dT,"legend-label",RN,jN,v,b,n.labels),b={enter:{noBound:{value:!0},width:mT,height:m?QN(m):mT,opacity:mT},exit:{opacity:mT},update:a={opacity:{value:1},row:{signal:null},column:{signal:null}}},sT(t,e.symbolDirection)?(l="ceil(item.mark.items.length/"+_+")",a.row.signal=x+"%"+l,a.column.signal="floor("+x+"/"+l+")",f={field:["row",x]}):(a.row.signal="floor("+x+"/"+_+")",a.column.signal=x+"%"+_,f={field:x}),a.column.signal=i+"?"+a.column.signal+":"+x,(t=pT("scope",null,p,r={facet:{data:r,name:"value",groupby:"index"}},h,eT(b,d,LN),[u,c])).sort=f,t}(t,f,d,c,bM(r.columns))],i.size=function(t,e,n){var r,i,o,a;return o=lT("strokeWidth",n[0].encode),i=t.size?'scale("'+t.size+'",datum)':lT("size",n[0].encode),r=function(t,e,n){return lT("fontSize",t)||function(t,e,n){var r=e.config.style["guide-label"];return r&&r.fontSize}(0,e)}(n[1].encode,e),a="max(ceil(sqrt("+bM(i)+")+"+bM(o)+"),"+bM(r)+")",nM(a,e)}(t,e,o[0].marks)),o=[pT("legend-entry",null,null,u,m,n,o,r)],s.title&&o.push(function(t,e,n,r){var i,o,a={value:0};return tT(i={enter:o={opacity:a,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},update:{opacity:{value:1},text:QN(t.title),x:o.x,y:o.y},exit:{opacity:a}},"align",aT("titleAlign",t,e)),tT(i,"baseline",aT("titleBaseline",t,e)),tT(i,"fill",aT("titleColor",t,e)),tT(i,"font",aT("titleFont",t,e)),tT(i,"fontSize",aT("titleFontSize",t,e)),tT(i,"fontWeight",aT("titleFontWeight",t,e)),tT(i,"limit",aT("titleLimit",t,e)),tT(i,"fillOpacity",aT("titleOpacity",t,e)),oT(dT,"legend-title","guide-title",null,r,i,n)}(t,f,d.title,u)),l=pT("legend",g,p,u,m,h,o),t.zindex&&(l.zindex=t.zindex),DT(l,e)};function RT(t,e,n){return'item.anchor==="'+IN+'"?'+t+':item.anchor==="'+DN+'"?'+e+":"+n}var FT=RT(Object(H.X)(MN),Object(H.X)("right"),Object(H.X)("center")),PT=RT('+(item.orient==="right")','+(item.orient!=="left")',"0.5");function zT(t){var e=qM({},t);return e.metadata={source:!0},e}function LT(t,e){return{scale:t.scale,range:e}}function BT(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}var UT=function(t,e,n){var r=Object(H.i)(t.signals),i=Object(H.i)(t.scales);return n||r.forEach(function(t){OO(t,e)}),Object(H.i)(t.projections).forEach(function(t){!function(t,e){var n={};for(var r in t)"name"!==r&&(n[r]=AN(t[r],r,e));e.addProjection(t.name,n)}(t,e)}),i.forEach(function(t){!function(t,e){var n=t.type||"linear";gN.hasOwnProperty(n)||Object(H.n)("Unrecognized scale type: "+Object(H.X)(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e)}),Object(H.i)(t.data).forEach(function(t){!function(t,e){var n=[];t.transform&&t.transform.forEach(function(t){n.push(bT(t,e))}),t.on&&t.on.forEach(function(n){IT(n,e,t.name)}),e.addDataPipeline(t.name,function(t,e,n){var r,i,o,a,s,u=[],c=null,l=!1,f=!1;for(t.values?u.push(c=zT({$ingest:t.values,$format:t.format})):t.url?(c=gM(t.url)||gM(t.format)?{$load:aM(e.add(function(t,e){return ZM({url:t.property(e.url),format:t.objectProperty(e.format)})}(e,t)))}:{$request:t.url,$format:t.format},u.push(c=zT(c))):t.source&&(c=r=Object(H.i)(t.source).map(function(t){return aM(e.getData(t).output)}),u.push(null)),i=0,o=n.length;i<o;++i)s=(a=n[i]).metadata,c||s.source||u.push(c=zT()),u.push(a),s.generates&&(f=!0),s.modifies&&!f&&(l=!0),s.source?c=a:s.changes&&(c=null);return r&&(o=r.length-1,u[0]=sN({derive:l,pulse:o?r:r[0]}),(l||o)&&u.splice(1,0,zT())),c||u.push(zT()),u.push(lN({})),u}(t,e,n))}(t,e)}),i.forEach(function(t){!function(t,e){var n,r=e.getScale(t.name).params;for(n in r.domain=EN(t.domain,t,e),null!=t.range&&(r.range=function t(e,n,r){var i=e.range,o=n.config.range;if(i.signal)return n.signalRef(i.signal);if(Object(H.H)(i)){if(o&&o.hasOwnProperty(i))return t(e=Object(H.o)({},e,{range:o[i]}),n,r);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=wN(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Object(H.n)("Unrecognized scale range value: "+Object(H.X)(i))}else{if(i.scheme)return r.scheme=kN(i.scheme,n),i.extent&&(r.schemeExtent=function(t,e){return t.signal?e.signalRef(t.signal):t.map(function(t){return kN(t,e)})}(i.extent,n)),void(i.count&&(r.schemeCount=kN(i.count,n)));if(i.step)return void(r.rangeStep=kN(i.step,n));if(wN(e.type)&&!Object(H.A)(i))return EN(i,e,n);Object(H.A)(i)||Object(H.n)("Unsupported range type: "+Object(H.X)(i))}return i.map(function(t){return kN(t,n)})}(t,e,r)),null!=t.interpolate&&function(t,e){e.interpolate=kN(t.type||t),null!=t.gamma&&(e.interpolateGamma=kN(t.gamma))}(t.interpolate,r),null!=t.nice&&function(t,e){r.nice=Object(H.F)(t)?{interval:kN(t.interval),step:kN(t.step)}:kN(t)}(t.nice),t)r.hasOwnProperty(n)||"name"===n||(r[n]=kN(t[n],e))}(t,e)}),r.forEach(function(t){!function(t,e){var n=e.getSignal(t.name),r=t.update;t.init&&(r?Object(H.n)("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=nM(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach(function(t){!function(t,e,n){var r,i,o=t.events,a=t.update,s=t.encode,u=[];o||Object(H.n)("Signal update missing events specification."),Object(H.H)(o)&&(o=SM(o,e.isSubscope()?hM:pM)),(o=Object(H.i)(o).filter(function(t){return t.signal||t.scale?(u.push(t),0):1})).length&&u.push(o.length>1?{merge:o}:o[0]),null!=s&&(a&&Object(H.n)("Signal encode and update are mutually exclusive."),a="encode(item(),"+Object(H.X)(s)+")"),r=Object(H.H)(a)?nM(a,e,"var datum=event.item&&event.item.datum;"):null!=a.expr?nM(a.expr,e,"var datum=event.item&&event.item.datum;"):null!=a.value?a.value:null!=a.signal?{$expr:"_.value",$params:{value:e.signalRef(a.signal)}}:Object(H.n)("Invalid signal update specification."),i={target:n,update:r},t.force&&(i.options={force:!0}),u.forEach(function(t){e.addUpdate(Object(H.o)(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):wM(t,e)}}(t,e),i))})}(t,e,n.id)})}(t,e)}),Object(H.i)(t.axes).forEach(function(t){!function(t,e){var n,r,i,o,a,s,u=function(t,e){var n=e.config,r=t.orient,i=r===CN||r===NN?n.axisX:n.axisY,o=n["axis"+r[0].toUpperCase()+r.slice(1)],a="band"===e.scaleType(t.scale)&&n.axisBand;return i||o||a?Object(H.o)({},n.axis,i,o,a):n.axis}(t,e),c=t.encode||{},l=c.axis||{},f=l.name||void 0,d=l.interactive,h=l.style;n={orient:t.orient,ticks:!!aT("ticks",t,u),labels:!!aT("labels",t,u),grid:!!aT("grid",t,u),domain:!!aT("domain",t,u),title:!!vM(t.title,!1)},r=aM(e.add(qM({},[n]))),l=eT({update:{range:{signal:'abs(span(range("'+t.scale+'")))'},offset:QN(vM(t.offset,0)),position:QN(vM(t.position,0)),titlePadding:QN(aT("titlePadding",t,u)),minExtent:QN(aT("minExtent",t,u)),maxExtent:QN(aT("maxExtent",t,u))}},c.axis,LN),i=aM(e.add(UM({scale:e.scaleRef(t.scale),extra:e.property(aT("tickExtra",t,u)),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),formatSpecifier:e.property(t.format)}))),s=[],n.grid&&s.push(function(t,e,n,r){var i,o,a,s,u,c,l,f,d,h=t.orient,p=t.gridScale,m=h===MN||h===CN?1:-1,g=m*t.offset||0,v={value:0};return tT(i={enter:o={opacity:v},update:s={opacity:{value:1}},exit:a={opacity:v}},"stroke",aT("gridColor",t,e)),tT(i,"strokeDash",aT("gridDash",t,e)),tT(i,"strokeOpacity",aT("gridOpacity",t,e)),tT(i,"strokeWidth",aT("gridWidth",t,e)),u={scale:t.scale,field:jN,band:aT("bandPosition",t,e),round:aT("tickRound",t,e),extra:aT("tickExtra",t,e),offset:aT("tickOffset",t,e)},h===CN||h===NN?(c="x",l="y",d="height"):(c="y",l="x",d="width"),f=l+"2",s[c]=o[c]=a[c]=u,p?(o[l]={scale:p,range:0,mult:m,offset:g},s[f]=o[f]={scale:p,range:1,mult:m,offset:g}):(o[l]={value:g},s[f]=o[f]={signal:d,mult:m,offset:g}),oT("rule","axis-grid",null,jN,r,i,n)}(t,u,c.grid,i)),n.ticks&&(o=aT("tickSize",t,u),s.push(function(t,e,n,r,i){var o,a,s,u,c,l,f=t.orient,d=f===MN||f===CN?-1:1,h={value:0};return tT(o={enter:a={opacity:h},update:u={opacity:{value:1}},exit:s={opacity:h}},"stroke",aT("tickColor",t,e)),tT(o,"strokeOpacity",aT("tickOpacity",t,e)),tT(o,"strokeWidth",aT("tickWidth",t,e)),(c=QN(i)).mult=d,l={scale:t.scale,field:jN,band:aT("bandPosition",t,e),round:aT("tickRound",t,e),extra:aT("tickExtra",t,e),offset:aT("tickOffset",t,e)},f===CN||f===NN?(u.y=a.y=h,u.y2=a.y2=c,u.x=a.x=s.x=l):(u.x=a.x=h,u.x2=a.x2=c,u.y=a.y=s.y=l),oT("rule","axis-tick",null,jN,r,o,n)}(t,u,c.ticks,i,o))),n.labels&&(o=n.ticks?o:0,s.push(function(t,e,n,r,i){var o,a,s,u,c,l,f,d,h,p=t.orient,m=p===MN||p===CN?-1:1,g=p===CN||p===NN,v=t.scale,b=bM(aT("labelFlush",t,e)),y=bM(aT("labelFlushOffset",t,e)),w=0===b||!!b,x=aT("labelAlign",t,e),_=aT("labelBaseline",t,e),k={value:0};return(s=QN(i)).mult=m,s.offset=QN(aT("labelPadding",t,e)||0),s.offset.mult=m,u={scale:v,field:jN,band:.5,offset:aT("tickOffset",t,e)},g?(c=x||(w?BT(v,b,'"left"','"right"','"center"'):"center"),l=_||(p===CN?"bottom":"top"),f=!x):(c=x||("right"===p?"left":"right"),l=_||(w?BT(v,b,'"top"','"bottom"','"middle"'):"middle"),f=!_),f=f&&w&&y?BT(v,b,"-"+y,y,0):null,tT(o={enter:a={opacity:k,x:g?u:s,y:g?s:u},update:{opacity:{value:1},text:{field:"label"},x:a.x,y:a.y},exit:{opacity:k,x:a.x,y:a.y}},g?"dx":"dy",f),tT(o,"align",c),tT(o,"baseline",l),tT(o,"angle",aT("labelAngle",t,e)),tT(o,"fill",aT("labelColor",t,e)),tT(o,"font",aT("labelFont",t,e)),tT(o,"fontSize",aT("labelFontSize",t,e)),tT(o,"fontWeight",aT("labelFontWeight",t,e)),tT(o,"limit",aT("labelLimit",t,e)),tT(o,"fillOpacity",aT("labelOpacity",t,e)),d=aT("labelBound",t,e),h=aT("labelOverlap",t,e),t=oT(dT,"axis-label",RN,jN,r,o,n),(h||d)&&(t.overlap={method:h,order:"datum.index",bound:d?{scale:v,orient:p,tolerance:d}:null}),t}(t,u,c.labels,i,o))),n.domain&&s.push(function(t,e,n,r){var i,o,a,s,u,c,l=t.orient,f={value:0};return tT(i={enter:o={opacity:f},update:a={opacity:{value:1}},exit:{opacity:f}},"stroke",aT("domainColor",t,e)),tT(i,"strokeWidth",aT("domainWidth",t,e)),tT(i,"strokeOpacity",aT("domainOpacity",t,e)),l===CN||l===NN?(s="x",c="y"):(s="y",c="x"),u=s+"2",o[c]=f,a[s]=o[s]=LT(t,0),a[u]=o[u]=LT(t,1),oT("rule","axis-domain",null,null,r,i,n)}(t,u,c.domain,r)),n.title&&s.push(function(t,e,n,r){var i,o,a,s,u=t.orient,c=u===MN||u===CN?-1:1,l=u===CN||u===NN,f={value:0};return i={enter:o={opacity:f},update:a={opacity:{value:1},text:QN(t.title)},exit:{opacity:f}},s={scale:t.scale,range:.5},l?(a.x=s,o.angle={value:0},o.baseline={value:u===CN?"bottom":"top"}):(a.y=s,o.angle={value:90*c},o.baseline={value:"bottom"}),tT(i,"align",aT("titleAlign",t,e)),tT(i,"angle",aT("titleAngle",t,e)),tT(i,"baseline",aT("titleBaseline",t,e)),tT(i,"fill",aT("titleColor",t,e)),tT(i,"font",aT("titleFont",t,e)),tT(i,"fontSize",aT("titleFontSize",t,e)),tT(i,"fontWeight",aT("titleFontWeight",t,e)),tT(i,"limit",aT("titleLimit",t,e)),tT(i,"fillOpacity",aT("titleOpacity",t,e)),!tT(i,"x",aT("titleX",t,e),"update")&&l&&!iT("x",n)&&(i.enter.auto={value:!0}),!tT(i,"y",aT("titleY",t,e),"update")&&!l&&!iT("y",n)&&(i.enter.auto={value:!0}),oT(dT,"axis-title","guide-title",null,r,i,n)}(t,u,c.title,r)),a=pT("axis",h,f,r,d,l,s),t.zindex&&(a.zindex=t.zindex),DT(a,e)}(t,e)}),Object(H.i)(t.marks).forEach(function(t){DT(t,e)}),Object(H.i)(t.legends).forEach(function(t){jT(t,e)}),t.title&&function(t,e){t=Object(H.H)(t)?{text:t}:t;var n,r,i,o=e.config.title,a=Object(H.o)({},t.encode);n={orient:aT("orient",t,o)},r=aM(e.add(qM(null,[n]))),a.name=t.name,a.interactive=t.interactive,i=function(t,e,n,r){var i,o,a,s,u,c={value:0},l=t.text,f=aT("orient",t,e),d=aT("anchor",t,e),h=f===MN||f===CN?-1:1,p=f===CN||f===NN,m={group:p?"width":"height"};return s={field:m,mult:{signal:PT}},u=h<0?c:p?{field:{group:"height"}}:{field:{group:"width"}},i={enter:o={opacity:c},update:a={opacity:{value:1},text:QN(l),anchor:QN(d),orient:QN(f),extent:{field:m},align:{signal:FT}},exit:{opacity:c}},p?(a.x=s,a.y=u,o.angle=c,o.baseline={value:f===CN?NN:CN}):(a.x=u,a.y=s,o.angle={value:90*h},o.baseline={value:NN}),tT(i,"align",aT("align",t,e),"update"),tT(i,"angle",aT("angle",t,e)),tT(i,"baseline",aT("baseline",t,e)),tT(i,"fill",aT("color",t,e)),tT(i,"font",aT("font",t,e)),tT(i,"fontSize",aT("fontSize",t,e)),tT(i,"fontWeight",aT("fontWeight",t,e)),tT(i,"frame",aT("frame",t,e)),tT(i,"limit",aT("limit",t,e)),tT(i,"offset",aT("offset",t,e)||0),oT(dT,"title",t.style||"group-title",null,r,i,n)}(t,o,a,r),t.zindex&&(i.zindex=t.zindex),DT(i,e)}(t.title,e),e.parseLambdas(),e},WT=Object(H.Ba)(["width","height","padding","autosize"]);function qT(t){this.config=t,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function VT(t){this.config=t.config,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}var HT=qT.prototype=VT.prototype;HT.fork=function(){return new VT(this)},HT.isSubscope=function(){return this._subid>0},HT.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},HT.id=function(){return(this._subid?this._subid+":":0)+this._id++},HT.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(function(e){e.$ref=t.id}),t.refs=null),t},HT.proxy=function(t){var e=t instanceof rM?aM(t):t;return this.add(aN({value:e}))},HT.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},HT.addUpdate=function(t){return this.updates.push(t),t},HT.finish=function(){var t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){var r;t&&((r=t.data||(t.data={}))[e]||(r[e]=[])).push(n)}for(t in this.data)for(var r in n((e=this.data[t]).input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values"),e.index)n(e.index[r],t,"index:"+r);return this},HT.pushState=function(t,e,n){this._encode.push(aM(this.add(lN({pulse:t})))),this._parent.push(e),this._lookup.push(n?aM(this.proxy(n)):null),this._markpath.push(-1)},HT.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},HT.parent=function(){return Object(H.S)(this._parent)},HT.encode=function(){return Object(H.S)(this._encode)},HT.lookup=function(){return Object(H.S)(this._lookup)},HT.markpath=function(){var t=this._markpath;return++t[t.length-1]},HT.fieldRef=function(t,e){if(Object(H.H)(t))return uM(t,e);t.signal||Object(H.n)("Unsupported field reference: "+Object(H.X)(t));var n,r=t.signal,i=this.field[r];return i||(n={name:this.signalRef(r)},e&&(n.as=e),this.field[r]=i=aM(this.add(XM(n)))),i},HT.compareRef=function(t,e){function n(t){return mM(t)?(i=!0,r.signalRef(t.signal)):t}var r=this,i=!1,o=Object(H.i)(t.field).map(n),a=Object(H.i)(t.order).map(n);return e&&o.push(sM),i?aM(this.add(VM({fields:o,orders:a}))):lM(o,a)},HT.keyRef=function(t,e){var n=this.signals,r=!1;return t=Object(H.i)(t).map(function(t){return mM(t)?(r=!0,aM(n[t.signal])):t}),r?aM(this.add(YM({fields:t,flat:e}))):function(t,e){var n={$key:t};return e&&(n.$flat=!0),n}(t,e)},HT.sortRef=function(t){if(!t)return t;var e=[dM(t.op,t.field),sM],n=t.order||"ascending";return n.signal?aM(this.add(VM({fields:e,orders:[n=this.signalRef(n.signal),n]}))):lM(e,[n,n])},HT.event=function(t,e){var n=t+":"+e;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},HT.addSignal=function(t,e){this.signals.hasOwnProperty(t)&&Object(H.n)("Duplicate signal name: "+Object(H.X)(t));var n=e instanceof rM?e:this.add(oM(e));return this.signals[t]=n},HT.getSignal=function(t){return this.signals[t]||Object(H.n)("Unrecognized signal name: "+Object(H.X)(t)),this.signals[t]},HT.signalRef=function(t){return this.signals[t]?aM(this.signals[t]):(this.lambdas.hasOwnProperty(t)||(this.lambdas[t]=this.add(oM(null))),aM(this.lambdas[t]))},HT.parseLambdas=function(){for(var t=Object.keys(this.lambdas),e=0,n=t.length;e<n;++e){var r=t[e],i=nM(r,this),o=this.lambdas[r];o.params=i.$params,o.update=i.$expr}},HT.property=function(t){return t&&t.signal?this.signalRef(t.signal):t},HT.objectProperty=function(t){return t&&Object(H.F)(t)?this.signalRef(t.signal||function t(e){return(Object(H.A)(e)?function(e){for(var n,r="[",i=0,o=e.length;i<o;++i)n=e[i],r+=(i>0?",":"")+(Object(H.F)(n)?n.signal||t(n):Object(H.X)(n));return r+"]"}:function(e){var n,r,i="{",o=0;for(n in e)r=e[n],i+=(++o>1?",":"")+Object(H.X)(n)+":"+(Object(H.F)(r)?r.signal||t(r):Object(H.X)(r));return i+"}"})(e)}(t)):t},HT.exprRef=function(t,e){var n={expr:nM(t,this)};return e&&(n.expr.$name=e),aM(this.add(GM(n)))},HT.addBinding=function(t,e){this.bindings||Object(H.n)("Nested signals do not support binding: "+Object(H.X)(t)),this.bindings.push(Object(H.o)({signal:t},e))},HT.addScaleProj=function(t,e){this.scales.hasOwnProperty(t)&&Object(H.n)("Duplicate scale or projection name: "+Object(H.X)(t)),this.scales[t]=this.add(e)},HT.addScale=function(t,e){this.addScaleProj(t,cN(e))},HT.addProjection=function(t,e){this.addScaleProj(t,oN(e))},HT.getScale=function(t){return this.scales[t]||Object(H.n)("Unrecognized scale name: "+Object(H.X)(t)),this.scales[t]},HT.projectionRef=HT.scaleRef=function(t){return aM(this.getScale(t))},HT.projectionType=HT.scaleType=function(t){return this.getScale(t).params.type},HT.addData=function(t,e){return this.data.hasOwnProperty(t)&&Object(H.n)("Duplicate data set name: "+Object(H.X)(t)),this.data[t]=e},HT.getData=function(t){return this.data[t]||Object(H.n)("Undefined data set name: "+Object(H.X)(t)),this.data[t]},HT.addDataPipeline=function(t,e){return this.data.hasOwnProperty(t)&&Object(H.n)("Duplicate data set name: "+Object(H.X)(t)),this.addData(t,AT.fromEntries(this,e))};var $T="sans-serif",GT=30,KT=2,XT="#4c78a8",YT="#000",JT="#888",ZT="#ddd",QT=function(t,e){return Object(H.F)(t)||Object(H.n)("Input Vega specification must be an object."),function(t,e){var n,r,i,o,a,s=e.config;return e.background=t.background||s.background,e.eventConfig=s.events,a=aM(e.root=e.add(oM())),e.addSignal("width",t.width||0),e.addSignal("height",t.height||0),e.addSignal("padding",function(t,e){return t=t||e.padding,Object(H.F)(t)?{top:bO(t.top),bottom:bO(t.bottom),left:bO(t.left),right:bO(t.right)}:function(t){return{top:t,bottom:t,left:t,right:t}}(bO(t))}(t.padding,s)),e.addSignal("autosize",function(t,e){return t=t||e.autosize,Object(H.F)(t)?t:{type:t=t||"pad"}}(t.autosize,s)),Object(H.i)(t.signals).forEach(function(t){WT[t.name]||OO(t,e)}),r=e.add(qM()),i=eT({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t.encode),i=e.add($M(nT(i,fT,ZN,t.style,e,{pulse:aM(r)}))),o=e.add(dN({layout:e.objectProperty(t.layout),legendMargin:s.legendMargin,autosize:e.signalRef("autosize"),mark:a,pulse:aM(i)})),e.operators.pop(),e.pushState(aM(i),aM(o),null),UT(t,e,!0),e.operators.push(o),n=e.add(WM({mark:a,pulse:aM(o)})),n=e.add(uN({pulse:aM(n)})),n=e.add(lN({pulse:aM(n)})),e.addData("root",new AT(e,r,r,n)),e}(t,new qT(function(t){var e={padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:XT},area:{fill:XT},image:null,line:{stroke:XT,strokeWidth:KT},path:{stroke:XT},rect:{fill:XT},rule:{stroke:YT},shape:{stroke:XT},symbol:{fill:XT,size:64},text:{fill:YT,font:$T,fontSize:11},style:{"guide-label":{fill:YT,font:$T,fontSize:10},"guide-title":{fill:YT,font:$T,fontSize:11,fontWeight:"bold"},"group-title":{fill:YT,font:$T,fontSize:13,fontWeight:"bold"},point:{size:GT,strokeWidth:KT,shape:"circle"},circle:{size:GT,strokeWidth:KT},square:{size:GT,strokeWidth:KT,shape:"square"},cell:{fill:"transparent",stroke:ZT}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:JT,grid:!1,gridWidth:1,gridColor:ZT,labels:!0,labelAngle:0,labelLimit:180,labelPadding:2,ticks:!0,tickColor:JT,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titleAlign:"center",titlePadding:4},axisBand:{tickOffset:-1},legend:{orient:"right",offset:18,padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:ZT,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:JT,titleAlign:"left",titleBaseline:"top",titleLimit:180,titlePadding:5},title:{orient:"top",anchor:"middle",offset:4},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues",extent:[.2,1]},heatmap:{scheme:"viridis"},ramp:{scheme:"blues",extent:[.2,1]},diverging:{scheme:"blueorange"},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}};return(t||[]).forEach(function(t){var n,r,i;if(t)for(n in t)if("style"===n)for(n in i=e.style||(e.style={}),t.style)i[n]=Object(H.o)(i[n]||{},t.style[n]);else r=t[n],e[n]=Object(H.F)(r)&&!Object(H.A)(r)?Object(H.o)(Object(H.F)(e[n])?e[n]:{},r):r}),e}([e,t.config]))).toRuntime()};function tI(t,e,n){";"!==e[e.length-1]&&(e="return("+e+");");var r=Function.apply(null,t.concat(e));return n&&n.functions?r.bind(n.functions):r}function eI(t,e){return tI(["event"],t,e)}function nI(t,e){return tI(["item","_"],t,e)}function rI(t,e,n){var r,i;for(r in n=n||{},t)i=t[r],n[r]=Object(H.A)(i)?i.map(function(t){return iI(t,e,n)}):iI(i,e,n);return n}function iI(t,e,n){if(!t||!Object(H.F)(t))return t;for(var r,i=0,o=oI.length;i<o;++i)if(r=oI[i],t.hasOwnProperty(r.key))return r.parse(t,e,n);return t}var oI=[{key:"$ref",parse:function(t,e){return e.get(t.$ref)||Object(H.n)("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,e){var n="k:"+t.$key+"_"+!!t.$flat;return e.fn[n]||(e.fn[n]=Object(H.I)(t.$key,t.$flat))}},{key:"$expr",parse:function(t,e,n){t.$params&&rI(t.$params,e,n);var r="e:"+t.$expr+"_"+t.$name;return e.fn[r]||(e.fn[r]=Object(H.f)(function(t,e){return tI(["datum","_"],t,e)}(t.$expr,e),t.$fields,t.$name))}},{key:"$field",parse:function(t,e){if(!t.$field)return null;var n="f:"+t.$field+"_"+t.$name;return e.fn[n]||(e.fn[n]=Object(H.t)(t.$field,t.$name))}},{key:"$encode",parse:function(t,e){var n,r,i=t.$encode,o={};for(n in i)r=i[n],o[n]=Object(H.f)(nI(r.$expr,e),r.$fields),o[n].output=r.$output;return o}},{key:"$compare",parse:function(t,e){var n="c:"+t.$compare+"_"+t.$order,r=Object(H.i)(t.$compare).map(function(t){return t&&t.$tupleid?Y:t});return e.fn[n]||(e.fn[n]=Object(H.k)(r,t.$order))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){var n=t.$subflow;return function(t,r,i){var o=sI(n,e.fork()),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(i),a}}},{key:"$tupleid",parse:function(){return Y}}];function aI(t){return(t+"").toLowerCase()}var sI=function(t,e){var n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),n.forEach(function(t){!function(t,e){!function(t){return"operator"===aI(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?function(t,e){return tI(["_"],t,e)}(t.update,e):null)}(t,e)}),n.forEach(function(t){!function(t,e){if(t.params){var n=e.get(t.id);n||Object(H.n)("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(rI(t.params,e),t.react,t.initonly))}}(t,e)}),(t.streams||[]).forEach(function(t){!function(t,e){var n,r=null!=t.filter?eI(t.filter,e):void 0,i=null!=t.stream?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map(e.get.bind(e)))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map(e.get.bind(e)),i=i.between(n[0],n[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&Object(H.n)("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)}(t,e)}),(t.updates||[]).forEach(function(t){!function(t,e){var n,r=Object(H.F)(r=t.source)?r.$ref:r,i=e.get(r),o=t.update,a=void 0;i||Object(H.n)("Source not defined: "+t.source),n=t.target&&t.target.$expr?eI(t.target.$expr,e):e.get(t.target),o&&o.$expr&&(o.$params&&(a=rI(o.$params,e)),o=function(t,e){return tI(["_","event"],t,e)}(o.$expr,e)),e.update(t,i,n,o,a)}(t,e)}),e.resolve()},uI={skip:!0},cI=function(t,e,n){return new lI(t,e,n)};function lI(t,e,n){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function fI(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.functions=t.functions,this.events=t.events,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}lI.prototype=fI.prototype={fork:function(){var t=new fI(this);return(this.subcontext||(this.subcontext=[])).push(t),t},get:function(t){return this.nodes[t]},set:function(t,e){return this.nodes[t]=e},add:function(t,e){var n,r=this,i=r.dataflow;if(r.set(t.id,e),function(t){return"collect"===aI(t)}(t.type)&&(n=t.value)&&(n.$ingest?i.ingest(e,n.$ingest,n.$format):n.$load?r.get(n.$load.$ref).target=e:n.$request?i.request(e,n.$request,n.$format):i.pulse(e,i.changeset().insert(n))),t.root&&(r.root=e),t.parent){var o=r.get(t.parent.$ref);o?(i.connect(o,[e]),e.targets().add(o)):(r.unresolved=r.unresolved||[]).push(function(){o=r.get(t.parent.$ref),i.connect(o,[e]),e.targets().add(o)})}if(t.signal&&(r.signals[t.signal]=e),t.scale&&(r.scales[t.scale]=e),t.data)for(var a in t.data)n=r.data[a]||(r.data[a]={}),t.data[a].forEach(function(t){n[t]=e})},resolve:function(){return(this.unresolved||[]).forEach(function(t){t()}),delete this.unresolved,this},operator:function(t,e){this.add(t,this.dataflow.add(t.value,e))},transform:function(t,e){this.add(t,this.dataflow.add(this.transforms[aI(e)]))},stream:function(t,e){this.set(t.id,e)},update:function(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach(function(n){var i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)})}if(t.data){var i=n.data={};Object.keys(e.data).forEach(function(n){var r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)})}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map(function(e){return e.getState(t)})),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach(function(t){n.update(e.signals[t],i[t],uI)}),Object.keys(r||{}).forEach(function(t){n.pulse(e.data[t].input,n.changeset().remove(H.Ea).insert(r[t]))}),(t.subcontext||[]).forEach(function(t,n){var r=e.subcontext[n];r&&r.setState(t)})}};var dI=function(t,e,n){return sI(e,cI(t,Dr,n||XC))},hI="width",pI="height",mI="padding",gI={skip:!0};function vI(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===mI?r.left+r.right:0)}function bI(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===mI?r.top+r.bottom:0)}function yI(t,e){return e.modified&&Object(H.A)(e.input.value)&&t.indexOf("_:vega:_")}function wI(t,e){return!("parent"===t||e instanceof Dr.proxy)}var xI=function(t,e,n,r){var i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":Object(H.A)(t)?_I(t):Object(H.F)(t)&&!Object(H.C)(t)?function(t){return Object.keys(t).map(function(e){var n=t[e];return e+": "+(Object(H.A)(n)?_I(n):kI(n))}).join("\n")}(t):t+""}(r))};function _I(t){return"["+t.map(kI).join(", ")+"]"}function kI(t){return Object(H.A)(t)?"[…]":Object(H.F)(t)&&!Object(H.C)(t)?"{…}":t}function SI(t,e){e=e||{},Cr.call(this),this.loader(e.loader||this._loader),this.logLevel(e.logLevel||0),this._el=null,this._renderType=e.renderer||Il.Canvas,this._scenegraph=new jc;var n=this._scenegraph.root;this._renderer=null,this._tooltip=e.tooltip||xI,this._redraw=!0,this._handler=(new Xc).scene(n),this._preventDefault=!1,this._timers=[],this._eventListeners=[],this._resizeListeners=[];var r=dI(this,t,e.functions);this._runtime=r,this._signals=r.signals,this._bind=(t.bindings||[]).map(function(t){return{state:null,param:Object(H.o)({},t)}}),r.root&&r.root.set(n),n.source=r.data.root.input,this.pulse(r.data.root.input,this.changeset().insert(n.items)),this._background=r.background||null,this._eventConfig=function(t){var e=(t=Object(H.o)({},t)).defaults;return e&&(Object(H.A)(e.prevent)&&(e.prevent=Object(H.Ba)(e.prevent)),Object(H.A)(e.allow)&&(e.allow=Object(H.Ba)(e.allow))),t}(r.eventConfig),this._width=this.width(),this._height=this.height(),this._viewWidth=vI(this,this._width),this._viewHeight=bI(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(t){var e=t._signals,n=e[hI],r=e[pI],i=e[mI];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,function(e){t._width=e.size,t._viewWidth=vI(t,e.size),o()},{size:n}),t._resizeHeight=t.add(null,function(e){t._height=e.size,t._viewHeight=bI(t,e.size),o()},{size:r});var a=t.add(null,o,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(this),$E(this)}var EI=Object(H.y)(SI,Cr);function OI(t,e){return t._signals.hasOwnProperty(e)?t._signals[e]:Object(H.n)("Unrecognized signal name: "+Object(H.X)(e))}function AI(t,e){var n=(t._targets||[]).filter(function(t){var n=t._update;return n&&n.handler===e});return n.length?n[0]:null}function CI(t,e,n,r){var i=AI(n,r);return i||((i=mO(this,function(){r(e,n.value)})).handler=r,t.on(n,null,i)),t}function MI(t,e,n){var r=AI(e,n);return r&&e._targets.remove(r),t}EI.run=function(t){if(Cr.prototype.run.call(this,t),this._pending)this.resize();else if(this._redraw||this._resize)try{this.render()}catch(t){this.error(t)}return this},EI.render=function(){return this._renderer&&(this._resize&&(this._resize=0,function(t){var e=JE(t),n=XE(t),r=YE(t);t._renderer.background(t._background),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach(function(e){try{e(n,r)}catch(e){t.error(e)}})}(this)),this._renderer.render(this._scenegraph.root)),this._redraw=!1,this},EI.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},EI.container=function(){return this._el},EI.scenegraph=function(){return this._scenegraph},EI.origin=function(){return this._origin.slice()},EI.signal=function(t,e,n){var r=OI(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},EI.background=function(t){return arguments.length?(this._background=t,this._resize=1,this):this._background},EI.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},EI.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},EI.padding=function(t){return arguments.length?this.signal("padding",t):this.signal("padding")},EI.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},EI.renderer=function(t){return arguments.length?(jl(t)||Object(H.n)("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},EI.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},EI.loader=function(t){return arguments.length?(t!==this._loader&&(Cr.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},EI.resize=function(){return this._autosize=1,this.touch(OI(this,"autosize"))},EI._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el))},EI._resizeView=function(t,e,n,r,i,o){this.runAfter(function(a){var s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(hI,n,gI),a._resizeWidth.skip(!0)),a.height()!==r&&(s=1,a.signal(pI,r,gI),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==e&&(a._resize=1,a._viewHeight=e),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),s&&a.run("enter"),o&&a.runAfter(function(){a.resize()})},!1,1)},EI.addEventListener=function(t,e,n){var r=e;return n&&!1===n.trap||((r=mO(this,e)).raw=e),this._handler.on(t,r),this},EI.removeEventListener=function(t,e){for(var n,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},EI.addResizeListener=function(t){var e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},EI.removeResizeListener=function(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},EI.addSignalListener=function(t,e){return CI(this,t,OI(this,t),e)},EI.removeSignalListener=function(t,e){return MI(this,OI(this,t),e)},EI.addDataListener=function(t,e){return CI(this,t,GE(this,t).values,e)},EI.removeDataListener=function(t,e){return MI(this,GE(this,t).values,e)},EI.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},EI.timer=function(t,e){this._timers.push(function(t,e,n){var r=new rk,i=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?ek():+n,r.restart(function o(a){a+=i,r.restart(o,i+=e,n),t(a)},e,n),r)}(function(e){t({timestamp:Date.now(),elapsed:e})},e))},EI.events=function(t,e,n){var r,i=this,o=new ht(n),a=function(n,r){"view"===t&&function(t,e){var n=t._eventConfig.defaults,r=n&&n.prevent,i=n&&n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault();try{o.receive(function(t,e,n){var r,i,o,a=t._renderer.canvas();return a&&(o=JE(t),i=e.changedTouches?e.changedTouches[0]:e,(r=Wc(i,a))[0]-=o[0],r[1]-=o[1]),e.dataflow=t,e.vega=function(t,e,n){var r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return n;Object(H.H)(t)&&(t=i(t));for(var e=n.slice();t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:Object(H.l)(t),item:Object(H.l)(e||{}),group:i,xy:o,x:function(t){return o(t)[0]},y:function(t){return o(t)[1]}}}(t,n,r),e.item=n,e}(i,n,r))}catch(t){i.error(t)}finally{i.run()}};if("timer"===t)i.timer(a,e);else if("view"===t)i.addEventListener(e,a,ZE);else if("window"===t?"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&(r=document.querySelectorAll(t)),r){for(var s=0,u=r.length;s<u;++s)r[s].addEventListener(e,a);i._eventListeners.push({type:e,sources:r,handler:a})}else i.warn("Can not resolve event source: "+t);return o},EI.finalize=function(){var t,e,n,r=this._tooltip,i=this._timers,o=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=o.length;--t>=0;)for(e=(n=o[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},EI.hover=function(t,e){return t=[t||"hover"],e=[e||"update",t[0]],this.on(this.events("view","mouseover",QE),tO,eO(t)),this.on(this.events("view","mouseout",QE),tO,eO(e)),this},EI.data=function(t){return GE(this,t).values.value},EI.change=KE,EI.insert=function(t,e){return KE.call(this,t,rt().insert(e))},EI.remove=function(t,e){return KE.call(this,t,rt().remove(e))},EI.scale=function(t){var e=this._runtime.scales;return e.hasOwnProperty(t)||Object(H.n)("Unrecognized scale or projection: "+t),e[t].value},EI.initialize=function(t,e){var n,r,i=this,o=i._renderType,a=jl(o);return t=i._el=t?gO(i,t):null,a||i.error("Unrecognized renderer type: "+o),n=a.handler||Xc,r=t?a.renderer:a.headless,i._renderer=r?pO(i,i._renderer,t,r):null,i._handler=function(t,e,n,r){var i=new r(t.loader(),mO(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,JE(t),t);return e&&e.handlers().forEach(function(t){i.on(t.type,t.handler)}),i}(i,i._handler,t,n),i._redraw=!0,t&&(e=e?gO(i,e):t.appendChild(nO("div",{class:"vega-bindings"})),i._bind.forEach(function(t){t.param.element&&(t.element=gO(i,t.param.element))}),i._bind.forEach(function(t){!function(t,e,n){if(e){var r=n.param,i=n.state;i||(i=n.state={elements:null,active:!1,set:null,update:function(e){e!==t.signal(r.signal)&&(i.source=!0,t.signal(r.signal,e).run())}},r.debounce&&(i.update=Object(H.m)(r.debounce,i.update))),function(t,e,n,r){var i=nO("div",{class:"vega-bind"});i.appendChild(nO("span",{class:"vega-bind-name"},n.name||n.signal)),e.appendChild(i);var o=uO;switch(n.input){case"checkbox":o=cO;break;case"select":o=lO;break;case"radio":o=fO;break;case"range":o=dO}o(t,i,n,r)}(i,e,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,function(){i.source?i.source=!1:i.set(t.signal(r.signal))}),i.active=!0)}}(i,t.element||e,t)})),i},EI.toImageURL=function(t,e){return t!==Il.Canvas&&t!==Il.SVG&&t!==Il.PNG?Promise.reject("Unrecognized image type: "+t):vO(this,t,e).then(function(e){return t===Il.SVG?function(t,e){var n=new Blob([t],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(e.svg()):e.canvas().toDataURL("image/png")})},EI.toCanvas=function(t){return vO(this,Il.Canvas,t).then(function(t){return t.canvas()})},EI.toSVG=function(t){return vO(this,Il.SVG,t).then(function(t){return t.svg()})},EI.getState=function(t){return this._runtime.getState(t||{data:yI,signals:wI,recurse:!0})},EI.setState=function(t){var e=this;return e.runAfter(function(){e._trigger=!1,e._runtime.setState(t),e.run().runAfter(function(){e._trigger=!0})}),this},Object(H.o)(Dr,r,i,s,u,c,l,f,d,h);var NI=n(399),TI=n(398),II=n.n(TI),DI=n(397),jI=n.n(DI),RI=n(171),FI=n.n(RI);function PI(t){return!!t.or}function zI(t){return!!t.and}function LI(t){return!!t.not}const BI=jI.a,UI=II.a;function WI(t){return new RegExp(`\\b${t}\\b`,"g")}function qI(t,e){const n={};for(const r of e)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}function VI(t,e){const n=Object.assign({},t);for(const t of e)delete n[t];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(FI.a).join(",")})`};const HI=FI.a;function $I(t){if(Object(H.E)(t))return t;const e=Object(H.H)(t)?t:FI()(t);if(e.length<250)return e;let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n&=n;return n}function GI(t,e){return t.indexOf(e)>-1}function KI(t,e){return t.filter(t=>!GI(e,t))}function XI(t,e){return t.concat(KI(e,t))}function YI(t,e){let n=0;for(let r=0;r<t.length;r++)if(e(t[r],r,n++))return!0;return!1}function JI(t,e){let n=0;for(let r=0;r<t.length;r++)if(!e(t[r],r,n++))return!1;return!0}function ZI(t){return[].concat(...t)}function QI(t,e){const n=new Array(e);for(let r=0;r<e;++r)n[r]=t;return n}function tD(t,...e){for(const n of e)t=eD(t,n);return t}function eD(t,e){if("object"!=typeof e||null===e)return t;for(const n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&("object"!=typeof e[n]||Object(H.A)(e[n])||null===e[n]?t[n]=e[n]:"object"!=typeof t[n]||null===t[n]?t[n]=tD(Object(H.A)(e[n].constructor)?[]:{},e[n]):tD(t[n],e[n]));return t}function nD(t,e){const n=[],r={};let i;for(const o of t)(i=e(o))in r||(r[i]=1,n.push(o));return n}function rD(t,e){const n=lD(t),r=lD(e);if(n.length!==r.length)return!1;for(const r of n)if(t[r]!==e[r])return!1;return!0}function iD(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function oD(t,e){for(const n of t)if(e.has(n))return!0;return!1}function aD(t){const e=new Set;for(const n of t){const t=Object(H.W)(n).map((t,e)=>0===e?t:`[${t}]`);t.map((e,n)=>t.slice(0,n+1).join("")).forEach(t=>e.add(t))}return e}function sD(t,e){return oD(aD(t),aD(e))}function uD(t){return!isNaN(t)}function cD(t,e){if(t.length!==e.length)return!0;t.sort(),e.sort();for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!0;return!1}const lD=Object.keys;function fD(t){const e=[];for(const n in t)t.hasOwnProperty(n)&&e.push(t[n]);return e}function dD(t){const e=[];for(const n in t)t.hasOwnProperty(n)&&e.push({key:n,value:t[n]});return e}function hD(t){return lD(t)}function pD(t){return!0===t||!1===t}function mD(t){const e=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+e}function gD(t,e){return LI(t)?"!("+gD(t.not,e)+")":zI(t)?"("+t.and.map(t=>gD(t,e)).join(") && (")+")":PI(t)?"("+t.or.map(t=>gD(t,e)).join(") || (")+")":e(t)}function vD(t,e){if(0===e.length)return!0;const n=e.shift();return vD(t[n],e)&&delete t[n],0===lD(t).length}function bD(t){return t.charAt(0).toUpperCase()+t.substr(1)}function yD(t,e="datum"){const n=Object(H.W)(t),r=[];for(let t=1;t<=n.length;t++){const i=`[${n.slice(0,t).map(H.X).join("][")}]`;r.push(`${e}${i}`)}return r.join(" && ")}function wD(t,e="datum"){return`${e}[${Object(H.X)(Object(H.W)(t).join("."))}]`}function xD(t){return`${Object(H.W)(t).map(t=>t.replace(".","\\.")).join("\\.")}`}function _D(t){return`${Object(H.W)(t).join(".")}`}function kD(t){return t?Object(H.W)(t).length:0}function SD(...t){for(const e of t)if(void 0!==e)return e}let ED=42;function OD(t){const e=++ED;return t?String(t)+e:e}function AD(){ED=42}const CD={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},MD=hD(CD);function ND(t){return!!CD[t]}const TD=["count","valid","missing","distinct"];function ID(t){return t&&GI(TD,t)}function DD(t){return t&&GI(["min","max"],t)}const jD=["count","sum","distinct","valid","missing"],RD=["mean","average","median","q1","q3","min","max"],FD=Object(H.Ba)(RD),PD=["domain","grid","labels","ticks","title"],zD={grid:"grid",gridColor:"grid",gridDash:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",domain:"main",domainColor:"main",domainOpacity:"main",domainWidth:"main",format:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontWeight:"main",labelLimit:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",maxExtent:"main",minExtent:"main",offset:"main",position:"main",tickColor:"main",tickExtra:"main",tickOffset:"both",tickOpacity:"main",tickRound:"main",ticks:"main",tickSize:"main",title:"main",titleAlign:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontWeight:"main",titleLimit:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",tickWidth:"both",tickCount:"both",values:"both",scale:"both",zindex:"both"},LD={orient:1,bandPosition:1,domain:1,domainColor:1,domainOpacity:1,domainWidth:1,format:1,grid:1,gridColor:1,gridDash:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,maxExtent:1,minExtent:1,offset:1,position:1,tickColor:1,tickCount:1,tickExtra:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,zindex:1},BD=Object.assign({},LD,{encoding:1,labelAngle:1,tickStep:1});function UD(t){return!!BD[t]}const WD=hD(Object.assign({gridScale:1,scale:1},LD,{encode:1})),qD=hD(BD);var VD;!function(t){t.ROW="row",t.COLUMN="column",t.X="x",t.Y="y",t.X2="x2",t.Y2="y2",t.XERROR="xError",t.YERROR="yError",t.XERROR2="xError2",t.YERROR2="yError2",t.LATITUDE="latitude",t.LONGITUDE="longitude",t.LATITUDE2="latitude2",t.LONGITUDE2="longitude2",t.COLOR="color",t.FILL="fill",t.STROKE="stroke",t.SHAPE="shape",t.SIZE="size",t.OPACITY="opacity",t.FILLOPACITY="fillOpacity",t.STROKEOPACITY="strokeOpacity",t.STROKEWIDTH="strokeWidth",t.TEXT="text",t.ORDER="order",t.DETAIL="detail",t.KEY="key",t.TOOLTIP="tooltip",t.HREF="href"}(VD||(VD={}));const HD=VD.X,$D=VD.Y,GD=VD.X2,KD=VD.Y2,XD=VD.XERROR,YD=VD.YERROR,JD=VD.XERROR2,ZD=VD.YERROR2,QD=VD.LATITUDE,tj=VD.LATITUDE2,ej=VD.LONGITUDE,nj=VD.LONGITUDE2,rj=VD.ROW,ij=VD.COLUMN,oj=VD.SHAPE,aj=VD.SIZE,sj=VD.COLOR,uj=VD.FILL,cj=VD.STROKE,lj=VD.TEXT,fj=VD.DETAIL,dj=VD.KEY,hj=VD.ORDER,pj=VD.OPACITY,mj=VD.FILLOPACITY,gj=VD.STROKEOPACITY,vj=VD.STROKEWIDTH,bj=VD.TOOLTIP,yj=VD.HREF,wj={longitude:1,longitude2:1,latitude:1,latitude2:1},xj=hD(wj),_j=Object.assign({x:1,y:1,x2:1,y2:1,xError:1,yError:1,xError2:1,yError2:1},wj,{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});function kj(t){return"color"===t||"fill"===t||"stroke"===t}const Sj=Object.assign({},_j,{row:1,column:1}),Ej=hD(Sj),{order:Oj,detail:Aj}=Sj,Cj=hD(B(Sj,["order","detail"]));function Mj(t){return!!Sj[t]}function Nj(t){return Tj(t)!==t}function Tj(t){switch(t){case"x2":return"x";case"y2":return"y";case"latitude2":return"latitude";case"longitude2":return"longitude"}return t}const Ij=hD(_j),{x:Dj,y:jj,x2:Rj,y2:Fj,xError:Pj,yError:zj,xError2:Lj,yError2:Bj,latitude:Uj,longitude:Wj,latitude2:qj,longitude2:Vj}=_j,Hj=B(_j,["x","y","x2","y2","xError","yError","xError2","yError2","latitude","longitude","latitude2","longitude2"]),$j=hD(Hj),Gj={x:1,y:1},Kj=hD(Gj),{text:Xj,tooltip:Yj,href:Jj,detail:Zj,key:Qj,order:tR}=Hj,eR=B(Hj,["text","tooltip","href","detail","key","order"]),nR=hD(eR);function rR(t){return!!Hj[t]}const iR=Object.assign({},Gj,eR),oR=hD(iR);function aR(t){return!!iR[t]}function sR(t,e){return function(t){switch(t){case sj:case uj:case cj:case fj:case dj:case bj:case yj:case hj:case pj:case mj:case gj:case vj:case rj:case ij:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",rect:"always",line:"always",trail:"always",area:"always",text:"always",geoshape:"always"};case HD:case $D:case QD:case ej:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",rect:"always",line:"always",trail:"always",area:"always",text:"always"};case GD:case KD:case tj:case nj:return{rule:"always",bar:"always",rect:"always",area:"always",circle:"binned",point:"binned",square:"binned",tick:"binned"};case aj:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case oj:return{point:"always",geoshape:"always"};case lj:return{text:"always"};case XD:case YD:case JD:case ZD:return{}}}(t)[e]}function uR(t){switch(t){case HD:case $D:case aj:case vj:case pj:case mj:case gj:case GD:case KD:case XD:case YD:case JD:case ZD:return;case rj:case ij:case oj:case lj:case bj:case yj:return"discrete";case sj:case uj:case cj:return"flexible";case QD:case ej:case tj:case nj:case fj:case dj:case hj:return}throw new Error("rangeType not implemented for "+t)}function cR(t){return Object(H.B)(t)?"bin":"bin"+lD(t).map(e=>mD(`_${e}_${t[e]}`)).join("")}function lR(t){return!0===t||dR(t)}function fR(t){return"binned"===t}function dR(t){return Object(H.F)(t)}function hR(t){switch(t){case rj:case ij:case aj:case sj:case uj:case cj:case vj:case pj:case mj:case gj:case oj:return 6;default:return 10}}var pR;!function(t){t.AREA="area",t.BAR="bar",t.LINE="line",t.POINT="point",t.RECT="rect",t.RULE="rule",t.TEXT="text",t.TICK="tick",t.TRAIL="trail",t.CIRCLE="circle",t.SQUARE="square",t.GEOSHAPE="geoshape"}(pR||(pR={}));const mR=pR.AREA,gR=pR.BAR,vR=pR.LINE,bR=pR.POINT,yR=pR.TEXT,wR=pR.TICK,xR=pR.TRAIL,_R=pR.RECT,kR=pR.RULE,SR=pR.GEOSHAPE,ER=pR.CIRCLE,OR=pR.SQUARE,AR={area:1,bar:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1};function CR(t){return!!AR[t]}function MR(t){return GI(["line","area","trail"],t)}const NR=hD(AR);function TR(t){return t.type}const IR=Object(H.Ba)(NR);function DR(t){return(TR(t)?t.type:t)in IR}const jR=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],RR=["fill","fillOpacity"],FR=[].concat(jR,RR),PR=["filled","color","tooltip"],zR={area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],text:["shortTimeLabels"],tick:["bandSize","thickness"]},LR={color:"#4c78a8",tooltip:{content:"encoding"}},BR={binSpacing:1,continuousBandSize:5},UR={thickness:1},WR=Object(H.K)(H.e);let qR=WR;function VR(...t){qR.warn.apply(qR,arguments)}var HR;!function(t){t.INVALID_SPEC="Invalid spec",t.FIT_NON_SINGLE='Autosize "fit" only works for single views and layered views.',t.CANNOT_FIX_RANGE_STEP_WITH_FIT='Cannot use a fixed value of "rangeStep" when "autosize" is "fit".',t.cannotProjectOnChannelWithoutField=function(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`},t.nearestNotSupportForContinuous=function(t){return`The "nearest" transform is not supported for ${t} marks.`},t.selectionNotSupported=function(t){return`Selection not supported for ${t} yet`},t.selectionNotFound=function(t){return`Cannot find a selection named "${t}"`},t.SCALE_BINDINGS_CONTINUOUS="Scale bindings are currently only supported for scales with unbinned, continuous domains.",t.noSuchRepeatedValue=function(t){return`Unknown repeated value "${t}".`},t.CONCAT_CANNOT_SHARE_AXIS="Axes cannot be shared in concatenated views.",t.REPEAT_CANNOT_SHARE_AXIS="Axes cannot be shared in repeated views.",t.cannotSetTitleAnchor=function(t){return`Cannot set title "anchor" for a ${t} spec`},t.unrecognizedParse=function(t){return`Unrecognized parse "${t}".`},t.differentParse=function(t,e,n){return`An ancestor parsed field "${t}" as ${n} but a child wants to parse the field as ${e}.`},t.invalidTransformIgnored=function(t){return`Ignoring an invalid transform: ${HI(t)}.`},t.NO_FIELDS_NEEDS_AS='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.',t.encodingOverridden=function(t){return`Layer's shared ${t.join(",")} channel ${1===t.length?"is":"are"} overriden`},t.projectionOverridden=function(t){const{parentProjection:e,projection:n}=t;return`Layer's shared projection ${HI(e)} is overridden by a child projection ${HI(n)}.`},t.primitiveChannelDef=function(t,e,n){return`Channel ${t} is a ${e}. Converted to {value: ${HI(n)}}.`},t.invalidFieldType=function(t){return`Invalid field type "${t}"`},t.nonZeroScaleUsedWithLengthMark=function(t,e,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${t}'s ${e}. This can be misleading as the ${"x"===e?"width":"height"} of the ${t} can be arbitrary based on the scale domain. You may want to use point mark instead.`},t.invalidFieldTypeForCountAggregate=function(t,e){return`Invalid field type "${t}" for aggregate: "${e}", using "quantitative" instead.`},t.invalidAggregate=function(t){return`Invalid aggregation operator "${t}"`},t.missingFieldType=function(t,e){return`Missing type for channel "${t}", using "${e}" instead.`},t.droppingColor=function(t,e){const{fill:n,stroke:r}=e;return`Dropping color ${t} as the plot also has `+(n&&r?"fill and stroke":n?"fill":"stroke")},t.emptyFieldDef=function(t,e){return`Dropping ${HI(t)} from channel "${e}" since it does not contain data field or value.`},t.latLongDeprecated=function(t,e,n){return`${t}-encoding with type ${e} is deprecated. Replacing with ${n}-encoding.`},t.LINE_WITH_VARYING_SIZE="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.",t.incompatibleChannel=function(t,e,n){return`${t} dropped as it is incompatible with "${e}"${n?` when ${n}`:""}.`},t.invalidEncodingChannel=function(t){return`${t}-encoding is dropped as ${t} is not a valid encoding channel.`},t.facetChannelShouldBeDiscrete=function(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`},t.discreteChannelCannotEncode=function(t,e){return`Using discrete channel "${t}" to encode "${e}" field can be misleading as it does not encode ${"ordinal"===e?"order":"magnitude"}.`},t.BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL="Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.",t.lineWithRange=function(t,e){return`Line mark is for continuous lines and thus cannot be used with ${t&&e?"x2 and y2":t?"x2":"y2"}. We will use the rule mark (line segments) instead.`},t.orientOverridden=function(t,e){return`Specified orient "${t}" overridden with "${e}"`},t.CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN="custom domain scale cannot be unioned with default field-based domain",t.cannotUseScalePropertyWithNonColor=function(t){return`Cannot use the scale property "${t}" with non-color channel.`},t.unaggregateDomainHasNoEffectForRawField=function(t){return`Using unaggregated domain with raw field has no effect (${HI(t)}).`},t.unaggregateDomainWithNonSharedDomainOp=function(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`},t.unaggregatedDomainWithLogScale=function(t){return`Unaggregated domain is currently unsupported for log scale (${HI(t)}).`},t.cannotApplySizeToNonOrientedMark=function(t){return`Cannot apply size to non-oriented mark "${t}".`},t.rangeStepDropped=function(t){return`rangeStep for "${t}" is dropped as top-level ${"x"===t?"width":"height"} is provided.`},t.scaleTypeNotWorkWithChannel=function(t,e,n){return`Channel "${t}" does not work with "${e}" scale. We are using "${n}" scale instead.`},t.scaleTypeNotWorkWithFieldDef=function(t,e){return`FieldDef does not work with "${t}" scale. We are using "${e}" scale instead.`},t.scalePropertyNotWorkWithScaleType=function(t,e,n){return`${n}-scale's "${e}" is dropped as it does not work with ${t} scale.`},t.scaleTypeNotWorkWithMark=function(t,e){return`Scale type "${e}" does not work with mark "${t}".`},t.mergeConflictingProperty=function(t,e,n,r){return`Conflicting ${e.toString()} property "${t.toString()}" (${HI(n)} and ${HI(r)}). Using ${HI(n)}.`},t.independentScaleMeansIndependentGuide=function(t){return`Setting the scale to be independent for "${t}" means we also have to set the guide (axis or legend) to be independent.`},t.domainSortDropped=function(t){return`Dropping sort property ${HI(t)} as unioned domains only support boolean or op 'count'.`},t.UNABLE_TO_MERGE_DOMAINS="Unable to merge domains",t.MORE_THAN_ONE_SORT="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",t.INVALID_CHANNEL_FOR_AXIS="Invalid channel for axis.",t.cannotStackRangedMark=function(t){return`Cannot stack "${t}" if there is already "${t}2"`},t.cannotStackNonLinearScale=function(t){return`Cannot stack non-linear scale (${t})`},t.stackNonSummativeAggregate=function(t){return`Stacking is applied even though the aggregate function is non-summative ("${t}")`},t.invalidTimeUnit=function(t,e){return`Invalid ${t}: ${HI(e)}`},t.dayReplacedWithDate=function(t){return`Time unit "${t}" is not supported. We are replacing it with ${t.replace("day","date")}.`},t.droppedDay=function(t){return`Dropping day from datetime ${HI(t)} as day cannot be combined with other units.`},t.errorBarCenterAndExtentAreNotNeeded=function(t,e){return`${e?"extent ":""}${e&&t?"and ":""}${t?"center ":""}${e&&t?"are ":"is "}not needed when data are aggregated.`},t.errorBarCenterIsUsedWithWrongExtent=function(t,e,n){return`${t} is not usually used with ${e} for ${n}.`},t.errorBarContinuousAxisHasCustomizedAggregate=function(t,e){return`Continuous axis should not have customized aggregation function ${t}; ${e} already agregates the axis.`},t.errorBarCenterIsNotNeeded=function(t,e){return`Center is not needed to be specified in ${e} when extent is ${t}.`},t.errorBand1DNotSupport=function(t){return`1D error band does not support ${t}`},t.channelRequiredForBinned=function(t){return`Channel ${t} is required for "binned" bin`},t.domainRequiredForThresholdScale=function(t){return`Domain for ${t} is required for threshold scale`}}(HR||(HR={}));const $R=2006;function GR(t){return!(!t||!(t.year||t.quarter||t.month||t.date||t.day||t.hours||t.minutes||t.seconds||t.milliseconds))}const KR=["january","february","march","april","may","june","july","august","september","october","november","december"],XR=KR.map(t=>t.substr(0,3)),YR=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],JR=YR.map(t=>t.substr(0,3));function ZR(t,e=!1){const n=[];if(e&&void 0!==t.day&&lD(t).length>1&&(VR(HR.droppedDay(t)),delete(t=UI(t)).day),void 0!==t.year?n.push(t.year):void 0!==t.day?n.push($R):n.push(0),void 0!==t.month){const r=e?function(t){if(Object(H.E)(t))return(t-1).toString();{const e=t.toLowerCase(),n=KR.indexOf(e);if(-1!==n)return n+"";const r=e.substr(0,3),i=XR.indexOf(r);if(-1!==i)return i+"";throw new Error(HR.invalidTimeUnit("month",t))}}(t.month):t.month;n.push(r)}else if(void 0!==t.quarter){const r=e?function(t){if(Object(H.E)(t))return t>4&&VR(HR.invalidTimeUnit("quarter",t)),(t-1).toString();throw new Error(HR.invalidTimeUnit("quarter",t))}(t.quarter):t.quarter;n.push(r+"*3")}else n.push(0);if(void 0!==t.date)n.push(t.date);else if(void 0!==t.day){const r=e?function(t){if(Object(H.E)(t))return t%7+"";{const e=t.toLowerCase(),n=YR.indexOf(e);if(-1!==n)return n+"";const r=e.substr(0,3),i=JR.indexOf(r);if(-1!==i)return i+"";throw new Error(HR.invalidTimeUnit("day",t))}}(t.day):t.day;n.push(r+"+1")}else n.push(1);for(const e of["hours","minutes","seconds","milliseconds"])void 0!==t[e]?n.push(t[e]):n.push(0);return t.utc?`utc(${n.join(", ")})`:`datetime(${n.join(", ")})`}function QR(t){return void 0!==t.facet}var tF;!function(t){t.YEAR="year",t.MONTH="month",t.DAY="day",t.DATE="date",t.HOURS="hours",t.MINUTES="minutes",t.SECONDS="seconds",t.MILLISECONDS="milliseconds",t.YEARMONTH="yearmonth",t.YEARMONTHDATE="yearmonthdate",t.YEARMONTHDATEHOURS="yearmonthdatehours",t.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",t.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",t.MONTHDATE="monthdate",t.MONTHDATEHOURS="monthdatehours",t.HOURSMINUTES="hoursminutes",t.HOURSMINUTESSECONDS="hoursminutesseconds",t.MINUTESSECONDS="minutesseconds",t.SECONDSMILLISECONDS="secondsmilliseconds",t.QUARTER="quarter",t.YEARQUARTER="yearquarter",t.QUARTERMONTH="quartermonth",t.YEARQUARTERMONTH="yearquartermonth",t.UTCYEAR="utcyear",t.UTCMONTH="utcmonth",t.UTCDAY="utcday",t.UTCDATE="utcdate",t.UTCHOURS="utchours",t.UTCMINUTES="utcminutes",t.UTCSECONDS="utcseconds",t.UTCMILLISECONDS="utcmilliseconds",t.UTCYEARMONTH="utcyearmonth",t.UTCYEARMONTHDATE="utcyearmonthdate",t.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",t.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",t.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",t.UTCMONTHDATE="utcmonthdate",t.UTCMONTHDATEHOURS="utcmonthdatehours",t.UTCHOURSMINUTES="utchoursminutes",t.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",t.UTCMINUTESSECONDS="utcminutesseconds",t.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",t.UTCQUARTER="utcquarter",t.UTCYEARQUARTER="utcyearquarter",t.UTCQUARTERMONTH="utcquartermonth",t.UTCYEARQUARTERMONTH="utcyearquartermonth"}(tF||(tF={}));const eF={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},nF=hD(eF);function rF(t){return!!eF[t]}const iF={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};function oF(t){return!!iF[t]}const aF={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},sF=Object.assign({},iF,aF);function uF(t){return!!sF[t]}function cF(t){return t.substr(3)}const lF=Object.assign({},eF,iF,{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},aF),fF=hD(lF);function dF(t){return!!lF[t]}const hF={year:"setFullYear",month:"setMonth",date:"setDate",hours:"setHours",minutes:"setMinutes",seconds:"setSeconds",milliseconds:"setMilliseconds",quarter:null,day:null};function pF(t,e){const n=uF(t),r=n?new Date(Date.UTC(1972,0,1,0,0,0,0)):new Date(1972,0,1,0,0,0,0);for(const i of nF)if(vF(t,i))switch(i){case tF.DAY:throw new Error("Cannot convert to TimeUnits containing 'day'");case tF.QUARTER:{const{getDateMethod:t,setDateMethod:i}=mF("month",n);r[i](3*Math.floor(e[t]()/3));break}default:const{getDateMethod:t,setDateMethod:o}=mF(i,n);r[o](e[t]())}return r}function mF(t,e){const n=hF[t];return{setDateMethod:e?"setUTC"+n.substr(3):n,getDateMethod:"get"+(e?"UTC":"")+n.substr(3)}}function gF(t){return nF.reduce((e,n)=>vF(t,n)?e.concat(n):e,[])}function vF(t,e){const n=t.indexOf(e);return n>-1&&(e!==tF.SECONDS||0===n||"i"!==t.charAt(n-1))}function bF(t,e){const n=yD(e),r=uF(t)?"utc":"";return ZR(nF.reduce((e,i)=>(vF(t,i)&&(e[i]=function(t){return t===tF.QUARTER?`(${r}quarter(${n})-1)`:`${r}${t}(${n})`}(i)),e),{}))}function yF(t,e){if(!t)return;const n=[],r=vF(t,tF.YEAR);vF(t,tF.MONTH)&&n.push(!1!==e?"%b":"%B"),vF(t,tF.DAY)?n.push(e?"%a":"%A"):vF(t,tF.DATE)&&n.push("%d"+(r?",":"")),r&&n.push(e?"%y":"%Y");const i=[];vF(t,tF.HOURS)&&i.push("%H"),vF(t,tF.MINUTES)&&i.push("%M"),vF(t,tF.SECONDS)&&i.push("%S"),vF(t,tF.MILLISECONDS)&&i.push("%L");const o=[];return n.length>0&&o.push(n.join(" ")),i.length>0&&o.push(i.join(":")),o}function wF(t,e,n,r){if(!t)return;const i=yF(t,n);let o="";return vF(t,tF.QUARTER)&&(o=`'Q' + quarter(${e})`),i.length>0&&(o&&(o+=" + ' ' + "),o+=r?`utcFormat(${e}, '${i.join(" ")}')`:`timeFormat(${e}, '${i.join(" ")}')`),o||void 0}function xF(t){return"day"!==t&&t.indexOf("day")>=0?(VR(HR.dayReplacedWithDate(t)),t.replace("day","date")):t}var _F;!function(t){t.QUANTITATIVE="quantitative",t.ORDINAL="ordinal",t.TEMPORAL="temporal",t.NOMINAL="nominal",t.GEOJSON="geojson"}(_F||(_F={}));const kF={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1};function SF(t){return!!kF[t]}const EF=_F.QUANTITATIVE,OF=_F.ORDINAL,AF=_F.TEMPORAL,CF=_F.NOMINAL,MF=_F.GEOJSON;function NF(t){if(t)switch(t=t.toLowerCase()){case"q":case EF:return"quantitative";case"t":case AF:return"temporal";case"o":case OF:return"ordinal";case"n":case CF:return"nominal";case MF:return"geojson"}}function TF(t){return t.selection}function IF(t){return t&&!Object(H.H)(t)&&"repeat"in t}function DF(t){const{field:e,timeUnit:n,bin:r,aggregate:i}=t;return Object.assign({},n?{timeUnit:n}:{},r?{bin:r}:{},i?{aggregate:i}:{},{field:e})}function jF(t){return LF(t)&&!!t.sort}function RF(t){return!!t&&!!t.condition}function FF(t){return!!t&&!!t.condition&&!Object(H.A)(t.condition)&&zF(t.condition)}function PF(t){return!!t&&!!t.condition&&(Object(H.A)(t.condition)||UF(t.condition))}function zF(t){return!(!t||!t.field&&"count"!==t.aggregate)}function LF(t){return!!t&&(!!t.field&&!!t.type||"count"===t.aggregate)}function BF(t){return zF(t)&&Object(H.H)(t.field)}function UF(t){return t&&"value"in t&&void 0!==t.value}function WF(t){return!(!t||!t.scale&&!t.sort)}function qF(t){return!(!t||!t.axis&&!t.stack&&!t.impute)}function VF(t){return!!t&&!!t.legend}function HF(t){return!!t&&!!t.format}function $F(t,e={}){let n=t.field;const r=e.prefix;let i=e.suffix;if(XF(t))n="count_*";else{let r;e.nofn||(function(t){return!!t.op}(t)?r=t.op:lR(t.bin)?(r=cR(t.bin),i=(e.binSuffix||"")+(e.suffix||"")):t.aggregate?r=String(t.aggregate):t.timeUnit&&(r=String(t.timeUnit))),r&&(n=n?`${r}_${n}`:r)}return i&&(n=`${n}_${i}`),r&&(n=`${r}_${n}`),e.forAs?n:e.expr?wD(n,e.expr):xD(n)}function GF(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!t.bin;case"temporal":return!1}throw new Error(HR.invalidFieldType(t.type))}function KF(t){return!GF(t)}function XF(t){return"count"===t.aggregate}function YF(t,e){const{field:n,bin:r,timeUnit:i,aggregate:o}=t;return"count"===o?e.countTitle:lR(r)?`${n} (binned)`:i?`${n} (${gF(i).join("-")})`:o?`${bD(o)} of ${n}`:n}function JF(t,e){const n=t.aggregate||t.timeUnit||lR(t.bin)&&"bin";return n?n.toUpperCase()+"("+t.field+")":t.field}const ZF=(t,e)=>{switch(e.fieldTitle){case"plain":return t.field;case"functional":return JF(t);default:return YF(t,e)}};let QF=ZF;function tP(t){QF=t}function eP(){tP(ZF)}function nP(t,e,{allowDisabling:n}){const r=(rP(t)||{}).title;return n?SD(r,t.title,iP(t,e)):r||t.title||iP(t,e)}function rP(t){return qF(t)&&t.axis?t.axis:VF(t)&&t.legend?t.legend:function(t){return!!t&&!!t.header}(t)&&t.header?t.header:void 0}function iP(t,e){return QF(t,e)}function oP(t){return HF(t)&&t.format?t.format:(rP(t)||{}).format}function aP(t,e){if(t.timeUnit)return"temporal";if(lR(t.bin))return"quantitative";switch(uR(e)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}function sP(t){return zF(t)?t:FF(t)?t.condition:void 0}function uP(t){return zF(t)?t:FF(t)?t.condition:void 0}function cP(t,e){if(Object(H.H)(t)||Object(H.E)(t)||Object(H.B)(t)){const n=Object(H.H)(t)?"string":Object(H.E)(t)?"number":"boolean";return VR(HR.primitiveChannelDef(e,n,t)),{value:t}}return zF(t)?lP(t,e):FF(t)?Object.assign({},t,{condition:lP(t.condition,e)}):t}function lP(t,e){if(t.aggregate&&!ND(t.aggregate)){const{aggregate:e}=t,n=B(t,["aggregate"]);VR(HR.invalidAggregate(t.aggregate)),t=n}if(t.timeUnit&&(t=Object.assign({},t,{timeUnit:xF(t.timeUnit)})),lR(t.bin)&&(t=Object.assign({},t,{bin:fP(t.bin,e)})),fR(t.bin)&&!GI(Kj,e)&&VR(`Channel ${e} should not be used with "binned" bin`),LF(t)){const e=NF(t.type);t.type!==e&&(t=Object.assign({},t,{type:e})),"quantitative"!==t.type&&ID(t.aggregate)&&(VR(HR.invalidFieldTypeForCountAggregate(t.type,t.aggregate)),t=Object.assign({},t,{type:"quantitative"}))}else if(!Nj(e)){const n=aP(t,e);VR(HR.missingFieldType(e,n)),t=Object.assign({},t,{type:n})}if(LF(t)){const{compatible:n,warning:r}=hP(t,e);n||VR(r)}return t}function fP(t,e){return Object(H.B)(t)?{maxbins:hR(e)}:t.maxbins||t.step?t:Object.assign({},t,{maxbins:hR(e)})}const dP={compatible:!0};function hP(t,e){const n=t.type;if("geojson"===n&&"shape"!==e)return{compatible:!1,warning:`Channel ${e} should not be used with a geojson data.`};switch(e){case"row":case"column":return KF(t)?{compatible:!1,warning:HR.facetChannelShouldBeDiscrete(e)}:dP;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":return dP;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==EF?{compatible:!1,warning:`Channel ${e} should be used with a quantitative field only, not ${t.type} field.`}:dP;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return"nominal"!==n||t.sort?dP:{compatible:!1,warning:`Channel ${e} should not be used with an unsorted discrete field.`};case"shape":return GI(["ordinal","nominal","geojson"],t.type)?dP:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==t.type||"sort"in t?dP:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+e)}function pP(t){return"quantitative"===t.type||lR(t.bin)}function mP(t){return"temporal"===t.type||!!t.timeUnit}function gP(t,{timeUnit:e,type:n,time:r,undefinedIfExprNotRequired:i}){let o;return GR(t)?o=ZR(t,!0):(Object(H.H)(t)||Object(H.E)(t))&&(e||"temporal"===n)&&(o=rF(e)?ZR({[e]:t},!0):oF(e)?gP(t,{timeUnit:cF(e)}):`datetime(${JSON.stringify(t)})`),o?r?`time(${o})`:o:i?void 0:JSON.stringify(t)}function vP(t,e){const{timeUnit:n,type:r}=t;return e.map(t=>{const e=gP(t,{timeUnit:n,type:r,undefinedIfExprNotRequired:!0});return void 0!==e?{signal:e}:t})}function bP(t,e){return lR(t.bin)?aR(e)&&GI(["ordinal","nominal"],t.type):(console.warn("Only use this method with binned field defs"),!1)}function yP(t,e){const n=t&&t[e];return!!n&&(Object(H.A)(n)?YI(n,t=>!!t.field):zF(n)||FF(n))}function wP(t){return YI(Ej,e=>{if(yP(t,e)){const n=t[e];if(Object(H.A)(n))return YI(n,t=>!!t.aggregate);{const t=sP(n);return t&&!!t.aggregate}}return!1})}function xP(t,e){const n=[],r=[],i=[],o=[],a={};return OP(t,(s,u)=>{if(zF(s)){const{field:c,aggregate:l,timeUnit:f,bin:d}=s,h=B(s,["field","aggregate","timeUnit","bin"]);if(l||f||d){const t=rP(s),p=t&&t.title,m=$F(s,{forAs:!0}),g=Object.assign({},p?[]:{title:nP(s,e,{allowDisabling:!0})},h,{field:m}),v=u===VD.X||u===VD.Y;if(l&&ND(l)){const t={op:l,as:m};c&&(t.field=c),o.push(t)}else if(LF(s)&&lR(d)){if(r.push({bin:d,field:c,as:m}),n.push($F(s,{binSuffix:"end"})),bP(s,u)&&n.push($F(s,{binSuffix:"range"})),v){const t={field:m+"_end",type:_F.QUANTITATIVE};a[u+"2"]=t}g.bin="binned",Nj(u)||(g.type=_F.QUANTITATIVE)}else if(f){i.push({timeUnit:f,field:c,as:m});const t=yF(f,e.axis.shortTimeLabels).join(" ");rR(u)?g.legend=Object.assign({format:t},g.legend):v?g.axis=Object.assign({format:t},g.axis):"text"!==u&&"tooltip"!==u||(g.format=g.format||t)}l||n.push(m),a[u]=g}else n.push(c),a[u]=t[u]}else a[u]=t[u]}),{bins:r,timeUnits:i,aggregate:o,groupby:n,encoding:a}}function _P(t,e,n){const r=sR(e,n);if(!r)return!1;if("binned"===r){const n=t["x2"===e?"x":"y"];return!(!zF(n)||!zF(t[e])||"binned"!==n.bin)}return!0}function kP(t,e){return lD(t).reduce((n,r)=>{if(!Mj(r))return VR(HR.invalidEncodingChannel(r)),n;if(!_P(t,r,e))return VR(HR.incompatibleChannel(r,e)),n;if("size"===r&&"line"===e){const e=uP(t[r]);if(e&&e.aggregate)return VR(HR.LINE_WITH_VARYING_SIZE),n}if("color"===r&&("fill"in t||"stroke"in t))return VR(HR.droppingColor("encoding",{fill:"fill"in t,stroke:"stroke"in t})),n;const i=t[r];if("detail"===r||"order"===r&&!Object(H.A)(i)&&!UF(i)||"tooltip"===r&&Object(H.A)(i))i&&(n[r]=(Object(H.A)(i)?i:[i]).reduce((t,e)=>(zF(e)?t.push(lP(e,r)):VR(HR.emptyFieldDef(e,r)),t),[]));else{if("tooltip"===r&&null===i)n[r]=null;else if(!zF(i)&&!UF(i)&&!RF(i))return VR(HR.emptyFieldDef(i,r)),n;n[r]=cP(i,r)}return n},{})}function SP(t){return t&&(!!t.x&&!!t.x2||!!t.y&&!!t.y2)}function EP(t){const e=[];for(const n of lD(t))if(yP(t,n)){const r=t[n];(Object(H.A)(r)?r:[r]).forEach(t=>{zF(t)?e.push(t):FF(t)&&e.push(t.condition)})}return e}function OP(t,e,n){if(t)for(const r of lD(t))Object(H.A)(t[r])?t[r].forEach(t=>{e.call(n,t,r)}):e.call(n,t[r],r)}function AP(t,e,n,r){return t?lD(t).reduce((n,i)=>{const o=t[i];return Object(H.A)(o)?o.reduce((t,n)=>e.call(r,t,n,i),n):e.call(r,n,o,i)},n):n}function CP(t,e,n,r=!0){return{tooltip:[...t.map(({fieldPrefix:t,titlePrefix:n})=>({field:t+e.field,type:e.type,title:n+(r?" of "+e.field:"")})),...EP(n)]}}function MP(t,e,n,r,i){const{scale:o,axis:a}=n;return({partName:s,mark:u,positionPrefix:c,endPositionPrefix:l,extraEncoding:f={}})=>{const d=a&&void 0!==a.title?void 0:void 0!==n.title?n.title:n.field;return NP(t,s,i,{mark:u,encoding:Object.assign({[e]:Object.assign({field:c+"_"+n.field,type:n.type},d?{title:d}:{},o?{scale:o}:{},a?{axis:a}:{})},Object(H.H)(l)?{[e+"2"]:{field:l+"_"+n.field,type:n.type}}:{},r,f)})}}function NP(t,e,n,r){const{clip:i,color:o,opacity:a}=t,s=t.type;return t[e]||void 0===t[e]&&n[e]?[Object.assign({},r,{mark:Object.assign({},n[e],i?{clip:i}:{},o?{color:o}:{},a?{opacity:a}:{},TR(r.mark)?r.mark:{type:r.mark},{style:`${s}-${e}`},Object(H.B)(t[e])?{}:t[e])})]:[]}function TP(t,e,n){const{encoding:r}=t,i="vertical"===e?"y":"x",o=r[i],a=r[i+"2"],s=r[i+"Error"],u=r[i+"Error2"];return{continuousAxisChannelDef:IP(o,n),continuousAxisChannelDef2:IP(a,n),continuousAxisChannelDefError:IP(s,n),continuousAxisChannelDefError2:IP(u,n),continuousAxis:i}}function IP(t,e){if(zF(t)&&t&&t.aggregate){const{aggregate:n}=t,r=B(t,["aggregate"]);return n!==e&&VR(HR.errorBarContinuousAxisHasCustomizedAggregate(n,e)),r}return t}function DP(t,e){const{mark:n,encoding:r}=t;if(zF(r.x)&&KF(r.x)){if(zF(r.y)&&KF(r.y)){if(void 0===r.x.aggregate&&r.y.aggregate===e)return"vertical";if(void 0===r.y.aggregate&&r.x.aggregate===e)return"horizontal";if(r.x.aggregate===e&&r.y.aggregate===e)throw new Error("Both x and y cannot have aggregate");return TR(n)&&n.orient?n.orient:"vertical"}return"horizontal"}if(zF(r.y)&&KF(r.y))return"vertical";throw new Error("Need a valid continuous axis for "+e+"s")}function jP(t,e,n){return Object.assign({},t,{encoding:AP(t.encoding,(t,r,i)=>(e.indexOf(i)>-1?t[i]=r:VR(HR.incompatibleChannel(i,n)),t),{})})}const RP="boxplot",FP=lD({box:1,median:1,outliers:1,rule:1,ticks:1}),PP=["x","y","color","detail","opacity","size"];function zP(t){return[{op:"q1",field:t,as:"lower_box_"+t},{op:"q3",field:t,as:"upper_box_"+t}]}const LP="errorbar",BP=lD({ticks:1,rule:1});const UP=["x","y","x2","y2","xError","yError","xError2","yError2","color","detail","opacity"];function WP(t,e,n){t=jP(t,UP,e);const{mark:r,encoding:i,selection:o,projection:a}=t,s=B(t,["mark","encoding","selection","projection"]),u=TR(r)?r:{type:r};o&&VR(HR.selectionNotSupported(e));const{orient:c,inputType:l}=function(t,e){const{encoding:n}=t;if(function(t){return(zF(t.x)||zF(t.y))&&!zF(t.x2)&&!zF(t.y2)&&!zF(t.xError)&&!zF(t.xError2)&&!zF(t.yError)&&!zF(t.yError2)}(n))return{orient:DP(t,e),inputType:"raw"};const r=function(t){return zF(t.x2)||zF(t.y2)}(n),i=function(t){return zF(t.xError)||zF(t.xError2)||zF(t.yError)||zF(t.yError2)}(n),o=n.x,a=n.y;if(r){if(i)throw new Error(e+" cannot be both type aggregated-upper-lower and aggregated-error");const t=n.x2,r=n.y2;if(zF(t)&&zF(r))throw new Error(e+" cannot have both x2 and y2");if(zF(t)){if(zF(o)&&KF(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+e)}if(zF(r)){if(zF(a)&&KF(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error("Both y and y2 have to be quantitative in "+e)}throw new Error("No ranged axis")}{const t=n.xError,r=n.xError2,i=n.yError,s=n.yError2;if(zF(r)&&!zF(t))throw new Error(e+" cannot have xError2 without xError");if(zF(s)&&!zF(i))throw new Error(e+" cannot have yError2 without yError");if(zF(t)&&zF(i))throw new Error(e+" cannot have both xError and yError with both are quantiative");if(zF(t)){if(zF(o)&&KF(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(zF(i)){if(zF(a)&&KF(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}(t,e),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=TP(t,c,e),{errorBarSpecificAggregate:g,postAggregateCalculates:v,tooltipSummary:b,tooltipTitleWithFieldName:y}=function(t,e,n,r,i,o,a,s){let u=[],c=[];const l=e.field;let f,d=!1;if("raw"===o){const e=t.center?t.center:t.extent?"iqr"===t.extent?"median":"mean":s.errorbar.center,n=t.extent?t.extent:"mean"===e?"stderr":"iqr";if("median"===e!=("iqr"===n)&&VR(HR.errorBarCenterIsUsedWithWrongExtent(e,n,a)),"stderr"===n||"stdev"===n)u=[{op:n,field:l,as:"extent_"+l},{op:e,field:l,as:"center_"+l}],c=[{calculate:`datum.center_${l} + datum.extent_${l}`,as:"upper_"+l},{calculate:`datum.center_${l} - datum.extent_${l}`,as:"lower_"+l}],f=[{fieldPrefix:"center_",titlePrefix:bD(e)},{fieldPrefix:"upper_",titlePrefix:qP(e,n,"+")},{fieldPrefix:"lower_",titlePrefix:qP(e,n,"-")}],d=!0;else{let e,r,i;t.center&&t.extent&&VR(HR.errorBarCenterIsNotNeeded(t.extent,a)),"ci"===n?(e="mean",r="ci0",i="ci1"):(e="median",r="q1",i="q3"),u=[{op:r,field:l,as:"lower_"+l},{op:i,field:l,as:"upper_"+l},{op:e,field:l,as:"center_"+l}],f=[{fieldPrefix:"upper_",titlePrefix:nP({field:l,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:nP({field:l,aggregate:r,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:nP({field:l,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(t.center||t.extent)&&VR(HR.errorBarCenterAndExtentAreNotNeeded(t.center,t.extent)),"aggregated-upper-lower"===o?(f=[],c=[{calculate:`datum.${n.field}`,as:"upper_"+l},{calculate:`datum.${l}`,as:"lower_"+l}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:l}],c=[{calculate:`datum.${l} + datum.${r.field}`,as:"upper_"+l}],i?c.push({calculate:`datum.${l} + datum.${i.field}`,as:"lower_"+l}):c.push({calculate:`datum.${l} - datum.${r.field}`,as:"lower_"+l}));for(const t of c)f.push({fieldPrefix:t.as.substring(0,6),titlePrefix:t.calculate.replace(new RegExp("datum.","g"),"")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(u,f,d,h,p,l,e,n),w=m,x=(i[w],"x"===m?"x2":"y2"),_=(i[x],"x"===m?"xError":"yError"),k=(i[_],"x"===m?"xError2":"yError2"),S=(i[k],B(i,["symbol"==typeof w?w:w+"","symbol"==typeof x?x:x+"","symbol"==typeof _?_:_+"","symbol"==typeof k?k:k+""])),{bins:E,timeUnits:O,aggregate:A,groupby:C,encoding:M}=xP(S,n),N=[...A,...g],T="raw"!==l?[]:C,I=CP(b,f,M,y);return{transform:[...s.transform||[],...E,...O,...N.length?[{aggregate:N,groupby:T}]:[],...v],groupby:T,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:M,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:u,outerSpec:s,tooltipEncoding:I}}function qP(t,e,n){return bD(t)+" "+n+" "+e}const VP="errorband",HP=lD({band:1,borders:1}),$P={};function GP(t,e,n){$P[t]={normalizer:e,parts:n}}function KP(t){delete $P[t]}function XP(){return lD($P)}function YP(t){if(t in $P)return $P[t].parts;throw new Error(`Unregistered composite mark ${t}`)}function JP(t,e){const n=TR(t.mark)?t.mark.type:t.mark;if(n in $P){const{normalizer:r}=$P[n];return r(t,e)}throw new Error(`Invalid mark type "${n}"`)}GP(RP,function(t,e){t=jP(t,PP,RP);const{mark:n,encoding:r,selection:i,projection:o}=t,a=B(t,["mark","encoding","selection","projection"]),s=TR(n)?n:{type:n};i&&VR(HR.selectionNotSupported("boxplot"));const u=s.extent||e.boxplot.extent,c=SD(s.size,e.boxplot.size),l=!Object(H.E)(u),{transform:f,continuousAxisChannelDef:d,continuousAxis:h,groupby:p,encodingWithoutContinuousAxis:m,ticksOrient:g,tooltipEncoding:v}=function(t,e,n){const r=DP(t,RP),{continuousAxisChannelDef:i,continuousAxis:o}=TP(t,r,RP),a=i.field,s=!Object(H.E)(e),u=[...zP(a),{op:"median",field:a,as:"mid_box_"+a},{op:"min",field:a,as:(s?"lower_whisker_":"min_")+a},{op:"max",field:a,as:(s?"upper_whisker_":"max_")+a}],c=s?[]:[{calculate:`datum.upper_box_${a} - datum.lower_box_${a}`,as:"iqr_"+a},{calculate:`min(datum.upper_box_${a} + datum.iqr_${a} * ${e}, datum.max_${a})`,as:"upper_whisker_"+a},{calculate:`max(datum.lower_box_${a} - datum.iqr_${a} * ${e}, datum.min_${a})`,as:"lower_whisker_"+a}],l=t.encoding,f=o,d=(l[f],B(l,["symbol"==typeof f?f:f+""])),{bins:h,timeUnits:p,aggregate:m,groupby:g,encoding:v}=xP(d,n),b="vertical"===r?"horizontal":"vertical",y=CP([{fieldPrefix:"upper_whisker_",titlePrefix:s?"Max":"Upper Whisker"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"lower_whisker_",titlePrefix:s?"Min":"Lower Whisker"}],i,v);return{transform:[...h,...p,{aggregate:[...m,...u],groupby:g},...c],groupby:g,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:b,tooltipEncoding:y}}(t,u,e),{color:b,size:y}=m,w=B(m,["color","size"]),x=t=>MP(s,h,d,t,e.boxplot),_=x(w),k=x(m),S=x(Object.assign({},w,y?{size:y}:{})),E={type:"tick",color:"black",opacity:1,orient:g},O=Object.assign({type:"bar"},c?{size:c}:{}),A=Object.assign({type:"tick"},Object(H.F)(e.boxplot.median)&&e.boxplot.median.color?{color:e.boxplot.median.color}:{},c?{size:c}:{},{orient:g}),C=[..._({partName:"rule",mark:"rule",positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:v}),..._({partName:"rule",mark:"rule",positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:v}),..._({partName:"ticks",mark:E,positionPrefix:"lower_whisker",extraEncoding:v}),..._({partName:"ticks",mark:E,positionPrefix:"upper_whisker",extraEncoding:v}),...k({partName:"box",mark:O,positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:v}),...S({partName:"median",mark:A,positionPrefix:"mid_box",extraEncoding:v})];let M=[];if(!l){const t="datum.lower_box_"+d.field,n="datum.upper_box_"+d.field,r=`(${n} - ${t})`,i=`${t} - ${u} * ${r}`,o=`${n} + ${u} * ${r}`,a=`datum.${d.field}`;M=NP(s,"outliers",e.boxplot,{transform:[{window:zP(d.field),frame:[null,null],groupby:p},{filter:`(${a} < ${i}) || (${a} > ${o})`}],mark:"point",encoding:Object.assign({[h]:{field:d.field,type:d.type}},w)})}return M.length>0?Object.assign({},a,{layer:[{transform:f,layer:C},...M]}):Object.assign({},a,{transform:(a.transform||[]).concat(f),layer:C})},FP),GP(LP,function(t,e){const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:u,tooltipEncoding:c}=WP(t,LP,e),l=MP(s,i,r,o,e.errorbar),f={type:"tick",orient:a};return Object.assign({},u,{transform:n,layer:[...l({partName:"ticks",mark:f,positionPrefix:"lower",extraEncoding:c}),...l({partName:"ticks",mark:f,positionPrefix:"upper",extraEncoding:c}),...l({partName:"rule",mark:"rule",positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})]})},BP),GP(VP,function(t,e){const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:u}=WP(t,VP,e),c=MP(a,i,r,o,e.errorband),l=void 0!==t.encoding.x&&void 0!==t.encoding.y;let f={type:l?"area":"rect"},d={type:l?"line":"rule"};const h=Object.assign({},a.interpolate?{interpolate:a.interpolate}:{},a.tension&&a.interpolate?{interpolate:a.tension}:{});return l?(f=Object.assign({},f,h),d=Object.assign({},d,h)):a.interpolate?VR(HR.errorBand1DNotSupport("interpolate")):a.tension&&VR(HR.errorBand1DNotSupport("tension")),Object.assign({},s,{transform:n,layer:[...c({partName:"band",mark:f,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:d,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:d,positionPrefix:"upper",extraEncoding:u})]})},HP);const ZP=["shortTimeLabels"],QP=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength"],tz={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64},ez={clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,strokeWidth:1,symbolFillColor:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,title:1,titleAlign:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,type:1,values:1,zindex:1},nz=Object.assign({},ez,{opacity:1,shape:1,stroke:1,fill:1,size:1,encode:1}),rz=hD(ez),iz=hD(nz);var oz;!function(t){t.LINEAR="linear",t.BIN_LINEAR="bin-linear",t.LOG="log",t.POW="pow",t.SQRT="sqrt",t.TIME="time",t.UTC="utc",t.SEQUENTIAL="sequential",t.QUANTILE="quantile",t.QUANTIZE="quantize",t.THRESHOLD="threshold",t.ORDINAL="ordinal",t.BIN_ORDINAL="bin-ordinal",t.POINT="point",t.BAND="band"}(oz||(oz={}));const az={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric","bin-linear":"bin-linear",time:"time",utc:"time",sequential:"sequential",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},sz=lD(az);function uz(t,e){const n=az[t],r=az[e];return n===r||"ordinal-position"===n&&"time"===r||"ordinal-position"===r&&"time"===n}const cz={linear:0,log:1,pow:1,sqrt:1,time:0,utc:0,point:10,band:11,"bin-linear":0,sequential:0,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function lz(t){return cz[t]}const fz=["linear","bin-linear","log","pow","sqrt","time","utc"],dz=Object(H.Ba)(fz),hz=["quantile","quantize","threshold"],pz=Object(H.Ba)(hz),mz=fz.concat(["sequential","quantile","quantize","threshold"]),gz=Object(H.Ba)(mz),vz=["ordinal","bin-ordinal","point","band"],bz=Object(H.Ba)(vz),yz=Object(H.Ba)(["bin-linear","bin-ordinal"]),wz=["time","utc"];function xz(t){return t in bz}function _z(t){return t in yz}function kz(t){return t in gz}function Sz(t){return t in dz}function Ez(t){return t in pz}const Oz={textXRangeStep:90,rangeStep:20,pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,facetSpacing:16,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4};function Az(t){return t&&!!t.name}function Cz(t){return t&&t.selection}const Mz={type:1,domain:1,range:1,rangeStep:1,scheme:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},Nz=hD(Mz),{type:Tz,domain:Iz,range:Dz,rangeStep:jz,scheme:Rz}=Mz,Fz=hD(B(Mz,["type","domain","range","rangeStep","scheme"])),Pz=function(){const t={};for(const e of Ej)for(const n of lD(kF))for(const r of sz)for(const i of[!1,!0]){const o=qz(e,n,i);Uz(e,r)&&Bz(r,n,i)&&(t[o]=t[o]||[],t[o].push(r))}return t}();function zz(t,e){switch(e){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":return GI(["sequential","ordinal","bin-ordinal","quantile","quantize","threshold"],t);case"interpolate":return GI(["linear","bin-linear","pow","log","sqrt","utc","time"],t);case"round":return Sz(t)||"band"===t||"point"===t;case"padding":return Sz(t)||GI(["point","band"],t);case"paddingOuter":case"rangeStep":return GI(["point","band"],t);case"paddingInner":return"band"===t;case"clamp":return Sz(t)||"sequential"===t;case"nice":return Sz(t)||"sequential"===t||"quantize"===t;case"exponent":return"pow"===t;case"base":return"log"===t;case"zero":return kz(t)&&!GI(["log","time","utc","bin-linear","threshold","quantile"],t)}throw new Error(`Invalid scale property ${e}.`)}function Lz(t,e){switch(e){case"interpolate":case"scheme":return kj(t)?void 0:HR.cannotUseScalePropertyWithNonColor(t);case"type":case"domain":case"range":case"base":case"exponent":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeStep":case"reverse":case"round":case"clamp":case"zero":return}throw new Error(`Invalid scale property "${e}".`)}function Bz(t,e,n){return GI([_F.ORDINAL,_F.NOMINAL],e)?void 0===t||xz(t):e===_F.TEMPORAL?GI([oz.TIME,oz.UTC,oz.SEQUENTIAL,void 0],t):e!==_F.QUANTITATIVE||GI(n?[oz.BIN_LINEAR,oz.BIN_ORDINAL,oz.LINEAR]:[oz.LOG,oz.POW,oz.SQRT,oz.QUANTILE,oz.QUANTIZE,oz.THRESHOLD,oz.LINEAR,oz.SEQUENTIAL,void 0],t)}function Uz(t,e){switch(t){case VD.X:case VD.Y:return Sz(e)||GI(["band","point"],e);case VD.SIZE:case VD.STROKEWIDTH:case VD.OPACITY:case VD.FILLOPACITY:case VD.STROKEOPACITY:return Sz(e)||Ez(e)||GI(["band","point"],e);case VD.COLOR:case VD.FILL:case VD.STROKE:return"band"!==e;case VD.SHAPE:return"ordinal"===e}return!1}function Wz(t,e,n){return Pz[qz(t,e,n)]}function qz(t,e,n){const r=t+"_"+e;return n?r+"_bin":r}const Vz="_vgsid_";function Hz(t){const{anchor:e,frame:n,offset:r,orient:i,color:o}=t,a=B(t,["anchor","frame","offset","orient","color"]);return{mark:Object.assign({},a,o?{fill:o}:{}),nonMark:Object.assign({},e?{anchor:e}:{},r?{offset:r}:{},i?{orient:i}:{})}}const $z={width:200,height:200};function Gz(t){return t&&!!t.scheme}const Kz={padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",invalidValues:"filter",view:$z,mark:LR,area:{},bar:BR,circle:{},geoshape:{},line:{},point:{},rect:{},rule:{color:"black"},square:{},text:{color:"black"},tick:UR,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:Oz,projection:{},axis:{},axisX:{},axisY:{minExtent:30},axisLeft:{},axisRight:{},axisTop:{},axisBottom:{},axisBand:{},legend:tz,selection:{single:{on:"click",fields:[Vz],resolve:"global",empty:"all"},multi:{on:"click",fields:[Vz],toggle:"event.shiftKey",resolve:"global",empty:"all"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global"}},style:{},title:{}};function Xz(t){return tD(UI(Kz),t)}const Yz=["view",...NR],Jz=["padding","numberFormat","timeFormat","countTitle","stack","scale","selection","invalidValues","overlay"],Zz=Object.assign({view:["width","height"]},zR);function Qz(t){t=UI(t);for(const e of Jz)delete t[e];if(t.axis)for(const e of ZP)delete t.axis[e];if(t.legend){for(const e of ZP)delete t.legend[e];for(const e of QP)delete t.legend[e]}if(t.mark)for(const e of PR)delete t.mark[e];for(const e of Yz){for(const n of PR)delete t[e][n];const n=Zz[e];if(n)for(const r of n)delete t[e][r];tL(t,e)}for(const e of XP())delete t[e];tL(t,"title","group-title");for(const e in t)Object(H.F)(t[e])&&0===lD(t[e]).length&&delete t[e];return lD(t).length>0?t:void 0}function tL(t,e,n,r){const i="title"===e?Hz(t.title).mark:r?t[e][r]:t[e];"view"===e&&(n="cell");const o=Object.assign({},i,t.style[e]);lD(o).length>0&&(t.style[n||e]=o),r||delete t[e]}function eL(t){return!!t.url}function nL(t){return!!t.values}function rL(t){return!!t.name&&!eL(t)&&!nL(t)}const iL="main",oL="raw",aL={titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontWeight:"fontWeight",titleLimit:"limit",titlePadding:"offset"},sL={labelAngle:"angle",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelLimit:"limit",labelPadding:"offset"},uL=lD(aL),cL=lD(sL);function lL(t){return!(!t||"count"!==t.op&&!t.field||!t.op)}function fL(t){return!!t&&Object(H.A)(t)}const dL={zero:1,center:1,normalize:1};function hL(t){return!!dL[t]}const pL=[gR,mR,kR,bR,ER,OR,vR,yR,wR],mL=[gR,mR];function gL(t,e,n){const r=TR(t)?t.type:t;if(!GI(pL,r))return null;const i=function(t){const e=t.x,n=t.y;if(zF(e)&&zF(n))if("quantitative"===e.type&&"quantitative"===n.type){if(e.stack)return"x";if(n.stack)return"y";if(!!e.aggregate!=!!n.aggregate)return e.aggregate?"x":"y"}else{if("quantitative"===e.type)return"x";if("quantitative"===n.type)return"y"}else{if(zF(e)&&"quantitative"===e.type)return"x";if(zF(n)&&"quantitative"===n.type)return"y"}}(e);if(!i)return null;const o=e[i],a=BF(o)?$F(o,{}):void 0,s="x"===i?"y":"x",u=e[s],c=BF(u)?$F(u,{}):void 0,l=$j.reduce((t,n)=>{if(yP(e,n)){const r=e[n];(Object(H.A)(r)?r:[r]).forEach(e=>{const r=uP(e);if(r.aggregate)return;const i=BF(r)?$F(r,{}):void 0;(!i||i!==c&&i!==a)&&t.push({channel:n,fieldDef:r})})}return t},[]);if(0===l.length)return null;let f;return(f=void 0!==o.stack?o.stack:GI(mL,r)?SD(n,"zero"):n)&&hL(f)?(o.scale&&o.scale.type&&o.scale.type!==oz.LINEAR&&VR(HR.cannotStackNonLinearScale(o.scale.type)),yP(e,i===HD?GD:KD)?(void 0!==o.stack&&VR(HR.cannotStackRangedMark(i)),null):(o.aggregate&&!GI(jD,o.aggregate)&&VR(HR.stackNonSummativeAggregate(o.aggregate)),{groupbyChannel:u?s:void 0,fieldChannel:i,impute:MR(r),stackBy:l,offset:f})):null}function vL(t){return bL(t)||yL(t)}function bL(t){return void 0!==t.vconcat}function yL(t){return void 0!==t.hconcat}function wL(t){return void 0!==t.layer}function xL(t){return void 0!==t.repeat}function _L(t,e){return function t(e,n){if(QR(e))return function(e,n){const{spec:r}=e,i=B(e,["spec"]);return Object.assign({},i,{spec:t(r,n)})}(e,n);if(wL(e))return function t(e,n,r,i){const{layer:o,encoding:a,projection:s}=e,u=B(e,["layer","encoding","projection"]),c=kL({parentEncoding:r,encoding:a}),l=SL({parentProjection:i,projection:s});return Object.assign({},u,{layer:o.map(e=>wL(e)?t(e,n,c,l):EL(e,n,c,l))})}(e,n);if(xL(e))return function(e,n){const{spec:r}=e,i=B(e,["spec"]);return Object.assign({},i,{spec:t(r,n)})}(e,n);if(bL(e))return function(e,n){const{vconcat:r}=e,i=B(e,["vconcat"]);return Object.assign({},i,{vconcat:r.map(e=>t(e,n))})}(e,n);if(yL(e))return function(e,n){const{hconcat:r}=e,i=B(e,["hconcat"]);return Object.assign({},i,{hconcat:r.map(e=>t(e,n))})}(e,n);if(AL(e)){const t=yP(e.encoding,rj),r=yP(e.encoding,ij);return t||r?function(t,e){const n=t.encoding,{row:r,column:i}=n,o=B(n,["row","column"]),{mark:a,width:s,projection:u,height:c,selection:l,encoding:f}=t,d=B(t,["mark","width","projection","height","selection","encoding"]);return Object.assign({},d,{facet:Object.assign({},r?{row:r}:{},i?{column:i}:{}),spec:EL(Object.assign({},u?{projection:u}:{},{mark:a},s?{width:s}:{},c?{height:c}:{},{encoding:o},l?{selection:l}:{}),e)})}(e,n):EL(e,n)}throw new Error(HR.INVALID_SPEC)}(t,e)}function kL(t){const{parentEncoding:e,encoding:n}=t;if(e&&n){const t=lD(e).reduce((t,e)=>(n[e]&&t.push(e),t),[]);t.length>0&&VR(HR.encodingOverridden(t))}const r=Object.assign({},e||{},n||{});return lD(r).length>0?r:void 0}function SL(t){const{parentProjection:e,projection:n}=t;return e&&n&&VR(HR.projectionOverridden({parentProjection:e,projection:n})),n||e}function EL(t,e,n,r){const{encoding:i,projection:o}=t,a=TR(t.mark)?t.mark.type:t.mark;if(n||r){const a=SL({parentProjection:r,projection:o}),s=kL({parentEncoding:n,encoding:i});return EL(Object.assign({},t,a?{projection:a}:{},s?{encoding:s}:{}),e)}return function(t){return DR(t.mark)}(t)?"line"===a&&(i.x2||i.y2)?(VR(HR.lineWithRange(!!i.x2,!!i.y2)),EL(Object.assign({mark:"rule"},t),e,n,r)):MR(a)?function(t,e={}){const{selection:n,projection:r,encoding:i,mark:o}=t,a=B(t,["selection","projection","encoding","mark"]),s=TR(o)?o:{type:o},u=function(t,e,n){return"transparent"===t.point?{opacity:0}:t.point?Object(H.F)(t.point)?t.point:{}:void 0!==t.point?null:e.point||n.shape?Object(H.F)(e.point)?e.point:{}:null}(s,e[s.type],i),c="area"===s.type&&function(t,e){return t.line?!0===t.line?{}:t.line:void 0!==t.line?null:e.line?!0===e.line?{}:e.line:null}(s,e[s.type]);if(!u&&!c)return Object.assign({},t,{mark:OL(s)});const l=[Object.assign({},n?{selection:n}:{},{mark:OL(Object.assign({},s,"area"===s.type?{opacity:.7}:{})),encoding:VI(i,["shape"])})],f=gL(s,i,e?e.stack:void 0);let d=i;if(f){const{fieldChannel:t,offset:e}=f;d=Object.assign({},i,{[t]:Object.assign({},i[t],e?{stack:e}:{})})}return c&&l.push(Object.assign({},r?{projection:r}:{},{mark:Object.assign({type:"line"},qI(s,["clip","interpolate","tension"]),c),encoding:d})),u&&l.push(Object.assign({},r?{projection:r}:{},{mark:Object.assign({type:"point",opacity:1,filled:!0},qI(s,["clip"]),u),encoding:d})),Object.assign({},a,{layer:l})}(t,e):t:JP(t,e)}function OL(t){const{point:e,line:n}=t,r=B(t,["point","line"]);return lD(r).length>1?r:r.type}function AL(t){return!!t.mark}function CL(t,e){return e.forEach(e=>{const n=$I(["field","type","value","timeUnit","bin","aggregate"].reduce((t,n)=>(void 0!==e[n]&&(t[n]=e[n]),t),{}));t[n]=t[n]||e}),t}function ML(t){return fD(function t(e,n={}){return wL(e)?e.layer.forEach(e=>{AL(e)?CL(n,EP(e.encoding)):t(e,n)}):QR(e)?(CL(n,EP(e.facet)),t(e.spec,n)):xL(e)?t(e.spec,n):vL(e)?(bL(e)?e.vconcat:e.hconcat).forEach(e=>t(e,n)):CL(n,EP(e.encoding)),n}(t))}function NL(t,e){return e=e||t.config,!!DR(t.mark)&&null!==gL(t.mark,t.encoding,e?e.stack:void 0)}function TL(t){if(QR(t)||xL(t))return function(t){return TL(t.spec)}(t);if(wL(t))return function(t){let e=[];return t.layer.map(t=>{e=e.concat(TL(t))}),e}(t);if(AL(t))return function(t){const e=[];return OP(t.encoding,(t,n)=>{zF(t)&&e.push(t.field)}),e}(t);throw new Error(HR.INVALID_SPEC)}function IL(t){return t&&!!t.field&&void 0!==t.equal}function DL(t){return t&&!!t.field&&void 0!==t.lt}function jL(t){return t&&!!t.field&&void 0!==t.lte}function RL(t){return t&&!!t.field&&void 0!==t.gt}function FL(t){return t&&!!t.field&&void 0!==t.gte}function PL(t){return!!(t&&t.field&&Object(H.A)(t.range)&&2===t.range.length)}function zL(t){return t&&!!t.field&&(Object(H.A)(t.oneOf)||Object(H.A)(t.in))}function LL(t){return zL(t)||IL(t)||PL(t)||DL(t)||RL(t)||jL(t)||FL(t)}function BL(t,e){return gP(t,{timeUnit:e,time:!0})}function UL(t,e=!0){const{field:n,timeUnit:r}=t,i=r?"time("+bF(r,n)+")":$F(t,{expr:"datum"});if(IL(t))return i+"==="+BL(t.equal,r);if(DL(t))return`${i}<${BL(t.lt,r)}`;if(RL(t))return`${i}>${BL(t.gt,r)}`;if(jL(t))return`${i}<=${BL(t.lte,r)}`;if(FL(t))return`${i}>=${BL(t.gte,r)}`;if(zL(t))return`indexof([${function(t,e){return t.map(t=>BL(t,e))}(t.oneOf,r).join(",")}], ${i}) !== -1`;if(function(t){return t&&!!t.field&&void 0!==t.valid}(t))return t.valid?`${i}!==null&&!isNaN(${i})`:`${i}===null||isNaN(${i})`;if(PL(t)){const n=t.range[0],o=t.range[1];if(null!==n&&null!==o&&e)return"inrange("+i+", ["+BL(n,r)+", "+BL(o,r)+"])";const a=[];return null!==n&&a.push(`${i} >= ${BL(n,r)}`),null!==o&&a.push(`${i} <= ${BL(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(t)}`)}function WL(t){return LL(t)&&t.timeUnit?Object.assign({},t,{timeUnit:xF(t.timeUnit)}):t}function qL(t){return void 0!==t.filter}function VL(t){return t&&void 0!==t.start&&void 0!==t.stop}function HL(t){return void 0!==t.lookup}function $L(t){return void 0!==t.sample}function GL(t){return void 0!==t.window}function KL(t){return void 0!==t.flatten}function XL(t){return void 0!==t.calculate}function YL(t){return!!t.bin}function JL(t){return void 0!==t.impute}function ZL(t){return void 0!==t.timeUnit}function QL(t){return void 0!==t.aggregate}function tB(t){return void 0!==t.stack}function eB(t){return void 0!==t.fold}function nB(t){return t.map(t=>qL(t)?{filter:function t(e,n){return LI(e)?{not:t(e.not,n)}:zI(e)?{and:e.and.map(e=>t(e,n))}:PI(e)?{or:e.or.map(e=>t(e,n))}:n(e)}(t.filter,WL)}:t)}const rB={text:["text"],line:["x","y"],trail:["x","y"],area:["x","y"]},iB={bar:Object(H.Ba)(["row","column","x","y","size","color","fill","stroke","detail"]),line:Object(H.Ba)(["row","column","x","y","color","fill","stroke","color","detail"]),trail:Object(H.Ba)(["row","column","x","y","color","fill","stroke","color","detail","size"]),area:Object(H.Ba)(["row","column","x","y","color","fill","stroke","detail"]),tick:Object(H.Ba)(["row","column","x","y","color","fill","stroke","detail"]),circle:Object(H.Ba)(["row","column","x","y","color","fill","stroke","size","detail"]),square:Object(H.Ba)(["row","column","x","y","color","fill","stroke","size","detail"]),point:Object(H.Ba)(["row","column","x","y","color","fill","stroke","size","detail","shape"]),geoshape:Object(H.Ba)(["row","column","color","fill","stroke","detail","shape"]),text:Object(H.Ba)(["row","column","size","color","fill","stroke","text"])};function oB(t,e=rB,n=iB){const r=TR(t.mark)?t.mark.type:t.mark,i=t.encoding,o=e[r],a=n[r];for(const t in o)if(!(o[t]in i))return'Missing encoding channel "'+o[t]+'" for mark "'+r+'"';for(const t in i)if(!a[t])return'Encoding channel "'+t+'" is not supported by mark type "'+r+'"';return r!==gR||i.x||i.y?null:"Missing both x and y for bar"}function aB(t){return Object(H.H)(t)?{type:t}:t||{}}const sB=["background","padding"];function uB(t){return sB.reduce((e,n)=>(t&&void 0!==t[n]&&(e[n]=t[n]),e),{})}function cB(t){return!!t.step}function lB(t){return!Object(H.A)(t)&&"field"in t&&"data"in t}const fB=hD({opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeMiterLimit:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,cursor:1,href:1,tooltip:1,cornerRadius:1});function dB(t,e,n,r={header:!1}){const i=t.combine(),{orient:o,scale:a,title:s,zindex:u}=i,c=B(i,["orient","scale","title","zindex"]);if(lD(c).forEach(t=>{const n=zD[t];n&&n!==e&&"both"!==n&&delete c[t]}),"grid"===e){if(!c.grid)return;if(c.encode){const{grid:t}=c.encode;c.encode=Object.assign({},t?{grid:t}:{}),0===lD(c.encode).length&&delete c.encode}return Object.assign({scale:a,orient:o},c,{domain:!1,labels:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:SD(u,0)})}{if(!r.header&&t.mainExtracted)return;if(c.encode){for(const e of PD)t.hasAxisPart(e)||delete c.encode[e];0===lD(c.encode).length&&delete c.encode}const e=function(t,e){return Object(H.A)(t)?t.map(t=>iP(t,e)).join(", "):t}(s,n);return Object.assign({scale:a,orient:o,grid:!1},e?{title:e}:{},c,{zindex:SD(u,1)})}}function hB(t){return[].concat(t.type,t.style||[])}function pB(t,e,n,{skipGeneralMarkConfig:r=!1}={}){return SD(mB(t,e,n.style),n[e.type][t],r?void 0:n.mark[t])}function mB(t,e,n){const r=hB(e);let i;for(const e of r){const r=n[e],o=t;r&&void 0!==r[o]&&(i=r[o])}return i}function gB(t,e,n,r){const i=vB(t,e,r);if(lR(t.bin))return{signal:wB($F(t,{expr:n}),$F(t,{expr:n,binSuffix:"end"}),i,r)};if("quantitative"===t.type)return{signal:`${bB($F(t,{expr:n,binSuffix:"range"}),i)}`};if(mP(t)){const i=WF(t)&&t.scale&&t.scale.type===oz.UTC;return{signal:xB($F(t,{expr:n}),t.timeUnit,e,r.text.shortTimeLabels,r.timeFormat,i,!0)}}return{signal:`''+${$F(t,{expr:n})}`}}function vB(t,e,n){if(!mP(t))return e||(t.type===EF?n.numberFormat:void 0)}function bB(t,e){return`format(${t}, "${e||""}")`}function yB(t,e,n){return bB(t,e||n.numberFormat)}function wB(t,e,n,r){return`${t} === null || isNaN(${t}) ? "null" : ${yB(t,n,r)} + " - " + ${yB(e,n,r)}`}function xB(t,e,n,r,i,o,a=!1){return!e||n?(n=n||i)||a?`${o?"utc":"time"}Format(${t}, '${n}')`:void 0:wF(e,t,r,o)}function _B(t,e){return(Object(H.A)(t)?t:[t]).reduce((t,n)=>(t.field.push($F(n,e)),t.order.push(n.sort||"ascending"),t),{field:[],order:[]})}function kB(t,e){const n=[...t];return e.forEach(t=>{for(const e of n)if(HI(e)===HI(t))return;n.push(t)}),n}function SB(t,e){return t!==e&&e?t?t+", "+e:e:t}function EB(t,e){if(Object(H.A)(t.value)&&Object(H.A)(e.value))return{explicit:t.explicit,value:kB(t.value,e.value)};if(!Object(H.A)(t.value)&&!Object(H.A)(e.value))return{explicit:t.explicit,value:SB(t.value,e.value)};throw new Error("It should never reach here")}class OB{constructor(t,e){this.debugName=e,this._children=[],this._parent=null,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}hash(){return void 0===this._hash&&(this._hash=OD()),this._hash}producedFields(){return new Set}dependentFields(){return new Set}get parent(){return this._parent}set parent(t){this._parent=t,t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,e){this._children.indexOf(t)>-1?console.warn("Attempt to add the same child twice."):void 0!==e?this._children.splice(e,0,t):this._children.push(t)}removeChild(t){const e=this._children.indexOf(t);return this._children.splice(e,1),e}remove(){let t=this._parent.removeChild(this);for(const e of this._children)e._parent=this._parent,this._parent.addChild(e,t++)}insertAsParentOf(t){const e=t.parent;e.removeChild(this),this.parent=e,t.parent=this}swapWithParent(){const t=this._parent,e=t.parent;for(const e of this._children)e.parent=t;this._children=[],t.removeChild(this),t.parent.removeChild(t),this.parent=e,t.parent=this}}class AB extends OB{constructor(t,e,n,r){super(t,e),this.type=n,this.refCounts=r,this._source=this._name=e,!this.refCounts||this._name in this.refCounts||(this.refCounts[this._name]=0)}clone(){const t=new this.constructor;return t.debugName="clone_"+this.debugName,t._source=this._source,t._name="clone_"+this._name,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function CB(t){const e=KA(t),n=new Set;return e.visit(t=>{"MemberExpression"===t.type&&function t(e){return"MemberExpression"===e.object.type?t(e.object):"datum"===e.object.name}(t)&&n.add(function t(e){let n=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(n=(n=n.concat(t(e.object))).concat(t(e.property))),n)}(t).slice(1).join("."))}),n}class MB extends OB{constructor(t,e){super(t),this.transform=e,this._dependentFields=CB(this.transform.calculate)}clone(){return new MB(null,UI(this.transform))}static parseAllForSortIndex(t,e){return e.forEachFieldDef((e,n)=>{if(WF(e)&&fL(e.sort)){const{field:r,timeUnit:i}=e,o=e.sort,a=o.map((t,e)=>`${UL({field:r,timeUnit:i,equal:t})} ? ${e} : `).join("")+o.length;t=new MB(t,{calculate:a,as:NB(e,n,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${$I(this.transform)}`}}function NB(t,e,n){return $F(t,Object.assign({prefix:e,suffix:"sort_index"},n||{}))}const TB=["row","column"],IB=["header","footer"];function DB(t){return"top"===t||"left"===t?"header":"footer"}function jB(t,e){const n=t.component.layoutHeaders[e].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[e].facetFieldDef?t.component.layoutHeaders[e].facetFieldDef:void 0;return{name:`${e}-title`,type:"group",role:`${e}-title`,title:Object.assign({text:n,offset:10},"row"===e?{orient:"left"}:{},{style:"guide-title"},PB(r,i,uL,aL))}}function RB(t,e){const n=t.component.layoutHeaders[e],r=[];for(const i of IB)if(n[i])for(const o of n[i])r.push(FB(t,e,i,n,o));return r}function FB(t,e,n,r,i){if(i){let o=null;const{facetFieldDef:a}=r;if(a&&i.labels){const{header:n={}}=a,{format:r,labelAngle:i}=n,s=t.config?t.config:void 0,u=Object.assign({},function(t){return(90+(t=(t%360+360)%360))%180==0?{}:t<90||270<t?{align:{value:"right"}}:135<=t&&t<225?{align:{value:"left"}}:{}}(i));o=Object.assign({text:gB(a,r,"parent",t.config),offset:10},"row"===e?{orient:"left"}:{},{style:"guide-label"},void 0!==i?{angle:i}:{},function(t){return 45<=(t=(t%360+360)%360)&&t<=135?{baseline:"top"}:{baseline:"middle"}}(i),PB(s,a,cL,sL),lD(u).length>0?{encode:{update:u}}:{})}const s=i.axes,u=s&&s.length>0;if(o||u){const c="row"===e?"height":"width";return Object.assign({name:t.getName(`${e}_${n}`),type:"group",role:`${e}-${n}`},r.facetFieldDef?{from:{data:t.getName(e+"_domain")},sort:function(t,e){const{sort:n}=t;return lL(n)?{field:$F(n,{expr:"datum"}),order:n.order||"ascending"}:Object(H.A)(n)?{field:NB(t,e,{expr:"datum"}),order:"ascending"}:{field:$F(t,{expr:"datum"}),order:n||"ascending"}}(a,e)}:{},o?{title:o}:{},i.sizeSignal?{encode:{update:{[c]:i.sizeSignal}}}:{},u?{axes:s}:{})}}return null}function PB(t,e,n,r){const i={};for(const o of n)t&&t.header&&t.header[o]&&(i[r[o]]=t.header[o]),e&&e.header&&e.header[o]&&(i[r[o]]=e.header[o]);return i}function zB(t){return[].concat(LB(t,"width"),LB(t,"height"))}function LB(t,e){const n="width"===e?"x":"y",r=t.component.layoutSize.get(e);if(!r||"merged"===r)return[];const i=t.getSizeSignalRef(e).signal;if("range-step"===r){const e=t.getScaleComponent(n);if(e){const r=e.get("type"),o=e.get("range");if(xz(r)&&cB(o)){const r=t.scaleName(n);return pq(t.parent)&&"independent"===t.parent.component.resolve.scale[n]?[BB(r,o)]:[BB(r,o),{name:i,update:UB(r,e,`domain('${r}').length`)}]}}throw new Error("layout size is range step although there is no rangeStep.")}return[{name:i,value:r}]}function BB(t,e){return{name:t+"_step",value:e.step}}function UB(t,e,n){const r=e.get("type"),i=e.get("padding"),o=SD(e.get("paddingOuter"),i);let a=e.get("paddingInner");return`bandspace(${n}, ${a="band"===r?void 0!==a?a:i:1}, ${o}) * ${t}_step`}class WB extends OB{constructor(t,e){super(t),this.formula=e}clone(){return new WB(null,UI(this.formula))}static makeFromEncoding(t,e){const n=e.reduceFieldDef((t,e)=>{if(e.timeUnit){const n=$F(e,{forAs:!0});t[n]={as:n,timeUnit:e.timeUnit,field:e.field}}return t},{});return 0===lD(n).length?null:new WB(t,n)}static makeFromTransform(t,e){return new WB(t,{[e.field]:{as:e.as,timeUnit:e.timeUnit,field:e.field}})}merge(t){this.formula=Object.assign({},this.formula,t.formula),t.remove()}producedFields(){return new Set(fD(this.formula).map(t=>t.as))}dependentFields(){return new Set(fD(this.formula).map(t=>t.field))}hash(){return`TimeUnit ${$I(this.formula)}`}assemble(){return fD(this.formula).map(t=>({type:"formula",as:t.as,expr:bF(t.timeUnit,t.field)}))}}const qB="_fields";var VB={has:t=>"interval"===t.type&&"global"===t.resolve&&t.bind&&"scales"===t.bind,parse:(t,e,n)=>{const r=mD(n.name),i=n.scales=[];for(const e of n.project){const n=e.channel;if(!aR(n))continue;const o=t.getScaleComponent(n),a=o?o.get("type"):void 0;o&&kz(a)&&!_z(a)?(o.set("domainRaw",{signal:yD(e.field,r)},!0),i.push(n),t.repeater&&t.repeater.row===t.repeater.column&&t.getScaleComponent(n===HD?$D:HD).set("domainRaw",{signal:yD(e.field,r)},!0)):VR(HR.SCALE_BINDINGS_CONTINUOUS)}},topLevelSignals:(t,e,n)=>{const r=e.scales.filter(t=>!n.filter(n=>n.name===yU(e,t,"data")).length).map(t=>({channel:t,signal:yU(e,t,"data")}));if(!t.parent||!r.length)return n;const i=n.filter(t=>t.name===e.name)[0],o=i.update;if(o.indexOf(dU)>=0)i.update="{"+r.map(t=>`${Object(H.X)(e.fields[t.channel])}: ${t.signal}`).join(", ")+"}";else for(const t of r){const n=`, ${Object(H.X)(e.fields[t.channel])}: ${t.signal}`;o.indexOf(n)<0&&(i.update=o.substring(0,o.length-1)+n+"}")}return n.concat(r.map(t=>({name:t.signal})))},signals:(t,e,n)=>{if(t.parent)for(const t of e.scales){const r=n.filter(n=>n.name===yU(e,t,"data"))[0];r.push="outer",delete r.value,delete r.update}return n}};function HB(t,e){return`domain(${Object(H.X)(t.scaleName(e))})`}const $B="_scale_trigger";var GB={signals:(t,e)=>{const n=e.name,r=n+cU+qB,i=VB.has(e),o=[],a=[],s=[];if(e.translate&&!i){const t=`!event.item || event.item.mark.name !== ${Object(H.X)(n+"_brush")}`;XB(e,(e,n)=>{const r=n.between[0].filter||(n.between[0].filter=[]);r.indexOf(t)<0&&r.push(t)})}for(const n of e.project){const r=n.channel;if(r!==HD&&r!==$D){VR("Interval selections only support x and y encoding channels.");continue}const i=KB(t,e,r),u=yU(e,r,"data"),c=yU(e,r,"visual"),l=Object(H.X)(t.scaleName(r)),f=kz(t.getScaleComponent(r).get("type"))?"+":"";o.push(...i),a.push(u),s.push({scaleName:t.scaleName(r),expr:`(!isArray(${u}) || `+`(${f}invert(${l}, ${c})[0] === ${f}${u}[0] && `+`${f}invert(${l}, ${c})[1] === ${f}${u}[1]))`})}return i||o.push({name:n+$B,update:s.map(t=>t.expr).join(" && ")+` ? ${n+$B} : {}`}),o.concat({name:n+cU,on:[{events:a.map(t=>({signal:t})),update:a.join(" && ")+` ? {unit: ${vU(t)}, fields: ${r}, `+`values: [${a.join(", ")}]} : null`}]})},modifyExpr:(t,e)=>e.name+cU+", "+("global"===e.resolve?"true":`{unit: ${vU(t)}}`),marks:(t,e,n)=>{const r=e.name,{xi:i,yi:o}=wU(e),a=`data(${Object(H.X)(e.name+uU)})`;if(VB.has(e))return n;const s={x:null!==i?{signal:`${r}_x[0]`}:{value:0},y:null!==o?{signal:`${r}_y[0]`}:{value:0},x2:null!==i?{signal:`${r}_x[1]`}:{field:{group:"width"}},y2:null!==o?{signal:`${r}_y[1]`}:{field:{group:"height"}}};if("global"===e.resolve)for(const e of lD(s))s[e]=[Object.assign({test:`${a}.length && ${a}[0].unit === ${vU(t)}`},s[e]),{value:0}];const u=e.mark,{fill:c,fillOpacity:l}=u,f=B(u,["fill","fillOpacity"]),d=lD(f).reduce((t,e)=>(t[e]=[{test:[null!==i&&`${r}_x[0] !== ${r}_x[1]`,null!=o&&`${r}_y[0] !== ${r}_y[1]`].filter(t=>t).join(" && "),value:f[e]},{value:null}],t),{});return[{name:r+"_brush_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:l}},update:s}}].concat(n,{name:r+"_brush",type:"rect",clip:!0,encode:{enter:{fill:{value:"transparent"}},update:Object.assign({},s,d)}})}};function KB(t,e,n){const r=yU(e,n,"visual"),i=yU(e,n,"data"),o=VB.has(e),a=t.scaleName(n),s=Object(H.X)(a),u=t.getScaleComponent(n),c=u?u.get("type"):void 0,l=t.getSizeSignalRef(n===HD?"width":"height").signal,f=`${n}(unit)`,d=XB(e,(t,e)=>t.concat({events:e.between[0],update:`[${f}, ${f}]`},{events:e,update:`[${r}[0], clamp(${f}, 0, ${l})]`}));return d.push({events:{signal:e.name+$B},update:kz(c)&&!_z(c)?`[scale(${s}, ${i}[0]), scale(${s}, ${i}[1])]`:"[0, 0]"}),o?[{name:i,on:[]}]:[{name:r,value:[],on:d},{name:i,on:[{events:{signal:r},update:`${r}[0] === ${r}[1] ? null : invert(${s}, ${r})`}]}]}function XB(t,e){return t.events.reduce((t,n)=>n.between?e(t,n):(VR(`${n} is not an ordered event stream for interval selections`),t),[])}function YB(t,e){const n=e.name,r=n+cU+qB,i="(item().isVoronoi ? datum.datum : datum)",o=e.project.map(e=>{const n=t.fieldDef(e.channel);return n&&n.bin?`[${yD(t.vgField(e.channel,{}),i)}, `+`${yD(t.vgField(e.channel,{binSuffix:"end"}),i)}]`:`${yD(e.field,i)}`}).join(", ");return[{name:n+cU,value:{},on:[{events:e.events,update:"datum && item().mark.marktype !== 'group' ? "+`{unit: ${vU(t)}, fields: ${r}, values: [${o}]} : null`,force:!0}]}]}var JB={signals:YB,modifyExpr:(t,e)=>e.name+cU+", "+("global"===e.resolve?"null":`{unit: ${vU(t)}}`)},ZB={signals:YB,modifyExpr:(t,e)=>e.name+cU+", "+("global"===e.resolve?"true":`{unit: ${vU(t)}}`)},QB={has:t=>"interval"!==t.type&&t.nearest,marks:(t,e,n)=>{const{x:r,y:i}=wU(e),o=t.mark;if(MR(o))return VR(HR.nearestNotSupportForContinuous(o)),n;const a={name:t.getName("voronoi"),type:"path",from:{data:t.getName("marks")},encode:{enter:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}}},transform:[{type:"voronoi",x:{expr:r||!r&&!i?"datum.datum.x || 0":"0"},y:{expr:i||!r&&!i?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let s=0,u=!1;return n.forEach((e,n)=>{const r=e.name||"";r===t.component.mark[0].name?s=n:r.indexOf("voronoi")>=0&&(u=!0)}),u||n.splice(s+1,0,a),n}};const tU="_translate_anchor",eU="_translate_delta";function nU(t,e,n,r,i){const o=e.name,a=VB.has(e),s=i.filter(t=>t.name===yU(e,n,a?"data":"visual"))[0],u=o+tU,c=o+eU,l=t.getSizeSignalRef(r).signal,f=t.getScaleComponent(n),d=f.get("type"),h=`${u}.extent_${n}`,p=`${a?"log"===d?"panLog":"pow"===d?"panPow":"panLinear":"panLinear"}(${h}, ${`${a&&n===HD?"-":""}${c}.${n} / `+(a?`${l}`:`span(${h})`)}`+(a&&"pow"===d?`, ${f.get("exponent")||1}`:"")+")";s.on.push({events:{signal:c},update:a?p:`clampRange(${p}, 0, ${l})`})}const rU="_zoom_anchor",iU="_zoom_delta";function oU(t,e,n,r,i){const o=e.name,a=VB.has(e),s=i.filter(t=>t.name===yU(e,n,a?"data":"visual"))[0],u=t.getSizeSignalRef(r).signal,c=t.getScaleComponent(n),l=c.get("type"),f=a?HB(t,n):s.name,d=o+iU,h=`${a?"log"===l?"zoomLog":"pow"===l?"zoomPow":"zoomLinear":"zoomLinear"}(${f}, ${`${o}${rU}.${n}`}, ${d}`+(a&&"pow"===l?`, ${c.get("exponent")||1}`:"")+")";s.on.push({events:{signal:d},update:a?h:`clampRange(${h}, 0, ${u})`})}const aU={project:{has:t=>{const e=t;return void 0!==e.fields||void 0!==e.encodings},parse:(t,e,n)=>{const r={},i={},o=n.project||(n.project=[]);n.fields={},e.fields&&o.push(...e.fields.map(t=>({field:t,type:"E"})));for(const a of e.encodings||[]){const e=t.fieldDef(a);if(e){let s=e.field;if(e.timeUnit&&(r[s=t.vgField(a)]={as:s,field:e.field,timeUnit:e.timeUnit}),!i[s]){let r="E";if("interval"===n.type){const e=t.getScaleComponent(a).get("type");kz(e)&&!_z(e)&&(r="R")}else e.bin&&(r="R-RE");o.push(i[s]={field:s,channel:a,type:r})}n.fields[a]=s}else VR(HR.cannotProjectOnChannelWithoutField(a))}lD(r).length&&(n.timeUnit=new WB(null,r))},signals:(t,e,n)=>{const r=e.name+cU+qB;return n.filter(t=>t.name===r).length?n:n.concat({name:r,update:`${JSON.stringify(e.project)}`})}},toggle:{has:t=>"multi"===t.type&&t.toggle,signals:(t,e,n)=>n.concat({name:e.name+"_toggle",value:!1,on:[{events:e.events,update:e.toggle}]}),modifyExpr:(t,e,n)=>{const r=e.name+cU,i=e.name+"_toggle";return`${i} ? null : ${r}, `+("global"===e.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${vU(t)}}, `)+`${i} ? ${r} : null`}},scales:VB,translate:{has:t=>"interval"===t.type&&t.translate,signals:(t,e,n)=>{const r=e.name,i=VB.has(e),o=r+tU,{x:a,y:s}=wU(e);let u=SM(e.translate,"scope");return i||(u=u.map(t=>(t.between[0].markname=r+"_brush",t))),n.push({name:o,value:{},on:[{events:u.map(t=>t.between[0]),update:"{x: x(unit), y: y(unit)"+(null!==a?", extent_x: "+(i?HB(t,HD):`slice(${yU(e,"x","visual")})`):"")+(null!==s?", extent_y: "+(i?HB(t,$D):`slice(${yU(e,"y","visual")})`):"")+"}"}]},{name:r+eU,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),null!==a&&nU(t,e,HD,"width",n),null!==s&&nU(t,e,$D,"height",n),n}},zoom:{has:t=>"interval"===t.type&&t.zoom,signals:(t,e,n)=>{const r=e.name,i=VB.has(e),o=r+iU,{x:a,y:s}=wU(e),u=Object(H.X)(t.scaleName(HD)),c=Object(H.X)(t.scaleName($D));let l=SM(e.zoom,"scope");return i||(l=l.map(t=>(t.markname=r+"_brush",t))),n.push({name:r+rU,on:[{events:l,update:i?"{"+[u?`x: invert(${u}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter(t=>!!t).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:l,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),null!==a&&oU(t,e,"x","width",n),null!==s&&oU(t,e,"y","height",n),n}},inputs:{has:t=>"single"===t.type&&"global"===t.resolve&&t.bind&&"scales"!==t.bind,topLevelSignals:(t,e,n)=>{const r=e.name,i=e.project,o=e.bind,a=QB.has(e)?"(item().isVoronoi ? datum.datum : datum)":"datum";for(const t of i){const i=mD(`${r}_${t.field}`);n.filter(t=>t.name===i).length||n.unshift({name:i,value:"",on:[{events:e.events,update:`datum && item().mark.marktype !== 'group' ? ${yD(t.field,a)} : null`}],bind:o[t.field]||o[t.channel]||o})}return n},signals:(t,e,n)=>{const r=e.name,i=e.project,o=n.filter(t=>t.name===r+cU)[0],a=r+cU+qB,s=i.map(t=>mD(`${r}_${t.field}`)),u=s.map(t=>`${t} !== null`).join(" && ");return s.length&&(o.update=`${u} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},nearest:QB};function sU(t,e){for(const n in aU)aU[n].has(t)&&e(aU[n])}const uU="_store",cU="_tuple",lU="_modify",fU="_selection_domain_",dU="vlSelectionResolve";function hU(t,e){return mU(t,(n,r)=>{e=r.marks?r.marks(t,n,e):e,sU(n,r=>{r.marks&&(e=r.marks(t,n,e))})}),e}function pU(t,e,n){const r=[],i=gD(e,function(e){const i=mD(e),o=t.getSelectionComponent(i,e),a=Object(H.X)(i+uU);if(o.timeUnit){const e=n||t.component.data.raw,r=o.timeUnit.clone();e.parent?r.insertAsParentOf(e):e.parent=r}return"none"!==o.empty&&r.push(a),`vlSelectionTest(${a}, datum`+("global"===o.resolve?")":`, ${Object(H.X)(o.resolve)})`)});return(r.length?"!("+r.map(t=>`length(data(${t}))`).join(" || ")+") || ":"")+`(${i})`}function mU(t,e){const n=t.component.selection;for(const t in n)if(n.hasOwnProperty(t)){const r=n[t];e(r,gU(r.type))}}function gU(t){switch(t){case"single":return ZB;case"multi":return JB;case"interval":return GB}return null}function vU(t){let e=Object(H.X)(t.name);const n=function(t){let e=t.parent;for(;e&&!pq(e);)e=e.parent;return e}(t);return n&&(e+=(n.facet.row?` + '_' + (${yD(n.vgField("row"),"facet")})`:"")+(n.facet.column?` + '_' + (${yD(n.vgField("column"),"facet")})`:"")),e}function bU(t){let e=!1;return mU(t,t=>{e=e||t.project.some(t=>t.field===Vz)}),e}function yU(t,e,n){const r=t._signalNames||(t._signalNames={});if(r[e]&&r[e][n])return r[e][n];r[e]=r[e]||{};const i=mD(t.name+"_"+("visual"===n?e:t.fields[e]));let o=i,a=1;for(;r[o];)o=`${i}_${a++}`;return r[o]=r[e][n]=o}function wU(t){let e=null,n=null,r=null,i=null;return t.project.forEach((t,o)=>{t.channel===HD?(e=t,n=o):t.channel===$D&&(r=t,i=o)}),{x:e,xi:n,y:r,yi:i}}function xU(t,e,n){return gD(e,e=>Object(H.H)(e)?e:e&&e.selection?pU(t,e.selection,n):UL(e))}function _U(t,e){const n=e[t+"Offset"];if(n)return n}function kU(t,e,n,r){return SU(t,e,{binSuffix:"start"===n?void 0:"end"},r?{offset:r}:{})}function SU(t,e,n,r){const i=Object.assign({},e?{scale:e}:{},{field:$F(t,n)});return r?Object.assign({},i,r):i}function EU(t,e=!0){return{scale:t,band:e}}function OU(t,e,n){return{signal:`scale("${t}", (${$F(e,{expr:"datum"})} + ${void 0!==n?$F(n,{expr:"datum"}):$F(e,{binSuffix:"end",expr:"datum"})}) / 2)`}}function AU(t,e,n,r,i,o,a){if(e){if(zF(e)){if(LF(e)){if(lR(e.bin))return GI([HD,$D],t)&&e.type===EF?o&&o.impute?SU(e,r,{binSuffix:"mid"}):OU(r,e):SU(e,r,bP(e,t)?{binSuffix:"range"}:{});if(fR(e.bin)){if(zF(n))return OU(r,e,n);{const e=t===HD?GD:KD;VR(HR.channelRequiredForBinned(e))}}}if(i){const t=i.get("type");if(xz(t))return"band"===t?SU(e,r,{binSuffix:"range"},{band:.5}):SU(e,r,{binSuffix:"range"})}return SU(e,r,{})}if(UF(e)){const n=e.value;return GI(["x","x2"],t)&&"width"===n?{field:{group:"width"}}:GI(["y","y2"],t)&&"height"===n?{field:{group:"height"}}:{value:n}}}return Object(H.D)(a)?a():a}function CU(t,e){const n=[],r={};function i(i,o){const a=Tj(o);o!==a&&(i=Object.assign({},i,{type:t[a].type}));const s=nP(i,e,{allowDisabling:!1}),u=MU(i,e).signal;r[s]||n.push(`${Object(H.X)(s)}: ${u}`),r[s]=!0}return OP(t,(t,e)=>{zF(t)?i(t,e):FF(t)&&i(t.condition,e)}),n.length?{signal:`{${n.join(", ")}}`}:void 0}function MU(t,e){if(t){if(UF(t))return{value:t.value};if(LF(t))return gB(t,oP(t),"datum",e)}}function NU(t){return Object.assign({},t,{mult:.5})}function TU(t,e,n,r,i){return()=>{if(Object(H.H)(t)){if(n){const t=r.get("type");if(GI([oz.LOG,oz.TIME,oz.UTC],t))"bar"!==i&&"area"!==i||VR(HR.nonZeroScaleUsedWithLengthMark(i,e,{scaleType:t}));else{if(function(t){if(!1!==t.get("zero"))return!0;const e=t.domains;return!!Object(H.A)(e)&&YI(e,t=>Object(H.A)(t)&&2===t.length&&t[0]<=0&&t[1]>=0)}(r))return{scale:n,value:0};"bar"!==i&&"area"!==i||VR(HR.nonZeroScaleUsedWithLengthMark(i,e,{zeroFalse:!1===r.explicit.zero}))}}return"zeroOrMin"===t?"x"===e?{value:0}:{field:{group:"height"}}:"x"===e?{field:{group:"width"}}:{value:0}}return t}}function IU(t){return"transparent"!==t&&null!==t&&void 0!==t}function DU(t){const{markDef:e,encoding:n,config:r}=t,{filled:i,type:o}=e,a={fill:pB("fill",e,r),stroke:pB("stroke",e,r),color:pB("color",e,r)},s=GI(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,u=SD(e.fill,a.fill,s),c=SD(e.stroke,a.stroke),l=i?"fill":"stroke",f=Object.assign({},u?{fill:{value:u}}:{},c?{stroke:{value:c}}:{});return n.fill||n.stroke?(e.color&&VR(HR.droppingColor("property",{fill:"fill"in n,stroke:"stroke"in n})),Object.assign({},zU("fill",t,{defaultValue:SD(u,s)}),zU("stroke",t,{defaultValue:c}))):n.color?Object.assign({},f,zU("color",t,{vgChannel:l,defaultValue:SD(e[l],e.color,a[l],a.color,i?s:void 0)})):IU(e.fill)||IU(e.stroke)?(e.color&&VR(HR.droppingColor("property",{fill:"fill"in e,stroke:"stroke"in e})),f):e.color?Object.assign({},f,{[l]:{value:e.color}}):IU(a.fill)||IU(a.stroke)?f:a.color?Object.assign({},s?{fill:{value:"transparent"}}:{},{[l]:{value:a.color}}):{}}function jU(t,e){const{fill:n,stroke:r}=DU(t);return Object.assign({},function(t,e){return fB.reduce((n,r)=>(void 0!==t[r]&&"ignore"!==e[r]&&(n[r]={value:t[r]}),n),{})}(t.markDef,e),RU(t,"fill",n),RU(t,"stroke",r),zU("opacity",t),zU("fillOpacity",t),zU("strokeOpacity",t),zU("strokeWidth",t),function(t){const{encoding:e,markDef:n,config:r}=t,i=e.tooltip;return Object(H.A)(i)?{tooltip:CU({tooltip:i},r)}:LU(t,i,"tooltip",i=>{const o=MU(i,t.config);if(o)return o;if(null===i)return;const a=SD(n.tooltip,pB("tooltip",n,r));return Object(H.H)(a)?{value:a}:Object(H.F)(a)?"encoding"===a.content?CU(e,r):{signal:"datum"}:void 0})}(t),BU(t,"href"))}function RU(t,e,n){const{config:r,mark:i}=t;if(r.invalidValues&&n&&!MR(i)){const r=FU(t,{invalid:!0,channels:oR});if(r)return{[e]:[{test:r,value:null},...Object(H.i)(n)]}}return n?{[e]:n}:{}}function FU(t,{invalid:e=!1,channels:n}){const r=n.reduce((e,n)=>{const r=t.getScaleComponent(n);if(r){const i=r.get("type"),o=t.vgField(n,{expr:"datum"});o&&kz(i)&&(e[o]=!0)}return e},{}),i=lD(r);if(i.length>0){const t=e?"||":"&&";return i.map(n=>`${n} ${e?"===":"!=="} null ${t} ${e?"":"!"}isNaN(${n})`).join(` ${t} `)}}function PU(t){if("filter"===t.config.invalidValues){const e=FU(t,{channels:["x","y"]});if(e)return{defined:{signal:e}}}return{}}function zU(t,e,n={}){const{markDef:r,encoding:i}=e,{vgChannel:o=t}=n,{defaultValue:a=r[o]}=n,s=n.defaultRef||(void 0!==a?{value:a}:void 0),u=i[t];return LU(e,u,o,n=>AU(t,n,void 0,e.scaleName(t),e.getScaleComponent(t),null,s))}function LU(t,e,n,r){const i=e&&e.condition,o=r(e);return i?{[n]:[...(Object(H.A)(i)?i:[i]).map(e=>{const n=r(e),i=TF(e)?pU(t,e.selection):xU(t,e.test);return Object.assign({test:i},n)}),...void 0!==o?[o]:[]]}:void 0!==o?{[n]:o}:{}}function BU(t,e="text"){const n=t.encoding[e];return LU(t,n,e,e=>MU(e,t.config))}function UU(t,e,n){const r=n.scaleName(e),i="x"===e?"width":"height";if(n.encoding.size||void 0!==n.markDef.size)if(n.markDef.orient){const o={[e+"c"]:SU(t,r,{},{band:.5})};if(uP(n.encoding.size))return Object.assign({},o,zU("size",n,{vgChannel:i}));if(UF(n.encoding.size))return Object.assign({},o,zU("size",n,{vgChannel:i}));if(void 0!==n.markDef.size)return Object.assign({},o,{[i]:{value:n.markDef.size}})}else VR(HR.cannotApplySizeToNonOrientedMark(n.markDef.type));return{[e]:SU(t,r,{binSuffix:"range"}),[i]:EU(r)}}function WU(t,e,n,r){const i="x"===t?"xc":"yc",o="x"===t?"width":"height";return Object.assign({},VU(t,e,n,i),zU("size",e,{defaultRef:r,vgChannel:o}))}function qU(t,e,n,r,i,o){const a={x:o?i:0,x2:o?0:i,y:o?0:i,y2:o?i:0},s=n===HD?GD:KD;return lR(t.bin)?{[s]:kU(t,r,"start",a[`${n}2`]),[n]:kU(t,r,"end",a[n])}:fR(t.bin)&&zF(e)?{[s]:SU(t,r,{},{offset:a[`${n}2`]}),[n]:SU(e,r,{},{offset:a[n]})}:void VR(HR.channelRequiredForBinned(s))}function VU(t,e,n,r){const{encoding:i,mark:o,stack:a}=e,s=i[t],u=i[t===HD?GD:KD],c=e.scaleName(t),l=e.getScaleComponent(t),f=_U(t,e.markDef),d=s||!i.latitude&&!i.longitude?Object.assign({},function(t,e,n,r,i,o,a){return zF(e)&&o&&t===o.fieldChannel?SU(e,r,{suffix:"end"}):AU(t,e,n,r,i,o,a)}(t,s,u,c,l,a,TU(n,t,c,l,o)),f?{offset:f}:{}):{field:e.getName(t)};return{[r||t]:d}}function HU(t,e,n){const{encoding:r,mark:i,stack:o}=t,a="x2"===n?"x":"y",s=r[a],u=t.scaleName(a),c=t.getScaleComponent(a),l=_U(n,t.markDef);return{[n]:s||!r.latitude&&!r.longitude?Object.assign({},function(t,e,n,r,i,o,a){return zF(e)&&o&&t.charAt(0)===o.fieldChannel.charAt(0)?SU(e,r,{suffix:"start"}):AU(t,n,void 0,r,i,o,a)}(n,s,r[n],u,c,o,TU(e,a,u,c,i)),l?{offset:l}:{}):{field:t.getName(n)}}}function $U(t,e){return lD(t).reduce((n,r)=>{const i=t[r];return Object.assign({},n,LU(e,i,r,t=>({value:t.value})))},{})}function GU(t,e){if(vq(e)||pq(e))return"shared";if(gq(e)||mq(e))return GI(Kj,t)?"independent":"shared";throw new Error("invalid model type for resolve")}function KU(t,e){const n=t.scale[e],r=GI(Kj,e)?"axis":"legend";return"independent"===n?("shared"===t[r][e]&&VR(HR.independentScaleMeansIndependentGuide(e)),"independent"):t[r][e]||"shared"}class XU{constructor(t={},e={}){this.explicit=t,this.implicit=e}clone(){return new XU(UI(this.explicit),UI(this.implicit))}combine(){return Object.assign({},this.explicit,this.implicit)}get(t){return SD(this.explicit[t],this.implicit[t])}getWithExplicit(t){return void 0!==this.explicit[t]?{explicit:!0,value:this.explicit[t]}:void 0!==this.implicit[t]?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,e){void 0!==e.value&&this.set(t,e.value,e.explicit)}set(t,e,n){return delete this[n?"implicit":"explicit"][t],this[n?"explicit":"implicit"][t]=e,this}copyKeyFromSplit(t,e){void 0!==e.explicit[t]?this.set(t,e.explicit[t],!0):void 0!==e.implicit[t]&&this.set(t,e.implicit[t],!1)}copyKeyFromObject(t,e){void 0!==e[t]&&this.set(t,e[t],!0)}copyAll(t){for(const e of lD(t.combine())){const n=t.getWithExplicit(e);this.setWithExplicit(e,n)}}}function YU(t){return{explicit:!0,value:t}}function JU(t){return{explicit:!1,value:t}}function ZU(t){return(e,n,r,i)=>{const o=t(e.value,n.value);return o>0?e:o<0?n:QU(e,n,r,i)}}function QU(t,e,n,r){return t.explicit&&e.explicit&&VR(HR.mergeConflictingProperty(n,r,t.value,e.value)),t}function tW(t,e,n,r,i=QU){return void 0===t||void 0===t.value?e:t.explicit&&!e.explicit?t:e.explicit&&!t.explicit?e:HI(t.value)===HI(e.value)?t:i(t,e,n,r)}class eW extends XU{}function nW(t){const{legend:e}=t;return SD(e.type,rW(t))}function rW({channel:t,timeUnit:e,scaleType:n,alwaysReturn:r}){if(kj(t)){if(GI(["quarter","month","day"],e))return"symbol";if(Sz(n))return r?"gradient":void 0}return r?"symbol":void 0}function iW({legend:t,legendConfig:e,timeUnit:n,channel:r,scaleType:i}){const o=SD(t.orient,e.orient,"right"),a=nW({legend:t,channel:r,timeUnit:n,scaleType:i,alwaysReturn:!0});return SD(t.direction,e[a?"gradientDirection":"symbolDirection"],function(t,e){switch(o){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===e?"horizontal":void 0}}(0,a))}function oW(t,e,n,r){return{signal:`clamp(${t.getSizeSignalRef(e).signal}, ${n}, ${r})`}}function aW(t,e,n){const r=e.getScaleComponent(n).get("type");return SD(t.get("type"),rW({channel:n,scaleType:r,alwaysReturn:!0}))}function sW(t,e,n,r,i){if("symbol"!==aW(i,n,r))return;let o=Object.assign({},function(t,e,n){for(const r of n){const n=pB(r,e.markDef,e.config);void 0!==n&&(t[r]={value:n})}return t}({},n,FR),DU(n));switch(n.mark){case gR:case wR:case yR:o.shape={value:"square"};break;case ER:case OR:o.shape={value:n.mark}}const{markDef:a,encoding:s}=n,u=a.filled,c=lW(s.opacity)||a.opacity;if(o.fill)if("fill"===r||u&&r===sj)delete o.fill;else if(o.fill.field)i.get("symbolFillColor")?delete o.fill:(o.fill={value:"black"},o.fillOpacity={value:c||1});else if(Object(H.A)(o.fill)){const t=fW(s.fill||s.color)||a.fill||u&&a.color;t&&(o.fill={value:t})}if(o.stroke)if("stroke"===r||!u&&r===sj)delete o.stroke;else if(o.stroke.field)delete o.stroke;else if(Object(H.A)(o.stroke)){const t=SD(fW(s.stroke||s.color),a.stroke,u?a.color:void 0);t&&(o.stroke={value:t})}if(r!==oj){const t=fW(s.shape)||a.shape;t&&(o.shape={value:t})}return r!==pj&&c&&(o.opacity={value:c}),o=Object.assign({},o,e),lD(o).length>0?o:void 0}function uW(t,e,n,r,i){if("gradient"!==aW(i,n,r))return;let o={};const a=lW(n.encoding.opacity)||n.markDef.opacity;return a&&(o.opacity={value:a}),o=Object.assign({},o,e),lD(o).length>0?o:void 0}function cW(t,e,n,r,i){const o=n.legend(r),a=n.config;let s={};if(mP(t)){const i=n.getScaleComponent(r).get("type")===oz.UTC,s=xB("datum.value",t.timeUnit,o.format,a.legend.shortTimeLabels,a.timeFormat,i);e=Object.assign({},s?{text:{signal:s}}:{},e)}return s=Object.assign({},s,e),lD(s).length>0?s:void 0}function lW(t){return dW(t,(t,e)=>Math.max(t,e.value))}function fW(t){return dW(t,(t,e)=>SD(t,e.value))}function dW(t,e){return PF(t)?(Object(H.A)(t.condition)?t.condition:[t.condition]).reduce(e,t.value):UF(t)?t.value:void 0}function hW(t,e,n,r){switch(e){case"values":return!!n.values;case"title":if("title"===e&&t===r.title)return!0}return t===n[e]}function pW(t,e,n,r){const{encoding:i}=r,o=uP(i[n]),a=r.config.legend,{timeUnit:s}=o,u=r.getScaleComponent(n).get("type");switch(t){case"format":return vB(o,e.format,r.config);case"title":return nP(o,r.config,{allowDisabling:!0})||void 0;case"type":return nW({legend:e,channel:n,timeUnit:s,scaleType:u,alwaysReturn:!1});case"direction":return iW({legend:e,legendConfig:a,timeUnit:s,channel:n,scaleType:u});case"labelOverlap":return SD(e.labelOverlap,function(t){if(GI(["quantile","threshold","log"],u))return"greedy"}());case"gradientLength":return SD(e.gradientLength,a.gradientLength,function({legend:t,legendConfig:e,model:n,channel:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:u}=e;if("horizontal"===iW({legend:t,legendConfig:e,channel:r,scaleType:i})){const r=SD(t.orient,e.orient);return"top"===r||"bottom"===r?oW(n,"width",a,o):a}return oW(n,"height",u,s)}({model:r,legend:e,legendConfig:a,channel:n,scaleType:u}));case"values":return function(t,e){const n=t.values;if(n)return vP(e,n)}(e,o)}return e[t]}function mW(t,e){if(!t)return e.clone();const n=t.getWithExplicit("orient"),r=e.getWithExplicit("orient");if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(const n of iz){const r=tW(t.getWithExplicit(n),e.getWithExplicit(n),n,"legend",(t,e)=>{switch(n){case"title":return EB(t,e);case"type":return i=!0,JU("symbol")}return QU(t,e,n,"legend")});t.setWithExplicit(n,r)}return i&&(((t.implicit||{}).encode||{}).gradient&&vD(t.implicit,["encode","gradient"]),((t.explicit||{}).encode||{}).gradient&&vD(t.explicit,["encode","gradient"])),t}function gW(t){const e=t.component.legends,n={};for(const r of lD(e)){const i=t.getScaleComponent(r),o=HI(i.domains);if(n[o])for(const t of n[o])mW(t,e[r])||n[o].push(e[r]);else n[o]=[e[r].clone()]}return ZI(fD(n)).map(t=>{const e=t.combine();if(e.encode&&e.encode.symbols){const t=e.encode.symbols.update;!t.fill||"transparent"===t.fill.value||t.stroke||e.stroke||(t.stroke={value:"transparent"})}return e})}function vW(t){const e=t.component.projection;if(!e||e.merged)return[];const n=e.combine(),{name:r}=n,i=B(n,["name"]),o={signal:`[${e.size.map(t=>t.signal).join(", ")}]`},a=e.data.reduce((e,n)=>{const r=n.signal?n.signal:`data('${t.lookupDataSource(n)}')`;return GI(e,r)||e.push(r),e},[]);if(a.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:r,size:o,fit:{signal:a.length>1?`[${a.join(", ")}]`:a[0]}},i)]}const bW=["type","clipAngle","clipExtent","center","rotate","precision","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class yW extends XU{constructor(t,e,n,r){super(Object.assign({},e),{name:t}),this.specifiedProjection=e,this.size=n,this.data=r,this.merged=!1}}class wW{constructor(t,e){this.expr=t,this.signalNames=e}static fromName(t){return new wW(t,[t])}map(t){return new wW(t(this.expr),this.signalNames)}}const xW=JA({globalvar:"global"});function _W(t,e){const n=lD(e),r=[];for(const i of n){const n=e[i];if(n instanceof wW){for(const t of n.signalNames)r.push(t);t=t.replace(WI(i),n.expr)}else t=t.replace(WI(i),Object(H.X)(n))}if(r.length>0)return new wW(t,r);try{const n=KA(t),{code:r}=xW(n);return new Function("global",`return ${r};`)(e)}catch(e){if(0===e.message.indexOf("Unrecognized function"))return new wW(t,[]);throw e}}function kW(t){for(const e of t){for(const t of e.children)if(t.parent!==e)return console.error("Dataflow graph is inconsistent.",parent,t),!1;if(!kW(e.children))return!1}return!0}class SW extends OB{constructor(t){super(null);const e=(t=t||{name:"source"}).format?Object.assign({},VI(t.format,["parse"])):{};if(nL(t))this._data={values:t.values};else if(eL(t)){if(this._data={url:t.url},!e.type){let n=/(?:\.([^.]+))?$/.exec(t.url)[1];GI(["json","csv","tsv","dsv","topojson"],n)||(n="json"),e.type=n}}else rL(t)&&(this._data={});t.name&&(this._name=t.name),e&&lD(e).length>0&&(this._data.format=e)}get data(){return this._data}hasName(){return!!this._name}get dataName(){return this._name}set dataName(t){this._name=t}set parent(t){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return Object.assign({name:this._name},this._data,{transform:[]})}}class EW{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class OW extends EW{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:t,mutatedFlag:e}){t&&this.setContinue(),e&&this.setMutated()}optimizeNextFromLeaves(t){if(t instanceof SW)return!1;const e=t.parent,{continueFlag:n}=this.run(t);return n&&this.optimizeNextFromLeaves(e),this.mutatedFlag}}class AW extends EW{}class CW extends OB{constructor(t,e,n){super(t),this.dimensions=e,this.measures=n}clone(){return new CW(null,new Set(this.dimensions),UI(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(t,e){let n=!1;e.forEachFieldDef(t=>{t.aggregate&&(n=!0)});const r={},i=new Set;return n?(e.forEachFieldDef((t,n)=>{const{aggregate:o,field:a}=t;o?"count"===o?(r["*"]=r["*"]||{},r["*"].count=new Set([$F(t,{forAs:!0})])):(r[a]=r[a]||{},r[a][o]=new Set([$F(t,{forAs:!0})]),aR(n)&&"unaggregated"===e.scaleDomain(n)&&(r[a].min=new Set([$F({field:a,aggregate:"min"},{forAs:!0})]),r[a].max=new Set([$F({field:a,aggregate:"max"},{forAs:!0})]))):function(t,e,n){LF(n)&&lR(n.bin)?(t.add($F(n,{})),t.add($F(n,{binSuffix:"end"})),bP(n,e)&&t.add($F(n,{binSuffix:"range"}))):t.add($F(n))}(i,n,t)}),i.size+lD(r).length===0?null:new CW(t,i,r)):null}static makeFromTransform(t,e){const n=new Set,r={};for(const t of e.aggregate){const{op:e,field:n,as:i}=t;e&&("count"===e?(r["*"]=r["*"]||{},r["*"].count=new Set([i||$F(t,{forAs:!0})])):(r[n]=r[n]||{},r[n][e]=new Set([i||$F(t,{forAs:!0})])))}for(const t of e.groupby||[])n.add(t);return n.size+lD(r).length===0?null:new CW(t,n,r)}merge(t){return iD(this.dimensions,t.dimensions)?(function(t,e){for(const n of lD(e)){const r=e[n];for(const e of lD(r))n in t?t[n][e]=new Set([...t[n][e]||[],...r[e]]):t[n]={[e]:r[e]}}}(this.measures,t.measures),!0):(function(...t){qR.debug.apply(qR,arguments)}("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...lD(this.measures)])}producedFields(){const t=new Set;for(const e of lD(this.measures))for(const n of lD(this.measures[e])){const r=this.measures[e][n];0===r.size?t.add(`${n}_${e}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${$I({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],e=[],n=[];for(const r of lD(this.measures))for(const i of lD(this.measures[r]))for(const o of this.measures[r][i])n.push(o),t.push(i),e.push(xD(r));return{type:"aggregate",groupby:[...this.dimensions],ops:t,fields:e,as:n}}}class MW extends OB{constructor(t,e,n,r){super(t),this.model=e,this.name=n,this.data=r;for(const t of[ij,rj]){const n=e.facet[t];if(n){const{bin:r,sort:i}=n;this[t]=Object.assign({name:e.getName(`${t}_domain`),fields:[$F(n),...lR(r)?[$F(n,{binSuffix:"end"})]:[]]},lL(i)?{sortField:i}:Object(H.A)(i)?{sortIndexField:NB(n,t)}:{})}}this.childModel=e.child}hash(){let t="Facet";return this.column&&(t+=` c:${$I(this.column)}`),this.row&&(t+=` r:${$I(this.row)}`),t}get fields(){return[...this.column&&this.column.fields||[],...this.row&&this.row.fields||[]]}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const e of["x","y"]){const n=this.childModel.component.scales[e];if(n&&!n.merged){const r=n.get("type"),i=n.get("range");if(xz(r)&&cB(i)){const n=XW(YW(this.childModel,e));n?t[e]=n:VR("Unknown field for ${channel}. Cannot calculate view size.")}}}return t}assembleRowColumnData(t,e,n){const r="row"===t?"y":"x",i=[],o=[],a=[];n[r]&&(e?(i.push(`distinct_${n[r]}`),o.push("max")):(i.push(n[r]),o.push("distinct")),a.push(`distinct_${n[r]}`));const{sortField:s,sortIndexField:u}=this[t];if(s){const{op:t,field:e}=s;i.push(e),o.push(t),a.push($F(s,{forAs:!0}))}else u&&(i.push(u),o.push("max"),a.push(u));return{name:this[t].name,source:e||this.data,transform:[Object.assign({type:"aggregate",groupby:this[t].fields},i.length?{fields:i,ops:o,as:a}:{})]}}assemble(){const t=[];let e=null;const n=this.getChildIndependentFieldsWithStep();if(this.column&&this.row&&(n.x||n.y)){e=`cross_${this.column.name}_${this.row.name}`;const r=[].concat(n.x?[n.x]:[],n.y?[n.y]:[]),i=r.map(()=>"distinct");t.push({name:e,source:this.data,transform:[{type:"aggregate",groupby:[...this.column.fields,...this.row.fields],fields:r,ops:i}]})}for(const r of[ij,rj])this[r]&&t.push(this.assembleRowColumnData(r,e,n));return t}}class NW extends OB{clone(){return new NW(null,UI(this._parse))}constructor(t,e){super(t),this._parse=e}hash(){return`Parse ${$I(this._parse)}`}static makeExplicit(t,e,n){let r={};const i=e.data;return i&&i.format&&i.format.parse&&(r=i.format.parse),this.makeWithAncestors(t,r,{},n)}static makeImplicitFromFilterTransform(t,e,n){const r={};return function t(e,n){if(LI(e))t(e.not,n);else if(zI(e))for(const r of e.and)t(r,n);else if(PI(e))for(const r of e.or)t(r,n);else n(e)}(e.filter,t=>{if(LL(t)){let e=null;IL(t)?e=t.equal:PL(t)?e=t.range[0]:zL(t)&&(e=(t.oneOf||t.in)[0]),e&&(GR(e)?r[t.field]="date":Object(H.E)(e)?r[t.field]="number":Object(H.H)(e)&&(r[t.field]="string")),t.timeUnit&&(r[t.field]="date")}}),0===lD(r).length?null:this.makeWithAncestors(t,{},r,n)}static makeImplicitFromEncoding(t,e,n){const r={};function i(t){mP(t)?r[t.field]="date":pP(t)&&DD(t.aggregate)?r[t.field]="number":kD(t.field)>1?t.field in r||(r[t.field]="flatten"):WF(t)&&lL(t.sort)&&kD(t.sort.field)>1&&(t.sort.field in r||(r[t.sort.field]="flatten"))}return(hq(e)||pq(e))&&e.forEachFieldDef((t,n)=>{if(LF(t))i(t);else{const r=Tj(n);if(r===n)throw new Error(`Non-secondary channel ${n} must have type in its field definition ${JSON.stringify(t)}`);{const n=e.fieldDef(r);i(Object.assign({},t,{type:n.type}))}}}),this.makeWithAncestors(t,{},r,n)}static makeWithAncestors(t,e,n,r){for(const t of lD(n)){const e=r.getWithExplicit(t);void 0!==e.value&&(e.explicit||e.value===n[t]||"derived"===e.value||"flatten"===n[t]?delete n[t]:VR(HR.differentParse(t,n[t],e.value)))}for(const t of lD(e)){const n=r.get(t);void 0!==n&&(n===e[t]?delete e[t]:VR(HR.differentParse(t,e[t],n)))}const i=new XU(e,n);r.copyAll(i);const o={};for(const t of lD(i.combine())){const e=i.get(t);null!==e&&(o[t]=e)}return 0===lD(o).length||r.parseNothing?null:new NW(t,o)}get parse(){return this._parse}merge(t){this._parse=Object.assign({},this._parse,t.parse),t.remove()}assembleFormatParse(){const t={};for(const e of lD(this._parse)){const n=this._parse[e];1===kD(e)&&(t[e]=n)}return t}producedFields(){return new Set(lD(this._parse))}dependentFields(){return new Set(lD(this._parse))}assembleTransforms(t=!1){return lD(this._parse).filter(e=>!t||kD(e)>1).map(t=>{const e=function(t,e){const n=yD(t);return"number"===e?`toNumber(${n})`:"boolean"===e?`toBoolean(${n})`:"string"===e?`toString(${n})`:"date"===e?`toDate(${n})`:"flatten"===e?n:0===e.indexOf("date:")?`timeParse(${n},${e.slice(5,e.length)})`:0===e.indexOf("utc:")?`utcParse(${n},${e.slice(4,e.length)})`:(VR(HR.unrecognizedParse(e)),null)}(t,this._parse[t]);return e?{type:"formula",expr:e,as:_D(t)}:null}).filter(t=>null!==t)}}class TW extends OB{clone(){return new TW(null,UI(this._stack))}constructor(t,e){super(t),this._stack=e}static makeFromTransform(t,e){const{stack:n,groupby:r,as:i,offset:o="zero"}=e,a=[],s=[];if(void 0!==e.sort)for(const t of e.sort)a.push(t.field),s.push(SD(t.order,"ascending"));const u={field:a,order:s};let c;return c=function(t){return Object(H.A)(t)&&t.every(t=>Object(H.H)(t))&&t.length>1}(i)?i:Object(H.H)(i)?[i,i+"_end"]:[e.stack+"_start",e.stack+"_end"],new TW(t,{stackField:n,groupby:r,offset:o,sort:u,facetby:[],as:c})}static makeFromEncoding(t,e){const n=e.stack,{encoding:r}=e;if(!n)return null;let i;n.groupbyChannel&&(i=uP(r[n.groupbyChannel]));const o=e.stack.stackBy.reduce((t,e)=>{const n=$F(e.fieldDef);return n&&t.push(n),t},[]),a=e.encoding.order;let s;return s=Object(H.A)(a)||zF(a)?_B(a):o.reduce((t,e)=>(t.field.push(e),t.order.push("descending"),t),{field:[],order:[]}),new TW(t,{dimensionFieldDef:i,stackField:e.vgField(n.fieldChannel),facetby:[],stackby:o,sort:s,offset:n.offset,impute:n.impute,as:[e.vgField(n.fieldChannel,{suffix:"start",forAs:!0}),e.vgField(n.fieldChannel,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby=this._stack.facetby.concat(t)}dependentFields(){const t=new Set;t.add(this._stack.stackField),this.getGroupbyFields().forEach(e=>t.add(e)),this._stack.facetby.forEach(e=>t.add(e));const e=this._stack.sort.field;return Object(H.A)(e)?e.forEach(e=>t.add(e)):t.add(e),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${$I(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:t,impute:e,groupby:n}=this._stack;return t?t.bin?e?[$F(t,{binSuffix:"mid"})]:[$F(t,{}),$F(t,{binSuffix:"end"})]:[$F(t)]:n||[]}assemble(){const t=[],{facetby:e,dimensionFieldDef:n,stackField:r,stackby:i,sort:o,offset:a,impute:s,as:u}=this._stack;return s&&n&&(n.bin&&t.push({type:"formula",expr:"("+$F(n,{expr:"datum"})+"+"+$F(n,{expr:"datum",binSuffix:"end"})+")/2",as:$F(n,{binSuffix:"mid",forAs:!0})}),t.push({type:"impute",field:r,groupby:[...i,...e],key:$F(n,{binSuffix:"mid"}),method:"value",value:0})),t.push({type:"stack",groupby:this.getGroupbyFields().concat(e),field:r,sort:o,as:u,offset:a}),t}}class IW extends OB{constructor(t,e){super(t),this.transform=e}clone(){return new IW(null,UI(this.transform))}addDimensions(t){this.transform.groupby=nD(this.transform.groupby.concat(t),t=>t)}dependentFields(){const t=new Set;return this.transform.groupby.forEach(e=>t.add(e)),this.transform.sort.forEach(e=>t.add(e.field)),this.transform.window.map(t=>t.field).filter(t=>void 0!==t).forEach(e=>t.add(e)),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as||$F(t)}hash(){return`WindowTransform ${$I(this.transform)}`}assemble(){const t=[],e=[],n=[],r=[];for(const i of this.transform.window)e.push(i.op),n.push(this.getDefaultName(i)),r.push(void 0===i.param?null:i.param),t.push(void 0===i.field?null:i.field);const i=this.transform.frame,o=this.transform.groupby,a=[],s=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),s.push(t.order||"ascending");const u={field:a,order:s},c=this.transform.ignorePeers,l={type:"window",params:r,as:n,ops:e,fields:t,sort:u};return void 0!==c&&(l.ignorePeers=c),void 0!==o&&(l.groupby=o),void 0!==i&&(l.frame=i),l}}class DW extends OW{run(t){const e=t.parent;if(t instanceof NW){if(e instanceof SW)return this.flags;if(e.numChildren()>1)return this.setContinue(),this.flags;if(e instanceof NW)this.setMutated(),e.merge(t);else{if(sD(e.producedFields(),t.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),t.swapWithParent()}}return this.setContinue(),this.flags}}class jW extends AW{mergeNodes(t,e){const n=e.shift();for(const r of e)t.removeChild(r),r.parent=n,r.remove()}run(t){const e=t.children.map(t=>t.hash()),n={};for(let r=0;r<e.length;r++)void 0===n[e[r]]?n[e[r]]=[t.children[r]]:n[e[r]].push(t.children[r]);for(const e of lD(n))n[e].length>1&&(this.setMutated(),this.mergeNodes(t,n[e]));for(const e of t.children)this.run(e);return this.mutatedFlag}}class RW extends OW{run(t){return t instanceof AB||t.numChildren()>0||t instanceof MW?this.flags:(this.setMutated(),t.remove(),this.flags)}}class FW extends OW{constructor(){super(...arguments),this.fields=new Set}run(t){if(this.setContinue(),t instanceof WB){const e=t.producedFields();oD(e,this.fields)?(this.setMutated(),t.remove()):this.fields=new Set([...this.fields,...e])}return this.flags}}function PW(t){if(t instanceof MW)if(1!==t.numChildren()||t.children[0]instanceof AB){const e=t.model.component.data.main;!function t(e){if(e instanceof AB&&e.type===iL&&1===e.numChildren()){const n=e.children[0];n instanceof MW||(n.swapWithParent(),t(e))}}(e);const n=function(t){return function e(n){if(!(n instanceof MW)){const r=n.clone();if(r instanceof AB){const e=UW+r.getSource();r.setSource(e),t.model.component.data.outputNodes[e]=r}else(r instanceof CW||r instanceof TW||r instanceof IW)&&r.addDimensions(t.fields);return ZI(n.children.map(e)).forEach(t=>t.parent=r),[r]}return ZI(n.children.map(e))}}(t),r=ZI(t.children.map(n));for(const t of r)t.parent=e}else{const e=t.children[0];(e instanceof CW||e instanceof TW||e instanceof IW)&&e.addDimensions(t.fields),e.swapWithParent(),PW(t)}else t.children.map(PW)}class zW extends AW{run(t){t instanceof AB&&!t.isRequired()&&(this.setMutated(),t.remove());for(const e of t.children)this.run(e);return this.mutatedFlag}}class LW extends OW{run(t){const e=t.parent,n=e.children.filter(t=>t instanceof NW);if(n.length>1){const t={};for(const e of n){const n=e.parse;for(const e of lD(n))void 0===t[e]?t[e]=n[e]:t[e]!==n[e]&&delete t[e]}if(0!==lD(t).length){this.setMutated();const r=new NW(e,t);for(const i of n){for(const e of lD(t))delete i.parse[e];e.removeChild(i),i.parent=r,0===lD(i.parse).length&&i.remove()}}}return this.setContinue(),this.flags}}class BW extends OW{run(t){const e=t.parent,n=e.children.filter(t=>t instanceof CW),r={};for(const t of n){const e=$I(lD(t.groupBy).sort());e in r||(r[e]=[]),r[e].push(t)}for(const t of lD(r)){const n=r[t];if(n.length>1){const t=n.pop();for(const r of n)t.merge(r)&&(e.removeChild(r),r.parent=t,r.remove(),this.setMutated())}}return this.setContinue(),this.flags}}const UW="scale_",WW=5;function qW(t){const e=[];return t.forEach(function t(n){0===n.numChildren()?e.push(n):n.children.forEach(t)}),e}function VW(t){return t}function HW(t,e,n){return e.map(e=>{const n=new t;return n instanceof OW?n.optimizeNextFromLeaves(e):n.run(e)}).some(VW)||n}function $W(t){let e=t.sources,n=!1;return n=HW(zW,e,n),e=e.filter(t=>t.numChildren()>0),n=HW(RW,qW(e),n),e=e.filter(t=>t.numChildren()>0),n=HW(DW,qW(e),n),n=HW(FW,qW(e),n),n=HW(LW,qW(e),n),n=HW(BW,qW(e),n),n=HW(jW,e,n),t.sources=e,n}function GW(t,e,n,r){const i=n.fieldDef(r);if(e&&"unaggregated"!==e&&!Cz(e)){const{type:t,timeUnit:n}=i;return"temporal"===t||n?function(t,e,n){return t.map(t=>({signal:`{data: ${gP(t,{timeUnit:n,type:e})}}`}))}(e,t,n):[e]}const o=n.stack;if(o&&r===o.fieldChannel){if("normalize"===o.offset)return[[0,1]];const t=n.requestDataName(iL);return[{data:t,field:n.vgField(r,{suffix:"start"})},{data:t,field:n.vgField(r,{suffix:"end"})}]}const a=aR(r)?function(t,e,n){if(!xz(n))return;const r=t.fieldDef(e),i=r.sort;return fL(i)?{op:"min",field:NB(r,e),order:"ascending"}:lL(i)?Object.assign({},i,i.field?{field:xD(i.field)}:{}):"descending"===i?{op:"min",field:t.vgField(e),order:"descending"}:!!GI(["ascending",void 0],i)||void 0}(n,r,t):void 0;if("unaggregated"===e){const t=n.requestDataName(iL),{field:e}=i;return[{data:t,field:$F({field:e,aggregate:"min"})},{data:t,field:$F({field:e,aggregate:"max"})}]}if(lR(i.bin)){if(_z(t)){const t=n.getName(`${cR(i.bin)}_${i.field}_bins`);return[{signal:`sequence(${t}.start, ${t}.stop + ${t}.step, ${t}.step)`}]}if(xz(t))return[{data:pD(a)?n.requestDataName(iL):n.requestDataName(oL),field:n.vgField(r,bP(i,r)?{binSuffix:"range"}:{}),sort:!0!==a&&lL(a)?a:{field:n.vgField(r,{}),op:"min"}}];if("x"===r||"y"===r){if(dR(i.bin)&&i.bin.extent)return[i.bin.extent];const t=n.requestDataName(iL);return[{data:t,field:n.vgField(r,{})},{data:t,field:n.vgField(r,{binSuffix:"end"})}]}return[{data:n.requestDataName(iL),field:n.vgField(r,{})}]}return a?[{data:pD(a)?n.requestDataName(iL):n.requestDataName(oL),field:n.vgField(r),sort:a}]:[{data:n.requestDataName(iL),field:n.vgField(r)}]}function KW(t,e){return t.aggregate?FD[t.aggregate]?"quantitative"===t.type&&"log"===e?{valid:!1,reason:HR.unaggregatedDomainWithLogScale(t)}:{valid:!0}:{valid:!1,reason:HR.unaggregateDomainWithNonSharedDomainOp(t.aggregate)}:{valid:!1,reason:HR.unaggregateDomainHasNoEffectForRawField(t)}}function XW(t){if(lB(t)&&Object(H.H)(t.field))return t.field;if(function(t){return!Object(H.A)(t)&&"fields"in t&&!("data"in t)}(t)){let e;for(const n of t.fields)if(lB(n)&&Object(H.H)(n.field))if(e){if(e!==n.field)return VR("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),e}else e=n.field;return VR("Detected faceted independent scales that union domain of identical fields from different source detected. We will assume that this is the same field from a different fork of the same data source. However, if this is not case, the result view size maybe incorrect."),e}if(function(t){return!Object(H.A)(t)&&"fields"in t&&"data"in t}(t)){VR("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const e=t.fields[0];return Object(H.H)(e)?e:void 0}}function YW(t,e){return function(t){const e=nD(t.map(t=>{if(lB(t)){const{sort:e}=t;return B(t,["sort"])}return t}),$I),n=nD(t.map(t=>{if(lB(t)){const e=t.sort;return void 0===e||pD(e)||("count"===e.op&&delete e.field,"ascending"===e.order&&delete e.order),e}}).filter(t=>void 0!==t),$I);if(1===e.length){const e=t[0];if(lB(e)&&n.length>0){let t=n[0];return n.length>1&&(VR(HR.MORE_THAN_ONE_SORT),t=!0),Object.assign({},e,{sort:t})}return e}const r=nD(n.map(t=>pD(t)?t:"count"===t.op?t:(VR(HR.domainSortDropped(t)),!0)),$I);let i;1===r.length?i=r[0]:r.length>1&&(VR(HR.MORE_THAN_ONE_SORT),i=!0);const o=nD(t.map(t=>lB(t)?t.data:null),t=>t);return 1===o.length&&null!==o[0]?Object.assign({data:o[0],fields:e.map(t=>t.field)},i?{sort:i}:{}):Object.assign({fields:e},i?{sort:i}:{})}(t.component.scales[e].domains.map(e=>(lB(e)&&(e.data=t.lookupDataSource(e.data)),e)))}function JW(t){return lD(t.component.scales).reduce((e,n)=>{const r=t.component.scales[n];if(r.merged)return e;const i=r.combine();let{domainRaw:o}=i;const{name:a,type:s,domainRaw:u,range:c}=i,l=B(i,["name","type","domainRaw","range"]),f=function(t,e,n,r){return t instanceof wW?ZW(t,n):Object(H.A)(t)?t.map(t=>t instanceof wW?ZW(t,n):t):"x"!==r&&"y"!==r||!cB(t)?t:{step:{signal:e+"_step"}}}(i.range,a,t,n);return o&&o.signal.indexOf(fU)>=0&&(o=function(t,e){const n=JSON.parse(e.signal.replace(fU,"")),r=mD(n.selection),i=n.encoding;let o=n.field,a=t.component.selection&&t.component.selection[r];if(!a){if(a=t.getSelectionComponent(r,n.selection),i||o){if(i&&!o){const t=a.project.filter(t=>t.channel===i);!t.length||t.length>1?(o=a.project[0].field,VR((t.length?"Multiple ":"No ")+`matching ${Object(H.X)(i)} encoding found for selection ${Object(H.X)(n.selection)}. `+`Using "field": ${Object(H.X)(o)}.`)):o=t[0].field}}else o=a.project[0].field,a.project.length>1&&VR('A "field" or "encoding" must be specified when using a selection as a scale domain. '+`Using "field": ${Object(H.X)(o)}.`);return{signal:yD(o,r)}}return VR('Use "bind": "scales" to setup a binding for scales and selections within the same view.'),{signal:"null"}}(t,o)),e.push(Object.assign({name:a,type:s,domain:YW(t,n)},o?{domainRaw:o}:{},{range:f},l)),e},[])}function ZW(t,e){let n=t.expr;for(const r of t.signalNames){const t=e.getSignalName(r);if(t!==r){const e=WI(r);n=n.replace(e,t)}}return{signal:n}}class QW extends XU{constructor(t,e){super({},{name:t}),this.merged=!1,this.domains=[],this.setWithExplicit("type",e)}}const tq=["range","rangeStep","scheme"];function eq(t){return"x"===t?"width":"y"===t?"height":void 0}function nq(t,e){const n=t.getScaleComponent(e);if(!n)return;const r=n.get("type"),i=t.fieldDef(e);if(xz(r)){const t=n&&n.get("range");if(t&&cB(t)&&Object(H.E)(t.step))return t.step}else if(i&&i.bin&&lR(i.bin)){const n=t.getName($F(i,{suffix:"bins"})),r=`(${n}.stop - ${n}.start) / ${n}.step`,o=eq(e),a=t.getName(o);return new wW(`${a} / (${r})`,[a,n])}}function rq(t){if(Az(t)){const e={scheme:t.name};return t.count&&(e.count=t.count),t.extent&&(e.extent=t.extent),e}return{scheme:t}}function iq(t,e,n,r){switch(t){case"quantile":return e.scale.quantileCount;case"quantize":return e.scale.quantizeCount;case"threshold":return void 0!==n&&Object(H.A)(n)?n.length+1:(VR(HR.domainRequiredForThresholdScale(r)),3)}}const oq=.95;function aq(t,e){if(t.length>0){const e=[],n=[];let r=1/0;for(const i of t)if(i instanceof wW){e.push(i.expr);for(const t of i.signalNames)n.push(t);r=void 0}else e.push(i),void 0!==r&&i<r&&(r=i);return void 0!==r?r:new wW(`min(${e.join(", ")})`,n)}return e.rangeStep?e.rangeStep:21}function sq(t,e){hq(t)?function(t,e){const n=t.component.scales;lD(n).forEach(r=>{const i=t.specifiedScales[r],o=n[r],a=t.getScaleComponent(r),s=t.fieldDef(r),u=t.config,c=i[e],l=a.get("type"),f=zz(l,e),d=Lz(r,e);if(void 0!==c&&(f?d&&VR(d):VR(HR.scalePropertyNotWorkWithScaleType(l,e,r))),f&&void 0===d)if(void 0!==c)o.copyKeyFromObject(e,i);else{const n=function(t,e,n,r,i,o,a,s,u){const c=u.scale;switch(t){case"interpolate":return function(t,e){if(GI([sj,uj,cj],t)&&Sz(e))return"hcl"}(e,r);case"nice":return function(t,e,n){if(!n.bin&&!GI([oz.TIME,oz.UTC],t))return!!GI([HD,$D],e)||void 0}(r,e,n);case"padding":return function(t,e,n,r,i,o){if(GI([HD,$D],t)){if(Sz(e)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:e,orient:a}=i;if("bar"===e&&!r.bin&&("vertical"===a&&"x"===t||"horizontal"===a&&"y"===t))return o.continuousBandSize}if(e===oz.POINT)return n.pointPadding}}(e,r,c,n,s,u.bar);case"paddingInner":return function(t,e,n,r){if(void 0===t&&GI([HD,$D],e)){const{bandPaddingInner:t,barBandPaddingInner:e,rectBandPaddingInner:i}=r;return SD(t,"bar"===n?e:i)}}(i,e,s.type,c);case"paddingOuter":return function(t,e,n,r,i,o){if(void 0===t&&GI([HD,$D],e)&&n===oz.BAND){const{bandPaddingOuter:t,barBandPaddingOuter:e,rectBandPaddingOuter:n}=o;return SD(t,"bar"===r?e:n,i/2)}}(i,e,r,s.type,o,c);case"reverse":return function(t,e){if(kz(t)&&"descending"===e)return!0}(r,n.sort);case"zero":return function(t,e,n,r,i){if(a&&"unaggregated"!==a)return!1;if("size"===t&&"quantitative"===e.type&&!Ez(i))return!0;if(!e.bin&&GI([HD,$D],t)){const{orient:e,type:n}=r;return!GI(["bar","area","line","trail"],n)||!("horizontal"===e&&"y"===t||"vertical"===e&&"x"===t)}return!1}(e,n,0,s,r)}return c[t]}(e,r,s,a.get("type"),a.get("padding"),a.get("paddingInner"),i.domain,t.markDef,u);void 0!==n&&o.set(e,n,!1)}})}(t,e):cq(t,e)}function uq(t){hq(t)?function(t){const e=t.component.scales;oR.forEach(n=>{const r=e[n];if(!r)return;const i=t.getScaleComponent(n),o=t.specifiedScales[n],a=t.fieldDef(n),s=eq(n);let u=s?!!t.component.layoutSize.get(s):void 0;const c=i.get("type"),l=GI(["point","band"],c)||!!o.rangeStep;s&&t.fit&&!u&&l&&(VR(HR.CANNOT_FIX_RANGE_STEP_WITH_FIT),u=!0);const f=function(t){const e=[];for(const n of Kj){const r=nq(t,n);void 0!==r&&e.push(r)}return e}(t),d=function(t,e,n,r,i,o,a,s,u,c){const l=s||null===r.rangeStep;for(const n of tq)if(void 0!==r[n]){const i=zz(e,n),o=Lz(t,n);if(i)if(o)VR(o);else switch(n){case"range":return YU(r[n]);case"scheme":return YU(rq(r[n]));case"rangeStep":const e=r[n];if(null!==e){if(!s)return YU({step:e});VR(HR.rangeStepDropped(t))}}else VR(HR.scalePropertyNotWorkWithScaleType(e,n,t))}return JU(function(t,e,n,r,i,o,a,s,u,c){switch(t){case HD:case $D:if(GI(["point","band"],e)&&!u)if(t===HD&&"text"===o){if(r.scale.textXRangeStep)return{step:r.scale.textXRangeStep}}else if(r.scale.rangeStep)return{step:r.scale.rangeStep};return t===$D&&kz(e)?[wW.fromName(a),0]:[0,wW.fromName(a)];case aj:const l=function(t,e,n){if(i)return 0;switch(t){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(HR.incompatibleChannel("size",t))}(o,0,r),f=function(t,e,n){const r=n.scale;switch(t){case"bar":case"tick":return void 0!==n.scale.maxBandSize?n.scale.maxBandSize:_W("min - 1",{min:aq(e,n.scale)});case"line":case"trail":case"rule":return n.scale.maxStrokeWidth;case"text":return n.scale.maxFontSize;case"point":case"square":case"circle":if(n.scale.maxSize)return n.scale.maxSize;const i=aq(e,r);return _W(`pow(${oq} * pointStep, 2)`,{pointStep:i})}throw new Error(HR.incompatibleChannel("size",t))}(o,s,r);return Ez(e)?function(t,e,n){const r="(rangeMax - rangeMin) / (cardinality - 1)";return _W(`sequence(rangeMin, rangeMax + ${r}, ${r})`,{rangeMin:t,rangeMax:e,cardinality:n})}(l,f,iq(e,r,c,t)):[l,f];case vj:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case oj:return"symbol";case sj:case uj:case cj:if("ordinal"===e)return"nominal"===n?"category":"ordinal";if(Ez(e)){const n=iq(e,r,c,t);return r.range&&Gz(r.range.ordinal)?Object.assign({},r.range.ordinal,{count:n}):{scheme:"blues",count:n}}return Sz(e)?["#f7fbff","#0e427f"]:"rect"===o||"geoshape"===o?"heatmap":"ramp";case pj:case mj:case gj:return[r.scale.minOpacity,r.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${t}`)}(t,e,n,i,o,a,u,c,l,r.domain))}(n,c,a.type,o,t.config,r.get("zero"),t.mark,u,t.getName(s),f);r.setWithExplicit("range",d)})}(t):cq(t,"range")}function cq(t,e){const n=t.component.scales;for(const n of t.children)"range"===e?uq(n):sq(n,e);lD(n).forEach(r=>{let i;for(const n of t.children){const t=n.component.scales[r];t&&(i=tW(i,t.getWithExplicit(e),e,"scale",ZU((t,n)=>{switch(e){case"range":return t.step&&n.step?t.step-n.step:0}return 0})))}n[r].setWithExplicit(e,i)})}function lq(t){hq(t)?t.component.scales=function(t){const{encoding:e,config:n,mark:r}=t;return oR.reduce((i,o)=>{let a,s;const u=e[o];if(zF(u)&&r===SR&&o===oj&&u.type===MF)return i;if(zF(u)?(a=u,s=u.scale):FF(u)&&(a=u.condition,s=u.condition.scale),a&&null!==s&&!1!==s){const e=function(t,e,n,r,i){const o=function(t,e,n,r,i){switch(e.type){case"nominal":case"ordinal":if(kj(t)||"discrete"===uR(t))return"shape"===t&&"ordinal"===e.type&&VR(HR.discreteChannelCannotEncode(t,"ordinal")),"ordinal";if(GI(["x","y"],t)){if(GI(["rect","bar","rule"],n))return"band";if("bar"===n)return"band"}return"point";case"temporal":return kj(t)?"time":"discrete"===uR(t)?(VR(HR.discreteChannelCannotEncode(t,"temporal")),"ordinal"):"time";case"quantitative":if(kj(t)){if(lR(e.bin))return"bin-ordinal";const{domain:t,range:n}=r||{};return t&&Object(H.A)(t)&&t.length>2&&n&&Object(H.A)(n)&&n.length>2?"linear":"sequential"}return"discrete"===uR(t)?(VR(HR.discreteChannelCannotEncode(t,"quantitative")),"ordinal"):lR(e.bin)&&"x"!==t&&"y"!==t?"bin-linear":"linear";case"geojson":return}throw new Error(HR.invalidFieldType(e.type))}(e,n,r,t),{type:a}=t;return aR(e)?void 0!==a?Uz(e,a)?Bz(a,n.type,n.bin)?a:(VR(HR.scaleTypeNotWorkWithFieldDef(a,o)),o):(VR(HR.scaleTypeNotWorkWithChannel(e,a,o)),o):o:null}(s=s||{},o,a,r,n.scale);i[o]=new QW(t.scaleName(o+"",!0),{value:e,explicit:s.type===e})}return i},{})}(t):t.component.scales=function(t){const e=t.component.scales={},n={},r=t.component.resolve;for(const e of t.children)lq(e),lD(e.component.scales).forEach(i=>{if(r.scale[i]=r.scale[i]||GU(i,t),"shared"===r.scale[i]){const t=n[i],o=e.component.scales[i].getWithExplicit("type");t?uz(t.value,o.value)?n[i]=tW(t,o,"type","scale",fq):(r.scale[i]="independent",delete n[i]):n[i]=o}});return lD(n).forEach(r=>{const i=t.scaleName(r,!0),o=n[r];e[r]=new QW(i,o);for(const e of t.children){const t=e.component.scales[r];t&&(e.renameScale(t.get("name"),i),t.merged=!0)}}),e}(t)}const fq=ZU((t,e)=>lz(t)-lz(e));class dq{constructor(){this.nameMap={}}rename(t,e){this.nameMap[t]=e}has(t){return void 0!==this.nameMap[t]}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function hq(t){return t&&"unit"===t.type}function pq(t){return t&&"facet"===t.type}function mq(t){return t&&"repeat"===t.type}function gq(t){return t&&"concat"===t.type}function vq(t){return t&&"layer"===t.type}class bq{constructor(t,e,n,r,i,o){this.children=[],this.correctDataNames=(t=>(t.from&&t.from.data&&(t.from.data=this.lookupDataSource(t.from.data)),t.from&&t.from.facet&&t.from.facet.data&&(t.from.facet.data=this.lookupDataSource(t.from.facet.data)),t)),this.parent=e,this.config=r,this.repeater=i,this.name=t.name||n,this.title=Object(H.H)(t.title)?{text:t.title}:t.title,this.scaleNameMap=e?e.scaleNameMap:new dq,this.projectionNameMap=e?e.projectionNameMap:new dq,this.signalNameMap=e?e.signalNameMap:new dq,this.data=t.data,this.description=t.description,this.transforms=nB(t.transform||[]),this.layout=AL(t)||wL(t)?void 0:function(t){const{align:e,center:n,bounds:r,spacing:i}=t||{};return{align:e,bounds:r,center:n,spacing:i}}(t),this.component={data:{sources:e?e.component.data.sources:[],outputNodes:e?e.component.data.outputNodes:{},outputNodeRefCounts:e?e.component.data.outputNodeRefCounts:{},isFaceted:QR(t)||e&&e.component.data.isFaceted&&!t.data},layoutSize:new XU,layoutHeaders:{row:{},column:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},o?UI(o):{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}initSize(t){const{width:e,height:n}=t;e&&this.component.layoutSize.set("width",e,!0),n&&this.component.layoutSize.set("height",n,!0)}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelection(),this.parseProjection(),this.parseData(),this.parseAxisAndHeader(),this.parseLegend(),this.parseMarkGroup()}parseScale(){!function(t){lq(t),function t(e){hq(e)?function(t){const e=t.specifiedScales,n=t.component.scales;lD(n).forEach(r=>{const i=e[r],o=i?i.domain:void 0,a=function(t,e){const n=t.getScaleComponent(e).get("type"),r=function(t,e,n,r){if("unaggregated"===t){const{valid:t,reason:r}=KW(e,n);if(!t)return void VR(r)}else if(void 0===t&&r.useUnaggregatedDomain){const{valid:t}=KW(e,n);if(t)return"unaggregated"}return t}(t.scaleDomain(e),t.fieldDef(e),n,t.config.scale);return r!==t.scaleDomain(e)&&(t.specifiedScales[e]=Object.assign({},t.specifiedScales[e],{domain:r})),"x"===e&&t.channelHasField("x2")?t.channelHasField("x")?GW(n,r,t,"x").concat(GW(n,r,t,"x2")):GW(n,r,t,"x2"):"y"===e&&t.channelHasField("y2")?t.channelHasField("y")?GW(n,r,t,"y").concat(GW(n,r,t,"y2")):GW(n,r,t,"y2"):GW(n,r,t,e)}(t,r),s=n[r];if(s.domains=a,Cz(o)&&s.set("domainRaw",{signal:fU+$I(o)},!0),t.component.data.isFaceted){let e=t;for(;!pq(e)&&e.parent;)e=e.parent;if("shared"===e.component.resolve.scale[r])for(const t of a)lB(t)&&(t.data=UW+t.data.replace(UW,""))}})}(e):function(e){for(const n of e.children)t(n);const n=e.component.scales;lD(n).forEach(t=>{let r,i=null;for(const n of e.children){const e=n.component.scales[t];if(e){r=void 0===r?e.domains:r.concat(e.domains);const t=e.get("domainRaw");i&&t&&i.signal!==t.signal&&VR("The same selection must be used to override scale domains in a layered view."),i=t}}n[t].domains=r,i&&n[t].set("domainRaw",i,!0)})}(e)}(t);for(const e of Fz)sq(t,e);uq(t)}(this)}parseProjection(){!function t(e){hq(e)?e.component.projection=function(t){const{specifiedProjection:e,config:n,hasProjection:r}=t;if(r){const r=[];return[[ej,QD],[nj,tj]].forEach(e=>{(t.channelHasField(e[0])||t.channelHasField(e[1]))&&r.push({signal:t.getName(`geojson_${r.length}`)})}),t.channelHasField(oj)&&t.fieldDef(oj).type===MF&&r.push({signal:t.getName(`geojson_${r.length}`)}),0===r.length&&r.push(t.requestDataName(iL)),new yW(t.projectionName(!0),Object.assign({},n.projection||{},e||{}),[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")],r)}}(e):e.component.projection=function(e){if(0===e.children.length)return;let n;const r=JI(e.children,e=>{t(e);const r=e.component.projection;if(r){if(n){const t=function(t,e){const n=JI(bW,n=>!t.explicit.hasOwnProperty(n)&&!e.explicit.hasOwnProperty(n)||!(!t.explicit.hasOwnProperty(n)||!e.explicit.hasOwnProperty(n)||HI(t.get(n))!==HI(e.get(n))));if(HI(t.size)===HI(e.size)){if(n)return t;if(HI(t.explicit)===HI({}))return e;if(HI(e.explicit)===HI({}))return t}return null}(n,r);return t&&(n=t),!!t}return n=r,!0}return!0});if(n&&r){const t=e.projectionName(!0),r=new yW(t,n.specifiedProjection,n.size,UI(n.data));return e.children.forEach(e=>{e.component.projection&&(r.data=r.data.concat(e.component.projection.data),e.renameProjection(e.component.projection.get("name"),t),e.component.projection.merged=!0)}),r}}(e)}(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegend(){!function t(e){hq(e)?e.component.legends=function(t){const{encoding:e}=t;return[sj,uj,cj,vj,aj,oj,pj,mj,gj].reduce((n,r)=>{const i=e[r];return!t.legend(r)||!t.getScaleComponent(r)||zF(i)&&r===oj&&i.type===MF||(n[r]=function(t,e){const n=t.fieldDef(e),r=t.legend(e),i=new eW({},function(t,e){switch(e){case sj:const n=t.scaleName(sj);return t.markDef.filled?{fill:n}:{stroke:n};case uj:case cj:case vj:case aj:case oj:case pj:case mj:case gj:return{[e]:t.scaleName(e)}}}(t,e));for(const o of rz){const a=pW(o,r,e,t);if(void 0!==a){const e=hW(a,o,r,n);(e||void 0===t.config.legend[o])&&i.set(o,a,e)}}const o=r.encoding||{},a=["labels","legend","title","symbols","gradient"].reduce((r,a)=>{const s=$U(o[a]||{},t),u=P[a]?P[a](n,s,t,e,i):s;return void 0!==u&&lD(u).length>0&&(r[a]={update:u}),r},{});return lD(a).length>0&&i.set("encode",a,!!r.encoding),i}(t,r)),n},{})}(e):e.component.legends=function(e){const{legends:n,resolve:r}=e.component;for(const i of e.children)t(i),lD(i.component.legends).forEach(t=>{r.legend[t]=KU(e.component.resolve,t),"shared"===r.legend[t]&&(n[t]=mW(n[t],i.component.legends[t]),n[t]||(r.legend[t]="independent",delete n[t]))});return lD(n).forEach(t=>{for(const n of e.children)n.component.legends[t]&&"shared"===r.legend[t]&&delete n.component.legends[t]}),n}(e)}(this)}assembleGroupStyle(){if("unit"===this.type||"layer"===this.type)return"cell"}assembleLayoutSize(){if("unit"===this.type||"layer"===this.type)return{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")}}assembleLayout(){if(!this.layout)return;const{align:t,bounds:e,center:n,spacing:r={}}=this.layout;return Object.assign({padding:Object(H.E)(r)?r:{row:r.row||10,column:r.column||10}},this.assembleDefaultLayout(),t?{align:t}:{},e?{bounds:e}:{},n?{center:n}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let e=[];for(const n of TB)t[n].title&&e.push(jB(this,n));for(const t of TB)e=e.concat(RB(this,t));return e}assembleAxes(){return function(t,e){const{x:n=[],y:r=[]}=t;return[...n.map(t=>dB(t,"main",e)),...n.map(t=>dB(t,"grid",e)),...r.map(t=>dB(t,"main",e)),...r.map(t=>dB(t,"grid",e))].filter(t=>t)}(this.component.axes,this.config)}assembleLegends(){return gW(this)}assembleProjections(){return function(t){return vq(t)||gq(t)||mq(t)?function(t){return t.children.reduce((t,e)=>t.concat(e.assembleProjections()),vW(t))}(t):vW(t)}(this)}assembleTitle(){const t=this.title||{},{encoding:e}=t,n=B(t,["encoding"]),r=Object.assign({},Hz(this.config.title).nonMark,n,e?{encode:{update:e}}:{});if(r.text)return GI(["unit","layer"],this.type)||(r.anchor&&"start"!==r.anchor&&VR(HR.cannotSetTitleAnchor(this.type)),r.anchor="start"),GI(["middle",void 0],r.anchor)&&void 0===r.frame&&(r.frame="group"),lD(r).length>0?r:void 0}assembleGroup(t=[]){const e={};(t=t.concat(this.assembleSelectionSignals())).length>0&&(e.signals=t);const n=this.assembleLayout();n&&(e.layout=n),e.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||pq(this.parent)?function t(e){return vq(e)||gq(e)||mq(e)?e.children.reduce((e,n)=>e.concat(t(n)),JW(e)):JW(e)}(this):[];r.length>0&&(e.scales=r);const i=this.assembleAxes();i.length>0&&(e.axes=i);const o=this.assembleLegends();return o.length>0&&(e.legends=o),e}hasDescendantWithFieldOnChannel(t){for(const e of this.children)if(hq(e)){if(e.channelHasField(t))return!0}else if(e.hasDescendantWithFieldOnChannel(t))return!0;return!1}getName(t){return mD((this.name?this.name+"_":"")+t)}requestDataName(t){const e=this.getName(t),n=this.component.data.outputNodeRefCounts;return n[e]=(n[e]||0)+1,e}getSizeSignalRef(t){if(pq(this.parent)){const e="width"===t?"x":"y",n=this.component.scales[e];if(n&&!n.merged){const t=n.get("type"),r=n.get("range");if(xz(t)&&cB(r)){const t=n.get("name"),r=XW(YW(this,e));return r?{signal:UB(t,n,$F({aggregate:"distinct",field:r},{expr:"datum"}))}:(VR("Unknown field for ${channel}. Cannot calculate view size."),null)}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const e=this.component.data.outputNodes[t];return e?e.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,e){this.signalNameMap.rename(t,e)}renameScale(t,e){this.scaleNameMap.rename(t,e)}renameProjection(t,e){this.projectionNameMap.rename(t,e)}scaleName(t,e){return e?this.getName(t):Mj(t)&&aR(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t))?this.scaleNameMap.get(this.getName(t)):void 0}projectionName(t){return t?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const e=this.component.scales[t];return e&&!e.merged?e:this.parent?this.parent.getScaleComponent(t):void 0}getSelectionComponent(t,e){let n=this.component.selection[t];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(t,e)),!n)throw new Error(HR.selectionNotFound(e));return n}}class yq extends bq{vgField(t,e={}){const n=this.fieldDef(t);if(n)return $F(n,e)}reduceFieldDef(t,e,n){return AP(this.getMapping(),(e,n,r)=>{const i=sP(n);return i?t(e,i,r):e},e,n)}forEachFieldDef(t,e){OP(this.getMapping(),(e,n)=>{const r=sP(e);r&&t(r,n)},e)}}function wq(t,e,n){let r;r=function(t){return"as"in t}(t)?Object(H.H)(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[$F(t,{forAs:!0}),$F(t,{binSuffix:"end",forAs:!0})];const i=fP(e,void 0)||{},o=function(t,e){return`${cR(t)}_${e}`}(i,t.field),{signal:a,extentSignal:s}=function(t,e){return{signal:t.getName(`${e}_bins`),extentSignal:t.getName(`${e}_extent`)}}(n,o);return{key:o,binComponent:Object.assign({bin:i,field:t.field,as:r},a?{signal:a}:{},s?{extentSignal:s}:{})}}class xq extends OB{constructor(t,e){super(t),this.bins=e}clone(){return new xq(null,UI(this.bins))}static makeFromEncoding(t,e){const n=e.reduceFieldDef((t,n,r)=>{if(LF(n)&&lR(n.bin)){const{key:i,binComponent:o}=wq(n,n.bin,e);t[i]=Object.assign({},o,t[i],function(t,e,n,r){if(bP(e,n)){const i=hq(t)&&(t.axis(n)||t.legend(n))||{},o=$F(e,{expr:"datum"}),a=$F(e,{expr:"datum",binSuffix:"end"});return{formulaAs:$F(e,{binSuffix:"range",forAs:!0}),formula:wB(o,a,i.format,r)}}return{}}(e,n,r,e.config))}return t},{});return 0===lD(n).length?null:new xq(t,n)}static makeFromTransform(t,e,n){const{key:r,binComponent:i}=wq(e,e.bin,n);return new xq(t,{[r]:i})}merge(t){this.bins=Object.assign({},this.bins,t.bins),t.remove()}producedFields(){return new Set(ZI(fD(this.bins).map(t=>t.as)))}dependentFields(){return new Set(fD(this.bins).map(t=>t.field))}hash(){return`Bin ${$I(this.bins)}`}assemble(){return ZI(fD(this.bins).map(t=>{const e=[],n=Object.assign({type:"bin",field:t.field,as:t.as,signal:t.signal},t.bin);return!t.bin.extent&&t.extentSignal&&(e.push({type:"extent",field:t.field,signal:t.extentSignal}),n.extent={signal:t.extentSignal}),e.push(n),t.formula&&e.push({type:"formula",expr:t.formula,as:t.formulaAs}),e}))}}class _q extends OB{constructor(t,e,n){super(t),this.model=e,this.filter=n,this.expr=xU(this.model,this.filter,this),this._dependentFields=CB(this.expr)}clone(){return new _q(null,this.model,UI(this.filter))}dependentFields(){return this._dependentFields}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}class kq extends OB{constructor(t,e){super(t),this.transform=e,this.transform=UI(e);const{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((t,e)=>r[e]||t)}clone(){return new kq(this.parent,UI(this.transform))}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${$I(this.transform)}`}assemble(){const{flatten:t,as:e}=this.transform;return{type:"flatten",fields:t,as:e}}}class Sq extends OB{constructor(t,e){super(t),this.transform=e,this.transform=UI(e);const n=this.transform.as||[void 0,void 0];this.transform.as=[n[0]||"key",n[1]||"value"]}clone(){return new Sq(null,UI(this.transform))}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${$I(this.transform)}`}assemble(){const{fold:t,as:e}=this.transform;return{type:"fold",fields:t,as:e}}}class Eq extends OB{constructor(t,e,n,r){super(t),this.fields=e,this.geojson=n,this.signal=r}clone(){return new Eq(null,UI(this.fields),this.geojson,this.signal)}static parseAll(t,e){let n=0;if([[ej,QD],[nj,tj]].forEach(r=>{const i=r.map(t=>e.channelHasField(t)?e.fieldDef(t).field:void 0);(i[0]||i[1])&&(t=new Eq(t,i,null,e.getName(`geojson_${n++}`)))}),e.channelHasField(oj)){const r=e.fieldDef(oj);r.type===MF&&(t=new Eq(t,null,r.field,e.getName(`geojson_${n++}`)))}return t}assemble(){return Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{},this.geojson?{geojson:this.geojson}:{},{signal:this.signal})}}class Oq extends OB{constructor(t,e,n,r){super(t),this.projection=e,this.fields=n,this.as=r}clone(){return new Oq(null,this.projection,UI(this.fields),UI(this.as))}static parseAll(t,e){return e.projectionName()?([[ej,QD],[nj,tj]].forEach(n=>{const r=n.map(t=>e.channelHasField(t)?e.fieldDef(t).field:void 0),i=n[0]===nj?"2":"";(r[0]||r[1])&&(t=new Oq(t,e.projectionName(),r,[e.getName("x"+i),e.getName("y"+i)]))}),t):t}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Aq extends OB{clone(){return new Aq(null)}constructor(t){super(t)}producedFields(){return new Set([Vz])}assemble(){return{type:"identifier",as:Vz}}}function Cq(t,e,n,r){if(void 0!==t.size)return{value:t.size};const i=pB("size",t,r,{skipGeneralMarkConfig:!0});if(void 0!==i)return{value:i};if(n){const t=n.get("type");if("point"!==t&&"band"!==t)return{value:r.bar.continuousBandSize};if(void 0!==r.bar.discreteBandSize)return{value:r.bar.discreteBandSize};if(t!==oz.POINT)return EU(e);{const t=n.get("range");if(cB(t)&&Object(H.E)(t.step))return{value:t.step-1};VR(HR.BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL)}}return{value:SD(r.bar.discreteBandSize,r.scale.rangeStep?r.scale.rangeStep-1:void 0,20)}}function Mq(t,e){const{config:n,markDef:r,width:i,height:o}=t;return Object.assign({},jU(t,{size:"include",orient:"ignore"}),VU("x",t,NU(i)),VU("y",t,NU(o)),zU("size",t,{defaultValue:pB("size",r,n)}),function(t,e,n){return n?{shape:{value:n}}:zU("shape",t,{defaultValue:pB("shape",t.markDef,e)})}(t,n,e))}const Nq={area:{vgMark:"area",encodeEntry:t=>Object.assign({},jU(t,{size:"ignore",orient:"include"}),VU("x",t,"zeroOrMin"),VU("y",t,"zeroOrMin"),HU(t,"zeroOrMin","horizontal"===t.markDef.orient?"x2":"y2"),PU(t))},bar:{vgMark:"rect",encodeEntry:t=>Object.assign({},jU(t,{size:"ignore",orient:"ignore"}),function(t){const{config:e,encoding:n,markDef:r,width:i}=t,o=r.orient,a=n.size,s=n.x,u=n.x2,c=t.scaleName(HD),l=t.getScaleComponent(HD);if(zF(s)&&fR(s.bin))return qU(s,u,HD,c,SD(r.binSpacing,e.bar.binSpacing),l.get("reverse"));if("horizontal"===o||u)return Object.assign({},VU("x",t,"zeroOrMin"),HU(t,"zeroOrMin","x2"));if(zF(s)){const n=l.get("type");if(lR(s.bin)&&!a&&!xz(n))return qU(s,void 0,HD,t.scaleName("x"),SD(r.binSpacing,e.bar.binSpacing),l.get("reverse"));if(n===oz.BAND)return UU(s,"x",t)}return WU("x",t,Object.assign({},NU(i)),Cq(r,c,l,e))}(t),function(t){const{config:e,encoding:n,height:r,markDef:i}=t,o=i.orient,a=n.size,s=n.y,u=n.y2,c=t.scaleName($D),l=t.getScaleComponent($D);if(zF(s)&&fR(s.bin))return qU(s,u,$D,c,SD(i.binSpacing,e.bar.binSpacing),l.get("reverse"));if("vertical"===o||u)return Object.assign({},VU("y",t,"zeroOrMin"),HU(t,"zeroOrMin","y2"));if(zF(s)){const n=l.get("type");if(lR(s.bin)&&!a&&!xz(n))return qU(s,void 0,$D,t.scaleName("y"),SD(i.binSpacing,e.bar.binSpacing),l.get("reverse"));if(n===oz.BAND)return UU(s,"y",t)}return WU("y",t,NU(r),Cq(i,c,l,e))}(t))},circle:{vgMark:"symbol",encodeEntry:t=>Mq(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>Object.assign({},jU(t,{size:"ignore",orient:"ignore"})),postEncodingTransform:t=>{const{encoding:e}=t,n=e.shape;return[Object.assign({type:"geoshape",projection:t.projectionName()},n&&zF(n)&&n.type===MF?{field:$F(n,{expr:"datum"})}:{})]}},line:{vgMark:"line",encodeEntry:t=>{const{width:e,height:n}=t;return Object.assign({},jU(t,{size:"ignore",orient:"ignore"}),VU("x",t,NU(e)),VU("y",t,NU(n)),zU("size",t,{vgChannel:"strokeWidth"}),PU(t))}},point:{vgMark:"symbol",encodeEntry:t=>Mq(t)},rect:{vgMark:"rect",encodeEntry:t=>Object.assign({},jU(t,{size:"ignore",orient:"ignore"}),function(t){const e=t.encoding.x,n=t.encoding.x2,r=t.getScaleComponent(HD),i=r?r.get("type"):void 0,o=t.scaleName(HD);if(zF(e)&&(lR(e.bin)||fR(e.bin)))return qU(e,n,HD,o,0,r.get("reverse"));if(zF(e)&&r&&xz(i)){if(i===oz.BAND)return UU(e,"x",t);throw new Error(HR.scaleTypeNotWorkWithMark(_R,i))}return Object.assign({},VU("x",t,"zeroOrMax"),HU(t,"zeroOrMin","x2"))}(t),function(t){const e=t.encoding.y,n=t.encoding.y2,r=t.getScaleComponent($D),i=r?r.get("type"):void 0,o=t.scaleName($D);if(zF(e)&&(lR(e.bin)||fR(e.bin)))return qU(e,n,$D,o,0,r.get("reverse"));if(zF(e)&&r&&xz(i)){if(i===oz.BAND)return UU(e,"y",t);throw new Error(HR.scaleTypeNotWorkWithMark(_R,i))}return Object.assign({},VU("y",t,"zeroOrMax"),HU(t,"zeroOrMin","y2"))}(t))},rule:{vgMark:"rule",encodeEntry:t=>{const{markDef:e,width:n,height:r}=t,i=e.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?Object.assign({},jU(t,{size:"ignore",orient:"ignore"}),VU("x",t,"horizontal"===i?"zeroOrMin":NU(n)),VU("y",t,"vertical"===i?"zeroOrMin":NU(r)),"vertical"!==i?HU(t,"zeroOrMax","x2"):{},"horizontal"!==i?HU(t,"zeroOrMax","y2"):{},zU("size",t,{vgChannel:"strokeWidth",defaultValue:e.size})):{}}},square:{vgMark:"symbol",encodeEntry:t=>Mq(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:e,encoding:n,width:r,height:i,markDef:o}=t,a=SD(o.fontSize,o.size,mB("fontSize",o,e.style),mB("size",o,e.style),e[o.type].fontSize,e[o.type].size);return Object.assign({},jU(t,{size:"ignore",orient:"ignore"}),VU("x",t,NU(r)),VU("y",t,NU(i)),BU(t),zU("size",t,{defaultValue:a,vgChannel:"fontSize"}),function(t,e){if(void 0!==e)return{align:{value:e}}}(0,function(t,e,n){if(void 0===(t.align||pB("align",t,n)))return"center"}(t.markDef,0,e)))}},tick:{vgMark:"rect",encodeEntry:t=>{const{config:e,markDef:n,width:r,height:i}=t,o=n.orient,a="horizontal"===o?"width":"height",s="horizontal"===o?"height":"width";return Object.assign({},jU(t,{size:"ignore",orient:"ignore"}),VU("x",t,NU(r),"xc"),VU("y",t,NU(i),"yc"),zU("size",t,{defaultValue:function(t){const{config:e,markDef:n}=t,r=n.orient,i=t.getScaleComponent("horizontal"===r?"x":"y");if(void 0!==n.size)return n.size;if(void 0!==e.tick.bandSize)return e.tick.bandSize;{const t=i?i.get("range"):void 0,n=t&&cB(t)?t.step:e.scale.rangeStep;if("number"!=typeof n)throw new Error("Function does not handle non-numeric rangeStep");return 3*n/4}}(t),vgChannel:a}),{[s]:{value:SD(n.thickness,e.tick.thickness)}})}},trail:{vgMark:"trail",encodeEntry:t=>{const{width:e,height:n}=t;return Object.assign({},jU(t,{size:"include",orient:"ignore"}),VU("x",t,NU(e)),VU("y",t,NU(n)),zU("size",t),PU(t))}}};const Tq="faceted_path_";function Iq(t,e={fromPrefix:""}){const n=t.mark,r=SD(t.markDef.clip,function(t){const e=t.getScaleComponent("x"),n=t.getScaleComponent("y");return!!(e&&e.get("domainRaw")||n&&n.get("domainRaw"))}(t)),i=hB(t.markDef),o=t.encoding.key,a=function(t){const{encoding:e,stack:n,mark:r,markDef:i}=t,o=e.order;if(Object(H.A)(o)||!UF(o)){if((Object(H.A)(o)||zF(o))&&!n)return _B(o,{expr:"datum"});if(MR(r)){const n=e["horizontal"===i.orient?"y":"x"];if(zF(n)){const e=n.sort;return{field:lL(e)?$F({aggregate:wP(t.encoding)?e.op:void 0,field:e.field},{expr:"datum"}):$F(n,{binSuffix:t.stack&&t.stack.impute?"mid":void 0,expr:"datum"}),order:"descending"}}}}}(t),s=Nq[n].postEncodingTransform?Nq[n].postEncodingTransform(t):null;return[Object.assign({name:t.getName("marks"),type:Nq[n].vgMark},r?{clip:!0}:{},i?{style:i}:{},o?{key:{field:o.field}}:{},a?{sort:a}:{},{from:{data:e.fromPrefix+t.requestDataName(iL)},encode:{update:Nq[n].encodeEntry(t)}},s?{transform:s}:{})]}function Dq(t,e){return lD(e).reduce((n,r)=>{switch(r){case"x":case"y":case"order":case"href":case"x2":case"y2":case"xError":case"yError":case"xError2":case"yError2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case"shape":case"tooltip":return n;case"detail":case"key":const i=e[r];return(Object(H.A)(i)||zF(i))&&(Object(H.A)(i)?i:[i]).forEach(t=>{t.aggregate||n.push($F(t,{}))}),n;case"size":if("trail"===t)return n;case"color":case"fill":case"stroke":case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":const o=uP(e[r]);return o&&!o.aggregate&&n.push($F(o,{})),n;default:throw new Error(`Bug: Channel ${r} unimplemented for line mark`)}},[])}class jq extends OB{constructor(t,e){super(t),this.transform=e}clone(){return new jq(null,UI(this.transform))}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:e=0,stop:n,step:r}=t;return{signal:`sequence(${[e,n,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,e){return new jq(t,e)}static makeFromEncoding(t,e){const n=e.encoding,r=n.x,i=n.y;if(zF(r)&&zF(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:s,value:u,frame:c,keyvals:l}=o.impute,f=Dq(e.mark,n);return new jq(t,Object.assign({impute:o.field,key:a.field},s?{method:s}:{},void 0!==u?{value:u}:{},c?{frame:c}:{},void 0!==l?{keyvals:l}:{},f.length?{groupby:f}:{}))}return null}hash(){return`Impute ${$I(this.transform)}`}assemble(){const{impute:t,key:e,keyvals:n,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform;let s;return[Object.assign({type:"impute",field:t,key:e},n?{keyvals:VL(n)?this.processSequence(n):n}:{},{method:"value"},i?{groupby:i}:{},{value:null}),...s=r&&"value"!==r?[Object.assign({type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:a,ignorePeers:!1},i?{groupby:i}:{}),{type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t}]:[{type:"formula",expr:`datum.${t} === null ? ${o} : datum.${t}`,as:t}]]}}class Rq extends XU{constructor(t={},e={},n=!1){super(t,e),this.explicit=t,this.implicit=e,this.parseNothing=n}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}class Fq extends OB{constructor(t,e,n){super(t),this.transform=e,this.secondary=n}clone(){return new Fq(null,UI(this.transform),this.secondary)}static make(t,e,n,r){const i=e.component.data.sources;let o=Yq(n.from.data,i);o||(o=new SW(n.from.data),i.push(o));const a=e.getName(`lookup_${r}`),s=new AB(o,a,"lookup",e.component.data.outputNodeRefCounts);return e.component.data.outputNodes[a]=s,new Fq(t,n,s.getSource())}producedFields(){return new Set(this.transform.from.fields||(this.transform.as instanceof Array?this.transform.as:[this.transform.as]))}hash(){return`Lookup ${$I({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t=Object.assign({values:this.transform.from.fields},this.transform.as?{as:this.transform.as instanceof Array?this.transform.as:[this.transform.as]}:{});else{let e=this.transform.as;Object(H.H)(e)||(VR(HR.NO_FIELDS_NEEDS_AS),e="_lookup"),t={as:[e]}}return Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},t,this.transform.default?{default:this.transform.default}:{})}}class Pq extends OB{constructor(t,e){super(t),this.transform=e}clone(){return new Pq(null,UI(this.transform))}hash(){return`SampleTransform ${$I(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function zq(t){let e=0;return function n(r,i){if(r instanceof SW&&!eL(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof NW&&(r.parent instanceof SW&&!i.source?(i.format=Object.assign({},i.format||{},{parse:r.assembleFormatParse()}),i.transform=i.transform.concat(r.assembleTransforms(!0))):i.transform=i.transform.concat(r.assembleTransforms())),r instanceof MW)return i.name||(i.name=`data_${e++}`),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void r.assemble().forEach(e=>t.push(e));switch((r instanceof _q||r instanceof MB||r instanceof Oq||r instanceof Eq||r instanceof CW||r instanceof Fq||r instanceof IW||r instanceof Sq||r instanceof kq||r instanceof Aq||r instanceof Pq)&&i.transform.push(r.assemble()),(r instanceof xq||r instanceof WB||r instanceof jq||r instanceof TW)&&(i.transform=i.transform.concat(r.assemble())),r instanceof AB&&(i.source&&0===i.transform.length?r.setSource(i.source):r.parent instanceof AB?r.setSource(i.name):(i.name||(i.name=`data_${e++}`),r.setSource(i.name),1===r.numChildren()&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof AB&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:n(r.children[0],i);break;default:i.name||(i.name=`data_${e++}`);let o=i.name;!i.source||i.transform.length>0?t.push(i):o=i.source,r.children.forEach(t=>{n(t,{name:null,source:o,transform:[]})})}}}function Lq(t){Uq(t);const e=t.component.layoutSize;e.setWithExplicit("width",Wq(t,"width")),e.setWithExplicit("height",Wq(t,"height"))}const Bq=Lq;function Uq(t){for(const e of t.children)e.parseLayoutSize()}function Wq(t,e){const n="width"===e?"x":"y",r=t.component.resolve;let i;for(const o of t.children){const t=o.component.layoutSize.getWithExplicit(e),a=r.scale[n];if("independent"===a&&"range-step"===t.value){i=void 0;break}if(i){if("independent"===a&&i.value!==t.value){i=void 0;break}i=tW(i,t,e,"")}else i=t}if(i){for(const n of t.children)t.renameSignal(n.getName(e),t.getName(e)),n.component.layoutSize.set(e,"merged",!1);return i}return{explicit:!1,value:void 0}}function qq(t,e){const n="width"===e?"x":"y",r=t.config,i=t.getScaleComponent(n);if(i){const t=i.get("type"),n=i.get("range");return xz(t)&&cB(n)?"range-step":r.view[e]}return t.hasProjection?r.view[e]:"width"===e&&"text"===t.mark?r.scale.textXRangeStep:r.scale.rangeStep||Oz.rangeStep}function Vq(t,e){return IF(t.field)?t.field.repeat in e?Object.assign({},t,{field:e[t.field.repeat]}):void VR(HR.noSuchRepeatedValue(t.field.repeat)):t}function Hq(t,e){if(void 0!==(t=Vq(t,e))){if(null===t)return null;if(jF(t)&&lL(t.sort)){const n=Vq(t.sort,e);t=Object.assign({},t,n?{sort:n}:{})}return t}}function $q(t,e){if(!zF(t)){if(FF(t)){const n=Hq(t.condition,e);if(n)return Object.assign({},t,{condition:n});{const{condition:e}=t;return B(t,["condition"])}}return t}{const n=Hq(t,e);if(n)return n;if(RF(t))return{condition:t.condition}}}function Gq(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r];if(Object(H.A)(i))n[r]=i.map(t=>$q(t,e)).filter(t=>t);else{const t=$q(i,e);void 0!==t&&(n[r]=t)}}return n}function Kq(t,e,n){return $F(e,Object.assign({suffix:`by_${$F(t)}`},n||{}))}class Xq extends yq{constructor(t,e,n,r,i){super(t,e,n,i,r,t.resolve),this.type="facet",this.child=lV(t.spec,this,this.getName("child"),void 0,r,i,!1),this.children=[this.child];const o=function(t,e){return Gq(t,r)}(t.facet);this.facet=this.initFacet(o)}initFacet(t){return AP(t,(t,e,n)=>GI([rj,ij],n)?void 0===e.field?(VR(HR.emptyFieldDef(e,n)),t):(t[n]=cP(e,n),t):(VR(HR.incompatibleChannel(n,"facet")),t),{})}channelHasField(t){return!!this.facet[t]}fieldDef(t){return this.facet[t]}parseData(){this.component.data=Jq(this),this.child.parseData()}parseLayoutSize(){Uq(this)}parseSelection(){this.child.parseSelection(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxisAndHeader(){this.child.parseAxisAndHeader(),this.parseHeader("column"),this.parseHeader("row"),this.mergeChildAxis("x"),this.mergeChildAxis("y")}parseHeader(t){if(this.channelHasField(t)){const e=this.facet[t];let n=nP(e,this.config,{allowDisabling:!0});this.child.component.layoutHeaders[t].title&&(n+=" / "+this.child.component.layoutHeaders[t].title,this.child.component.layoutHeaders[t].title=null),this.component.layoutHeaders[t]={title:n,facetFieldDef:e,header:[this.makeHeaderComponent(t,!0)]}}}makeHeaderComponent(t,e){const n="row"===t?"height":"width";return{labels:e,sizeSignal:this.child.component.layoutSize.get(n)?this.child.getSizeSignalRef(n):void 0,axes:[]}}mergeChildAxis(t){const{child:e}=this;if(e.component.axes[t]){const{layoutHeaders:n,resolve:r}=this.component;if(r.axis[t]=KU(r,t),"shared"===r.axis[t]){const r="x"===t?"column":"row",i=n[r];for(const n of e.component.axes[t]){const t=DB(n.get("orient"));i[t]=i[t]||[this.makeHeaderComponent(r,!1)];const e=dB(n,"main",this.config,{header:!0});i[t][0].axes.push(e),n.mainExtracted=!0}}}}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSelectionSignals(){return this.child.assembleSelectionSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};return["row","column"].forEach(e=>{["header","footer"].forEach(n=>{const r=this.component.layoutHeaders[e],i=r[n];if(i&&i[0]){const i="row"===e?"height":"width",o="header"===n?"headerBand":"footerBand";this.child.component.layoutSize.get(i)||(t[o]=t[o]||{},t[o][e]=.5),r.title&&(t.offset=t.offset||{},t.offset["row"===e?"rowTitle":"columnTitle"]=10)}})}),t}assembleDefaultLayout(){const t=this.channelHasField("column")?this.columnDistinctSignal():1;return Object.assign({},this.getHeaderLayoutMixins(),{columns:t,bounds:"full",align:"all"})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Xq))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroup(t){return this.parent&&this.parent instanceof Xq?Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:$F(this.facet.column,{prefix:"distinct"})}}}}:{},super.assembleGroup(t)):super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],e=[],n=[];if(this.child instanceof Xq){if(this.child.channelHasField("column")){const r=$F(this.child.facet.column);t.push(r),e.push("distinct"),n.push(`distinct_${r}`)}}else for(const r of["x","y"]){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(xz(o)&&cB(a)){const i=XW(YW(this.child,r));i?(t.push(i),e.push("distinct"),n.push(`distinct_${i}`)):VR("Unknown field for ${channel}. Cannot calculate view size.")}}}return{fields:t,ops:e,as:n}}assembleFacet(){const{name:t,data:e}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),s=[];["row","column"].forEach(t=>{const e=this.facet[t];if(e){s.push($F(e));const{sort:u}=e;if(lL(u)){const{field:t,op:s}=u,c=Kq(e,u);n&&r?(i.push(c),o.push("max"),a.push(c)):(i.push(t),o.push(s),a.push(c))}else if(Object(H.A)(u)){const n=NB(e,t);i.push(n),o.push("max"),a.push(n)}}});const u=!!n&&!!r;return Object.assign({name:t,data:e,groupby:s},u||i.length?{aggregate:Object.assign({},u?{cross:u}:{},i.length?{fields:i,ops:o,as:a}:{})}:{})}headerSortFields(t){const{facet:e}=this,n=e[t];return n?lL(n.sort)?[Kq(n,n.sort,{expr:"datum"})]:Object(H.A)(n.sort)?[NB(n,t,{expr:"datum"})]:[$F(n,{expr:"datum"})]:[]}headerSortOrder(t){const{facet:e}=this,n=e[t];if(n){const{sort:t}=n;return[(lL(t)?t.order:!Object(H.A)(t)&&t)||"ascending"]}return[]}assembleMarks(){const{child:t}=this,e=function(t){const e=[],n=zq(e);return t.children.forEach(e=>n(e,{source:t.name,name:null,transform:[]})),e}(this.component.data.facetRoot),n=t.assembleLayoutSize(),r=t.assembleTitle(),i=t.assembleGroupStyle();return[Object.assign({name:this.getName("cell"),type:"group"},r?{title:r}:{},i?{style:i}:{},{from:{facet:this.assembleFacet()},sort:{field:[...this.headerSortFields("row"),...this.headerSortFields("column")],order:[...this.headerSortOrder("row"),...this.headerSortOrder("column")]}},e.length>0?{data:e}:{},n?{encode:{update:n}}:{},t.assembleGroup(function(t,e){if(t.component.selection&&lD(t.component.selection).length){const n=Object(H.X)(t.getName("cell"));e.unshift({name:"facet",value:{},on:[{events:SM("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return e}(this,[])))]}getMapping(){return this.facet}}function Yq(t,e){for(const n of e){const e=n.data;if(nL(t)&&nL(e)){const r=t.values,i=e.values;if(BI(r,i))return n}else if(eL(t)&&eL(e)){if(t.url===e.url)return n}else if(rL(t)&&t.name===n.dataName)return n}return null}function Jq(t){let e=function(t,e){if(t.data||!t.parent){const n=Yq(t.data,e);if(n)return n.data.format=tD({},t.data.format,n.data.format),n;{const n=new SW(t.data);return e.push(n),n}}return t.parent.component.data.facetRoot?t.parent.component.data.facetRoot:t.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:n,outputNodeRefCounts:r}=t.component.data,i=t.parent?t.parent.component.data.ancestorParse.clone():new Rq;t.data&&t.data.format&&null===t.data.format.parse&&(i.parseNothing=!0),e=NW.makeExplicit(e,t,i)||e,bU(t)&&(hq(t)||vq(t))&&(e=new Aq(e));const o=t.parent&&vq(t.parent);(hq(t)||pq(t))&&o&&(e=xq.makeFromEncoding(e,t)||e),t.transforms.length>0&&(e=function(t,e,n){let r=0;for(const i of e.transforms){let o,a=void 0;if(XL(i))o=t=new MB(t,i),a="derived";else if(qL(i))o=t=NW.makeImplicitFromFilterTransform(t,i,n)||t,t=new _q(t,e,i.filter);else if(YL(i))o=t=xq.makeFromTransform(t,i,e),a="number";else if(ZL(i))o=t=WB.makeFromTransform(t,i),a="date",void 0===n.getWithExplicit(i.field).value&&(t=new NW(t,{[i.field]:a}),n.set(i.field,a,!1));else if(QL(i))o=t=CW.makeFromTransform(t,i),a="number",bU(e)&&(t=new Aq(t));else if(HL(i))o=t=Fq.make(t,e,i,r++),a="derived";else if(GL(i))o=t=new IW(t,i),a="number";else if(tB(i))o=t=TW.makeFromTransform(t,i),a="derived";else if(eB(i))o=t=new Sq(t,i),a="derived";else if(KL(i))o=t=new kq(t,i),a="derived";else if($L(i))t=new Pq(t,i);else{if(!JL(i)){VR(HR.invalidTransformIgnored(i));continue}o=t=jq.makeFromTransform(t,i),a="derived"}if(o&&void 0!==a)for(const t of o.producedFields())n.set(t,a,!1)}return t}(e,t,i)),e=NW.makeImplicitFromEncoding(e,t,i)||e,hq(t)&&(e=Eq.parseAll(e,t),e=Oq.parseAll(e,t)),(hq(t)||pq(t))&&(o||(e=xq.makeFromEncoding(e,t)||e),e=WB.makeFromEncoding(e,t)||e,e=MB.parseAllForSortIndex(e,t));const a=t.getName(oL),s=new AB(e,a,oL,r);if(n[a]=s,e=s,hq(t)){const n=CW.makeFromEncoding(e,t);n&&(e=n,bU(t)&&(e=new Aq(e))),e=jq.makeFromEncoding(e,t)||e,e=TW.makeFromEncoding(e,t)||e}const u=t.getName(iL),c=new AB(e,u,iL,r);n[u]=c,e=c;let l=null;if(pq(t)){const r=t.getName("facet");e=function(t,e){const{row:n,column:r}=e;if(n&&r){let e=null;for(const i of[n,r])if(lL(i.sort)){const{field:n,op:r}=i.sort;t=e=new IW(t,{window:[{op:r,field:n,as:Kq(i,i.sort,{forAs:!0})}],groupby:[$F(i)],frame:[null,null]})}return e}return null}(e=MB.parseAllForSortIndex(e,t),t.facet)||e,l=new MW(e,t,r,c.getSource()),n[r]=l,e=l}return Object.assign({},t.component.data,{outputNodes:n,outputNodeRefCounts:r,raw:s,main:c,facetRoot:l,ancestorParse:i})}class Zq extends bq{constructor(t,e,n,r,i,o){super(t,e,n,r,i,o)}parseData(){this.component.data=Jq(this),this.children.forEach(t=>{t.parseData()})}parseSelection(){this.component.selection={};for(const t of this.children)t.parseSelection(),lD(t.component.selection).forEach(e=>{this.component.selection[e]=t.component.selection[e]})}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxisAndHeader(){for(const t of this.children)t.parseAxisAndHeader()}assembleSelectionTopLevelSignals(t){return this.children.reduce((t,e)=>e.assembleSelectionTopLevelSignals(t),t)}assembleSelectionSignals(){return this.children.forEach(t=>t.assembleSelectionSignals()),[]}assembleLayoutSignals(){return this.children.reduce((t,e)=>t.concat(e.assembleLayoutSignals()),zB(this))}assembleSelectionData(t){return this.children.reduce((t,e)=>e.assembleSelectionData(t),t)}assembleMarks(){return this.children.map(t=>{const e=t.assembleTitle(),n=t.assembleGroupStyle(),r=t.assembleLayoutSize();return Object.assign({type:"group",name:t.getName("group")},e?{title:e}:{},n?{style:n}:{},r?{encode:{update:r}}:{},t.assembleGroup())})}}class Qq extends Zq{constructor(t,e,n,r,i){super(t,e,n,i,r,t.resolve),this.type="concat",t.resolve&&t.resolve.axis&&("shared"===t.resolve.axis.x||"shared"===t.resolve.axis.y)&&VR(HR.CONCAT_CANNOT_SHARE_AXIS),this.isVConcat=bL(t),this.children=(bL(t)?t.vconcat:t.hconcat).map((t,e)=>lV(t,this,this.getName("concat_"+e),void 0,r,i,!1))}parseLayoutSize(){!function(t){Uq(t);const e=t.component.layoutSize,n=t.isVConcat?"width":"height";e.setWithExplicit(n,Wq(t,n))}(this)}parseAxisGroup(){return null}assembleDefaultLayout(){return Object.assign({},this.isVConcat?{columns:1}:{},{bounds:"full",align:"each"})}}class tV extends XU{constructor(t={},e={},n=!1){super(),this.explicit=t,this.implicit=e,this.mainExtracted=n}clone(){return new tV(UI(this.explicit),UI(this.implicit),this.mainExtracted)}hasAxisPart(t){return"axis"===t||("grid"===t||"title"===t?!!this.get(t):!function(t){return!1===t||null===t}(this.get(t)))}}function eV(t,e,n,r="",i){const o=("band"===i?["axisBand"]:[]).concat(["x"===n?"axisX":"axisY","axis"+r.substr(0,1).toUpperCase()+r.substr(1),"axis"]);for(const n of o)if(e[n]&&void 0!==e[n][t])return e[n][t]}function nV(t){switch(t){case HD:return"bottom";case $D:return"left"}throw new Error(HR.INVALID_CHANNEL_FOR_AXIS)}const rV={bottom:"top",top:"bottom",left:"right",right:"left"};function iV(t,e){if(!t)return e.map(t=>t.clone());{if(t.length!==e.length)return;const n=t.length;for(let r=0;r<n;r++){const n=t[r],i=e[r];if(!!n!=!!i)return;if(n&&i){const e=n.getWithExplicit("orient"),o=i.getWithExplicit("orient");if(e.explicit&&o.explicit&&e.value!==o.value)return;t[r]=oV(n,i)}}}return t}function oV(t,e){for(const n of WD){const r=tW(t.getWithExplicit(n),e.getWithExplicit(n),n,"axis",(t,e)=>{switch(n){case"title":return EB(t,e);case"gridScale":return{explicit:t.explicit,value:SD(t.value,e.value)}}return QU(t,e,n,"axis")});t.setWithExplicit(n,r)}return t}function aV(t,e){const n="x"===e?"x2":"y2",r=t.fieldDef(e),i=t.fieldDef(n),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?SB(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class sV extends yq{constructor(t,e,n,r={},i,o,a){super(t,e,n,o,i,void 0),this.fit=a,this.type="unit",this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[],this.initSize(Object.assign({},r,t.width?{width:t.width}:{},t.height?{height:t.height}:{}));const s=TR(t.mark)?t.mark.type:t.mark,u=this.encoding=kP(function(t,e){return Gq(t,i)}(t.encoding||{}),s);this.markDef=function(t,e,n){const r=TR(t)?Object.assign({},t):{type:t},i=r.orient||pB("orient",r,n);return r.orient=function(t,e,n){switch(t){case bR:case ER:case OR:case yR:case _R:return}const{x:r,y:i,x2:o,y2:a}=e;switch(t){case gR:if(zF(r)&&fR(r.bin))return"vertical";if(zF(i)&&fR(i.bin))return"horizontal";if(a||o){if(n)return n;if(!o&&zF(r)&&r.type===EF&&!lR(r.bin))return"horizontal";if(!a&&zF(i)&&i.type===EF&&!lR(i.bin))return"vertical"}case kR:if(o&&a)return;case mR:if(a)return zF(i)&&fR(i.bin)?"horizontal":"vertical";if(o)return zF(r)&&fR(r.bin)?"vertical":"horizontal";if(t===kR){if(e.x&&!e.y)return"vertical";if(e.y&&!e.x)return"horizontal"}case vR:case wR:const s=zF(e.x)&&KF(e.x),u=zF(e.y)&&KF(e.y);if(s&&!u)return"tick"!==t?"horizontal":"vertical";if(!s&&u)return"tick"!==t?"vertical":"horizontal";if(s&&u){const r=e.x,i=e.y,o=r.type===AF,a=i.type===AF;return o&&!a?"tick"!==t?"vertical":"horizontal":!o&&a?"tick"!==t?"horizontal":"vertical":!r.aggregate&&i.aggregate?"tick"!==t?"vertical":"horizontal":r.aggregate&&!i.aggregate?"tick"!==t?"horizontal":"vertical":n||"vertical"}return n||void 0}return"vertical"}(r.type,e,i),void 0!==i&&i!==r.orient&&VR(HR.orientOverridden(r.orient,i)),void 0===SD(r.opacity,pB("opacity",r,n))&&(r.opacity=function(t,e){if(GI([bR,wR,ER,OR],t)&&!wP(e))return.7}(r.type,e)),void 0===r.filled&&(r.filled=function(t,e){const n=pB("filled",t,e),r=t.type;return SD(n,r!==bR&&r!==vR&&r!==kR)}(r,n)),void 0===(r.cursor||pB("cursor",r,n))&&(r.cursor=function(t,e,n){return e.href||t.href||pB("href",t,n)?"pointer":t.cursor}(r,e,n)),r}(t.mark,u,o),this.stack=gL(s,u,this.config.stack),this.specifiedScales=this.initScales(s,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegend(u),this.specifiedProjection=t.projection,this.selection=t.selection}get hasProjection(){const{encoding:t}=this,e=this.mark===SR,n=t&&xj.some(e=>zF(t[e]));return e||n}scaleDomain(t){const e=this.specifiedScales[t];return e?e.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,e){return oR.reduce((t,n)=>{let r,i;const o=e[n];return zF(o)?(r=o,i=o.scale):FF(o)&&(r=o.condition,i=o.condition.scale),r&&(t[n]=i||{}),t},{})}initAxes(t){return[HD,$D].reduce((e,n)=>{const r=t[n];if(zF(r)||n===HD&&zF(t.x2)||n===$D&&zF(t.y2)){const t=zF(r)?r.axis:null;null!==t&&(e[n]=Object.assign({},t))}return e},{})}initLegend(t){return nR.reduce((e,n)=>{const r=t[n];if(r){const t=zF(r)?r.legend:FF(r)?r.condition.legend:null;null!==t&&!1!==t&&(e[n]=Object.assign({},t))}return e},{})}parseData(){this.component.data=Jq(this)}parseLayoutSize(){!function(t){const e=t.component.layoutSize;if(!e.explicit.width){const n=qq(t,"width");e.set("width",n,!1)}if(!e.explicit.height){const n=qq(t,"height");e.set("height",n,!1)}}(this)}parseSelection(){this.component.selection=function(t,e){const n={},r=t.config.selection;e&&(e=UI(e));for(let i in e){if(!e.hasOwnProperty(i))continue;const o=e[i],a=r[o.type];for(const t in a)"encodings"===t&&o.fields||"fields"===t&&o.encodings||("mark"===t&&(o[t]=Object.assign({},a[t],o[t])),void 0!==o[t]&&!0!==o[t]||(o[t]=a[t]||o[t]));const s=n[i=mD(i)]=Object.assign({},o,{name:i,events:Object(H.H)(o.on)?SM(o.on,"scope"):o.on});sU(s,e=>{e.parse&&e.parse(t,o,s)})}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(t){return GI([vR,mR,xR],t.mark)?function(t){const e=Dq(t.mark,t.encoding),n=Iq(t,{fromPrefix:e.length>0?Tq:""});return e.length>0?[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:Tq+t.requestDataName(iL),data:t.requestDataName(iL),groupby:e}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n}]:n}(t):Iq(t)}(this)}parseAxisAndHeader(){this.component.axes=function(t){return Kj.reduce((e,n)=>(t.component.scales[n]&&t.axis(n)&&(e[n]=[function(t,e){const n=e.axis(t),r=new tV;WD.forEach(i=>{const o=function(t,e,n,r){const i=r.fieldDef(n),o=function(t,e,n,r){if(void 0!==e.labelAngle)return(e.labelAngle%360+360)%360;{const e=eV("labelAngle",t.config,n,nV(n),t.getScaleComponent(n).get("type"));return void 0!==e?(e%360+360)%360:n===HD&&GI([CF,OF],r.type)?270:void 0}}(r,e,n,i);switch(t){case"scale":return r.scaleName(n);case"gridScale":return function(t,e){const n="x"===e?"y":"x";if(t.getScaleComponent(n))return t.scaleName(n)}(r,n);case"format":return vB(i,e.format,r.config);case"grid":if(fR(r.fieldDef(n).bin))return!1;{const t=r.getScaleComponent(n).get("type");return SD(e.grid,function(t,e){return!xz(t)&&!lR(e.bin)}(t,i))}case"labelAlign":return SD(e.labelAlign,function(t,e){if(void 0!==t)return t=(t%360+360)%360,"top"===e||"bottom"===e?t%180==0?"center":0<t&&t<180?"top"===e?"right":"left":"top"===e?"left":"right":(t+90)%180==0?"center":90<=t&&t<270?"left"===e?"left":"right":"left"===e?"right":"left"}(o,nV(n)));case"labelAngle":return o;case"labelBaseline":return SD(e.labelBaseline,function(t,e){if(void 0!==t)return"top"===e||"bottom"===e?t<=45||315<=t?"top"===e?"bottom":"top":135<=t&&t<=225?"top"===e?"top":"bottom":"middle":t<=45||315<=t||135<=t&&t<=225?"middle":45<=t&&t<=135?"left"===e?"top":"bottom":"left"===e?"bottom":"top"}(o,nV(n)));case"labelFlush":return SD(e.labelFlush,function(t,e){if("x"===n&&GI(["quantitative","temporal"],i.type))return!0}());case"labelOverlap":{const t=r.getScaleComponent(n).get("type");return SD(e.labelOverlap,function(t,e){if("nominal"!==i.type)return"log"!==e||"greedy"}(0,t))}case"orient":return SD(e.orient,nV(n));case"tickCount":{const t=r.getScaleComponent(n).get("type"),o=r.scaleName(n),a="x"===n?"width":"y"===n?"height":void 0,s=a?r.getSizeSignalRef(a):void 0;return SD(e.tickCount,function({fieldDef:t,scaleType:e,size:n,scaleName:r,specifiedAxis:i={}}){if(!xz(e)&&"log"!==e&&!GI(["month","hours","day","quarter"],t.timeUnit))return i.tickStep?{signal:`(domain('${r}')[1] - domain('${r}')[0]) / ${i.tickStep} + 1`}:lR(t.bin)?{signal:`ceil(${n.signal}/10)`}:{signal:`ceil(${n.signal}/40)`}}({fieldDef:i,scaleType:t,size:s,scaleName:o,specifiedAxis:e}))}case"title":const a="x"===n?"x2":"y2",s=r.fieldDef(a);return SD(e.title,aV(r,n),kB([DF(i)],s?[DF(s)]:[]));case"values":return function(t,e,n,r){const i=t.values;if(i)return vP(n,i);if(n.type===EF){if(lR(n.bin)){const t=e.scaleDomain(r);if(t&&"unaggregated"!==t&&!Cz(t))return i;const o=e.getName($F(n,{suffix:"bins"}));return{signal:`sequence(${o}.start, ${o}.stop + ${o}.step, ${o}.step)`}}if(t.tickStep){const n=e.scaleName(r),i=t.tickStep;return{signal:`sequence(domain('${n}')[0], domain('${n}')[1] + ${i}, ${i})`}}}}(e,r,i,n)}return UD(t)?e[t]:void 0}(i,n,t,e);if(void 0!==o){const a=function(t,e,n,r,i){switch(e){case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(t===aV(r,i))return!0}return t===n[e]}(o,i,n,e,t),s=eV(i,e.config,t,r.get("orient"),e.getScaleComponent(t).get("type"));a||void 0===s?r.set(i,o,a):"grid"===i&&s&&r.set(i,s,!1)}});const i=n.encoding||{},o=PD.reduce((n,o)=>{if(!r.hasAxisPart(o))return n;const a=$U(i[o]||{},e),s="labels"===o?function(t,e,n,r){const i=t.fieldDef(e)||("x"===e?t.fieldDef("x2"):"y"===e?t.fieldDef("y2"):void 0),o=t.axis(e),a=t.config;let s={};if(mP(i)){const n=t.getScaleComponent(e).get("type")===oz.UTC,r=xB("datum.value",i.timeUnit,o.format,a.axis.shortTimeLabels,null,n);r&&(s.text={signal:r})}return s=Object.assign({},s,n),0===lD(s).length?void 0:s}(e,t,a,r.get("orient")):a;return void 0!==s&&lD(s).length>0&&(n[o]={update:s}),n},{});return lD(o).length>0&&r.set("encode",o,!!n.encoding||void 0!==n.labelAngle),r}(n,t)]),e),{})}(this)}assembleSelectionTopLevelSignals(t){return function(t,e){let n=!1;return mU(t,(r,i)=>{const o=r.name,a=Object(H.X)(o+uU);e.filter(t=>t.name===o).length||e.push({name:r.name,update:`${dU}(${a}`+("global"===r.resolve?")":`, ${Object(H.X)(r.resolve)})`)}),n=!0,i.topLevelSignals&&(e=i.topLevelSignals(t,r,e)),sU(r,n=>{n.topLevelSignals&&(e=n.topLevelSignals(t,r,e))})}),n&&(e.filter(t=>"unit"===t.name).length||e.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})),e}(this,t)}assembleSelectionSignals(){return function(t,e){return mU(t,(n,r)=>{const i=n.name;let o=r.modifyExpr(t,n);e.push(...r.signals(t,n)),sU(n,r=>{r.signals&&(e=r.signals(t,n,e)),r.modifyExpr&&(o=r.modifyExpr(t,n,o))}),e.push({name:i+lU,on:[{events:{signal:i+cU},update:`modify(${Object(H.X)(n.name+uU)}, ${o})`}]})}),e}(this,[])}assembleSelectionData(t){return function(t,e){return mU(t,t=>{e.filter(e=>e.name===t.name+uU).length||e.push({name:t.name+uU})}),e}(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return zB(this)}assembleMarks(){let t=this.component.mark||[];return this.parent&&vq(this.parent)||(t=hU(this,t)),t.map(this.correctDataNames)}assembleLayoutSize(){return{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")}}getMapping(){return this.encoding}toSpec(t,e){const n=UI(this.encoding);let r;return r={mark:this.markDef,encoding:n},t||(r.config=UI(this.config)),e||(r.data=UI(this.data)),r}get mark(){return this.markDef.type}channelHasField(t){return yP(this.encoding,t)}fieldDef(t){return uP(this.encoding[t])}}class uV extends bq{constructor(t,e,n,r,i,o,a){super(t,e,n,o,i,t.resolve),this.type="layer";const s=Object.assign({},r,t.width?{width:t.width}:{},t.height?{height:t.height}:{});this.initSize(s),this.children=t.layer.map((t,e)=>{if(wL(t))return new uV(t,this,this.getName("layer_"+e),s,i,o,a);if(AL(t))return new sV(t,this,this.getName("layer_"+e),s,i,o,a);throw new Error(HR.INVALID_SPEC)})}parseData(){this.component.data=Jq(this);for(const t of this.children)t.parseData()}parseLayoutSize(){Lq(this)}parseSelection(){this.component.selection={};for(const t of this.children)t.parseSelection(),lD(t.component.selection).forEach(e=>{this.component.selection[e]=t.component.selection[e]})}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxisAndHeader(){!function(t){const{axes:e,resolve:n}=t.component,r={top:0,bottom:0,right:0,left:0};for(const r of t.children){r.parseAxisAndHeader();for(const i of lD(r.component.axes))n.axis[i]=KU(t.component.resolve,i),"shared"===n.axis[i]&&(e[i]=iV(e[i],r.component.axes[i]),e[i]||(n.axis[i]="independent",delete e[i]))}for(const i of[HD,$D])for(const o of t.children)if(o.component.axes[i]){if("independent"===n.axis[i]){e[i]=(e[i]||[]).concat(o.component.axes[i]);for(const t of o.component.axes[i]){const{value:e,explicit:n}=t.getWithExplicit("orient");if(r[e]>0&&!n){const n=rV[e];r[e]>r[n]&&t.set("orient",n,!1)}r[e]++}}delete o.component.axes[i]}}(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce((t,e)=>e.assembleSelectionTopLevelSignals(t),t)}assembleSelectionSignals(){return this.children.reduce((t,e)=>t.concat(e.assembleSelectionSignals()),[])}assembleLayoutSignals(){return this.children.reduce((t,e)=>t.concat(e.assembleLayoutSignals()),zB(this))}assembleSelectionData(t){return this.children.reduce((t,e)=>e.assembleSelectionData(t),t)}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const e of this.children)if(t=e.assembleTitle())return t}assembleLayout(){return null}assembleMarks(){return function(t,e){for(const n of t.children)hq(n)&&(e=hU(n,e));return e}(this,ZI(this.children.map(t=>t.assembleMarks())))}assembleLegends(){return this.children.reduce((t,e)=>t.concat(e.assembleLegends()),gW(this))}}class cV extends Zq{constructor(t,e,n,r,i){super(t,e,n,i,r,t.resolve),this.type="repeat",t.resolve&&t.resolve.axis&&("shared"===t.resolve.axis.x||"shared"===t.resolve.axis.y)&&VR(HR.REPEAT_CANNOT_SHARE_AXIS),this.repeat=t.repeat,this.children=this._initChildren(t,this.repeat,r,i)}_initChildren(t,e,n,r){const i=[],o=e.row||[n?n.row:null],a=e.column||[n?n.column:null];for(const e of o)for(const n of a){const o=(e?"_"+e:"")+(n?"_"+n:""),a={row:e,column:n};i.push(lV(t.spec,this,this.getName("child"+o),void 0,a,r,!1))}return i}parseLayoutSize(){Bq(this)}assembleDefaultLayout(){return{columns:this.repeat&&this.repeat.column?this.repeat.column.length:1,bounds:"full",align:"all"}}}function lV(t,e,n,r,i,o,a){if(QR(t))return new Xq(t,e,n,i,o);if(wL(t))return new uV(t,e,n,r,i,o,a);if(AL(t))return new sV(t,e,n,r,i,o,a);if(xL(t))return new cV(t,e,n,i,o);if(vL(t))return new Qq(t,e,n,i,o);throw new Error(HR.INVALID_SPEC)}function fV(t,e={}){e.logger&&function(t){qR=t}(e.logger),e.fieldTitle&&tP(e.fieldTitle);try{const n=Xz(tD({},e.config,t.config)),r=_L(t,n),i=function(t,e,n=!0){const r=Object.assign({type:"pad"},aB(e),aB(t));return"fit"===r.type&&(n||(VR(HR.FIT_NON_SINGLE),r.type="pad")),r}(t.autosize,n.autosize,wL(r)||AL(r)),o=lV(r,null,"",void 0,void 0,n,"fit"===i.type);return o.parse(),function(t){kW(t.sources);let e=0,n=0;for(let n=0;n<WW&&$W(t);n++)e++;t.sources.map(PW);for(let e=0;e<WW&&$W(t);e++)n++;kW(t.sources),Math.max(e,n)===WW&&VR(`Maximum optimization runs(${WW}) reached.`)}(o.component.data),function(t,e,n={},r){const i=t.config?Qz(t.config):void 0,o=[].concat(t.assembleSelectionData([]),function(t,e){const n=[],r=zq(n);let i=0;t.sources.forEach(t=>{t.hasName()||(t.dataName=`source_${i++}`);const e=t.assemble();r(t,e)}),n.forEach(t=>{0===t.transform.length&&delete t.transform});let o=0;for(let t=0;t<n.length;t++){const e=n[t];0!==(e.transform||[]).length||e.source||n.splice(o++,0,n.splice(t,1)[0])}for(const e of n)for(const n of e.transform||[])"lookup"===n.type&&(n.from=t.outputNodes[n.from].getSource());for(const t of n)t.name in e&&(t.values=e[t.name]);return n}(t.component.data,n)),a=t.assembleProjections(),s=t.assembleTitle(),u=t.assembleGroupStyle();let c=t.assembleLayoutSignals();return c=c.filter(t=>"width"!==t.name&&"height"!==t.name||void 0===t.value||(e[t.name]=+t.value,!1)),{spec:Object.assign({$schema:"https://vega.github.io/schema/vega/v4.json"},t.description?{description:t.description}:{},e,s?{title:s}:{},u?{style:u}:{},{data:o},a.length>0?{projections:a}:{},t.assembleGroup([...c,...t.assembleSelectionTopLevelSignals([])]),i?{config:i}:{},r?{usermeta:r}:{})}}(o,function(t,e,n){return Object.assign({autosize:1===lD(n).length&&n.type?n.type:n},uB(e),uB(t))}(t,n,i),t.datasets,t.usermeta)}finally{e.logger&&(qR=WR),e.fieldTitle&&eP()}}function dV(t,e){if(QR(t)||xL(t))return function(t,e){const{spec:n}=t,r=B(t,["spec"]);return Object.assign({},r,{spec:dV(n,e)})}(t,e);if(wL(t))return function(t,e){const{layer:n}=t,r=B(t,["layer"]);return Object.assign({},r,{layer:n.map(t=>dV(t,e))})}(t,e);if(AL(t))return function(t,e){if(t.encoding){const{encoding:n,transform:r}=t,i=B(t,["encoding","transform"]),{bins:o,timeUnits:a,aggregate:s,groupby:u,encoding:c}=xP(n,e);return Object.assign({transform:[...r||[],...o,...a,...s.length?[{aggregate:s,groupby:u}]:[]]},i,{encoding:c})}return t}(t,e);if(bL(t))return function(t,e){const{vconcat:n}=t,r=B(t,["vconcat"]);return Object.assign({},r,{vconcat:n.map(t=>dV(t,e))})}(t,e);if(yL(t))return function(t,e){const{hconcat:n}=t,r=B(t,["hconcat"]);return Object.assign({},r,{hconcat:n.map(t=>dV(t,e))})}(t,e);throw new Error(HR.INVALID_SPEC)}const hV=NI.version;var pV=n(256),mV=n.n(pV),gV=n(396),vV={background:"#333",title:{color:"#fff"},style:{"guide-label":{fill:"#fff"},"guide-title":{fill:"#fff"}},axis:{domainColor:"#fff",gridColor:"#888",tickColor:"#fff"}},bV={background:"#fff",arc:{fill:"#4572a7"},area:{fill:"#4572a7"},line:{stroke:"#4572a7",strokeWidth:2},path:{stroke:"#4572a7"},rect:{fill:"#4572a7"},shape:{stroke:"#4572a7"},symbol:{fill:"#4572a7",strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},yV={arc:{fill:"#30a2da"},area:{fill:"#30a2da"},axis:{domainColor:"#cbcbcb",grid:!0,gridColor:"#cbcbcb",gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:"#cbcbcb",tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:"#f0f0f0",group:{fill:"#f0f0f0"},legend:{labelColor:"#333",labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:"#333",titleFontSize:14,titlePadding:10},line:{stroke:"#30a2da",strokeWidth:2},path:{stroke:"#30a2da",strokeWidth:.5},rect:{fill:"#30a2da"},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:"#30a2da"},style:{bar:{binSpacing:2,fill:"#30a2da",stroke:null}},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},wV={group:{fill:"#e5e5e5"},arc:{fill:"#000"},area:{fill:"#000"},line:{stroke:"#000"},path:{stroke:"#000"},rect:{fill:"#000"},shape:{stroke:"#000"},symbol:{fill:"#000",size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}};const xV="Benton Gothic Bold, sans-serif",_V={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]};var kV={background:"#ffffff",title:{anchor:"start",color:"#000000",font:xV,fontSize:22,fontWeight:"normal"},arc:{fill:"#82c6df"},area:{fill:"#82c6df"},line:{stroke:"#82c6df",strokeWidth:2},path:{stroke:"#82c6df"},rect:{fill:"#82c6df"},shape:{stroke:"#82c6df"},symbol:{fill:"#82c6df",size:30},axis:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,labelFontWeight:"normal",titleFont:xV,titleFontSize:13,titleFontWeight:"normal"},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,symbolType:"square",titleFont:xV,titleFontSize:13,titleFontWeight:"normal"},range:{category:_V["category-6"],diverging:_V["fireandice-6"],heatmap:_V["fire-7"],ordinal:_V["fire-7"],ramp:_V["fire-7"]}},SV={background:"#f9f9f9",arc:{fill:"#ab5787"},area:{fill:"#ab5787"},line:{stroke:"#ab5787"},path:{stroke:"#ab5787"},rect:{fill:"#ab5787"},shape:{stroke:"#ab5787"},symbol:{fill:"#ab5787",size:30},axis:{domainColor:"#979797",domainWidth:.5,gridWidth:.2,labelColor:"#979797",tickColor:"#979797",tickWidth:.2,titleColor:"#979797"},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},EV={background:"#fff",arc:{fill:"#3e5c69"},area:{fill:"#3e5c69"},line:{stroke:"#3e5c69"},path:{stroke:"#3e5c69"},rect:{fill:"#3e5c69"},shape:{stroke:"#3e5c69"},symbol:{fill:"#3e5c69"},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}};const OV=gV.version;var AV="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black; }\n #vg-tooltip-element.visible {\n visibility: visible; }\n #vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px; }\n #vg-tooltip-element table {\n border-spacing: 0; }\n #vg-tooltip-element table tr {\n border: none; }\n #vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px; }\n #vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px; }\n #vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left; }\n #vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white; }\n #vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf; }\n";const CV="vg-tooltip-element",MV={offsetX:10,offsetY:10,id:CV,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(t){return String(t).replace(/&/g,"&").replace(/</g,"<")},maxDepth:2};function NV(t,e){return JSON.stringify(t,function(t){const e=[];return function(n,r){if("object"!=typeof r||null===r)return r;const i=e.indexOf(this)+1;return e.length=i,e.length>t?"[Object]":e.indexOf(r)>=0?"[Circular]":(e.push(r),r)}}(e))}class TV{constructor(t){this.options=Object.assign({},MV,t);const e=this.options.id;if(this.call=this.tooltip_handler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=function(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return AV.toString().replace(CV,t)}(e);const n=document.head;n.childNodes.length>0?n.insertBefore(t,n.childNodes[0]):n.appendChild(t)}this.el=document.getElementById(e),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",e),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el))}tooltip_handler(t,e,n,r){if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=function(t,e,n){if(Object(H.A)(t))return`[${t.map(t=>e(Object(H.H)(t)?t:NV(t,n))).join(", ")}]`;if(Object(H.F)(t)){let r="";const i=t,{title:o}=i,a=B(i,["title"]);o&&(r+=`<h2>${e(o)}</h2>`);const s=Object.keys(a);if(s.length>0){r+="<table>";for(const t of s){let i=a[t];Object(H.F)(i)&&(i=NV(i,n)),r+=`<tr><td class="key">${e(t)}:</td><td class="value">${e(i)}</td></tr>`}r+="</table>"}return r||"{}"}return e(t)}(r,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}=function(t,e,n,r){let i=t.clientX+n;i+e.width>window.innerWidth&&(i=+t.clientX-n-e.width);let o=t.clientY+r;return o+e.height>window.innerHeight&&(o=+t.clientY-r-e.height),{x:i,y:o}}(e,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${o}px; left: ${i}px`)}}var IV='.vega-embed {\n position: relative;\n display: inline-block;\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\n .vega-embed summary {\n list-style: none;\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); }\n .vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none; }\n .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: scroll;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n';function DV(t,...e){for(const n of e)t=jV(t,n);return t}function jV(t,e){if("object"!=typeof e||null===e)return t;for(const n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&("object"!=typeof e[n]||Object(H.A)(e[n])||null===e[n]?t[n]=e[n]:"object"!=typeof t[n]||null===t[n]?t[n]=DV(Object(H.A)(e[n].constructor)?[]:{},e[n]):DV(t[n],e[n]));return t}String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return this.substr(!e||e<0?0:+e,t.length)===t}),n.d(e,"vega",function(){return RV}),n.d(e,"vl",function(){return FV}),n.d(e,"guessMode",function(){return qV}),n.d(e,"default",function(){return VV});const RV=p,FV=z,PV={vega:"Vega","vega-lite":"Vega-Lite"},zV={vega:RV.version,"vega-lite":FV?FV.version:"not available"},LV={vega:(t,e)=>t,"vega-lite":(t,e)=>FV.compile(t,{config:e}).spec},BV='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" width="14" height="14">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>',UV={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Vega Source",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"};function WV(t,e,n,r){const i=`<html><head>${e}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(i+t+o),a.document.title=`${PV[r]} JSON Source`}function qV(t,e){if(t.$schema){const n=mV()(t.$schema);e&&e!==n.library&&console.warn(`The given visualization spec is written in ${PV[n.library]}, but mode argument sets ${PV[e]||e}.`);const r=n.library;return Object(V.satisfies)(zV[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${r} ${n.version}, but the current version of ${PV[r]} is ${zV[r]}.`),r}return"mark"in t||"encoding"in t||"layer"in t||"hconcat"in t||"vconcat"in t||"facet"in t||"repeat"in t?"vega-lite":"marks"in t||"signals"in t||"scales"in t||"axes"in t?"vega":e||"vega"}function VV(t,e,n={}){return function(t,e,n,r){return new(n||(n=Promise))(function(e,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?e(t.value):new n(function(e){e(t.value)}).then(o,a)}s((r=r.apply(t,[])).next())})}(this,0,void 0,function*(){const r=(n=n||{}).patch||n.onBeforeParse,i=!0===n.actions||!1===n.actions?n.actions:DV({},{export:{svg:!0,png:!0},source:!0,compiled:!1,editor:!0},n.actions||{}),o=Object.assign({},UV,n.i18n),a=function(t){return!!(t&&"load"in t)}(n.loader)?n.loader:RV.loader(n.loader),s=n.renderer||"canvas",u=n.logLevel||RV.Warn;if(RV.isString(e)){const r=yield a.load(e);return VV(t,JSON.parse(r),n)}let c=n.config||{};if(RV.isString(c)){const r=yield a.load(c);return VV(t,e,Object.assign({},n,{config:JSON.parse(r)}))}if(!1!==n.defaultStyle){const t="vega-embed-style";if(!document.getElementById(t)){const e=document.createElement("style");e.id=t,e.innerText=void 0===n.defaultStyle||!0===n.defaultStyle?(IV||"").toString():n.defaultStyle,document.head.appendChild(e)}}n.theme&&(c=DV({},L[n.theme],c));const l=qV(e,n.mode);let f=LV[l](e,c);if("vega-lite"===l&&f.$schema){const t=mV()(f.$schema);Object(V.satisfies)(zV.vega,`^${t.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${t.version}, but current version is ${zV.vega}.`)}const d=U.select(t).classed("vega-embed",!0).html("");if(r)if(r instanceof Function)f=r(f);else if(RV.isString(r)){const t=yield a.load(r);f=DV(f,JSON.parse(t))}else f=DV(f,r);const h=RV.parse(f,"vega-lite"===l?{}:c),p=new RV.View(h,{loader:a,logLevel:u,renderer:s}).initialize(t);if(!1!==n.tooltip){let t;t="function"==typeof n.tooltip?n.tooltip:new TV(!0===n.tooltip?{}:n.tooltip).call,p.tooltip(t)}let m=n.hover;if(void 0===m&&(m="vega-lite"!==l),m){const{hoverSet:t,updateSet:e}="boolean"==typeof m?{}:m;p.hover(t,e)}if(n&&(n.width&&p.width(n.width),n.height&&p.height(n.height),n.padding&&p.padding(n.padding)),n.runAsync?yield p.runAsync():p.run(),!1!==i){let t=d;if(!1!==n.defaultStyle){const e=t=d.append("details").attr("title",o.CLICK_TO_VIEW_ACTIONS);e.insert("summary").html(BV);const n=e.node();document.addEventListener("click",t=>{n.contains(t.target)||n.removeAttribute("open")})}const r=t.insert("div").attr("class","vega-actions");if(!0===i||!1!==i.export)for(const t of["svg","png"])if(!0===i||!0===i.export||i.export[t]){const e=o[`${t.toUpperCase()}_ACTION`];r.append("a").text(e).attr("href","#").attr("target","_blank").attr("download",`visualization.${t}`).on("mousedown",function(){p.toImageURL(t,n.scaleFactor).then(t=>{this.href=t}).catch(t=>{throw t}),U.event.preventDefault()})}if(!0!==i&&!1===i.source||r.append("a").text(o.SOURCE_ACTION).attr("href","#").on("mousedown",()=>{WV(q()(e),n.sourceHeader||"",n.sourceFooter||"",l),U.event.preventDefault()}),"vega-lite"!==l||!0!==i&&!1===i.compiled||r.append("a").text(o.COMPILED_ACTION).attr("href","#").on("mousedown",()=>{WV(q()(f),n.sourceHeader||"",n.sourceFooter||"","vega"),U.event.preventDefault()}),!0===i||!1!==i.editor){const t=n.editorUrl||"https://vega.github.io/editor/";r.append("a").text(o.EDITOR_ACTION).attr("href","#").on("mousedown",()=>{!function(t,e,n){const r=t.open(e);let i=40;t.addEventListener("message",function e(n){n.source===r&&(i=0,t.removeEventListener("message",e,!1))},!1),setTimeout(function t(){i<=0||(r.postMessage(n,"*"),setTimeout(t,250),i-=1)},250)}(window,t,{config:c,mode:l,renderer:s,spec:q()(e)}),U.event.preventDefault()})}}return{view:p,spec:e,vgSpec:f}})}},function(t,e,n){"use strict";e.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(52));e.default=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return(0,r.default)(t)}},function(t,e){t.exports={}},function(t,e,n){"use strict";var r=n(509)(!0);n(186)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(141),i=n(196);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},function(t,e,n){var r=n(112),i=n(626),o=n(625),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?i(t):o(t)}},function(t,e,n){var r=n(7).Buffer;function i(t,e){this._block=r.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=r.from(t,e));for(var n=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),l=0;l<c;l++)n[u+l]=t[s+l];s+=c,(a+=c)%i==0&&this._update(n)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,n){"use strict";(function(e,r){var i=n(7).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,n){if(t>65536)throw new Error("requested too many random bytes");var a=new e.Uint8Array(t);t>0&&o.getRandomValues(a);var s=i.from(a.buffer);return"function"==typeof n?r.nextTick(function(){n(null,s)}):s}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(27),n(44))},function(t,e,n){var r=n(223);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(358),i=n(219);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){t.exports={default:n(764),__esModule:!0}},function(t,e,n){"use strict";e.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(100));e.default=r.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){var r=n(14);t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},function(t,e){t.exports={}},function(t,e,n){var r=n(3),i=n(59),o=n(13),a=n(247),s="["+a+"]",u=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),l=function(t,e,n){var i={},s=o(function(){return!!a[t]()||"••"!="••"[t]()}),u=i[t]=s?e(f):a[t];n&&(i[n]=u),r(r.P+r.F*s,"String",i)},f=l.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(u,"")),2&e&&(t=t.replace(c,"")),t};t.exports=l},function(t,e,n){var r=n(49),i=n(15)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){var r=n(21).f,i=n(42),o=n(15)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){t.exports={default:n(468),__esModule:!0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=c(n(12)),i=c(n(52)),o=c(n(11)),a=c(n(36)),s=c(n(9)),u=c(n(10));function c(t){return t&&t.__esModule?t:{default:t}}var l=new(function(){function t(){(0,s.default)(this,t),this.p5Instance=window}return(0,u.default)(t,[{key:"setP5Instance",value:function(t){this.p5Instance=t}},{key:"checkP5",value:function(){return void 0!==this.p5Instance&&"function"==typeof this.p5Instance.loadImage||void 0!==this.p5Instance.p5&&void 0!==this.p5Instance.p5.Image&&"function"==typeof this.p5Instance.p5.Image}},{key:"getBlob",value:function(t){return new a.default(function(e){t.toBlob(function(t){e(t)})})}},{key:"loadAsync",value:function(t){var e=this;return new a.default(function(n){e.p5Instance.loadImage(t,function(t){n(t)})})}},{key:"rawToBlob",value:function(){var t=(0,o.default)(r.default.mark(function t(e,n,o){var a,s,u,c,l,f,d;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(a=(0,i.default)(e),s=document.createElement("canvas"),u=s.getContext("2d"),s.width=n,s.height=o,c=u.createImageData(n,o),l=c.data,f=0;f<n*o*4;f+=1)l[f]=a[f];return u.putImageData(c,0,0),t.next=11,this.getBlob(s);case 11:return d=t.sent,t.abrupt("return",d);case 13:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"blobToP5Image",value:function(){var t=(0,o.default)(r.default.mark(function t(e){var n;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.checkP5()){t.next=5;break}return t.next=3,this.loadAsync(URL.createObjectURL(e));case 3:return n=t.sent,t.abrupt("return",n);case 5:return t.abrupt("return",null);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}());e.default=l},function(t,e,n){var r=n(64),i=n(280),o=n(279),a=n(56),s=n(152),u=n(184),c={},l={};(e=t.exports=function(t,e,n,f,d){var h,p,m,g,v=d?function(){return t}:u(t),b=r(n,f,e?2:1),y=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(o(v)){for(h=s(t.length);h>y;y++)if((g=e?b(a(p=t[y])[0],p[1]):b(t[y]))===c||g===l)return g}else for(m=v.call(t);!(p=m.next()).done;)if((g=i(m,b,p.value,e))===c||g===l)return g}).BREAK=c,e.RETURN=l},function(t,e,n){n(506);for(var r=n(29),i=n(68),o=n(92),a=n(28)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<s.length;u++){var c=s[u],l=r[c],f=l&&l.prototype;f&&!f[a]&&i(f,a,c),o[c]=o.Array}},function(t,e,n){var r=n(46).f,i=n(77),o=n(28)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var r=n(53).Symbol;t.exports=r},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,n){"use strict";e.tachyons=n(313),e.reset=n(539),e.wrap=n(537),e.globals=n(535)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return"string"==typeof t&&r.test(t)};var r=/-webkit-|-moz-|-ms-/;t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.compose=e.merge=e.$=e.style=e.presets=e.keyframes=e.fontFace=e.insertGlobal=e.insertRule=e.plugins=e.styleSheet=void 0,e.speedy=function(t){return f.speedy(t)},e.simulations=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];g=!!t},e.simulate=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return(e=(0,a.default)(e))?g?e.reduce(function(t,e){return t["data-simulate-"+w(e)]="",t},{}):(v||(console.warn("can't simulate without once calling simulations(true)"),v=!0),h||p||b||(console.warn("don't use simulation outside dev"),b=!0),{}):{}},e.cssLabels=function(t){y=!!t},e.isLikeRule=_,e.idFor=k,e.css=W,e.rehydrate=function(t){(0,r.default)(N,t.reduce(function(t,e){return t[e]=!0,t},{}))},e.flush=function(){N=f.inserted={},T=f.registered={},D={},f.flush(),f.inject()},e.select=V,e.parent=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W(l({},t+" &",n))},e.media=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W(l({},"@media "+t,n))},e.pseudo=H,e.active=function(t){return H(":active",t)},e.any=function(t){return H(":any",t)},e.checked=function(t){return H(":checked",t)},e.disabled=function(t){return H(":disabled",t)},e.empty=function(t){return H(":empty",t)},e.enabled=function(t){return H(":enabled",t)},e._default=function(t){return H(":default",t)},e.first=function(t){return H(":first",t)},e.firstChild=function(t){return H(":first-child",t)},e.firstOfType=function(t){return H(":first-of-type",t)},e.fullscreen=function(t){return H(":fullscreen",t)},e.focus=function(t){return H(":focus",t)},e.hover=function(t){return H(":hover",t)},e.indeterminate=function(t){return H(":indeterminate",t)},e.inRange=function(t){return H(":in-range",t)},e.invalid=function(t){return H(":invalid",t)},e.lastChild=function(t){return H(":last-child",t)},e.lastOfType=function(t){return H(":last-of-type",t)},e.left=function(t){return H(":left",t)},e.link=function(t){return H(":link",t)},e.onlyChild=function(t){return H(":only-child",t)},e.onlyOfType=function(t){return H(":only-of-type",t)},e.optional=function(t){return H(":optional",t)},e.outOfRange=function(t){return H(":out-of-range",t)},e.readOnly=function(t){return H(":read-only",t)},e.readWrite=function(t){return H(":read-write",t)},e.required=function(t){return H(":required",t)},e.right=function(t){return H(":right",t)},e.root=function(t){return H(":root",t)},e.scope=function(t){return H(":scope",t)},e.target=function(t){return H(":target",t)},e.valid=function(t){return H(":valid",t)},e.visited=function(t){return H(":visited",t)},e.dir=function(t,e){return H(":dir("+t+")",e)},e.lang=function(t,e){return H(":lang("+t+")",e)},e.not=function(t,e){var n=t.split(",").map(function(t){return t.trim()}).map(function(t){return":not("+t+")"});return 1===n.length?H(":not("+t+")",e):V(n.join(""),e)},e.nthChild=function(t,e){return H(":nth-child("+t+")",e)},e.nthLastChild=function(t,e){return H(":nth-last-child("+t+")",e)},e.nthLastOfType=function(t,e){return H(":nth-last-of-type("+t+")",e)},e.nthOfType=function(t,e){return H(":nth-of-type("+t+")",e)},e.after=function(t){return H("::after",t)},e.before=function(t){return H("::before",t)},e.firstLetter=function(t){return H("::first-letter",t)},e.firstLine=function(t){return H("::first-line",t)},e.selection=function(t){return H("::selection",t)},e.backdrop=function(t){return H("::backdrop",t)},e.placeholder=function(t){return W({"::placeholder":t})},e.cssFor=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return(e=(0,a.default)(e))?e.map(function(t){var e={label:[]};return F(e,{src:t}),M(x(e),C(e)).join("")}).join(""):""},e.attribsFor=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return(e=(0,a.default)(e))?e.map(function(t){k(t);var e=Object.keys(t)[0];return e+'="'+(t[e]||"")+'"'}).join(" "):""};var r=c(n(204)),i=n(667),o=n(316),a=c(n(658)),s=n(657),u=c(n(640));function c(t){return t&&t.__esModule?t:{default:t}}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var f=e.styleSheet=new i.StyleSheet;f.inject();var d=e.plugins=f.plugins=new s.PluginSet([s.prefixes,s.contentWrap,s.fallbacks]);d.media=new s.PluginSet,d.fontFace=new s.PluginSet,d.keyframes=new s.PluginSet([s.prefixes,s.fallbacks]);var h=!1,p=!1,m="undefined"!=typeof window,g=h,v=!1,b=!1,y=h;function w(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.toLowerCase().replace(/[^a-z0-9]/g,e)}function x(t){var e=JSON.stringify(t),n=(0,u.default)(e).toString(36);return t.label&&t.label.length>0&&h?w(t.label.join("."),"-")+"-"+n:n}function _(t){var e=Object.keys(t).filter(function(t){return"toString"!==t});return 1===e.length&&!!/data\-css\-([a-zA-Z0-9\-_]+)/.exec(e[0])}function k(t){var e=Object.keys(t).filter(function(t){return"toString"!==t});if(1!==e.length)throw new Error("not a rule");var n=/data\-css\-([a-zA-Z0-9\-_]+)/.exec(e[0]);if(!n)throw new Error("not a rule");return n[1]}var S=/[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g;function E(t){if(-1===t.indexOf(","))return[t];for(var e,n=[],r=[],i=0;e=S.exec(t);)switch(e[0]){case"(":i++;break;case")":i--;break;case",":if(i)break;n.push(e.index)}for(e=n.length;e--;)r.unshift(t.slice(n[e]+1)),t=t.slice(0,n[e]);return r.unshift(t),r}function O(t,e){if(!t)return e.replace(/\&/g,"");if(!e)return".css-"+t+",[data-css-"+t+"]";var n=E(e).map(function(e){return e.indexOf("&")>=0?[e.replace(/\&/gm,".css-"+t),e.replace(/\&/gm,"[data-css-"+t+"]")].join(","):".css-"+t+e+",[data-css-"+t+"]"+e}).join(",");return g&&/^\&\:/.exec(e)&&!/\s/.exec(e)&&(n+=",.css-"+t+"[data-simulate-"+w(e)+"],[data-css-"+t+"][data-simulate-"+w(e)+"]"),n}function A(t){var e=t.selector,n=t.style,r=d.transform({selector:e,style:n});return r.selector+"{"+(0,o.createMarkupForStyles)(r.style)+"}"}function C(t){var e=void 0,n=void 0,r=void 0,i=void 0;return Object.keys(t).forEach(function(o){o.indexOf("&")>=0?(n=n||{})[o]=t[o]:0===o.indexOf("@media")?(r=r||{})[o]=C(t[o]):0===o.indexOf("@supports")?(i=i||{})[o]=C(t[o]):"label"===o?t.label.length>0&&((e=e||{}).label=y?t.label.join("."):""):(e=e||{})[o]=t[o]}),{plain:e,selects:n,medias:r,supports:i}}function M(t,e){var n=[],r=e.plain,i=e.selects,o=e.medias,a=e.supports;return r&&n.push(A({style:r,selector:O(t)})),i&&Object.keys(i).forEach(function(e){return n.push(A({style:i[e],selector:O(t,e)}))}),o&&Object.keys(o).forEach(function(e){return n.push(e+"{"+M(t,o[e]).join("")+"}")}),a&&Object.keys(a).forEach(function(e){return n.push(e+"{"+M(t,a[e]).join("")+"}")}),n}var N=f.inserted={},T=f.registered={};function I(t){T[t.id]||(T[t.id]=t)}var D={};function j(t,e){var n=E(t).map(function(t){return t.indexOf("&")>=0?t:"&"+t});return E(e).map(function(t){return t.indexOf("&")>=0?t:"&"+t}).reduce(function(t,e){return t.concat(n.map(function(t){return e.replace(/\&/g,t)}))},[]).join(",")}var R={"::placeholder":["::-webkit-input-placeholder","::-moz-placeholder","::-ms-input-placeholder"],":fullscreen":[":-webkit-full-screen",":-moz-full-screen",":-ms-fullscreen"]};function F(t,e){var n=e.selector,r=void 0===n?"":n,i=e.mq,o=void 0===i?"":i,s=e.supp,u=void 0===s?"":s,c=e.src,l=void 0===c?{}:c;Array.isArray(l)||(l=[l]),(l=function t(e){for(var n=[],r=0;r<e.length;r++)n=Array.isArray(e[r])?n.concat(t(e[r])):n.concat(e[r]);return n}(l)).forEach(function(e){if(_(e)){var n=function(t){if(_(t)){var e=T[k(t)];if(null==e)throw new Error("[glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79");return e}return t}(e);if("css"!==n.type)throw new Error("cannot merge this rule");e=n.style}(e=(0,a.default)(e))&&e.composes&&F(t,{selector:r,mq:o,supp:u,src:e.composes}),Object.keys(e||{}).forEach(function(n){if(function(t){for(var e=[":",".","[",">"," "],n=!1,r=t.charAt(0),i=0;i<e.length;i++)if(r===e[i]){n=!0;break}return n||t.indexOf("&")>=0}(n))R[n]&&R[n].forEach(function(i){return F(t,{selector:j(r,i),mq:o,supp:u,src:e[n]})}),F(t,{selector:j(r,n),mq:o,supp:u,src:e[n]});else if(0===n.indexOf("@media"))F(t,{selector:r,mq:function(t,e){return o?"@media "+o.substring(6)+" and "+e.substring(6):e}(0,n),supp:u,src:e[n]});else if(0===n.indexOf("@supports"))F(t,{selector:r,mq:o,supp:function(t,e){return u?"@supports "+u.substring(9)+" and "+e.substring(9):e}(0,n),src:e[n]});else if("composes"===n);else{var i=t;u&&(i[u]=i[u]||{},i=i[u]),o&&(i[o]=i[o]||{},i=i[o]),r&&(i[r]=i[r]||{},i=i[r]),"label"===n?y&&(t.label=t.label.concat(e.label)):i[n]=e[n]}})})}function P(t){var e={label:[]};return F(e,{src:t}),function(t){if(I(t),function(t){if(!N[t.id]){N[t.id]=!0;var e=C(t.style),n=M(t.id,e);N[t.id]=!!m||n,n.forEach(function(t){return f.insert(t)})}}(t),D[t.id])return D[t.id];var e=l({},"data-css-"+t.id,y&&t.label||"");return Object.defineProperty(e,"toString",{enumerable:!1,value:function(){return"css-"+t.id}}),D[t.id]=e,e}({id:x(e),style:e,label:y?e.label.join("."):"",type:"css"})}var z={};Object.defineProperty(z,"toString",{enumerable:!1,value:function(){return"css-nil"}});var L="undefined"!=typeof WeakMap?[z,new WeakMap,new WeakMap,new WeakMap]:[z],B=!1,U="undefined"!=typeof WeakMap?function(t){return function(e){if(L[e.length]){for(var n=L[e.length],r=0;r<e.length-1;)n.has(e[r])||n.set(e[r],new WeakMap),n=n.get(e[r]),r++;if(n.has(e[e.length-1])){var i=n.get(e[r]);if(T[i.toString().substring(4)])return i}}var o=t(e);if(L[e.length]){for(var a=0,s=L[e.length];a<e.length-1;)s=s.get(e[a]),a++;try{s.set(e[a],o)}catch(t){var u;h&&!B&&(B=!0,(u=console).warn.apply(u,["failed setting the WeakMap cache for args:"].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))),console.warn("this should NOT happen, please file a bug on the github repo."))}}return o}}(P):P;function W(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(e[0]&&e[0].length&&e[0].raw)throw new Error("you forgot to include glamor/babel in your babel plugins.");return(e=(0,a.default)(e))?U(e):z}W.insert=function(t){var e={id:x(t),css:t,type:"raw"};I(e),N[e.id]||(f.insert(e.css),N[e.id]=!!m||[e.css])},e.insertRule=W.insert,W.global=function(t,e){if(e=(0,a.default)(e))return W.insert(A({selector:t,style:e}))},e.insertGlobal=W.global,W.keyframes=function(t,e){e||(e=t,t="animation");var n={id:x({name:t,kfs:e=(0,a.default)(e)||{}}),type:"keyframes",name:t,keyframes:e};return I(n),function(t){if(!N[t.id]){var e=Object.keys(t.keyframes).map(function(e){var n=d.keyframes.transform({id:t.id,name:e,style:t.keyframes[e]});return n.name+"{"+(0,o.createMarkupForStyles)(n.style)+"}"}).join(""),n=["-webkit-","-moz-","-o-",""].map(function(n){return"@"+n+"keyframes "+t.name+"_"+t.id+"{"+e+"}"});n.forEach(function(t){return f.insert(t)}),N[t.id]=!!m||n}}(n),t+"_"+n.id},W.fontFace=function(t){var e={id:x(t=(0,a.default)(t)),type:"font-face",font:t};return I(e),function(t){if(!N[t.id]){var e="@font-face{"+(0,o.createMarkupForStyles)(t.font)+"}";f.insert(e),N[t.id]=!!m||[e]}}(e),t.fontFamily},e.fontFace=W.fontFace,e.keyframes=W.keyframes,e.presets={mobile:"(min-width: 400px)",Mobile:"@media (min-width: 400px)",phablet:"(min-width: 550px)",Phablet:"@media (min-width: 550px)",tablet:"(min-width: 750px)",Tablet:"@media (min-width: 750px)",desktop:"(min-width: 1000px)",Desktop:"@media (min-width: 1000px)",hd:"(min-width: 1200px)",Hd:"@media (min-width: 1200px)"};var q=e.style=W;function V(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t?W(l({},t,n)):q(n)}function H(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return W(l({},t,n))}e.$=V,e.merge=W,e.compose=W},function(t,e,n){var r=e;r.Reporter=n(691).Reporter,r.DecoderBuffer=n(328).DecoderBuffer,r.EncoderBuffer=n(328).EncoderBuffer,r.Node=n(690)},function(t,e,n){var r=e;r.bignum=n(24),r.define=n(694).define,r.base=n(117),r.constants=n(327),r.decoders=n(688),r.encoders=n(686)},function(t,e,n){"use strict";var r=n(54),i=n(38);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=r.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-n,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},function(t,e,n){(function(e){t.exports=function(t,n){for(var r=Math.min(t.length,n.length),i=new e(r),o=0;o<r;++o)i[o]=t[o]^n[o];return i}}).call(this,n(18).Buffer)},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(18).Buffer)},function(t,e,n){"use strict";var r=n(6),i=n(217),o=n(212),a=n(211),s=n(67);function u(t){s.call(this,"digest"),this._hash=t}r(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){t.exports=!0},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(5),i=n(30),o=n(15)("species");t.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||void 0==(n=r(a)[o])?e:i(n)}},function(t,e,n){"use strict";var r=n(5);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(49);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadFile=e.saveBlob=void 0;var r=o(n(12)),i=o(n(11));function o(t){return t&&t.__esModule?t:{default:t}}var a=function(){var t=(0,i.default)(r.default.mark(function t(e,n,i){var o,a;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:(o=document.createElement("a")).style.display="none",document.body.appendChild(o),a=new Blob([e],{type:i}),o.href=URL.createObjectURL(a),o.download=n,o.click();case 7:case"end":return t.stop()}},t,void 0)}));return function(e,n,r){return t.apply(this,arguments)}}(),s=function(){var t=(0,i.default)(r.default.mark(function t(e,n){return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",fetch(e).then(function(t){return t.json()}).then(function(t){return n&&n(null,t),t}).catch(function(t){throw n&&n(t),console.error("There has been a problem loading the file: "+t.message),t}));case 1:case"end":return t.stop()}},t,void 0)}));return function(e,n){return t.apply(this,arguments)}}();e.saveBlob=a,e.loadFile=s},function(t,e,n){var r=n(125),i=n(28)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){var r=n(56),i=n(507),o=n(219),a=n(221)("IE_PROTO"),s=function(){},u=function(){var t,e=n(226)("iframe"),r=o.length;for(e.style.display="none",n(283).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;r--;)delete u.prototype[o[r]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=u(),void 0===e?n:i(n,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(23),i=n(89),o=n(116),a=n(114),s=n(43);e.table=function(t,e,n={}){if(e&&null==e.headers)throw new Error('Data to render must have a "headers" property');if(e&&null==e.values)throw new Error('Data to render must have a "values" property');const c=s.getDrawArea(t),l=Object.assign({},u,n);let f=i.select(c).select("table.tf-table");const d=o.css(Object.assign({},a.tachyons("f6 w-100 mw8 center"),{fontSize:l.fontSize}));if(0===f.size()&&((f=i.select(c).append("table")).attr("class",` ${d} tf-table`),f.append("thead").append("tr"),f.append("tbody")),1!==f.size())throw new Error("Error inserting table");const h=o.css(Object.assign({},a.tachyons("fw6 bb b--black-20 tl pb3 pr3 bg-white"))),p=f.select("thead").select("tr").selectAll("th").data(e.headers),m=p.enter().append("th").attr("class",`${h}`);p.merge(m).html(t=>t),p.exit().remove();const g=r.format(",.4~f"),v=f.select("tbody").selectAll("tr").data(e.values),b=v.enter().append("tr"),y=o.css(Object.assign({},a.tachyons("pa1 bb b--black-20"))),w=v.merge(b).selectAll("td").data(t=>t),x=w.enter().append("td").attr("class",`${y}`);w.merge(x).html(t=>"number"==typeof t?g(t):t),w.exit().remove(),v.exit().remove()};const u={fontSize:14}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(2),o=n(286);e.arrayStats=function(t){if(!Array.isArray(t))throw new Error("input must be an array");if(0===t.length)return{numVals:0,numNans:0,numZeros:0,max:void 0,min:void 0};const e=t.length;let n=-1/0,r=1/0,i=0,o=0,a=0;for(let s=0;s<e;s++){const e=t[s];e>n&&(n=e),e<r&&(r=e),0===e&&(i+=1),isNaN(e)?o+=1:isFinite(e)||(a+=1)}const s={numVals:e,numZeros:i,numNans:o,max:n,min:r,numInfs:a};return s.max===-1/0&&(s.max=NaN),s.min===1/0&&(s.min=NaN),s},e.tensorStats=function(t){return r(this,void 0,void 0,function*(){const[e,n,r]=i.tidy(()=>{const e=i.scalar(0,t.dtype);return[t.min(),t.max(),t.equal(e).sum()]});return yield Promise.all([t.data(),e.data(),n.data(),r.data()]).then(([t,e,n,r])=>{const i=t.length;let o=0,a=0;for(let e=0;e<i;e++){const n=t[e];isNaN(n)?o+=1:isFinite(n)||(a+=1)}let s=e[0],u=n[0];return o===i&&(s=NaN,u=NaN),{numVals:i,numZeros:r[0],numNans:o,min:s,max:u,numInfs:a}})})},e.confusionMatrix=function(t,e,n,a){return r(this,void 0,void 0,function*(){o.assert(1===t.rank,"labels must be a 1D tensor"),o.assert(1===e.rank,"predictions must be a 1D tensor"),o.assert(t.size===e.size,"labels and predictions must be the same length"),null!=a&&o.assert(a.size===e.size,"labels and predictions must be the same length");const r=t.cast("int32"),s=e.cast("int32");null==n&&(n=i.tidy(()=>i.maximum(r.max(),s.max()).cast("int32").dataSync()[0]+1));let u=Promise.resolve(null);return null!=a&&(u=a.data()),Promise.all([r.data(),s.data(),u]).then(([t,e,r])=>{const i=Array(n).fill(0);for(let t=0;t<n;t++)i[t]=Array(n).fill(0);for(let n=0;n<t.length;n++){const o=t[n],a=e[n];i[o][a]+=null!=r?r[n]:1}return i})})},e.accuracy=function(t,e){return r(this,void 0,void 0,function*(){o.assertShapesMatch(t.shape,e.shape,"Error computing accuracy.");const n=t.equal(e),r=n.mean(),a=(yield r.data())[0];return i.dispose([n,r]),a})},e.perClassAccuracy=function(t,e,n){return r(this,void 0,void 0,function*(){return o.assert(1===t.rank,"labels must be a 1D tensor"),o.assert(1===e.rank,"predictions must be a 1D tensor"),o.assert(t.size===e.size,"labels and predictions must be the same length"),null==n&&(n=i.tidy(()=>i.maximum(t.max(),e.max()).dataSync()[0]+1)),Promise.all([t.data(),e.data()]).then(([t,e])=>{const r=Array(n).fill(0),i=Array(n).fill(0);for(let n=0;n<t.length;n++){const o=t[n],a=e[n];r[o]+=1,o===a&&(i[o]+=1)}const o=[];for(let t=0;t<r.length;t++)o.push({count:r[t],accuracy:0===r[t]?0:i[t]/r[t]});return o})})}},function(t,e,n){var r=n(193);t.exports=function(t){if("string"==typeof t||r(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},function(t,e,n){var r=n(593),i=n(73),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return i(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u},function(t,e,n){var r=n(613);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e,n){var r=n(74)(Object,"create");t.exports=r},function(t,e,n){var r=n(95),i=n(63);t.exports=function(t){if(!i(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e,n){var r=n(113);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},function(t,e,n){var r=n(637),i=n(636),o=n(635),a=n(634),s=n(633);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){(function(e){var r=n(695),i=n(683),o=n(682),a=n(209),s=n(344);function u(t){var n;"object"!=typeof t||e.isBuffer(t)||(n=t.passphrase,t=t.key),"string"==typeof t&&(t=new e(t));var u,c,l=o(t,n),f=l.tag,d=l.data;switch(f){case"CERTIFICATE":c=r.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=r.PublicKey.decode(d,"der")),u=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=r.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+f);case"ENCRYPTED PRIVATE KEY":d=function(t,n){var r=t.algorithm.decrypt.kde.kdeparams.salt,o=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),u=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,l=t.subjectPrivateKey,f=parseInt(u.split("-")[1],10)/8,d=s.pbkdf2Sync(n,r,o,f),h=a.createDecipheriv(u,d,c),p=[];return p.push(h.update(l)),p.push(h.final()),e.concat(p)}(d=r.EncryptedPrivateKey.decode(d,"der"),n);case"PRIVATE KEY":switch(u=(c=r.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:r.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=r.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+f);case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=r.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+f)}}t.exports=u,u.signature=r.signature}).call(this,n(18).Buffer)},function(t,e,n){"use strict";var r=e;r.base=n(714),r.short=n(713),r.mont=n(712),r.edwards=n(711)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){var r=n(7).Buffer,i=n(217);t.exports=function(t,e,n,o){if(r.isBuffer(t)||(t=r.from(t,"binary")),e&&(r.isBuffer(e)||(e=r.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=r.alloc(a),u=r.alloc(o||0),c=r.alloc(0);a>0||o>0;){var l=new i;l.update(c),l.update(t),e&&l.update(e),c=l.digest();var f=0;if(a>0){var d=s.length-a;f=Math.min(a,c.length),c.copy(s,d,0,f),a-=f}if(f<c.length&&o>0){var h=u.length-o,p=Math.min(o,c.length-f);c.copy(u,h,f,f+p),o-=p}}return c.fill(0),{key:s,iv:u}}},function(t,e,n){var r=n(7).Buffer;function i(t){r.isBuffer(t)||(t=r.from(t));for(var e=t.length/4|0,n=new Array(e),i=0;i<e;i++)n[i]=t.readUInt32BE(4*i);return n}function o(t){for(;0<t.length;t++)t[0]=0}function a(t,e,n,r,i){for(var o,a,s,u,c=n[0],l=n[1],f=n[2],d=n[3],h=t[0]^e[0],p=t[1]^e[1],m=t[2]^e[2],g=t[3]^e[3],v=4,b=1;b<i;b++)o=c[h>>>24]^l[p>>>16&255]^f[m>>>8&255]^d[255&g]^e[v++],a=c[p>>>24]^l[m>>>16&255]^f[g>>>8&255]^d[255&h]^e[v++],s=c[m>>>24]^l[g>>>16&255]^f[h>>>8&255]^d[255&p]^e[v++],u=c[g>>>24]^l[h>>>16&255]^f[p>>>8&255]^d[255&m]^e[v++],h=o,p=a,m=s,g=u;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^e[v++],a=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&h])^e[v++],s=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^e[v++],u=(r[g>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^e[v++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,n[a]=c,r[c]=a;var l=t[a],f=t[l],d=t[f],h=257*t[c]^16843008*c;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*d^65537*f^257*l^16843008*a,o[0][c]=h<<24|h>>>8,o[1][c]=h<<16|h>>>16,o[2][c]=h<<8|h>>>24,o[3][c]=h,0===a?a=s=1:(a=l^t[t[t[d^l]]],s^=t[t[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,r=4*(n+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<r;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-e]^a}for(var c=[],l=0;l<r;l++){var f=r-l,d=i[f-(l%4?0:4)];c[l]=l<4||f<=4?d:u.INV_SUB_MIX[0][u.SBOX[d>>>24]]^u.INV_SUB_MIX[1][u.SBOX[d>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[d>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&d]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=r.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var n=a(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},function(t,e,n){"use strict";(function(e){!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return e.nextTick(function(){t.apply(null,o)})}}}:t.exports=e}).call(this,n(44))},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,a,s,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(o(n=this._events[t]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(c=n.slice()).length,u=0;u<a;u++)c[u].apply(this,s);return!0},n.prototype.addListener=function(t,e){var a;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?i(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,i(this._events[t])&&!this._events[t].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[t].length>a&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){if(!r(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},n.prototype.removeListener=function(t,e){var n,o,a,s;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(n=this._events[t]).length,o=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(222),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e,n){"use strict";var r=n(3),i=n(30),o=n(50),a=n(80);t.exports=function(t){r(r.S,t,{from:function(t){var e,n,r,s,u=arguments[1];return i(this),(e=void 0!==u)&&i(u),void 0==t?new this:(n=[],e?(r=0,s=o(u,arguments[2],2),a(t,!1,function(t){n.push(s(t,r++))})):a(t,!1,n.push,n),new this(n))}})}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t){r(r.S,t,{of:function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},function(t,e,n){"use strict";t.exports=n(70)||!n(13)(function(){var t=Math.random();__defineSetter__.call(null,t,function(){}),delete n(8)[t]})},function(t,e,n){for(var r,i=n(8),o=n(35),a=n(87),s=a("typed_array"),u=a("view"),c=!(!i.ArrayBuffer||!i.DataView),l=c,f=0,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f<9;)(r=i[d[f++]])?(o(r.prototype,s,!0),o(r.prototype,u,!0)):l=!1;t.exports={ABV:c,CONSTR:l,TYPED:s,VIEW:u}},function(t,e,n){"use strict";var r=n(8),i=n(3),o=n(34),a=n(79),s=n(71),u=n(80),c=n(81),l=n(14),f=n(13),d=n(161),h=n(106),p=n(246);t.exports=function(t,e,n,m,g,v){var b=r[t],y=b,w=g?"set":"add",x=y&&y.prototype,_={},k=function(t){var e=x[t];o(x,t,"delete"==t?function(t){return!(v&&!l(t))&&e.call(this,0===t?0:t)}:"has"==t?function(t){return!(v&&!l(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return v&&!l(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof y&&(v||x.forEach&&!f(function(){(new y).entries().next()}))){var S=new y,E=S[w](v?{}:-0,1)!=S,O=f(function(){S.has(1)}),A=d(function(t){new y(t)}),C=!v&&f(function(){for(var t=new y,e=5;e--;)t[w](e,e);return!t.has(-0)});A||((y=e(function(e,n){c(e,y,t);var r=p(new b,e,y);return void 0!=n&&u(n,g,r[w],r),r})).prototype=x,x.constructor=y),(O||C)&&(k("delete"),k("has"),g&&k("get")),(C||E)&&k(w),v&&x.clear&&delete x.clear}else y=m.getConstructor(e,t,g,w),a(y.prototype,n),s.NEED=!0;return h(y,t),_[t]=y,i(i.G+i.W+i.F*(y!=b),_),v||m.setStrong(y,t,g),y}},function(t,e,n){var r=n(8).navigator;t.exports=r&&r.userAgent||""},function(t,e,n){"use strict";n(376);var r=n(34),i=n(35),o=n(13),a=n(59),s=n(15),u=n(232),c=s("species"),l=!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var d=s(t),h=!o(function(){var e={};return e[d]=function(){return 7},7!=""[t](e)}),p=h?!o(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[c]=function(){return n}),n[d](""),!e}):void 0;if(!h||!p||"replace"===t&&!l||"split"===t&&!f){var m=/./[d],g=n(a,d,""[t],function(t,e,n,r,i){return e.exec===u?h&&!i?{done:!0,value:m.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),v=g[0],b=g[1];r(String.prototype,t,v),i(RegExp.prototype,d,2==e?function(t,e){return b.call(t,this,e)}:function(t){return b.call(t,this)})}}},function(t,e,n){"use strict";var r=n(105),i=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var o=n.call(t,e);if("object"!=typeof o)throw new TypeError("RegExp exec method returned something other than an Object or null");return o}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,e)}},function(t,e,n){var r=n(15)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},t(o)}catch(t){}return n}},function(t,e,n){var r=n(14),i=n(49),o=n(15)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},function(t,e,n){var r=n(48),i=n(59);t.exports=function(t){return function(e,n){var o,a,s=String(i(e)),u=r(n),c=s.length;return u<0||u>=c?t?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):o:t?s.slice(u,u+2):a-56320+(o-55296<<10)+65536}}},function(t,e,n){var r=n(49);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(41),i=n(16),o=n(85);t.exports=function(t){return function(e,n,a){var s,u=r(e),c=i(u.length),l=o(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var r=n(51),i=n(8),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(70)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){"use strict";n.r(e),function(t,r){n.d(e,"array",function(){return G}),n.d(e,"Dataset",function(){return H}),n.d(e,"zip",function(){return K}),n.d(e,"CSVDataset",function(){return nt}),n.d(e,"TextLineDataset",function(){return Y}),n.d(e,"csv",function(){return gt}),n.d(e,"func",function(){return vt}),n.d(e,"generator",function(){return bt}),n.d(e,"microphone",function(){return wt}),n.d(e,"webcam",function(){return yt}),n.d(e,"FileDataSource",function(){return pt}),n.d(e,"URLDataSource",function(){return mt}),n.d(e,"version_data",function(){return xt});var i=n(0),o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};
/**
* @license
* Copyright 2019 Google LLC. 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(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function u(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function c(t,e){return t(e={exports:{}},e.exports),e.exports}"undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self;var l=c(function(t){!function(t,e,n){function r(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function i(t,e){var n=new function(t){var e,n=this,r=(e=4022871197,function(t){t=t.toString();for(var n=0;n<t.length;n++){var r=.02519603282416938*(e+=t.charCodeAt(n));r-=e=r>>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)});n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(t),n.s0<0&&(n.s0+=1),n.s1-=r(t),n.s1<0&&(n.s1+=1),n.s2-=r(t),n.s2<0&&(n.s2+=1),r=null}(t),i=e&&e.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.alea=i}(0,t)}),f=c(function(t){!function(t,e,n){function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function i(t,e){var n=new function(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),e.next()}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xor128=i}(0,t)}),d=c(function(t){!function(t,e,n){function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function i(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),r==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xorwow=i}(0,t)}),h=c(function(t){!function(t,e,n){function r(t,e){return e.x=t.x.slice(),e.i=t.i,e}function i(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.x,i=e.i;return t=r[i],n=(t^=t>>>7)^t<<24,n^=(t=r[i+1&7])^t>>>10,n^=(t=r[i+3&7])^t>>>3,n^=(t=r[i+4&7])^t<<7,t=r[i+7&7],n^=(t^=t<<13)^t<<9,r[i]=n,e.i=i+1&7,n},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n<e.length;++n)r[7&n]=r[7&n]<<15^e.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],t.x=r,t.i=0,n=256;n>0;--n)t.next()}(e,t)}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&(i.x&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xorshift7=i}(0,t)}),p=c(function(t){!function(t,e,n){function r(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function i(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.w,i=e.X,o=e.i;return e.w=r=r+1640531527|0,n=i[o+34&127],t=i[o=o+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=i[o]=n^t,e.i=o,n+(r^r>>>16)|0},function(t,e){var n,r,i,o,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),i=0,o=-32;o<u;++o)e&&(r^=e.charCodeAt((o+32)%e.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(e&&e.length||0)]=-1),i=127,o=512;o>0;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;t.w=a,t.X=s,t.i=i}(e,t)}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&(i.X&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.xor4096=i}(0,t)}),m=c(function(t){!function(t,e,n){function r(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function i(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,r=e.d,i=e.a;return t=t<<25^t>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-r|0,e.d=r<<16^n>>>16^i,e.a=i-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var r=0;r<n.length+20;r++)e.b^=0|n.charCodeAt(r),e.next()}(t),i=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}e&&e.exports?e.exports=i:this.tychei=i}(0,t)}),g=c(function(t){!function(e,r){var i,o=this,a=256,s=6,u="random",c=r.pow(a,s),l=r.pow(2,52),f=2*l,d=a-1;function h(t,n,h){var v=[],b=m(function t(e,n){var r,i=[],o=typeof e;if(n&&"object"==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:"string"==o?e:e+"\0"}((n=1==n?{entropy:!0}:n||{}).entropy?[t,g(e)]:null==t?function(){try{var t;return i&&(t=i.randomBytes)?t=t(a):(t=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(t)),g(t)}catch(t){var n=o.navigator,r=n&&n.plugins;return[+new Date,o,r,o.screen,g(e)]}}():t,3),v),y=new function(t){var e,n=t.length,r=this,i=0,o=r.i=r.j=0,s=r.S=[];for(n||(t=[n++]);i<a;)s[i]=i++;for(i=0;i<a;i++)s[i]=s[o=d&o+t[i%n]+(e=s[i])],s[o]=e;(r.g=function(t){for(var e,n=0,i=r.i,o=r.j,s=r.S;t--;)e=s[i=d&i+1],n=n*a+s[d&(s[i]=s[o=d&o+e])+(s[o]=e)];return r.i=i,r.j=o,n})(a)}(v),w=function(){for(var t=y.g(s),e=c,n=0;t<l;)t=(t+n)*a,e*=a,n=y.g(1);for(;t>=f;)t/=2,e/=2,n>>>=1;return(t+n)/e};return w.int32=function(){return 0|y.g(4)},w.quick=function(){return y.g(4)/4294967296},w.double=w,m(g(y.S),e),(n.pass||h||function(t,e,n,i){return i&&(i.S&&p(i,y),t.state=function(){return p(y,{})}),n?(r[u]=t,e):t})(w,b,"global"in n?n.global:this==r,n.state)}function p(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function m(t,e){for(var n,r=t+"",i=0;i<r.length;)e[d&i]=d&(n^=19*e[d&i])+r.charCodeAt(i++);return g(e)}function g(t){return String.fromCharCode.apply(0,t)}if(r["seed"+u]=h,m(r.random(),e),t.exports){t.exports=h;try{i=n(355)}catch(t){}}}([],Math)});g.alea=l,g.xor128=f,g.xorwow=d,g.xorshift7=h,g.xor4096=p,g.tychei=m;var v=g.alea;function b(t,e,n,r){if(void 0===n&&(n=new Map),void 0===r&&(r=new Set),null==t)return null;if(r.has(t))throw new Error("Circular references are not supported.");if(n.has(t))return n.get(t);var i=e(t);if(i.recurse&&null!==i.value)throw new Error("A deep map function may not return both a value and recurse=true.");if(i.recurse){if(x(t)){var o=Array.isArray(t)?[]:{};for(var a in r.add(t),t){var s=b(t[a],e,n,r);o[a]=s}return r.delete(t),o}throw new Error("Can't recurse into non-iterable type: "+t)}return n.set(t,i.value),i.value}function y(t){return null===t?null:x(t[0])?{value:null,recurse:!0}:{value:t,recurse:!1}}function w(t,e){return s(this,void 0,void 0,function(){var n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:n=new Map,b(t,e,n),r=0,i=Array.from(n.keys()),u.label=1;case 1:return r<i.length?(o=i[r],(a=n.get(o))instanceof Promise?[4,a]:[3,3]):[3,4];case 2:s=u.sent(),n.set(o,s),u.label=3;case 3:return r++,[3,1];case 4:return[2,b(t,e,n)]}})})}function x(t){return null!=t&&(Array.isArray(t)||"object"==typeof t&&!(t instanceof i.Tensor))}function _(t){return t instanceof i.Tensor?{value:t.clone(),recurse:!1}:x(t)?{value:null,recurse:!0}:{value:t,recurse:!1}}var k=function(){function t(t){if(this.capacity=t,this.begin=0,this.end=0,null==t)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(t<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(t),this.doubledCapacity=2*t}return t.prototype.wrap=function(t){for(;t<0;)t+=this.doubledCapacity;return t%this.doubledCapacity},t.prototype.get=function(t){if(t<0)throw new RangeError("Can't get item at a negative index.");return this.data[t%this.capacity]},t.prototype.set=function(t,e){if(t<0)throw new RangeError("Can't set item at a negative index.");this.data[t%this.capacity]=e},t.prototype.length=function(){var t=this.end-this.begin;return t<0&&(t=this.doubledCapacity+t),t},t.prototype.isFull=function(){return this.length()===this.capacity},t.prototype.isEmpty=function(){return 0===this.length()},t.prototype.push=function(t){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,t),this.end=this.wrap(this.end+1)},t.prototype.pushAll=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];this.push(r)}},t.prototype.pop=function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);var t=this.get(this.end);return this.set(this.end,void 0),t},t.prototype.unshift=function(t){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,t)},t.prototype.shift=function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var t=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),t},t.prototype.shuffleExcise=function(t){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var e=this.wrap(this.begin+t),n=this.get(e);return this.set(e,this.pop()),n},t}(),S=function(t){function e(){return t.call(this,e.INITIAL_CAPACITY)||this}return a(e,t),e.prototype.isFull=function(){return!1},e.prototype.push=function(e){t.prototype.isFull.call(this)&&this.expand(),t.prototype.push.call(this,e)},e.prototype.unshift=function(e){t.prototype.isFull.call(this)&&this.expand(),t.prototype.unshift.call(this,e)},e.prototype.expand=function(){for(var t=2*this.capacity,e=new Array(t),n=this.length(),r=0;r<n;r++)e[r]=this.get(this.wrap(this.begin+r));this.data=e,this.capacity=t,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=n},e.INITIAL_CAPACITY=32,e}(k);function E(t){return new M(t)}function O(t){return new N(t)}var A,C=function(){function t(){}return t.prototype.toArray=function(){return s(this,void 0,void 0,function(){var t,e;return u(this,function(n){switch(n.label){case 0:return t=[],[4,this.next()];case 1:e=n.sent(),n.label=2;case 2:return e.done?[3,4]:(t.push(e.value),[4,this.next()]);case 3:return e=n.sent(),[3,2];case 4:return[2,t]}})})},t.prototype.toArrayForTest=function(){return s(this,void 0,void 0,function(){var t,e,n;return u(this,function(r){switch(r.label){case 0:return t=this.prefetch(100),e=[],[4,t.next()];case 1:n=r.sent(),r.label=2;case 2:return n.done?[3,4]:(e.push(n.value),[4,t.next()]);case 3:return n=r.sent(),[3,2];case 4:return[2,e]}})})},t.prototype.resolveFully=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){switch(e.label){case 0:return[4,this.next()];case 1:t=e.sent(),e.label=2;case 2:return t.done?[3,4]:[4,this.next()];case 3:return t=e.sent(),[3,2];case 4:return[2]}})})},t.prototype.resolveWhile=function(t){return s(this,void 0,void 0,function(){var e,n;return u(this,function(r){switch(r.label){case 0:return[4,this.next()];case 1:e=r.sent(),n=t(e.value),r.label=2;case 2:return e.done||!n?[3,4]:[4,this.next()];case 3:return e=r.sent(),n=t(e.value),[3,2];case 4:return[2]}})})},t.prototype.handleErrors=function(t){return new P(this,t)},t.prototype.filter=function(t){return new R(this,t)},t.prototype.map=function(t){return new F(this,t)},t.prototype.mapAsync=function(t){return new z(this,t)},t.prototype.serialMapAsync=function(t){return new z(this,t).serial()},t.prototype.flatmap=function(t){return new B(this,t)},t.prototype.forEachAsync=function(t){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,this.map(t).resolveFully()]})})},t.prototype.serialForEach=function(t){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,this.serialMapAsync(t).resolveWhile(function(t){return!0===t})]})})},t.prototype.rowMajorBatch=function(t,e){return void 0===e&&(e=!0),new j(this,t,e)},t.prototype.columnMajorBatch=function(t,e,n){return void 0===e&&(e=!0),void 0===n&&(n=y),this.rowMajorBatch(t,e).map(function(t){return function(t,e){return void 0===e&&(e=y),function t(e,n,r){void 0===r&&(r=new Set);var i=e[0];if(r.has(i))throw new Error("Circular references are not supported.");var o=n(e);if(o.recurse&&null!==o.value)throw new Error("A deep zip function may not return both a value and recurse=true.");if(o.recurse){if(x(i)){var a=Array.isArray(i)?[]:{};r.add(i);var s=function(i){var o=t(e.map(function(t){return t[i]}),n,r);a[i]=o};for(var u in i)s(u);return r.delete(i),a}throw new Error("Can't recurse into non-iterable type: "+i)}return o.value}(t,e)}(t,n)})},t.prototype.concatenate=function(t,e){return new U(E([this,t]),e)},t.prototype.take=function(t){return t<0||null==t?this:new D(this,t)},t.prototype.skip=function(t){return t<0||null==t?this:new I(this,t)},t.prototype.prefetch=function(t){return new q(this,t)},t.prototype.shuffle=function(t,e){return new V(this,t,e)},t.prototype.serial=function(){return new T(this)},t}(),M=function(t){function e(e){var n=t.call(this)||this;return n.items=e,n.trav=0,n}return a(e,t),e.prototype.summary=function(){return"Array of "+this.items.length+" items"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){return this.trav>=this.items.length?[2,{value:null,done:!0}]:(t=this.items[this.trav],this.trav++,[2,{value:function(t){return function(t,e){return b(t,_)}(t)}(t),done:!1}])})})},e}(C),N=function(t){function e(e){var n=t.call(this)||this;return n.nextFn=e,n}return a(e,t),e.prototype.summary=function(){return"Function call"},e.prototype.next=function(){return s(this,void 0,void 0,function(){return u(this,function(t){try{return[2,this.nextFn()]}catch(t){throw t.message="Error thrown while iterating through a dataset: "+t.message,t}return[2]})})},e}(C),T=function(t){function e(e){var n=t.call(this)||this;return n.upstream=e,n.lastRead=Promise.resolve({value:null,done:!1}),n}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Serial"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.upstream.next()]})})},e}(C),I=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.maxCount=n,r.count=0,r.lastRead=Promise.resolve({value:null,done:!1}),r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Skip"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){switch(e.label){case 0:return this.count++<this.maxCount?[4,this.upstream.next()]:[3,2];case 1:return(t=e.sent()).done?[2,t]:(Object(i.dispose)(t.value),[3,0]);case 2:return[2,this.upstream.next()]}})})},e}(C),D=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.maxCount=n,r.count=0,r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Take"},e.prototype.next=function(){return s(this,void 0,void 0,function(){return u(this,function(t){return this.count++>=this.maxCount?[2,{value:null,done:!0}]:[2,this.upstream.next()]})})},e}(C),j=function(t){function e(e,n,r){void 0===r&&(r=!0);var i=t.call(this)||this;return i.upstream=e,i.batchSize=n,i.enableSmallLastBatch=r,i.lastRead=Promise.resolve({value:null,done:!1}),i}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> RowMajorBatch"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){var t,e;return u(this,function(n){switch(n.label){case 0:t=[],n.label=1;case 1:return t.length<this.batchSize?[4,this.upstream.next()]:[3,3];case 2:return(e=n.sent()).done?this.enableSmallLastBatch&&t.length>0?[2,{value:t,done:!1}]:[2,{value:null,done:!0}]:(t.push(e.value),[3,1]);case 3:return[2,{value:t,done:!1}]}})})},e}(C),R=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.predicate=n,r.lastRead=Promise.resolve({value:null,done:!1}),r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Filter"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){switch(e.label){case 0:return[4,this.upstream.next()];case 1:return(t=e.sent()).done||this.predicate(t.value)?[2,t]:(Object(i.dispose)(t.value),[3,0]);case 2:return[2]}})})},e}(C),F=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.transform=n,r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Map"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t,e,n,r,o,a,s;return u(this,function(u){switch(u.label){case 0:return[4,this.upstream.next()];case 1:if((t=u.sent()).done)return[2,{value:null,done:!0}];for(e=i.tensor_util.getTensorsInContainer(t.value),n=this.transform(t.value),r=i.tensor_util.getTensorsInContainer(n),o=0,a=e;o<a.length;o++)s=a[o],i.tensor_util.isTensorInList(s,r)||s.dispose();return[2,{value:n,done:!1}]}})})},e}(C),P=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.handler=n,r.count=0,r.lastRead=Promise.resolve({value:null,done:!1}),r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> handleErrors"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){switch(e.label){case 0:e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.upstream.next()];case 2:return[2,e.sent()];case 3:return t=e.sent(),this.handler(t)?[3,4]:[2,{value:null,done:!0}];case 4:return[3,0];case 5:return[2]}})})},e}(C),z=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.transform=n,r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> AsyncMap"},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t,e,n,r,o,a,s;return u(this,function(u){switch(u.label){case 0:return[4,this.upstream.next()];case 1:return(t=u.sent()).done?[2,{value:null,done:!0}]:(e=i.tensor_util.getTensorsInContainer(t.value),[4,this.transform(t.value)]);case 2:for(n=u.sent(),r=i.tensor_util.getTensorsInContainer(n),o=0,a=e;o<a.length;o++)s=a[o],i.tensor_util.isTensorInList(s,r)||s.dispose();return[2,{value:n,done:!1}]}})})},e}(C),L=function(t){function e(){var e=t.call(this)||this;return e.outputQueue=new S,e.lastRead=Promise.resolve({value:null,done:!1}),e}return a(e,t),e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return 0!==this.outputQueue.length()?[3,2]:[4,this.pump()];case 1:return t.sent()?[3,0]:[2,{value:null,done:!0}];case 2:return[2,{value:this.outputQueue.shift(),done:!1}]}})})},e}(C),B=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.transform=n,r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Flatmap"},e.prototype.pump=function(){return s(this,void 0,void 0,function(){var t,e,n,r,o,a,s;return u(this,function(u){switch(u.label){case 0:return[4,this.upstream.next()];case 1:if((t=u.sent()).done)return[2,!1];for(e=i.tensor_util.getTensorsInContainer(t.value),n=this.transform(t.value),r=i.tensor_util.getTensorsInContainer(n),this.outputQueue.pushAll(n),o=0,a=e;o<a.length;o++)s=a[o],i.tensor_util.isTensorInList(s,r)||s.dispose();return[2,!0]}})})},e}(L),U=function(t){function e(e,n){var r=t.call(this)||this;return r.baseErrorHandler=n,r.lastRead=null,r.iterator=null,r.moreIterators=e,r}return a(e,t),e.prototype.summary=function(){return"TODO: fill in upstream of chained summaries -> Chained"},e.prototype.next=function(){return s(this,void 0,void 0,function(){return u(this,function(t){return this.lastRead=this.readFromChain(this.lastRead),[2,this.lastRead]})})},e.prototype.readFromChain=function(t){return s(this,void 0,void 0,function(){var e,n;return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),null!=this.iterator?[3,3]:[4,this.moreIterators.next()];case 2:if((e=r.sent()).done)return[2,{value:null,done:!0}];this.iterator=e.value,null!=this.baseErrorHandler&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler)),r.label=3;case 3:return[4,this.iterator.next()];case 4:return(n=r.sent()).done?(this.iterator=null,[2,this.readFromChain(t)]):[2,n]}})})},e}(C);!function(t){t[t.FAIL=0]="FAIL",t[t.SHORTEST=1]="SHORTEST",t[t.LONGEST=2]="LONGEST"}(A||(A={}));var W=function(t){function e(e,n){void 0===n&&(n=A.FAIL);var r=t.call(this)||this;return r.iterators=e,r.mismatchMode=n,r.count=0,r.currentPromise=null,r}return a(e,t),e.prototype.summary=function(){return"{TODO: fill in upstream of zip summaries} -> Zip"},e.prototype.nextState=function(t){return s(this,void 0,void 0,function(){function e(t){return t instanceof C?{value:t.next().then(function(t){return n++,t.done&&r++,t.value}),recurse:!1}:{value:null,recurse:!0}}var n,r,i;return u(this,function(o){switch(o.label){case 0:return[4,t];case 1:return o.sent(),n=0,r=0,[4,w(this.iterators,e)];case 2:if(i=o.sent(),n===r)return[2,{value:null,done:!0}];if(r>0)switch(this.mismatchMode){case A.FAIL:throw new Error("Zipped streams should have the same length. Mismatched at element "+this.count+".");case A.SHORTEST:return[2,{value:null,done:!0}];case A.LONGEST:}return this.count++,[2,{value:i,done:!1}]}})})},e.prototype.next=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return this.currentPromise=this.nextState(this.currentPromise),[4,this.currentPromise];case 1:return[2,t.sent()]}})})},e}(C),q=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.bufferSize=n,r.buffer=new k(n),r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Prefetch"},e.prototype.refill=function(){for(;!this.buffer.isFull();){var t=this.upstream.next();this.buffer.push(t)}},e.prototype.next=function(){return this.refill(),this.buffer.shift()},e}(C),V=function(t){function e(e,n,r){var o=t.call(this,e,n)||this;return o.upstream=e,o.windowSize=n,o.upstreamExhausted=!1,o.random=v(r||i.util.now().toString()),o.lastRead=Promise.resolve({value:null,done:!1}),o}return a(e,t),e.prototype.next=function(){return s(this,void 0,void 0,function(){var t=this;return u(this,function(e){return this.lastRead=this.lastRead.then(function(){return t.serialNext()}),[2,this.lastRead]})})},e.prototype.randomInt=function(t){return Math.floor(this.random()*t)},e.prototype.chooseIndex=function(){return this.randomInt(this.buffer.length())},e.prototype.serialNext=function(){return s(this,void 0,void 0,function(){var t,e;return u(this,function(n){switch(n.label){case 0:this.upstreamExhausted||this.refill(),n.label=1;case 1:return this.buffer.isEmpty()?[3,3]:(t=this.chooseIndex(),[4,this.buffer.shuffleExcise(t)]);case 2:return(e=n.sent()).done?(this.upstreamExhausted=!0,[3,1]):(this.refill(),[2,e]);case 3:return[2,{value:null,done:!0}]}})})},e}(q),H=function(){function t(){this.size=null}return t.prototype.batch=function(t,e){var n=this;void 0===e&&(e=!0);var r=this;return i.util.assert(t>0,function(){return"batchSize needs to be positive, but it is\n "+t}),$(function(){return s(n,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return[4,r.iterator()];case 1:return[2,n.sent().columnMajorBatch(t,e,X)]}})})},this.size===1/0||null==this.size?this.size:e?Math.ceil(this.size/t):Math.floor(this.size/t))},t.prototype.concatenate=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){var e,r;return u(this,function(i){switch(i.label){case 0:return[4,n.iterator()];case 1:return r=(e=i.sent()).concatenate,[4,t.iterator()];case 2:return[2,r.apply(e,[i.sent()])]}})})},this.size===1/0||t.size===1/0?1/0:null!=this.size&&null!=t.size?this.size+t.size:null)},t.prototype.filter=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().filter(function(e){return Object(i.tidy)(function(){return t(e)})})]}})})},this.size===1/0?1/0:null)},t.prototype.forEachAsync=function(t){return s(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.iterator()];case 1:return[2,e.sent().forEachAsync(t)]}})})},t.prototype.forEach=function(t){return s(this,void 0,void 0,function(){return u(this,function(e){return Object(i.deprecationWarn)("dataset.forEach() is deprecated and will be removed. Please use dataset.forEachAsync() instead"),[2,this.forEachAsync(t)]})})},t.prototype.map=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().map(function(e){return Object(i.tidy)(function(){return t(e)})})]}})})},this.size)},t.prototype.mapAsync=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().mapAsync(t)]}})})},this.size)},t.prototype.prefetch=function(t){var e=this;if(null==t)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");var n=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().prefetch(t)]}})})},this.size)},t.prototype.repeat=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){var e=this;return u(this,function(r){return[2,function(t,e){return new U(t,void 0)}(O(function(){return s(e,void 0,void 0,function(){var t;return u(this,function(e){switch(e.label){case 0:return t={},[4,n.iterator()];case 1:return[2,(t.value=e.sent(),t.done=!1,t)]}})})}).take(t))]})})},null!=this.size&&t>0?this.size*t:0===t?0:null!=this.size&&(void 0===t||t<0)?1/0:null)},t.prototype.skip=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().skip(t)]}})})},null!=this.size&&t>=0&&this.size>=t?this.size-t:null!=this.size&&(this.size<t||void 0===t||t<0)?0:null)},t.prototype.shuffle=function(t,e,n){var r=this;if(void 0===n&&(n=!0),null==t||t<0)throw null==this.size?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError("`Dataset.shuffle()` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for `tf.Tensor`s), consider setting bufferSize to the dataset size ("+this.size+" elements)");var o=this,a=v(e||i.util.now().toString());return $(function(){return s(r,void 0,void 0,function(){var e;return u(this,function(r){switch(r.label){case 0:return e=a.int32(),n&&(e+=a.int32()),[4,o.iterator()];case 1:return[2,r.sent().shuffle(t,e.toString())]}})})},this.size)},t.prototype.take=function(t){var e=this,n=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,n.iterator()];case 1:return[2,e.sent().take(t)]}})})},null!=this.size&&this.size>t?t:null!=this.size&&this.size<=t?this.size:null)},t.prototype.toArray=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return[4,this.iterator()];case 1:return[2,t.sent().toArray()]}})})},t.prototype.toArrayForTest=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return[4,this.iterator()];case 1:return[2,t.sent().toArrayForTest()]}})})},t.MAX_BUFFER_SIZE=1e4,t}();function $(t,e){return void 0===e&&(e=null),new(function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.size=e,t}return a(r,n),r.prototype.iterator=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,t()]})})},r}(H))}function G(t){var e=this;return $(function(){return s(e,void 0,void 0,function(){return u(this,function(e){return[2,E(t)]})})},t.length)}function K(t){var e,n=this;if(!x(t))throw new Error("The argument to zip() must be an object or array.");if(Array.isArray(t))for(var r=0;r<t.length;r++)e=null==e?t[r].size:Math.min(e,t[r].size);else if(t instanceof Object)for(var i in t)e=null==e?t[i].size:Math.min(e,t[i].size);return $(function(){return s(n,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,w(t,function(t){if(t instanceof H)return{value:t.iterator(),recurse:!1};if(x(t))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")})];case 1:return[2,function(t,e){return void 0===e&&(e=A.FAIL),new W(t,e)}(e.sent(),A.SHORTEST)]}})})},e)}function X(t){return null===t?null:function(t){return null==t||function(t){return null===t||"object"!=typeof t&&"function"!=typeof t}(t)||Array.isArray(t)||"object"==typeof t&&t instanceof i.Tensor||i.util.isTypedArray(t)}(t[0])?{value:function(t){if(0===t.length)throw new Error("Can't make a batch of zero elements.");return t[0]instanceof i.Tensor?Object(i.stack)(t):Object(i.tensor)(t)}(t),recurse:!1}:{value:null,recurse:!0}}var Y=function(t){function e(e){var n=t.call(this)||this;return n.input=e,n}return a(e,t),e.prototype.iterator=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.input.iterator()];case 1:return[2,t.sent().decodeUTF8().split("\n").map(function(t){return t.endsWith("\r")&&(t=t.slice(0,-1)),t})]}})})},e}(H),J=Symbol("out"),Z=Symbol("field"),Q=Symbol("quote"),tt=Symbol("quoteafterquote"),et=Symbol("quoteinquote"),nt=function(t){function e(e,n){var r=t.call(this)||this;return r.input=e,r.hasHeader=!0,r.fullColumnNames=null,r.columnNamesValidated=!1,r.columnConfigs=null,r.configuredColumnsOnly=!1,r.delimiter=",",r.delimWhitespace=!1,r.base=new Y(e),n||(n={}),r.hasHeader=!1!==n.hasHeader,r.fullColumnNames=n.columnNames,r.columnConfigs=n.columnConfigs,r.configuredColumnsOnly=n.configuredColumnsOnly,n.delimWhitespace?(i.util.assert(null==n.delimiter,function(){return"Delimiter should not be provided when delimWhitespace is true."}),r.delimWhitespace=!0,r.delimiter=" "):r.delimiter=n.delimiter?n.delimiter:",",r}return a(e,t),e.prototype.columnNames=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:t.sent(),t.label=2;case 2:return[2,this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames]}})})},e.prototype.setColumnNames=function(){return s(this,void 0,void 0,function(){var t,e,n,r,o,a,s=this;return u(this,function(u){switch(u.label){case 0:return[4,this.maybeReadHeaderLine()];case 1:if(t=u.sent(),!this.fullColumnNames&&!t)throw new Error("Column names must be provided if there is no header line.");if(this.fullColumnNames&&t&&i.util.assert(t.length===this.fullColumnNames.length,function(){return"The length of provided columnNames ("+s.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+t.length.toString()+")."}),this.fullColumnNames||(this.fullColumnNames=t),e=this.fullColumnNames.reduce(function(t,e){return t[e]=t[e]+1||1,t},{}),n=Object.keys(e).filter(function(t){return e[t]>1}),i.util.assert(0===n.length,function(){return"Duplicate column names found: "+n.toString()}),this.columnConfigs)for(r=0,o=Object.keys(this.columnConfigs);r<o.length;r++)if(a=o[r],-1===this.fullColumnNames.indexOf(a))throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").");return this.columnNamesValidated=!0,[2]}})})},e.prototype.maybeReadHeaderLine=function(){return s(this,void 0,void 0,function(){var t,e;return u(this,function(n){switch(n.label){case 0:return this.hasHeader?[4,this.base.iterator()]:[3,3];case 1:return[4,n.sent().next()];case 2:if((t=n.sent()).done)throw new Error("No data was found for CSV parsing.");return e=t.value,[2,this.parseRow(e,!1)];case 3:return[2,null]}})})},e.prototype.iterator=function(){return s(this,void 0,void 0,function(){var t,e=this;return u(this,function(n){switch(n.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:n.sent(),n.label=2;case 2:return[4,this.base.iterator()];case 3:return t=n.sent(),this.hasHeader&&(t=t.skip(1)),[2,t.map(function(t){return e.makeDataElement(t)})]}})})},e.prototype.makeDataElement=function(t){for(var e=this.parseRow(t),n={},r={},i=0;i<this.fullColumnNames.length;i++){var o=this.fullColumnNames[i],a=this.columnConfigs?this.columnConfigs[o]:null;if(!this.configuredColumnsOnly||a){var s=e[i],u=null;if(""===s)if(a&&void 0!==a.default)u=a.default;else{if(a&&(a.required||a.isLabel))throw new Error("Required column "+o+" is empty in this line: "+t);u=void 0}else{var c=Number(s);if(isNaN(c))u=a&&"bool"===a.dtype?this.getBoolean(s):s;else if(a&&a.dtype)switch(a.dtype){case"float32":u=c;break;case"int32":u=Math.floor(c);break;case"bool":u=this.getBoolean(s);break;default:u=c}else u=c}a&&a.isLabel?r[o]=u:n[o]=u}}return 0===Object.keys(r).length?n:{xs:n,ys:r}},e.prototype.getBoolean=function(t){return"1"===t||"true"===t.toLowerCase()?1:0},e.prototype.parseRow=function(t,e){void 0===e&&(e=!0);for(var n=[],r=0,i=t.length,o=J,a=0;a<i;a++)switch(o){case J:switch(t.charAt(a)){case'"':r=a+1,o=Q;break;case this.delimiter:if(r=a+1," "===this.delimiter&&this.delimWhitespace)break;n.push(""),o=J;break;default:o=Z,r=a}break;case Z:switch(t.charAt(a)){case this.delimiter:n.push(t.substring(r,a)),o=J,r=a+1}break;case Q:switch(t.charAt(a)){case'"':o=tt}break;case tt:switch(t.charAt(a)){case this.delimiter:n.push(t.substring(r,a-1)),o=J,r=a+1;break;case'"':o=Q;break;default:o=et}break;case et:switch(t.charAt(a)){case'"':o=Q}}if(o===tt?n.push(t.substring(r,i-1)):n.push(t.substring(r)),e&&n.length!==this.fullColumnNames.length)throw new Error("Invalid row in csv file. Should have "+this.fullColumnNames.length+" elements in a row, but got "+n);return n},e}(H),rt=function(t){function e(e){var n=t.call(this)||this;n.microphoneConfig=e,n.isClosed=!1,n.fftSize=e.fftSize||1024;var r=Math.log2(n.fftSize);if(n.fftSize<0||r<4||r>14||!Number.isInteger(r))throw new Error("Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got "+n.fftSize);if(n.numFrames=e.numFramesPerSpectrogram||43,n.sampleRateHz=e.sampleRateHz,n.columnTruncateLength=e.columnTruncateLength||n.fftSize,n.audioTrackConstraints=e.audioTrackConstraints,n.smoothingTimeConstant=e.smoothingTimeConstant||0,n.includeSpectrogram=!1!==e.includeSpectrogram,n.includeWaveform=!0===e.includeWaveform,!n.includeSpectrogram&&!n.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.");return n}return a(e,t),e.prototype.summary=function(){return"microphone"},e.create=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,function(){var n;return u(this,function(r){switch(r.label){case 0:if(i.ENV.get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");return[4,(n=new e(t)).start()];case 1:return r.sent(),[2,n]}})})},e.prototype.start=function(){return s(this,void 0,void 0,function(){var t,e,n,r;return u(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=this,[4,navigator.mediaDevices.getUserMedia({audio:null==this.audioTrackConstraints||this.audioTrackConstraints,video:!1})];case 1:return t.stream=i.sent(),[3,3];case 2:throw e=i.sent(),new Error("Error thrown while initializing video stream: "+e.message);case 3:if(!this.stream)throw new Error("Could not obtain audio from microphone.");if(n=window.AudioContext||window.webkitAudioContext,this.audioContext=new n,this.sampleRateHz){if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error("Mismatch in sampling rate: Expected: "+this.sampleRateHz+"; Actual: "+this.audioContext.sampleRate)}else this.sampleRateHz=this.audioContext.sampleRate;return r=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,r.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize),[2]}})})},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t,e,n,r,i;return u(this,function(o){switch(o.label){case 0:return this.isClosed?[2,{value:null,done:!0}]:[4,this.getAudioData()];case 1:return n=o.sent(),this.includeSpectrogram&&(r=this.flattenQueue(n.freqDataQueue),t=this.getTensorFromAudioDataArray(r,[this.numFrames,this.columnTruncateLength,1])),this.includeWaveform&&(i=this.flattenQueue(n.timeDataQueue),e=this.getTensorFromAudioDataArray(i,[this.numFrames*this.fftSize,1])),[2,{value:{spectrogram:t,waveform:e},done:!1}]}})})},e.prototype.capture=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.next()];case 1:return[2,t.sent().value]}})})},e.prototype.getAudioData=function(){return s(this,void 0,void 0,function(){var t,e,n,r=this;return u(this,function(i){return t=[],e=[],n=0,[2,new Promise(function(i){var o=setInterval(function(){r.includeSpectrogram&&(r.analyser.getFloatFrequencyData(r.freqData),r.freqData[0]===-1/0&&i({freqDataQueue:t,timeDataQueue:e}),t.push(r.freqData.slice(0,r.columnTruncateLength))),r.includeWaveform&&(r.analyser.getFloatTimeDomainData(r.timeData),e.push(r.timeData.slice())),++n===r.numFrames&&(clearInterval(o),i({freqDataQueue:t,timeDataQueue:e}))},r.fftSize/r.sampleRateHz*1e3)})]})})},e.prototype.stop=function(){this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop()},e.prototype.toArray=function(){throw new Error("Can not convert infinite audio stream to array.")},e.prototype.getSampleRate=function(){return this.sampleRateHz},e.prototype.flattenQueue=function(t){var e=t[0].length,n=new Float32Array(t.length*e);return t.forEach(function(t,r){return n.set(t,r*e)}),n},e.prototype.getTensorFromAudioDataArray=function(t,e){var n=new Float32Array(i.util.sizeFromShape(e));return n.set(t,n.length-t.length),Object(i.tensor)(n,e)},e}(C),it=function(t){function e(e,n){var r=t.call(this)||this;if(r.webcamVideoElement=e,r.webcamConfig=n,r.isClosed=!0,r.resize=!1,r.needToResize())if(r.resize=!0,r.cropSize=[r.webcamConfig.resizeHeight,r.webcamConfig.resizeWidth],r.cropBoxInd=Object(i.tensor1d)([0],"int32"),r.webcamConfig.centerCrop){var o=1*r.webcamConfig.resizeWidth/r.webcamVideoElement.width,a=1*r.webcamConfig.resizeHeight/r.webcamVideoElement.height,s=(1-o)/2,u=(1-a)/2,c=s+o,l=a+u;r.cropBox=Object(i.tensor2d)([u,s,l,c],[1,4])}else r.cropBox=Object(i.tensor2d)([0,0,1,1],[1,4]);return r}return a(e,t),e.prototype.summary=function(){return"webcam"},e.create=function(t,n){return void 0===n&&(n={}),s(this,void 0,void 0,function(){var r;return u(this,function(o){switch(o.label){case 0:if(i.ENV.get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!t){if(t=document.createElement("video"),!n.resizeWidth||!n.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");t.width=n.resizeWidth,t.height=n.resizeHeight}return[4,(r=new e(t,n)).start()];case 1:return o.sent(),[2,r]}})})},e.prototype.start=function(){return s(this,void 0,void 0,function(){var t,e,n=this;return u(this,function(r){switch(r.label){case 0:this.webcamConfig.facingMode&&i.util.assert("user"===this.webcamConfig.facingMode||"environment"===this.webcamConfig.facingMode,function(){return"Invalid webcam facing mode: "+n.webcamConfig.facingMode+". Please provide 'user' or 'environment'"}),r.label=1;case 1:return r.trys.push([1,3,,4]),t=this,[4,navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})];case 2:return t.stream=r.sent(),[3,4];case 3:throw(e=r.sent()).message="Error thrown while initializing video stream: "+e.message,e;case 4:if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(t){console.log(t),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,[2,new Promise(function(t){n.webcamVideoElement.onloadedmetadata=function(){t()}})]}})})},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){if(this.isClosed)return[2,{value:null,done:!0}];try{t=i.browser.fromPixels(this.webcamVideoElement)}catch(t){throw new Error("Error thrown converting video to pixels: "+JSON.stringify(t))}if(!this.resize)return[2,{value:t,done:!1}];try{return[2,{value:this.cropAndResizeFrame(t),done:!1}]}catch(t){throw new Error("Error thrown cropping the video: "+t.message)}finally{t.dispose()}return[2]})})},e.prototype.needToResize=function(){return!(!this.webcamConfig.resizeWidth||!this.webcamConfig.resizeHeight||this.webcamVideoElement.width===this.webcamConfig.resizeWidth&&this.webcamVideoElement.height===this.webcamConfig.resizeHeight)},e.prototype.cropAndResizeFrame=function(t){var e=this;return Object(i.tidy)(function(){var n,r=t.toFloat().expandDims(0),o=(n=i.image.cropAndResize(r,e.cropBox,e.cropBoxInd,e.cropSize,"bilinear")).shape;return n.reshape(o.slice(1))})},e.prototype.capture=function(){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.next()];case 1:return[2,t.sent().value]}})})},e.prototype.stop=function(){this.stream.getTracks().forEach(function(t){return t.stop()});try{this.webcamVideoElement.srcObject=null}catch(t){console.log(t),this.webcamVideoElement.src=null}this.isClosed=!0},e.prototype.toArray=function(){throw new Error("Can not convert infinite video stream to array.")},e}(C),ot=function(){},at=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.split=function(t){return new st(this,t)},e}(C),st=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.impl=new ut(e,n),r}return a(e,t),e.prototype.summary=function(){return this.impl.summary()},e.prototype.next=function(){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.impl.next()]})})},e}(at),ut=function(t){function e(e,n){var r=t.call(this)||this;return r.upstream=e,r.separator=n,r.carryover="",r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Split('"+this.separator+"')"},e.prototype.pump=function(){return s(this,void 0,void 0,function(){var t,e,n,r,i;return u(this,function(o){switch(o.label){case 0:return[4,this.upstream.next()];case 1:if((t=o.sent()).done)return""===this.carryover?[2,!1]:(this.outputQueue.push(this.carryover),this.carryover="",[2,!0]);for((e=t.value.split(this.separator))[0]=this.carryover+e[0],n=0,r=e.slice(0,-1);n<r.length;n++)i=r[n],this.outputQueue.push(i);return this.carryover=e[e.length-1],[2,!0]}})})},e}(L),ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.decodeUTF8=function(){return new lt(this)},e}(C),lt=function(t){function e(e){var n=t.call(this)||this;return n.upstream=e,n.impl=new ft(e),n}return a(e,t),e.prototype.summary=function(){return this.impl.summary()},e.prototype.next=function(){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.impl.next()]})})},e}(at),ft=function(t){function e(e){var r=t.call(this)||this;if(r.upstream=e,i.ENV.get("IS_BROWSER"))r.decoder=new TextDecoder("utf-8");else{var o=n(673).StringDecoder;r.decoder=new o("utf8")}return r}return a(e,t),e.prototype.summary=function(){return this.upstream.summary()+" -> Utf8"},e.prototype.pump=function(){return s(this,void 0,void 0,function(){var t,e,n;return u(this,function(o){switch(o.label){case 0:return[4,this.upstream.next()];case 1:return(t=o.sent()).done?[2,!1]:(e=t.value,n=i.ENV.get("IS_BROWSER")?this.decoder.decode(e,{stream:!0}):this.decoder.write(r.from(e.buffer)),this.outputQueue.push(n),[2,!0])}})})},e}(L),dt=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;return r.file=e,r.options=n,i.util.assert(e instanceof Uint8Array||!!i.ENV.get("IS_BROWSER")&&(e instanceof File||e instanceof Blob),function(){return"FileChunkIterator only supports File, Blob and Uint8Array right now."}),r.offset=n.offset||0,r.chunkSize=n.chunkSize||1048576,r}return a(e,t),e.prototype.summary=function(){return"FileChunks "+this.file},e.prototype.next=function(){return s(this,void 0,void 0,function(){var t,e,n=this;return u(this,function(r){switch(r.label){case 0:return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?[2,{value:null,done:!0}]:(t=new Promise(function(t,e){var r=n.offset+n.chunkSize;if(n.file instanceof Uint8Array)t(new Uint8Array(n.file.slice(n.offset,r)));else{var i=new FileReader;i.onload=function(n){var r=i.result;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),!(r instanceof Uint8Array))return e(new TypeError("FileReader returned unknown type."));t(r)},i.onabort=function(t){return e(new Error("Aborted"))},i.onerror=function(t){return e(new Error(t.type))};var o=n.file.slice(n.offset,r);i.readAsArrayBuffer(o)}n.offset=r}),e={},[4,t]);case 1:return[2,(e.value=r.sent(),e.done=!1,e)]}})})},e}(ct);function ht(t){return"string"==typeof t&&"file://"===t.substr(0,7)}var pt=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;return r.input=e,r.options=n,r}return a(e,t),e.prototype.iterator=function(){return s(this,void 0,void 0,function(){var t;return u(this,function(e){return ht(this.input)&&i.ENV.get("IS_NODE")&&(t=n(672),this.input=t.readFileSync(this.input.substr(7))),[2,new dt(this.input,this.options)]})})},e}(ot),mt=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;return r.url=e,r.fileOptions=n,r}return a(e,t),e.prototype.iterator=function(){return s(this,void 0,void 0,function(){return u(this,function(t){return ht(this.url)?[2,new pt(this.url,this.fileOptions).iterator()]:[2,function(t,e){return void 0===e&&(e={}),s(this,void 0,void 0,function(){var n,r,o,a,s;return u(this,function(u){switch(u.label){case 0:return"string"==typeof t?n=t:(n=t.url,r=function(t){return{method:t.method,headers:t.headers,body:t.body,mode:t.mode,credentials:t.credentials,cache:t.cache,redirect:t.redirect,referrer:t.referrer,integrity:t.integrity}}(t)),[4,i.util.fetch(n,r)];case 1:return(o=u.sent()).ok?(s=Uint8Array.bind,[4,o.arrayBuffer()]):[3,3];case 2:return a=new(s.apply(Uint8Array,[void 0,u.sent()])),[2,new dt(a,e)];case 3:throw new Error(o.statusText)}})})}(this.url,this.fileOptions)]})})},e}(ot);function gt(t,e){return void 0===e&&(e={}),new nt(new mt(t),e)}function vt(t){var e=this,n=O(t);return $(function(){return s(e,void 0,void 0,function(){return u(this,function(t){return[2,n]})})})}function bt(t){var e=this;return $(function(){return s(e,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return[4,t()];case 1:return e=n.sent(),[2,O(function(){return e.next()})]}})})})}function yt(t,e){return s(this,void 0,void 0,function(){return u(this,function(n){return[2,it.create(t,e)]})})}function wt(t){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,rt.create(t)]})})}var xt="1.2.2"}.call(this,n(27),n(18).Buffer)},function(t,e,n){"use strict";function r(t){var e="";if(!t)try{t=n(268)}catch(t){e=t.toString()}return{readFile:t?function(e){return new Promise(function(n,r){t.readFile(e,function(t,e){return t?r(t):n(e)})})}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+e)}}}n.d(e,"a",function(){return r})},function(t,e,n){"use strict";(function(t){var r=n(1);e.a=function(e,n){var i=n&&n.property?Object(r.t)(n.property):r.x;return Object(r.F)(e)&&!function(e){return!("function"!=typeof t||!Object(r.D)(t.isBuffer))&&t.isBuffer(e)}(e)?function(t,e){return t}(i(e)):i(JSON.parse(e))}}).call(this,n(18).Buffer)},function(t,e,n){"use strict";t.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var n="boolean"==typeof e.cycles&&e.cycles,r=e.cmp&&function(t){return function(e){return function(n,r){var i={key:n,value:e[n]},o={key:r,value:e[r]};return t(i,o)}}}(e.cmp),i=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var o,a;if(Array.isArray(e)){for(a="[",o=0;o<e.length;o++)o&&(a+=","),a+=t(e[o])||"null";return a+"]"}if(null===e)return"null";if(-1!==i.indexOf(e)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=i.push(e)-1,u=Object.keys(e).sort(r&&r(e));for(a="",o=0;o<u.length;o++){var c=u[o],l=t(e[c]);l&&(a&&(a+=","),a+=JSON.stringify(c)+":"+l)}return i.splice(s,1),"{"+a+"}"}}(t)}},function(t,e,n){"use strict";var r=/("(?:[^\\"]|\\.)*")|[:,]/g;t.exports=function(t,e){var n,i,o;return e=e||{},n=JSON.stringify([1],void 0,void 0===e.indent?2:e.indent).slice(2,-3),i=""===n?1/0:void 0===e.maxLength?80:e.maxLength,o=e.replacer,function t(e,a,s){var u,c,l,f,d,h,p,m,g,v,b,y;if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0===(b=JSON.stringify(e,o)))return b;if(p=i-a.length-s,b.length<=p&&(g=b.replace(r,function(t,e){return e||t+" "})).length<=p)return g;if(null!=o&&(e=JSON.parse(b),o=void 0),"object"==typeof e&&null!==e){if(m=a+n,l=[],c=0,Array.isArray(e))for(v="[",u="]",p=e.length;c<p;c++)l.push(t(e[c],m,c===p-1?0:1)||"null");else for(v="{",u="}",p=(h=Object.keys(e)).length;c<p;c++)f=h[c],d=JSON.stringify(f)+": ",void 0!==(y=t(e[f],m,d.length+(c===p-1?0:1)))&&l.push(d+y);if(l.length>0)return[v,n+l.join(",\n"+m),u].join("\n"+a)}return b}(t,"",0)}},function(t,e,n){"use strict";function r(t){return!!new RegExp("^(?:[a-z]+:)?//","i").test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default={isAbsoluteURL:r,getModelPath:function(t){return r(t)?t:window.location.pathname+t}}},function(t,e,n){"use strict";e.__esModule=!0;var r=a(n(457)),i=a(n(453)),o=a(n(17));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,o.default)(e)));t.prototype=(0,i.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(r.default?(0,r.default)(t,e):t.__proto__=e)}},function(t,e,n){"use strict";e.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(17));e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":(0,r.default)(e))&&"function"!=typeof e?t:e}},function(t,e,n){t.exports={default:n(459),__esModule:!0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=c(n(12)),i=c(n(36)),o=c(n(11)),a=c(n(17)),s=c(n(9)),u=c(n(10));function c(t){return t&&t.__esModule?t:{default:t}}var l=function(){function t(e,n){(0,s.default)(this,t),this.videoElt=null,this.size=n,this.videoReady=!1,e instanceof HTMLVideoElement?this.videoElt=e:null!==e&&"object"===(void 0===e?"undefined":(0,a.default)(e))&&e.elt instanceof HTMLVideoElement&&(this.videoElt=e.elt)}return(0,u.default)(t,[{key:"loadVideo",value:function(){var t=(0,o.default)(r.default.mark(function t(){var e,n=this;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=void 0,t.abrupt("return",new i.default(function(t){n.video=document.createElement("video");var r=navigator.userAgent;e=r.indexOf("Firefox")>-1?n.videoElt.mozCaptureStream():n.videoElt.captureStream(),n.video.srcObject=e,n.video.width=n.size,n.video.height=n.size,n.video.autoplay=!0,n.video.playsinline=!0,n.video.muted=!0;var i=n.video.play();void 0!==i&&i.then(function(){t(n.video)})}));case 2:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTopKClassesFromTensor=void 0;var r=a(n(12)),i=a(n(11)),o=e.getTopKClassesFromTensor=function(){var t=(0,i.default)(r.default.mark(function t(e,n,i){var o;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.data();case 2:return o=t.sent,t.abrupt("return",s(o,n,i));case 4:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}();function a(t){return t&&t.__esModule?t:{default:t}}function s(t,e,n){for(var r=[],i=0;i<t.length;i+=1)r.push({value:t[i],index:i});r.sort(function(t,e){return e.value-t.value});for(var o=new Float32Array(e),a=new Int32Array(e),s=0;s<e;s+=1)o[s]=r[s].value,a[s]=r[s].index;for(var u=[],c=0;c<a.length;c+=1)u.push({className:n[a[c]],probability:o[c]});return u}e.getTopKClassesFromArray=s,e.default={getTopKClassesFromArray:s,getTopKClassesFromTensor:o}},function(t,e,n){var r=n(29),i=n(19),o=n(124),a=n(181),s=n(46).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},function(t,e,n){var r=n(151)("meta"),i=n(45),o=n(77),a=n(46).f,s=0,u=Object.isExtensible||function(){return!0},c=!n(78)(function(){return u(Object.preventExtensions({}))}),l=function(t){a(t,r,{value:{i:"O"+ ++s,w:{}}})},f=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[r].w},onFreeze:function(t){return c&&f.NEED&&u(t)&&!o(t,r)&&l(t),t}}},function(t,e,n){e.f=n(28)},function(t,e,n){var r=n(68);t.exports=function(t,e,n){for(var i in e)n&&t[i]?t[i]=e[i]:r(t,i,e[i]);return t}},function(t,e,n){"use strict";var r=n(127);t.exports.f=function(t){return new function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=r(e),this.reject=r(n)}(t)}},function(t,e,n){var r=n(133),i=n(28)("iterator"),o=n(92);t.exports=n(19).getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){"use strict";var r=n(124),i=n(26),o=n(284),a=n(68),s=n(92),u=n(508),c=n(111),l=n(282),f=n(28)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,p,m,g,v){u(n,e,p);var b,y,w,x=function(t){if(!d&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},_=e+" Iterator",k="values"==m,S=!1,E=t.prototype,O=E[f]||E["@@iterator"]||m&&E[m],A=O||x(m),C=m?k?x("entries"):A:void 0,M="Array"==e&&E.entries||O;if(M&&(w=l(M.call(new t)))!==Object.prototype&&w.next&&(c(w,_,!0),r||"function"==typeof w[f]||a(w,f,h)),k&&O&&"values"!==O.name&&(S=!0,A=function(){return O.call(this)}),r&&!v||!d&&!S&&E[f]||a(E,f,A),s[e]=A,s[_]=h,m)if(b={values:k?A:x("values"),keys:g?A:x("keys"),entries:C},v)for(y in b)y in E||o(E,y,b[y]);else i(i.P+i.F*(d||S),e,b);return b}},function(t,e){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(116),i=n(114),o=n(43),a={prepend:!1};e.subSurface=function(t,e,n={}){const s=o.getDrawArea(t),u=r.css(Object.assign({"& canvas":{display:"block"}},i.tachyons("mv2"))),c=r.css(Object.assign({backgroundColor:"white",display:"inline-block",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",padding:"0 10px 0 10px",marginBottom:"20px"},i.tachyons("fw6 tl"))),l=Object.assign({},a,n);let f=s.querySelector(`div[data-name=${e}]`);if(!f){if((f=document.createElement("div")).setAttribute("class",`${u}`),f.dataset.name=e,l.title){const t=document.createElement("div");t.setAttribute("class",`subsurface-title ${c}`),t.innerText=l.title,f.appendChild(t)}l.prepend?s.insertBefore(f,s.firstChild):s.appendChild(f)}return f}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(23),a=i(n(90)),s=n(188),u=n(136),c=n(135),l={maxBins:12,fontSize:11};e.histogram=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=function(t){if(null==t.length)throw new Error("input data must be an array");if(0===t.length)return[];if("object"==typeof t[0]){if(null==t[0].value)throw new Error("input data must have a value field");return t}{const e=Array(t.length);for(let n=0;n<t.length;n++)e[n]={value:t[n]};return e}}(e),i=Object.assign({},l,n),f=s.subSurface(t,"histogram");if(!1!==n.stats){const e=s.subSurface(t,"stats",{prepend:!0});let a;!function(t,e,n){const r=o.format(",.4~f"),i=o.format(".4~p"),a=[],s=[];if(null!=t.numVals&&(a.push("Num Vals"),s.push(r(t.numVals))),null!=t.min&&(a.push("Min"),s.push(r(t.min))),null!=t.max&&(a.push("Max"),s.push(r(t.max))),null!=t.numZeros){a.push("# Zeros");let e="";t.numVals&&(e=t.numZeros>0?`(${i(t.numZeros/t.numVals)})`:""),s.push(`${r(t.numZeros)} ${e}`)}if(null!=t.numNans){a.push("# NaNs");let e="";t.numVals&&(e=t.numNans>0?`(${i(t.numNans/t.numVals)})`:""),s.push(`${r(t.numNans)} ${e}`)}if(null!=t.numInfs){a.push("# Infinity");let e="";t.numVals&&(e=t.numInfs>0?`(${i(t.numInfs/t.numVals)})`:""),s.push(`${r(t.numInfs)} ${e}`)}c.table(e,{headers:a,values:[s]},n)}(a=n.stats?n.stats:u.arrayStats(r.map(t=>t.value)),e,{fontSize:i.fontSize})}const d=[];for(let t=0;t<r.length;t++){const e=r[t].value;null!=e&&isFinite(e)&&d.push(r[t])}const h={width:i.width||f.clientWidth,height:i.height||f.clientHeight,padding:0,autosize:{type:"fit",contains:"padding",resize:!0},data:{values:d},mark:"bar",config:{axis:{labelFontSize:i.fontSize,titleFontSize:i.fontSize},text:{fontSize:i.fontSize},legend:{labelFontSize:i.fontSize,titleFontSize:i.fontSize}},encoding:{x:{bin:{maxbins:i.maxBins},field:"value",type:"quantitative"},y:{aggregate:"count",type:"quantitative"},color:{value:"#001B44"}}};return a.default(f,h,{actions:!1,mode:"vega-lite",defaultStyle:!1})})}},function(t,e,n){var r=n(293);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var r=n(575);t.exports=function(t){return null==t?"":r(t)}},function(t,e,n){var r=n(95),i=n(73);t.exports=function(t){return"symbol"==typeof t||i(t)&&"[object Symbol]"==r(t)}},function(t,e,n){var r=n(37),i=n(193),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!i(t))||a.test(t)||!o.test(t)||null!=e&&t in Object(e)}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,n){var r=n(591),i=n(590),o=n(589),a=o&&o.isTypedArray,s=a?i(a):r;t.exports=s},function(t,e){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e,n){(function(t){var r=n(53),i=n(592),o="object"==typeof e&&e&&!e.nodeType&&e,a=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===o?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||i;t.exports=u}).call(this,n(146)(t))},function(t,e,n){var r=n(302),i=n(588),o=n(94);t.exports=function(t){return o(t)?r(t):i(t)}},function(t,e,n){var r=n(621),i=n(614),o=n(612),a=n(611),s=n(610);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(74)(n(53),"Map");t.exports=r},function(t,e,n){var r=n(143),i=n(632),o=n(631),a=n(630),s=n(629),u=n(628);function c(t){var e=this.__data__=new r(t);this.size=e.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,t.exports=c},function(t,e,n){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,a,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in n=Object(arguments[u]))i.call(n,c)&&(s[c]=n[c]);if(r){a=r(n);for(var l=0;l<a.length;l++)o.call(n,a[l])&&(s[a[l]]=n[a[l]])}}return s}},function(t,e,n){!function(t){"use strict";var e=function(){},n={},r=[],i=[];function o(t,o){var a=i,s=void 0,u=void 0,c=void 0,l=void 0;for(l=arguments.length;l-- >2;)r.push(arguments[l]);for(o&&null!=o.children&&(r.length||r.push(o.children),delete o.children);r.length;)if((u=r.pop())&&void 0!==u.pop)for(l=u.length;l--;)r.push(u[l]);else"boolean"==typeof u&&(u=null),(c="function"!=typeof t)&&(null==u?u="":"number"==typeof u?u=String(u):"string"!=typeof u&&(c=!1)),c&&s?a[a.length-1]+=u:a===i?a=[u]:a.push(u),s=c;var f=new e;return f.nodeName=t,f.children=a,f.attributes=null==o?void 0:o,f.key=null==o?void 0:o.key,void 0!==n.vnode&&n.vnode(f),f}function a(t,e){for(var n in e)t[n]=e[n];return t}function s(t,e){t&&("function"==typeof t?t(e):t.current=e)}var u="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function c(t,e){return o(t.nodeName,a(a({},t.attributes),e),arguments.length>2?[].slice.call(arguments,2):t.children)}var l=0,f=1,d=2,h=3,p="__preactattr_",m=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,g=[];function v(t){!t._dirty&&(t._dirty=!0)&&1==g.push(t)&&(n.debounceRendering||u)(b)}function b(){for(var t=void 0;t=g.pop();)t._dirty&&P(t)}function y(t,e,n){return"string"==typeof e||"number"==typeof e?void 0!==t.splitText:"string"==typeof e.nodeName?!t._componentConstructor&&w(t,e.nodeName):n||t._componentConstructor===e.nodeName}function w(t,e){return t.normalizedNodeName===e||t.nodeName.toLowerCase()===e.toLowerCase()}function x(t){var e=a({},t.attributes);e.children=t.children;var n=t.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===e[r]&&(e[r]=n[r]);return e}function _(t){var e=t.parentNode;e&&e.removeChild(t)}function k(t,e,n,r,i){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)s(n,null),s(r,t);else if("class"!==e||i)if("style"===e){if(r&&"string"!=typeof r&&"string"!=typeof n||(t.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var o in n)o in r||(t.style[o]="");for(var a in r)t.style[a]="number"==typeof r[a]&&!1===m.test(a)?r[a]+"px":r[a]}}else if("dangerouslySetInnerHTML"===e)r&&(t.innerHTML=r.__html||"");else if("o"==e[0]&&"n"==e[1]){var u=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),r?n||t.addEventListener(e,S,u):t.removeEventListener(e,S,u),(t._listeners||(t._listeners={}))[e]=r}else if("list"!==e&&"type"!==e&&!i&&e in t){try{t[e]=null==r?"":r}catch(t){}null!=r&&!1!==r||"spellcheck"==e||t.removeAttribute(e)}else{var c=i&&e!==(e=e.replace(/^xlink:?/,""));null==r||!1===r?c?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof r&&(c?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),r):t.setAttribute(e,r))}else t.className=r||""}function S(t){return this._listeners[t.type](n.event&&n.event(t)||t)}var E=[],O=0,A=!1,C=!1;function M(){for(var t=void 0;t=E.shift();)n.afterMount&&n.afterMount(t),t.componentDidMount&&t.componentDidMount()}function N(t,e,n,r,i,o){O++||(A=null!=i&&void 0!==i.ownerSVGElement,C=null!=t&&!(p in t));var a=function t(e,n,r,i,o){var a=e,s=A;if(null!=n&&"boolean"!=typeof n||(n=""),"string"==typeof n||"number"==typeof n)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=n&&(e.nodeValue=n):(a=document.createTextNode(n),e&&(e.parentNode&&e.parentNode.replaceChild(a,e),T(e,!0))),a[p]=!0,a;var u=n.nodeName;if("function"==typeof u)return function(t,e,n,r){for(var i=t&&t._component,o=i,a=t,s=i&&t._componentConstructor===e.nodeName,u=s,c=x(e);i&&!u&&(i=i._parentComponent);)u=i.constructor===e.nodeName;return i&&u&&(!r||i._component)?(F(i,c,h,n,r),t=i.base):(o&&!s&&(z(o),t=a=null),i=j(e.nodeName,c,n),t&&!i.nextBase&&(i.nextBase=t,a=null),F(i,c,f,n,r),t=i.base,a&&t!==a&&(a._component=null,T(a,!1))),t}(e,n,r,i);if(A="svg"===u||"foreignObject"!==u&&A,u=String(u),(!e||!w(e,u))&&(a=function(t,e){var n=e?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return n.normalizedNodeName=t,n}(u,A),e)){for(;e.firstChild;)a.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(a,e),T(e,!0)}var c=a.firstChild,l=a[p],d=n.children;if(null==l){l=a[p]={};for(var m=a.attributes,g=m.length;g--;)l[m[g].name]=m[g].value}return!C&&d&&1===d.length&&"string"==typeof d[0]&&null!=c&&void 0!==c.splitText&&null==c.nextSibling?c.nodeValue!=d[0]&&(c.nodeValue=d[0]):(d&&d.length||null!=c)&&function(e,n,r,i,o){var a=e.childNodes,s=[],u={},c=0,l=0,f=a.length,d=0,h=n?n.length:0,m=void 0,g=void 0,v=void 0,b=void 0,w=void 0;if(0!==f)for(var x=0;x<f;x++){var k=a[x],S=k[p],E=h&&S?k._component?k._component.__key:S.key:null;null!=E?(c++,u[E]=k):(S||(void 0!==k.splitText?!o||k.nodeValue.trim():o))&&(s[d++]=k)}if(0!==h)for(var O=0;O<h;O++){b=n[O],w=null;var A=b.key;if(null!=A)c&&void 0!==u[A]&&(w=u[A],u[A]=void 0,c--);else if(l<d)for(m=l;m<d;m++)if(void 0!==s[m]&&y(g=s[m],b,o)){w=g,s[m]=void 0,m===d-1&&d--,m===l&&l++;break}w=t(w,b,r,i),v=a[O],w&&w!==e&&w!==v&&(null==v?e.appendChild(w):w===v.nextSibling?_(v):e.insertBefore(w,v))}if(c)for(var C in u)void 0!==u[C]&&T(u[C],!1);for(;l<=d;)void 0!==(w=s[d--])&&T(w,!1)}(a,d,r,i,C||null!=l.dangerouslySetInnerHTML),function(t,e,n){var r=void 0;for(r in n)e&&null!=e[r]||null==n[r]||k(t,r,n[r],n[r]=void 0,A);for(r in e)"children"===r||"innerHTML"===r||r in n&&e[r]===("value"===r||"checked"===r?t[r]:n[r])||k(t,r,n[r],n[r]=e[r],A)}(a,n.attributes,l),A=s,a}(t,e,n,r,o);return i&&a.parentNode!==i&&i.appendChild(a),--O||(C=!1,o||M()),a}function T(t,e){var n=t._component;n?z(n):(null!=t[p]&&s(t[p].ref,null),!1!==e&&null!=t[p]||_(t),I(t))}function I(t){for(t=t.lastChild;t;){var e=t.previousSibling;T(t,!0),t=e}}var D=[];function j(t,e,n){var r=void 0,i=D.length;for(t.prototype&&t.prototype.render?(r=new t(e,n),L.call(r,e,n)):((r=new L(e,n)).constructor=t,r.render=R);i--;)if(D[i].constructor===t)return r.nextBase=D[i].nextBase,D.splice(i,1),r;return r}function R(t,e,n){return this.constructor(t,n)}function F(t,e,r,i,o){t._disable||(t._disable=!0,t.__ref=e.ref,t.__key=e.key,delete e.ref,delete e.key,void 0===t.constructor.getDerivedStateFromProps&&(!t.base||o?t.componentWillMount&&t.componentWillMount():t.componentWillReceiveProps&&t.componentWillReceiveProps(e,i)),i&&i!==t.context&&(t.prevContext||(t.prevContext=t.context),t.context=i),t.prevProps||(t.prevProps=t.props),t.props=e,t._disable=!1,r!==l&&(r!==f&&!1===n.syncComponentUpdates&&t.base?v(t):P(t,f,o)),s(t.__ref,t))}function P(t,e,r,i){if(!t._disable){var o=t.props,s=t.state,u=t.context,c=t.prevProps||o,h=t.prevState||s,p=t.prevContext||u,m=t.base,g=t.nextBase,v=m||g,b=t._component,y=!1,w=p,_=void 0,k=void 0,S=void 0;if(t.constructor.getDerivedStateFromProps&&(s=a(a({},s),t.constructor.getDerivedStateFromProps(o,s)),t.state=s),m&&(t.props=c,t.state=h,t.context=p,e!==d&&t.shouldComponentUpdate&&!1===t.shouldComponentUpdate(o,s,u)?y=!0:t.componentWillUpdate&&t.componentWillUpdate(o,s,u),t.props=o,t.state=s,t.context=u),t.prevProps=t.prevState=t.prevContext=t.nextBase=null,t._dirty=!1,!y){_=t.render(o,s,u),t.getChildContext&&(u=a(a({},u),t.getChildContext())),m&&t.getSnapshotBeforeUpdate&&(w=t.getSnapshotBeforeUpdate(c,h));var A=_&&_.nodeName,C=void 0,I=void 0;if("function"==typeof A){var D=x(_);(k=b)&&k.constructor===A&&D.key==k.__key?F(k,D,f,u,!1):(C=k,t._component=k=j(A,D,u),k.nextBase=k.nextBase||g,k._parentComponent=t,F(k,D,l,u,!1),P(k,f,r,!0)),I=k.base}else S=v,(C=b)&&(S=t._component=null),(v||e===f)&&(S&&(S._component=null),I=N(S,_,u,r||!m,v&&v.parentNode,!0));if(v&&I!==v&&k!==b){var R=v.parentNode;R&&I!==R&&(R.replaceChild(I,v),C||(v._component=null,T(v,!1)))}if(C&&z(C),t.base=I,I&&!i){for(var L=t,B=t;B=B._parentComponent;)(L=B).base=I;I._component=L,I._componentConstructor=L.constructor}}for(!m||r?E.push(t):y||(t.componentDidUpdate&&t.componentDidUpdate(c,h,w),n.afterUpdate&&n.afterUpdate(t));t._renderCallbacks.length;)t._renderCallbacks.pop().call(t);O||i||M()}}function z(t){n.beforeUnmount&&n.beforeUnmount(t);var e=t.base;t._disable=!0,t.componentWillUnmount&&t.componentWillUnmount(),t.base=null;var r=t._component;r?z(r):e&&(null!=e[p]&&s(e[p].ref,null),t.nextBase=e,_(e),D.push(t),I(e)),s(t.__ref,null)}function L(t,e){this._dirty=!0,this.context=e,this.props=t,this.state=this.state||{},this._renderCallbacks=[]}function B(t,e,n){return N(n,t,{},!1,e,!1)}function U(){return{}}a(L.prototype,{setState:function(t,e){this.prevState||(this.prevState=this.state),this.state=a(a({},this.state),"function"==typeof t?t(this.state,this.props):t),e&&this._renderCallbacks.push(e),v(this)},forceUpdate:function(t){t&&this._renderCallbacks.push(t),P(this,d)},render:function(){}});var W={h:o,createElement:o,cloneElement:c,createRef:U,Component:L,render:B,rerender:b,options:n};t.default=W,t.h=o,t.createElement=o,t.cloneElement=c,t.createRef=U,t.Component=L,t.render=B,t.rerender=b,t.options=n,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,n){var r=e;r.utils=n(54),r.common=n(119),r.sha=n(709),r.ripemd=n(705),r.hmac=n(704),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(t,e,n){(function(e){var r=n(24),i=n(97);function o(t,n){var i=function(t){var e=a(t);return{blinder:e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(n),o=n.modulus.byteLength(),s=(r.mont(n.modulus),new r(t).mul(i.blinder).umod(n.modulus)),u=s.toRed(r.mont(n.prime1)),c=s.toRed(r.mont(n.prime2)),l=n.coefficient,f=n.prime1,d=n.prime2,h=u.redPow(n.exponent1),p=c.redPow(n.exponent2);h=h.fromRed(),p=p.fromRed();var m=h.isub(p).imul(l).umod(f);return m.imul(d),p.iadd(m),new e(p.imul(i.unblinder).umod(n.modulus).toArray(!1,o))}function a(t){for(var e=t.modulus.byteLength(),n=new r(i(e));n.cmp(t.modulus)>=0||!n.umod(t.prime1)||!n.umod(t.prime2);)n=new r(i(e));return n}t.exports=o,o.getr=a}).call(this,n(18).Buffer)},function(t,e,n){var r={ECB:n(732),CBC:n(731),CFB:n(730),CFB8:n(729),CFB1:n(728),OFB:n(727),CTR:n(340),GCM:n(340)},i=n(338);for(var o in i)i[o].module=r[i[o].mode];t.exports=i},function(t,e,n){var r=n(733),i=n(725),o=n(338);e.createCipher=e.Cipher=r.createCipher,e.createCipheriv=e.Cipheriv=r.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,n){"use strict";e.utils=n(738),e.Cipher=n(737),e.DES=n(736),e.CBC=n(735),e.EDE=n(734)},function(t,e,n){(e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n}).sha=n(747),e.sha1=n(746),e.sha224=n(745),e.sha256=n(349),e.sha384=n(744),e.sha512=n(348)},function(t,e,n){"use strict";var r=n(18).Buffer,i=n(6),o=n(354),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function h(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function m(t,e,n,r,i,o,a,s){return p(t+(e^n^r)+o+a|0,s)+i|0}function g(t,e,n,r,i,o,a,s){return p(t+(e&n|~e&r)+o+a|0,s)+i|0}function v(t,e,n,r,i,o,a,s){return p(t+((e|~n)^r)+o+a|0,s)+i|0}function b(t,e,n,r,i,o,a,s){return p(t+(e&r|n&~r)+o+a|0,s)+i|0}function y(t,e,n,r,i,o,a,s){return p(t+(e^(n|~r))+o+a|0,s)+i|0}i(h,o),h.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,w=0|this._a,x=0|this._b,_=0|this._c,k=0|this._d,S=0|this._e,E=0;E<80;E+=1){var O,A;E<16?(O=m(n,r,i,o,h,t[s[E]],f[0],c[E]),A=y(w,x,_,k,S,t[u[E]],d[0],l[E])):E<32?(O=g(n,r,i,o,h,t[s[E]],f[1],c[E]),A=b(w,x,_,k,S,t[u[E]],d[1],l[E])):E<48?(O=v(n,r,i,o,h,t[s[E]],f[2],c[E]),A=v(w,x,_,k,S,t[u[E]],d[2],l[E])):E<64?(O=b(n,r,i,o,h,t[s[E]],f[3],c[E]),A=g(w,x,_,k,S,t[u[E]],d[3],l[E])):(O=y(n,r,i,o,h,t[s[E]],f[4],c[E]),A=m(w,x,_,k,S,t[u[E]],d[4],l[E])),n=h,h=o,o=p(i,10),i=r,r=O,w=S,S=k,k=p(_,10),_=x,x=A}var C=this._b+i+k|0;this._b=this._c+o+S|0,this._c=this._d+h+w|0,this._d=this._e+n+x|0,this._e=this._a+r+_|0,this._a=C},h.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=r.alloc?r.alloc(20):new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=h},function(t,e,n){"use strict";var r=n(7).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=l,this.end=f,e=3;break;default:return this.write=d,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function l(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function h(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=a(e[r]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--r<n||-2===i?0:(i=a(e[r]))>=0?(i>0&&(t.lastNeed=i-2),i):--r<n||-2===i?0:(i=a(e[r]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";(function(e,r,i){var o=n(149);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(void 0),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=b;var s,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:o.nextTick;b.WritableState=v;var c=n(121);c.inherits=n(6);var l,f={deprecate:n(753)},d=n(352),h=n(7).Buffer,p=i.Uint8Array||function(){},m=n(351);function g(){}function v(t,e){s=s||n(75),t=t||{};var r=e instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(o.nextTick(i,r),o.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),S(t,e))}(t,n,r,e,i);else{var a=_(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||x(t,n),r?u(w,t,n,a,i):w(t,n,a,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function b(t){if(s=s||n(75),!(l.call(b,this)||this instanceof s))return new b(t);this._writableState=new v(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),d.call(this)}function y(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),S(t,e)}function x(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,y(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(y(t,e,!1,e.objectMode?1:c.length,c,l,f),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function k(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),S(t,e)})}function S(t,e){var n=_(e);return n&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(k,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(b,d),v.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(v.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===b&&t&&t._writableState instanceof v}})):l=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,n){var r=this._writableState,i=!1,a=!r.objectMode&&function(t){return h.isBuffer(t)||t instanceof p}(t);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=g),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var i=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(r,a),i=!1),i}(this,r,t,n))&&(r.pendingcb++,i=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n)),e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else y(t,e,!1,s,r,i,o);return u}(this,r,a,t,e,n)),i},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||x(this,t))},b.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,S(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=m.destroy,b.prototype._undestroy=m.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(44),n(356).setImmediate,n(27))},function(t,e,n){(e=t.exports=n(353)).Stream=e,e.Readable=e,e.Writable=n(214),e.Duplex=n(75),e.Transform=n(350),e.PassThrough=n(752)},function(t,e,n){t.exports=i;var r=n(150).EventEmitter;function i(){r.call(this)}n(6)(i,r),i.Readable=n(215),i.Writable=n(751),i.Duplex=n(750),i.Transform=n(749),i.PassThrough=n(748),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(l(),0===r.listenerCount(this,"error"))throw t}function l(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",c),t.removeListener("error",c),n.removeListener("end",l),n.removeListener("close",l),t.removeListener("close",l)}return n.on("error",c),t.on("error",c),n.on("end",l),n.on("close",l),t.on("close",l),t.emit("pipe",n),t}},function(t,e,n){"use strict";var r=n(6),i=n(354),o=n(7).Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,n,r,i,o,a){return u(t+(e&n|~e&r)+i+o|0,a)+e|0}function l(t,e,n,r,i,o,a){return u(t+(e&r|n&~r)+i+o|0,a)+e|0}function f(t,e,n,r,i,o,a){return u(t+(e^n^r)+i+o|0,a)+e|0}function d(t,e,n,r,i,o,a){return u(t+(n^(e|~r))+i+o|0,a)+e|0}r(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,r=this._b,i=this._c,o=this._d;r=d(r=d(r=d(r=d(r=f(r=f(r=f(r=f(r=l(r=l(r=l(r=l(r=c(r=c(r=c(r=c(r,i=c(i,o=c(o,n=c(n,r,i,o,t[0],3614090360,7),r,i,t[1],3905402710,12),n,r,t[2],606105819,17),o,n,t[3],3250441966,22),i=c(i,o=c(o,n=c(n,r,i,o,t[4],4118548399,7),r,i,t[5],1200080426,12),n,r,t[6],2821735955,17),o,n,t[7],4249261313,22),i=c(i,o=c(o,n=c(n,r,i,o,t[8],1770035416,7),r,i,t[9],2336552879,12),n,r,t[10],4294925233,17),o,n,t[11],2304563134,22),i=c(i,o=c(o,n=c(n,r,i,o,t[12],1804603682,7),r,i,t[13],4254626195,12),n,r,t[14],2792965006,17),o,n,t[15],1236535329,22),i=l(i,o=l(o,n=l(n,r,i,o,t[1],4129170786,5),r,i,t[6],3225465664,9),n,r,t[11],643717713,14),o,n,t[0],3921069994,20),i=l(i,o=l(o,n=l(n,r,i,o,t[5],3593408605,5),r,i,t[10],38016083,9),n,r,t[15],3634488961,14),o,n,t[4],3889429448,20),i=l(i,o=l(o,n=l(n,r,i,o,t[9],568446438,5),r,i,t[14],3275163606,9),n,r,t[3],4107603335,14),o,n,t[8],1163531501,20),i=l(i,o=l(o,n=l(n,r,i,o,t[13],2850285829,5),r,i,t[2],4243563512,9),n,r,t[7],1735328473,14),o,n,t[12],2368359562,20),i=f(i,o=f(o,n=f(n,r,i,o,t[5],4294588738,4),r,i,t[8],2272392833,11),n,r,t[11],1839030562,16),o,n,t[14],4259657740,23),i=f(i,o=f(o,n=f(n,r,i,o,t[1],2763975236,4),r,i,t[4],1272893353,11),n,r,t[7],4139469664,16),o,n,t[10],3200236656,23),i=f(i,o=f(o,n=f(n,r,i,o,t[13],681279174,4),r,i,t[0],3936430074,11),n,r,t[3],3572445317,16),o,n,t[6],76029189,23),i=f(i,o=f(o,n=f(n,r,i,o,t[9],3654602809,4),r,i,t[12],3873151461,11),n,r,t[15],530742520,16),o,n,t[2],3299628645,23),i=d(i,o=d(o,n=d(n,r,i,o,t[0],4096336452,6),r,i,t[7],1126891415,10),n,r,t[14],2878612391,15),o,n,t[5],4237533241,21),i=d(i,o=d(o,n=d(n,r,i,o,t[12],1700485571,6),r,i,t[3],2399980690,10),n,r,t[10],4293915773,15),o,n,t[1],2240044497,21),i=d(i,o=d(o,n=d(n,r,i,o,t[8],1873313359,6),r,i,t[15],4264355552,10),n,r,t[6],2734768916,15),o,n,t[13],1309151649,21),i=d(i,o=d(o,n=d(n,r,i,o,t[4],4149444226,6),r,i,t[11],3174756917,10),n,r,t[2],718787259,15),o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(19),i=n(29),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(124)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(220)("keys"),i=n(151);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(125);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(45);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(45),i=n(29).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){"use strict";var r=n(8),i=n(22),o=n(70),a=n(156),s=n(35),u=n(79),c=n(13),l=n(81),f=n(48),d=n(16),h=n(367),p=n(83).f,m=n(21).f,g=n(234),v=n(106),b="prototype",y="Wrong index!",w=r.ArrayBuffer,x=r.DataView,_=r.Math,k=r.RangeError,S=r.Infinity,E=w,O=_.abs,A=_.pow,C=_.floor,M=_.log,N=_.LN2,T=i?"_b":"buffer",I=i?"_l":"byteLength",D=i?"_o":"byteOffset";function j(t,e,n){var r,i,o,a=new Array(n),s=8*n-e-1,u=(1<<s)-1,c=u>>1,l=23===e?A(2,-24)-A(2,-77):0,f=0,d=t<0||0===t&&1/t<0?1:0;for((t=O(t))!=t||t===S?(i=t!=t?1:0,r=u):(r=C(M(t)/N),t*(o=A(2,-r))<1&&(r--,o*=2),(t+=r+c>=1?l/o:l*A(2,1-c))*o>=2&&(r++,o/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(t*o-1)*A(2,e),r+=c):(i=t*A(2,c-1)*A(2,e),r=0));e>=8;a[f++]=255&i,i/=256,e-=8);for(r=r<<e|i,s+=e;s>0;a[f++]=255&r,r/=256,s-=8);return a[--f]|=128*d,a}function R(t,e,n){var r,i=8*n-e-1,o=(1<<i)-1,a=o>>1,s=i-7,u=n-1,c=t[u--],l=127&c;for(c>>=7;s>0;l=256*l+t[u],u--,s-=8);for(r=l&(1<<-s)-1,l>>=-s,s+=e;s>0;r=256*r+t[u],u--,s-=8);if(0===l)l=1-a;else{if(l===o)return r?NaN:c?-S:S;r+=A(2,e),l-=a}return(c?-1:1)*r*A(2,l-e)}function F(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function P(t){return[255&t]}function z(t){return[255&t,t>>8&255]}function L(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function B(t){return j(t,52,8)}function U(t){return j(t,23,4)}function W(t,e,n){m(t[b],e,{get:function(){return this[n]}})}function q(t,e,n,r){var i=h(+n);if(i+e>t[I])throw k(y);var o=t[T]._b,a=i+t[D],s=o.slice(a,a+e);return r?s:s.reverse()}function V(t,e,n,r,i,o){var a=h(+n);if(a+e>t[I])throw k(y);for(var s=t[T]._b,u=a+t[D],c=r(+i),l=0;l<e;l++)s[u+l]=c[o?l:e-l-1]}if(a.ABV){if(!c(function(){w(1)})||!c(function(){new w(-1)})||c(function(){return new w,new w(1.5),new w(NaN),"ArrayBuffer"!=w.name})){for(var H,$=(w=function(t){return l(this,w),new E(h(t))})[b]=E[b],G=p(E),K=0;G.length>K;)(H=G[K++])in w||s(w,H,E[H]);o||($.constructor=w)}var X=new x(new w(2)),Y=x[b].setInt8;X.setInt8(0,2147483648),X.setInt8(1,2147483649),!X.getInt8(0)&&X.getInt8(1)||u(x[b],{setInt8:function(t,e){Y.call(this,t,e<<24>>24)},setUint8:function(t,e){Y.call(this,t,e<<24>>24)}},!0)}else w=function(t){l(this,w,"ArrayBuffer");var e=h(t);this._b=g.call(new Array(e),0),this[I]=e},x=function(t,e,n){l(this,x,"DataView"),l(t,w,"DataView");var r=t[I],i=f(e);if(i<0||i>r)throw k("Wrong offset!");if(i+(n=void 0===n?r-i:d(n))>r)throw k("Wrong length!");this[T]=t,this[D]=i,this[I]=n},i&&(W(w,"byteLength","_l"),W(x,"buffer","_b"),W(x,"byteLength","_l"),W(x,"byteOffset","_o")),u(x[b],{getInt8:function(t){return q(this,1,t)[0]<<24>>24},getUint8:function(t){return q(this,1,t)[0]},getInt16:function(t){var e=q(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=q(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return F(q(this,4,t,arguments[1]))},getUint32:function(t){return F(q(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return R(q(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return R(q(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){V(this,1,t,P,e)},setUint8:function(t,e){V(this,1,t,P,e)},setInt16:function(t,e){V(this,2,t,z,e,arguments[2])},setUint16:function(t,e){V(this,2,t,z,e,arguments[2])},setInt32:function(t,e){V(this,4,t,L,e,arguments[2])},setUint32:function(t,e){V(this,4,t,L,e,arguments[2])},setFloat32:function(t,e){V(this,4,t,U,e,arguments[2])},setFloat64:function(t,e){V(this,8,t,B,e,arguments[2])}});v(w,"ArrayBuffer"),v(x,"DataView"),s(x[b],a.VIEW,!0),e.ArrayBuffer=w,e.DataView=x},function(t,e,n){"use strict";var r=n(30);t.exports.f=function(t){return new function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=r(e),this.reject=r(n)}(t)}},function(t,e,n){var r=n(8),i=n(230).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(49)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(u&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,d=document.createTextNode("");new o(c).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},function(t,e,n){var r,i,o,a=n(50),s=n(387),u=n(249),c=n(253),l=n(8),f=l.process,d=l.setImmediate,h=l.clearImmediate,p=l.MessageChannel,m=l.Dispatch,g=0,v={},b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){b.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++g]=function(){s("function"==typeof t?t:Function(t),e)},r(g),g},h=function(t){delete v[t]},"process"==n(49)(f)?r=function(t){f.nextTick(a(b,t,1))}:m&&m.now?r=function(t){m.now(a(b,t,1))}:p?(o=(i=new p).port2,i.port1.onmessage=y,r=a(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(t){l.postMessage(t+"","*")},l.addEventListener("message",y,!1)):r="onreadystatechange"in c("script")?function(t){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),b.call(t)}}:function(t){setTimeout(a(b,t,1),0)}),t.exports={set:d,clear:h}},function(t,e,n){"use strict";var r=n(163)(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){"use strict";var r=n(129),i=RegExp.prototype.exec,o=String.prototype.replace,a=i,s=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),u=void 0!==/()??/.exec("")[1];(s||u)&&(a=function(t){var e,n,a,c,l=this;return u&&(n=new RegExp("^"+l.source+"$(?!\\s)",r.call(l))),s&&(e=l.lastIndex),a=i.call(l,t),s&&a&&(l.lastIndex=l.global?a.index+a[0].length:e),u&&a&&a.length>1&&o.call(a[0],n,function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(a[c]=void 0)}),a}),t.exports=a},function(t,e,n){"use strict";var r=n(69),i=n(377),o=n(103),a=n(41);t.exports=n(242)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e,n){"use strict";var r=n(25),i=n(85),o=n(16);t.exports=function(t){for(var e=r(this),n=o(e.length),a=arguments.length,s=i(a>1?arguments[1]:void 0,n),u=a>2?arguments[2]:void 0,c=void 0===u?n:i(u,n);c>s;)e[s++]=t;return e}},function(t,e,n){var r=n(875);t.exports=function(t,e){return new(r(t))(e)}},function(t,e,n){var r=n(105),i=n(15)("iterator"),o=n(103);t.exports=n(51).getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e,n){"use strict";var r=n(21),i=n(88);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},function(t,e,n){var r=n(103),i=n(15)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},function(t,e,n){var r=n(15)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},function(t,e,n){var r=n(162),i=n(59);t.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(i(t))}},function(t,e,n){"use strict";var r=n(84),i=n(88),o=n(106),a={};n(35)(a,n(15)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},function(t,e,n){"use strict";var r=n(70),i=n(3),o=n(34),a=n(35),s=n(103),u=n(241),c=n(106),l=n(39),f=n(15)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,p,m,g,v){u(n,e,p);var b,y,w,x=function(t){if(!d&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},_=e+" Iterator",k="values"==m,S=!1,E=t.prototype,O=E[f]||E["@@iterator"]||m&&E[m],A=O||x(m),C=m?k?x("entries"):A:void 0,M="Array"==e&&E.entries||O;if(M&&(w=l(M.call(new t)))!==Object.prototype&&w.next&&(c(w,_,!0),r||"function"==typeof w[f]||a(w,f,h)),k&&O&&"values"!==O.name&&(S=!0,A=function(){return O.call(this)}),r&&!v||!d&&!S&&E[f]||a(E,f,A),s[e]=A,s[_]=h,m)if(b={values:k?A:x("values"),keys:g?A:x("keys"),entries:C},v)for(y in b)y in E||o(E,y,b[y]);else i(i.P+i.F*(d||S),e,b);return b}},function(t,e){var n=Math.expm1;t.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||-2e-17!=n(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:n},function(t,e){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,e,n){"use strict";var r=n(48),i=n(59);t.exports=function(t){var e=String(i(this)),n="",o=r(t);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(e+=e))1&o&&(n+=e);return n}},function(t,e,n){var r=n(14),i=n(248).set;t.exports=function(t,e,n){var o,a=e.constructor;return a!==n&&"function"==typeof a&&(o=a.prototype)!==n.prototype&&r(o)&&i&&i(t,o),t}},function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,e,n){var r=n(14),i=n(5),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(50)(Function.call,n(40).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return o(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:o}},function(t,e,n){var r=n(8).document;t.exports=r&&r.documentElement},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(167)("keys"),i=n(87);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e,n){var r=n(8),i=n(51),o=n(70),a=n(394),s=n(21).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},function(t,e,n){var r=n(14),i=n(8).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){"use strict";(function(r,i){function o(){return"object"==typeof r&&void 0!==t&&void 0!==i&&!!i.version}n.d(e,"a",function(){return o})}).call(this,n(27),n(44))},function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return o});var r=n(4),i=n(169);function o(){var e=t.Canvas||t.HTMLCanvasElement,n=t.Image||t.HTMLImageElement,o=t.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},a=Object(i.a)();return r.a({Canvas:e||function(){},CanvasRenderingContext2D:t.CanvasRenderingContext2D||function(){},Image:n||function(){},ImageData:t.ImageData||function(){},Video:t.HTMLVideoElement||function(){},createCanvasElement:function(){if(e)return new e;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},createImageElement:function(){if(n)return new n;throw new Error("createImageElement - missing Image implementation for nodejs environment")},fetch:o},a)}}).call(this,n(27))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=/\/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(t).slice(1,3);return{library:e[0],version:e[1]}}},function(t,e,n){(function(n){var r;e=t.exports=K,r="object"==typeof n&&n.env&&n.env.NODE_DEBUG&&/\bsemver\b/i.test(n.env.NODE_DEBUG)?function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("SEMVER"),console.log.apply(console,t)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var i=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,a=e.re=[],s=e.src=[],u=0,c=u++;s[c]="0|[1-9]\\d*";var l=u++;s[l]="[0-9]+";var f=u++;s[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var d=u++;s[d]="("+s[c]+")\\.("+s[c]+")\\.("+s[c]+")";var h=u++;s[h]="("+s[l]+")\\.("+s[l]+")\\.("+s[l]+")";var p=u++;s[p]="(?:"+s[c]+"|"+s[f]+")";var m=u++;s[m]="(?:"+s[l]+"|"+s[f]+")";var g=u++;s[g]="(?:-("+s[p]+"(?:\\."+s[p]+")*))";var v=u++;s[v]="(?:-?("+s[m]+"(?:\\."+s[m]+")*))";var b=u++;s[b]="[0-9A-Za-z-]+";var y=u++;s[y]="(?:\\+("+s[b]+"(?:\\."+s[b]+")*))";var w=u++,x="v?"+s[d]+s[g]+"?"+s[y]+"?";s[w]="^"+x+"$";var _="[v=\\s]*"+s[h]+s[v]+"?"+s[y]+"?",k=u++;s[k]="^"+_+"$";var S=u++;s[S]="((?:<|>)?=?)";var E=u++;s[E]=s[l]+"|x|X|\\*";var O=u++;s[O]=s[c]+"|x|X|\\*";var A=u++;s[A]="[v=\\s]*("+s[O]+")(?:\\.("+s[O]+")(?:\\.("+s[O]+")(?:"+s[g]+")?"+s[y]+"?)?)?";var C=u++;s[C]="[v=\\s]*("+s[E]+")(?:\\.("+s[E]+")(?:\\.("+s[E]+")(?:"+s[v]+")?"+s[y]+"?)?)?";var M=u++;s[M]="^"+s[S]+"\\s*"+s[A]+"$";var N=u++;s[N]="^"+s[S]+"\\s*"+s[C]+"$";var T=u++;s[T]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var I=u++;s[I]="(?:~>?)";var D=u++;s[D]="(\\s*)"+s[I]+"\\s+",a[D]=new RegExp(s[D],"g");var j=u++;s[j]="^"+s[I]+s[A]+"$";var R=u++;s[R]="^"+s[I]+s[C]+"$";var F=u++;s[F]="(?:\\^)";var P=u++;s[P]="(\\s*)"+s[F]+"\\s+",a[P]=new RegExp(s[P],"g");var z=u++;s[z]="^"+s[F]+s[A]+"$";var L=u++;s[L]="^"+s[F]+s[C]+"$";var B=u++;s[B]="^"+s[S]+"\\s*("+_+")$|^$";var U=u++;s[U]="^"+s[S]+"\\s*("+x+")$|^$";var W=u++;s[W]="(\\s*)"+s[S]+"\\s*("+_+"|"+s[A]+")",a[W]=new RegExp(s[W],"g");var q=u++;s[q]="^\\s*("+s[A]+")\\s+-\\s+("+s[A]+")\\s*$";var V=u++;s[V]="^\\s*("+s[C]+")\\s+-\\s+("+s[C]+")\\s*$";var H=u++;s[H]="(<|>)?=?\\s*\\*";for(var $=0;$<u;$++)r($,s[$]),a[$]||(a[$]=new RegExp(s[$]));function G(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof K)return t;if("string"!=typeof t)return null;if(t.length>i)return null;if(!(e.loose?a[k]:a[w]).test(t))return null;try{return new K(t,e)}catch(t){return null}}function K(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof K){if(t.loose===e.loose)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof K))return new K(t,e);r("SemVer",t,e),this.options=e,this.loose=!!e.loose;var n=t.trim().match(e.loose?a[k]:a[w]);if(!n)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e<o)return e}return t}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}e.parse=G,e.valid=function(t,e){var n=G(t,e);return n?n.version:null},e.clean=function(t,e){var n=G(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null},e.SemVer=K,K.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},K.prototype.toString=function(){return this.version},K.prototype.compare=function(t){return r("SemVer.compare",this.version,this.options,t),t instanceof K||(t=new K(t,this.options)),this.compareMain(t)||this.comparePre(t)},K.prototype.compareMain=function(t){return t instanceof K||(t=new K(t,this.options)),Y(this.major,t.major)||Y(this.minor,t.minor)||Y(this.patch,t.patch)},K.prototype.comparePre=function(t){if(t instanceof K||(t=new K(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;var e=0;do{var n=this.prerelease[e],i=t.prerelease[e];if(r("prerelease compare",e,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return Y(n,i)}while(++e)},K.prototype.inc=function(t,e){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e),this.inc("pre",e);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",e),this.inc("pre",e);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var n=this.prerelease.length;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);-1===n&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this},e.inc=function(t,e,n,r){"string"==typeof n&&(r=n,n=void 0);try{return new K(t,n).inc(e,r).version}catch(t){return null}},e.diff=function(t,e){if(tt(t,e))return null;var n=G(t),r=G(e);if(n.prerelease.length||r.prerelease.length){for(var i in n)if(("major"===i||"minor"===i||"patch"===i)&&n[i]!==r[i])return"pre"+i;return"prerelease"}for(var i in n)if(("major"===i||"minor"===i||"patch"===i)&&n[i]!==r[i])return i},e.compareIdentifiers=Y;var X=/^[0-9]+$/;function Y(t,e){var n=X.test(t),r=X.test(e);return n&&r&&(t=+t,e=+e),n&&!r?-1:r&&!n?1:t<e?-1:t>e?1:0}function J(t,e,n){return new K(t,n).compare(new K(e,n))}function Z(t,e,n){return J(t,e,n)>0}function Q(t,e,n){return J(t,e,n)<0}function tt(t,e,n){return 0===J(t,e,n)}function et(t,e,n){return 0!==J(t,e,n)}function nt(t,e,n){return J(t,e,n)>=0}function rt(t,e,n){return J(t,e,n)<=0}function it(t,e,n,r){var i;switch(e){case"===":"object"==typeof t&&(t=t.version),"object"==typeof n&&(n=n.version),i=t===n;break;case"!==":"object"==typeof t&&(t=t.version),"object"==typeof n&&(n=n.version),i=t!==n;break;case"":case"=":case"==":i=tt(t,n,r);break;case"!=":i=et(t,n,r);break;case">":i=Z(t,n,r);break;case">=":i=nt(t,n,r);break;case"<":i=Q(t,n,r);break;case"<=":i=rt(t,n,r);break;default:throw new TypeError("Invalid operator: "+e)}return i}function ot(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof ot){if(t.loose===!!e.loose)return t;t=t.value}if(!(this instanceof ot))return new ot(t,e);r("comparator",t,e),this.options=e,this.loose=!!e.loose,this.parse(t),this.semver===at?this.value="":this.value=this.operator+this.semver.version,r("comp",this)}e.rcompareIdentifiers=function(t,e){return Y(e,t)},e.major=function(t,e){return new K(t,e).major},e.minor=function(t,e){return new K(t,e).minor},e.patch=function(t,e){return new K(t,e).patch},e.compare=J,e.compareLoose=function(t,e){return J(t,e,!0)},e.rcompare=function(t,e,n){return J(e,t,n)},e.sort=function(t,n){return t.sort(function(t,r){return e.compare(t,r,n)})},e.rsort=function(t,n){return t.sort(function(t,r){return e.rcompare(t,r,n)})},e.gt=Z,e.lt=Q,e.eq=tt,e.neq=et,e.gte=nt,e.lte=rt,e.cmp=it,e.Comparator=ot;var at={};function st(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof st)return t.loose===!!e.loose&&t.includePrerelease===!!e.includePrerelease?t:new st(t.raw,e);if(t instanceof ot)return new st(t.value,e);if(!(this instanceof st))return new st(t,e);if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(function(t){return this.parseRange(t.trim())},this).filter(function(t){return t.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}function ut(t){return!t||"x"===t.toLowerCase()||"*"===t}function ct(t,e,n,r,i,o,a,s,u,c,l,f,d){return((e=ut(n)?"":ut(r)?">="+n+".0.0":ut(i)?">="+n+"."+r+".0":">="+e)+" "+(s=ut(u)?"":ut(c)?"<"+(+u+1)+".0.0":ut(l)?"<"+u+"."+(+c+1)+".0":f?"<="+u+"."+c+"."+l+"-"+f:"<="+s)).trim()}function lt(t,e,n){for(var i=0;i<t.length;i++)if(!t[i].test(e))return!1;if(n||(n={}),e.prerelease.length&&!n.includePrerelease){for(i=0;i<t.length;i++)if(r(t[i].semver),t[i].semver!==at&&t[i].semver.prerelease.length>0){var o=t[i].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}function ft(t,e,n){try{e=new st(e,n)}catch(t){return!1}return e.test(t)}function dt(t,e,n,r){var i,o,a,s,u;switch(t=new K(t,r),e=new st(e,r),n){case">":i=Z,o=rt,a=Q,s=">",u=">=";break;case"<":i=Q,o=nt,a=Z,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ft(t,e,r))return!1;for(var c=0;c<e.set.length;++c){var l=null,f=null;if(e.set[c].forEach(function(t){t.semver===at&&(t=new ot(">=0.0.0")),l=l||t,f=f||t,i(t.semver,l.semver,r)?l=t:a(t.semver,f.semver,r)&&(f=t)}),l.operator===s||l.operator===u)return!1;if((!f.operator||f.operator===s)&&o(t,f.semver))return!1;if(f.operator===u&&a(t,f.semver))return!1}return!0}ot.prototype.parse=function(t){var e=this.options.loose?a[B]:a[U],n=t.match(e);if(!n)throw new TypeError("Invalid comparator: "+t);this.operator=n[1],"="===this.operator&&(this.operator=""),n[2]?this.semver=new K(n[2],this.options.loose):this.semver=at},ot.prototype.toString=function(){return this.value},ot.prototype.test=function(t){return r("Comparator.test",t,this.options.loose),this.semver===at||("string"==typeof t&&(t=new K(t,this.options)),it(t,this.operator,this.semver,this.options))},ot.prototype.intersects=function(t,e){if(!(t instanceof ot))throw new TypeError("a Comparator is required");var n;if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),""===this.operator)return n=new st(t.value,e),ft(this.value,n,e);if(""===t.operator)return n=new st(this.value,e),ft(t.semver,n,e);var r=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),o=this.semver.version===t.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=it(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=it(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return r||i||o&&a||s||u},e.Range=st,st.prototype.format=function(){return this.range=this.set.map(function(t){return t.join(" ").trim()}).join("||").trim(),this.range},st.prototype.toString=function(){return this.range},st.prototype.parseRange=function(t){var e=this.options.loose;t=t.trim();var n=e?a[V]:a[q];t=t.replace(n,ct),r("hyphen replace",t),t=t.replace(a[W],"$1$2$3"),r("comparator trim",t,a[W]),t=(t=(t=t.replace(a[D],"$1~")).replace(a[P],"$1^")).split(/\s+/).join(" ");var i=e?a[B]:a[U],o=t.split(" ").map(function(t){return function(t,e){return r("comp",t,e),t=function(t,e){return t.trim().split(/\s+/).map(function(t){return function(t,e){r("caret",t,e),e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1});var n=e.loose?a[L]:a[z];return t.replace(n,function(e,n,i,o,a){var s;return r("caret",t,e,n,i,o,a),ut(n)?s="":ut(i)?s=">="+n+".0.0 <"+(+n+1)+".0.0":ut(o)?s="0"===n?">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0":">="+n+"."+i+".0 <"+(+n+1)+".0.0":a?(r("replaceCaret pr",a),"-"!==a.charAt(0)&&(a="-"+a),s="0"===n?"0"===i?">="+n+"."+i+"."+o+a+" <"+n+"."+i+"."+(+o+1):">="+n+"."+i+"."+o+a+" <"+n+"."+(+i+1)+".0":">="+n+"."+i+"."+o+a+" <"+(+n+1)+".0.0"):(r("no pr"),s="0"===n?"0"===i?">="+n+"."+i+"."+o+" <"+n+"."+i+"."+(+o+1):">="+n+"."+i+"."+o+" <"+n+"."+(+i+1)+".0":">="+n+"."+i+"."+o+" <"+(+n+1)+".0.0"),r("caret return",s),s})}(t,e)}).join(" ")}(t,e),r("caret",t),t=function(t,e){return t.trim().split(/\s+/).map(function(t){return function(t,e){e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1});var n=e.loose?a[R]:a[j];return t.replace(n,function(e,n,i,o,a){var s;return r("tilde",t,e,n,i,o,a),ut(n)?s="":ut(i)?s=">="+n+".0.0 <"+(+n+1)+".0.0":ut(o)?s=">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0":a?(r("replaceTilde pr",a),"-"!==a.charAt(0)&&(a="-"+a),s=">="+n+"."+i+"."+o+a+" <"+n+"."+(+i+1)+".0"):s=">="+n+"."+i+"."+o+" <"+n+"."+(+i+1)+".0",r("tilde return",s),s})}(t,e)}).join(" ")}(t,e),r("tildes",t),t=function(t,e){return r("replaceXRanges",t,e),t.split(/\s+/).map(function(t){return function(t,e){t=t.trim(),e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1});var n=e.loose?a[N]:a[M];return t.replace(n,function(e,n,i,o,a,s){r("xRange",t,e,n,i,o,a,s);var u=ut(i),c=u||ut(o),l=c||ut(a);return"="===n&&l&&(n=""),u?e=">"===n||"<"===n?"<0.0.0":"*":n&&l?(c&&(o=0),l&&(a=0),">"===n?(n=">=",c?(i=+i+1,o=0,a=0):l&&(o=+o+1,a=0)):"<="===n&&(n="<",c?i=+i+1:o=+o+1),e=n+i+"."+o+"."+a):c?e=">="+i+".0.0 <"+(+i+1)+".0.0":l&&(e=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),r("xRange return",e),e})}(t,e)}).join(" ")}(t,e),r("xrange",t),t=function(t,e){return r("replaceStars",t,e),t.trim().replace(a[H],"")}(t,e),r("stars",t),t}(t,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(o=o.filter(function(t){return!!t.match(i)})),o.map(function(t){return new ot(t,this.options)},this)},st.prototype.intersects=function(t,e){if(!(t instanceof st))throw new TypeError("a Range is required");return this.set.some(function(n){return n.every(function(n){return t.set.some(function(t){return t.every(function(t){return n.intersects(t,e)})})})})},e.toComparators=function(t,e){return new st(t,e).set.map(function(t){return t.map(function(t){return t.value}).join(" ").trim().split(" ")})},st.prototype.test=function(t){if(!t)return!1;"string"==typeof t&&(t=new K(t,this.options));for(var e=0;e<this.set.length;e++)if(lt(this.set[e],t,this.options))return!0;return!1},e.satisfies=ft,e.maxSatisfying=function(t,e,n){var r=null,i=null;try{var o=new st(e,n)}catch(t){return null}return t.forEach(function(t){o.test(t)&&(r&&-1!==i.compare(t)||(i=new K(r=t,n)))}),r},e.minSatisfying=function(t,e,n){var r=null,i=null;try{var o=new st(e,n)}catch(t){return null}return t.forEach(function(t){o.test(t)&&(r&&1!==i.compare(t)||(i=new K(r=t,n)))}),r},e.validRange=function(t,e){try{return new st(t,e).range||"*"}catch(t){return null}},e.ltr=function(t,e,n){return dt(t,e,"<",n)},e.gtr=function(t,e,n){return dt(t,e,">",n)},e.outside=dt,e.prerelease=function(t,e){var n=G(t,e);return n&&n.prerelease.length?n.prerelease:null},e.intersects=function(t,e,n){return t=new st(t,n),e=new st(e,n),t.intersects(e)},e.coerce=function(t){if(t instanceof K)return t;if("string"!=typeof t)return null;var e=t.match(a[T]);return null==e?null:G((e[1]||"0")+"."+(e[2]||"0")+"."+(e[3]||"0"))}}).call(this,n(44))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=u(n(17)),i=u(n(101)),o=u(n(91)),a=u(n(9)),s=u(n(10));function u(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){(0,a.default)(this,t),this.options=e||{}}return(0,s.default)(t,[{key:"normalizeValue",value:function(t,e,n){return(t-e)/(n-e)}},{key:"unnormalizeValue",value:function(t,e,n){return t*(n-e)+e}},{key:"getMin",value:function(t){return t.reduce(function(t,e){return Math.min(t,e)})}},{key:"getMax",value:function(t){return t.reduce(function(t,e){return Math.max(t,e)})}},{key:"isJsonOrString",value:function(t){try{JSON.parse(t)}catch(t){return!1}return!0}},{key:"zipArrays",value:function(t,e){return t.length!==e.length?(console.error("arrays do not have the same length"),[]):[].concat((0,o.default)(new Array(t.length).fill(null))).map(function(n,r){return(0,i.default)({},t[r],e[r])})}},{key:"createLabelsFromArrayValues",value:function(t,e){var n=void 0;return Array.isArray(t)&&(n=t.map(function(t,n){return e+"_"+n})),n}},{key:"formatDataAsObject",value:function(t,e){var n={};if(Array.isArray(t))return t.forEach(function(t,r){var i=e[r];n[i]=t}),n;if("object"===(void 0===t?"undefined":(0,r.default)(t)))return n=t;throw new Error("input provided is not supported or does not match your output label specifications")}},{key:"getDataType",value:function(t){var e=void 0===t?"undefined":(0,r.default)(t);return"object"===e&&Array.isArray(t)&&(e="array"),e}}]),t}();e.default=new c},function(t,e,n){"use strict";e.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(272));e.default=function(t,e,n){return e in t?(0,r.default)(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e,n){t.exports={default:n(408),__esModule:!0}},function(t,e,n){var r=n(45);t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},function(t,e,n){t.exports={default:n(432),__esModule:!0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=l(n(61)),i=l(n(12)),o=l(n(36)),a=l(n(11)),s=l(n(9)),u=l(n(10)),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2));function l(t){return t&&t.__esModule?t:{default:t}}var f=function(){function t(e){(0,s.default)(this,t),this.urlPath=e,"/"!==this.urlPath.charAt(this.urlPath.length-1)&&(this.urlPath+="/")}return(0,u.default)(t,[{key:"loadManifest",value:function(){var t=(0,a.default)(i.default.mark(function t(){var e=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new o.default(function(t,n){var r=new XMLHttpRequest;r.open("GET",e.urlPath+"manifest.json"),r.onload=function(){e.checkpointManifest=JSON.parse(r.responseText),t()},r.onerror=function(t){throw n(),new Error("manifest.json not found at "+e.urlPath+". "+t)},r.send()}));case 1:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getCheckpointManifest",value:function(){var t=(0,a.default)(i.default.mark(function t(){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=this.checkpointManifest){t.next=3;break}return t.next=3,this.loadManifest();case 3:return t.abrupt("return",this.checkpointManifest);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getAllVariables",value:function(){var t=(0,a.default)(i.default.mark(function t(){var e,n,a=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null==this.variables){t.next=2;break}return t.abrupt("return",o.default.resolve(this.variables));case 2:return t.next=4,this.getCheckpointManifest();case 4:return e=(0,r.default)(this.checkpointManifest),n=e.map(function(t){return a.getVariable(t)}),t.abrupt("return",o.default.all(n).then(function(t){a.variables={};for(var n=0;n<t.length;n+=1)a.variables[e[n]]=t[n];return a.variables}));case 7:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVariable",value:function(t){var e=this;if(!(t in this.checkpointManifest))throw new Error("Cannot load non-existent variable "+t);var n=function(n){var r=new XMLHttpRequest;r.responseType="arraybuffer";var i=e.checkpointManifest[t].filename;r.open("GET",e.urlPath+i),r.onload=function(){if(404===r.status)throw new Error("Not found variable "+t);var i=new Float32Array(r.response),o=c.Tensor.make(e.checkpointManifest[t].shape,{values:i});n(o)},r.onerror=function(e){throw new Error("Could not fetch variable "+t+": "+e)},r.send()};return null==this.checkpointManifest?new o.default(function(t){e.loadManifest().then(function(){new o.default(n).then(t)})}):new o.default(n)}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=y(n(72)),i=y(n(17)),o=y(n(12)),a=y(n(11)),s=y(n(176)),u=y(n(9)),c=y(n(10)),l=y(n(175)),f=y(n(174)),d=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),h=y(n(177)),p=n(62),m=y(n(20)),g=y(n(450)),v=y(n(173)),b=n(449);function y(t){return t&&t.__esModule?t:{default:t}}var w={modelUrl:"https://raw.githubusercontent.com/ml5js/ml5-data-and-training/master/models/YOLO/model.json",filterBoxesThreshold:.01,IOUThreshold:.4,classProbThreshold:.4},x=416,_=function(t){function e(t,n,r){(0,u.default)(this,e);var i=(0,l.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,x));return i.modelUrl=n.modelUrl||w.modelUrl,i.filterBoxesThreshold=n.filterBoxesThreshold||w.filterBoxesThreshold,i.IOUThreshold=n.IOUThreshold||w.IOUThreshold,i.classProbThreshold=n.classProbThreshold||w.classProbThreshold,i.modelReady=!1,i.isPredicting=!1,i.callback=r,i.ready=(0,m.default)(i.loadModel(),i.callback),n.disableDeprecationNotice||console.warn("WARNING! Function YOLO has been deprecated, please use the new ObjectDetector function instead"),i}return(0,f.default)(e,t),(0,c.default)(e,[{key:"loadModel",value:function(){var t=(0,a.default)(o.default.mark(function t(){var e;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.videoElt||this.video){t.next=4;break}return t.next=3,this.loadVideo();case 3:this.video=t.sent;case 4:if(!0!==v.default.isAbsoluteURL(this.modelUrl)){t.next=10;break}return t.next=7,d.loadLayersModel(this.modelUrl);case 7:this.model=t.sent,t.next=15;break;case 10:return e=v.default.getModelPath(this.modelUrl),this.modelUrl=e+"/model.json",t.next=14,d.loadLayersModel(this.modelUrl);case 14:this.model=t.sent;case 15:return this.modelReady=!0,t.abrupt("return",this);case 17:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"detect",value:function(){var t=(0,a.default)(o.default.mark(function t(e,n){var r,a;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:if(r=void 0,a=n,!(0,p.isInstanceOfSupportedElement)(e)){t.next=8;break}r=e,t.next=22;break;case 8:if("object"!==(void 0===e?"undefined":(0,i.default)(e))||!(0,p.isInstanceOfSupportedElement)(e.elt)){t.next=12;break}r=e.elt,t.next=22;break;case 12:if("object"!==(void 0===e?"undefined":(0,i.default)(e))||!(0,p.isInstanceOfSupportedElement)(e.canvas)){t.next=16;break}r=e.canvas,t.next=22;break;case 16:if("function"!=typeof e){t.next=21;break}r=this.video,a=e,t.next=22;break;case 21:throw new Error("Detection subject not supported");case 22:return t.abrupt("return",(0,m.default)(this.detectInternal(r),a));case 23:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"detectInternal",value:function(){var t=(0,a.default)(o.default.mark(function t(e){var n,i,a,s,u,c,l,f,h,m,v,y=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,d.nextFrame();case 4:return n=d.tensor2d([[.57273,.677385],[1.87446,2.06253],[3.33843,5.47434],[7.88282,3.52778],[9.77052,9.16828]]),this.isPredicting=!0,i=d.tidy(function(){var t=(0,p.imgToTensor)(e,[x,x]),i=y.model.predict(t),o=(0,b.head)(i,n,80),a=(0,r.default)(o,4),s=a[0],u=a[1],c=a[2],l=a[3];return[(0,b.boxesToCorners)(s,u),c,l]}),a=(0,r.default)(i,3),s=a[0],u=a[1],c=a[2],t.next=9,(0,b.filterBoxes)(s,u,c,this.filterBoxesThreshold);case 9:if(l=t.sent,f=(0,r.default)(l,3),h=f[0],m=f[1],v=f[2],s.dispose(),u.dispose(),c.dispose(),null!=h){t.next=19;break}return t.abrupt("return",[]);case 19:return t.abrupt("return",d.tidy(function(){var t=d.scalar(x),e=d.scalar(x),i=d.stack([e,t,e,t]).reshape([1,4]),o=d.mul(h,i),a=o.dataSync(),s=m.dataSync(),u=(0,b.nonMaxSuppression)(a,s,y.IOUThreshold),c=(0,r.default)(u,3),l=c[0],f=c[1],p=c[2],w=[];return v.gather(d.tensor1d(l,"int32")).dataSync().forEach(function(t,e){var n=p[e];if(!(n<y.classProbThreshold)){var i=g.default[t],o=(0,r.default)(f[e],4),a=o[0],s=o[1],u=o[2],c=o[3];a=Math.max(0,a),s=Math.max(0,s),u=Math.min(x,u)-a;var l={label:i,confidence:n,x:s,y:a,width:c=Math.min(x,c)-s,height:u,normalized:{x:s/x,y:a/x,width:c/x,height:u/x}};w.push(l)}}),y.isPredicting=!1,t.dispose(),e.dispose(),i.dispose(),o.dispose(),h.dispose(),m.dispose(),v.dispose(),n.dispose(),w}));case 20:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),e}(h.default);e.default=function(t,e,n){var r=null,o={},a=n;return t instanceof HTMLVideoElement?r=t:"object"===(void 0===t?"undefined":(0,i.default)(t))&&t.elt instanceof HTMLVideoElement?r=t.elt:"function"==typeof t?a=t:"object"===(void 0===t?"undefined":(0,i.default)(t))&&(o=t),"object"===(void 0===e?"undefined":(0,i.default)(e))?o=e:"function"==typeof e&&(a=e),new _(r,o,a)}},function(t,e,n){var r=n(99),i=n(76),o=n(123).f;t.exports=function(t){return function(e){for(var n,a=i(e),s=r(a),u=s.length,c=0,l=[];u>c;)o.call(a,n=s[c++])&&l.push(t?[n,a[n]]:a[n]);return l}}},function(t,e,n){t.exports={default:n(461),__esModule:!0}},function(t,e,n){var r=n(26),i=n(19),o=n(78);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*o(function(){n(1)}),"Object",a)}},function(t,e){},function(t,e,n){var r=n(123),i=n(126),o=n(76),a=n(225),s=n(77),u=n(359),c=Object.getOwnPropertyDescriptor;e.f=n(55)?c:function(t,e){if(t=o(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(s(t,e))return i(!r.f.call(t,e),t[e])}},function(t,e,n){var r=n(358),i=n(219).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){var r=n(125);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){t.exports={default:n(498),__esModule:!0}},function(t,e,n){var r=n(28)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},t(o)}catch(t){}return n}},function(t,e,n){"use strict";var r=n(29),i=n(19),o=n(46),a=n(55),s=n(28)("species");t.exports=function(t){var e="function"==typeof i[t]?i[t]:r[t];a&&e&&!e[s]&&o.f(e,s,{configurable:!0,get:function(){return this}})}},function(t,e,n){var r=n(56),i=n(45),o=n(183);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var r,i,o,a=n(64),s=n(503),u=n(283),c=n(226),l=n(29),f=l.process,d=l.setImmediate,h=l.clearImmediate,p=l.MessageChannel,m=l.Dispatch,g=0,v={},b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){b.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++g]=function(){s("function"==typeof t?t:Function(t),e)},r(g),g},h=function(t){delete v[t]},"process"==n(125)(f)?r=function(t){f.nextTick(a(b,t,1))}:m&&m.now?r=function(t){m.now(a(b,t,1))}:p?(o=(i=new p).port2,i.port1.onmessage=y,r=a(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(t){l.postMessage(t+"","*")},l.addEventListener("message",y,!1)):r="onreadystatechange"in c("script")?function(t){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),b.call(t)}}:function(t){setTimeout(a(b,t,1),0)}),t.exports={set:d,clear:h}},function(t,e,n){var r=n(56),i=n(127),o=n(28)("species");t.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||void 0==(n=r(a)[o])?e:i(n)}},function(t,e,n){var r=n(92),i=n(28)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},function(t,e,n){var r=n(56);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&r(o.call(t)),e}}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var r=n(77),i=n(98),o=n(221)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,n){var r=n(29).document;t.exports=r&&r.documentElement},function(t,e,n){t.exports=n(68)},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(90)),a=n(43);e.linechart=function(t,e,n={}){return r(this,void 0,void 0,function*(){let r=e.values;const i=null==e.series?[]:e.series;r=Array.isArray(r[0])?r:[r];const u=[],c=new Set;r.forEach((t,e)=>{const n=null!=i[e]?i[e]:`Series ${e+1}`;c.add(n);const r=t.map(t=>Object.assign({},t,{series:n}));u.push(...r)});const l=a.getDrawArea(t),f=Object.assign({},s,n),d={x:{field:"x",type:f.xType,title:f.xLabel},y:{field:"y",type:f.yType,title:f.yLabel,scale:f.zoomToFit?{zero:!1}:null!=f.yAxisDomain?{domain:f.yAxisDomain}:void 0},color:{field:"series",type:"nominal",legend:{values:Array.from(c)}}};let h;null!=f.yAxisDomain&&(h={filter:{field:"y",range:f.yAxisDomain}});const p={width:f.width||l.clientWidth,height:f.height||l.clientHeight,padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:f.fontSize,titleFontSize:f.fontSize},text:{fontSize:f.fontSize},legend:{labelFontSize:f.fontSize,titleFontSize:f.fontSize}},data:{values:u},layer:[{mark:{type:"line",clip:!0},encoding:d},{mark:{type:"point"},transform:f.yAxisDomain?[h]:void 0,selection:{nearestPoint:{type:"single",on:"mouseover",nearest:!0,empty:"none",encodings:["x"]}},encoding:Object.assign({},d,{opacity:{value:0,condition:{selection:"nearestPoint",value:1}}})},{transform:[{filter:{selection:"nearestPoint"}},h].filter(Boolean),mark:{type:"text",align:"left",dx:5,dy:-5,color:"black"},encoding:Object.assign({},d,{text:{type:f.xType,field:"y",format:".6f"},color:void 0})},{transform:[{filter:{selection:"nearestPoint"}}],mark:{type:"rule",color:"gray"},encoding:{x:{type:f.xType,field:"x"}}}]};return yield o.default(l,p,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const s={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},function(t,e,n){"use strict";function r(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function i(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}Object.defineProperty(e,"__esModule",{value:!0}),e.assert=r,e.assertShapesMatch=function(t,e,n=""){r(i(t,e),n+` Shapes ${t} and ${e} must match`)},e.arraysEqual=i,e.DECIMAL_PLACES_TO_CHECK=4},function(t,e){t.exports=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}},function(t,e,n){var r=n(287),i=n(296),o=n(309),a=n(536),s=n(37);t.exports=function(t,e,n){var u=s(t)?r:a,c=arguments.length<3;return u(t,o(e,4),n,c,i)}},function(t,e,n){"use strict";t.exports={"border-box":{boxSizing:"border-box"},"aspect-ratio":{height:"0",position:"relative"},"aspect-ratio--16x9":{paddingBottom:"56.25%"},"aspect-ratio--9x16":{paddingBottom:"177.77%"},"aspect-ratio--4x3":{paddingBottom:"75%"},"aspect-ratio--3x4":{paddingBottom:"133.33%"},"aspect-ratio--6x4":{paddingBottom:"66.6%"},"aspect-ratio--4x6":{paddingBottom:"150%"},"aspect-ratio--8x5":{paddingBottom:"62.5%"},"aspect-ratio--5x8":{paddingBottom:"160%"},"aspect-ratio--7x5":{paddingBottom:"71.42%"},"aspect-ratio--5x7":{paddingBottom:"140%"},"aspect-ratio--1x1":{paddingBottom:"100%"},"aspect-ratio--object":{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",width:"100%",height:"100%",zIndex:"100"},cover:{backgroundSize:"cover"},contain:{backgroundSize:"contain"},"bg-center":{backgroundRepeat:"no-repeat",backgroundPosition:"center center"},"bg-top":{backgroundRepeat:"no-repeat",backgroundPosition:"top center"},"bg-right":{backgroundRepeat:"no-repeat",backgroundPosition:"center right"},"bg-bottom":{backgroundRepeat:"no-repeat",backgroundPosition:"bottom center"},"bg-left":{backgroundRepeat:"no-repeat",backgroundPosition:"center left"},outline:{outline:"1px solid"},"outline-transparent":{outline:"1px solid transparent"},"outline-0":{outline:"0"},ba:{borderStyle:"solid",borderWidth:"1px"},bt:{borderTopStyle:"solid",borderTopWidth:"1px"},br:{borderRightStyle:"solid",borderRightWidth:"1px"},bb:{borderBottomStyle:"solid",borderBottomWidth:"1px"},bl:{borderLeftStyle:"solid",borderLeftWidth:"1px"},bn:{borderStyle:"none",borderWidth:"0"},"b--black":{borderColor:"#000"},"b--near-black":{borderColor:"#111"},"b--dark-gray":{borderColor:"#333"},"b--mid-gray":{borderColor:"#555"},"b--gray":{borderColor:"#777"},"b--silver":{borderColor:"#999"},"b--light-silver":{borderColor:"#aaa"},"b--moon-gray":{borderColor:"#ccc"},"b--light-gray":{borderColor:"#eee"},"b--near-white":{borderColor:"#f4f4f4"},"b--white":{borderColor:"#fff"},"b--white-90":{borderColor:"rgba( 255, 255, 255, .9 )"},"b--white-80":{borderColor:"rgba( 255, 255, 255, .8 )"},"b--white-70":{borderColor:"rgba( 255, 255, 255, .7 )"},"b--white-60":{borderColor:"rgba( 255, 255, 255, .6 )"},"b--white-50":{borderColor:"rgba( 255, 255, 255, .5 )"},"b--white-40":{borderColor:"rgba( 255, 255, 255, .4 )"},"b--white-30":{borderColor:"rgba( 255, 255, 255, .3 )"},"b--white-20":{borderColor:"rgba( 255, 255, 255, .2 )"},"b--white-10":{borderColor:"rgba( 255, 255, 255, .1 )"},"b--white-05":{borderColor:"rgba( 255, 255, 255, .05 )"},"b--white-025":{borderColor:"rgba( 255, 255, 255, .025 )"},"b--white-0125":{borderColor:"rgba( 255, 255, 255, .0125 )"},"b--black-90":{borderColor:"rgba( 0, 0, 0, .9 )"},"b--black-80":{borderColor:"rgba( 0, 0, 0, .8 )"},"b--black-70":{borderColor:"rgba( 0, 0, 0, .7 )"},"b--black-60":{borderColor:"rgba( 0, 0, 0, .6 )"},"b--black-50":{borderColor:"rgba( 0, 0, 0, .5 )"},"b--black-40":{borderColor:"rgba( 0, 0, 0, .4 )"},"b--black-30":{borderColor:"rgba( 0, 0, 0, .3 )"},"b--black-20":{borderColor:"rgba( 0, 0, 0, .2 )"},"b--black-10":{borderColor:"rgba( 0, 0, 0, .1 )"},"b--black-05":{borderColor:"rgba( 0, 0, 0, .05 )"},"b--black-025":{borderColor:"rgba( 0, 0, 0, .025 )"},"b--black-0125":{borderColor:"rgba( 0, 0, 0, .0125 )"},"b--dark-red":{borderColor:"#e7040f"},"b--red":{borderColor:"#ff4136"},"b--light-red":{borderColor:"#ff725c"},"b--orange":{borderColor:"#ff6300"},"b--gold":{borderColor:"#ffb700"},"b--yellow":{borderColor:"#ffd700"},"b--light-yellow":{borderColor:"#fbf1a9"},"b--purple":{borderColor:"#5e2ca5"},"b--light-purple":{borderColor:"#a463f2"},"b--dark-pink":{borderColor:"#d5008f"},"b--hot-pink":{borderColor:"#ff41b4"},"b--pink":{borderColor:"#ff80cc"},"b--light-pink":{borderColor:"#ffa3d7"},"b--dark-green":{borderColor:"#137752"},"b--green":{borderColor:"#19a974"},"b--light-green":{borderColor:"#9eebcf"},"b--navy":{borderColor:"#001b44"},"b--dark-blue":{borderColor:"#00449e"},"b--blue":{borderColor:"#357edd"},"b--light-blue":{borderColor:"#96ccff"},"b--lightest-blue":{borderColor:"#cdecff"},"b--washed-blue":{borderColor:"#f6fffe"},"b--washed-green":{borderColor:"#e8fdf5"},"b--washed-yellow":{borderColor:"#fffceb"},"b--washed-red":{borderColor:"#ffdfdf"},"b--transparent":{borderColor:"transparent"},"b--inherit":{borderColor:"inherit"},br0:{borderRadius:"0"},br1:{borderRadius:".125rem"},br2:{borderRadius:".25rem"},br3:{borderRadius:".5rem"},br4:{borderRadius:"1rem"},"br-100":{borderRadius:"100%"},"br-pill":{borderRadius:"9999px"},"br--bottom":{borderTopLeftRadius:"0",borderTopRightRadius:"0"},"br--top":{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},"br--right":{borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},"br--left":{borderTopRightRadius:"0",borderBottomRightRadius:"0"},"b--dotted":{borderStyle:"dotted"},"b--dashed":{borderStyle:"dashed"},"b--solid":{borderStyle:"solid"},"b--none":{borderStyle:"none"},bw0:{borderWidth:"0"},bw1:{borderWidth:".125rem"},bw2:{borderWidth:".25rem"},bw3:{borderWidth:".5rem"},bw4:{borderWidth:"1rem"},bw5:{borderWidth:"2rem"},"bt-0":{borderTopWidth:"0"},"br-0":{borderRightWidth:"0"},"bb-0":{borderBottomWidth:"0"},"bl-0":{borderLeftWidth:"0"},"shadow-1":{boxShadow:"0 0 4px 2px rgba( 0, 0, 0, .2 )"},"shadow-2":{boxShadow:"0 0 8px 2px rgba( 0, 0, 0, .2 )"},"shadow-3":{boxShadow:"2px 2px 4px 2px rgba( 0, 0, 0, .2 )"},"shadow-4":{boxShadow:"2px 2px 8px 0 rgba( 0, 0, 0, .2 )"},"shadow-5":{boxShadow:"4px 4px 8px 0 rgba( 0, 0, 0, .2 )"},pre:{whiteSpace:"pre",overflowX:"auto",overflowY:"hidden",overflow:"scroll"},"top-0":{top:"0"},"right-0":{right:"0"},"bottom-0":{bottom:"0"},"left-0":{left:"0"},"top-1":{top:"1rem"},"right-1":{right:"1rem"},"bottom-1":{bottom:"1rem"},"left-1":{left:"1rem"},"top-2":{top:"2rem"},"right-2":{right:"2rem"},"bottom-2":{bottom:"2rem"},"left-2":{left:"2rem"},"top--1":{top:"-1rem"},"right--1":{right:"-1rem"},"bottom--1":{bottom:"-1rem"},"left--1":{left:"-1rem"},"top--2":{top:"-2rem"},"right--2":{right:"-2rem"},"bottom--2":{bottom:"-2rem"},"left--2":{left:"-2rem"},"absolute--fill":{top:"0",right:"0",bottom:"0",left:"0"},cf:{zoom:"1",":after":{content:'" "',display:"table"},":before":{content:'" "',display:"table"}},cl:{clear:"left"},cr:{clear:"right"},cb:{clear:"both"},cn:{clear:"none"},dn:{display:"none"},di:{display:"inline"},db:{display:"block"},dib:{display:"inline-block"},dit:{display:"inline-table"},dt:{display:"table"},dtc:{display:"table-cell"},"dt-row":{display:"table-row"},"dt-row-group":{display:"table-row-group"},"dt-column":{display:"table-column"},"dt-column-group":{display:"table-column-group"},"dt--fixed":{tableLayout:"fixed",width:"100%"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},"flex-auto":{webkitBoxFlex:"1",msFlex:"1 1 auto",flex:"1 1 auto",minWidth:"0",minHeight:"0"},"flex-none":{webkitBoxFlex:"0",msFlex:"none",flex:"none"},"flex-column":{webkitBoxOrient:"vertical",webkitBoxDirection:"normal",msFlexDirection:"column",flexDirection:"column"},"flex-row":{webkitBoxOrient:"horizontal",webkitBoxDirection:"normal",msFlexDirection:"row",flexDirection:"row"},"flex-wrap":{msFlexWrap:"wrap",flexWrap:"wrap"},"flex-nowrap":{msFlexWrap:"nowrap",flexWrap:"nowrap"},"flex-wrap-reverse":{msFlexWrap:"wrap-reverse",flexWrap:"wrap-reverse"},"flex-column-reverse":{webkitBoxOrient:"vertical",webkitBoxDirection:"reverse",msFlexDirection:"column-reverse",flexDirection:"column-reverse"},"flex-row-reverse":{webkitBoxOrient:"horizontal",webkitBoxDirection:"reverse",msFlexDirection:"row-reverse",flexDirection:"row-reverse"},"items-start":{webkitBoxAlign:"start",msFlexAlign:"start",alignItems:"flex-start"},"items-end":{webkitBoxAlign:"end",msFlexAlign:"end",alignItems:"flex-end"},"items-center":{webkitBoxAlign:"center",msFlexAlign:"center",alignItems:"center"},"items-baseline":{webkitBoxAlign:"baseline",msFlexAlign:"baseline",alignItems:"baseline"},"items-stretch":{webkitBoxAlign:"stretch",msFlexAlign:"stretch",alignItems:"stretch"},"self-start":{msFlexItemAlign:"start",alignSelf:"flex-start"},"self-end":{msFlexItemAlign:"end",alignSelf:"flex-end"},"self-center":{msFlexItemAlign:"center",msGridRowAlign:"center",alignSelf:"center"},"self-baseline":{msFlexItemAlign:"baseline",alignSelf:"baseline"},"self-stretch":{msFlexItemAlign:"stretch",msGridRowAlign:"stretch",alignSelf:"stretch"},"justify-start":{webkitBoxPack:"start",msFlexPack:"start",justifyContent:"flex-start"},"justify-end":{webkitBoxPack:"end",msFlexPack:"end",justifyContent:"flex-end"},"justify-center":{webkitBoxPack:"center",msFlexPack:"center",justifyContent:"center"},"justify-between":{webkitBoxPack:"justify",msFlexPack:"justify",justifyContent:"space-between"},"justify-around":{msFlexPack:"distribute",justifyContent:"space-around"},"content-start":{msFlexLinePack:"start",alignContent:"flex-start"},"content-end":{msFlexLinePack:"end",alignContent:"flex-end"},"content-center":{msFlexLinePack:"center",alignContent:"center"},"content-between":{msFlexLinePack:"justify",alignContent:"space-between"},"content-around":{msFlexLinePack:"distribute",alignContent:"space-around"},"content-stretch":{msFlexLinePack:"stretch",alignContent:"stretch"},"order-0":{webkitBoxOrdinalGroup:"1",msFlexOrder:"0",order:"0"},"order-1":{webkitBoxOrdinalGroup:"2",msFlexOrder:"1",order:"1"},"order-2":{webkitBoxOrdinalGroup:"3",msFlexOrder:"2",order:"2"},"order-3":{webkitBoxOrdinalGroup:"4",msFlexOrder:"3",order:"3"},"order-4":{webkitBoxOrdinalGroup:"5",msFlexOrder:"4",order:"4"},"order-5":{webkitBoxOrdinalGroup:"6",msFlexOrder:"5",order:"5"},"order-6":{webkitBoxOrdinalGroup:"7",msFlexOrder:"6",order:"6"},"order-7":{webkitBoxOrdinalGroup:"8",msFlexOrder:"7",order:"7"},"order-8":{webkitBoxOrdinalGroup:"9",msFlexOrder:"8",order:"8"},"order-last":{webkitBoxOrdinalGroup:"100000",msFlexOrder:"99999",order:"99999"},fl:{float:"left",display:"inline"},fr:{float:"right",display:"inline"},fn:{float:"none"},"sans-serif":{fontFamily:"-apple-system, BlinkMacSystemFont, 'avenir next', avenir, 'helvetica neue', helvetica, ubuntu, roboto, noto, 'segoe ui', arial, sans-serif"},serif:{fontFamily:"georgia, times, serif"},"system-sans-serif":{fontFamily:"sans-serif"},"system-serif":{fontFamily:"serif"},code:{fontFamily:"Consolas, monaco, monospace"},courier:{fontFamily:"'Courier Next', courier, monospace"},helvetica:{fontFamily:"'helvetica neue', helvetica, sans-serif"},avenir:{fontFamily:"'avenir next', avenir, sans-serif"},athelas:{fontFamily:"athelas, georgia, serif"},georgia:{fontFamily:"georgia, serif"},times:{fontFamily:"times, serif"},bodoni:{fontFamily:'"Bodoni MT", serif'},calisto:{fontFamily:'"Calisto MT", serif'},garamond:{fontFamily:"garamond, serif"},baskerville:{fontFamily:"baskerville, serif"},i:{fontStyle:"italic"},"fs-normal":{fontStyle:"normal"},normal:{fontWeight:"normal"},b:{fontWeight:"bold"},fw1:{fontWeight:"100"},fw2:{fontWeight:"200"},fw3:{fontWeight:"300"},fw4:{fontWeight:"400"},fw5:{fontWeight:"500"},fw6:{fontWeight:"600"},fw7:{fontWeight:"700"},fw8:{fontWeight:"800"},fw9:{fontWeight:"900"},"input-reset":{"::-moz-focus-inner":{border:"0",padding:"0"},webkitAppearance:"none",mozAppearance:"none"},"button-reset":{"::-moz-focus-inner":{border:"0",padding:"0"}},h1:{height:"1rem"},h2:{height:"2rem"},h3:{height:"4rem"},h4:{height:"8rem"},h5:{height:"16rem"},"h-25":{height:"25%"},"h-50":{height:"50%"},"h-75":{height:"75%"},"h-100":{height:"100%"},"min-h-100":{minHeight:"100%"},"vh-25":{height:"25vh"},"vh-50":{height:"50vh"},"vh-75":{height:"75vh"},"vh-100":{height:"100vh"},"min-vh-100":{minHeight:"100vh"},"h-auto":{height:"auto"},"h-inherit":{height:"inherit"},tracked:{letterSpacing:".1em"},"tracked-tight":{letterSpacing:"-.05em"},"tracked-mega":{letterSpacing:".25em"},"lh-solid":{lineHeight:"1"},"lh-title":{lineHeight:"1.25"},"lh-copy":{lineHeight:"1.5"},link:{":focus":{transition:"color .15s ease-in",outline:"1px dotted currentColor"},":active":{transition:"color .15s ease-in"},":hover":{transition:"color .15s ease-in"},":visited":{transition:"color .15s ease-in"},":link":{transition:"color .15s ease-in"},textDecoration:"none",transition:"color .15s ease-in"},list:{listStyleType:"none"},"mw-100":{maxWidth:"100%"},mw1:{maxWidth:"1rem"},mw2:{maxWidth:"2rem"},mw3:{maxWidth:"4rem"},mw4:{maxWidth:"8rem"},mw5:{maxWidth:"16rem"},mw6:{maxWidth:"32rem"},mw7:{maxWidth:"48rem"},mw8:{maxWidth:"64rem"},mw9:{maxWidth:"96rem"},"mw-none":{maxWidth:"none"},w1:{width:"1rem"},w2:{width:"2rem"},w3:{width:"4rem"},w4:{width:"8rem"},w5:{width:"16rem"},"w-10":{width:"10%"},"w-20":{width:"20%"},"w-25":{width:"25%"},"w-30":{width:"30%"},"w-33":{width:"33%"},"w-34":{width:"34%"},"w-40":{width:"40%"},"w-50":{width:"50%"},"w-60":{width:"60%"},"w-70":{width:"70%"},"w-75":{width:"75%"},"w-80":{width:"80%"},"w-90":{width:"90%"},"w-100":{width:"100%"},"w-third":{width:"calc( 100% / 3 )"},"w-two-thirds":{width:"calc( 100% / 1.5 )"},"w-auto":{width:"auto"},"overflow-visible":{overflow:"visible"},"overflow-hidden":{overflow:"hidden"},"overflow-scroll":{overflow:"scroll"},"overflow-auto":{overflow:"auto"},"overflow-x-visible":{overflowX:"visible"},"overflow-x-hidden":{overflowX:"hidden"},"overflow-x-scroll":{overflowX:"scroll"},"overflow-x-auto":{overflowX:"auto"},"overflow-y-visible":{overflowY:"visible"},"overflow-y-hidden":{overflowY:"hidden"},"overflow-y-scroll":{overflowY:"scroll"},"overflow-y-auto":{overflowY:"auto"},static:{position:"static"},relative:{position:"relative"},absolute:{position:"absolute"},fixed:{position:"fixed"},"o-100":{opacity:"1"},"o-90":{opacity:".9"},"o-80":{opacity:".8"},"o-70":{opacity:".7"},"o-60":{opacity:".6"},"o-50":{opacity:".5"},"o-40":{opacity:".4"},"o-30":{opacity:".3"},"o-20":{opacity:".2"},"o-10":{opacity:".1"},"o-05":{opacity:".05"},"o-025":{opacity:".025"},"o-0":{opacity:"0"},"rotate-45":{webkitTransform:"rotate( 45deg )",transform:"rotate( 45deg )"},"rotate-90":{webkitTransform:"rotate( 90deg )",transform:"rotate( 90deg )"},"rotate-135":{webkitTransform:"rotate( 135deg )",transform:"rotate( 135deg )"},"rotate-180":{webkitTransform:"rotate( 180deg )",transform:"rotate( 180deg )"},"rotate-225":{webkitTransform:"rotate( 225deg )",transform:"rotate( 225deg )"},"rotate-270":{webkitTransform:"rotate( 270deg )",transform:"rotate( 270deg )"},"rotate-315":{webkitTransform:"rotate( 315deg )",transform:"rotate( 315deg )"},"black-90":{color:"rgba( 0, 0, 0, .9 )"},"black-80":{color:"rgba( 0, 0, 0, .8 )"},"black-70":{color:"rgba( 0, 0, 0, .7 )"},"black-60":{color:"rgba( 0, 0, 0, .6 )"},"black-50":{color:"rgba( 0, 0, 0, .5 )"},"black-40":{color:"rgba( 0, 0, 0, .4 )"},"black-30":{color:"rgba( 0, 0, 0, .3 )"},"black-20":{color:"rgba( 0, 0, 0, .2 )"},"black-10":{color:"rgba( 0, 0, 0, .1 )"},"black-05":{color:"rgba( 0, 0, 0, .05 )"},"white-90":{color:"rgba( 255, 255, 255, .9 )"},"white-80":{color:"rgba( 255, 255, 255, .8 )"},"white-70":{color:"rgba( 255, 255, 255, .7 )"},"white-60":{color:"rgba( 255, 255, 255, .6 )"},"white-50":{color:"rgba( 255, 255, 255, .5 )"},"white-40":{color:"rgba( 255, 255, 255, .4 )"},"white-30":{color:"rgba( 255, 255, 255, .3 )"},"white-20":{color:"rgba( 255, 255, 255, .2 )"},"white-10":{color:"rgba( 255, 255, 255, .1 )"},black:{color:"#000"},"near-black":{color:"#111"},"dark-gray":{color:"#333"},"mid-gray":{color:"#555"},gray:{color:"#777"},silver:{color:"#999"},"light-silver":{color:"#aaa"},"moon-gray":{color:"#ccc"},"light-gray":{color:"#eee"},"near-white":{color:"#f4f4f4"},white:{color:"#fff"},"dark-red":{color:"#e7040f"},red:{color:"#ff4136"},"light-red":{color:"#ff725c"},orange:{color:"#ff6300"},gold:{color:"#ffb700"},yellow:{color:"#ffd700"},"light-yellow":{color:"#fbf1a9"},purple:{color:"#5e2ca5"},"light-purple":{color:"#a463f2"},"dark-pink":{color:"#d5008f"},"hot-pink":{color:"#ff41b4"},pink:{color:"#ff80cc"},"light-pink":{color:"#ffa3d7"},"dark-green":{color:"#137752"},green:{color:"#19a974"},"light-green":{color:"#9eebcf"},navy:{color:"#001b44"},"dark-blue":{color:"#00449e"},blue:{color:"#357edd"},"light-blue":{color:"#96ccff"},"lightest-blue":{color:"#cdecff"},"washed-blue":{color:"#f6fffe"},"washed-green":{color:"#e8fdf5"},"washed-yellow":{color:"#fffceb"},"washed-red":{color:"#ffdfdf"},"color-inherit":{color:"inherit"},"bg-black-90":{backgroundColor:"rgba( 0, 0, 0, .9 )"},"bg-black-80":{backgroundColor:"rgba( 0, 0, 0, .8 )"},"bg-black-70":{backgroundColor:"rgba( 0, 0, 0, .7 )"},"bg-black-60":{backgroundColor:"rgba( 0, 0, 0, .6 )"},"bg-black-50":{backgroundColor:"rgba( 0, 0, 0, .5 )"},"bg-black-40":{backgroundColor:"rgba( 0, 0, 0, .4 )"},"bg-black-30":{backgroundColor:"rgba( 0, 0, 0, .3 )"},"bg-black-20":{backgroundColor:"rgba( 0, 0, 0, .2 )"},"bg-black-10":{backgroundColor:"rgba( 0, 0, 0, .1 )"},"bg-black-05":{backgroundColor:"rgba( 0, 0, 0, .05 )"},"bg-white-90":{backgroundColor:"rgba( 255, 255, 255, .9 )"},"bg-white-80":{backgroundColor:"rgba( 255, 255, 255, .8 )"},"bg-white-70":{backgroundColor:"rgba( 255, 255, 255, .7 )"},"bg-white-60":{backgroundColor:"rgba( 255, 255, 255, .6 )"},"bg-white-50":{backgroundColor:"rgba( 255, 255, 255, .5 )"},"bg-white-40":{backgroundColor:"rgba( 255, 255, 255, .4 )"},"bg-white-30":{backgroundColor:"rgba( 255, 255, 255, .3 )"},"bg-white-20":{backgroundColor:"rgba( 255, 255, 255, .2 )"},"bg-white-10":{backgroundColor:"rgba( 255, 255, 255, .1 )"},"bg-black":{backgroundColor:"#000"},"bg-near-black":{backgroundColor:"#111"},"bg-dark-gray":{backgroundColor:"#333"},"bg-mid-gray":{backgroundColor:"#555"},"bg-gray":{backgroundColor:"#777"},"bg-silver":{backgroundColor:"#999"},"bg-light-silver":{backgroundColor:"#aaa"},"bg-moon-gray":{backgroundColor:"#ccc"},"bg-light-gray":{backgroundColor:"#eee"},"bg-near-white":{backgroundColor:"#f4f4f4"},"bg-white":{backgroundColor:"#fff"},"bg-transparent":{backgroundColor:"transparent"},"bg-dark-red":{backgroundColor:"#e7040f"},"bg-red":{backgroundColor:"#ff4136"},"bg-light-red":{backgroundColor:"#ff725c"},"bg-orange":{backgroundColor:"#ff6300"},"bg-gold":{backgroundColor:"#ffb700"},"bg-yellow":{backgroundColor:"#ffd700"},"bg-light-yellow":{backgroundColor:"#fbf1a9"},"bg-purple":{backgroundColor:"#5e2ca5"},"bg-light-purple":{backgroundColor:"#a463f2"},"bg-dark-pink":{backgroundColor:"#d5008f"},"bg-hot-pink":{backgroundColor:"#ff41b4"},"bg-pink":{backgroundColor:"#ff80cc"},"bg-light-pink":{backgroundColor:"#ffa3d7"},"bg-dark-green":{backgroundColor:"#137752"},"bg-green":{backgroundColor:"#19a974"},"bg-light-green":{backgroundColor:"#9eebcf"},"bg-navy":{backgroundColor:"#001b44"},"bg-dark-blue":{backgroundColor:"#00449e"},"bg-blue":{backgroundColor:"#357edd"},"bg-light-blue":{backgroundColor:"#96ccff"},"bg-lightest-blue":{backgroundColor:"#cdecff"},"bg-washed-blue":{backgroundColor:"#f6fffe"},"bg-washed-green":{backgroundColor:"#e8fdf5"},"bg-washed-yellow":{backgroundColor:"#fffceb"},"bg-washed-red":{backgroundColor:"#ffdfdf"},"bg-inherit":{backgroundColor:"inherit"},"hover-black":{":focus":{color:"#000"},":hover":{color:"#000"}},"hover-near-black":{":focus":{color:"#111"},":hover":{color:"#111"}},"hover-dark-gray":{":focus":{color:"#333"},":hover":{color:"#333"}},"hover-mid-gray":{":focus":{color:"#555"},":hover":{color:"#555"}},"hover-gray":{":focus":{color:"#777"},":hover":{color:"#777"}},"hover-silver":{":focus":{color:"#999"},":hover":{color:"#999"}},"hover-light-silver":{":focus":{color:"#aaa"},":hover":{color:"#aaa"}},"hover-moon-gray":{":focus":{color:"#ccc"},":hover":{color:"#ccc"}},"hover-light-gray":{":focus":{color:"#eee"},":hover":{color:"#eee"}},"hover-near-white":{":focus":{color:"#f4f4f4"},":hover":{color:"#f4f4f4"}},"hover-white":{":focus":{color:"#fff"},":hover":{color:"#fff"}},"hover-black-90":{":focus":{color:"rgba( 0, 0, 0, .9 )"},":hover":{color:"rgba( 0, 0, 0, .9 )"}},"hover-black-80":{":focus":{color:"rgba( 0, 0, 0, .8 )"},":hover":{color:"rgba( 0, 0, 0, .8 )"}},"hover-black-70":{":focus":{color:"rgba( 0, 0, 0, .7 )"},":hover":{color:"rgba( 0, 0, 0, .7 )"}},"hover-black-60":{":focus":{color:"rgba( 0, 0, 0, .6 )"},":hover":{color:"rgba( 0, 0, 0, .6 )"}},"hover-black-50":{":focus":{color:"rgba( 0, 0, 0, .5 )"},":hover":{color:"rgba( 0, 0, 0, .5 )"}},"hover-black-40":{":focus":{color:"rgba( 0, 0, 0, .4 )"},":hover":{color:"rgba( 0, 0, 0, .4 )"}},"hover-black-30":{":focus":{color:"rgba( 0, 0, 0, .3 )"},":hover":{color:"rgba( 0, 0, 0, .3 )"}},"hover-black-20":{":focus":{color:"rgba( 0, 0, 0, .2 )"},":hover":{color:"rgba( 0, 0, 0, .2 )"}},"hover-black-10":{":focus":{color:"rgba( 0, 0, 0, .1 )"},":hover":{color:"rgba( 0, 0, 0, .1 )"}},"hover-white-90":{":focus":{color:"rgba( 255, 255, 255, .9 )"},":hover":{color:"rgba( 255, 255, 255, .9 )"}},"hover-white-80":{":focus":{color:"rgba( 255, 255, 255, .8 )"},":hover":{color:"rgba( 255, 255, 255, .8 )"}},"hover-white-70":{":focus":{color:"rgba( 255, 255, 255, .7 )"},":hover":{color:"rgba( 255, 255, 255, .7 )"}},"hover-white-60":{":focus":{color:"rgba( 255, 255, 255, .6 )"},":hover":{color:"rgba( 255, 255, 255, .6 )"}},"hover-white-50":{":focus":{color:"rgba( 255, 255, 255, .5 )"},":hover":{color:"rgba( 255, 255, 255, .5 )"}},"hover-white-40":{":focus":{color:"rgba( 255, 255, 255, .4 )"},":hover":{color:"rgba( 255, 255, 255, .4 )"}},"hover-white-30":{":focus":{color:"rgba( 255, 255, 255, .3 )"},":hover":{color:"rgba( 255, 255, 255, .3 )"}},"hover-white-20":{":focus":{color:"rgba( 255, 255, 255, .2 )"},":hover":{color:"rgba( 255, 255, 255, .2 )"}},"hover-white-10":{":focus":{color:"rgba( 255, 255, 255, .1 )"},":hover":{color:"rgba( 255, 255, 255, .1 )"}},"hover-inherit":{":focus":{color:"inherit"},":hover":{color:"inherit"}},"hover-bg-black":{":focus":{backgroundColor:"#000"},":hover":{backgroundColor:"#000"}},"hover-bg-near-black":{":focus":{backgroundColor:"#111"},":hover":{backgroundColor:"#111"}},"hover-bg-dark-gray":{":focus":{backgroundColor:"#333"},":hover":{backgroundColor:"#333"}},"hover-bg-mid-gray":{":focus":{backgroundColor:"#555"},":hover":{backgroundColor:"#555"}},"hover-bg-gray":{":focus":{backgroundColor:"#777"},":hover":{backgroundColor:"#777"}},"hover-bg-silver":{":focus":{backgroundColor:"#999"},":hover":{backgroundColor:"#999"}},"hover-bg-light-silver":{":focus":{backgroundColor:"#aaa"},":hover":{backgroundColor:"#aaa"}},"hover-bg-moon-gray":{":focus":{backgroundColor:"#ccc"},":hover":{backgroundColor:"#ccc"}},"hover-bg-light-gray":{":focus":{backgroundColor:"#eee"},":hover":{backgroundColor:"#eee"}},"hover-bg-near-white":{":focus":{backgroundColor:"#f4f4f4"},":hover":{backgroundColor:"#f4f4f4"}},"hover-bg-white":{":focus":{backgroundColor:"#fff"},":hover":{backgroundColor:"#fff"}},"hover-bg-transparent":{":focus":{backgroundColor:"transparent"},":hover":{backgroundColor:"transparent"}},"hover-bg-black-90":{":focus":{backgroundColor:"rgba( 0, 0, 0, .9 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .9 )"}},"hover-bg-black-80":{":focus":{backgroundColor:"rgba( 0, 0, 0, .8 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .8 )"}},"hover-bg-black-70":{":focus":{backgroundColor:"rgba( 0, 0, 0, .7 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .7 )"}},"hover-bg-black-60":{":focus":{backgroundColor:"rgba( 0, 0, 0, .6 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .6 )"}},"hover-bg-black-50":{":focus":{backgroundColor:"rgba( 0, 0, 0, .5 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .5 )"}},"hover-bg-black-40":{":focus":{backgroundColor:"rgba( 0, 0, 0, .4 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .4 )"}},"hover-bg-black-30":{":focus":{backgroundColor:"rgba( 0, 0, 0, .3 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .3 )"}},"hover-bg-black-20":{":focus":{backgroundColor:"rgba( 0, 0, 0, .2 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .2 )"}},"hover-bg-black-10":{":focus":{backgroundColor:"rgba( 0, 0, 0, .1 )"},":hover":{backgroundColor:"rgba( 0, 0, 0, .1 )"}},"hover-bg-white-90":{":focus":{backgroundColor:"rgba( 255, 255, 255, .9 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .9 )"}},"hover-bg-white-80":{":focus":{backgroundColor:"rgba( 255, 255, 255, .8 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .8 )"}},"hover-bg-white-70":{":focus":{backgroundColor:"rgba( 255, 255, 255, .7 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .7 )"}},"hover-bg-white-60":{":focus":{backgroundColor:"rgba( 255, 255, 255, .6 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .6 )"}},"hover-bg-white-50":{":focus":{backgroundColor:"rgba( 255, 255, 255, .5 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .5 )"}},"hover-bg-white-40":{":focus":{backgroundColor:"rgba( 255, 255, 255, .4 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .4 )"}},"hover-bg-white-30":{":focus":{backgroundColor:"rgba( 255, 255, 255, .3 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .3 )"}},"hover-bg-white-20":{":focus":{backgroundColor:"rgba( 255, 255, 255, .2 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .2 )"}},"hover-bg-white-10":{":focus":{backgroundColor:"rgba( 255, 255, 255, .1 )"},":hover":{backgroundColor:"rgba( 255, 255, 255, .1 )"}},"hover-dark-red":{":focus":{color:"#e7040f"},":hover":{color:"#e7040f"}},"hover-red":{":focus":{color:"#ff4136"},":hover":{color:"#ff4136"}},"hover-light-red":{":focus":{color:"#ff725c"},":hover":{color:"#ff725c"}},"hover-orange":{":focus":{color:"#ff6300"},":hover":{color:"#ff6300"}},"hover-gold":{":focus":{color:"#ffb700"},":hover":{color:"#ffb700"}},"hover-yellow":{":focus":{color:"#ffd700"},":hover":{color:"#ffd700"}},"hover-light-yellow":{":focus":{color:"#fbf1a9"},":hover":{color:"#fbf1a9"}},"hover-purple":{":focus":{color:"#5e2ca5"},":hover":{color:"#5e2ca5"}},"hover-light-purple":{":focus":{color:"#a463f2"},":hover":{color:"#a463f2"}},"hover-dark-pink":{":focus":{color:"#d5008f"},":hover":{color:"#d5008f"}},"hover-hot-pink":{":focus":{color:"#ff41b4"},":hover":{color:"#ff41b4"}},"hover-pink":{":focus":{color:"#ff80cc"},":hover":{color:"#ff80cc"}},"hover-light-pink":{":focus":{color:"#ffa3d7"},":hover":{color:"#ffa3d7"}},"hover-dark-green":{":focus":{color:"#137752"},":hover":{color:"#137752"}},"hover-green":{":focus":{color:"#19a974"},":hover":{color:"#19a974"}},"hover-light-green":{":focus":{color:"#9eebcf"},":hover":{color:"#9eebcf"}},"hover-navy":{":focus":{color:"#001b44"},":hover":{color:"#001b44"}},"hover-dark-blue":{":focus":{color:"#00449e"},":hover":{color:"#00449e"}},"hover-blue":{":focus":{color:"#357edd"},":hover":{color:"#357edd"}},"hover-light-blue":{":focus":{color:"#96ccff"},":hover":{color:"#96ccff"}},"hover-lightest-blue":{":focus":{color:"#cdecff"},":hover":{color:"#cdecff"}},"hover-washed-blue":{":focus":{color:"#f6fffe"},":hover":{color:"#f6fffe"}},"hover-washed-green":{":focus":{color:"#e8fdf5"},":hover":{color:"#e8fdf5"}},"hover-washed-yellow":{":focus":{color:"#fffceb"},":hover":{color:"#fffceb"}},"hover-washed-red":{":focus":{color:"#ffdfdf"},":hover":{color:"#ffdfdf"}},"hover-bg-dark-red":{":focus":{backgroundColor:"#e7040f"},":hover":{backgroundColor:"#e7040f"}},"hover-bg-red":{":focus":{backgroundColor:"#ff4136"},":hover":{backgroundColor:"#ff4136"}},"hover-bg-light-red":{":focus":{backgroundColor:"#ff725c"},":hover":{backgroundColor:"#ff725c"}},"hover-bg-orange":{":focus":{backgroundColor:"#ff6300"},":hover":{backgroundColor:"#ff6300"}},"hover-bg-gold":{":focus":{backgroundColor:"#ffb700"},":hover":{backgroundColor:"#ffb700"}},"hover-bg-yellow":{":focus":{backgroundColor:"#ffd700"},":hover":{backgroundColor:"#ffd700"}},"hover-bg-light-yellow":{":focus":{backgroundColor:"#fbf1a9"},":hover":{backgroundColor:"#fbf1a9"}},"hover-bg-purple":{":focus":{backgroundColor:"#5e2ca5"},":hover":{backgroundColor:"#5e2ca5"}},"hover-bg-light-purple":{":focus":{backgroundColor:"#a463f2"},":hover":{backgroundColor:"#a463f2"}},"hover-bg-dark-pink":{":focus":{backgroundColor:"#d5008f"},":hover":{backgroundColor:"#d5008f"}},"hover-bg-hot-pink":{":focus":{backgroundColor:"#ff41b4"},":hover":{backgroundColor:"#ff41b4"}},"hover-bg-pink":{":focus":{backgroundColor:"#ff80cc"},":hover":{backgroundColor:"#ff80cc"}},"hover-bg-light-pink":{":focus":{backgroundColor:"#ffa3d7"},":hover":{backgroundColor:"#ffa3d7"}},"hover-bg-dark-green":{":focus":{backgroundColor:"#137752"},":hover":{backgroundColor:"#137752"}},"hover-bg-green":{":focus":{backgroundColor:"#19a974"},":hover":{backgroundColor:"#19a974"}},"hover-bg-light-green":{":focus":{backgroundColor:"#9eebcf"},":hover":{backgroundColor:"#9eebcf"}},"hover-bg-navy":{":focus":{backgroundColor:"#001b44"},":hover":{backgroundColor:"#001b44"}},"hover-bg-dark-blue":{":focus":{backgroundColor:"#00449e"},":hover":{backgroundColor:"#00449e"}},"hover-bg-blue":{":focus":{backgroundColor:"#357edd"},":hover":{backgroundColor:"#357edd"}},"hover-bg-light-blue":{":focus":{backgroundColor:"#96ccff"},":hover":{backgroundColor:"#96ccff"}},"hover-bg-lightest-blue":{":focus":{backgroundColor:"#cdecff"},":hover":{backgroundColor:"#cdecff"}},"hover-bg-washed-blue":{":focus":{backgroundColor:"#f6fffe"},":hover":{backgroundColor:"#f6fffe"}},"hover-bg-washed-green":{":focus":{backgroundColor:"#e8fdf5"},":hover":{backgroundColor:"#e8fdf5"}},"hover-bg-washed-yellow":{":focus":{backgroundColor:"#fffceb"},":hover":{backgroundColor:"#fffceb"}},"hover-bg-washed-red":{":focus":{backgroundColor:"#ffdfdf"},":hover":{backgroundColor:"#ffdfdf"}},"hover-bg-inherit":{":focus":{backgroundColor:"inherit"},":hover":{backgroundColor:"inherit"}},pa0:{padding:"0"},pa1:{padding:".25rem"},pa2:{padding:".5rem"},pa3:{padding:"1rem"},pa4:{padding:"2rem"},pa5:{padding:"4rem"},pa6:{padding:"8rem"},pa7:{padding:"16rem"},pl0:{paddingLeft:"0"},pl1:{paddingLeft:".25rem"},pl2:{paddingLeft:".5rem"},pl3:{paddingLeft:"1rem"},pl4:{paddingLeft:"2rem"},pl5:{paddingLeft:"4rem"},pl6:{paddingLeft:"8rem"},pl7:{paddingLeft:"16rem"},pr0:{paddingRight:"0"},pr1:{paddingRight:".25rem"},pr2:{paddingRight:".5rem"},pr3:{paddingRight:"1rem"},pr4:{paddingRight:"2rem"},pr5:{paddingRight:"4rem"},pr6:{paddingRight:"8rem"},pr7:{paddingRight:"16rem"},pb0:{paddingBottom:"0"},pb1:{paddingBottom:".25rem"},pb2:{paddingBottom:".5rem"},pb3:{paddingBottom:"1rem"},pb4:{paddingBottom:"2rem"},pb5:{paddingBottom:"4rem"},pb6:{paddingBottom:"8rem"},pb7:{paddingBottom:"16rem"},pt0:{paddingTop:"0"},pt1:{paddingTop:".25rem"},pt2:{paddingTop:".5rem"},pt3:{paddingTop:"1rem"},pt4:{paddingTop:"2rem"},pt5:{paddingTop:"4rem"},pt6:{paddingTop:"8rem"},pt7:{paddingTop:"16rem"},pv0:{paddingTop:"0",paddingBottom:"0"},pv1:{paddingTop:".25rem",paddingBottom:".25rem"},pv2:{paddingTop:".5rem",paddingBottom:".5rem"},pv3:{paddingTop:"1rem",paddingBottom:"1rem"},pv4:{paddingTop:"2rem",paddingBottom:"2rem"},pv5:{paddingTop:"4rem",paddingBottom:"4rem"},pv6:{paddingTop:"8rem",paddingBottom:"8rem"},pv7:{paddingTop:"16rem",paddingBottom:"16rem"},ph0:{paddingLeft:"0",paddingRight:"0"},ph1:{paddingLeft:".25rem",paddingRight:".25rem"},ph2:{paddingLeft:".5rem",paddingRight:".5rem"},ph3:{paddingLeft:"1rem",paddingRight:"1rem"},ph4:{paddingLeft:"2rem",paddingRight:"2rem"},ph5:{paddingLeft:"4rem",paddingRight:"4rem"},ph6:{paddingLeft:"8rem",paddingRight:"8rem"},ph7:{paddingLeft:"16rem",paddingRight:"16rem"},ma0:{margin:"0"},ma1:{margin:".25rem"},ma2:{margin:".5rem"},ma3:{margin:"1rem"},ma4:{margin:"2rem"},ma5:{margin:"4rem"},ma6:{margin:"8rem"},ma7:{margin:"16rem"},ml0:{marginLeft:"0"},ml1:{marginLeft:".25rem"},ml2:{marginLeft:".5rem"},ml3:{marginLeft:"1rem"},ml4:{marginLeft:"2rem"},ml5:{marginLeft:"4rem"},ml6:{marginLeft:"8rem"},ml7:{marginLeft:"16rem"},mr0:{marginRight:"0"},mr1:{marginRight:".25rem"},mr2:{marginRight:".5rem"},mr3:{marginRight:"1rem"},mr4:{marginRight:"2rem"},mr5:{marginRight:"4rem"},mr6:{marginRight:"8rem"},mr7:{marginRight:"16rem"},mb0:{marginBottom:"0"},mb1:{marginBottom:".25rem"},mb2:{marginBottom:".5rem"},mb3:{marginBottom:"1rem"},mb4:{marginBottom:"2rem"},mb5:{marginBottom:"4rem"},mb6:{marginBottom:"8rem"},mb7:{marginBottom:"16rem"},mt0:{marginTop:"0"},mt1:{marginTop:".25rem"},mt2:{marginTop:".5rem"},mt3:{marginTop:"1rem"},mt4:{marginTop:"2rem"},mt5:{marginTop:"4rem"},mt6:{marginTop:"8rem"},mt7:{marginTop:"16rem"},mv0:{marginTop:"0",marginBottom:"0"},mv1:{marginTop:".25rem",marginBottom:".25rem"},mv2:{marginTop:".5rem",marginBottom:".5rem"},mv3:{marginTop:"1rem",marginBottom:"1rem"},mv4:{marginTop:"2rem",marginBottom:"2rem"},mv5:{marginTop:"4rem",marginBottom:"4rem"},mv6:{marginTop:"8rem",marginBottom:"8rem"},mv7:{marginTop:"16rem",marginBottom:"16rem"},mh0:{marginLeft:"0",marginRight:"0"},mh1:{marginLeft:".25rem",marginRight:".25rem"},mh2:{marginLeft:".5rem",marginRight:".5rem"},mh3:{marginLeft:"1rem",marginRight:"1rem"},mh4:{marginLeft:"2rem",marginRight:"2rem"},mh5:{marginLeft:"4rem",marginRight:"4rem"},mh6:{marginLeft:"8rem",marginRight:"8rem"},mh7:{marginLeft:"16rem",marginRight:"16rem"},na1:{margin:"-.25rem"},na2:{margin:"-.5rem"},na3:{margin:"-1rem"},na4:{margin:"-2rem"},na5:{margin:"-4rem"},na6:{margin:"-8rem"},na7:{margin:"-16rem"},nl1:{marginLeft:"-.25rem"},nl2:{marginLeft:"-.5rem"},nl3:{marginLeft:"-1rem"},nl4:{marginLeft:"-2rem"},nl5:{marginLeft:"-4rem"},nl6:{marginLeft:"-8rem"},nl7:{marginLeft:"-16rem"},nr1:{marginRight:"-.25rem"},nr2:{marginRight:"-.5rem"},nr3:{marginRight:"-1rem"},nr4:{marginRight:"-2rem"},nr5:{marginRight:"-4rem"},nr6:{marginRight:"-8rem"},nr7:{marginRight:"-16rem"},nb1:{marginBottom:"-.25rem"},nb2:{marginBottom:"-.5rem"},nb3:{marginBottom:"-1rem"},nb4:{marginBottom:"-2rem"},nb5:{marginBottom:"-4rem"},nb6:{marginBottom:"-8rem"},nb7:{marginBottom:"-16rem"},nt1:{marginTop:"-.25rem"},nt2:{marginTop:"-.5rem"},nt3:{marginTop:"-1rem"},nt4:{marginTop:"-2rem"},nt5:{marginTop:"-4rem"},nt6:{marginTop:"-8rem"},nt7:{marginTop:"-16rem"},collapse:{borderCollapse:"collapse",borderSpacing:"0"},"striped--light-silver":{":nth-child(odd)":{backgroundColor:"#aaa"}},"striped--moon-gray":{":nth-child(odd)":{backgroundColor:"#ccc"}},"striped--light-gray":{":nth-child(odd)":{backgroundColor:"#eee"}},"striped--near-white":{":nth-child(odd)":{backgroundColor:"#f4f4f4"}},"stripe-light":{":nth-child(odd)":{backgroundColor:"rgba( 255, 255, 255, .1 )"}},"stripe-dark":{":nth-child(odd)":{backgroundColor:"rgba( 0, 0, 0, .1 )"}},strike:{textDecoration:"line-through"},underline:{textDecoration:"underline"},"no-underline":{textDecoration:"none"},tl:{textAlign:"left"},tr:{textAlign:"right"},tc:{textAlign:"center"},tj:{textAlign:"justify"},ttc:{textTransform:"capitalize"},ttl:{textTransform:"lowercase"},ttu:{textTransform:"uppercase"},ttn:{textTransform:"none"},"f-6":{fontSize:"6rem"},"f-headline":{fontSize:"6rem"},"f-5":{fontSize:"5rem"},"f-subheadline":{fontSize:"5rem"},f1:{fontSize:"3rem"},f2:{fontSize:"2.25rem"},f3:{fontSize:"1.5rem"},f4:{fontSize:"1.25rem"},f5:{fontSize:"1rem"},f6:{fontSize:".875rem"},f7:{fontSize:".75rem"},measure:{maxWidth:"30em"},"measure-wide":{maxWidth:"34em"},"measure-narrow":{maxWidth:"20em"},indent:{textIndent:"1em",marginTop:"0",marginBottom:"0"},"small-caps":{fontVariant:"small-caps"},truncate:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},"overflow-container":{overflowY:"scroll"},center:{marginRight:"auto",marginLeft:"auto"},"mr-auto":{marginRight:"auto"},"ml-auto":{marginLeft:"auto"},clip:{position:"absolute",clip:"rect( 1px, 1px, 1px, 1px )"},"ws-normal":{whiteSpace:"normal"},nowrap:{whiteSpace:"nowrap"},"v-base":{verticalAlign:"baseline"},"v-mid":{verticalAlign:"middle"},"v-top":{verticalAlign:"top"},"v-btm":{verticalAlign:"bottom"},dim:{":active":{opacity:".8",transition:"opacity .15s ease-out"},":focus":{opacity:".5",transition:"opacity .15s ease-in"},":hover":{opacity:".5",transition:"opacity .15s ease-in"},opacity:"1",transition:"opacity .15s ease-in"},glow:{":focus":{opacity:"1",transition:"opacity .15s ease-in"},":hover":{opacity:"1",transition:"opacity .15s ease-in"},transition:"opacity .15s ease-in"},"underline-hover":{":focus":{textDecoration:"underline"},":hover":{textDecoration:"underline"}},grow:{":active":{webkitTransform:"scale( .90 )",transform:"scale( .90 )"},":focus":{webkitTransform:"scale( 1.05 )",transform:"scale( 1.05 )"},":hover":{webkitTransform:"scale( 1.05 )",transform:"scale( 1.05 )"},mozOsxFontSmoothing:"grayscale",webkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",webkitTransform:"translateZ( 0 )",transform:"translateZ( 0 )",transition:"transform .25s ease-out, -webkit-transform .25s ease-out"},"grow-large":{":active":{webkitTransform:"scale( .95 )",transform:"scale( .95 )"},":focus":{webkitTransform:"scale( 1.2 )",transform:"scale( 1.2 )"},":hover":{webkitTransform:"scale( 1.2 )",transform:"scale( 1.2 )"},mozOsxFontSmoothing:"grayscale",webkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",webkitTransform:"translateZ( 0 )",transform:"translateZ( 0 )",transition:"transform .25s ease-in-out, -webkit-transform .25s ease-in-out"},pointer:{":hover":{cursor:"pointer"}},"shadow-hover":{":focus::after":{opacity:"1"},":hover::after":{opacity:"1"},"::after":{content:"''",boxShadow:"0 0 16px 2px rgba( 0, 0, 0, .2 )",borderRadius:"inherit",opacity:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",zIndex:"-1",transition:"opacity .5s cubic-bezier( .165, .84, .44, 1 )"},cursor:"pointer",position:"relative",transition:"all .5s cubic-bezier( .165, .84, .44, 1 )"},"bg-animate":{":focus":{transition:"background-color .15s ease-in-out"},":hover":{transition:"background-color .15s ease-in-out"},transition:"background-color .15s ease-in-out"},"z-0":{zIndex:"0"},"z-1":{zIndex:"1"},"z-2":{zIndex:"2"},"z-3":{zIndex:"3"},"z-4":{zIndex:"4"},"z-5":{zIndex:"5"},"z-999":{zIndex:"999"},"z-9999":{zIndex:"9999"},"z-max":{zIndex:"2147483647"},"z-inherit":{zIndex:"inherit"},"z-initial":{zIndex:"initial"},"z-unset":{zIndex:"unset"},"debug-grid":{background:"transparent url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAFElEQVR4AWPAC97/9x0eCsAEPgwAVLshdpENIxcAAAAASUVORK5CYII= ) repeat top left"},"debug-grid-16":{background:"transparent url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMklEQVR4AWOgCLz/b0epAa6UGuBOqQHOQHLUgFEDnAbcBZ4UGwDOkiCnkIhdgNgNxAYAiYlD+8sEuo8AAAAASUVORK5CYII= ) repeat top left"},"debug-grid-8-solid":{background:"white url( data:image/gif;base64,R0lGODdhCAAIAPEAAADw/wDx/////wAAACwAAAAACAAIAAACDZQvgaeb/lxbAIKA8y0AOw== ) repeat top left"},"debug-grid-16-solid":{background:"white url( data:image/gif;base64,R0lGODdhEAAQAPEAAADw/wDx/xXy/////ywAAAAAEAAQAAACIZyPKckYDQFsb6ZqD85jZ2+BkwiRFKehhqQCQgDHcgwEBQA7 ) repeat top left"},"aspect-ratio-ns":"aspect-ratio","aspect-ratio--16x9-ns":"aspect-ratio--16x9","aspect-ratio--9x16-ns":"aspect-ratio--9x16","aspect-ratio--4x3-ns":"aspect-ratio--4x3","aspect-ratio--3x4-ns":"aspect-ratio--3x4","aspect-ratio--6x4-ns":"aspect-ratio--6x4","aspect-ratio--4x6-ns":"aspect-ratio--4x6","aspect-ratio--8x5-ns":"aspect-ratio--8x5","aspect-ratio--5x8-ns":"aspect-ratio--5x8","aspect-ratio--7x5-ns":"aspect-ratio--7x5","aspect-ratio--5x7-ns":"aspect-ratio--5x7","aspect-ratio--1x1-ns":"aspect-ratio--1x1","aspect-ratio--object-ns":"aspect-ratio--object","cover-ns":"cover","contain-ns":"contain","bg-center-ns":"bg-center","bg-top-ns":"bg-top","bg-right-ns":"bg-right","bg-bottom-ns":"bg-bottom","bg-left-ns":"bg-left","outline-ns":"outline","outline-transparent-ns":"outline-transparent","outline-0-ns":"outline-0","ba-ns":"ba","bt-ns":"bt","br-ns":"br","bb-ns":"bb","bl-ns":"bl","bn-ns":"bn","br0-ns":"br0","br1-ns":"br1","br2-ns":"br2","br3-ns":"br3","br4-ns":"br4","br-100-ns":"br-100","br-pill-ns":"br-pill","br--bottom-ns":"br--bottom","br--top-ns":"br--top","br--right-ns":"br--right","br--left-ns":"br--left","b--dotted-ns":"b--dotted","b--dashed-ns":"b--dashed","b--solid-ns":"b--solid","b--none-ns":"b--none","bw0-ns":"bw0","bw1-ns":"bw1","bw2-ns":"bw2","bw3-ns":"bw3","bw4-ns":"bw4","bw5-ns":"bw5","bt-0-ns":"bt-0","br-0-ns":"br-0","bb-0-ns":"bb-0","bl-0-ns":"bl-0","shadow-1-ns":"shadow-1","shadow-2-ns":"shadow-2","shadow-3-ns":"shadow-3","shadow-4-ns":"shadow-4","shadow-5-ns":"shadow-5","top-0-ns":"top-0","left-0-ns":"left-0","right-0-ns":"right-0","bottom-0-ns":"bottom-0","top-1-ns":"top-1","left-1-ns":"left-1","right-1-ns":"right-1","bottom-1-ns":"bottom-1","top-2-ns":"top-2","left-2-ns":"left-2","right-2-ns":"right-2","bottom-2-ns":"bottom-2","top--1-ns":"top--1","right--1-ns":"right--1","bottom--1-ns":"bottom--1","left--1-ns":"left--1","top--2-ns":"top--2","right--2-ns":"right--2","bottom--2-ns":"bottom--2","left--2-ns":"left--2","absolute--fill-ns":"absolute--fill","cl-ns":"cl","cr-ns":"cr","cb-ns":"cb","cn-ns":"cn","dn-ns":"dn","di-ns":"di","db-ns":"db","dib-ns":"dib","dit-ns":"dit","dt-ns":"dt","dtc-ns":"dtc","dt-row-ns":"dt-row","dt-row-group-ns":"dt-row-group","dt-column-ns":"dt-column","dt-column-group-ns":"dt-column-group","dt--fixed-ns":"dt--fixed","flex-ns":"flex","inline-flex-ns":"inline-flex","flex-auto-ns":"flex-auto","flex-none-ns":"flex-none","flex-column-ns":"flex-column","flex-row-ns":"flex-row","flex-wrap-ns":"flex-wrap","flex-nowrap-ns":"flex-nowrap","flex-wrap-reverse-ns":"flex-wrap-reverse","flex-column-reverse-ns":"flex-column-reverse","flex-row-reverse-ns":"flex-row-reverse","items-start-ns":"items-start","items-end-ns":"items-end","items-center-ns":"items-center","items-baseline-ns":"items-baseline","items-stretch-ns":"items-stretch","self-start-ns":"self-start","self-end-ns":"self-end","self-center-ns":"self-center","self-baseline-ns":"self-baseline","self-stretch-ns":"self-stretch","justify-start-ns":"justify-start","justify-end-ns":"justify-end","justify-center-ns":"justify-center","justify-between-ns":"justify-between","justify-around-ns":"justify-around","content-start-ns":"content-start","content-end-ns":"content-end","content-center-ns":"content-center","content-between-ns":"content-between","content-around-ns":"content-around","content-stretch-ns":"content-stretch","order-0-ns":"order-0","order-1-ns":"order-1","order-2-ns":"order-2","order-3-ns":"order-3","order-4-ns":"order-4","order-5-ns":"order-5","order-6-ns":"order-6","order-7-ns":"order-7","order-8-ns":"order-8","order-last-ns":"order-last","fl-ns":"fl","fr-ns":"fr","fn-ns":"fn","i-ns":"i","fs-normal-ns":"fs-normal","normal-ns":"normal","b-ns":"b","fw1-ns":"fw1","fw2-ns":"fw2","fw3-ns":"fw3","fw4-ns":"fw4","fw5-ns":"fw5","fw6-ns":"fw6","fw7-ns":"fw7","fw8-ns":"fw8","fw9-ns":"fw9","h1-ns":"h1","h2-ns":"h2","h3-ns":"h3","h4-ns":"h4","h5-ns":"h5","h-25-ns":"h-25","h-50-ns":"h-50","h-75-ns":"h-75","h-100-ns":"h-100","min-h-100-ns":"min-h-100","vh-25-ns":"vh-25","vh-50-ns":"vh-50","vh-75-ns":"vh-75","vh-100-ns":"vh-100","min-vh-100-ns":"min-vh-100","h-auto-ns":"h-auto","h-inherit-ns":"h-inherit","tracked-ns":"tracked","tracked-tight-ns":"tracked-tight","tracked-mega-ns":"tracked-mega","lh-solid-ns":"lh-solid","lh-title-ns":"lh-title","lh-copy-ns":"lh-copy","mw-100-ns":"mw-100","mw1-ns":"mw1","mw2-ns":"mw2","mw3-ns":"mw3","mw4-ns":"mw4","mw5-ns":"mw5","mw6-ns":"mw6","mw7-ns":"mw7","mw8-ns":"mw8","mw9-ns":"mw9","mw-none-ns":"mw-none","w1-ns":"w1","w2-ns":"w2","w3-ns":"w3","w4-ns":"w4","w5-ns":"w5","w-10-ns":"w-10","w-20-ns":"w-20","w-25-ns":"w-25","w-30-ns":"w-30","w-33-ns":"w-33","w-34-ns":"w-34","w-40-ns":"w-40","w-50-ns":"w-50","w-60-ns":"w-60","w-70-ns":"w-70","w-75-ns":"w-75","w-80-ns":"w-80","w-90-ns":"w-90","w-100-ns":"w-100","w-third-ns":"w-third","w-two-thirds-ns":"w-two-thirds","w-auto-ns":"w-auto","overflow-visible-ns":"overflow-visible","overflow-hidden-ns":"overflow-hidden","overflow-scroll-ns":"overflow-scroll","overflow-auto-ns":"overflow-auto","overflow-x-visible-ns":"overflow-x-visible","overflow-x-hidden-ns":"overflow-x-hidden","overflow-x-scroll-ns":"overflow-x-scroll","overflow-x-auto-ns":"overflow-x-auto","overflow-y-visible-ns":"overflow-y-visible","overflow-y-hidden-ns":"overflow-y-hidden","overflow-y-scroll-ns":"overflow-y-scroll","overflow-y-auto-ns":"overflow-y-auto","static-ns":"static","relative-ns":"relative","absolute-ns":"absolute","fixed-ns":"fixed","rotate-45-ns":"rotate-45","rotate-90-ns":"rotate-90","rotate-135-ns":"rotate-135","rotate-180-ns":"rotate-180","rotate-225-ns":"rotate-225","rotate-270-ns":"rotate-270","rotate-315-ns":"rotate-315","pa0-ns":"pa0","pa1-ns":"pa1","pa2-ns":"pa2","pa3-ns":"pa3","pa4-ns":"pa4","pa5-ns":"pa5","pa6-ns":"pa6","pa7-ns":"pa7","pl0-ns":"pl0","pl1-ns":"pl1","pl2-ns":"pl2","pl3-ns":"pl3","pl4-ns":"pl4","pl5-ns":"pl5","pl6-ns":"pl6","pl7-ns":"pl7","pr0-ns":"pr0","pr1-ns":"pr1","pr2-ns":"pr2","pr3-ns":"pr3","pr4-ns":"pr4","pr5-ns":"pr5","pr6-ns":"pr6","pr7-ns":"pr7","pb0-ns":"pb0","pb1-ns":"pb1","pb2-ns":"pb2","pb3-ns":"pb3","pb4-ns":"pb4","pb5-ns":"pb5","pb6-ns":"pb6","pb7-ns":"pb7","pt0-ns":"pt0","pt1-ns":"pt1","pt2-ns":"pt2","pt3-ns":"pt3","pt4-ns":"pt4","pt5-ns":"pt5","pt6-ns":"pt6","pt7-ns":"pt7","pv0-ns":"pv0","pv1-ns":"pv1","pv2-ns":"pv2","pv3-ns":"pv3","pv4-ns":"pv4","pv5-ns":"pv5","pv6-ns":"pv6","pv7-ns":"pv7","ph0-ns":"ph0","ph1-ns":"ph1","ph2-ns":"ph2","ph3-ns":"ph3","ph4-ns":"ph4","ph5-ns":"ph5","ph6-ns":"ph6","ph7-ns":"ph7","ma0-ns":"ma0","ma1-ns":"ma1","ma2-ns":"ma2","ma3-ns":"ma3","ma4-ns":"ma4","ma5-ns":"ma5","ma6-ns":"ma6","ma7-ns":"ma7","ml0-ns":"ml0","ml1-ns":"ml1","ml2-ns":"ml2","ml3-ns":"ml3","ml4-ns":"ml4","ml5-ns":"ml5","ml6-ns":"ml6","ml7-ns":"ml7","mr0-ns":"mr0","mr1-ns":"mr1","mr2-ns":"mr2","mr3-ns":"mr3","mr4-ns":"mr4","mr5-ns":"mr5","mr6-ns":"mr6","mr7-ns":"mr7","mb0-ns":"mb0","mb1-ns":"mb1","mb2-ns":"mb2","mb3-ns":"mb3","mb4-ns":"mb4","mb5-ns":"mb5","mb6-ns":"mb6","mb7-ns":"mb7","mt0-ns":"mt0","mt1-ns":"mt1","mt2-ns":"mt2","mt3-ns":"mt3","mt4-ns":"mt4","mt5-ns":"mt5","mt6-ns":"mt6","mt7-ns":"mt7","mv0-ns":"mv0","mv1-ns":"mv1","mv2-ns":"mv2","mv3-ns":"mv3","mv4-ns":"mv4","mv5-ns":"mv5","mv6-ns":"mv6","mv7-ns":"mv7","mh0-ns":"mh0","mh1-ns":"mh1","mh2-ns":"mh2","mh3-ns":"mh3","mh4-ns":"mh4","mh5-ns":"mh5","mh6-ns":"mh6","mh7-ns":"mh7","na1-ns":"na1","na2-ns":"na2","na3-ns":"na3","na4-ns":"na4","na5-ns":"na5","na6-ns":"na6","na7-ns":"na7","nl1-ns":"nl1","nl2-ns":"nl2","nl3-ns":"nl3","nl4-ns":"nl4","nl5-ns":"nl5","nl6-ns":"nl6","nl7-ns":"nl7","nr1-ns":"nr1","nr2-ns":"nr2","nr3-ns":"nr3","nr4-ns":"nr4","nr5-ns":"nr5","nr6-ns":"nr6","nr7-ns":"nr7","nb1-ns":"nb1","nb2-ns":"nb2","nb3-ns":"nb3","nb4-ns":"nb4","nb5-ns":"nb5","nb6-ns":"nb6","nb7-ns":"nb7","nt1-ns":"nt1","nt2-ns":"nt2","nt3-ns":"nt3","nt4-ns":"nt4","nt5-ns":"nt5","nt6-ns":"nt6","nt7-ns":"nt7","strike-ns":"strike","underline-ns":"underline","no-underline-ns":"no-underline","tl-ns":"tl","tr-ns":"tr","tc-ns":"tc","tj-ns":"tj","ttc-ns":"ttc","ttl-ns":"ttl","ttu-ns":"ttu","ttn-ns":"ttn","f-6-ns":"f-6","f-headline-ns":"f-headline","f-5-ns":"f-5","f-subheadline-ns":"f-subheadline","f1-ns":"f1","f2-ns":"f2","f3-ns":"f3","f4-ns":"f4","f5-ns":"f5","f6-ns":"f6","f7-ns":"f7","measure-ns":"measure","measure-wide-ns":"measure-wide","measure-narrow-ns":"measure-narrow","indent-ns":"indent","small-caps-ns":"small-caps","truncate-ns":"truncate","center-ns":"center","mr-auto-ns":"mr-auto","ml-auto-ns":"ml-auto","clip-ns":"clip","ws-normal-ns":"ws-normal","nowrap-ns":"nowrap","pre-ns":{"@media screen and (min-width: 30em)":{whiteSpace:"pre"}},"v-base-ns":"v-base","v-mid-ns":"v-mid","v-top-ns":"v-top","v-btm-ns":"v-btm","aspect-ratio-m":"aspect-ratio","aspect-ratio--16x9-m":"aspect-ratio--16x9","aspect-ratio--9x16-m":"aspect-ratio--9x16","aspect-ratio--4x3-m":"aspect-ratio--4x3","aspect-ratio--3x4-m":"aspect-ratio--3x4","aspect-ratio--6x4-m":"aspect-ratio--6x4","aspect-ratio--4x6-m":"aspect-ratio--4x6","aspect-ratio--8x5-m":"aspect-ratio--8x5","aspect-ratio--5x8-m":"aspect-ratio--5x8","aspect-ratio--7x5-m":"aspect-ratio--7x5","aspect-ratio--5x7-m":"aspect-ratio--5x7","aspect-ratio--1x1-m":"aspect-ratio--1x1","aspect-ratio--object-m":"aspect-ratio--object","cover-m":"cover","contain-m":"contain","bg-center-m":"bg-center","bg-top-m":"bg-top","bg-right-m":"bg-right","bg-bottom-m":"bg-bottom","bg-left-m":"bg-left","outline-m":"outline","outline-transparent-m":"outline-transparent","outline-0-m":"outline-0","ba-m":"ba","bt-m":"bt","br-m":"br","bb-m":"bb","bl-m":"bl","bn-m":"bn","br0-m":"br0","br1-m":"br1","br2-m":"br2","br3-m":"br3","br4-m":"br4","br-100-m":"br-100","br-pill-m":"br-pill","br--bottom-m":"br--bottom","br--top-m":"br--top","br--right-m":"br--right","br--left-m":"br--left","b--dotted-m":"b--dotted","b--dashed-m":"b--dashed","b--solid-m":"b--solid","b--none-m":"b--none","bw0-m":"bw0","bw1-m":"bw1","bw2-m":"bw2","bw3-m":"bw3","bw4-m":"bw4","bw5-m":"bw5","bt-0-m":"bt-0","br-0-m":"br-0","bb-0-m":"bb-0","bl-0-m":"bl-0","shadow-1-m":"shadow-1","shadow-2-m":"shadow-2","shadow-3-m":"shadow-3","shadow-4-m":"shadow-4","shadow-5-m":"shadow-5","top-0-m":"top-0","left-0-m":"left-0","right-0-m":"right-0","bottom-0-m":"bottom-0","top-1-m":"top-1","left-1-m":"left-1","right-1-m":"right-1","bottom-1-m":"bottom-1","top-2-m":"top-2","left-2-m":"left-2","right-2-m":"right-2","bottom-2-m":"bottom-2","top--1-m":"top--1","right--1-m":"right--1","bottom--1-m":"bottom--1","left--1-m":"left--1","top--2-m":"top--2","right--2-m":"right--2","bottom--2-m":"bottom--2","left--2-m":"left--2","absolute--fill-m":"absolute--fill","cl-m":"cl","cr-m":"cr","cb-m":"cb","cn-m":"cn","dn-m":"dn","di-m":"di","db-m":"db","dib-m":"dib","dit-m":"dit","dt-m":"dt","dtc-m":"dtc","dt-row-m":"dt-row","dt-row-group-m":"dt-row-group","dt-column-m":"dt-column","dt-column-group-m":"dt-column-group","dt--fixed-m":"dt--fixed","flex-m":"flex","inline-flex-m":"inline-flex","flex-auto-m":"flex-auto","flex-none-m":"flex-none","flex-column-m":"flex-column","flex-row-m":"flex-row","flex-wrap-m":"flex-wrap","flex-nowrap-m":"flex-nowrap","flex-wrap-reverse-m":"flex-wrap-reverse","flex-column-reverse-m":"flex-column-reverse","flex-row-reverse-m":"flex-row-reverse","items-start-m":"items-start","items-end-m":"items-end","items-center-m":"items-center","items-baseline-m":"items-baseline","items-stretch-m":"items-stretch","self-start-m":"self-start","self-end-m":"self-end","self-center-m":"self-center","self-baseline-m":"self-baseline","self-stretch-m":"self-stretch","justify-start-m":"justify-start","justify-end-m":"justify-end","justify-center-m":"justify-center","justify-between-m":"justify-between","justify-around-m":"justify-around","content-start-m":"content-start","content-end-m":"content-end","content-center-m":"content-center","content-between-m":"content-between","content-around-m":"content-around","content-stretch-m":"content-stretch","order-0-m":"order-0","order-1-m":"order-1","order-2-m":"order-2","order-3-m":"order-3","order-4-m":"order-4","order-5-m":"order-5","order-6-m":"order-6","order-7-m":"order-7","order-8-m":"order-8","order-last-m":"order-last","fl-m":"fl","fr-m":"fr","fn-m":"fn","i-m":"i","fs-normal-m":"fs-normal","normal-m":"normal","b-m":"b","fw1-m":"fw1","fw2-m":"fw2","fw3-m":"fw3","fw4-m":"fw4","fw5-m":"fw5","fw6-m":"fw6","fw7-m":"fw7","fw8-m":"fw8","fw9-m":"fw9","h1-m":"h1","h2-m":"h2","h3-m":"h3","h4-m":"h4","h5-m":"h5","h-25-m":"h-25","h-50-m":"h-50","h-75-m":"h-75","h-100-m":"h-100","min-h-100-m":"min-h-100","vh-25-m":"vh-25","vh-50-m":"vh-50","vh-75-m":"vh-75","vh-100-m":"vh-100","min-vh-100-m":"min-vh-100","h-auto-m":"h-auto","h-inherit-m":"h-inherit","tracked-m":"tracked","tracked-tight-m":"tracked-tight","tracked-mega-m":"tracked-mega","lh-solid-m":"lh-solid","lh-title-m":"lh-title","lh-copy-m":"lh-copy","mw-100-m":"mw-100","mw1-m":"mw1","mw2-m":"mw2","mw3-m":"mw3","mw4-m":"mw4","mw5-m":"mw5","mw6-m":"mw6","mw7-m":"mw7","mw8-m":"mw8","mw9-m":"mw9","mw-none-m":"mw-none","w1-m":"w1","w2-m":"w2","w3-m":"w3","w4-m":"w4","w5-m":"w5","w-10-m":"w-10","w-20-m":"w-20","w-25-m":"w-25","w-30-m":"w-30","w-33-m":"w-33","w-34-m":"w-34","w-40-m":"w-40","w-50-m":"w-50","w-60-m":"w-60","w-70-m":"w-70","w-75-m":"w-75","w-80-m":"w-80","w-90-m":"w-90","w-100-m":"w-100","w-third-m":"w-third","w-two-thirds-m":"w-two-thirds","w-auto-m":"w-auto","overflow-visible-m":"overflow-visible","overflow-hidden-m":"overflow-hidden","overflow-scroll-m":"overflow-scroll","overflow-auto-m":"overflow-auto","overflow-x-visible-m":"overflow-x-visible","overflow-x-hidden-m":"overflow-x-hidden","overflow-x-scroll-m":"overflow-x-scroll","overflow-x-auto-m":"overflow-x-auto","overflow-y-visible-m":"overflow-y-visible","overflow-y-hidden-m":"overflow-y-hidden","overflow-y-scroll-m":"overflow-y-scroll","overflow-y-auto-m":"overflow-y-auto","static-m":"static","relative-m":"relative","absolute-m":"absolute","fixed-m":"fixed","rotate-45-m":"rotate-45","rotate-90-m":"rotate-90","rotate-135-m":"rotate-135","rotate-180-m":"rotate-180","rotate-225-m":"rotate-225","rotate-270-m":"rotate-270","rotate-315-m":"rotate-315","pa0-m":"pa0","pa1-m":"pa1","pa2-m":"pa2","pa3-m":"pa3","pa4-m":"pa4","pa5-m":"pa5","pa6-m":"pa6","pa7-m":"pa7","pl0-m":"pl0","pl1-m":"pl1","pl2-m":"pl2","pl3-m":"pl3","pl4-m":"pl4","pl5-m":"pl5","pl6-m":"pl6","pl7-m":"pl7","pr0-m":"pr0","pr1-m":"pr1","pr2-m":"pr2","pr3-m":"pr3","pr4-m":"pr4","pr5-m":"pr5","pr6-m":"pr6","pr7-m":"pr7","pb0-m":"pb0","pb1-m":"pb1","pb2-m":"pb2","pb3-m":"pb3","pb4-m":"pb4","pb5-m":"pb5","pb6-m":"pb6","pb7-m":"pb7","pt0-m":"pt0","pt1-m":"pt1","pt2-m":"pt2","pt3-m":"pt3","pt4-m":"pt4","pt5-m":"pt5","pt6-m":"pt6","pt7-m":"pt7","pv0-m":"pv0","pv1-m":"pv1","pv2-m":"pv2","pv3-m":"pv3","pv4-m":"pv4","pv5-m":"pv5","pv6-m":"pv6","pv7-m":"pv7","ph0-m":"ph0","ph1-m":"ph1","ph2-m":"ph2","ph3-m":"ph3","ph4-m":"ph4","ph5-m":"ph5","ph6-m":"ph6","ph7-m":"ph7","ma0-m":"ma0","ma1-m":"ma1","ma2-m":"ma2","ma3-m":"ma3","ma4-m":"ma4","ma5-m":"ma5","ma6-m":"ma6","ma7-m":"ma7","ml0-m":"ml0","ml1-m":"ml1","ml2-m":"ml2","ml3-m":"ml3","ml4-m":"ml4","ml5-m":"ml5","ml6-m":"ml6","ml7-m":"ml7","mr0-m":"mr0","mr1-m":"mr1","mr2-m":"mr2","mr3-m":"mr3","mr4-m":"mr4","mr5-m":"mr5","mr6-m":"mr6","mr7-m":"mr7","mb0-m":"mb0","mb1-m":"mb1","mb2-m":"mb2","mb3-m":"mb3","mb4-m":"mb4","mb5-m":"mb5","mb6-m":"mb6","mb7-m":"mb7","mt0-m":"mt0","mt1-m":"mt1","mt2-m":"mt2","mt3-m":"mt3","mt4-m":"mt4","mt5-m":"mt5","mt6-m":"mt6","mt7-m":"mt7","mv0-m":"mv0","mv1-m":"mv1","mv2-m":"mv2","mv3-m":"mv3","mv4-m":"mv4","mv5-m":"mv5","mv6-m":"mv6","mv7-m":"mv7","mh0-m":"mh0","mh1-m":"mh1","mh2-m":"mh2","mh3-m":"mh3","mh4-m":"mh4","mh5-m":"mh5","mh6-m":"mh6","mh7-m":"mh7","na1-m":"na1","na2-m":"na2","na3-m":"na3","na4-m":"na4","na5-m":"na5","na6-m":"na6","na7-m":"na7","nl1-m":"nl1","nl2-m":"nl2","nl3-m":"nl3","nl4-m":"nl4","nl5-m":"nl5","nl6-m":"nl6","nl7-m":"nl7","nr1-m":"nr1","nr2-m":"nr2","nr3-m":"nr3","nr4-m":"nr4","nr5-m":"nr5","nr6-m":"nr6","nr7-m":"nr7","nb1-m":"nb1","nb2-m":"nb2","nb3-m":"nb3","nb4-m":"nb4","nb5-m":"nb5","nb6-m":"nb6","nb7-m":"nb7","nt1-m":"nt1","nt2-m":"nt2","nt3-m":"nt3","nt4-m":"nt4","nt5-m":"nt5","nt6-m":"nt6","nt7-m":"nt7","strike-m":"strike","underline-m":"underline","no-underline-m":"no-underline","tl-m":"tl","tr-m":"tr","tc-m":"tc","tj-m":"tj","ttc-m":"ttc","ttl-m":"ttl","ttu-m":"ttu","ttn-m":"ttn","f-6-m":"f-6","f-headline-m":"f-headline","f-5-m":"f-5","f-subheadline-m":"f-subheadline","f1-m":"f1","f2-m":"f2","f3-m":"f3","f4-m":"f4","f5-m":"f5","f6-m":"f6","f7-m":"f7","measure-m":"measure","measure-wide-m":"measure-wide","measure-narrow-m":"measure-narrow","indent-m":"indent","small-caps-m":"small-caps","truncate-m":"truncate","center-m":"center","mr-auto-m":"mr-auto","ml-auto-m":"ml-auto","clip-m":"clip","ws-normal-m":"ws-normal","nowrap-m":"nowrap","pre-m":{"@media screen and (min-width: 30em) and (max-width: 60em)":{whiteSpace:"pre"}},"v-base-m":"v-base","v-mid-m":"v-mid","v-top-m":"v-top","v-btm-m":"v-btm","aspect-ratio-l":"aspect-ratio","aspect-ratio--16x9-l":"aspect-ratio--16x9","aspect-ratio--9x16-l":"aspect-ratio--9x16","aspect-ratio--4x3-l":"aspect-ratio--4x3","aspect-ratio--3x4-l":"aspect-ratio--3x4","aspect-ratio--6x4-l":"aspect-ratio--6x4","aspect-ratio--4x6-l":"aspect-ratio--4x6","aspect-ratio--8x5-l":"aspect-ratio--8x5","aspect-ratio--5x8-l":"aspect-ratio--5x8","aspect-ratio--7x5-l":"aspect-ratio--7x5","aspect-ratio--5x7-l":"aspect-ratio--5x7","aspect-ratio--1x1-l":"aspect-ratio--1x1","aspect-ratio--object-l":"aspect-ratio--object","cover-l":"cover","contain-l":"contain","bg-center-l":"bg-center","bg-top-l":"bg-top","bg-right-l":"bg-right","bg-bottom-l":"bg-bottom","bg-left-l":"bg-left","outline-l":"outline","outline-transparent-l":"outline-transparent","outline-0-l":"outline-0","ba-l":"ba","bt-l":"bt","br-l":"br","bb-l":"bb","bl-l":"bl","bn-l":"bn","br0-l":"br0","br1-l":"br1","br2-l":"br2","br3-l":"br3","br4-l":"br4","br-100-l":"br-100","br-pill-l":"br-pill","br--bottom-l":"br--bottom","br--top-l":"br--top","br--right-l":"br--right","br--left-l":"br--left","b--dotted-l":"b--dotted","b--dashed-l":"b--dashed","b--solid-l":"b--solid","b--none-l":"b--none","bw0-l":"bw0","bw1-l":"bw1","bw2-l":"bw2","bw3-l":"bw3","bw4-l":"bw4","bw5-l":"bw5","bt-0-l":"bt-0","br-0-l":"br-0","bb-0-l":"bb-0","bl-0-l":"bl-0","shadow-1-l":"shadow-1","shadow-2-l":"shadow-2","shadow-3-l":"shadow-3","shadow-4-l":"shadow-4","shadow-5-l":"shadow-5","top-0-l":"top-0","left-0-l":"left-0","right-0-l":"right-0","bottom-0-l":"bottom-0","top-1-l":"top-1","left-1-l":"left-1","right-1-l":"right-1","bottom-1-l":"bottom-1","top-2-l":"top-2","left-2-l":"left-2","right-2-l":"right-2","bottom-2-l":"bottom-2","top--1-l":"top--1","right--1-l":"right--1","bottom--1-l":"bottom--1","left--1-l":"left--1","top--2-l":"top--2","right--2-l":"right--2","bottom--2-l":"bottom--2","left--2-l":"left--2","absolute--fill-l":"absolute--fill","cl-l":"cl","cr-l":"cr","cb-l":"cb","cn-l":"cn","dn-l":"dn","di-l":"di","db-l":"db","dib-l":"dib","dit-l":"dit","dt-l":"dt","dtc-l":"dtc","dt-row-l":"dt-row","dt-row-group-l":"dt-row-group","dt-column-l":"dt-column","dt-column-group-l":"dt-column-group","dt--fixed-l":"dt--fixed","flex-l":"flex","inline-flex-l":"inline-flex","flex-auto-l":"flex-auto","flex-none-l":"flex-none","flex-column-l":"flex-column","flex-row-l":"flex-row","flex-wrap-l":"flex-wrap","flex-nowrap-l":"flex-nowrap","flex-wrap-reverse-l":"flex-wrap-reverse","flex-column-reverse-l":"flex-column-reverse","flex-row-reverse-l":"flex-row-reverse","items-start-l":"items-start","items-end-l":"items-end","items-center-l":"items-center","items-baseline-l":"items-baseline","items-stretch-l":"items-stretch","self-start-l":"self-start","self-end-l":"self-end","self-center-l":"self-center","self-baseline-l":"self-baseline","self-stretch-l":"self-stretch","justify-start-l":"justify-start","justify-end-l":"justify-end","justify-center-l":"justify-center","justify-between-l":"justify-between","justify-around-l":"justify-around","content-start-l":"content-start","content-end-l":"content-end","content-center-l":"content-center","content-between-l":"content-between","content-around-l":"content-around","content-stretch-l":"content-stretch","order-0-l":"order-0","order-1-l":"order-1","order-2-l":"order-2","order-3-l":"order-3","order-4-l":"order-4","order-5-l":"order-5","order-6-l":"order-6","order-7-l":"order-7","order-8-l":"order-8","order-last-l":"order-last","fl-l":"fl","fr-l":"fr","fn-l":"fn","i-l":"i","fs-normal-l":"fs-normal","normal-l":"normal","b-l":"b","fw1-l":"fw1","fw2-l":"fw2","fw3-l":"fw3","fw4-l":"fw4","fw5-l":"fw5","fw6-l":"fw6","fw7-l":"fw7","fw8-l":"fw8","fw9-l":"fw9","h1-l":"h1","h2-l":"h2","h3-l":"h3","h4-l":"h4","h5-l":"h5","h-25-l":"h-25","h-50-l":"h-50","h-75-l":"h-75","h-100-l":"h-100","min-h-100-l":"min-h-100","vh-25-l":"vh-25","vh-50-l":"vh-50","vh-75-l":"vh-75","vh-100-l":"vh-100","min-vh-100-l":"min-vh-100","h-auto-l":"h-auto","h-inherit-l":"h-inherit","tracked-l":"tracked","tracked-tight-l":"tracked-tight","tracked-mega-l":"tracked-mega","lh-solid-l":"lh-solid","lh-title-l":"lh-title","lh-copy-l":"lh-copy","mw-100-l":"mw-100","mw1-l":"mw1","mw2-l":"mw2","mw3-l":"mw3","mw4-l":"mw4","mw5-l":"mw5","mw6-l":"mw6","mw7-l":"mw7","mw8-l":"mw8","mw9-l":"mw9","mw-none-l":"mw-none","w1-l":"w1","w2-l":"w2","w3-l":"w3","w4-l":"w4","w5-l":"w5","w-10-l":"w-10","w-20-l":"w-20","w-25-l":"w-25","w-30-l":"w-30","w-33-l":"w-33","w-34-l":"w-34","w-40-l":"w-40","w-50-l":"w-50","w-60-l":"w-60","w-70-l":"w-70","w-75-l":"w-75","w-80-l":"w-80","w-90-l":"w-90","w-100-l":"w-100","w-third-l":"w-third","w-two-thirds-l":"w-two-thirds","w-auto-l":"w-auto","overflow-visible-l":"overflow-visible","overflow-hidden-l":"overflow-hidden","overflow-scroll-l":"overflow-scroll","overflow-auto-l":"overflow-auto","overflow-x-visible-l":"overflow-x-visible","overflow-x-hidden-l":"overflow-x-hidden","overflow-x-scroll-l":"overflow-x-scroll","overflow-x-auto-l":"overflow-x-auto","overflow-y-visible-l":"overflow-y-visible","overflow-y-hidden-l":"overflow-y-hidden","overflow-y-scroll-l":"overflow-y-scroll","overflow-y-auto-l":"overflow-y-auto","static-l":"static","relative-l":"relative","absolute-l":"absolute","fixed-l":"fixed","rotate-45-l":"rotate-45","rotate-90-l":"rotate-90","rotate-135-l":"rotate-135","rotate-180-l":"rotate-180","rotate-225-l":"rotate-225","rotate-270-l":"rotate-270","rotate-315-l":"rotate-315","pa0-l":"pa0","pa1-l":"pa1","pa2-l":"pa2","pa3-l":"pa3","pa4-l":"pa4","pa5-l":"pa5","pa6-l":"pa6","pa7-l":"pa7","pl0-l":"pl0","pl1-l":"pl1","pl2-l":"pl2","pl3-l":"pl3","pl4-l":"pl4","pl5-l":"pl5","pl6-l":"pl6","pl7-l":"pl7","pr0-l":"pr0","pr1-l":"pr1","pr2-l":"pr2","pr3-l":"pr3","pr4-l":"pr4","pr5-l":"pr5","pr6-l":"pr6","pr7-l":"pr7","pb0-l":"pb0","pb1-l":"pb1","pb2-l":"pb2","pb3-l":"pb3","pb4-l":"pb4","pb5-l":"pb5","pb6-l":"pb6","pb7-l":"pb7","pt0-l":"pt0","pt1-l":"pt1","pt2-l":"pt2","pt3-l":"pt3","pt4-l":"pt4","pt5-l":"pt5","pt6-l":"pt6","pt7-l":"pt7","pv0-l":"pv0","pv1-l":"pv1","pv2-l":"pv2","pv3-l":"pv3","pv4-l":"pv4","pv5-l":"pv5","pv6-l":"pv6","pv7-l":"pv7","ph0-l":"ph0","ph1-l":"ph1","ph2-l":"ph2","ph3-l":"ph3","ph4-l":"ph4","ph5-l":"ph5","ph6-l":"ph6","ph7-l":"ph7","ma0-l":"ma0","ma1-l":"ma1","ma2-l":"ma2","ma3-l":"ma3","ma4-l":"ma4","ma5-l":"ma5","ma6-l":"ma6","ma7-l":"ma7","ml0-l":"ml0","ml1-l":"ml1","ml2-l":"ml2","ml3-l":"ml3","ml4-l":"ml4","ml5-l":"ml5","ml6-l":"ml6","ml7-l":"ml7","mr0-l":"mr0","mr1-l":"mr1","mr2-l":"mr2","mr3-l":"mr3","mr4-l":"mr4","mr5-l":"mr5","mr6-l":"mr6","mr7-l":"mr7","mb0-l":"mb0","mb1-l":"mb1","mb2-l":"mb2","mb3-l":"mb3","mb4-l":"mb4","mb5-l":"mb5","mb6-l":"mb6","mb7-l":"mb7","mt0-l":"mt0","mt1-l":"mt1","mt2-l":"mt2","mt3-l":"mt3","mt4-l":"mt4","mt5-l":"mt5","mt6-l":"mt6","mt7-l":"mt7","mv0-l":"mv0","mv1-l":"mv1","mv2-l":"mv2","mv3-l":"mv3","mv4-l":"mv4","mv5-l":"mv5","mv6-l":"mv6","mv7-l":"mv7","mh0-l":"mh0","mh1-l":"mh1","mh2-l":"mh2","mh3-l":"mh3","mh4-l":"mh4","mh5-l":"mh5","mh6-l":"mh6","mh7-l":"mh7","na1-l":"na1","na2-l":"na2","na3-l":"na3","na4-l":"na4","na5-l":"na5","na6-l":"na6","na7-l":"na7","nl1-l":"nl1","nl2-l":"nl2","nl3-l":"nl3","nl4-l":"nl4","nl5-l":"nl5","nl6-l":"nl6","nl7-l":"nl7","nr1-l":"nr1","nr2-l":"nr2","nr3-l":"nr3","nr4-l":"nr4","nr5-l":"nr5","nr6-l":"nr6","nr7-l":"nr7","nb1-l":"nb1","nb2-l":"nb2","nb3-l":"nb3","nb4-l":"nb4","nb5-l":"nb5","nb6-l":"nb6","nb7-l":"nb7","nt1-l":"nt1","nt2-l":"nt2","nt3-l":"nt3","nt4-l":"nt4","nt5-l":"nt5","nt6-l":"nt6","nt7-l":"nt7","strike-l":"strike","underline-l":"underline","no-underline-l":"no-underline","tl-l":"tl","tr-l":"tr","tc-l":"tc","tj-l":"tj","ttc-l":"ttc","ttl-l":"ttl","ttu-l":"ttu","ttn-l":"ttn","f-6-l":"f-6","f-headline-l":"f-headline","f-5-l":"f-5","f-subheadline-l":"f-subheadline","f1-l":"f1","f2-l":"f2","f3-l":"f3","f4-l":"f4","f5-l":"f5","f6-l":"f6","f7-l":"f7","measure-l":"measure","measure-wide-l":"measure-wide","measure-narrow-l":"measure-narrow","indent-l":"indent","small-caps-l":"small-caps","truncate-l":"truncate","center-l":"center","mr-auto-l":"mr-auto","ml-auto-l":"ml-auto","clip-l":"clip","ws-normal-l":"ws-normal","nowrap-l":"nowrap","pre-l":{"@media screen and (min-width: 60em)":{whiteSpace:"pre"}},"v-base-l":"v-base","v-mid-l":"v-mid","v-top-l":"v-top","v-btm-l":"v-btm",ns:"@media screen and (min-width: 30em)",m:"@media screen and (min-width: 30em) and (max-width: 60em)",l:"@media screen and (min-width: 60em)"}},function(t,e,n){var r=n(302),i=n(550),o=n(94);t.exports=function(t){return o(t)?r(t,!0):i(t)}},function(t,e){t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},function(t,e,n){var r=n(301)(Object.getPrototypeOf,Object);t.exports=r},function(t,e,n){var r=n(74),i=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},function(t,e,n){var r=n(190),i=n(113);t.exports=function(t,e,n){(void 0===n||i(t[e],n))&&(void 0!==n||e in t)||r(t,e,n)}},function(t,e,n){var r=n(566)();t.exports=r},function(t,e,n){var r=n(567),i=n(565)(r);t.exports=i},function(t,e,n){var r=n(37),i=n(194),o=n(578),a=n(192);t.exports=function(t,e){return r(t)?t:i(t,e)?[t]:o(a(t))}},function(t,e,n){var r=n(297),i=n(137);t.exports=function(t,e){for(var n=0,o=(e=r(e,t)).length;null!=t&&n<o;)t=t[i(e[n++])];return n&&n==o?t:void 0}},function(t,e){t.exports=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}}},function(t,e,n){var r=n(63);t.exports=function(t){return t==t&&!r(t)}},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(594),i=n(138),o=n(37),a=n(199),s=n(198),u=n(197),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=o(t),l=!n&&i(t),f=!n&&!l&&a(t),d=!n&&!l&&!f&&u(t),h=n||l||f||d,p=h?r(t.length,String):[],m=p.length;for(var g in t)!e&&!c.call(t,g)||h&&("length"==g||f&&("offset"==g||"parent"==g)||d&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,m))||p.push(g);return p}},function(t,e){t.exports=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}},function(t,e,n){var r=n(53).Uint8Array;t.exports=r},function(t,e,n){var r=n(608),i=n(605),o=n(604);t.exports=function(t,e,n,a,s,u){var c=1&n,l=t.length,f=e.length;if(l!=f&&!(c&&f>l))return!1;var d=u.get(t);if(d&&u.get(e))return d==e;var h=-1,p=!0,m=2&n?new r:void 0;for(u.set(t,e),u.set(e,t);++h<l;){var g=t[h],v=e[h];if(a)var b=c?a(v,g,h,e,t,u):a(g,v,h,t,e,u);if(void 0!==b){if(b)continue;p=!1;break}if(m){if(!i(e,function(t,e){if(!o(m,e)&&(g===t||s(g,t,n,a,u)))return m.push(e)})){p=!1;break}}else if(g!==v&&!s(g,v,n,a,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},function(t,e,n){var r=n(609),i=n(73);t.exports=function t(e,n,o,a,s){return e===n||(null==e||null==n||!i(e)&&!i(n)?e!=e&&n!=n:r(e,n,o,a,t,s))}},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(27))},function(t,e,n){var r=n(639),i=n(580),o=n(191),a=n(37),s=n(571);t.exports=function(t){return"function"==typeof t?t:null==t?o:"object"==typeof t?a(t)?i(t[0],t[1]):r(t):s(t)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}},function(t,e,n){var r=n(310),i=n(309),o=n(568),a=n(37);t.exports=function(t,e){return(a(t)?r:o)(t,i(e,3))}},function(t,e,n){"use strict";e.hasClass=function(t){return/^\.\S+/.test(t)},e.isClassSelector=function(t){return/^\.[^.# ]+$/.test(t)};var r=/^\.?(.*)-([nsml]{1,2})$/;e.getAtRuleSize=function(t){return t.replace(r,"$2")},e.stripAtRuleSize=function(t){return t.replace(r,"$1")},e.getPseudos=function(t){return t.replace(/^[^:]*(.*)$/,"$1")}},function(t,e,n){"use strict";var r=n(312),i=n(311),o=n(564),a=n(289);t.exports=function(t){var e;return e="string"==typeof t?t.split(" "):t,i(e,function(t){var e=a[t];if("string"==typeof e){var n=e;(e={})[a[r.getAtRuleSize(t)]]=a[n]}return e||(console.error(t+" is not in the list of available Tachyons classes"),null)}).reduce(function(t,e){return o(t,e)},{})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},t.exports=e.default},function(t,e,n){"use strict";var r=n(662);t.exports=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.processStyleName=void 0,e.createMarkupForStyles=function(t,e){var n="";for(var i in t){var o=0===i.indexOf("--");if(t.hasOwnProperty(i)&&"label"!==i){var a=t[i];null!=a&&(o?n+=i+":"+a+";":(n+=s(i)+":",n+=(0,r.default)(i,a,e)+";"))}}return n||null},a(n(666));var r=a(n(664)),i=a(n(661)),o=a(n(659));function a(t){return t&&t.__esModule?t:{default:t}}a(n(315));var s=e.processStyleName=(0,o.default)(i.default)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(668);let i;const o="Visor",a="tfjs-visor-container";e.visor=function(){if("undefined"==typeof document)throw new Error("No document defined. This library needs a browser/dom to work");if(document.getElementById(a)&&null!=i)return i;let t,e=document.getElementById(a);function n(e,n){let i;return t=r.VisorComponent.render(e,t,{ref:t=>i=t,surfaceList:Array.from(n.values())}),i}null==e&&((e=document.createElement("div")).id=a,document.body.appendChild(e));const o=new Map,u=n(e,o);return i=new s(u,e,o,n)};class s{constructor(t,e,n,r){this.visorComponent=t,this.el=e,this.surfaceList=n,this.renderVisor=r}surface(t){const{name:e}=t,n=null==t.tab?o:t.tab;if(null==e||!("string"==typeof e||e instanceof String))throw new Error("You must pass a config object with a 'name' property to create or retrieve a surface");const r=Object.assign({},t,{tab:n}),i=`${e}-${n}`;return this.surfaceList.has(i)||this.surfaceList.set(i,r),this.renderVisor(this.el,this.surfaceList),this.visorComponent.getSurface(e,n)}isFullscreen(){return this.visorComponent.isFullscreen()}isOpen(){return this.visorComponent.isOpen()}close(){return this.visorComponent.close()}open(){return this.visorComponent.open()}toggle(){return this.visorComponent.toggle()}toggleFullScreen(){return this.visorComponent.toggleFullScreen()}bindKeys(){return this.visorComponent.bindKeys()}unbindKeys(){return this.visorComponent.unbindKeys()}setActiveTab(t){if(!this.visorComponent.state.tabs.has(t))throw new Error(`Tab '${t}' does not exist`);this.visorComponent.setState({activeTab:t})}}e.Visor=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isSurfaceInfo=function(t){return null!=t.name},e.isSurface=function(t){return t.drawArea instanceof HTMLElement}},function(t){t.exports={a:"4.4.0"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(671),i=n(520),o=n(519),a=n(189),s=n(285),u=n(518),c=n(135),l=n(517),f=n(516),d=n(515),h=n(514),p=n(136),m={barchart:r.barchart,table:c.table,histogram:a.histogram,linechart:s.linechart,scatterplot:u.scatterplot,confusionMatrix:i.confusionMatrix,heatmap:o.heatmap};e.render=m;const g={accuracy:p.accuracy,perClassAccuracy:p.perClassAccuracy,confusionMatrix:p.confusionMatrix};e.metrics=g;const v={history:l.history,fitCallbacks:l.fitCallbacks,perClassAccuracy:d.showPerClassAccuracy,valuesDistribution:h.valuesDistribution,layer:f.layer,modelSummary:f.modelSummary};e.show=v;var b=n(317);e.visor=b.visor,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(318))},function(t,e,n){var r=n(24),i=n(7).Buffer;t.exports=function(t,e){return i.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},function(t,e){t.exports=function(t,e){for(var n=t.length,r=-1;++r<n;)t[r]^=e[r];return t}},function(t,e,n){var r=n(122),i=n(7).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,a=i.alloc(0),s=0;a.length<e;)n=o(s++),a=i.concat([a,r("sha1").update(t).update(n).digest()]);return a.slice(0,e)}},function(t){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},function(t,e,n){var r=n(6),i=n(18).Buffer,o=n(118),a=o.base,s=o.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){a.Node.call(this,"der",t)}function l(t){return t<10?"0"+t:t}t.exports=u,u.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(c,a.Node),c.prototype._encodeComposite=function(t,e,n,r){var o,a=function(t,e,n,r){var i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),s.tagByName.hasOwnProperty(t))i=s.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);i=t}return i>=31?r.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|s.tagClassByName[n||"universal"]<<6)}(t,e,n,this.reporter);if(r.length<128)return(o=new i(2))[0]=a,o[1]=r.length,this._createEncoderBuffer([o,r]);for(var u=1,c=r.length;c>=256;c>>=8)u++;(o=new i(2+u))[0]=a,o[1]=128|u,c=1+u;for(var l=r.length;l>0;c--,l>>=8)o[c]=255&l;return this._createEncoderBuffer([o,r])},c.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var n=new i(2*t.length),r=0;r<t.length;r++)n.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(n)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)?this._createEncoderBuffer(t):"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},c.prototype._encodeObjid=function(t,e,n){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var r=0;r<t.length;r++)t[r]|=0}else if(Array.isArray(t))for(t=t.slice(),r=0;r<t.length;r++)t[r]|=0;if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(r=0;r<t.length;r++){var a=t[r];for(o++;a>=128;a>>=7)o++}var s=new i(o),u=s.length-1;for(r=t.length-1;r>=0;r--)for(a=t[r],s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a;return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(t,e){var n,r=new Date(t);return"gentime"===e?n=[l(r.getFullYear()),l(r.getUTCMonth()+1),l(r.getUTCDate()),l(r.getUTCHours()),l(r.getUTCMinutes()),l(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[l(r.getFullYear()%100),l(r.getUTCMonth()+1),l(r.getUTCDate()),l(r.getUTCHours()),l(r.getUTCMinutes()),l(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){var n=t.toArray();!t.sign&&128&n[0]&&n.unshift(0),t=new i(n)}if(i.isBuffer(t)){var r=t.length;0===t.length&&r++;var o=new i(r);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);r=1;for(var a=t;a>=256;a>>=8)r++;for(a=(o=new Array(r)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},c.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},c.prototype._skipDefault=function(t,e,n){var r,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,n).join()),o.length!==i.defaultBuffer.length)return!1;for(r=0;r<o.length;r++)if(o[r]!==i.defaultBuffer[r])return!1;return!0}},function(t,e,n){var r=n(6),i=n(118),o=i.base,a=i.bignum,s=i.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){o.Node.call(this,"der",t)}function l(t,e){var n=t.readUInt8(e);if(t.isError(n))return n;var r=s.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){var o=n;for(n=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;n<<=7,n|=127&o}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:s.tag[n]}}function f(t,e,n){var r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;var i=127&r;if(i>4)return t.error("length octect is too long");r=0;for(var o=0;o<i;o++){r<<=8;var a=t.readUInt8(n);if(t.isError(a))return a;r|=a}return r}t.exports=u,u.prototype.decode=function(t,e){return t instanceof o.DecoderBuffer||(t=new o.DecoderBuffer(t,e)),this.tree._decode(t,e)},r(c,o.Node),c.prototype._peekTag=function(t,e,n){if(t.isEmpty())return!1;var r=t.save(),i=l(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(r),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||n)},c.prototype._decodeTag=function(t,e,n){var r=l(t,'Failed to decode tag of "'+e+'"');if(t.isError(r))return r;var i=f(t,r.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!n&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');var o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){var n=l(t,e);if(t.isError(n))return n;var r,i=f(t,n.primitive,e);if(t.isError(i))return i;if(r=n.primitive||null!==i?t.skip(i):this._skipUntilEnd(t,e),t.isError(r))return r;if("end"===n.tagStr)break}},c.prototype._decodeList=function(t,e,n,r){for(var i=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var a=n.decode(t,"der",r);if(t.isError(a)&&o)break;i.push(a)}return i},c.prototype._decodeStr=function(t,e){if("bitstr"===e){var n=t.readUInt8();return t.isError(n)?n:{unused:n,data:t.raw()}}if("bmpstr"===e){var r=t.raw();if(r.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var i="",o=0;o<r.length/2;o++)i+=String.fromCharCode(r.readUInt16BE(2*o));return i}if("numstr"===e){var a=t.raw().toString("ascii");return this._isNumstr(a)?a:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var s=t.raw().toString("ascii");return this._isPrintstr(s)?s:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},c.prototype._decodeObjid=function(t,e,n){for(var r,i=[],o=0;!t.isEmpty();){var a=t.readUInt8();o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0)}128&a&&i.push(o);var s=i[0]/40|0,u=i[0]%40;if(r=n?i:[s,u].concat(i.slice(1)),e){var c=e[r.join(" ")];void 0===c&&(c=e[r.join(".")]),void 0!==c&&(r=c)}return r},c.prototype._decodeTime=function(t,e){var n=t.raw().toString();if("gentime"===e)var r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),u=0|n.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,u,0)},c.prototype._decodeNull=function(t){return null},c.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){var n=t.raw(),r=new a(n);return e&&(r=e[r.toString(10)]||r),r},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t,e,n){var r=e;r._reverse=function(t){var e={};return Object.keys(t).forEach(function(n){(0|n)==n&&(n|=0);var r=t[n];e[r]=n}),e},r.der=n(689)},function(t,e,n){var r=n(6),i=n(117).Reporter,o=n(18).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return t instanceof s||(t=new s(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}r(a,i),e.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){var e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var n=new a(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.prototype.join=function(t,e){return t||(t=new o(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(n){n.join(t,e),e+=n.length}):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},function(t,e,n){"use strict";var r=n(54),i=n(119),o=n(38),a=r.rotr64_hi,s=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,l=r.sum64,f=r.sum64_hi,d=r.sum64_lo,h=r.sum64_4_hi,p=r.sum64_4_lo,m=r.sum64_5_hi,g=r.sum64_5_lo,v=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function w(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function x(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function _(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function k(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function S(t,e){var n=a(t,e,28)^a(e,t,2)^a(e,t,7);return n<0&&(n+=4294967296),n}function E(t,e){var n=s(t,e,28)^s(e,t,2)^s(e,t,7);return n<0&&(n+=4294967296),n}function O(t,e){var n=a(t,e,14)^a(t,e,18)^a(e,t,9);return n<0&&(n+=4294967296),n}function A(t,e){var n=s(t,e,14)^s(t,e,18)^s(e,t,9);return n<0&&(n+=4294967296),n}function C(t,e){var n=a(t,e,1)^a(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function M(t,e){var n=s(t,e,1)^s(t,e,8)^c(t,e,7);return n<0&&(n+=4294967296),n}function N(t,e){var n=a(t,e,19)^a(e,t,29)^u(t,e,6);return n<0&&(n+=4294967296),n}function T(t,e){var n=s(t,e,19)^s(e,t,29)^c(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(y,v),t.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=N(n[r-4],n[r-3]),o=T(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=C(n[r-30],n[r-29]),c=M(n[r-30],n[r-29]),l=n[r-32],f=n[r-31];n[r]=h(i,o,a,s,u,c,l,f),n[r+1]=p(i,o,a,s,u,c,l,f)}},y.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],h=this.h[6],p=this.h[7],v=this.h[8],b=this.h[9],y=this.h[10],C=this.h[11],M=this.h[12],N=this.h[13],T=this.h[14],I=this.h[15];o(this.k.length===n.length);for(var D=0;D<n.length;D+=2){var j=T,R=I,F=O(v,b),P=A(v,b),z=w(v,0,y,0,M),L=x(0,b,0,C,0,N),B=this.k[D],U=this.k[D+1],W=n[D],q=n[D+1],V=m(j,R,F,P,z,L,B,U,W,q),H=g(j,R,F,P,z,L,B,U,W,q);j=S(r,i),R=E(r,i),F=_(r,0,a,0,u),P=k(0,i,0,s,0,c);var $=f(j,R,F,P),G=d(j,R,F,P);T=M,I=N,M=y,N=C,y=v,C=b,v=f(h,p,V,H),b=d(p,p,V,H),h=u,p=c,u=a,c=s,a=r,s=i,r=f(V,H,$,G),i=d(V,H,$,G)}l(this.h,0,r,i),l(this.h,2,a,s),l(this.h,4,u,c),l(this.h,6,h,p),l(this.h,8,v,b),l(this.h,10,y,C),l(this.h,12,M,N),l(this.h,14,T,I)},y.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(54),i=n(119),o=n(331),a=n(38),s=r.sum32,u=r.sum32_4,c=r.sum32_5,l=o.ch32,f=o.maj32,d=o.s0_256,h=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}r.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=u(m(n[r-2]),n[r-7],p(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],g=this.h[2],v=this.h[3],b=this.h[4],y=this.h[5],w=this.h[6],x=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var _=c(x,h(b),l(b,y,w),this.k[r],n[r]),k=s(d(i),f(i,o,g));x=w,w=y,y=b,b=s(v,_),v=g,g=o,o=i,i=s(_,k)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],v),this.h[4]=s(this.h[4],b),this.h[5]=s(this.h[5],y),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],x)},b.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(54).rotr32;function i(t,e,n){return t&e^~t&n}function o(t,e,n){return t&e^t&n^e&n}function a(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?i(e,n,r):1===t||3===t?a(e,n,r):2===t?o(e,n,r):void 0},e.ch32=i,e.maj32=o,e.p32=a,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},function(t,e,n){"use strict";var r=e;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",n=0;n<t.length;n++)e+=i(t[n].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16));else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},r.zero2=i,r.toHex=o,r.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,n){var r;function i(t){this.rand=t}if(t.exports=function(t){return r||(r=new i(null)),r.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=n(721);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e,n){var r=n(24),i=n(333);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},o.prototype.test=function(t,e,n){var i=t.bitLength(),o=r.mont(t),a=new r(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var c=t.shrn(u),l=s.toRed(o);e>0;e--){var f=this._randrange(new r(2),s);n&&n(f);var d=f.toRed(o).redPow(c);if(0!==d.cmp(a)&&0!==d.cmp(l)){for(var h=1;h<u;h++){if(0===(d=d.redSqr()).cmp(a))return!1;if(0===d.cmp(l))break}if(h===u)return!1}}return!0},o.prototype.getDivisor=function(t,e){var n=t.bitLength(),i=r.mont(t),o=new r(1).toRed(i);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),c=a.toRed(i);e>0;e--){var l=this._randrange(new r(2),a),f=t.gcd(l);if(0!==f.cmpn(1))return f;var d=l.toRed(i).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var h=1;h<s;h++){if(0===(d=d.redSqr()).cmp(o))return d.fromRed().subn(1).gcd(t);if(0===d.cmp(c))break}if(h===s)return(d=d.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,n){var r=n(97);t.exports=v,v.simpleSieve=m,v.fermatTest=g;var i=n(24),o=new i(24),a=new(n(334)),s=new i(1),u=new i(2),c=new i(5),l=(new i(16),new i(8),new i(10)),f=new i(3),d=(new i(7),new i(11)),h=new i(4),p=(new i(12),null);function m(t){for(var e=function(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;i<e&&t[i]<=r&&n%t[i]!=0;i++);e!==i&&t[i]<=r||(t[e++]=n)}return p=t,t}(),n=0;n<e.length;n++)if(0===t.modn(e[n]))return 0===t.cmpn(e[n]);return!0}function g(t){var e=i.mont(t);return 0===u.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function v(t,e){if(t<16)return new i(2===e||5===e?[140,123]:[140,39]);var n,p;for(e=new i(e);;){for(n=new i(r(Math.ceil(t/8)));n.bitLength()>t;)n.ishrn(1);if(n.isEven()&&n.iadd(s),n.testn(1)||n.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;n.mod(l).cmp(f);)n.iadd(h)}else for(;n.mod(o).cmp(d);)n.iadd(h);if(m(p=n.shrn(1))&&m(n)&&g(p)&&g(n)&&a.test(p)&&a.test(n))return n}}},function(t,e,n){var r=n(148),i=n(7).Buffer,o=n(67);function a(t,e,n,a){o.call(this),this._cipher=new r.AES(e),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}n(6)(a,o),a.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},t.exports=a},function(t,e,n){var r=n(148),i=n(7).Buffer,o=n(67),a=n(6),s=n(726),u=n(120),c=n(339);function l(t,e,n,a){o.call(this);var u=i.alloc(4,0);this._cipher=new r.AES(e);var l=this._cipher.encryptBlock(u);this._ghash=new s(l),n=function(t,e,n){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var r=new s(n),o=e.length,a=o%16;r.update(e),a&&(a=16-a,r.update(i.alloc(a,0))),r.update(i.alloc(8,0));var u=8*o,l=i.alloc(8);l.writeUIntBE(u,0,8),r.update(l),t._finID=r.state;var f=i.from(t._finID);return c(f),f}(this,n,l),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(l,o),l.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},l.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),i=0;i<r;++i)n+=t[i]^e[i];return n}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},l.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},l.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},l.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=l},function(t){t.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},function(t,e){t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},function(t,e,n){var r=n(120),i=n(7).Buffer,o=n(339);function a(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var n=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*n)]);for(var s=0;s<n;s++){var u=a(t),c=o+16*s;t._cache.writeUInt32BE(u[0],c+0),t._cache.writeUInt32BE(u[1],c+4),t._cache.writeUInt32BE(u[2],c+8),t._cache.writeUInt32BE(u[3],c+12)}var l=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),r(e,l)}},function(t,e,n){var r=n(346),i=n(212),o=n(211),a=n(343),s=n(342),u=n(7).Buffer,c=u.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function f(t,e,n){var a=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?r:function(e){return o(t).update(e).digest()}}(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=a(e):e.length<s&&(e=u.concat([e,c],s));for(var f=u.allocUnsafe(s+l[t]),d=u.allocUnsafe(s+l[t]),h=0;h<s;h++)f[h]=54^e[h],d[h]=92^e[h];var p=u.allocUnsafe(s+n+4);f.copy(p,0,0,s),this.ipad1=p,this.ipad2=f,this.opad=d,this.alg=t,this.blocksize=s,this.hash=a,this.size=l[t]}f.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,n,r,i){a(t,e,n,r),u.isBuffer(t)||(t=u.from(t,s)),u.isBuffer(e)||(e=u.from(e,s));var o=new f(i=i||"sha1",t,e.length),c=u.allocUnsafe(r),d=u.allocUnsafe(e.length+4);e.copy(d,0,0,e.length);for(var h=0,p=l[i],m=Math.ceil(r/p),g=1;g<=m;g++){d.writeUInt32BE(g,e.length);for(var v=o.run(d,o.ipad1),b=v,y=1;y<n;y++){b=o.run(b,o.ipad2);for(var w=0;w<p;w++)v[w]^=b[w]}v.copy(c,h),h+=p}return c}},function(t,e,n){(function(e){var n;n=e.browser?"utf-8":parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary",t.exports=n}).call(this,n(44))},function(t,e,n){(function(e){var n=Math.pow(2,30)-1;function r(t,n){if("string"!=typeof t&&!e.isBuffer(t))throw new TypeError(n+" must be a buffer or string")}t.exports=function(t,e,i,o){if(r(t,"Password"),r(e,"Salt"),"number"!=typeof i)throw new TypeError("Iterations not a number");if(i<0)throw new TypeError("Bad iterations");if("number"!=typeof o)throw new TypeError("Key length not a number");if(o<0||o>n||o!=o)throw new TypeError("Bad key length")}}).call(this,n(18).Buffer)},function(t,e,n){e.pbkdf2=n(741),e.pbkdf2Sync=n(341)},function(t){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},function(t,e,n){var r=n(217);t.exports=function(t){return(new r).update(t).digest()}},function(t,e,n){"use strict";var r=n(6),i=n(743),o=n(67),a=n(7).Buffer,s=n(346),u=n(212),c=n(211),l=a.alloc(128);function f(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var n="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>n?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length<n&&(e=a.concat([e,l],n));for(var r=this._ipad=a.allocUnsafe(n),i=this._opad=a.allocUnsafe(n),s=0;s<n;s++)r[s]=54^e[s],i[s]=92^e[s];this._hash="rmd160"===t?new u:c(t),this._hash.update(r)}r(f,o),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new f("rmd160",e):"md5"===t?new i(s,e):new f(t,e)}},function(t,e,n){var r=n(6),i=n(96),o=n(7).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function l(t,e,n){return t&e|n&(t|e)}function f(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function h(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function v(t,e){return t>>>0<e>>>0?1:0}r(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,b=0|this._gh,y=0|this._hh,w=0|this._al,x=0|this._bl,_=0|this._cl,k=0|this._dl,S=0|this._el,E=0|this._fl,O=0|this._gl,A=0|this._hl,C=0;C<32;C+=2)e[C]=t.readInt32BE(4*C),e[C+1]=t.readInt32BE(4*C+4);for(;C<160;C+=2){var M=e[C-30],N=e[C-30+1],T=h(M,N),I=p(N,M),D=m(M=e[C-4],N=e[C-4+1]),j=g(N,M),R=e[C-14],F=e[C-14+1],P=e[C-32],z=e[C-32+1],L=I+F|0,B=T+R+v(L,I)|0;B=(B=B+D+v(L=L+j|0,j)|0)+P+v(L=L+z|0,z)|0,e[C]=B,e[C+1]=L}for(var U=0;U<160;U+=2){B=e[U],L=e[U+1];var W=l(n,r,i),q=l(w,x,_),V=f(n,w),H=f(w,n),$=d(s,S),G=d(S,s),K=a[U],X=a[U+1],Y=c(s,u,b),J=c(S,E,O),Z=A+G|0,Q=y+$+v(Z,A)|0;Q=(Q=(Q=Q+Y+v(Z=Z+J|0,J)|0)+K+v(Z=Z+X|0,X)|0)+B+v(Z=Z+L|0,L)|0;var tt=H+q|0,et=V+W+v(tt,H)|0;y=b,A=O,b=u,O=E,u=s,E=S,s=o+Q+v(S=k+Z|0,k)|0,o=i,k=_,i=r,_=x,r=n,x=w,n=Q+et+v(w=Z+tt|0,Z)|0}this._al=this._al+w|0,this._bl=this._bl+x|0,this._cl=this._cl+_|0,this._dl=this._dl+k|0,this._el=this._el+S|0,this._fl=this._fl+E|0,this._gl=this._gl+O|0,this._hl=this._hl+A|0,this._ah=this._ah+n+v(this._al,w)|0,this._bh=this._bh+r+v(this._bl,x)|0,this._ch=this._ch+i+v(this._cl,_)|0,this._dh=this._dh+o+v(this._dl,k)|0,this._eh=this._eh+s+v(this._el,S)|0,this._fh=this._fh+u+v(this._fl,E)|0,this._gh=this._gh+b+v(this._gl,O)|0,this._hh=this._hh+y+v(this._hl,A)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,n){var r=n(6),i=n(96),o=n(7).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function l(t,e,n){return t&e|n&(t|e)}function f(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function h(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function p(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}r(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0|this._f,m=0|this._g,g=0|this._h,v=0;v<16;++v)e[v]=t.readInt32BE(4*v);for(;v<64;++v)e[v]=p(e[v-2])+e[v-7]+h(e[v-15])+e[v-16]|0;for(var b=0;b<64;++b){var y=g+d(s)+c(s,u,m)+a[b]+e[b]|0,w=f(n)+l(n,r,i)|0;g=m,m=u,u=s,s=o+y|0,o=i,i=r,r=n,n=y+w|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,n){"use strict";t.exports=o;var r=n(75),i=n(121);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t),this._transformState={afterTransform:function(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",a)}function a(){var t=this;"function"==typeof this._flush?this._flush(function(e,n){s(t,e,n)}):s(this,null,null)}function s(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=n(6),i.inherits(o,r),o.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},o.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},o.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,function(t){e(t),n.emit("close")})}},function(t,e,n){"use strict";var r=n(149);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(r.nextTick(i,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){t.exports=n(150).EventEmitter},function(t,e,n){"use strict";(function(e,r){var i=n(149);t.exports=y;var o,a=n(357);y.ReadableState=b,n(150).EventEmitter;var s=function(t,e){return t.listeners(e).length},u=n(352),c=n(7).Buffer,l=e.Uint8Array||function(){},f=n(121);f.inherits=n(6);var d=n(756),h=void 0;h=d&&d.debuglog?d.debuglog("stream"):function(){};var p,m=n(755),g=n(351);f.inherits(y,u);var v=["error","close","destroy","pause","resume"];function b(t,e){o=o||n(75),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,a=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=n(213).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function y(t){if(o=o||n(75),!(this instanceof y))return new y(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function w(t,e,n,r,i){var o,a=t._readableState;return null===e?(a.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,S(t)}}(t,a)):(i||(o=function(t,e){var n;return function(t){return c.isBuffer(t)||t instanceof l}(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):x(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):O(t,a)):x(t,a,e,!1))):r||(a.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function x(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&S(t)),O(t,e)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(t,e){this.push(null),e(t)},y.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=c.from(t,e),e=""),n=!0),w(this,t,e,!1,n)},y.prototype.unshift=function(t){return w(this,t,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(t){return p||(p=n(213).StringDecoder),this._readableState.decoder=new p(t),this._readableState.encoding=t,this};var _=8388608;function k(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(h("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(E,t):E(t))}function E(t){h("emit readable"),t.emit("readable"),N(t)}function O(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(A,t,e))}function A(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(h("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function C(t){h("readable nexttick read 0"),t.read(0)}function M(t,e){e.reading||(h("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(h("flow",e.flowing);e.flowing&&null!==t.read(););}function T(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;return t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;for(t-=i.length;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0==(t-=a)){a===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=c.allocUnsafe(t),r=e.head,i=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),0==(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e),r}(t,e.buffer,e.decoder),n);var n}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function j(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}y.prototype.read=function(t){h("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return h("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):S(this),null;if(0===(t=k(t,e))&&e.ended)return 0===e.length&&I(this),null;var r,i=e.needReadable;return h("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&h("length less than watermark",i=!0),e.ended||e.reading?h("reading or ended",i=!1):i&&(h("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=k(n,e))),null===(r=t>0?T(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&I(this)),null!==r&&this.emit("data",r),r},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,h("pipe count=%d opts=%j",o.pipesCount,e);var u=e&&!1===e.end||t===r.stdout||t===r.stderr?b:c;function c(){h("onend"),t.end()}o.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",function e(r,i){h("onunpipe"),r===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),t.removeListener("close",g),t.removeListener("finish",v),t.removeListener("drain",l),t.removeListener("error",m),t.removeListener("unpipe",e),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",p),f=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())});var l=function(t){return function(){var e=t._readableState;h("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",l);var f=!1,d=!1;function p(e){h("ondata"),d=!1,!1!==t.write(e)||d||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==j(o.pipes,t))&&!f&&(h("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function m(e){h("onerror",e),b(),t.removeListener("error",m),0===s(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",v),b()}function v(){h("onfinish"),t.removeListener("close",g),b()}function b(){h("unpipe"),n.unpipe(t)}return n.on("data",p),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",m),t.once("close",g),t.once("finish",v),t.emit("pipe",n),o.flowing||(h("pipe resume"),n.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var a=j(e.pipes,t);return-1===a?this:(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n),this)},y.prototype.on=function(t,e){var n=u.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&S(this):i.nextTick(C,this))}return n},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var t=this._readableState;return t.flowing||(h("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(M,t,e))}(this,t)),this},y.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",function(){if(h("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){h("wrapped data"),n.decoder&&(i=n.decoder.write(i)),(!n.objectMode||null!==i&&void 0!==i)&&(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<v.length;o++)t.on(v[o],this.emit.bind(this,v[o]));return this._read=function(e){h("wrapped _read",e),r&&(r=!1,t.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=T}).call(this,n(27),n(44))},function(t,e,n){"use strict";var r=n(7).Buffer,i=n(216).Transform;function o(t){i.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(6)(o,i),o.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)n[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)n[this._blockOffset++]=t[i++];for(var a=0,s=8*t.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,n){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=n(97),e.createHash=e.Hash=n(122),e.createHmac=e.Hmac=n(347);var r=n(742),i=Object.keys(r),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=n(344);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=n(740);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=n(723);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=n(718);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=n(680);var l=n(679);e.publicEncrypt=l.publicEncrypt,e.privateEncrypt=l.privateEncrypt,e.publicDecrypt=l.publicDecrypt,e.privateDecrypt=l.privateDecrypt;var f=n(676);e.randomFill=f.randomFill,e.randomFillSync=f.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(757),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(27))},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){var r=n(77),i=n(76),o=n(761)(!1),a=n(221)("IE_PROTO");t.exports=function(t,e){var n,s=i(t),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~o(c,n)||c.push(n));return c}},function(t,e,n){t.exports=!n(55)&&!n(78)(function(){return 7!=Object.defineProperty(n(226)("div"),"a",{get:function(){return 7}}).a})},function(t,e){t.exports=Math.scale||function(t,e,n,r,i){return 0===arguments.length||t!=t||e!=e||n!=n||r!=r||i!=i?NaN:t===1/0||t===-1/0?t:(t-e)*(i-r)/(n-e)+r}},function(t,e,n){var r=n(80);t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},function(t,e,n){var r=n(105),i=n(361);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return i(this)}}},function(t,e,n){var r=n(86),i=n(41),o=n(130).f;t.exports=function(t){return function(e){for(var n,a=i(e),s=r(a),u=s.length,c=0,l=[];u>c;)o.call(a,n=s[c++])&&l.push(t?[n,a[n]]:a[n]);return l}}},function(t,e,n){var r=n(16),i=n(245),o=n(59);t.exports=function(t,e,n,a){var s=String(o(t)),u=s.length,c=void 0===n?" ":String(n),l=r(e);if(l<=u||""==c)return s;var f=l-u,d=i.call(c,Math.ceil(f/c.length));return d.length>f&&(d=d.slice(0,f)),a?d+s:s+d}},function(t,e,n){"use strict";var r=n(164),i=n(14),o=n(16),a=n(50),s=n(15)("isConcatSpreadable");t.exports=function t(e,n,u,c,l,f,d,h){for(var p,m,g=l,v=0,b=!!d&&a(d,h,3);v<c;){if(v in u){if(p=b?b(u[v],v,n):u[v],m=!1,i(p)&&(m=void 0!==(m=p[s])?!!m:r(p)),m&&f>0)g=t(e,n,p,o(p.length),g,f-1)-1;else{if(g>=9007199254740991)throw TypeError();e[g]=p}g++}v++}return g}},function(t,e,n){var r=n(83),i=n(165),o=n(5),a=n(8).Reflect;t.exports=a&&a.ownKeys||function(t){var e=r.f(o(t)),n=i.f;return n?e.concat(n(t)):e}},function(t,e,n){var r=n(48),i=n(16);t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw RangeError("Wrong length!");return n}},function(t,e,n){"use strict";var r=n(79),i=n(71).getWeak,o=n(5),a=n(14),s=n(81),u=n(80),c=n(57),l=n(42),f=n(102),d=c(5),h=c(6),p=0,m=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},v=function(t,e){return d(t.a,function(t){return t[0]===e})};g.prototype={get:function(t){var e=v(this,t);if(e)return e[1]},has:function(t){return!!v(this,t)},set:function(t,e){var n=v(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=h(this.a,function(e){return e[0]===t});return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,o){var c=t(function(t,r){s(t,c,e,"_i"),t._t=e,t._i=p++,t._l=void 0,void 0!=r&&u(r,n,t[o],t)});return r(c.prototype,{delete:function(t){if(!a(t))return!1;var n=i(t);return!0===n?m(f(this,e)).delete(t):n&&l(n,this._i)&&delete n[this._i]},has:function(t){if(!a(t))return!1;var n=i(t);return!0===n?m(f(this,e)).has(t):n&&l(n,this._i)}}),c},def:function(t,e,n){var r=i(o(e),!0);return!0===r?m(t).set(e,n):r[t._i]=n,t},ufstore:m}},function(t,e,n){"use strict";var r,i=n(57)(0),o=n(34),a=n(71),s=n(390),u=n(368),c=n(14),l=n(13),f=n(102),d=a.getWeak,h=Object.isExtensible,p=u.ufstore,m={},g=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},v={get:function(t){if(c(t)){var e=d(t);return!0===e?p(f(this,"WeakMap")).get(t):e?e[this._i]:void 0}},set:function(t,e){return u.def(f(this,"WeakMap"),t,e)}},b=t.exports=n(157)("WeakMap",g,v,u,!0,!0);l(function(){return 7!=(new b).set((Object.freeze||Object)(m),7).get(m)})&&(s((r=u.getConstructor(g,"WeakMap")).prototype,v),a.NEED=!0,i(["delete","has","get","set"],function(t){var e=b.prototype,n=e[t];o(e,t,function(e,i){if(c(e)&&!h(e)){this._f||(this._f=new r);var o=this._f[t](e,i);return"set"==t?this:o}return n.call(this,e,i)})}))},function(t,e,n){"use strict";var r=n(371),i=n(102);t.exports=n(157)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},function(t,e,n){"use strict";var r=n(21).f,i=n(84),o=n(79),a=n(50),s=n(81),u=n(80),c=n(242),l=n(377),f=n(82),d=n(22),h=n(71).fastKey,p=n(102),m=d?"_s":"size",g=function(t,e){var n,r=h(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,c){var l=t(function(t,r){s(t,l,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[m]=0,void 0!=r&&u(r,n,t[c],t)});return o(l.prototype,{clear:function(){for(var t=p(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[m]=0},delete:function(t){var n=p(this,e),r=g(n,t);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[m]--}return!!r},forEach:function(t){p(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(p(this,e),t)}}),d&&r(l.prototype,"size",{get:function(){return p(this,e)[m]}}),l},def:function(t,e,n){var r,i,o=g(t,e);return o?o.v=n:(t._l=o={i:i=h(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[m]++,"F"!==i&&(t._i[i]=o)),t},getEntry:g,setStrong:function(t,e,n){c(t,e,function(t,n){this._t=p(t,e),this._k=n,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?l(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,l(1))},n?"entries":"values",!n,!0),f(e)}}},function(t,e,n){"use strict";var r=n(371),i=n(102);t.exports=n(157)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(i(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(i(this,"Map"),0===t?0:t,e)}},r,!0)},function(t,e,n){var r=n(5),i=n(14),o=n(228);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){n(22)&&"g"!=/./g.flags&&n(21).f(RegExp.prototype,"flags",{configurable:!0,get:n(129)})},function(t,e,n){"use strict";var r=n(232);n(3)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var r=n(25),i=n(85),o=n(16);t.exports=[].copyWithin||function(t,e){var n=r(this),a=o(n.length),s=i(t,a),u=i(e,a),c=arguments.length>2?arguments[2]:void 0,l=Math.min((void 0===c?a:i(c,a))-u,a-s),f=1;for(u<s&&s<u+l&&(f=-1,u+=l-1,s+=l-1);l-- >0;)u in n?n[s]=n[u]:delete n[s],s+=f,u+=f;return n}},function(t,e,n){var r=n(30),i=n(25),o=n(131),a=n(16);t.exports=function(t,e,n,s,u){r(e);var c=i(t),l=o(c),f=a(c.length),d=u?f-1:0,h=u?-1:1;if(n<2)for(;;){if(d in l){s=l[d],d+=h;break}if(d+=h,u?d<0:f<=d)throw TypeError("Reduce of empty array with no initial value")}for(;u?d>=0:f>d;d+=h)d in l&&(s=e(s,l[d],d,c));return s}},function(t,e,n){var r=n(5);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&r(o.call(t)),e}}},function(t,e,n){var r=n(244),i=Math.pow,o=i(2,-52),a=i(2,-23),s=i(2,127)*(2-a),u=i(2,-126);t.exports=Math.fround||function(t){var e,n,i=Math.abs(t),c=r(t);return i<u?c*(i/u/a+1/o-1/o)*u*a:(n=(e=(1+a/o)*i)-(e-i))>s||n!=n?c*(1/0):c*n}},function(t,e){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,e,n){var r=n(14),i=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&i(t)===t}},function(t,e,n){var r=n(49);t.exports=function(t,e){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(e);return+t}},function(t,e,n){var r=n(8).parseFloat,i=n(104).trim;t.exports=1/r(n(247)+"-0")!=-1/0?function(t){var e=i(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},function(t,e,n){var r=n(8).parseInt,i=n(104).trim,o=n(247),a=/^[-+]?0[xX]/;t.exports=8!==r(o+"08")||22!==r(o+"0x16")?function(t,e){var n=i(String(t),3);return r(n,e>>>0||(a.test(n)?16:10))}:r},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){"use strict";var r=n(30),i=n(14),o=n(387),a=[].slice,s={};t.exports=Function.bind||function(t){var e=r(this),n=a.call(arguments,1),u=function(){var r=n.concat(a.call(arguments));return this instanceof u?function(t,e,n){if(!(e in s)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";s[e]=Function("F,a","return new F("+r.join(",")+")")}return s[e](t,n)}(e,r.length,r):o(e,r,t)};return i(e.prototype)&&(u.prototype=e.prototype),u}},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,n){"use strict";var r=n(86),i=n(165),o=n(130),a=n(25),s=n(131),u=Object.assign;t.exports=!u||n(13)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=r})?function(t,e){for(var n=a(t),u=arguments.length,c=1,l=i.f,f=o.f;u>c;)for(var d,h=s(arguments[c++]),p=l?r(h).concat(l(h)):r(h),m=p.length,g=0;m>g;)f.call(h,d=p[g++])&&(n[d]=h[d]);return n}:u},function(t,e,n){var r=n(41),i=n(83).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(r(t))}},function(t,e,n){var r=n(21),i=n(5),o=n(86);t.exports=n(22)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},function(t,e,n){var r=n(42),i=n(41),o=n(166)(!1),a=n(251)("IE_PROTO");t.exports=function(t,e){var n,s=i(t),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~o(c,n)||c.push(n));return c}},function(t,e,n){e.f=n(15)},function(t,e,n){t.exports=!n(22)&&!n(13)(function(){return 7!=Object.defineProperty(n(253)("div"),"a",{get:function(){return 7}}).a})},function(t){t.exports={name:"vega-themes",version:"2.4.0",description:"Themes for stylized Vega and Vega-Lite visualizations.",keywords:["vega","vega-lite","themes","style"],license:"BSD-3-Clause",author:{name:"UW Interactive Data Lab",url:"https://idl.cs.washington.edu"},contributors:[{name:"Emily Gu",url:"https://github.com/emilygu"},{name:"Arvind Satyanarayan",url:"http://arvindsatya.com"},{name:"Jeffrey Heer",url:"http://idl.cs.washington.edu"},{name:"Dominik Moritz",url:"https://www.domoritz.de"}],main:"build/vega-themes.js",module:"build/src/index.js",unpkg:"build/vega-themes.min.js",jsdelivr:"build/vega-themes.min.js",typings:"build/src/index.d.ts",repository:{type:"git",url:"https://github.com/vega/vega-themes.git"},scripts:{prepare:"beemo create-config --silent",clean:"rm -rf build examples/build",prettierbase:"beemo prettier 'examples/*.{html,scss,css}'",eslintbase:"beemo eslint 'src/**/*.ts'",format:"yarn eslintbase --fix && yarn prettierbase --write",lint:"yarn eslintbase && yarn prettierbase --check",prebuild:"mkdir -p build",build:"tsc && rollup -c",postbuild:"terser build/vega-themes.js -cm > build/vega-themes.min.js","deploy:gh":"yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples",prepublishOnly:"yarn clean && yarn build",preversion:"yarn lint",serve:"browser-sync start -s -f build examples --serveStatic examples",start:"yarn build && concurrently --kill-others -n Server,Typescript,Rollup 'yarn serve' 'tsc -w' 'rollup -c -w'"},devDependencies:{"browser-sync":"^2.26.7",concurrently:"^4.1.2","gh-pages":"^2.1.1",rollup:"^1.20.3","rollup-plugin-json":"^4.0.0",terser:"^4.2.1",typescript:"~3.5.3",vega:"^5.5.2","vega-lite":"^4.0.0-beta.1","vega-lite-dev-config":"^0.2.5"},peerDependencies:{vega:"*","vega-lite":"*"},beemo:{module:"vega-lite-dev-config",drivers:["prettier","eslint"]}}},function(t,e,n){"use strict";var r=Array.isArray,i=Object.keys,o=Object.prototype.hasOwnProperty;t.exports=function t(e,n){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){var a,s,u,c=r(e),l=r(n);if(c&&l){if((s=e.length)!=n.length)return!1;for(a=s;0!=a--;)if(!t(e[a],n[a]))return!1;return!0}if(c!=l)return!1;var f=e instanceof Date,d=n instanceof Date;if(f!=d)return!1;if(f&&d)return e.getTime()==n.getTime();var h=e instanceof RegExp,p=n instanceof RegExp;if(h!=p)return!1;if(h&&p)return e.toString()==n.toString();var m=i(e);if((s=m.length)!==i(n).length)return!1;for(a=s;0!=a--;)if(!o.call(n,m[a]))return!1;for(a=s;0!=a--;)if(!t(e[u=m[a]],n[u]))return!1;return!0}return e!=e&&n!=n}},function(t,e,n){(function(e){var n=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}var n,r,i;try{n=Map}catch(t){n=function(){}}try{r=Set}catch(t){r=function(){}}try{i=Promise}catch(t){i=function(){}}function o(a,u,c,l,f){"object"==typeof u&&(c=u.depth,l=u.prototype,f=u.includeNonEnumerable,u=u.circular);var d=[],h=[],p=void 0!==e;return void 0===u&&(u=!0),void 0===c&&(c=1/0),function a(c,m){if(null===c)return null;if(0===m)return c;var g,v;if("object"!=typeof c)return c;if(t(c,n))g=new n;else if(t(c,r))g=new r;else if(t(c,i))g=new i(function(t,e){c.then(function(e){t(a(e,m-1))},function(t){e(a(t,m-1))})});else if(o.__isArray(c))g=[];else if(o.__isRegExp(c))g=new RegExp(c.source,s(c)),c.lastIndex&&(g.lastIndex=c.lastIndex);else if(o.__isDate(c))g=new Date(c.getTime());else{if(p&&e.isBuffer(c))return g=e.allocUnsafe?e.allocUnsafe(c.length):new e(c.length),c.copy(g),g;t(c,Error)?g=Object.create(c):void 0===l?(v=Object.getPrototypeOf(c),g=Object.create(v)):(g=Object.create(l),v=l)}if(u){var b=d.indexOf(c);if(-1!=b)return h[b];d.push(c),h.push(g)}for(var y in t(c,n)&&c.forEach(function(t,e){var n=a(e,m-1),r=a(t,m-1);g.set(n,r)}),t(c,r)&&c.forEach(function(t){var e=a(t,m-1);g.add(e)}),c){var w;v&&(w=Object.getOwnPropertyDescriptor(v,y)),w&&null==w.set||(g[y]=a(c[y],m-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(c);for(y=0;y<x.length;y++){var _=x[y];(!(S=Object.getOwnPropertyDescriptor(c,_))||S.enumerable||f)&&(g[_]=a(c[_],m-1),S.enumerable||Object.defineProperty(g,_,{enumerable:!1}))}}if(f){var k=Object.getOwnPropertyNames(c);for(y=0;y<k.length;y++){var S,E=k[y];(S=Object.getOwnPropertyDescriptor(c,E))&&S.enumerable||(g[E]=a(c[E],m-1),Object.defineProperty(g,E,{enumerable:!1}))}}return g}(a,c)}function a(t){return Object.prototype.toString.call(t)}function s(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return o.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},o.__objToStr=a,o.__isDate=function(t){return"object"==typeof t&&"[object Date]"===a(t)},o.__isArray=function(t){return"object"==typeof t&&"[object Array]"===a(t)},o.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===a(t)},o.__getRegExpFlags=s,o}();"object"==typeof t&&t.exports&&(t.exports=n)}).call(this,n(18).Buffer)},function(t){t.exports={name:"vega-lite",author:'Jeffrey Heer, Dominik Moritz, Kanit "Ham" Wongsuphasawat',version:"3.0.0-rc12",collaborators:["Kanit Wongsuphasawat <kanitw@gmail.com> (http://kanitw.yellowpigz.com)","Dominik Moritz <domoritz@cs.washington.edu> (https://www.domoritz.de)","Jeffrey Heer <jheer@uw.edu> (http://jheer.org)"],homepage:"https://vega.github.io/vega-lite/",description:"Vega-Lite is a concise high-level language for interactive visualization.",main:"build/vega-lite.js",unpkg:"build/vega-lite.min.js",jsdelivr:"build/vega-lite.min.js",module:"build/src/index",types:"build/src/index.d.ts",bin:{vl2png:"./bin/vl2png",vl2svg:"./bin/vl2svg",vl2vg:"./bin/vl2vg"},directories:{test:"test"},scripts:{prebuild:"mkdir -p build/src",build:"npm run build:only","build:only":"tsc && rollup -c",postbuild:"terser build/vega-lite.js -cm --source-map content=build/vega-lite.js.map,filename=build/vega-lite.min.js.map -o build/vega-lite.min.js && npm run schema","build:examples":"npm run build:only","postbuild:examples":"npm run data && TZ=America/Los_Angeles scripts/build-examples.sh","build:examples-full":"npm run build:only","postbuild:examples-full":"TZ=America/Los_Angeles scripts/build-examples.sh 1","build:example":"TZ=America/Los_Angeles scripts/build-example.sh","build:toc":"bundle exec jekyll build -q && scripts/generate-toc","build:site":"tsc -p site && webpack --config site/webpack.config.js","build:versions":"scripts/update-version.sh",clean:"rm -rf build && rm -f examples/compiled/*.png && find site/examples ! -name 'index.md' -type f -delete",data:"rsync -r node_modules/vega-datasets/data/* data",deploy:"scripts/deploy.sh","deploy:gh":"scripts/deploy-gh.sh","deploy:schema":"scripts/deploy-schema.sh",preschema:"npm run prebuild",schema:"node --stack-size=2800 ./node_modules/.bin/ts-json-schema-generator --no-type-check --path tsconfig.json --type TopLevelSpec > build/vega-lite-schema.json && npm run renameschema && cp build/vega-lite-schema.json _data/",renameschema:"scripts/rename-schema.sh",presite:"npm run prebuild && npm run data && npm run build:site && npm run build:toc && npm run build:versions && scripts/create-example-pages",site:"bundle exec jekyll serve --incremental",prettierbase:"prettier '{src,test,test-runtime,site,typings}/**/*.{ts,md,css}'",format:"tslint -p . --fix -e 'package.json' && npm run prettierbase -- --write",lint:"tslint -p . -e 'package.json' && npm run prettierbase -- --list-different",test:"jest test/ && npm run lint && npm run schema && jest examples/ && npm run test:runtime","test:inspect":"node --inspect-brk ./node_modules/.bin/jest --runInBand test","test:runtime":'TZ=America/Los_Angeles TS_NODE_COMPILER_OPTIONS=\'{"module":"commonjs"}\' wdio wdio.conf.js',"test:runtime:generate":"rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true npm run test:runtime","watch:build":"npm run build:only && concurrently --kill-others -n Typescript,Rollup 'tsc -w' 'rollup -c -w'","watch:site":"concurrently --kill-others -n Typescript,Webpack 'tsc -p site --watch' 'webpack --config site/webpack.config.js --mode development --watch'","watch:test":"jest --watch"},repository:{type:"git",url:"https://github.com/vega/vega-lite.git"},license:"BSD-3-Clause",bugs:{url:"https://github.com/vega/vega-lite/issues"},devDependencies:{"@types/chai":"^4.1.7","@types/d3":"^5.5.0","@types/highlight.js":"^9.12.3","@types/jest":"^23.3.10","@types/mkdirp":"^0.5.2","@types/node":"10.12.18","@types/webdriverio":"^4.13.0",ajv:"^6.6.2",chai:"^4.2.0",cheerio:"^1.0.0-rc.2",chromedriver:"^2.45.0",codecov:"^3.1.0",concurrently:"^4.1.0",d3:"^5.7.0","highlight.js":"^9.13.1",jest:"^23.6.0",mkdirp:"^0.5.1",prettier:"^1.15.3",rollup:"^1.0.0","rollup-plugin-commonjs":"^9.2.0","rollup-plugin-json":"^3.1.0","rollup-plugin-node-resolve":"^4.0.0","rollup-plugin-sourcemaps":"^0.4.2","source-map-support":"^0.5.9","svg2png-many":"^0.0.7",terser:"^3.13.1","ts-jest":"^23.10.5","ts-json-schema-generator":"^0.38.1","ts-node":"^7.0.1",tslint:"5.12.0","tslint-config-prettier":"^1.17.0","tslint-eslint-rules":"^5.4.0",typescript:"^3.2.2",vega:"^4.4.0","vega-datasets":"^1.20.0","vega-embed":"^3.28.0","vega-tooltip":"^0.15.0","wdio-chromedriver-service":"^0.1.5","wdio-dot-reporter":"0.0.10","wdio-mocha-framework":"^0.6.4","wdio-static-server-service":"^1.0.1",webdriverio:"^4.14.0",webpack:"^4.28.2","webpack-cli":"^3.1.2","yaml-front-matter":"^4.0.0"},dependencies:{"@types/clone":"^0.1.30",clone:"^2.1.2","fast-deep-equal":"^2.0.1","fast-json-stable-stringify":"^2.0.0","json-stringify-pretty-compact":"^1.2.0",tslib:"^1.9.3","vega-event-selector":"^2.0.0","vega-expression":"^2.4.0","vega-typings":"0.3.53","vega-util":"^1.7.1",yargs:"^12.0.5"},jest:{testURL:"http://localhost/",transform:{"^.+\\.tsx?$":"ts-jest"},testRegex:"(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",moduleFileExtensions:["ts","tsx","js","jsx","json","node"],testPathIgnorePatterns:["node_modules","test-runtime","<rootDir>/build","_site","src"],coverageDirectory:"./coverage/",collectCoverage:!1}}},function(t,e,n){"use strict";n.r(e);var r={};n.d(r,"DrawBoxOptions",function(){return X}),n.d(r,"DrawBox",function(){return Y}),n.d(r,"AnchorPosition",function(){return q}),n.d(r,"DrawTextFieldOptions",function(){return G}),n.d(r,"DrawTextField",function(){return K});var i={};n.d(i,"getModelUris",function(){return at}),n.d(i,"convLayer",function(){return J}),n.d(i,"disposeUnusedWeightTensors",function(){return Z}),n.d(i,"extractConvParamsFactory",function(){return Q}),n.d(i,"extractFCParamsFactory",function(){return tt}),n.d(i,"extractSeparableConvParamsFactory",function(){return nt}),n.d(i,"loadSeparableConvParamsFactory",function(){return rt}),n.d(i,"extractWeightEntryFactory",function(){return it}),n.d(i,"extractWeightsFactory",function(){return ot}),n.d(i,"SeparableConvParams",function(){return et}),n.d(i,"TinyYolov2",function(){return Ut}),n.d(i,"TinyYolov2SizeType",function(){return Dt}),n.d(i,"TinyYolov2Options",function(){return Bt}),n.d(i,"validateConfig",function(){return Rt});var o={};n.d(o,"drawContour",function(){return Wt}),n.d(o,"drawDetections",function(){return $t}),n.d(o,"drawFaceExpressions",function(){return ue}),n.d(o,"DrawFaceLandmarksOptions",function(){return he}),n.d(o,"DrawFaceLandmarks",function(){return pe}),n.d(o,"drawFaceLandmarks",function(){return me});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. 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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function c(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function l(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var f=n(0),d=n(4),h=function(){function t(t,e){if(!A(t)||!A(e))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:t,height:e}));this._width=t,this._height=e}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),t.prototype.reverse=function(){return new t(1/this.width,1/this.height)},t}(),p=function(){function t(t,e){this._x=t,this._y=e}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),t.prototype.add=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.sub=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.mul=function(e){return new t(this.x*e.x,this.y*e.y)},t.prototype.div=function(e){return new t(this.x/e.x,this.y/e.y)},t.prototype.abs=function(){return new t(Math.abs(this.x),Math.abs(this.y))},t.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},t.prototype.floor=function(){return new t(Math.floor(this.x),Math.floor(this.y))},t}();function m(t,e){return t instanceof f.Tensor&&t.shape.length===e}function g(t){return m(t,1)}function v(t){return m(t,2)}function b(t){return m(t,3)}function y(t){return m(t,4)}function w(t){return t%1!=0}function x(t){return t%2==0}function _(t,e){void 0===e&&(e=2);var n=Math.pow(10,e);return Math.floor(t*n)/n}function k(t){return t&&t.width&&t.height}function S(t,e){var n=t.width,r=t.height,i=e/Math.max(r,n);return new h(Math.round(n*i),Math.round(r*i))}function E(t){return t.reduce(function(t,e){return t.add(e)},new p(0,0)).div(new p(t.length,t.length))}function O(t,e,n){return Array(t).fill(0).map(function(t,r){return e+r*n})}function A(t){return!!t&&t!==1/0&&t!==-1/0&&!isNaN(t)||0===t}function C(t){return A(t)&&0<=t&&t<=1}var M=function(){function t(e,n){void 0===n&&(n=!0);var r=e||{},i=[r.left,r.top,r.right,r.bottom].every(A),o=[r.x,r.y,r.width,r.height].every(A);if(!o&&!i)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(r));var a=o?[r.x,r.y,r.width,r.height]:[r.left,r.top,r.right-r.left,r.bottom-r.top],s=a[0],u=a[1],c=a[2],l=a[3];t.assertIsValidBox({x:s,y:u,width:c,height:l},"Box.constructor",n),this._x=s,this._y=u,this._width=c,this._height=l}return t.isRect=function(t){return!!t&&[t.x,t.y,t.width,t.height].every(A)},t.assertIsValidBox=function(e,n,r){if(void 0===r&&(r=!1),!t.isRect(e))throw new Error(n+" - invalid box: "+JSON.stringify(e)+", expected object with properties x, y, width, height");if(!r&&(e.width<0||e.height<0))throw new Error(n+" - width ("+e.width+") and height ("+e.height+") must be positive numbers")},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topLeft",{get:function(){return new p(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topRight",{get:function(){return new p(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomLeft",{get:function(){return new p(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomRight",{get:function(){return new p(this.right,this.bottom)},enumerable:!0,configurable:!0}),t.prototype.round=function(){var e=[this.x,this.y,this.width,this.height].map(function(t){return Math.round(t)});return new t({x:e[0],y:e[1],width:e[2],height:e[3]})},t.prototype.floor=function(){var e=[this.x,this.y,this.width,this.height].map(function(t){return Math.floor(t)});return new t({x:e[0],y:e[1],width:e[2],height:e[3]})},t.prototype.toSquare=function(){var e=this.x,n=this.y,r=this.width,i=this.height,o=Math.abs(r-i);return r<i&&(e-=o/2,r+=o),i<r&&(n-=o/2,i+=o),new t({x:e,y:n,width:r,height:i})},t.prototype.rescale=function(e){var n=k(e)?e.width:e,r=k(e)?e.height:e;return new t({x:this.x*n,y:this.y*r,width:this.width*n,height:this.height*r})},t.prototype.pad=function(e,n){var r=[this.x-e/2,this.y-n/2,this.width+e,this.height+n];return new t({x:r[0],y:r[1],width:r[2],height:r[3]})},t.prototype.clipAtImageBorders=function(e,n){var r=this.x,i=this.y,o=this.right,a=this.bottom,s=Math.max(r,0),u=Math.max(i,0),c=o-s,l=a-u;return new t({x:s,y:u,width:Math.min(c,e-s),height:Math.min(l,n-u)}).floor()},t.prototype.shift=function(e,n){var r=this.width,i=this.height;return new t({x:this.x+e,y:this.y+n,width:r,height:i})},t.prototype.padAtBorders=function(t,e){var n=this.width+1,r=this.height+1,i=n,o=r,a=this.left,s=this.top,u=this.right,c=this.bottom;return u>e&&(i=-u+e+n,u=e),c>t&&(o=-c+t+r,c=t),a<1&&(o=2-a,a=1),s<1&&(o=2-s,s=1),{dy:1,edy:o,dx:1,edx:i,y:s,ey:c,x:a,ex:u,w:n,h:r}},t.prototype.calibrate=function(e){return new t({left:this.left+e.left*this.width,top:this.top+e.top*this.height,right:this.right+e.right*this.width,bottom:this.bottom+e.bottom*this.height}).toSquare().round()},t}(),N=function(t){function e(e,n,r,i,o){return void 0===o&&(o=!1),t.call(this,{left:e,top:n,right:r,bottom:i},o)||this}return d.c(e,t),e}(M),T=function(t){function e(e,n){var r=t.call(this,e)||this;return r._label=n,r}return d.c(e,t),e.assertIsValidLabeledBox=function(t,e){if(M.assertIsValidBox(t,e),!A(t.label))throw new Error(e+" - expected property label ("+t.label+") to be a number")},Object.defineProperty(e.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),e}(M),I=function(){function t(t,e,n,r,i){this._imageDims=new h(i.width,i.height),this._score=t,this._classScore=e,this._className=n,this._box=new M(r).rescale(this._imageDims)}return Object.defineProperty(t.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativeBox",{get:function(){return new M(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),t.prototype.forSize=function(e,n){return new t(this.score,this.classScore,this.className,this.relativeBox,{width:e,height:n})},t}(),D=function(t){function e(e,n,r,i){var o=t.call(this,e,n)||this;return o._score=r,o._classScore=i,o}return d.c(e,t),e.assertIsValidPredictedBox=function(t,e){if(T.assertIsValidLabeledBox(t,e),!C(t.score)||!C(t.classScore))throw new Error(e+" - expected properties score ("+t.score+") and ("+t.classScore+") to be a number between [0, 1]")},Object.defineProperty(e.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),e}(T),j=function(t){function e(e,n,r,i,o){return void 0===o&&(o=!1),t.call(this,{x:e,y:n,width:r,height:i},o)||this}return d.c(e,t),e}(M);function R(){var t=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")};return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D:CanvasRenderingContext2D,Image:HTMLImageElement,ImageData:ImageData,Video:HTMLVideoElement,createCanvasElement:function(){return document.createElement("canvas")},createImageElement:function(){return document.createElement("img")},fetch:t,readFile:function(){throw new Error("readFile - filesystem not available for browser environment")}}}var F=n(169),P=n(255);function z(){return"object"==typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLImageElement&&"undefined"!=typeof HTMLCanvasElement&&"undefined"!=typeof HTMLVideoElement&&"undefined"!=typeof ImageData&&"undefined"!=typeof CanvasRenderingContext2D}var L,B=n(254);function U(t){L=t}function W(){z()&&U(R()),Object(B.a)()&&U(Object(P.a)())}var q,V={getEnv:function(){if(!L)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return L},setEnv:U,initialize:W,createBrowserEnv:R,createFileSystem:F.a,createNodejsEnv:P.a,monkeyPatch:function(t){if(L||W(),!L)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var e=t.Canvas,n=void 0===e?L.Canvas:e,r=t.Image,i=void 0===r?L.Image:r;L.Canvas=n,L.Image=i,L.createCanvasElement=t.createCanvasElement||function(){return new n},L.createImageElement=t.createImageElement||function(){return new i},L.ImageData=t.ImageData||L.ImageData,L.Video=t.Video||L.Video,L.fetch=t.fetch||L.fetch,L.readFile=t.readFile||L.readFile},isBrowser:z,isNodejs:B.a};function H(t){return V.isNodejs()||"string"!=typeof t?t:document.getElementById(t)}function $(t){var e=V.getEnv(),n=e.Canvas;if(t instanceof e.CanvasRenderingContext2D)return t;var r=H(t);if(!(r instanceof n))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var i=r.getContext("2d");if(!i)throw new Error("resolveContext2d - canvas 2d context is null");return i}W(),function(t){t.TOP_LEFT="TOP_LEFT",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_LEFT="BOTTOM_LEFT",t.BOTTOM_RIGHT="BOTTOM_RIGHT"}(q||(q={}));var G=function(t){void 0===t&&(t={});var e=t.anchorPosition,n=t.backgroundColor,r=t.fontColor,i=t.fontSize,o=t.fontStyle,a=t.padding;this.anchorPosition=e||q.TOP_LEFT,this.backgroundColor=n||"rgba(0, 0, 0, 0.5)",this.fontColor=r||"rgba(255, 255, 255, 1)",this.fontSize=i||14,this.fontStyle=o||"Georgia",this.padding=a||4},K=function(){function t(e,n,r){void 0===r&&(r={}),this.text="string"==typeof e?[e]:e instanceof t?e.text:e,this.anchor=n,this.options=new G(r)}return t.prototype.measureWidth=function(t){var e=this.options.padding;return this.text.map(function(e){return t.measureText(e).width}).reduce(function(t,e){return t<e?e:t},0)+2*e},t.prototype.measureHeight=function(){var t=this.options,e=t.fontSize,n=t.padding;return this.text.length*e+2*n},t.prototype.getUpperLeft=function(t,e){var n=this.options.anchorPosition,r=n===q.BOTTOM_RIGHT||n===q.TOP_RIGHT,i=n===q.BOTTOM_LEFT||n===q.BOTTOM_RIGHT,o=this.measureWidth(t),a=this.measureHeight(),s=r?this.anchor.x-o:this.anchor.x,u=i?this.anchor.y-a:this.anchor.y;if(e){var c=e.width,l=e.height;return{x:Math.max(Math.min(s,c-o),0),y:Math.max(Math.min(u,l-a),0)}}return{x:s,y:u}},t.prototype.draw=function(t){var e=H(t),n=$(e),r=this.options,i=r.backgroundColor,o=r.fontColor,a=r.fontSize,s=r.fontStyle,u=r.padding;n.font=a+"px "+s;var c=this.measureWidth(n),l=this.measureHeight();n.fillStyle=i;var f=this.getUpperLeft(n,e);n.fillRect(f.x,f.y,c,l),n.fillStyle=o,this.text.forEach(function(t,e){var r=u+f.x,i=u+f.y+(e+1)*a;n.fillText(t,r,i)})},t}(),X=function(t){void 0===t&&(t={});var e=t.boxColor,n=t.lineWidth,r=t.label,i=t.drawLabelOptions;this.boxColor=e||"rgba(0, 0, 255, 1)",this.lineWidth=n||2,this.label=r;var o={anchorPosition:q.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new G(Object.assign({},o,i))},Y=function(){function t(t,e){void 0===e&&(e={}),this.box=new M(t),this.options=new X(e)}return t.prototype.draw=function(t){var e=$(t),n=this.options,r=n.boxColor,i=n.lineWidth,o=this.box,a=o.x,s=o.y,u=o.width,c=o.height;e.strokeStyle=r,e.lineWidth=i,e.strokeRect(a,s,u,c);var l=this.options.label;l&&new K([l],{x:a-i/2,y:s},this.options.drawLabelOptions).draw(t)},t}();function J(t,e,n,r){return void 0===n&&(n="same"),void 0===r&&(r=!1),f.tidy(function(){var i=f.add(f.conv2d(t,e.filters,[1,1],n),e.bias);return r?f.relu(i):i})}function Z(t,e){Object.keys(t).forEach(function(n){e.some(function(t){return t.originalPath===n})||t[n].dispose()})}function Q(t,e){return function(n,r,i,o){var a=f.tensor4d(t(n*r*i*i),[i,i,n,r]),s=f.tensor1d(t(r));return e.push({paramPath:o+"/filters"},{paramPath:o+"/bias"}),{filters:a,bias:s}}}function tt(t,e){return function(n,r,i){var o=f.tensor2d(t(n*r),[n,r]),a=f.tensor1d(t(r));return e.push({paramPath:i+"/weights"},{paramPath:i+"/bias"}),{weights:o,bias:a}}}var et=function(t,e,n){this.depthwise_filter=t,this.pointwise_filter=e,this.bias=n};function nt(t,e){return function(n,r,i){var o=f.tensor4d(t(9*n),[3,3,n,1]),a=f.tensor4d(t(n*r),[1,1,n,r]),s=f.tensor1d(t(r));return e.push({paramPath:i+"/depthwise_filter"},{paramPath:i+"/pointwise_filter"},{paramPath:i+"/bias"}),new et(o,a,s)}}function rt(t){return function(e){var n=t(e+"/depthwise_filter",4),r=t(e+"/pointwise_filter",4),i=t(e+"/bias",1);return new et(n,r,i)}}function it(t,e){return function(n,r,i){var o=t[n];if(!m(o,r))throw new Error("expected weightMap["+n+"] to be a Tensor"+r+"D, instead have "+o);return e.push({originalPath:n,paramPath:i||n}),o}}function ot(t){var e=t;return{extractWeights:function(t){var n=e.slice(0,t);return e=e.slice(t),n},getRemainingWeights:function(){return e}}}function at(t,e){var n=e+"-weights_manifest.json";if(!t)return{modelBaseUri:"",manifestUri:n};if("/"===t)return{modelBaseUri:"/",manifestUri:"/"+n};var r=t.startsWith("http://")?"http://":t.startsWith("https://")?"https://":"",i=(t=t.replace(r,"")).split("/").filter(function(t){return t}),o=t.endsWith(".json")?i[i.length-1]:n,a=r+(t.endsWith(".json")?i.slice(0,i.length-1):i).join("/");return{modelBaseUri:a=t.startsWith("/")?"/"+a:a,manifestUri:"/"===a?"/"+o:a+"/"+o}}function st(t){var e=V.getEnv(),n=e.Image,r=e.Video;return t instanceof n&&t.complete||t instanceof r&&t.readyState>=3}function ut(t){return new Promise(function(e,n){if(t instanceof V.getEnv().Canvas||st(t))return e();function r(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",r),t.currentTarget.removeEventListener("error",i),e(t))}function i(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",r),t.currentTarget.removeEventListener("error",i),n(t))}t.addEventListener("load",r),t.addEventListener("error",i)})}function ct(t){return new Promise(function(e,n){if(!(t instanceof Blob))return n("bufferToImage - expected buf to be of type: Blob");var r=new FileReader;r.onload=function(){if("string"!=typeof r.result)return n("bufferToImage - expected reader.result to be a string, in onload");var t=V.getEnv().createImageElement();t.onload=function(){return e(t)},t.onerror=n,t.src=r.result},r.onerror=n,r.readAsDataURL(t)})}function lt(t){var e=V.getEnv(),n=e.Image,r=e.Video;return t instanceof n?new h(t.naturalWidth,t.naturalHeight):t instanceof r?new h(t.videoWidth,t.videoHeight):new h(t.width,t.height)}function ft(t){var e=t.width,n=t.height,r=(0,V.getEnv().createCanvasElement)();return r.width=e,r.height=n,r}function dt(t,e){var n=V.getEnv().ImageData;if(!(t instanceof n||st(t)))throw new Error("createCanvasFromMedia - media has not finished loading yet");var r=e||lt(t),i=r.width,o=r.height,a=ft({width:i,height:o});return t instanceof n?$(a).putImageData(t,0,0):$(a).drawImage(t,0,0,i,o),a}function ht(t,e){return d.b(this,void 0,void 0,function(){var n;return d.d(this,function(r){switch(r.label){case 0:return[4,(0,V.getEnv().fetch)(t,e)];case 1:if(!((n=r.sent()).status<400))throw new Error("failed to fetch: ("+n.status+") "+n.statusText+", from url: "+n.url);return[2,n]}})})}function pt(t){return d.b(this,void 0,void 0,function(){var e,n;return d.d(this,function(r){switch(r.label){case 0:return[4,ht(t)];case 1:return[4,(e=r.sent()).blob()];case 2:if(!(n=r.sent()).type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+n.type+", for url: "+e.url);return[2,ct(n)]}})})}function mt(t){return d.b(this,void 0,void 0,function(){return d.d(this,function(e){switch(e.label){case 0:return[4,ht(t)];case 1:return[2,e.sent().json()]}})})}function gt(t){return d.b(this,void 0,void 0,function(){var e;return d.d(this,function(n){switch(n.label){case 0:return e=Float32Array.bind,[4,ht(t)];case 1:return[4,n.sent().arrayBuffer()];case 2:return[2,new(e.apply(Float32Array,[void 0,n.sent()]))]}})})}function vt(t,e){return d.b(this,void 0,void 0,function(){var n,r,i,o,a,s;return d.d(this,function(u){switch(u.label){case 0:return n=e||V.getEnv().createCanvasElement(),r=t.shape.slice(y(t)?1:0),i=r[0],o=r[1],a=r[2],s=f.tidy(function(){return t.as3D(i,o,a).toInt()}),[4,f.browser.toPixels(s,n)];case 1:return u.sent(),s.dispose(),[2,n]}})})}function bt(t,e,n){void 0===n&&(n=!1);var r=V.getEnv(),i=r.Image,o=r.Canvas;if(!(t instanceof i||t instanceof o))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var a=lt(t),s=e/Math.max(a.height,a.width),u=s*a.width,c=s*a.height,l=ft({width:e,height:e}),f=t instanceof o?t:dt(t),d=Math.abs(u-c)/2,h=n&&u<c?d:0,p=n&&c<u?d:0;return $(l).drawImage(f,h,p,u,c),l}function yt(t){var e=V.getEnv(),n=e.Image,r=e.Canvas,i=e.Video;return t instanceof n||t instanceof r||t instanceof i}function wt(t,e){return d.b(this,void 0,void 0,function(){var n,r,i,o;return d.d(this,function(a){switch(a.label){case 0:return n=at(t,e),r=n.manifestUri,i=n.modelBaseUri,[4,mt(r)];case 1:return o=a.sent(),[2,f.io.loadWeights(o,i)]}})})}function xt(t,e,n){void 0===n&&(n=!1);var r=n?lt(e):e,i=r.width,o=r.height;return t.width=i,t.height=o,{width:i,height:o}}function _t(t,e){return void 0===e&&(e=!1),f.tidy(function(){var n=t.shape.slice(1),r=n[0],i=n[1];if(r===i)return t;var o=Math.abs(r-i),a=Math.round(o*(e?.5:1)),s=r>i?2:1,u=function(e){var n=t.shape.slice();return n[s]=e,f.fill(n,0)},c=u(a),l=o-c.shape[s],d=[e&&l?u(l):null,t,c].filter(function(t){return!!t}).map(function(t){return t.toFloat()});return f.concat(d,s)})}var kt=function(){function t(t,e){var n=this;if(void 0===e&&(e=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(t))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+t);this._treatAsBatchInput=e,this._batchSize=t.length,t.forEach(function(t,e){if(b(t))return n._imageTensors[e]=t,void(n._inputDimensions[e]=t.shape);if(y(t)){var r=t.shape[0];if(1!==r)throw new Error("NetInput - tf.Tensor4D with batchSize "+r+" passed, but not supported in input array");return n._imageTensors[e]=t,void(n._inputDimensions[e]=t.shape.slice(1))}var i=t instanceof V.getEnv().Canvas?t:dt(t);n._canvases[e]=i,n._inputDimensions[e]=[i.height,i.width,3]})}return Object.defineProperty(t.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBatchInput",{get:function(){return this.batchSize>1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reshapedInputDimensions",{get:function(){var t=this;return O(this.batchSize,0,1).map(function(e,n){return t.getReshapedInputDimensions(n)})},enumerable:!0,configurable:!0}),t.prototype.getInput=function(t){return this.canvases[t]||this.imageTensors[t]},t.prototype.getInputDimensions=function(t){return this._inputDimensions[t]},t.prototype.getInputHeight=function(t){return this._inputDimensions[t][0]},t.prototype.getInputWidth=function(t){return this._inputDimensions[t][1]},t.prototype.getReshapedInputDimensions=function(t){if("number"!=typeof this.inputSize)throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");return S({width:this.getInputWidth(t),height:this.getInputHeight(t)},this.inputSize)},t.prototype.toBatchTensor=function(t,e){var n=this;return void 0===e&&(e=!0),this._inputSize=t,f.tidy(function(){var r=O(n.batchSize,0,1).map(function(r){var i=n.getInput(r);if(i instanceof f.Tensor){var o=y(i)?i:i.expandDims();return(o=_t(o,e)).shape[1]===t&&o.shape[2]===t||(o=f.image.resizeBilinear(o,[t,t])),o.as3D(t,t,3)}if(i instanceof V.getEnv().Canvas)return f.browser.fromPixels(bt(i,t,e));throw new Error("toBatchTensor - at batchIdx "+r+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+i)});return f.stack(r.map(function(t){return t.toFloat()})).as4D(n.batchSize,t,t,3)})},t}();function St(t){return d.b(this,void 0,void 0,function(){var e,n,r;return d.d(this,function(i){switch(i.label){case 0:if(t instanceof kt)return[2,t];if(!(e=Array.isArray(t)?t:[t]).length)throw new Error("toNetInput - empty array passed as input");return n=function(e){return Array.isArray(t)?" at input index "+e+":":""},(r=e.map(H)).forEach(function(t,r){if(!yt(t)&&!b(t)&&!y(t)){if("string"==typeof e[r])throw new Error("toNetInput -"+n(r)+" string passed, but could not resolve HTMLElement for element id "+e[r]);throw new Error("toNetInput -"+n(r)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id")}if(y(t)){var i=t.shape[0];if(1!==i)throw new Error("toNetInput -"+n(r)+" tf.Tensor4D with batchSize "+i+" passed, but not supported in input array")}}),[4,Promise.all(r.map(function(t){return yt(t)&&ut(t)}))];case 1:return i.sent(),[2,new kt(r,Array.isArray(t))]}})})}var Et=function(){function t(t){this._name=t,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(t.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),t.prototype.getParamFromPath=function(t){var e=this.traversePropertyPath(t);return e.obj[e.objProp]},t.prototype.reassignParamFromPath=function(t,e){var n=this.traversePropertyPath(t),r=n.obj,i=n.objProp;r[i].dispose(),r[i]=e},t.prototype.getParamList=function(){var t=this;return this._paramMappings.map(function(e){var n=e.paramPath;return{path:n,tensor:t.getParamFromPath(n)}})},t.prototype.getTrainableParams=function(){return this.getParamList().filter(function(t){return t.tensor instanceof f.Variable})},t.prototype.getFrozenParams=function(){return this.getParamList().filter(function(t){return!(t.tensor instanceof f.Variable)})},t.prototype.variable=function(){var t=this;this.getFrozenParams().forEach(function(e){var n=e.path,r=e.tensor;t.reassignParamFromPath(n,r.variable())})},t.prototype.freeze=function(){var t=this;this.getTrainableParams().forEach(function(e){var n=e.path,r=e.tensor,i=f.tensor(r.dataSync());r.dispose(),t.reassignParamFromPath(n,i)})},t.prototype.dispose=function(t){void 0===t&&(t=!0),this.getParamList().forEach(function(e){if(t&&e.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+e.path);e.tensor.dispose()}),this._params=void 0},t.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(t){var e=t.tensor;return Array.from(e.dataSync())}).reduce(function(t,e){return t.concat(e)}))},t.prototype.load=function(t){return d.b(this,void 0,void 0,function(){return d.d(this,function(e){switch(e.label){case 0:return t instanceof Float32Array?(this.extractWeights(t),[2]):[4,this.loadFromUri(t)];case 1:return e.sent(),[2]}})})},t.prototype.loadFromUri=function(t){return d.b(this,void 0,void 0,function(){var e;return d.d(this,function(n){switch(n.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromUri - expected model uri");return[4,wt(t,this.getDefaultModelName())];case 1:return e=n.sent(),this.loadFromWeightMap(e),[2]}})})},t.prototype.loadFromDisk=function(t){return d.b(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l;return d.d(this,function(d){switch(d.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromDisk - expected model file path");return e=V.getEnv().readFile,n=at(t,this.getDefaultModelName()),r=n.manifestUri,i=n.modelBaseUri,o=function(t){return Promise.all(t.map(function(t){return e(t).then(function(t){return t.buffer})}))},a=f.io.weightsLoaderFactory(o),c=(u=JSON).parse,[4,e(r)];case 1:return s=c.apply(u,[d.sent().toString()]),[4,a(s,i)];case 2:return l=d.sent(),this.loadFromWeightMap(l),[2]}})})},t.prototype.loadFromWeightMap=function(t){var e=this.extractParamsFromWeigthMap(t),n=e.paramMappings,r=e.params;this._paramMappings=n,this._params=r},t.prototype.extractWeights=function(t){var e=this.extractParams(t),n=e.paramMappings,r=e.params;this._paramMappings=n,this._params=r},t.prototype.traversePropertyPath=function(t){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var e=t.split("/").reduce(function(e,n){if(!e.nextObj.hasOwnProperty(n))throw new Error("traversePropertyPath - object does not have property "+n+", for path "+t);return{obj:e.nextObj,objProp:n,nextObj:e.nextObj[n]}},{nextObj:this.params}),n=e.obj,r=e.objProp;if(!(n&&r&&n[r]instanceof f.Tensor))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+t);return{obj:n,objProp:r}},t}();function Ot(t,e,n){void 0===n&&(n=!0);var r=Math.max(0,Math.min(t.right,e.right)-Math.max(t.left,e.left))*Math.max(0,Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top));return n?r/(t.area+e.area-r):r/Math.min(t.area,e.area)}function At(t){var e=t.map(function(t){return t.x}),n=t.map(function(t){return t.y}),r=e.reduce(function(t,e){return e<t?e:t},1/0),i=n.reduce(function(t,e){return e<t?e:t},1/0),o=e.reduce(function(t,e){return t<e?e:t},0),a=n.reduce(function(t,e){return t<e?e:t},0);return new N(r,i,o,a)}function Ct(t,e,n,r){void 0===r&&(r=!0);for(var i=e.map(function(t,e){return{score:t,boxIndex:e}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.boxIndex}),o=[],a=function(){var e=i.pop();o.push(e);for(var a=i,s=[],u=0;u<a.length;u++){var c=a[u],l=t[e],f=t[c];s.push(Ot(l,f,r))}i=i.filter(function(t,e){return s[e]<=n})};i.length>0;)a();return o}function Mt(t,e){return f.tidy(function(){var n=e[0],r=e[1],i=e[2],o=f.fill(t.shape.slice(0,3).concat([1]),n),a=f.fill(t.shape.slice(0,3).concat([1]),r),s=f.fill(t.shape.slice(0,3).concat([1]),i),u=f.concat([o,a,s],3);return f.sub(t,u)})}function Nt(t){for(var e=t.slice(),n=e.length-1;n>0;n--){var r=Math.floor(Math.random()*(n+1)),i=e[n];e[n]=e[r],e[r]=i}return e}function Tt(t){return 1/(1+Math.exp(-t))}function It(t){return Math.log(t/(1-t))}var Dt,jt=function(t){return"number"==typeof t};function Rt(t){if(!t)throw new Error("invalid config: "+t);if("boolean"!=typeof t.withSeparableConvs)throw new Error("config.withSeparableConvs has to be a boolean, have: "+t.withSeparableConvs);if(!jt(t.iouThreshold)||t.iouThreshold<0||t.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+t.iouThreshold);if(!Array.isArray(t.classes)||!t.classes.length||!t.classes.every(function(t){return"string"==typeof t}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(t.classes));if(!Array.isArray(t.anchors)||!t.anchors.length||!t.anchors.map(function(t){return t||{}}).every(function(t){return jt(t.x)&&jt(t.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(t.anchors));if(t.meanRgb&&(!Array.isArray(t.meanRgb)||3!==t.meanRgb.length||!t.meanRgb.every(jt)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(t.meanRgb))}function Ft(t){return f.tidy(function(){var e=f.mul(t,f.scalar(.10000000149011612));return f.add(f.relu(f.sub(t,e)),e)})}function Pt(t,e){return f.tidy(function(){var n=f.pad(t,[[0,0],[1,1],[1,1],[0,0]]);return n=f.conv2d(n,e.conv.filters,[1,1],"valid"),n=f.sub(n,e.bn.sub),n=f.mul(n,e.bn.truediv),Ft(n=f.add(n,e.conv.bias))})}function zt(t,e){return f.tidy(function(){var n=f.pad(t,[[0,0],[1,1],[1,1],[0,0]]);return n=f.separableConv2d(n,e.depthwise_filter,e.pointwise_filter,[1,1],"valid"),Ft(n=f.add(n,e.bias))})}function Lt(t,e){var n=Q(t,e),r=nt(t,e);return{extractConvParams:n,extractConvWithBatchNormParams:function(r,i,o){return{conv:n(r,i,3,o+"/conv"),bn:function(n,r){var i=f.tensor1d(t(n)),o=f.tensor1d(t(n));return e.push({paramPath:r+"/sub"},{paramPath:r+"/truediv"}),{sub:i,truediv:o}}(i,o+"/bn")}},extractSeparableConvParams:r}}!function(t){t[t.XS=224]="XS",t[t.SM=320]="SM",t[t.MD=416]="MD",t[t.LG=608]="LG"}(Dt||(Dt={}));var Bt=function(){function t(t){var e=void 0===t?{}:t,n=e.inputSize,r=e.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=n||416,this._scoreThreshold=r||.5,"number"!=typeof this._inputSize||this._inputSize%32!=0)throw new Error(this._name+" - expected inputSize to be a number divisible by 32");if("number"!=typeof this._scoreThreshold||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(this._name+" - expected scoreThreshold to be a number between 0 and 1")}return Object.defineProperty(t.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),t}(),Ut=function(t){function e(e){var n=t.call(this,"TinyYolov2")||this;return Rt(e),n._config=e,n}return d.c(e,t),Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),e.prototype.runTinyYolov2=function(t,e){var n=Pt(t,e.conv0);return n=Pt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv1),n=Pt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv2),n=Pt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv3),n=Pt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv4),n=Pt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv5),J(n=Pt(n=Pt(n=f.maxPool(n,[2,2],[1,1],"same"),e.conv6),e.conv7),e.conv8,"valid",!1)},e.prototype.runMobilenet=function(t,e){var n=this.config.isFirstLayerConv2d?Ft(J(t,e.conv0,"valid",!1)):zt(t,e.conv0);return n=zt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv1),n=zt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv2),n=zt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv3),n=zt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv4),n=zt(n=f.maxPool(n,[2,2],[2,2],"same"),e.conv5),n=f.maxPool(n,[2,2],[1,1],"same"),n=e.conv6?zt(n,e.conv6):n,J(n=e.conv7?zt(n,e.conv7):n,e.conv8,"valid",!1)},e.prototype.forwardInput=function(t,e){var n=this,r=this.params;if(!r)throw new Error("TinyYolov2 - load model before inference");return f.tidy(function(){var i=t.toBatchTensor(e,!1).toFloat();return i=(i=n.config.meanRgb?Mt(i,n.config.meanRgb):i).div(f.scalar(256)),n.config.withSeparableConvs?n.runMobilenet(i,r):n.runTinyYolov2(i,r)})},e.prototype.forward=function(t,e){return d.b(this,void 0,void 0,function(){var n;return d.d(this,function(r){switch(r.label){case 0:return n=this.forwardInput,[4,St(t)];case 1:return[4,n.apply(this,[r.sent(),e])];case 2:return[2,r.sent()]}})})},e.prototype.detect=function(t,e){return void 0===e&&(e={}),d.b(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,l,h,p,m,g=this;return d.d(this,function(d){switch(d.label){case 0:return n=new Bt(e),r=n.inputSize,i=n.scoreThreshold,[4,St(t)];case 1:return o=d.sent(),[4,this.forwardInput(o,r)];case 2:return a=d.sent(),s=f.tidy(function(){return f.unstack(a)[0].expandDims()}),u={width:o.getInputWidth(0),height:o.getInputHeight(0)},[4,this.extractBoxes(s,o.getReshapedInputDimensions(0),i)];case 3:return c=d.sent(),a.dispose(),s.dispose(),l=c.map(function(t){return t.box}),h=c.map(function(t){return t.score}),p=c.map(function(t){return t.classScore}),m=c.map(function(t){return g.config.classes[t.label]}),[2,Ct(l.map(function(t){return t.rescale(r)}),h,this.config.iouThreshold,!0).map(function(t){return new I(h[t],p[t],m[t],l[t],u)})]}})})},e.prototype.getDefaultModelName=function(){return""},e.prototype.extractParamsFromWeigthMap=function(t){return function(t,e){var n,r=[],i=function(t,e){var n=it(t,e);function r(t){return{filters:n(t+"/filters",4),bias:n(t+"/bias",1)}}return{extractConvParams:r,extractConvWithBatchNormParams:function(t){return{conv:r(t+"/conv"),bn:function(t){return{sub:n(t+"/sub",1),truediv:n(t+"/truediv",1)}}(t+"/bn")}},extractSeparableConvParams:rt(n)}}(t,r),o=i.extractConvParams,a=i.extractConvWithBatchNormParams,s=i.extractSeparableConvParams;if(e.withSeparableConvs){var u=e.filterSizes&&e.filterSizes.length||9;n={conv0:e.isFirstLayerConv2d?o("conv0"):s("conv0"),conv1:s("conv1"),conv2:s("conv2"),conv3:s("conv3"),conv4:s("conv4"),conv5:s("conv5"),conv6:u>7?s("conv6"):void 0,conv7:u>8?s("conv7"):void 0,conv8:o("conv8")}}else n={conv0:a("conv0"),conv1:a("conv1"),conv2:a("conv2"),conv3:a("conv3"),conv4:a("conv4"),conv5:a("conv5"),conv6:a("conv6"),conv7:a("conv7"),conv8:o("conv8")};return Z(t,r),{params:n,paramMappings:r}}(t,this.config)},e.prototype.extractParams=function(t){var n=this.config.filterSizes||e.DEFAULT_FILTER_SIZES,r=n?n.length:void 0;if(7!==r&&8!==r&&9!==r)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+r+" filterSizes in config");return function(t,e,n,r){var i,o=ot(t),a=o.extractWeights,s=o.getRemainingWeights,u=[],c=Lt(a,u),l=c.extractConvParams,f=c.extractConvWithBatchNormParams,d=c.extractSeparableConvParams;if(e.withSeparableConvs){var h=r[0],p=r[1],m=r[2],g=r[3],v=r[4],b=r[5],y=r[6],w=r[7],x=r[8];i={conv0:e.isFirstLayerConv2d?l(h,p,3,"conv0"):d(h,p,"conv0"),conv1:d(p,m,"conv1"),conv2:d(m,g,"conv2"),conv3:d(g,v,"conv3"),conv4:d(v,b,"conv4"),conv5:d(b,y,"conv5"),conv6:w?d(y,w,"conv6"):void 0,conv7:x?d(w,x,"conv7"):void 0,conv8:l(x||w||y,5*n,1,"conv8")}}else h=r[0],p=r[1],m=r[2],g=r[3],v=r[4],b=r[5],y=r[6],w=r[7],x=r[8],i={conv0:f(h,p,"conv0"),conv1:f(p,m,"conv1"),conv2:f(m,g,"conv2"),conv3:f(g,v,"conv3"),conv4:f(v,b,"conv4"),conv5:f(b,y,"conv5"),conv6:f(y,w,"conv6"),conv7:f(w,x,"conv7"),conv8:l(x,5*n,1,"conv8")};if(0!==s().length)throw new Error("weights remaing after extract: "+s().length);return{params:i,paramMappings:u}}(t,this.config,this.boxEncodingSize,n)},e.prototype.extractBoxes=function(t,e,n){return d.b(this,void 0,void 0,function(){var r,i,o,a,s,u,c,l,h,p,m,g,v,b,y,w,x,_,k,S,E,O,A,C,M,T,I,D,j,R=this;return d.d(this,function(F){switch(F.label){case 0:return r=e.width,i=e.height,o=Math.max(r,i),a=o/r,s=o/i,u=t.shape[1],c=this.config.anchors.length,l=f.tidy(function(){var e=t.reshape([u,u,c,R.boxEncodingSize]);return[e.slice([0,0,0,0],[u,u,c,4]),e.slice([0,0,0,4],[u,u,c,1]),R.withClassScores?f.softmax(e.slice([0,0,0,5],[u,u,c,R.config.classes.length]),3):f.scalar(0)]}),h=l[0],p=l[1],m=l[2],g=[],[4,p.array()];case 1:return v=F.sent(),[4,h.array()];case 2:b=F.sent(),y=0,F.label=3;case 3:if(!(y<u))return[3,12];w=0,F.label=4;case 4:if(!(w<u))return[3,11];x=0,F.label=5;case 5:return x<c?(_=Tt(v[y][w][x][0]),!n||_>n?(k=(w+Tt(b[y][w][x][0]))/u*a,S=(y+Tt(b[y][w][x][1]))/u*s,E=Math.exp(b[y][w][x][2])*this.config.anchors[x].x/u*a,O=Math.exp(b[y][w][x][3])*this.config.anchors[x].y/u*s,A=k-E/2,C=S-O/2,M={row:y,col:w,anchor:x},this.withClassScores?[4,this.extractPredictedClass(m,M)]:[3,7]):[3,9]):[3,10];case 6:return j=F.sent(),[3,8];case 7:j={classScore:1,label:0},F.label=8;case 8:I=(T=j).classScore,D=T.label,g.push(d.a({box:new N(A,C,A+E,C+O),score:_,classScore:_*I,label:D},M)),F.label=9;case 9:return x++,[3,5];case 10:return w++,[3,4];case 11:return y++,[3,3];case 12:return h.dispose(),p.dispose(),m.dispose(),[2,g]}})})},e.prototype.extractPredictedClass=function(t,e){return d.b(this,void 0,void 0,function(){var n,r,i,o;return d.d(this,function(a){switch(a.label){case 0:return n=e.row,r=e.col,i=e.anchor,[4,t.array()];case 1:return o=a.sent(),[2,Array(this.config.classes.length).fill(0).map(function(t,e){return o[n][r][i][e]}).map(function(t,e){return{classScore:t,label:e}}).reduce(function(t,e){return t.classScore>e.classScore?t:e})]}})})},e.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],e}(Et);function Wt(t,e,n){if(void 0===n&&(n=!1),t.beginPath(),e.slice(1).forEach(function(n,r){var i=n.x,o=n.y,a=e[r];t.moveTo(a.x,a.y),t.lineTo(i,o)}),n){var r=e[e.length-1],i=e[0];if(!r||!i)return;t.moveTo(r.x,r.y),t.lineTo(i.x,i.y)}t.stroke()}var qt=function(t){function e(e,n,r){return t.call(this,e,e,"",n,r)||this}return s(e,t),e.prototype.forSize=function(n,r){var i=t.prototype.forSize.call(this,n,r);return new e(i.score,i.relativeBox,i.imageDims)},e}(I);function Vt(t){return t.detection instanceof qt}function Ht(t,e){var n={detection:e};return Object.assign({},t,n)}function $t(t,e){(Array.isArray(e)?e:[e]).forEach(function(e){var n=e instanceof qt?e.score:Vt(e)?e.detection.score:void 0,i=e instanceof qt?e.box:Vt(e)?e.detection.box:new M(e),o=n?""+_(n):void 0;new r.DrawBox(i,{label:o}).draw(t)})}function Gt(t,e,n){return f.tidy(function(){var r=f.separableConv2d(t,e.depthwise_filter,e.pointwise_filter,n,"same");return f.add(r,e.bias)})}function Kt(t,e,n){return void 0===n&&(n=!1),f.tidy(function(){var r=f.relu(n?f.add(f.conv2d(t,e.conv0.filters,[2,2],"same"),e.conv0.bias):Gt(t,e.conv0,[2,2])),i=Gt(r,e.conv1,[1,1]),o=Gt(f.relu(f.add(r,i)),e.conv2,[1,1]);return f.relu(f.add(r,f.add(i,o)))})}function Xt(t,e,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!0),f.tidy(function(){var i=f.relu(n?f.add(f.conv2d(t,e.conv0.filters,r?[2,2]:[1,1],"same"),e.conv0.bias):Gt(t,e.conv0,r?[2,2]:[1,1])),o=Gt(i,e.conv1,[1,1]),a=Gt(f.relu(f.add(i,o)),e.conv2,[1,1]),s=Gt(f.relu(f.add(i,f.add(o,a))),e.conv3,[1,1]);return f.relu(f.add(i,f.add(o,f.add(a,s))))})}function Yt(t,e){var n=i.extractConvParamsFactory(t,e),r=i.extractSeparableConvParamsFactory(t,e);function o(t,e,i,o){return void 0===o&&(o=!1),{conv0:o?n(t,e,3,i+"/conv0"):r(t,e,i+"/conv0"),conv1:r(e,e,i+"/conv1"),conv2:r(e,e,i+"/conv2")}}return{extractDenseBlock3Params:o,extractDenseBlock4Params:function(t,e,n,i){void 0===i&&(i=!1);var a=o(t,e,n,i);return{conv0:a.conv0,conv1:a.conv1,conv2:a.conv2,conv3:r(e,e,n+"/conv3")}}}}function Jt(t){return function(e){return{filters:t(e+"/filters",4),bias:t(e+"/bias",1)}}}function Zt(t,e){var n=i.extractWeightEntryFactory(t,e),r=Jt(n),o=i.loadSeparableConvParamsFactory(n);return{extractDenseBlock3Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):o(t+"/conv0"),conv1:o(t+"/conv1"),conv2:o(t+"/conv2")}},extractDenseBlock4Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):o(t+"/conv0"),conv1:o(t+"/conv1"),conv2:o(t+"/conv2"),conv3:o(t+"/conv3")}}}}var Qt=function(t){function e(){return t.call(this,"FaceFeatureExtractor")||this}return s(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceFeatureExtractor - load model before inference");return f.tidy(function(){var n=Xt(Mt(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(f.scalar(255)),e.dense0,!0);return n=Xt(n=Xt(n=Xt(n,e.dense1),e.dense2),e.dense3),f.avgPool(n,[7,7],[2,2],"valid")})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=Zt(t,e).extractDenseBlock4Params,r={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2"),dense3:n("dense3")};return i.disposeUnusedWeightTensors(t,e),{params:r,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=i.extractWeightsFactory(t),r=n.extractWeights,o=n.getRemainingWeights,a=Yt(r,e).extractDenseBlock4Params,s=a(3,32,"dense0",!0),u=a(32,64,"dense1"),c=a(64,128,"dense2"),l=a(128,256,"dense3");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{dense0:s,dense1:u,dense2:c,dense3:l}}}(t)},e}(Et);function te(t,e){return f.tidy(function(){return f.add(f.matMul(t,e.weights),e.bias)})}function ee(t){var e={},n={};return Object.keys(t).forEach(function(r){(r.startsWith("fc")?n:e)[r]=t[r]}),{featureExtractorMap:e,classifierMap:n}}var ne=function(t){function e(e,n){var r=t.call(this,e)||this;return r._faceFeatureExtractor=n,r}return s(e,t),Object.defineProperty(e.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),e.prototype.runNet=function(t){var e=this,n=this.params;if(!n)throw new Error(this._name+" - load model before inference");return f.tidy(function(){var r=t instanceof kt?e.faceFeatureExtractor.forwardInput(t):t;return te(r.as2D(r.shape[0],-1),n.fc)})},e.prototype.dispose=function(e){void 0===e&&(e=!0),this.faceFeatureExtractor.dispose(e),t.prototype.dispose.call(this,e)},e.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,r=e.paramMappings;this._params=n,this._paramMappings=r},e.prototype.extractClassifierParams=function(t){return function(t,e,n){var r=[],o=i.extractWeightsFactory(t),a=o.extractWeights,s=o.getRemainingWeights,u=i.extractFCParamsFactory(a,r)(e,n,"fc");if(0!==s().length)throw new Error("weights remaing after extract: "+s().length);return{paramMappings:r,params:{fc:u}}}(t,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},e.prototype.extractParamsFromWeigthMap=function(t){var e=ee(t),n=e.featureExtractorMap,r=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e=[],n=i.extractWeightEntryFactory(t,e),r={fc:{weights:n("fc/weights",2),bias:n("fc/bias",1)}};return i.disposeUnusedWeightTensors(t,e),{params:r,paramMappings:e}}(r)},e.prototype.extractParams=function(t){var e=this.getClassifierChannelsIn(),n=this.getClassifierChannelsOut(),r=n*e+n,i=t.slice(0,t.length-r),o=t.slice(t.length-r);return this.faceFeatureExtractor.extractWeights(i),this.extractClassifierParams(o)},e}(Et),re=["neutral","happy","sad","angry","fearful","disgusted","surprised"],ie=function(){function t(t){var e=this;if(7!==t.length)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+t.length);re.forEach(function(n,r){e[n]=t[r]})}return t.prototype.asSortedArray=function(){var t=this;return re.map(function(e){return{expression:e,probability:t[e]}}).sort(function(t,e){return e.probability-t.probability})},t}(),oe=function(t){function e(e){return void 0===e&&(e=new Qt),t.call(this,"FaceExpressionNet",e)||this}return s(e,t),e.prototype.forwardInput=function(t){var e=this;return f.tidy(function(){return f.softmax(e.runNet(t))})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.predictExpressions=function(t){return c(this,void 0,void 0,function(){var e,n,r,i,o=this;return l(this,function(a){switch(a.label){case 0:return[4,St(t)];case 1:return e=a.sent(),[4,this.forwardInput(e)];case 2:return n=a.sent(),[4,Promise.all(f.unstack(n).map(function(t){return c(o,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return[4,t.data()];case 1:return e=n.sent(),t.dispose(),[2,e]}})})}))];case 3:return r=a.sent(),n.dispose(),i=r.map(function(t){return new ie(t)}),[2,e.isBatchInput?i:i[0]]}})})},e.prototype.getDefaultModelName=function(){return"face_expression_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e.prototype.getClassifierChannelsOut=function(){return 7},e}(ne);function ae(t){return t.expressions instanceof ie}function se(t,e){var n={expressions:e};return Object.assign({},t,n)}function ue(t,e,n,i){void 0===n&&(n=.1),(Array.isArray(e)?e:[e]).forEach(function(e){var o=e instanceof ie?e:ae(e)?e.expressions:void 0;if(!o)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var a=o.asSortedArray().filter(function(t){return t.probability>n}),s=Vt(e)?e.detection.box.bottomLeft:i||new p(0,0);new r.DrawTextField(a.map(function(t){return t.expression+" ("+_(t.probability)+")"}),s).draw(t)})}var ce=function(){function t(t,e,n){void 0===n&&(n=new p(0,0));var r=e.width,i=e.height;this._imgDims=new h(r,i),this._shift=n,this._positions=t.map(function(t){return t.mul(new p(r,i)).add(n)})}return Object.defineProperty(t.prototype,"shift",{get:function(){return new p(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativePositions",{get:function(){var t=this;return this._positions.map(function(e){return e.sub(t._shift).div(new p(t.imageWidth,t.imageHeight))})},enumerable:!0,configurable:!0}),t.prototype.forSize=function(t,e){return new this.constructor(this.relativePositions,{width:t,height:e})},t.prototype.shiftBy=function(t,e){return new this.constructor(this.relativePositions,this._imgDims,new p(t,e))},t.prototype.shiftByPoint=function(t){return this.shiftBy(t.x,t.y)},t.prototype.align=function(t,e){if(void 0===e&&(e={}),t){var n=t instanceof qt?t.box.floor():new M(t);return this.shiftBy(n.x,n.y).align(null,e)}var r=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},e),i=r.useDlibAlignment,o=r.minBoxPadding;return i?this.alignDlib():this.alignMinBbox(o)},t.prototype.alignDlib=function(){var t=this.getRefPointsForAlignment(),e=t[0],n=t[1],r=t[2],i=function(t){return r.sub(t).magnitude()},o=(i(e)+i(n))/2,a=Math.floor(o/.45),s=E(t),u=Math.floor(Math.max(0,s.x-.5*a)),c=Math.floor(Math.max(0,s.y-.43*a));return new j(u,c,Math.min(a,this.imageWidth+u),Math.min(a,this.imageHeight+c))},t.prototype.alignMinBbox=function(t){var e=function(t){var e=t.map(function(t){return t.x}),n=t.map(function(t){return t.y}),r=e.reduce(function(t,e){return e<t?e:t},1/0),i=n.reduce(function(t,e){return e<t?e:t},1/0),o=e.reduce(function(t,e){return t<e?e:t},0),a=n.reduce(function(t,e){return t<e?e:t},0);return new N(r,i,o,a)}(this.positions);return e.pad(e.width*t,e.height*t)},t.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},t}(),le=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.getJawOutline=function(){return this.positions.slice(0,17)},e.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},e.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},e.prototype.getNose=function(){return this.positions.slice(27,36)},e.prototype.getLeftEye=function(){return this.positions.slice(36,42)},e.prototype.getRightEye=function(){return this.positions.slice(42,48)},e.prototype.getMouth=function(){return this.positions.slice(48,68)},e.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(E)},e}(ce);function fe(t){return Vt(t)&&t.landmarks instanceof ce&&t.unshiftedLandmarks instanceof ce&&t.alignedRect instanceof qt}function de(t,e){var n=t.detection.box,r=e.shiftBy(n.x,n.y),i=r.align(),o=t.detection.imageDims,a={landmarks:r,unshiftedLandmarks:e,alignedRect:new qt(t.detection.score,i.rescale(o.reverse()),o)};return Object.assign({},t,a)}var he=function(t){void 0===t&&(t={});var e=t.drawLines,n=void 0===e||e,r=t.drawPoints,i=void 0===r||r,o=t.lineWidth,a=t.lineColor,s=t.pointSize,u=t.pointColor;this.drawLines=n,this.drawPoints=i,this.lineWidth=o||1,this.pointSize=s||2,this.lineColor=a||"rgba(0, 255, 255, 1)",this.pointColor=u||"rgba(255, 0, 255, 1)"},pe=function(){function t(t,e){void 0===e&&(e={}),this.faceLandmarks=t,this.options=new he(e)}return t.prototype.draw=function(t){var e=$(t),n=this.options,r=n.drawLines,i=n.drawPoints,o=n.lineWidth,a=n.lineColor,s=n.pointSize,u=n.pointColor;r&&this.faceLandmarks instanceof le&&(e.strokeStyle=a,e.lineWidth=o,Wt(e,this.faceLandmarks.getJawOutline()),Wt(e,this.faceLandmarks.getLeftEyeBrow()),Wt(e,this.faceLandmarks.getRightEyeBrow()),Wt(e,this.faceLandmarks.getNose()),Wt(e,this.faceLandmarks.getLeftEye(),!0),Wt(e,this.faceLandmarks.getRightEye(),!0),Wt(e,this.faceLandmarks.getMouth(),!0)),i&&(e.strokeStyle=u,e.fillStyle=u,this.faceLandmarks.positions.forEach(function(t){e.beginPath(),e.arc(t.x,t.y,s,0,2*Math.PI),e.fill()}))},t}();function me(t,e){(Array.isArray(e)?e:[e]).forEach(function(e){var n=e instanceof ce?e:fe(e)?e.landmarks:void 0;if(!n)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new pe(n).draw(t)})}function ge(t,e,n){return f.add(f.conv2d(t,e.filters,n,"same"),e.bias)}function ve(t,e,n){void 0===n&&(n=!0);var r=n?f.relu(t):t;return r=Gt(r,e.separable_conv0,[1,1]),r=Gt(f.relu(r),e.separable_conv1,[1,1]),r=f.maxPool(r,[3,3],[2,2],"same"),f.add(r,ge(t,e.expansion_conv,[2,2]))}var be,ye=function(t){function e(e){var n=t.call(this,"TinyXception")||this;return n._numMainBlocks=e,n}return s(e,t),e.prototype.forwardInput=function(t){var e=this,n=this.params;if(!n)throw new Error("TinyXception - load model before inference");return f.tidy(function(){var r=Mt(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(f.scalar(256)),i=f.relu(ge(r,n.entry_flow.conv_in,[2,2]));return i=ve(i=ve(i,n.entry_flow.reduction_block_0,!1),n.entry_flow.reduction_block_1),O(e._numMainBlocks,0,1).forEach(function(t){i=function(t,e){var n=Gt(f.relu(t),e.separable_conv0,[1,1]);return n=Gt(f.relu(n),e.separable_conv1,[1,1]),n=Gt(f.relu(n),e.separable_conv2,[1,1]),f.add(n,t)}(i,n.middle_flow["main_block_"+t])}),i=ve(i,n.exit_flow.reduction_block),i=f.relu(Gt(i,n.exit_flow.separable_conv,[1,1]))})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"tiny_xception_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t,e){var n=[],r=function(t,e){var n=i.extractWeightEntryFactory(t,e),r=Jt(n),o=i.loadSeparableConvParamsFactory(n);return{extractConvParams:r,extractSeparableConvParams:o,extractReductionBlockParams:function(t){return{separable_conv0:o(t+"/separable_conv0"),separable_conv1:o(t+"/separable_conv1"),expansion_conv:r(t+"/expansion_conv")}},extractMainBlockParams:function(t){return{separable_conv0:o(t+"/separable_conv0"),separable_conv1:o(t+"/separable_conv1"),separable_conv2:o(t+"/separable_conv2")}}}}(t,n),o=r.extractConvParams,a=r.extractSeparableConvParams,s=r.extractReductionBlockParams,u=r.extractMainBlockParams,c={conv_in:o("entry_flow/conv_in"),reduction_block_0:s("entry_flow/reduction_block_0"),reduction_block_1:s("entry_flow/reduction_block_1")},l={};O(e,0,1).forEach(function(t){l["main_block_"+t]=u("middle_flow/main_block_"+t)});var f={reduction_block:s("exit_flow/reduction_block"),separable_conv:a("exit_flow/separable_conv")};return i.disposeUnusedWeightTensors(t,n),{params:{entry_flow:c,middle_flow:l,exit_flow:f},paramMappings:n}}(t,this._numMainBlocks)},e.prototype.extractParams=function(t){return function(t,e){var n=[],r=i.extractWeightsFactory(t),o=r.extractWeights,a=r.getRemainingWeights,s=function(t,e){var n=i.extractConvParamsFactory(t,e),r=i.extractSeparableConvParamsFactory(t,e);return{extractConvParams:n,extractSeparableConvParams:r,extractReductionBlockParams:function(t,e,i){return{separable_conv0:r(t,e,i+"/separable_conv0"),separable_conv1:r(e,e,i+"/separable_conv1"),expansion_conv:n(t,e,1,i+"/expansion_conv")}},extractMainBlockParams:function(t,e){return{separable_conv0:r(t,t,e+"/separable_conv0"),separable_conv1:r(t,t,e+"/separable_conv1"),separable_conv2:r(t,t,e+"/separable_conv2")}}}}(o,n),u=s.extractConvParams,c=s.extractSeparableConvParams,l=s.extractReductionBlockParams,f=s.extractMainBlockParams,d={conv_in:u(3,32,3,"entry_flow/conv_in"),reduction_block_0:l(32,64,"entry_flow/reduction_block_0"),reduction_block_1:l(64,128,"entry_flow/reduction_block_1")},h={};O(e,0,1).forEach(function(t){h["main_block_"+t]=f(128,"middle_flow/main_block_"+t)});var p={reduction_block:l(128,256,"exit_flow/reduction_block"),separable_conv:c(256,512,"exit_flow/separable_conv")};if(0!==a().length)throw new Error("weights remaing after extract: "+a().length);return{paramMappings:n,params:{entry_flow:d,middle_flow:h,exit_flow:p}}}(t,this._numMainBlocks)},e}(Et);!function(t){t.FEMALE="female",t.MALE="male"}(be||(be={}));var we=function(t){function e(e){void 0===e&&(e=new ye(2));var n=t.call(this,"AgeGenderNet")||this;return n._faceFeatureExtractor=e,n}return s(e,t),Object.defineProperty(e.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),e.prototype.runNet=function(t){var e=this,n=this.params;if(!n)throw new Error(this._name+" - load model before inference");return f.tidy(function(){var r=t instanceof kt?e.faceFeatureExtractor.forwardInput(t):t,i=f.avgPool(r,[7,7],[2,2],"valid").as2D(r.shape[0],-1);return{age:te(i,n.fc.age).as1D(),gender:te(i,n.fc.gender)}})},e.prototype.forwardInput=function(t){var e=this;return f.tidy(function(){var n=e.runNet(t),r=n.age,i=n.gender;return{age:r,gender:f.softmax(i)}})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.predictAgeAndGender=function(t){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s=this;return l(this,function(u){switch(u.label){case 0:return[4,St(t)];case 1:return e=u.sent(),[4,this.forwardInput(e)];case 2:return n=u.sent(),r=f.unstack(n.age),i=f.unstack(n.gender),o=r.map(function(t,e){return{ageTensor:t,genderTensor:i[e]}}),[4,Promise.all(o.map(function(t){var e=t.ageTensor,n=t.genderTensor;return c(s,void 0,void 0,function(){var t,r,i,o,a;return l(this,function(s){switch(s.label){case 0:return[4,e.data()];case 1:return t=s.sent()[0],[4,n.data()];case 2:return r=s.sent()[0],o=(i=r>.5)?be.MALE:be.FEMALE,a=i?r:1-r,e.dispose(),n.dispose(),[2,{age:t,gender:o,genderProbability:a}]}})})}))];case 3:return a=u.sent(),n.age.dispose(),n.gender.dispose(),[2,e.isBatchInput?a:a[0]]}})})},e.prototype.getDefaultModelName=function(){return"age_gender_model"},e.prototype.dispose=function(e){void 0===e&&(e=!0),this.faceFeatureExtractor.dispose(e),t.prototype.dispose.call(this,e)},e.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,r=e.paramMappings;this._params=n,this._paramMappings=r},e.prototype.extractClassifierParams=function(t){return function(t){var e=[],n=i.extractWeightsFactory(t),r=n.extractWeights,o=n.getRemainingWeights,a=i.extractFCParamsFactory(r,e),s=a(512,1,"fc/age"),u=a(512,2,"fc/gender");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{fc:{age:s,gender:u}}}}(t)},e.prototype.extractParamsFromWeigthMap=function(t){var e=ee(t),n=e.featureExtractorMap,r=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e=[],n=i.extractWeightEntryFactory(t,e);function r(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}var o={fc:{age:r("fc/age"),gender:r("fc/gender")}};return i.disposeUnusedWeightTensors(t,e),{params:o,paramMappings:e}}(r)},e.prototype.extractParams=function(t){var e=t.slice(0,t.length-1539),n=t.slice(t.length-1539);return this.faceFeatureExtractor.extractWeights(e),this.extractClassifierParams(n)},e}(Et),xe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.getRefPointsForAlignment=function(){var t=this.positions;return[t[0],t[1],E([t[3],t[4]])]},e}(ce),_e=function(){function t(t,e){this._label=t,this._distance=e}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){return void 0===t&&(t=!0),this.label+(t?" ("+_(this.distance)+")":"")},t}(),ke=function(){function t(t,e){if("string"!=typeof t)throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(e)||e.some(function(t){return!(t instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=t,this._descriptors=e}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),t}();function Se(t,e){return c(this,void 0,void 0,function(){var n,r,i,o,a,s;return l(this,function(u){switch(u.label){case 0:return n=V.getEnv().Canvas,r=t,t instanceof n?[3,5]:[4,St(t)];case 1:if((i=u.sent()).batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return(o=i.getInput(0))instanceof n?(a=o,[3,4]):[3,2];case 2:return[4,vt(o)];case 3:a=u.sent(),u.label=4;case 4:r=a,u.label=5;case 5:return s=$(r),[2,e.map(function(t){return t instanceof qt?t.forSize(r.width,r.height).box.floor():t}).map(function(t){return t.clipAtImageBorders(r.width,r.height)}).map(function(t){var e=t.x,n=t.y,r=t.width,i=t.height,o=ft({width:r,height:i});return $(o).putImageData(s.getImageData(e,n,r,i),0,0),o})]}})})}function Ee(t,e){return c(this,void 0,void 0,function(){return l(this,function(n){if(!b(t)&&!y(t))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(y(t)&&t.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,f.tidy(function(){var n=t.shape.slice(y(t)?1:0),r=n[0],i=n[1],o=n[2];return e.map(function(t){return t instanceof qt?t.forSize(i,r).box:t}).map(function(t){return t.clipAtImageBorders(i,r)}).map(function(e){var n=e.x,a=e.y,s=e.width,u=e.height;return f.slice3d(t.as3D(r,i,o),[a,n,0],[u,s,o])})})]})})}var Oe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.postProcess=function(t,e,n){var r=n.map(function(t){var n=t.width,r=t.height,i=e/Math.max(r,n);return{width:n*i,height:r*i}}),i=r.length;return f.tidy(function(){var n=function(t,e){return f.stack([f.fill([68],t),f.fill([68],e)],1).as2D(1,136).as1D()},o=function(t,e){var n=r[t],i=n.width,o=n.height;return e(i,o)?Math.abs(i-o)/2:0};return t.mul(f.fill([i,136],e)).sub(f.stack(Array.from(Array(i),function(t,e){return n(o(e,function(t,e){return t<e}),o(e,function(t,e){return e<t}))}))).div(f.stack(Array.from(Array(i),function(t,e){return n(r[e].width,r[e].height)})))})},e.prototype.forwardInput=function(t){var e=this;return f.tidy(function(){var n=e.runNet(t);return e.postProcess(n,t.inputSize,t.inputDimensions.map(function(t){return{height:t[0],width:t[1]}}))})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.detectLandmarks=function(t){return c(this,void 0,void 0,function(){var e,n,r,i=this;return l(this,function(o){switch(o.label){case 0:return[4,St(t)];case 1:return e=o.sent(),n=f.tidy(function(){return f.unstack(i.forwardInput(e))}),[4,Promise.all(n.map(function(t,n){return c(i,void 0,void 0,function(){var r,i,o,a,s;return l(this,function(u){switch(u.label){case 0:return o=(i=Array).from,[4,t.data()];case 1:return r=o.apply(i,[u.sent()]),a=r.filter(function(t,e){return x(e)}),s=r.filter(function(t,e){return!x(e)}),[2,new le(Array(68).fill(0).map(function(t,e){return new p(a[e],s[e])}),{height:e.getInputHeight(n),width:e.getInputWidth(n)})]}})})}))];case 2:return r=o.sent(),n.forEach(function(t){return t.dispose()}),[2,e.isBatchInput?r:r[0]]}})})},e.prototype.getClassifierChannelsOut=function(){return 136},e}(ne),Ae=function(t){function e(e){return void 0===e&&(e=new Qt),t.call(this,"FaceLandmark68Net",e)||this}return s(e,t),e.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e}(Oe),Ce=function(t){function e(){return t.call(this,"TinyFaceFeatureExtractor")||this}return s(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("TinyFaceFeatureExtractor - load model before inference");return f.tidy(function(){var n=Kt(Mt(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(f.scalar(255)),e.dense0,!0);return n=Kt(n=Kt(n,e.dense1),e.dense2),f.avgPool(n,[14,14],[2,2],"valid")})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=Zt(t,e).extractDenseBlock3Params,r={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2")};return i.disposeUnusedWeightTensors(t,e),{params:r,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=i.extractWeightsFactory(t),r=n.extractWeights,o=n.getRemainingWeights,a=Yt(r,e).extractDenseBlock3Params,s=a(3,32,"dense0",!0),u=a(32,64,"dense1"),c=a(64,128,"dense2");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{dense0:s,dense1:u,dense2:c}}}(t)},e}(Et),Me=function(t){function e(e){return void 0===e&&(e=new Ce),t.call(this,"FaceLandmark68TinyNet",e)||this}return s(e,t),e.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},e.prototype.getClassifierChannelsIn=function(){return 128},e}(Oe),Ne=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(Ae);function Te(t,e,n,r,i){void 0===i&&(i="same");var o=e.conv,a=o.filters,s=o.bias,u=f.conv2d(t,a,n,i);return u=function(t,e){return f.add(f.mul(t,e.weights),e.biases)}(u=f.add(u,s),e.scale),r?f.relu(u):u}function Ie(t,e){return Te(t,e,[1,1],!1)}function De(t,e){return Te(t,e,[2,2],!0,"valid")}function je(t,e){function n(n,r,i,o){return{conv:function(n,r,i,o){var a=function(e,n,r){var i=t(e),o=i.length/(n*r*r);if(w(o))throw new Error("depth has to be an integer: "+o+", weights.length: "+i.length+", numFilters: "+n+", filterSize: "+r);return f.tidy(function(){return f.transpose(f.tensor4d(i,[n,o,r,r]),[2,3,1,0])})}(n,r,i),s=f.tensor1d(t(r));return e.push({paramPath:o+"/filters"},{paramPath:o+"/bias"}),{filters:a,bias:s}}(n,r,i,o+"/conv"),scale:function(n,r){var i=f.tensor1d(t(n)),o=f.tensor1d(t(n));return e.push({paramPath:r+"/weights"},{paramPath:r+"/biases"}),{weights:i,biases:o}}(r,o+"/scale")}}return{extractConvLayerParams:n,extractResidualLayerParams:function(t,e,r,i,o){return void 0===o&&(o=!1),{conv1:n((o?.5:1)*t,e,r,i+"/conv1"),conv2:n(t,e,r,i+"/conv2")}}}}function Re(t,e){var n=function(t,e){return Te(t,e,[1,1],!0)}(t,e.conv1);return n=Ie(n,e.conv2),n=f.add(n,t),f.relu(n)}function Fe(t,e){var n=De(t,e.conv1);n=Ie(n,e.conv2);var r=f.avgPool(t,2,2,"valid"),i=f.zeros(r.shape),o=r.shape[3]!==n.shape[3];if(r.shape[1]!==n.shape[1]||r.shape[2]!==n.shape[2]){var a=n.shape.slice();a[1]=1;var s=f.zeros(a),u=(n=f.concat([n,s],1)).shape.slice();u[2]=1;var c=f.zeros(u);n=f.concat([n,c],2)}return r=o?f.concat([r,i],3):r,n=f.add(r,n),f.relu(n)}var Pe=function(t){function e(){return t.call(this,"FaceRecognitionNet")||this}return s(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceRecognitionNet - load model before inference");return f.tidy(function(){var n=De(Mt(t.toBatchTensor(150,!0).toFloat(),[122.782,117.001,104.298]).div(f.scalar(256)),e.conv32_down),r=(n=Fe(n=Re(n=Re(n=Fe(n=Re(n=Re(n=Fe(n=Re(n=Re(n=Re(n=Fe(n=Re(n=Re(n=Re(n=f.maxPool(n,3,2,"valid"),e.conv32_1),e.conv32_2),e.conv32_3),e.conv64_down),e.conv64_1),e.conv64_2),e.conv64_3),e.conv128_down),e.conv128_1),e.conv128_2),e.conv256_down),e.conv256_1),e.conv256_2),e.conv256_down_out)).mean([1,2]);return f.matMul(r,e.fc)})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.computeFaceDescriptor=function(t){return c(this,void 0,void 0,function(){var e,n,r,i=this;return l(this,function(o){switch(o.label){case 0:return[4,St(t)];case 1:return e=o.sent(),n=f.tidy(function(){return f.unstack(i.forwardInput(e))}),[4,Promise.all(n.map(function(t){return t.data()}))];case 2:return r=o.sent(),n.forEach(function(t){return t.dispose()}),[2,e.isBatchInput?r:r[0]]}})})},e.prototype.getDefaultModelName=function(){return"face_recognition_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=function(t,e){var n=i.extractWeightEntryFactory(t,e);function r(t){return{conv:{filters:n(t+"/conv/filters",4),bias:n(t+"/conv/bias",1)},scale:function(t){return{weights:n(t+"/scale/weights",1),biases:n(t+"/scale/biases",1)}}(t)}}return{extractConvLayerParams:r,extractResidualLayerParams:function(t){return{conv1:r(t+"/conv1"),conv2:r(t+"/conv2")}}}}(t,e),r=n.extractConvLayerParams,o=n.extractResidualLayerParams,a=r("conv32_down"),s=o("conv32_1"),u=o("conv32_2"),c=o("conv32_3"),l=o("conv64_down"),f=o("conv64_1"),d=o("conv64_2"),h=o("conv64_3"),p=o("conv128_down"),m=o("conv128_1"),g=o("conv128_2"),b=o("conv256_down"),y=o("conv256_1"),w=o("conv256_2"),x=o("conv256_down_out"),_=t.fc;if(e.push({originalPath:"fc",paramPath:"fc"}),!v(_))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+_);var k={conv32_down:a,conv32_1:s,conv32_2:u,conv32_3:c,conv64_down:l,conv64_1:f,conv64_2:d,conv64_3:h,conv128_down:p,conv128_1:m,conv128_2:g,conv256_down:b,conv256_1:y,conv256_2:w,conv256_down_out:x,fc:_};return i.disposeUnusedWeightTensors(t,e),{params:k,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=i.extractWeightsFactory(t),n=e.extractWeights,r=e.getRemainingWeights,o=[],a=je(n,o),s=a.extractConvLayerParams,u=a.extractResidualLayerParams,c=s(4704,32,7,"conv32_down"),l=u(9216,32,3,"conv32_1"),d=u(9216,32,3,"conv32_2"),h=u(9216,32,3,"conv32_3"),p=u(36864,64,3,"conv64_down",!0),m=u(36864,64,3,"conv64_1"),g=u(36864,64,3,"conv64_2"),v=u(36864,64,3,"conv64_3"),b=u(147456,128,3,"conv128_down",!0),y=u(147456,128,3,"conv128_1"),w=u(147456,128,3,"conv128_2"),x=u(589824,256,3,"conv256_down",!0),_=u(589824,256,3,"conv256_1"),k=u(589824,256,3,"conv256_2"),S=u(589824,256,3,"conv256_down_out"),E=f.tidy(function(){return f.transpose(f.tensor2d(n(32768),[128,256]),[1,0])});if(o.push({paramPath:"fc"}),0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{conv32_down:c,conv32_1:l,conv32_2:d,conv32_3:h,conv64_down:p,conv64_1:m,conv64_2:g,conv64_3:v,conv128_down:b,conv128_1:y,conv128_2:w,conv256_down:x,conv256_1:_,conv256_2:k,conv256_down_out:S,fc:E},paramMappings:o}}(t)},e}(Et);function ze(t){var e=new Pe;return e.extractWeights(t),e}function Le(t,e){var n={descriptor:e};return Object.assign({},t,n)}var Be=function(){function t(t){var e=void 0===t?{}:t,n=e.minFaceSize,r=e.scaleFactor,i=e.maxNumScales,o=e.scoreThresholds,a=e.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=n||20,this._scaleFactor=r||.709,this._maxNumScales=i||10,this._scoreThresholds=o||[.6,.7,.7],this._scaleSteps=a,"number"!=typeof this._minFaceSize||this._minFaceSize<0)throw new Error(this._name+" - expected minFaceSize to be a number > 0");if("number"!=typeof this._scaleFactor||this._scaleFactor<=0||this._scaleFactor>=1)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if("number"!=typeof this._maxNumScales||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||3!==this._scoreThresholds.length||this._scoreThresholds.some(function(t){return"number"!=typeof t}))throw new Error(this._name+" - expected scoreThresholds to be an array of numbers of length 3");if(this._scaleSteps&&(!Array.isArray(this._scaleSteps)||this._scaleSteps.some(function(t){return"number"!=typeof t})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(t.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),t}();function Ue(t,e,n){return f.tidy(function(){var r=f.conv2d(t,e.filters,n,"same");return r=f.add(r,e.batch_norm_offset),f.clipByValue(r,0,6)})}var We=.0010000000474974513;function qe(t,e,n){var r=t.arraySync(),i=Math.min(r[e][0],r[e][2]),o=Math.min(r[e][1],r[e][3]),a=Math.max(r[e][0],r[e][2]),s=Math.max(r[e][1],r[e][3]),u=Math.min(r[n][0],r[n][2]),c=Math.min(r[n][1],r[n][3]),l=Math.max(r[n][0],r[n][2]),f=Math.max(r[n][1],r[n][3]),d=(a-i)*(s-o),h=(l-u)*(f-c);if(d<=0||h<=0)return 0;var p=Math.max(i,u),m=Math.max(o,c),g=Math.min(a,l),v=Math.min(s,f),b=Math.max(g-p,0)*Math.max(v-m,0);return b/(d+h-b)}function Ve(t,e){return f.tidy(function(){var n=t.shape[0];return{boxPredictionEncoding:f.reshape(i.convLayer(t,e.box_encoding_predictor),[n,-1,1,4]),classPrediction:f.reshape(i.convLayer(t,e.class_predictor),[n,-1,3])}})}var He=function(){function t(t){var e=void 0===t?{}:t,n=e.minConfidence,r=e.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=n||.5,this._maxResults=r||100,"number"!=typeof this._minConfidence||this._minConfidence<=0||this._minConfidence>=1)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if("number"!=typeof this._maxResults)throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(t.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),t}(),$e=function(t){function e(){return t.call(this,"SsdMobilenetv1")||this}return s(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("SsdMobilenetv1 - load model before inference");return f.tidy(function(){var n=t.toBatchTensor(512,!1).toFloat(),r=function(t,e){return f.tidy(function(){var n=null,r=Ue(t,e.conv_0,[2,2]);if([e.conv_1,e.conv_2,e.conv_3,e.conv_4,e.conv_5,e.conv_6,e.conv_7,e.conv_8,e.conv_9,e.conv_10,e.conv_11,e.conv_12,e.conv_13].forEach(function(t,e){var i=e+1,o=function(t){return[2,4,6,12].some(function(e){return e===t})?[2,2]:[1,1]}(i);r=Ue(r=function(t,e,n){return f.tidy(function(){var r=f.depthwiseConv2d(t,e.filters,n,"same");return r=f.batchNorm(r,e.batch_norm_mean,e.batch_norm_variance,e.batch_norm_offset,e.batch_norm_scale,We),f.clipByValue(r,0,6)})}(r,t.depthwise_conv,o),t.pointwise_conv,[1,1]),11===i&&(n=r)}),null===n)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:r,conv11:n}})}(f.sub(f.mul(n,f.scalar(.007843137718737125)),f.scalar(1)),e.mobilenetv1),i=function(t,e,n){return f.tidy(function(){var r=Ue(Ue(t,n.conv_0,[1,1]),n.conv_1,[2,2]),i=Ue(Ue(r,n.conv_2,[1,1]),n.conv_3,[2,2]),o=Ue(Ue(i,n.conv_4,[1,1]),n.conv_5,[2,2]),a=Ue(Ue(o,n.conv_6,[1,1]),n.conv_7,[2,2]),s=Ve(e,n.box_predictor_0),u=Ve(t,n.box_predictor_1),c=Ve(r,n.box_predictor_2),l=Ve(i,n.box_predictor_3),d=Ve(o,n.box_predictor_4),h=Ve(a,n.box_predictor_5);return{boxPredictions:f.concat([s.boxPredictionEncoding,u.boxPredictionEncoding,c.boxPredictionEncoding,l.boxPredictionEncoding,d.boxPredictionEncoding,h.boxPredictionEncoding],1),classPredictions:f.concat([s.classPrediction,u.classPrediction,c.classPrediction,l.classPrediction,d.classPrediction,h.classPrediction],1)}})}(r.out,r.conv11,e.prediction_layer);return function(t,e,n){return f.tidy(function(){var r=t.shape[0],i=function(t,e){var n=function(t){var e=f.unstack(f.transpose(t,[1,0])),n=[f.sub(e[2],e[0]),f.sub(e[3],e[1])];return{sizes:n,centers:[f.add(e[0],f.div(n[0],f.scalar(2))),f.add(e[1],f.div(n[1],f.scalar(2)))]}}(t),r=n.sizes,i=n.centers,o=f.unstack(f.transpose(e,[1,0])),a=f.div(f.mul(f.exp(f.div(o[2],f.scalar(5))),r[0]),f.scalar(2)),s=f.add(f.mul(f.div(o[0],f.scalar(10)),r[0]),i[0]),u=f.div(f.mul(f.exp(f.div(o[3],f.scalar(5))),r[1]),f.scalar(2)),c=f.add(f.mul(f.div(o[1],f.scalar(10)),r[1]),i[1]);return f.transpose(f.stack([f.sub(s,a),f.sub(c,u),f.add(s,a),f.add(c,u)]),[1,0])}(f.reshape(f.tile(n.extra_dim,[r,1,1]),[-1,4]),f.reshape(t,[-1,4]));i=f.reshape(i,[r,i.shape[0]/r,4]);var o=f.sigmoid(f.slice(e,[0,0,1],[-1,-1,-1])),a=f.slice(o,[0,0,0],[-1,-1,1]);return a=f.reshape(a,[r,a.shape[1]]),{boxes:f.unstack(i),scores:f.unstack(a)}})}(i.boxPredictions,i.classPredictions,e.output_layer)})},e.prototype.forward=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,St(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.locateFaces=function(t,e){return void 0===e&&(e={}),c(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,f,d,h,p,m,g,v,b,y,w,x,_;return l(this,function(l){switch(l.label){case 0:return n=new He(e),r=n.maxResults,i=n.minConfidence,[4,St(t)];case 1:for(o=l.sent(),a=this.forwardInput(o),s=a.boxes,u=a.scores,c=s[0],f=u[0],d=1;d<s.length;d++)s[d].dispose(),u[d].dispose();return m=(p=Array).from,[4,f.data()];case 2:return h=m.apply(p,[l.sent()]),g=function(t,e,n,r,i){var o=t.shape[0],a=Math.min(n,o),s=function(t){return t<=.5?1:0},u=[];return e.map(function(t,e){return{score:t,boxIndex:e}}).filter(function(t){return t.score>i}).sort(function(t,e){return e.score-t.score}).forEach(function(e){if(!(u.length>=a)){for(var n=e.score,r=u.length-1;r>=0;--r){var o=qe(t,e.boxIndex,u[r]);if(0!==o&&(e.score*=s(o),e.score<=i))break}n===e.score&&u.push(e.boxIndex)}}),u}(c,h,r,0,i),v=o.getReshapedInputDimensions(0),b=o.inputSize,y=b/v.width,w=b/v.height,x=c.arraySync(),_=g.map(function(t){var e=[Math.max(0,x[t][0]),Math.min(1,x[t][2])].map(function(t){return t*w}),n=e[0],r=e[1],i=[Math.max(0,x[t][1]),Math.min(1,x[t][3])].map(function(t){return t*y}),a=i[0],s=i[1];return new qt(h[t],new j(a,n,s-a,r-n),{height:o.getInputHeight(0),width:o.getInputWidth(0)})}),c.dispose(),f.dispose(),[2,_]}})})},e.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=function(t,e){var n=i.extractWeightEntryFactory(t,e);function r(t,e,r){return{filters:n(t+"/Conv2d_"+e+"_pointwise/weights",4,r+"/filters"),batch_norm_offset:n(t+"/Conv2d_"+e+"_pointwise/convolution_bn_offset",1,r+"/batch_norm_offset")}}function o(t){var e="mobilenetv1/conv_"+t,i="MobilenetV1/Conv2d_"+t+"_depthwise",o=e+"/depthwise_conv",a=e+"/pointwise_conv";return{depthwise_conv:{filters:n(i+"/depthwise_weights",4,o+"/filters"),batch_norm_scale:n(i+"/BatchNorm/gamma",1,o+"/batch_norm_scale"),batch_norm_offset:n(i+"/BatchNorm/beta",1,o+"/batch_norm_offset"),batch_norm_mean:n(i+"/BatchNorm/moving_mean",1,o+"/batch_norm_mean"),batch_norm_variance:n(i+"/BatchNorm/moving_variance",1,o+"/batch_norm_variance")},pointwise_conv:r("MobilenetV1",t,a)}}function a(t,e){return{filters:n(t+"/weights",4,e+"/filters"),bias:n(t+"/biases",1,e+"/bias")}}function s(t){return{box_encoding_predictor:a("Prediction/BoxPredictor_"+t+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+t+"/box_encoding_predictor"),class_predictor:a("Prediction/BoxPredictor_"+t+"/ClassPredictor","prediction_layer/box_predictor_"+t+"/class_predictor")}}return{extractMobilenetV1Params:function(){return{conv_0:r("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:o(1),conv_2:o(2),conv_3:o(3),conv_4:o(4),conv_5:o(5),conv_6:o(6),conv_7:o(7),conv_8:o(8),conv_9:o(9),conv_10:o(10),conv_11:o(11),conv_12:o(12),conv_13:o(13)}},extractPredictionLayerParams:function(){return{conv_0:r("Prediction",0,"prediction_layer/conv_0"),conv_1:r("Prediction",1,"prediction_layer/conv_1"),conv_2:r("Prediction",2,"prediction_layer/conv_2"),conv_3:r("Prediction",3,"prediction_layer/conv_3"),conv_4:r("Prediction",4,"prediction_layer/conv_4"),conv_5:r("Prediction",5,"prediction_layer/conv_5"),conv_6:r("Prediction",6,"prediction_layer/conv_6"),conv_7:r("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:s(0),box_predictor_1:s(1),box_predictor_2:s(2),box_predictor_3:s(3),box_predictor_4:s(4),box_predictor_5:s(5)}}}}(t,e),r=n.extractMobilenetV1Params,o=n.extractPredictionLayerParams,a=t["Output/extra_dim"];if(e.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!b(a))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+a);var s={mobilenetv1:r(),prediction_layer:o(),output_layer:{extra_dim:a}};return i.disposeUnusedWeightTensors(t,e),{params:s,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=i.extractWeightsFactory(t),r=n.extractWeights,o=n.getRemainingWeights,a=function(t,e){function n(n,r,i,o,a){var s=f.tensor4d(t(n*r*i*i),[i,i,n,r]),u=f.tensor1d(t(r));return e.push({paramPath:o+"/filters"},{paramPath:o+"/"+(a?"batch_norm_offset":"bias")}),{filters:s,bias:u}}function r(t,e,r,i){var o=n(t,e,r,i,!0);return{filters:o.filters,batch_norm_offset:o.bias}}function i(n,i,o){return{depthwise_conv:function(n,r){var i=f.tensor4d(t(9*n),[3,3,n,1]),o=f.tensor1d(t(n)),a=f.tensor1d(t(n)),s=f.tensor1d(t(n)),u=f.tensor1d(t(n));return e.push({paramPath:r+"/filters"},{paramPath:r+"/batch_norm_scale"},{paramPath:r+"/batch_norm_offset"},{paramPath:r+"/batch_norm_mean"},{paramPath:r+"/batch_norm_variance"}),{filters:i,batch_norm_scale:o,batch_norm_offset:a,batch_norm_mean:s,batch_norm_variance:u}}(n,o+"/depthwise_conv"),pointwise_conv:r(n,i,1,o+"/pointwise_conv")}}return{extractMobilenetV1Params:function(){return{conv_0:r(3,32,3,"mobilenetv1/conv_0"),conv_1:i(32,64,"mobilenetv1/conv_1"),conv_2:i(64,128,"mobilenetv1/conv_2"),conv_3:i(128,128,"mobilenetv1/conv_3"),conv_4:i(128,256,"mobilenetv1/conv_4"),conv_5:i(256,256,"mobilenetv1/conv_5"),conv_6:i(256,512,"mobilenetv1/conv_6"),conv_7:i(512,512,"mobilenetv1/conv_7"),conv_8:i(512,512,"mobilenetv1/conv_8"),conv_9:i(512,512,"mobilenetv1/conv_9"),conv_10:i(512,512,"mobilenetv1/conv_10"),conv_11:i(512,512,"mobilenetv1/conv_11"),conv_12:i(512,1024,"mobilenetv1/conv_12"),conv_13:i(1024,1024,"mobilenetv1/conv_13")}},extractPredictionLayerParams:function(){return{conv_0:r(1024,256,1,"prediction_layer/conv_0"),conv_1:r(256,512,3,"prediction_layer/conv_1"),conv_2:r(512,128,1,"prediction_layer/conv_2"),conv_3:r(128,256,3,"prediction_layer/conv_3"),conv_4:r(256,128,1,"prediction_layer/conv_4"),conv_5:r(128,256,3,"prediction_layer/conv_5"),conv_6:r(256,64,1,"prediction_layer/conv_6"),conv_7:r(64,128,3,"prediction_layer/conv_7"),box_predictor_0:{box_encoding_predictor:n(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),class_predictor:n(512,9,1,"prediction_layer/box_predictor_0/class_predictor")},box_predictor_1:{box_encoding_predictor:n(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),class_predictor:n(1024,18,1,"prediction_layer/box_predictor_1/class_predictor")},box_predictor_2:{box_encoding_predictor:n(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),class_predictor:n(512,18,1,"prediction_layer/box_predictor_2/class_predictor")},box_predictor_3:{box_encoding_predictor:n(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),class_predictor:n(256,18,1,"prediction_layer/box_predictor_3/class_predictor")},box_predictor_4:{box_encoding_predictor:n(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),class_predictor:n(256,18,1,"prediction_layer/box_predictor_4/class_predictor")},box_predictor_5:{box_encoding_predictor:n(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),class_predictor:n(128,18,1,"prediction_layer/box_predictor_5/class_predictor")}}}}}(r,e),s=a.extractMobilenetV1Params,u=a.extractPredictionLayerParams,c=s(),l=u(),d={extra_dim:f.tensor3d(r(20472),[1,5118,4])};if(e.push({paramPath:"output_layer/extra_dim"}),0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{params:{mobilenetv1:c,prediction_layer:l,output_layer:d},paramMappings:e}}(t)},e}(Et);function Ge(t){var e=new $e;return e.extractWeights(t),e}function Ke(t){return Ge(t)}var Xe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}($e),Ye=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._name="TinyFaceDetectorOptions",e}return s(e,t),e}(i.TinyYolov2Options),Je=function(){function t(){}return t.prototype.then=function(t){return c(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=t,[4,this.run()];case 1:return[2,e.apply(void 0,[n.sent()])]}})})},t.prototype.run=function(){return c(this,void 0,void 0,function(){return l(this,function(t){throw new Error("ComposableTask - run is not implemented")})})},t}();function Ze(t,e,n,r,i){return void 0===i&&(i=function(t){return t.alignedRect}),c(this,void 0,void 0,function(){var o,a,s,u,c;return l(this,function(l){switch(l.label){case 0:return o=t.map(function(t){return fe(t)?i(t):t.detection}),(s=r)?[3,5]:e instanceof f.Tensor?[4,Ee(e,o)]:[3,2];case 1:return u=l.sent(),[3,4];case 2:return[4,Se(e,o)];case 3:u=l.sent(),l.label=4;case 4:s=u,l.label=5;case 5:return[4,n(a=s)];case 6:return c=l.sent(),a.forEach(function(t){return t instanceof f.Tensor&&t.dispose()}),[2,c]}})})}function Qe(t,e,n,r,i){return c(this,void 0,void 0,function(){var o=this;return l(this,function(a){return[2,Ze([t],e,function(t){return c(o,void 0,void 0,function(){return l(this,function(e){return[2,n(t[0])]})})},r,i)]})})}var tn=2,en=12;function nn(t,e){var n=e[0],r=e[1];return{height:Math.floor(n*t),width:Math.floor(r*t)}}var rn=function(t){function e(e,n,r,i){return t.call(this,{left:e,top:n,right:r,bottom:i},!0)||this}return s(e,t),e}(M);function on(t){return f.tidy(function(){return f.mul(f.sub(t,f.scalar(127.5)),f.scalar(.0078125))})}function an(t,e){return f.tidy(function(){return f.add(f.relu(t),f.mul(e,f.neg(f.relu(f.neg(t)))))})}function sn(t,e,n){return void 0===n&&(n=!1),f.tidy(function(){var r=i.convLayer(t,e.conv1,"valid");return r=an(r,e.prelu1_alpha),r=f.maxPool(r,n?[2,2]:[3,3],[2,2],"same"),r=an(r=i.convLayer(r,e.conv2,"valid"),e.prelu2_alpha),r=n?r:f.maxPool(r,[3,3],[2,2],"valid"),an(r=i.convLayer(r,e.conv3,"valid"),e.prelu3_alpha)})}function un(t,e,n,r,o){o.stage1=[];var a=e.map(function(e){return f.tidy(function(){var n={scale:e},o=function(t,e){return f.tidy(function(){var n=nn(e,t.shape.slice(1)),r=n.height,i=n.width,o=on(f.image.resizeBilinear(t,[r,i]));return f.transpose(o,[0,2,1,3])})}(t,e),a=Date.now(),s=function(t,e){return f.tidy(function(){var n=sn(t,e,!0),r=i.convLayer(n,e.conv4_1,"valid"),o=f.expandDims(f.max(r,3),3);return{prob:f.softmax(f.sub(r,o),3),regions:i.convLayer(n,e.conv4_2,"valid")}})}(o,r),u=s.prob,c=s.regions;return n.pnet=Date.now()-a,{scoresTensor:f.unstack(f.unstack(u,3)[1])[0],regionsTensor:f.unstack(c)[0],scale:e,statsForScale:n}})}).map(function(t){var e=t.scoresTensor,r=t.regionsTensor,i=t.scale,a=t.statsForScale,s=function(t,e,n,r){for(var i=[],o=t.arraySync(),a=0;a<t.shape[0];a++)for(var s=0;s<t.shape[1];s++)o[a][s]>=r&&i.push(new p(s,a));return i.map(function(t){var r=new N(Math.round((t.y*tn+1)/n),Math.round((t.x*tn+1)/n),Math.round((t.y*tn+en)/n),Math.round((t.x*tn+en)/n)),i=o[t.y][t.x],a=e.arraySync();return{cell:r,score:i,region:new rn(a[t.y][t.x][0],a[t.y][t.x][1],a[t.y][t.x][2],a[t.y][t.x][3])}})}(e,r,i,n);if(e.dispose(),r.dispose(),!s.length)return o.stage1.push(a),[];var u=Date.now(),c=Ct(s.map(function(t){return t.cell}),s.map(function(t){return t.score}),.5);return a.nms=Date.now()-u,a.numBoxes=c.length,o.stage1.push(a),c.map(function(t){return s[t]})}).reduce(function(t,e){return t.concat(e)},[]),s=[],u=[];if(a.length>0){var c=Date.now(),l=Ct(a.map(function(t){return t.cell}),a.map(function(t){return t.score}),.7);o.stage1_nms=Date.now()-c,u=l.map(function(t){return a[t].score}),s=l.map(function(t){return a[t]}).map(function(t){var e=t.cell,n=t.region;return new N(e.left+n.left*e.width,e.top+n.top*e.height,e.right+n.right*e.width,e.bottom+n.bottom*e.height).toSquare().round()})}return{boxes:s,scores:u}}function cn(t,e,n){var r=n.width,i=n.height;return c(this,void 0,void 0,function(){var n,o,a,s=this;return l(this,function(u){switch(u.label){case 0:return n=$(t),[4,Promise.all(e.map(function(e){return c(s,void 0,void 0,function(){var r,i,o,a,s,u,c,f;return l(this,function(l){return r=e.padAtBorders(t.height,t.width),i=r.y,o=r.ey,a=r.x,s=r.ex,u=a-1,c=i-1,f=n.getImageData(u,c,s-u,o-c),[2,V.isNodejs()?dt(f):createImageBitmap(f)]})})}))];case 1:return o=u.sent(),a=[],o.forEach(function(t){var e=$(ft({width:r,height:i}));e.drawImage(t,0,0,r,i);for(var n=e.getImageData(0,0,r,i).data,o=[],s=0;s<n.length;s+=4)o.push(n[s+2]),o.push(n[s+1]),o.push(n[s]);a.push(o)}),[2,a.map(function(t){return f.tidy(function(){return on(f.transpose(f.tensor4d(t,[1,r,i,3]),[0,2,1,3]).toFloat())})})]}})})}function ln(t,e,n,r,i){return c(this,void 0,void 0,function(){var o,a,s,u,c,d,h,p,m,g,v,b,y,w;return l(this,function(l){switch(l.label){case 0:return o=Date.now(),[4,cn(t,e,{width:24,height:24})];case 1:return a=l.sent(),i.stage2_extractImagePatches=Date.now()-o,o=Date.now(),s=a.map(function(t){var e=function(t,e){return f.tidy(function(){var n=sn(t,e),r=an(te(f.reshape(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu4_alpha),i=te(r,e.fc2_1),o=f.expandDims(f.max(i,1),1),a=f.softmax(f.sub(i,o),1),s=te(r,e.fc2_2);return{scores:f.unstack(a,1)[1],regions:s}})}(t,r);return t.dispose(),e}),i.stage2_rnet=Date.now()-o,u=s.length>1?f.concat(s.map(function(t){return t.scores})):s[0].scores,h=(d=Array).from,[4,u.data()];case 2:return c=h.apply(d,[l.sent()]),u.dispose(),p=c.map(function(t,e){return{score:t,idx:e}}).filter(function(t){return t.score>n}).map(function(t){return t.idx}),m=p.map(function(t){return e[t]}),g=p.map(function(t){return c[t]}),v=[],b=[],m.length>0&&(o=Date.now(),y=Ct(m,g,.7),i.stage2_nms=Date.now()-o,w=y.map(function(t){var e=s[p[t]].regions.arraySync();return new rn(e[0][0],e[0][1],e[0][2],e[0][3])}),b=y.map(function(t){return g[t]}),v=y.map(function(t,e){return m[t].calibrate(w[e])})),s.forEach(function(t){t.regions.dispose(),t.scores.dispose()}),[2,{boxes:v,scores:b}]}})})}function fn(t,e,n,r,o){return c(this,void 0,void 0,function(){var a,s,u,c,d,h,m,g,v,b,y,w,x,_,k;return l(this,function(l){switch(l.label){case 0:return a=Date.now(),[4,cn(t,e,{width:48,height:48})];case 1:return s=l.sent(),o.stage3_extractImagePatches=Date.now()-a,a=Date.now(),u=s.map(function(t){var e=function(t,e){return f.tidy(function(){var n=sn(t,e);n=f.maxPool(n,[2,2],[2,2],"same"),n=an(n=i.convLayer(n,e.conv4,"valid"),e.prelu4_alpha);var r=an(te(f.reshape(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu5_alpha),o=te(r,e.fc2_1),a=f.expandDims(f.max(o,1),1),s=f.softmax(f.sub(o,a),1),u=te(r,e.fc2_2),c=te(r,e.fc2_3);return{scores:f.unstack(s,1)[1],regions:u,points:c}})}(t,r);return t.dispose(),e}),o.stage3_onet=Date.now()-a,c=u.length>1?f.concat(u.map(function(t){return t.scores})):u[0].scores,m=(h=Array).from,[4,c.data()];case 2:return d=m.apply(h,[l.sent()]),c.dispose(),g=d.map(function(t,e){return{score:t,idx:e}}).filter(function(t){return t.score>n}).map(function(t){return t.idx}),v=g.map(function(t){var e=u[t].regions.arraySync();return new rn(e[0][0],e[0][1],e[0][2],e[0][3])}),b=g.map(function(t,n){return e[t].calibrate(v[n])}),y=g.map(function(t){return d[t]}),w=[],x=[],_=[],b.length>0&&(a=Date.now(),k=Ct(b,y,.7,!1),o.stage3_nms=Date.now()-a,w=k.map(function(t){return b[t]}),x=k.map(function(t){return y[t]}),_=k.map(function(t,e){return Array(5).fill(0).map(function(n,r){var i=u[t].points.arraySync();return new p(i[0][r]*(w[e].width+1)+w[e].left,i[0][r+5]*(w[e].height+1)+w[e].top)})})),u.forEach(function(t){t.regions.dispose(),t.scores.dispose(),t.points.dispose()}),[2,{boxes:w,scores:x,points:_}]}})})}var dn=function(t){function e(){return t.call(this,"Mtcnn")||this}return s(e,t),e.prototype.forwardInput=function(t,e){return void 0===e&&(e={}),c(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,d,h,m,g,v,b,y,w,x,_,k,S,E;return l(this,function(l){switch(l.label){case 0:if(!(n=this.params))throw new Error("Mtcnn - load model before inference");if(!(r=t.canvases[0]))throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return i={},o=Date.now(),a=f.tidy(function(){return function(t){return f.tidy(function(){return f.stack(f.unstack(t,3).reverse(),3)})}(f.expandDims(f.browser.fromPixels(r)).toFloat())}),s=function(t){return a.dispose(),i.total=Date.now()-o,t},u=a.shape.slice(1),c=u[0],d=u[1],h=new Be(e),m=h.minFaceSize,g=h.scaleFactor,v=h.maxNumScales,b=h.scoreThresholds,y=h.scaleSteps,w=(y||function(t,e,n){for(var r=n[0],i=n[1],o=en/m,a=[],s=Math.min(r,i)*o,u=0;s>=12;)a.push(o*Math.pow(e,u)),s*=e,u+=1;return a}(0,g,[c,d])).filter(function(t){var e=nn(t,[c,d]);return Math.min(e.width,e.height)>en}).slice(0,v),i.scales=w,i.pyramid=w.map(function(t){return nn(t,[c,d])}),x=Date.now(),[4,un(a,w,b[0],n.pnet,i)];case 1:return _=l.sent(),i.total_stage1=Date.now()-x,_.boxes.length?(i.stage2_numInputBoxes=_.boxes.length,x=Date.now(),[4,ln(r,_.boxes,b[1],n.rnet,i)]):[2,s({results:[],stats:i})];case 2:return k=l.sent(),i.total_stage2=Date.now()-x,k.boxes.length?(i.stage3_numInputBoxes=k.boxes.length,x=Date.now(),[4,fn(r,k.boxes,b[2],n.onet,i)]):[2,s({results:[],stats:i})];case 3:return S=l.sent(),i.total_stage3=Date.now()-x,E=S.boxes.map(function(t,e){return de(Ht({},new qt(S.scores[e],new j(t.left/d,t.top/c,t.width/d,t.height/c),{height:c,width:d})),new xe(S.points[e].map(function(e){return e.sub(new p(t.left,t.top)).div(new p(t.width,t.height))}),{width:t.width,height:t.height}))}),[2,s({results:E,stats:i})]}})})},e.prototype.forward=function(t,e){return void 0===e&&(e={}),c(this,void 0,void 0,function(){var n;return l(this,function(r){switch(r.label){case 0:return n=this.forwardInput,[4,St(t)];case 1:return[4,n.apply(this,[r.sent(),e])];case 2:return[2,r.sent().results]}})})},e.prototype.forwardWithStats=function(t,e){return void 0===e&&(e={}),c(this,void 0,void 0,function(){var n;return l(this,function(r){switch(r.label){case 0:return n=this.forwardInput,[4,St(t)];case 1:return[2,n.apply(this,[r.sent(),e])]}})})},e.prototype.getDefaultModelName=function(){return"mtcnn_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=function(t,e){var n=i.extractWeightEntryFactory(t,e);function r(t){return{filters:n(t+"/weights",4,t+"/filters"),bias:n(t+"/bias",1)}}function o(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}function a(t){return n(t,1)}function s(t){return{conv1:r(t+"/conv1"),prelu1_alpha:a(t+"/prelu1_alpha"),conv2:r(t+"/conv2"),prelu2_alpha:a(t+"/prelu2_alpha"),conv3:r(t+"/conv3"),prelu3_alpha:a(t+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=s("pnet"),e=r("pnet/conv4_1"),n=r("pnet/conv4_2");return u({},t,{conv4_1:e,conv4_2:n})},extractRNetParams:function(){var t=s("rnet"),e=o("rnet/fc1"),n=a("rnet/prelu4_alpha"),r=o("rnet/fc2_1"),i=o("rnet/fc2_2");return u({},t,{fc1:e,prelu4_alpha:n,fc2_1:r,fc2_2:i})},extractONetParams:function(){var t=s("onet"),e=r("onet/conv4"),n=a("onet/prelu4_alpha"),i=o("onet/fc1"),c=a("onet/prelu5_alpha"),l=o("onet/fc2_1"),f=o("onet/fc2_2"),d=o("onet/fc2_3");return u({},t,{conv4:e,prelu4_alpha:n,fc1:i,prelu5_alpha:c,fc2_1:l,fc2_2:f,fc2_3:d})}}}(t,e),r=n.extractPNetParams,o=n.extractRNetParams,a=n.extractONetParams,s=r(),c=o(),l=a();return i.disposeUnusedWeightTensors(t,e),{params:{pnet:s,rnet:c,onet:l},paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=i.extractWeightsFactory(t),n=e.extractWeights,r=e.getRemainingWeights,o=[],a=function(t,e){var n=i.extractConvParamsFactory(t,e),r=i.extractFCParamsFactory(t,e);function o(n,r){var i=f.tensor1d(t(n));return e.push({paramPath:r}),i}function a(t,e,r){return void 0===r&&(r=!1),{conv1:n(t[0],t[1],3,e+"/conv1"),prelu1_alpha:o(t[1],e+"/prelu1_alpha"),conv2:n(t[1],t[2],3,e+"/conv2"),prelu2_alpha:o(t[2],e+"/prelu2_alpha"),conv3:n(t[2],t[3],r?2:3,e+"/conv3"),prelu3_alpha:o(t[3],e+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=a([3,10,16,32],"pnet"),e=n(32,2,1,"pnet/conv4_1"),r=n(32,4,1,"pnet/conv4_2");return u({},t,{conv4_1:e,conv4_2:r})},extractRNetParams:function(){var t=a([3,28,48,64],"rnet",!0),e=r(576,128,"rnet/fc1"),n=o(128,"rnet/prelu4_alpha"),i=r(128,2,"rnet/fc2_1"),s=r(128,4,"rnet/fc2_2");return u({},t,{fc1:e,prelu4_alpha:n,fc2_1:i,fc2_2:s})},extractONetParams:function(){var t=a([3,32,64,64],"onet"),e=n(64,128,2,"onet/conv4"),i=o(128,"onet/prelu4_alpha"),s=r(1152,256,"onet/fc1"),c=o(256,"onet/prelu5_alpha"),l=r(256,2,"onet/fc2_1"),f=r(256,4,"onet/fc2_2"),d=r(256,10,"onet/fc2_3");return u({},t,{conv4:e,prelu4_alpha:i,fc1:s,prelu5_alpha:c,fc2_1:l,fc2_2:f,fc2_3:d})}}}(n,o),s=a.extractPNetParams,c=a.extractRNetParams,l=a.extractONetParams,d=s(),h=c(),p=l();if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{pnet:d,rnet:h,onet:p},paramMappings:o}}(t)},e}(Et),hn=.4,pn=[new p(1.603231,2.094468),new p(6.041143,7.080126),new p(2.882459,3.518061),new p(4.266906,5.178857),new p(9.041765,10.66308)],mn=[117.001,114.697,97.404],gn=function(t){function e(){var e={withSeparableConvs:!0,iouThreshold:hn,classes:["face"],anchors:pn,meanRgb:mn,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return t.call(this,e)||this}return s(e,t),Object.defineProperty(e.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),e.prototype.locateFaces=function(t,e){return c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,this.detect(t,e)];case 1:return[2,n.sent().map(function(t){return new qt(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},e.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},e.prototype.extractParamsFromWeigthMap=function(e){return t.prototype.extractParamsFromWeigthMap.call(this,e)},e}(i.TinyYolov2),vn=.4,bn=[new p(.738768,.874946),new p(2.42204,2.65704),new p(4.30971,7.04493),new p(10.246,4.59428),new p(12.6868,11.8741)],yn=[new p(1.603231,2.094468),new p(6.041143,7.080126),new p(2.882459,3.518061),new p(4.266906,5.178857),new p(9.041765,10.66308)],wn=[117.001,114.697,97.404],xn=function(t){function e(e){void 0===e&&(e=!0);var n=Object.assign({},{withSeparableConvs:e,iouThreshold:vn,classes:["face"]},e?{anchors:yn,meanRgb:wn}:{anchors:bn,withClassScores:!0});return t.call(this,n)||this}return s(e,t),Object.defineProperty(e.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),e.prototype.locateFaces=function(t,e){return c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,this.detect(t,e)];case 1:return[2,n.sent().map(function(t){return new qt(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},e.prototype.getDefaultModelName=function(){return this.withSeparableConvs?"tiny_yolov2_separable_conv_model":"tiny_yolov2_model"},e.prototype.extractParamsFromWeigthMap=function(e){return t.prototype.extractParamsFromWeigthMap.call(this,e)},e}(i.TinyYolov2);function _n(t,e){void 0===e&&(e=!0);var n=new xn(e);return n.extractWeights(t),n}var kn={ssdMobilenetv1:new $e,tinyFaceDetector:new gn,tinyYolov2:new xn,mtcnn:new dn,faceLandmark68Net:new Ae,faceLandmark68TinyNet:new Me,faceRecognitionNet:new Pe,faceExpressionNet:new oe,ageGenderNet:new we},Sn=function(t,e){return kn.ssdMobilenetv1.locateFaces(t,e)},En=function(t,e){return kn.tinyFaceDetector.locateFaces(t,e)},On=function(t,e){return kn.tinyYolov2.locateFaces(t,e)},An=function(t,e){return kn.mtcnn.forward(t,e)},Cn=function(t){return kn.faceLandmark68Net.detectLandmarks(t)},Mn=function(t){return kn.faceLandmark68TinyNet.detectLandmarks(t)},Nn=function(t){return kn.faceRecognitionNet.computeFaceDescriptor(t)},Tn=function(t){return kn.faceExpressionNet.predictExpressions(t)},In=function(t){return kn.ageGenderNet.predictAgeAndGender(t)},Dn=function(t){return kn.ssdMobilenetv1.load(t)},jn=function(t){return kn.tinyFaceDetector.load(t)},Rn=function(t){return kn.mtcnn.load(t)},Fn=function(t){return kn.tinyYolov2.load(t)},Pn=function(t){return kn.faceLandmark68Net.load(t)},zn=function(t){return kn.faceLandmark68TinyNet.load(t)},Ln=function(t){return kn.faceRecognitionNet.load(t)},Bn=function(t){return kn.faceExpressionNet.load(t)},Un=function(t){return kn.ageGenderNet.load(t)},Wn=Dn,qn=Sn,Vn=Cn;function Hn(t,e){var n={age:e};return Object.assign({},t,n)}function $n(t,e,n){var r={gender:e,genderProbability:n};return Object.assign({},t,r)}var Gn=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i.extractedFaces=r,i}return s(e,t),e}(Je),Kn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e,n=this;return l(this,function(r){switch(r.label){case 0:return[4,this.parentTask];case 1:return[4,Ze(t=r.sent(),this.input,function(t){return c(n,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,Promise.all(t.map(function(t){return kn.faceExpressionNet.predictExpressions(t)}))];case 1:return[2,e.sent()]}})})},this.extractedFaces)];case 2:return e=r.sent(),[2,t.map(function(t,n){return se(t,e[n])})]}})})},e.prototype.withAgeAndGender=function(){return new Qn(this,this.input)},e}(Gn),Xn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e;return l(this,function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,Qe(t,this.input,function(t){return kn.faceExpressionNet.predictExpressions(t)},this.extractedFaces)]:[2];case 2:return e=n.sent(),[2,se(t,e)]}})})},e.prototype.withAgeAndGender=function(){return new tr(this,this.input)},e}(Gn),Yn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.withAgeAndGender=function(){return new er(this,this.input)},e.prototype.withFaceDescriptors=function(){return new ir(this,this.input)},e}(Kn),Jn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.withAgeAndGender=function(){return new nr(this,this.input)},e.prototype.withFaceDescriptor=function(){return new or(this,this.input)},e}(Xn),Zn=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i.extractedFaces=r,i}return s(e,t),e}(Je),Qn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e,n=this;return l(this,function(r){switch(r.label){case 0:return[4,this.parentTask];case 1:return[4,Ze(t=r.sent(),this.input,function(t){return c(n,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,Promise.all(t.map(function(t){return kn.ageGenderNet.predictAgeAndGender(t)}))];case 1:return[2,e.sent()]}})})},this.extractedFaces)];case 2:return e=r.sent(),[2,t.map(function(t,n){var r=e[n],i=r.age;return Hn($n(t,r.gender,r.genderProbability),i)})]}})})},e.prototype.withFaceExpressions=function(){return new Kn(this,this.input)},e}(Zn),tr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e,n,r,i;return l(this,function(o){switch(o.label){case 0:return[4,this.parentTask];case 1:return(t=o.sent())?[4,Qe(t,this.input,function(t){return kn.ageGenderNet.predictAgeAndGender(t)},this.extractedFaces)]:[2];case 2:return e=o.sent(),n=e.age,r=e.gender,i=e.genderProbability,[2,Hn($n(t,r,i),n)]}})})},e.prototype.withFaceExpressions=function(){return new Xn(this,this.input)},e}(Zn),er=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.withFaceExpressions=function(){return new Yn(this,this.input)},e.prototype.withFaceDescriptors=function(){return new ir(this,this.input)},e}(Qn),nr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.withFaceExpressions=function(){return new Jn(this,this.input)},e.prototype.withFaceDescriptor=function(){return new or(this,this.input)},e}(tr),rr=function(t){function e(e,n){var r=t.call(this)||this;return r.parentTask=e,r.input=n,r}return s(e,t),e}(Je),ir=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.parentTask];case 1:return[4,Ze(t=e.sent(),this.input,function(t){return Promise.all(t.map(function(t){return kn.faceRecognitionNet.computeFaceDescriptor(t)}))},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return[2,e.sent().map(function(e,n){return Le(t[n],e)})]}})})},e.prototype.withFaceExpressions=function(){return new Yn(this,this.input)},e.prototype.withAgeAndGender=function(){return new er(this,this.input)},e}(rr),or=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e;return l(this,function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,Qe(t,this.input,function(t){return kn.faceRecognitionNet.computeFaceDescriptor(t)},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return e=n.sent(),[2,Le(t,e)]}})})},e.prototype.withFaceExpressions=function(){return new Jn(this,this.input)},e.prototype.withAgeAndGender=function(){return new nr(this,this.input)},e}(rr),ar=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i.useTinyLandmarkNet=r,i}return s(e,t),Object.defineProperty(e.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?kn.faceLandmark68TinyNet:kn.faceLandmark68Net},enumerable:!0,configurable:!0}),e}(Je),sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e,n,r,i,o=this;return l(this,function(a){switch(a.label){case 0:return[4,this.parentTask];case 1:return t=a.sent(),e=t.map(function(t){return t.detection}),this.input instanceof f.Tensor?[4,Ee(this.input,e)]:[3,3];case 2:return r=a.sent(),[3,5];case 3:return[4,Se(this.input,e)];case 4:r=a.sent(),a.label=5;case 5:return n=r,[4,Promise.all(n.map(function(t){return o.landmarkNet.detectLandmarks(t)}))];case 6:return i=a.sent(),n.forEach(function(t){return t instanceof f.Tensor&&t.dispose()}),[2,t.map(function(t,e){return de(t,i[e])})]}})})},e.prototype.withFaceExpressions=function(){return new Yn(this,this.input)},e.prototype.withAgeAndGender=function(){return new er(this,this.input)},e.prototype.withFaceDescriptors=function(){return new ir(this,this.input)},e}(ar),ur=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e,n,r,i;return l(this,function(o){switch(o.label){case 0:return[4,this.parentTask];case 1:return(t=o.sent())?(e=t.detection,this.input instanceof f.Tensor?[4,Ee(this.input,[e])]:[3,3]):[2];case 2:return r=o.sent(),[3,5];case 3:return[4,Se(this.input,[e])];case 4:r=o.sent(),o.label=5;case 5:return n=r,[4,this.landmarkNet.detectLandmarks(n[0])];case 6:return i=o.sent(),n.forEach(function(t){return t instanceof f.Tensor&&t.dispose()}),[2,de(t,i)]}})})},e.prototype.withFaceExpressions=function(){return new Jn(this,this.input)},e.prototype.withAgeAndGender=function(){return new nr(this,this.input)},e.prototype.withFaceDescriptor=function(){return new or(this,this.input)},e}(ar),cr=function(t){function e(e,n){void 0===n&&(n=new He);var r=t.call(this)||this;return r.input=e,r.options=n,r}return s(e,t),e}(Je),lr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e,n,r;return l(this,function(o){switch(o.label){case 0:return e=(t=this).input,(n=t.options)instanceof Be?[4,kn.mtcnn.forward(e,n)]:[3,2];case 1:return[2,o.sent().map(function(t){return t.detection})];case 2:if(!(r=n instanceof Ye?function(t){return kn.tinyFaceDetector.locateFaces(t,n)}:n instanceof He?function(t){return kn.ssdMobilenetv1.locateFaces(t,n)}:n instanceof i.TinyYolov2Options?function(t){return kn.tinyYolov2.locateFaces(t,n)}:null))throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,r(e)]}})})},e.prototype.runAndExtendWithFaceDetections=function(){var t=this;return new Promise(function(e){return c(t,void 0,void 0,function(){var t;return l(this,function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t.map(function(t){return Ht({},t)}))]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new sr(this.runAndExtendWithFaceDetections(),this.input,t)},e.prototype.withFaceExpressions=function(){return new Kn(this.runAndExtendWithFaceDetections(),this.input)},e.prototype.withAgeAndGender=function(){return new Qn(this.runAndExtendWithFaceDetections(),this.input)},e}(cr),fr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.run=function(){return c(this,void 0,void 0,function(){var t,e;return l(this,function(n){switch(n.label){case 0:return[4,new lr(this.input,this.options)];case 1:return t=n.sent(),e=t[0],t.forEach(function(t){t.score>e.score&&(e=t)}),[2,e]}})})},e.prototype.runAndExtendWithFaceDetection=function(){var t=this;return new Promise(function(e){return c(t,void 0,void 0,function(){var t;return l(this,function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t?Ht({},t):void 0)]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new ur(this.runAndExtendWithFaceDetection(),this.input,t)},e.prototype.withFaceExpressions=function(){return new Xn(this.runAndExtendWithFaceDetection(),this.input)},e.prototype.withAgeAndGender=function(){return new tr(this.runAndExtendWithFaceDetection(),this.input)},e}(cr);function dr(t,e){return void 0===e&&(e=new He),new fr(t,e)}function hr(t,e){return void 0===e&&(e=new He),new lr(t,e)}function pr(t,e){return c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,hr(t,new He(e?{minConfidence:e}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}function mr(t,e){return void 0===e&&(e={}),c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,hr(t,new i.TinyYolov2Options(e)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}function gr(t,e){return void 0===e&&(e={}),c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,hr(t,new Be(e)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}var vr=pr;function br(t,e){if(t.length!==e.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var n=Array.from(t),r=Array.from(e);return Math.sqrt(n.map(function(t,e){return t-r[e]}).reduce(function(t,e){return t+Math.pow(e,2)},0))}var yr=function(){function t(t,e){void 0===e&&(e=.6),this._distanceThreshold=e;var n=Array.isArray(t)?t:[t];if(!n.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var r=1,i=function(){return"person "+r++};this._labeledDescriptors=n.map(function(t){if(t instanceof ke)return t;if(t instanceof Float32Array)return new ke(i(),[t]);if(t.descriptor&&t.descriptor instanceof Float32Array)return new ke(i(),[t.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>")})}return Object.defineProperty(t.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),t.prototype.computeMeanDistance=function(t,e){return e.map(function(e){return br(e,t)}).reduce(function(t,e){return t+e},0)/(e.length||1)},t.prototype.matchDescriptor=function(t){var e=this;return this.labeledDescriptors.map(function(n){var r=n.descriptors,i=n.label;return new _e(i,e.computeMeanDistance(t,r))}).reduce(function(t,e){return t.distance<e.distance?t:e})},t.prototype.findBestMatch=function(t){var e=this.matchDescriptor(t);return e.distance<this.distanceThreshold?e:new _e("unknown",e.distance)},t}();function wr(t){var e=new dn;return e.extractWeights(t),e}function xr(t){var e=new gn;return e.extractWeights(t),e}function _r(t,e){var n=new h(e.width,e.height),r=n.width,i=n.height;if(r<=0||i<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:r,height:i}));if(Array.isArray(t))return t.map(function(t){return _r(t,{width:r,height:i})});if(fe(t)){var o=t.detection.forSize(r,i),a=t.unshiftedLandmarks.forSize(o.box.width,o.box.height);return de(Ht(t,o),a)}return Vt(t)?Ht(t,t.detection.forSize(r,i)):t instanceof ce||t instanceof qt?t.forSize(r,i):t}n.d(e,"draw",function(){return kr}),n.d(e,"tf",function(){return f}),n.d(e,"TfjsImageRecognitionBase",function(){return i}),n.d(e,"env",function(){return V}),n.d(e,"sigmoid",function(){return Tt}),n.d(e,"inverseSigmoid",function(){return It}),n.d(e,"isTensor",function(){return m}),n.d(e,"isTensor1D",function(){return g}),n.d(e,"isTensor2D",function(){return v}),n.d(e,"isTensor3D",function(){return b}),n.d(e,"isTensor4D",function(){return y}),n.d(e,"isFloat",function(){return w}),n.d(e,"isEven",function(){return x}),n.d(e,"round",function(){return _}),n.d(e,"isDimensions",function(){return k}),n.d(e,"computeReshapedDimensions",function(){return S}),n.d(e,"getCenterPoint",function(){return E}),n.d(e,"range",function(){return O}),n.d(e,"isValidNumber",function(){return A}),n.d(e,"isValidProbablitiy",function(){return C}),n.d(e,"NeuralNetwork",function(){return Et}),n.d(e,"BoundingBox",function(){return N}),n.d(e,"Box",function(){return M}),n.d(e,"Dimensions",function(){return h}),n.d(e,"LabeledBox",function(){return T}),n.d(e,"ObjectDetection",function(){return I}),n.d(e,"Point",function(){return p}),n.d(e,"PredictedBox",function(){return D}),n.d(e,"Rect",function(){return j}),n.d(e,"awaitMediaLoaded",function(){return ut}),n.d(e,"bufferToImage",function(){return ct}),n.d(e,"createCanvas",function(){return ft}),n.d(e,"createCanvasFromMedia",function(){return dt}),n.d(e,"fetchImage",function(){return pt}),n.d(e,"fetchJson",function(){return mt}),n.d(e,"fetchNetWeights",function(){return gt}),n.d(e,"fetchOrThrow",function(){return ht}),n.d(e,"getContext2dOrThrow",function(){return $}),n.d(e,"getMediaDimensions",function(){return lt}),n.d(e,"imageTensorToCanvas",function(){return vt}),n.d(e,"imageToSquare",function(){return bt}),n.d(e,"isMediaElement",function(){return yt}),n.d(e,"isMediaLoaded",function(){return st}),n.d(e,"loadWeightMap",function(){return wt}),n.d(e,"matchDimensions",function(){return xt}),n.d(e,"NetInput",function(){return kt}),n.d(e,"resolveInput",function(){return H}),n.d(e,"toNetInput",function(){return St}),n.d(e,"iou",function(){return Ot}),n.d(e,"minBbox",function(){return At}),n.d(e,"nonMaxSuppression",function(){return Ct}),n.d(e,"normalize",function(){return Mt}),n.d(e,"padToSquare",function(){return _t}),n.d(e,"shuffleArray",function(){return Nt}),n.d(e,"AgeGenderNet",function(){return we}),n.d(e,"Gender",function(){return be}),n.d(e,"FaceDetection",function(){return qt}),n.d(e,"FaceLandmarks",function(){return ce}),n.d(e,"FaceLandmarks5",function(){return xe}),n.d(e,"FaceLandmarks68",function(){return le}),n.d(e,"FaceMatch",function(){return _e}),n.d(e,"LabeledFaceDescriptors",function(){return ke}),n.d(e,"extractFaces",function(){return Se}),n.d(e,"extractFaceTensors",function(){return Ee}),n.d(e,"FaceExpressionNet",function(){return oe}),n.d(e,"FACE_EXPRESSION_LABELS",function(){return re}),n.d(e,"FaceExpressions",function(){return ie}),n.d(e,"FaceLandmarkNet",function(){return Ne}),n.d(e,"FaceLandmark68Net",function(){return Ae}),n.d(e,"FaceLandmark68TinyNet",function(){return Me}),n.d(e,"createFaceRecognitionNet",function(){return ze}),n.d(e,"FaceRecognitionNet",function(){return Pe}),n.d(e,"isWithFaceDetection",function(){return Vt}),n.d(e,"extendWithFaceDetection",function(){return Ht}),n.d(e,"isWithFaceLandmarks",function(){return fe}),n.d(e,"extendWithFaceLandmarks",function(){return de}),n.d(e,"extendWithFaceDescriptor",function(){return Le}),n.d(e,"isWithFaceExpressions",function(){return ae}),n.d(e,"extendWithFaceExpressions",function(){return se}),n.d(e,"allFacesSsdMobilenetv1",function(){return pr}),n.d(e,"allFacesTinyYolov2",function(){return mr}),n.d(e,"allFacesMtcnn",function(){return gr}),n.d(e,"allFaces",function(){return vr}),n.d(e,"ComposableTask",function(){return Je}),n.d(e,"ComputeFaceDescriptorsTaskBase",function(){return rr}),n.d(e,"ComputeAllFaceDescriptorsTask",function(){return ir}),n.d(e,"ComputeSingleFaceDescriptorTask",function(){return or}),n.d(e,"detectSingleFace",function(){return dr}),n.d(e,"detectAllFaces",function(){return hr}),n.d(e,"DetectFacesTaskBase",function(){return cr}),n.d(e,"DetectAllFacesTask",function(){return lr}),n.d(e,"DetectSingleFaceTask",function(){return fr}),n.d(e,"DetectFaceLandmarksTaskBase",function(){return ar}),n.d(e,"DetectAllFaceLandmarksTask",function(){return sr}),n.d(e,"DetectSingleFaceLandmarksTask",function(){return ur}),n.d(e,"FaceMatcher",function(){return yr}),n.d(e,"nets",function(){return kn}),n.d(e,"ssdMobilenetv1",function(){return Sn}),n.d(e,"tinyFaceDetector",function(){return En}),n.d(e,"tinyYolov2",function(){return On}),n.d(e,"mtcnn",function(){return An}),n.d(e,"detectFaceLandmarks",function(){return Cn}),n.d(e,"detectFaceLandmarksTiny",function(){return Mn}),n.d(e,"computeFaceDescriptor",function(){return Nn}),n.d(e,"recognizeFaceExpressions",function(){return Tn}),n.d(e,"predictAgeAndGender",function(){return In}),n.d(e,"loadSsdMobilenetv1Model",function(){return Dn}),n.d(e,"loadTinyFaceDetectorModel",function(){return jn}),n.d(e,"loadMtcnnModel",function(){return Rn}),n.d(e,"loadTinyYolov2Model",function(){return Fn}),n.d(e,"loadFaceLandmarkModel",function(){return Pn}),n.d(e,"loadFaceLandmarkTinyModel",function(){return zn}),n.d(e,"loadFaceRecognitionModel",function(){return Ln}),n.d(e,"loadFaceExpressionModel",function(){return Bn}),n.d(e,"loadAgeGenderModel",function(){return Un}),n.d(e,"loadFaceDetectionModel",function(){return Wn}),n.d(e,"locateFaces",function(){return qn}),n.d(e,"detectLandmarks",function(){return Vn}),n.d(e,"createMtcnn",function(){return wr}),n.d(e,"Mtcnn",function(){return dn}),n.d(e,"MtcnnOptions",function(){return Be}),n.d(e,"createSsdMobilenetv1",function(){return Ge}),n.d(e,"createFaceDetectionNet",function(){return Ke}),n.d(e,"FaceDetectionNet",function(){return Xe}),n.d(e,"SsdMobilenetv1",function(){return $e}),n.d(e,"SsdMobilenetv1Options",function(){return He}),n.d(e,"createTinyFaceDetector",function(){return xr}),n.d(e,"TinyFaceDetector",function(){return gn}),n.d(e,"TinyFaceDetectorOptions",function(){return Ye}),n.d(e,"TinyYolov2",function(){return xn}),n.d(e,"createTinyYolov2",function(){return _n}),n.d(e,"euclideanDistance",function(){return br}),n.d(e,"resizeResults",function(){return _r});var kr=u({},r,o)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomSample=e.randomGaussian=e.randomInt=e.randomFloat=void 0;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(52)),i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.random()*(e-t)+t};e.randomFloat=i,e.randomInt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.floor(Math.random()*(e-t+1))+t},e.randomGaussian=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=void 0,r=void 0,o=void 0,a=void 0,s=void 0,u=void 0;if(u)n=r,u=!1;else{do{s=(o=i(0,2)-1)*o+(a=i(0,2)-1)*a}while(s>=1);n=o*(s=Math.sqrt(-2*Math.log(s)/s)),r=a*s,u=!0}return n*e+t},e.randomSample=function(t,e){var n=void 0;if(!0===(arguments.length>2&&void 0!==arguments[2]&&arguments[2]))n=(0,r.default)({length:e},function(){return t[Math.floor(Math.random()*t.length)]});else{if(e>t.length)throw new RangeError("Sample size must be less than or equal to array length when sampling without replacement.");n=t.map(function(t){return[t,Math.random()]}).sort(function(t,e){return t[1]<e[1]?-1:1}).slice(0,e).map(function(t){return t[0]})}return n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=h(n(9)),i=h(n(10)),o=h(n(266)),a=h(n(12)),s=h(n(11)),u=function(){var t=(0,s.default)(a.default.mark(function t(e){var n,r;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=l.data.csv(e),t.next=3,n.toArray();case 3:return r=t.sent,t.abrupt("return",r);case 5:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),c=function(){var t=(0,s.default)(a.default.mark(function t(e){var n,r;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=void 0,"string"!=typeof e){t.next=7;break}return t.next=4,u(e);case 4:n=t.sent,t.next=8;break;case 7:n=e;case 8:return r=n.map(function(t){return(0,o.default)(t)}),t.abrupt("return",r);case 10:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),l=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),f=h(n(20)),d=n(401);function h(t){return t&&t.__esModule?t:{default:t}}var p={k:3,maxIter:5,threshold:.5},m=function(){function t(e,n,i){(0,r.default)(this,t),this.config={k:n.k||p.k,maxIter:n.maxIter||p.maxIter,threshold:n.threshold||p.threshold},this.ready=(0,f.default)(this.load(e),i)}return(0,i.default)(t,[{key:"load",value:function(){var t=(0,s.default)(a.default.mark(function t(e){var n=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c(e);case 2:return this.dataset=t.sent,l.tidy(function(){n.dataTensor=l.tensor2d(n.dataset),n.dataset.forEach(function(t){var e=l.tensor1d((0,o.default)(t));t.tensor=e}),n.centroids=l.tensor2d((0,d.randomSample)(n.dataset,n.config.k,!1)),n.fit()}),t.abrupt("return",this);case 5:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"fit",value:function(){this.getClosestCentroids(),this.recenterCentroids();for(var e=t.getEuclidianDistance(this.centroids,this.centroidsOld),n=0;e>this.config.threshold&&n<this.config.maxIter;)this.getClosestCentroids(),this.recenterCentroids(),e=t.getEuclidianDistance(this.centroids,this.centroidsOld),n+=1}},{key:"getClosestCentroids",value:function(){var t=this;this.dataset.forEach(function(e){var n=t.closestCentroid(e.tensor);e.centroid=n})}},{key:"closestCentroid",value:function(t){var e=this;return l.tidy(function(){return e.centroids.squaredDifference(t).sum(1).sqrt().argMin().arraySync()})}},{key:"classify",value:function(t){var e=this;return l.tidy(function(){var n=l.tensor1d((0,o.default)(t));return e.closestCentroid(n)})}},{key:"recenterCentroids",value:function(){var t=this,e=l.tidy(function(){return t.centroidsOld=t.centroids,l.stack(t.centroids.unstack().map(function(e,n){var r=t.dataset.filter(function(t){return t.centroid===n}).map(function(t){return t.tensor});return 0===r.length?e:1===r.length?r[0]:l.tidy(function(){return l.stack(r).mean(0)})}))});this.centroids=e}}],[{key:"getEuclidianDistance",value:function(t,e){return l.tidy(function(){return l.squaredDifference(t,e).sum().sqrt().dataSync()})[0]}}]),t}();e.default=function(t,e,n){return new m(t,e,n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=m(n(100)),i=m(n(36)),o=m(n(17)),a=m(n(12)),s=m(n(61)),u=m(n(11)),c=m(n(9)),l=m(n(10)),f=p(n(2)),d=p(n(400)),h=m(n(20));function p(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function m(t){return t&&t.__esModule?t:{default:t}}var g={withLandmarks:!0,withDescriptors:!0,minConfidence:.5,MODEL_URLS:{Mobilenetv1Model:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/face-api/models/faceapi/ssd_mobilenetv1_model-weights_manifest.json",FaceLandmarkModel:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/face-api/models/faceapi/face_landmark_68_model-weights_manifest.json",FaceLandmark68TinyNet:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/face-api/models/faceapi/face_landmark_68_tiny_model-weights_manifest.json",FaceRecognitionModel:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/face-api/models/faceapi/face_recognition_model-weights_manifest.json"}},v=function(){function t(e,n,r){(0,c.default)(this,t),this.video=e,this.model=null,this.modelReady=!1,this.config={minConfidence:this.checkUndefined(n.minConfidence,g.minConfidence),withLandmarks:this.checkUndefined(n.withLandmarks,g.withLandmarks),withDescriptors:this.checkUndefined(n.withDescriptors,g.withDescriptors),MODEL_URLS:{Mobilenetv1Model:this.checkUndefined(n.Mobilenetv1Model,g.MODEL_URLS.Mobilenetv1Model),FaceLandmarkModel:this.checkUndefined(n.FaceLandmarkModel,g.MODEL_URLS.FaceLandmarkModel),FaceLandmark68TinyNet:this.checkUndefined(n.FaceLandmark68TinyNet,g.MODEL_URLS.FaceLandmark68TinyNet),FaceRecognitionModel:this.checkUndefined(n.FaceRecognitionModel,g.MODEL_URLS.FaceRecognitionModel)}},this.ready=(0,h.default)(this.loadModel(),r)}return(0,l.default)(t,[{key:"loadModel",value:function(){var t=(0,u.default)(a.default.mark(function t(){var e,n,r,i,o,u,c=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=["Mobilenetv1Model","FaceLandmarkModel","FaceLandmark68TinyNet","FaceRecognitionModel"],(0,s.default)(this.config.MODEL_URLS).forEach(function(t){e.includes(t)&&(c.config.MODEL_URLS[t]=c.getModelPath(c.config.MODEL_URLS[t]))}),n=this.config.MODEL_URLS,r=n.Mobilenetv1Model,i=n.FaceLandmarkModel,o=n.FaceRecognitionModel,this.model=d,u=this.model.SsdMobilenetv1Options({minConfidence:this.minConfidence}),t.next=7,this.model.loadSsdMobilenetv1Model(r,u);case 7:return t.next=9,this.model.loadFaceLandmarkModel(i);case 9:return t.next=11,this.model.loadFaceRecognitionModel(o);case 11:return this.modelReady=!0,t.abrupt("return",this);case 13:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"detect",value:function(){var t=(0,u.default)(a.default.mark(function t(e,n,r){var i,s,u;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.video,s=void 0,u=this.config,"function"!=typeof e){t.next=8;break}i=this.video,s=e,t.next=22;break;case 8:if(!(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData)){t.next=12;break}i=e,t.next=22;break;case 12:if("object"!==(void 0===e?"undefined":(0,o.default)(e))||!(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof HTMLVideoElement||e.elt instanceof ImageData)){t.next=16;break}i=e.elt,t.next=22;break;case 16:if(!("object"===(void 0===e?"undefined":(0,o.default)(e))&&e.canvas instanceof HTMLCanvasElement)){t.next=20;break}i=e.canvas,t.next=22;break;case 20:if(this.video instanceof HTMLVideoElement){t.next=22;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 22:return"object"===(void 0===n?"undefined":(0,o.default)(n))?u=n:"function"==typeof n&&(s=n),"function"==typeof r&&(s=r),t.abrupt("return",(0,h.default)(this.detectInternal(i,u),s));case 25:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"detectInternal",value:function(){var t=(0,u.default)(a.default.mark(function t(e,n){var r,o,s,u,c=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,f.nextFrame();case 4:if(!this.video||0!==this.video.readyState){t.next=7;break}return t.next=7,new i.default(function(t){c.video.onloadeddata=function(){return t()}});case 7:if(this.config=this.setReturnOptions(n),r=this.config,o=r.withLandmarks,s=r.withDescriptors,u=void 0,!o){t.next=22;break}if(!s){t.next=17;break}return t.next=14,this.model.detectAllFaces(e).withFaceLandmarks().withFaceDescriptors();case 14:u=t.sent,t.next=20;break;case 17:return t.next=19,this.model.detectAllFaces(e).withFaceLandmarks();case 19:u=t.sent;case 20:t.next=31;break;case 22:if(o){t.next=28;break}return t.next=25,this.model.detectAllFaces(e);case 25:u=t.sent,t.next=31;break;case 28:return t.next=30,this.model.detectAllFaces(e).withFaceLandmarks().withFaceDescriptors();case 30:u=t.sent;case 31:return u=this.resizeResults(u,e.width,e.height),u=this.landmarkParts(u),t.abrupt("return",u);case 34:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"detectSingle",value:function(){var t=(0,u.default)(a.default.mark(function t(e,n,r){var i,s,u;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.video,s=void 0,u=this.config,"function"!=typeof e){t.next=8;break}i=this.video,s=e,t.next=22;break;case 8:if(!(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData)){t.next=12;break}i=e,t.next=22;break;case 12:if("object"!==(void 0===e?"undefined":(0,o.default)(e))||!(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof HTMLVideoElement||e.elt instanceof ImageData)){t.next=16;break}i=e.elt,t.next=22;break;case 16:if(!("object"===(void 0===e?"undefined":(0,o.default)(e))&&e.canvas instanceof HTMLCanvasElement)){t.next=20;break}i=e.canvas,t.next=22;break;case 20:if(this.video instanceof HTMLVideoElement){t.next=22;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 22:return"object"===(void 0===n?"undefined":(0,o.default)(n))?u=n:"function"==typeof n&&(s=n),"function"==typeof r&&(s=r),t.abrupt("return",(0,h.default)(this.detectSingleInternal(i,u),s));case 25:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"detectSingleInternal",value:function(){var t=(0,u.default)(a.default.mark(function t(e,n){var r,o,s,u,c=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,f.nextFrame();case 4:if(!this.video||0!==this.video.readyState){t.next=7;break}return t.next=7,new i.default(function(t){c.video.onloadeddata=function(){return t()}});case 7:if(this.config=this.setReturnOptions(n),r=this.config,o=r.withLandmarks,s=r.withDescriptors,u=void 0,!o){t.next=22;break}if(!s){t.next=17;break}return t.next=14,this.model.detectSingleFace(e).withFaceLandmarks().withFaceDescriptor();case 14:u=t.sent,t.next=20;break;case 17:return t.next=19,this.model.detectSingleFace(e).withFaceLandmarks();case 19:u=t.sent;case 20:t.next=31;break;case 22:if(o){t.next=28;break}return t.next=25,this.model.detectSingleFace(e);case 25:u=t.sent,t.next=31;break;case 28:return t.next=30,this.model.detectSingleFace(e).withFaceLandmarks().withFaceDescriptor();case 30:u=t.sent;case 31:return u=this.resizeResults(u,e.width,e.height),u=this.landmarkParts(u),t.abrupt("return",u);case 34:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"checkUndefined",value:function(t,e){return void 0!==t?t:e}},{key:"getModelPath",value:function(t){return this.isAbsoluteURL(t)?t:window.location.pathname+t}},{key:"setReturnOptions",value:function(t){var e=this,n=(0,r.default)({},this.config);return["withLandmarks","withDescriptors"].forEach(function(r){void 0!==t[r]?e.config[r]=t[r]:n[r]=e.config[r]}),n}},{key:"resizeResults",value:function(t,e,n){if(void 0===e||void 0===n)throw new Error("width and height must be defined");return this.model.resizeResults(t,{width:e,height:n})}},{key:"isAbsoluteURL",value:function(t){return!!new RegExp("^(?:[a-z]+:)?//","i").test(t)}},{key:"landmarkParts",value:function(t){var e=void 0;if(!0===Array.isArray(t))e=t.map(function(t){var e=(0,r.default)({},t);if(e.landmarks){var n=e.landmarks;e.parts={mouth:n.getMouth(),nose:n.getNose(),leftEye:n.getLeftEye(),leftEyeBrow:n.getLeftEyeBrow(),rightEye:n.getRightEye(),rightEyeBrow:n.getRightEyeBrow(),jawOutline:n.getJawOutline()}}else e.parts={mouth:[],nose:[],leftEye:[],leftEyeBrow:[],rightEye:[],rightEyeBrow:[],jawOutline:[]};return e});else if((e=(0,r.default)({},t)).landmarks){var n=t.landmarks;e.parts={mouth:n.getMouth(),nose:n.getNose(),leftEye:n.getLeftEye(),leftEyeBrow:n.getLeftEyeBrow(),rightEye:n.getRightEye(),rightEyeBrow:n.getRightEyeBrow()}}else e.parts={mouth:[],nose:[],leftEye:[],leftEyeBrow:[],rightEye:[],rightEyeBrow:[]};return e}}]),t}();e.default=function(t,e,n){var r=void 0,i={},a=n;t instanceof HTMLVideoElement?r=t:"object"===(void 0===t?"undefined":(0,o.default)(t))&&t.elt instanceof HTMLVideoElement?r=t.elt:"object"===(void 0===t?"undefined":(0,o.default)(t))?i=t:"function"==typeof t&&(a=t),"object"===(void 0===e?"undefined":(0,o.default)(e))?(i=e,console.log(i)):"function"==typeof e&&(a=e);var s=new v(r,i,a);return a?s:s.ready}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=u(n(91)),i=u(n(101)),o=u(n(9)),a=u(n(10)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(320));function u(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(){(0,o.default)(this,t),this.config={height:300}}return(0,a.default)(t,[{key:"modelSummary",value:function(t,e){var n=(0,i.default)({},t);s.show.modelSummary(n,e)}},{key:"scatterplot",value:function(t,e,n){var r=n.map(function(n){return{x:n.xs[t],y:n.ys[e]}}),i={xLabel:"X",yLabel:"Y",height:this.config.height};s.render.scatterplot({name:"debug mode"},r,i)}},{key:"scatterplotAll",value:function(t,e,n){var i=[];t.forEach(function(t){e.forEach(function(e){var o=n.map(function(n){return{x:n.xs[t],y:n.ys[e]}});i=[].concat((0,r.default)(i),(0,r.default)(o))})});var o={xLabel:"X",yLabel:"Y",height:this.config.height};s.render.scatterplot({name:"debug mode"},i,o)}},{key:"barchart",value:function(t,e,n){var r=n.map(function(n){return{value:n.xs[t],index:n.ys[e]}}),i={xLabel:"label",yLabel:"value",height:this.config.height};console.log(i),s.render.barchart({name:"Bar chart"},r)}},{key:"trainingVis",value:function(){return s.show.fitCallbacks({name:"Training Performance"},["loss","accuracy"],{height:this.config.height,callbacks:["onEpochEnd"]})}}]),t}();e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=x(n(17)),i=x(n(52)),o=x(n(36)),a=x(n(107)),s=x(n(12)),u=x(n(11)),c=x(n(262)),l=x(n(260)),f=x(n(259)),d=x(n(91)),h=x(n(61)),p=x(n(100)),m=x(n(101)),g=x(n(9)),v=x(n(10)),b=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),y=n(132),w=x(n(258));function x(t){return t&&t.__esModule?t:{default:t}}var _=function(){function t(){(0,g.default)(this,t),this.meta={inputUnits:null,outputUnits:null,inputs:{},outputs:{},isNormalized:!1},this.isMetadataReady=!1,this.isWarmedUp=!1,this.data={raw:[]}}return(0,v.default)(t,[{key:"createMetadata",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.getDTypesFromData(t),this.getDataStats(t),this.getDataOneHot(t),this.getDataUnits(t,e),this.isMetadataReady=!0,(0,m.default)({},this.meta)}},{key:"addData",value:function(t,e){this.data.raw.push({xs:t,ys:e})}},{key:"convertRawToTensors",value:function(t){var e=(0,p.default)({},this.meta),n=t.length;return b.tidy(function(){var r=[],i=[];return t.forEach(function(t){var n=(0,h.default)(e.inputs).map(function(e){return t.xs[e]}).flat();r.push(n);var o=(0,h.default)(e.outputs).map(function(e){return t.ys[e]}).flat();i.push(o)}),{inputs:b.tensor(r.flat(),[n].concat((0,d.default)(e.inputUnits))),outputs:b.tensor(i.flat(),[n,e.outputUnits])}})}},{key:"normalizeDataRaw",value:function(t){var e=(0,p.default)({},this.meta),n=this.normalizeInputData(t,e.inputs,"xs"),r=this.normalizeInputData(t,e.outputs,"ys");return w.default.zipArrays(n,r)}},{key:"normalizeInputData",value:function(t,e,n){var r=this,i=t.length,o=(0,p.default)({},e),a={};return(0,h.default)(o).forEach(function(e){var i={min:o[e].min,max:o[e].max},s=t.map(function(t){return t[n][e]});"string"===o[e].dtype?(i.legend=o[e].legend,a[e]=r.normalizeArray(s,i)):"number"===o[e].dtype?a[e]=r.normalizeArray(s,i):"array"===o[e].dtype&&(a[e]=s.map(function(t){return r.normalizeArray(t,i)}))}),[].concat((0,d.default)(new Array(i).fill(null))).map(function(t,e){var r=(0,f.default)({},n,{});return(0,h.default)(o).forEach(function(t){r[n][t]=a[t][e]}),r})}},{key:"normalizeArray",value:function(t,e){var n=e.min,r=e.max;if(e.legend)return t.map(function(t){return e.legend[t]?e.legend[t]:t});if(t.every(function(t){return"number"==typeof t}))return t.map(function(t){return w.default.normalizeValue(t,n,r)});throw new Error("error in inputArray of normalizeArray() function")}},{key:"unnormalizeArray",value:function(t,e){var n=e.min,r=e.max;if(e.legend)return t.map(function(t){var n=void 0;return(0,l.default)(e.legend).forEach(function(e){var r=e[0],i=e[1];t.map(function(t,e){return t===i[e]}).every(function(t){return!0===t})&&(n=r)}),n});if(t.every(function(t){return"number"==typeof t}))return t.map(function(t){return w.default.unnormalizeValue(t,n,r)});throw new Error("error in inputArray of normalizeArray() function")}},{key:"getDataStats",value:function(t){var e=(0,p.default)({},this.meta),n=this.getInputMetaStats(t,e.inputs,"xs"),r=this.getInputMetaStats(t,e.outputs,"ys");return e.inputs=n,e.outputs=r,this.meta=(0,m.default)({},this.meta,e),e}},{key:"getInputMetaStats",value:function(t,e,n){var r=(0,p.default)({},e);return(0,h.default)(r).forEach(function(e){if("string"===r[e].dtype)r[e].min=0,r[e].max=1;else if("number"===r[e].dtype){var i=t.map(function(t){return t[n][e]});r[e].min=w.default.getMin(i),r[e].max=w.default.getMax(i)}else if("array"===r[e].dtype){var o=t.map(function(t){return t[n][e]}).flat();r[e].min=w.default.getMin(o),r[e].max=w.default.getMax(o)}}),r}},{key:"getDataUnits",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=null!==n?n:void 0,i=(0,p.default)({},this.meta);e=r||[this.getInputMetaUnits(t,i.inputs)].flat(),console.log(e);var o=this.getInputMetaUnits(t,i.outputs);return i.inputUnits=e,i.outputUnits=o,this.meta=(0,m.default)({},this.meta,i),i}},{key:"getInputMetaUnits",value:function(t,e){var n=0,r=(0,p.default)({},e);return(0,l.default)(r).forEach(function(t){var e=t[1].dtype;if("number"===e)n+=1;else if("string"===e){var r=t[1].uniqueValues.length;n+=r}else"array"===e&&(n=[])}),n}},{key:"getDTypesFromData",value:function(t){var e=(0,m.default)({},this.meta,{inputs:{},outputs:{}}),n=t[0],r=(0,h.default)(n.xs),i=(0,h.default)(n.ys);return r.forEach(function(t){e.inputs[t]={dtype:w.default.getDataType(n.xs[t])}}),i.forEach(function(t){e.outputs[t]={dtype:w.default.getDataType(n.ys[t])}}),this.meta=e,e}},{key:"applyOneHotEncodingsToDataRaw",value:function(t){var e=(0,p.default)({},this.meta);return t.map(function(t){var n=(0,m.default)({},t.xs),r=(0,m.default)({},t.ys);return(0,h.default)(e.inputs).forEach(function(r){e.inputs[r].legend&&(n[r]=e.inputs[r].legend[t.xs[r]])}),(0,h.default)(e.outputs).forEach(function(n){e.outputs[n].legend&&(r[n]=e.outputs[n].legend[t.ys[n]])}),{xs:n,ys:r}})}},{key:"getDataOneHot",value:function(t){var e=(0,p.default)({},this.meta),n=this.getInputMetaOneHot(t,e.inputs,"xs"),r=this.getInputMetaOneHot(t,e.outputs,"ys");return e.inputs=n,e.outputs=r,this.meta=(0,m.default)({},this.meta,e),e}},{key:"getInputMetaOneHot",value:function(t,e,n){var r=this,i=(0,p.default)({},e);return(0,l.default)(i).forEach(function(e){var o=e[0];if("string"===e[1].dtype){var a=[].concat((0,d.default)(new c.default(t.map(function(t){return t[n][o]})))),s=r.createOneHotEncodings(a);i[o]=(0,m.default)({},i[o],s)}}),i}},{key:"createOneHotEncodings",value:function(t){return b.tidy(function(){var e={uniqueValues:t,legend:{}},n=t,r=n.map(function(t,e){return e}),i=b.oneHot(b.tensor1d(r,"int32"),n.length).arraySync();return n.forEach(function(t,n){e.legend[t]=i[n]}),e})}},{key:"loadDataFromUrl",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n,r){var i;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,i=void 0,!e.endsWith(".csv")){t.next=8;break}return t.next=5,this.loadCSV(e,n,r);case 5:i=t.sent,t.next=21;break;case 8:if(!e.endsWith(".json")){t.next=14;break}return t.next=11,this.loadJSON(e,n,r);case 11:i=t.sent,t.next=21;break;case 14:if(!e.includes("blob")){t.next=20;break}return t.next=17,this.loadBlob(e,n,r);case 17:i=t.sent,t.next=21;break;case 20:throw new Error("Not a valid data format. Must be csv or json");case 21:return t.abrupt("return",i);case 24:throw t.prev=24,t.t0=t.catch(0),console.error(t.t0),new Error(t.t0);case 28:case"end":return t.stop()}},t,this,[[0,24]])}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"formatRawData",value:function(t,e,n){var r=this.findEntries(t);!r.length>0&&console.log("your data must be contained in an array in \n\n a property called 'entries' or 'data' of your json object");var i=r.map(function(t,r){var i={xs:{},ys:{}};return e.forEach(function(e){void 0!==t[e]?i.xs[e]=t[e]:console.error("the input label "+e+" does not exist at row "+r)}),n.forEach(function(e){void 0!==t[e]?i.ys[e]=t[e]:console.error("the output label "+e+" does not exist at row "+r)}),i});return this.data.raw=i,i}},{key:"loadJSON",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n,r){var i,o,a;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,i=void 0,!(e instanceof Object)){t.next=6;break}i=(0,p.default)({},e),t.next=12;break;case 6:return t.next=8,fetch(e);case 8:return o=t.sent,t.next=11,o.json();case 11:i=t.sent;case 12:return a=this.formatRawData(i,n,r),t.abrupt("return",a);case 16:throw t.prev=16,t.t0=t.catch(0),console.error("error loading json"),new Error(t.t0);case 20:case"end":return t.stop()}},t,this,[[0,16]])}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"loadCSV",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n,r){var i,o,a,u;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,i=b.data.csv(e),t.next=4,i.toArray();case 4:return o=t.sent,a={entries:o},u=this.formatRawData(a,n,r),t.abrupt("return",u);case 10:throw t.prev=10,t.t0=t.catch(0),console.error("error loading csv",t.t0),new Error(t.t0);case 14:case"end":return t.stop()}},t,this,[[0,10]])}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"loadBlob",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n,r){var i,o,a,u,c;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch(e);case 3:return i=t.sent,t.next=6,i.text();case 6:if(o=t.sent,a=void 0,!w.default.isJsonOrString(o)){t.next=15;break}return u=JSON.parse(o),t.next=12,this.loadJSON(u,n,r);case 12:a=t.sent,t.next=19;break;case 15:return c=this.csvToJSON(o),t.next=18,this.loadJSON(c,n,r);case 18:a=t.sent;case 19:return t.abrupt("return",a);case 22:throw t.prev=22,t.t0=t.catch(0),console.log("mmm might be passing in a string or something!",t.t0),new Error(t.t0);case 26:case"end":return t.stop()}},t,this,[[0,22]])}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"loadData",value:function(){var t=(0,u.default)(s.default.mark(function t(){var e,n,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=arguments[1];return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,e=void 0,"string"==typeof o){t.next=16;break}if(n=o[0],(new FileReader).readAsText(n),!n.name.includes(".json")){t.next=13;break}return t.next=9,n.text();case 9:r=t.sent,e=JSON.parse(r),t.next=14;break;case 13:console.log('data must be a json object containing an array called "data" or "entries');case 14:t.next=23;break;case 16:return t.next=18,fetch(o);case 18:return e=t.sent,t.next=21,e.text();case 21:i=t.sent,w.default.isJsonOrString(i)?e=JSON.parse(i):console.log("Whoops! something went wrong. Either this kind of data is not supported yet or there is an issue with .loadData");case 23:this.data.raw=this.findEntries(e),!this.data.raw.length>0&&console.log('data must be a json object containing an array called "data" '),a&&a(),t.next=31;break;case 28:throw t.prev=28,t.t0=t.catch(0),new Error(t.t0);case 31:case"end":return t.stop()}},t,this,[[0,28]])}));return function(){return t.apply(this,arguments)}}()},{key:"saveData",value:function(){var t=(0,u.default)(s.default.mark(function t(e){var n,r,i,o,u;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=new Date,r=String(n.getFullYear())+"-"+String(n.getMonth()+1)+"-"+String(n.getDate()),i=String(n.getHours())+"-"+String(n.getMinutes())+"-"+String(n.getSeconds()),o=r+"_"+i,e&&(o=e),u={data:this.data.raw},t.next=9,(0,y.saveBlob)((0,a.default)(u),o+".json","text/plain");case 9:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"saveMeta",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n){var r,i;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=void 0,i=void 0,"function"==typeof e?(r="model",i=e):"string"==typeof e?(r=e,"function"==typeof n&&(i=n)):r="model",t.next=5,(0,y.saveBlob)((0,a.default)(this.meta),r+"_meta.json","text/plain");case 5:i&&i();case 6:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"loadMeta",value:function(){var t=(0,u.default)(s.default.mark(function t(){var e,n,r,a,c,l=this,f=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,d=arguments[1];return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(f instanceof FileList)){t.next=8;break}return t.next=3,o.default.all((0,i.default)(f).map(function(){var t=(0,u.default)(s.default.mark(function t(e){var n;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.name.includes(".json")||e.name.includes("_meta")){t.next=4;break}return t.abrupt("return",{name:"model",file:e});case 4:if(!e.name.includes(".json")||!e.name.includes("_meta.json")){t.next=11;break}return t.next=7,e.text();case 7:return n=t.sent,t.abrupt("return",{name:"metadata",file:n});case 11:if(!e.name.includes(".bin")){t.next=13;break}return t.abrupt("return",{name:"weights",file:e});case 13:return t.abrupt("return",{name:null,file:null});case 14:case"end":return t.stop()}},t,l)}));return function(e){return t.apply(this,arguments)}}()));case 3:e=t.sent,n=JSON.parse(e.find(function(t){return"metadata"===t.name}).file),this.meta=n,t.next=27;break;case 8:if(!(f instanceof Object)){t.next=19;break}return t.next=11,fetch(f.metadata);case 11:return r=t.sent,t.next=14,r.text();case 14:r=t.sent,r=JSON.parse(r),this.meta=r,t.next=27;break;case 19:return a=f.substring(0,f.lastIndexOf("/"))+"/model_meta.json",t.next=22,fetch(a);case 22:return c=t.sent,t.next=25,c.json();case 25:c=t.sent,this.meta=c;case 27:return this.isMetadataReady=!0,this.isWarmedUp=!0,d&&d(),t.abrupt("return",this.meta);case 31:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"csvToJSON",value:function(t){for(var e=t.split("\n"),n=[],r=e[0].split(","),i=function(t){var i={},o=e[t].split(",");r.forEach(function(t,e){i[t]=o[e]}),n.push(i)},o=1;o<e.length;o+=1)i(o);return{entries:n}}},{key:"findEntries",value:function(t){var e=this,n=(0,p.default)({},t);return n.entries&&n.entries instanceof Array?n.entries:n.data&&n.data instanceof Array?n.data:((0,h.default)(n).forEach(function(t){if("object"===(0,r.default)(n[t]))return e.findEntries(n[t])}),n)}}]),t}();e.default=_},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=h(n(52)),i=h(n(36)),o=h(n(107)),a=h(n(12)),s=h(n(11)),u=h(n(9)),c=h(n(10)),l=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),f=h(n(20)),d=n(132);function h(t){return t&&t.__esModule?t:{default:t}}var p=function(){function t(){(0,u.default)(this,t),this.isTrained=!1,this.isCompiled=!1,this.isLayered=!1,this.model=null,this.init=this.init.bind(this),this.createModel=this.createModel.bind(this),this.addLayer=this.addLayer.bind(this),this.compile=this.compile.bind(this),this.setOptimizerFunction=this.setOptimizerFunction.bind(this),this.train=this.train.bind(this),this.trainInternal=this.trainInternal.bind(this),this.predict=this.predict.bind(this),this.classify=this.classify.bind(this),this.save=this.save.bind(this),this.load=this.load.bind(this),this.init()}return(0,c.default)(t,[{key:"init",value:function(){this.createModel()}},{key:"createModel",value:function(){switch((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sequential").toLowerCase()){case"sequential":default:return this.model=l.sequential(),this.model}}},{key:"addLayer",value:function(t){var e=t||{};this.model.add(e),this.model.layers.length>=2&&(this.isLayered=!0)}},{key:"compile",value:function(t){this.model.compile(t),this.isCompiled=!0}},{key:"setOptimizerFunction",value:function(t,e){return e.call(this,t)}},{key:"train",value:function(t,e){return(0,f.default)(this.trainInternal(t),e)}},{key:"trainInternal",value:function(){var t=(0,s.default)(a.default.mark(function t(e){var n,r,i,o,s,u,c,l;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=(n=e).inputs,i=n.outputs,o=n.batchSize,s=n.epochs,u=n.shuffle,c=n.validationSplit,l=n.whileTraining,t.next=6,this.model.fit(r,i,{batchSize:o,epochs:s,shuffle:u,validationSplit:c,callbacks:l});case 6:r.dispose(),i.dispose(),this.isTrained=!0;case 9:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"predict",value:function(){var t=(0,s.default)(a.default.mark(function t(e){var n,r,i=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=l.tidy(function(){return i.model.predict(e)}),t.next=3,n.array();case 3:return r=t.sent,n.dispose(),e.dispose(),t.abrupt("return",r);case 7:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=(0,s.default)(a.default.mark(function t(e){return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.predict(e));case 1:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"save",value:function(){var t=(0,s.default)(a.default.mark(function t(e,n){var r,i,u=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=void 0,i=void 0,"function"==typeof e?(r="model",i=e):"string"==typeof e?(r=e,"function"==typeof n&&(i=n)):r="model",this.model.save(l.io.withSaveHandler(function(){var t=(0,s.default)(a.default.mark(function t(e){return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return u.weightsManifest={modelTopology:e.modelTopology,weightsManifest:[{paths:["./"+r+".weights.bin"],weights:e.weightSpecs}]},t.next=3,(0,d.saveBlob)(e.weightData,r+".weights.bin","application/octet-stream");case 3:return t.next=5,(0,d.saveBlob)((0,o.default)(u.weightsManifest),r+".json","text/plain");case 5:i&&i();case 6:case"end":return t.stop()}},t,u)}));return function(e){return t.apply(this,arguments)}}()));case 4:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"load",value:function(){var t=(0,s.default)(a.default.mark(function t(){var e,n,o,u,c,f,d,h=this,p=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,m=arguments[1];return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(p instanceof FileList)){t.next=11;break}return t.next=3,i.default.all((0,r.default)(p).map(function(){var t=(0,s.default)(a.default.mark(function t(e){var n;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.name.includes(".json")||e.name.includes("_meta")){t.next=4;break}return t.abrupt("return",{name:"model",file:e});case 4:if(!e.name.includes(".json")||!e.name.includes("_meta.json")){t.next=11;break}return t.next=7,e.text();case 7:return n=t.sent,t.abrupt("return",{name:"metadata",file:n});case 11:if(!e.name.includes(".bin")){t.next=13;break}return t.abrupt("return",{name:"weights",file:e});case 13:return t.abrupt("return",{name:null,file:null});case 14:case"end":return t.stop()}},t,h)}));return function(e){return t.apply(this,arguments)}}()));case 3:return e=t.sent,n=e.find(function(t){return"model"===t.name}).file,o=e.find(function(t){return"weights"===t.name}).file,t.next=8,l.loadLayersModel(l.io.browserFiles([n,o]));case 8:this.model=t.sent,t.next=34;break;case 11:if(!(p instanceof Object)){t.next=31;break}return t.next=14,fetch(p.model);case 14:return u=t.sent,t.next=17,u.text();case 17:return u=t.sent,c=new File([u],"model.json",{type:"application/json"}),t.next=21,fetch(p.weights);case 21:return f=t.sent,t.next=24,f.blob();case 24:return f=t.sent,d=new File([f],"model.weights.bin",{type:"application/macbinary"}),t.next=28,l.loadLayersModel(l.io.browserFiles([c,d]));case 28:this.model=t.sent,t.next=34;break;case 31:return t.next=33,l.loadLayersModel(p);case 33:this.model=t.sent;case 34:return this.isCompiled=!0,this.isLayered=!0,this.isTrained=!0,m&&m(),t.abrupt("return",this.model);case 39:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();e.default=p},function(t,e,n){var r=n(26),i=n(265)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},function(t,e,n){n(407),t.exports=n(19).Object.entries},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=_(n(260)),i=_(n(52)),o=_(n(259)),a=_(n(91)),s=_(n(100)),u=_(n(12)),c=_(n(11)),l=_(n(61)),f=_(n(17)),d=_(n(101)),h=_(n(9)),p=_(n(10)),m=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),g=_(n(406)),v=_(n(405)),b=_(n(404)),y=_(n(20)),w=_(n(258)),x=n(62);function _(t){return t&&t.__esModule?t:{default:t}}var k={inputs:[],outputs:[],dataUrl:null,modelUrl:null,layers:[],task:null,debug:!1,learningRate:.2,hiddenUnits:16},S=function(){function t(e,n){(0,h.default)(this,t),this.callback=n,this.options=(0,d.default)({},k,e)||k,this.neuralNetwork=new g.default,this.neuralNetworkData=new v.default,this.neuralNetworkVis=new b.default,this.data={training:[]},this.ready=!1,this.init=this.init.bind(this),this.addData=this.addData.bind(this),this.loadDataFromUrl=this.loadDataFromUrl.bind(this),this.loadDataInternal=this.loadDataInternal.bind(this),this.createMetaData=this.createMetaData.bind(this),this.prepareForTraining=this.prepareForTraining.bind(this),this.normalizeData=this.normalizeData.bind(this),this.normalizeInput=this.normalizeInput.bind(this),this.searchAndFormat=this.searchAndFormat.bind(this),this.formatInputItem=this.formatInputItem.bind(this),this.convertTrainingDataToTensors=this.convertTrainingDataToTensors.bind(this),this.formatInputsForPrediction=this.formatInputsForPrediction.bind(this),this.formatInputsForPredictionAll=this.formatInputsForPredictionAll.bind(this),this.isOneHotEncodedOrNormalized=this.isOneHotEncodedOrNormalized.bind(this),this.train=this.train.bind(this),this.trainInternal=this.trainInternal.bind(this),this.addLayer=this.addLayer.bind(this),this.createNetworkLayers=this.createNetworkLayers.bind(this),this.addDefaultLayers=this.addDefaultLayers.bind(this),this.compile=this.compile.bind(this),this.predict=this.predict.bind(this),this.predictMultiple=this.predictMultiple.bind(this),this.classify=this.classify.bind(this),this.classifyMultiple=this.classifyMultiple.bind(this),this.predictInternal=this.predictInternal.bind(this),this.classifyInternal=this.classifyInternal.bind(this),this.saveData=this.saveData.bind(this),this.loadData=this.loadData.bind(this),this.save=this.save.bind(this),this.load=this.load.bind(this),this.init(this.callback)}return(0,p.default)(t,[{key:"init",value:function(t){null!==this.options.dataUrl?this.ready=this.loadDataFromUrl(this.options,t):null!==this.options.modelUrl?this.ready=this.load(this.options.modelUrl,t):this.ready=!0}},{key:"addData",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.options,i=r.inputs,o=r.outputs,a=void 0,s=void 0;if(null!==n?(a=n.inputLabels,s=n.outputLabels):i.length>0&&o.length>0?(i.every(function(t){return"string"==typeof t})&&(a=i),o.every(function(t){return"string"==typeof t})&&(s=o)):"object"===(void 0===t?"undefined":(0,f.default)(t))&&"object"===(void 0===e?"undefined":(0,f.default)(e))?(a=(0,l.default)(t),s=(0,l.default)(e)):(a=w.default.createLabelsFromArrayValues(t,"input"),s=w.default.createLabelsFromArrayValues(e,"output")),!(a instanceof Array))throw new Error("inputLabels must be an array");if(!(s instanceof Array))throw new Error("outputLabels must be an array");var u=this.searchAndFormat(t),c=w.default.formatDataAsObject(u,a),d=w.default.formatDataAsObject(e,s);this.neuralNetworkData.addData(c,d)}},{key:"loadDataFromUrl",value:function(t,e){return(0,y.default)(this.loadDataInternal(t),e)}},{key:"loadDataInternal",value:function(){var t=(0,c.default)(u.default.mark(function t(e){var n,r,i,o;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.dataUrl,r=e.inputs,i=e.outputs,t.next=3,this.neuralNetworkData.loadDataFromUrl(n,r,i);case 3:o=t.sent,this.createMetadata(o),this.prepareForTraining(o);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"createMetaData",value:function(t){var e=this.options.inputs,n=void 0;Array.isArray(e)&&e.length>0&&(n=e.every(function(t){return"number"==typeof t})&&e.length>0?e:null),this.neuralNetworkData.createMetadata(t,n)}},{key:"prepareForTraining",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=null===t?this.neuralNetworkData.data.raw:t,n=this.neuralNetworkData.applyOneHotEncodingsToDataRaw(e);return this.data.training=n,this.neuralNetworkData.isWarmedUp=!0,n}},{key:"normalizeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=null===t?this.neuralNetworkData.data.raw:t;this.neuralNetworkData.isMetadataReady||this.createMetaData(e),this.neuralNetworkData.isWarmedUp||this.prepareForTraining(e);var n=this.neuralNetworkData.normalizeDataRaw(e);return this.data.training=n,this.neuralNetworkData.meta.isNormalized=!0,n}},{key:"normalizeInput",value:function(t,e,n){var r=n[e],i=r.min,o=r.max;return w.default.normalizeValue(t,i,o)}},{key:"searchAndFormat",value:function(t){var e=this,n=void 0;if(Array.isArray(t))n=t.map(function(t){return e.formatInputItem(t)});else if("object"===(void 0===t?"undefined":(0,f.default)(t))){var r=(0,s.default)({},t);(0,l.default)(t).forEach(function(n){var i=t[n];r[n]=e.formatInputItem(i)}),n=r}return n}},{key:"formatInputItem",value:function(t){var e=void 0;return(0,x.isInstanceOfSupportedElement)(t)?e=t:"object"===(void 0===t?"undefined":(0,f.default)(t))&&(0,x.isInstanceOfSupportedElement)(t.elt)?e=t.elt:"object"===(void 0===t?"undefined":(0,f.default)(t))&&(0,x.isInstanceOfSupportedElement)(t.canvas)&&(e=t.canvas),e?(0,x.imgToPixelArray)(e):t}},{key:"convertTrainingDataToTensors",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=null===t?this.data.training:t,r=null===e?this.neuralNetworkData.meta:e;return this.neuralNetworkData.convertRawToTensors(n,r)}},{key:"formatInputsForPrediction",value:function(t,e,n){var r=this,i=[];return t instanceof Array?i=n.map(function(n,i){return r.isOneHotEncodedOrNormalized(t[i],n,e.inputs)}):t instanceof Object&&(i=n.map(function(n){return r.isOneHotEncodedOrNormalized(t[n],n,e.inputs)})),i.flat()}},{key:"formatInputsForPredictionAll",value:function(t,e,n){var r=this,i=void 0;return t instanceof Array&&t.every(function(t){return Array.isArray(t)})?(i=t.map(function(t){return r.formatInputsForPrediction(t,e,n)}),m.tensor(i,[t.length,n.length])):(i=this.formatInputsForPrediction(t,e,n),m.tensor([i]))}},{key:"isOneHotEncodedOrNormalized",value:function(t,e,n){var r=t,i=e,o=void 0;return"number"!=typeof t?o=n[i].legend[r]:(o=t,this.neuralNetworkData.meta.isNormalized&&(o=this.normalizeInput(t,i,n))),o}},{key:"train",value:function(t,e,n){var r=void 0,i=void 0,o=void 0;"object"===(void 0===t?"undefined":(0,f.default)(t))&&"function"==typeof e&&"function"==typeof n?(r=t,i=e,o=n):"object"===(void 0===t?"undefined":(0,f.default)(t))&&"function"==typeof e?(r=t,i=null,o=e):"function"==typeof t&&"function"==typeof e?(r={},i=t,o=e):(r={},i=null,o=t),this.trainInternal(r,i,o)}},{key:"trainInternal",value:function(t,e,n){var r=(0,d.default)({epochs:10,batchSize:32,validationSplit:.1,whileTraining:null},t);if(!0===this.options.debug?r.whileTraining=[this.neuralNetworkVis.trainingVis(),{onEpochEnd:null}]:r.whileTraining=[{onEpochEnd:e}],this.neuralNetworkData.isMetadataReady||this.createMetaData(this.neuralNetworkData.data.raw),this.neuralNetworkData.isWarmedUp||this.prepareForTraining(this.neuralNetworkData.data.raw),!r.inputs&&!r.outputs){var i=this.convertTrainingDataToTensors(),o=i.inputs,a=i.outputs;r.inputs=o,r.outputs=a}this.neuralNetwork.isLayered||(this.options.layers=this.createNetworkLayers(this.options.layers,this.neuralNetworkData.meta)),this.neuralNetwork.isLayered||(this.options.layers=this.addDefaultLayers(this.options.task,this.neuralNetworkData.meta)),this.neuralNetwork.isCompiled||this.compile(),this.neuralNetwork.train(r,n)}},{key:"addLayer",value:function(t){this.neuralNetwork.addLayer(t)}},{key:"createNetworkLayers",value:function(t,e){var n=this,r=[].concat((0,a.default)(t)),i=(0,s.default)({},e),o=i.inputUnits,u=i.outputUnits,c=r.length;if(!(r.length>=2))return!1;r[0].inputShape=r[0].inputShape?r[0].inputShape:o;var l=r[c-1];return l.units=l.units?l.units:u,r.forEach(function(t){n.addLayer(m.layers[t.type](t))}),r}},{key:"addDefaultLayers",value:function(t,e){var n=void 0;switch(t.toLowerCase()){case"classification":return n=[{type:"dense",units:this.options.hiddenUnits,activation:"relu"},{type:"dense",activation:"softmax"}],this.createNetworkLayers(n,e);case"regression":return n=[{type:"dense",units:this.options.hiddenUnits,activation:"relu"},{type:"dense",activation:"sigmoid"}],this.createNetworkLayers(n,e);case"imageclassification":return n=[{type:"conv2d",filters:2,kernelSize:2,strides:2,activation:"relu",kernelInitializer:"varianceScaling"},{type:"maxPooling2d",poolSize:[1,1],strides:[1,1]},{type:"conv2d",filters:1,kernelSize:1,strides:1,activation:"relu",kernelInitializer:"varianceScaling"},{type:"maxPooling2d",poolSize:[1,1],strides:[1,1]},{type:"flatten"},{type:"dense",kernelInitializer:"varianceScaling",activation:"softmax"}],this.createNetworkLayers(n,e);default:return console.log("no imputUnits or outputUnits defined"),n=[{type:"dense",units:this.options.hiddenUnits,activation:"relu"},{type:"dense",activation:"sigmoid"}],this.createNetworkLayers(n,e)}}},{key:"compile",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=null===e?this.options.learningRate:e,r={};null!==t?r=(0,d.default)({},t):"classification"===this.options.task||"imageClassification"===this.options.task?r={loss:"categoricalCrossentropy",optimizer:m.train.sgd,metrics:["accuracy"]}:"regression"===this.options.task&&(r={loss:"meanSquaredError",optimizer:m.train.adam,metrics:["accuracy"]}),r.optimizer=r.optimizer?this.neuralNetwork.setOptimizerFunction(n,r.optimizer):this.neuralNetwork.setOptimizerFunction(n,m.train.sgd),this.neuralNetwork.compile(r),this.options.debug&&this.neuralNetworkVis.modelSummary({name:"Model Summary"},this.neuralNetwork.model)}},{key:"predict",value:function(t,e){return(0,y.default)(this.predictInternal(t),e)}},{key:"predictMultiple",value:function(t,e){return(0,y.default)(this.predictInternal(t),e)}},{key:"classify",value:function(t,e){return(0,y.default)(this.classifyInternal(t),e)}},{key:"classifyMultiple",value:function(t,e){return(0,y.default)(this.classifyInternal(t),e)}},{key:"predictInternal",value:function(){var t=(0,c.default)(u.default.mark(function t(e){var n,r,i,a,s,c;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.neuralNetworkData.meta,r=(0,l.default)(n.inputs),i=this.formatInputsForPredictionAll(e,n,r),t.next=5,this.neuralNetwork.predict(i);case 5:if(a=t.sent,i.dispose(),null===n){t.next=13;break}if(s=(0,l.default)(n.outputs),!((c=a.map(function(t){return s.map(function(e,r){var i,a=void 0,u=void 0;if(n.isNormalized){var c=n.outputs[e],l=c.min,f=c.max;a=w.default.unnormalizeValue(t[r],l,f),u=t[r]}else a=t[r];var d=(i={},(0,o.default)(i,s[r],a),(0,o.default)(i,"label",e),(0,o.default)(i,"value",a),i);return u&&(d.unNormalizedValue=u),d})})).length<2)){t.next=12;break}return t.abrupt("return",c[0]);case 12:return t.abrupt("return",c);case 13:return t.abrupt("return",a);case 14:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var t=(0,c.default)(u.default.mark(function t(e){var n,s,c,f,d,h,p,g,v,b;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.neuralNetworkData.meta,s=(0,l.default)(n.inputs),c=void 0,"imageClassification"===this.options.task?(c=this.searchAndFormat(e),c=Array.isArray(c)?c.flat():c[s[0]],n.isNormalized?(f=n.inputs[s[0]],d=f.min,h=f.max,c=this.neuralNetworkData.normalizeArray((0,i.default)(c),{min:d,max:h})):c=(0,i.default)(c),c=m.tensor([c],[1].concat((0,a.default)(n.inputUnits)))):c=this.formatInputsForPredictionAll(e,n,s),t.next=6,this.neuralNetwork.classify(c);case 6:if(p=t.sent,c.dispose(),null===n){t.next=15;break}if(g=(0,l.default)(n.outputs)[0],v=(0,r.default)(n.outputs[g].legend),!((b=p.map(function(t){return v.map(function(e,n){var r;return r={},(0,o.default)(r,e[0],t[n]),(0,o.default)(r,"label",e[0]),(0,o.default)(r,"confidence",t[n]),r}).sort(function(t,e){return e.confidence-t.confidence})})).length<2)){t.next=14;break}return t.abrupt("return",b[0]);case 14:return t.abrupt("return",b);case 15:return t.abrupt("return",p);case 16:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"saveData",value:function(t){this.neuralNetworkData.saveData(t)}},{key:"loadData",value:function(){var t=(0,c.default)(u.default.mark(function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments[1];return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:this.neuralNetworkData.loadData(e,n);case 1:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"save",value:function(t,e){var n=this,r=void 0,i=void 0;"function"==typeof t?(r="model",i=t):"string"==typeof t?(r=t,"function"==typeof e&&(i=e)):r="model",this.neuralNetwork.save(r,function(){n.neuralNetworkData.saveMeta(r,i)})}},{key:"load",value:function(){var t=(0,c.default)(u.default.mark(function t(){var e,n=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments[1];return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=void 0,i&&(e=i),this.neuralNetwork.load(r,function(){return n.neuralNetworkData.loadMeta(r,e),n.neuralNetwork.model});case 3:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();e.default=function(t,e,n){var r=void 0,i=void 0;return t instanceof Object?(r=t,i=e):(r={inputs:t,outputs:e},i=n),new S(r,i)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={leftFace:{id:0,color:[110,64,170]},rightFace:{id:1,color:[106,72,183]},rightUpperLegFront:{id:2,color:[100,81,196]},rightLowerLegBack:{id:3,color:[92,91,206]},rightUpperLegBack:{id:4,color:[84,101,214]},leftLowerLegFront:{id:5,color:[75,113,221]},leftUpperLegFront:{id:6,color:[66,125,224]},leftUpperLegBack:{id:7,color:[56,138,226]},leftLowerLegBack:{id:8,color:[48,150,224]},rightFeet:{id:9,color:[40,163,220]},rightLowerLegFront:{id:10,color:[33,176,214]},leftFeet:{id:11,color:[29,188,205]},torsoFront:{id:12,color:[26,199,194]},torsoBack:{id:13,color:[26,210,182]},rightUpperArmFront:{id:14,color:[28,219,169]},rightUpperArmBack:{id:15,color:[33,227,155]},rightLowerArmBack:{id:16,color:[41,234,141]},leftLowerArmFront:{id:17,color:[51,240,128]},leftUpperArmFront:{id:18,color:[64,243,116]},leftUpperArmBack:{id:19,color:[79,246,105]},leftLowerArmBack:{id:20,color:[96,247,97]},rightHand:{id:21,color:[115,246,91]},rightLowerArmFront:{id:22,color:[134,245,88]},leftHand:{id:23,color:[155,243,88]}}},function(t,e,n){"use strict";n.r(e),n.d(e,"BodyPix",function(){return x}),n.d(e,"load",function(){return _}),n.d(e,"checkpoints",function(){return h}),n.d(e,"decodePartSegmentation",function(){return m}),n.d(e,"toMask",function(){return p}),n.d(e,"drawBokehEffect",function(){return F}),n.d(e,"drawMask",function(){return j}),n.d(e,"drawPixelatedMask",function(){return R}),n.d(e,"toColoredPartImageData",function(){return I}),n.d(e,"toMaskImageData",function(){return T}),n.d(e,"partChannels",function(){return P}),n.d(e,"resizeAndPadTo",function(){return b}),n.d(e,"scaleAndCropToInputTensorShape",function(){return y});var r=n(0),i=n(32);
/**
* @license
* Copyright 2019 Google LLC. 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 o(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function a(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var s=[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1]],u=[8,16,32];function c(t){r.util.assert("number"==typeof t,function(){return"outputStride is not a number"}),r.util.assert(u.indexOf(t)>=0,function(){return"outputStride of "+t+" is invalid. It must be either 8, 16, or 32"})}var l={100:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",2],["separableConv",1]],75:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1]],50:s,25:s},f=function(){function t(t,e){this.PREPROCESS_DIVISOR=Object(r.scalar)(127.5),this.ONE=Object(r.scalar)(1),this.modelWeights=t,this.convolutionDefinitions=e}return t.prototype.predict=function(t,e){var n=this,i=Object(r.div)(t.toFloat(),this.PREPROCESS_DIVISOR),o=Object(r.sub)(i,this.ONE);return function(t,e){var n=1,r=1;return t.map(function(t,i){var o,a,s=t[0],u=t[1];return n===e?(o=1,a=r,r*=u):(o=u,a=1,n*=u),{blockId:i,convType:s,stride:o,rate:a,outputStride:n}})}(this.convolutionDefinitions,e).reduce(function(t,e){var r=e.blockId,i=e.stride,o=e.convType,a=e.rate;if("conv2d"===o)return n.conv(t,i,r);if("separableConv"===o)return n.separableConv(t,i,r,a);throw Error("Unknown conv type of "+o)},o)},t.prototype.convToOutput=function(t,e){return t.conv2d(this.weights(e),1,"same").add(this.convBias(e,!1))},t.prototype.conv=function(t,e,n){var r=this.weights("Conv2d_"+String(n));return t.conv2d(r,e,"same").add(this.convBias("Conv2d_"+String(n))).clipByValue(0,6)},t.prototype.separableConv=function(t,e,n,r){void 0===r&&(r=1);var i="Conv2d_"+String(n)+"_depthwise",o="Conv2d_"+String(n)+"_pointwise";return t.depthwiseConv2D(this.depthwiseWeights(i),e,"same","NHWC",r).add(this.depthwiseBias(i)).clipByValue(0,6).conv2d(this.weights(o),[1,1],"same").add(this.convBias(o)).clipByValue(0,6)},t.prototype.weights=function(t){return this.modelWeights.weights(t)},t.prototype.convBias=function(t,e){return void 0===e&&(e=!0),this.modelWeights.convBias(t,e)},t.prototype.depthwiseBias=function(t){return this.modelWeights.depthwiseBias(t)},t.prototype.depthwiseWeights=function(t){return this.modelWeights.depthwiseWeights(t)},t.prototype.dispose=function(){this.modelWeights.dispose()},t}(),d="https://storage.googleapis.com/tfjs-models/savedmodel/",h={1:{url:d+"posenet_mobilenet_100_partmap/",architecture:l[100]},.75:{url:d+"posenet_mobilenet_075_partmap/",architecture:l[75]},.5:{url:d+"posenet_mobilenet_050_partmap/",architecture:l[50]},.25:{url:d+"posenet_mobilenet_025_partmap/",architecture:l[25]}};function p(t,e){return Object(r.tidy)(function(){return t.greater(Object(r.scalar)(e)).toInt()})}function m(t,e){var n=e.shape,i=n[0],o=n[1],a=n[2];return Object(r.tidy)(function(){var n=function(t){var e=t.shape[2],n=t.argMax(2).reshape([-1]);return Object(r.oneHot)(n,e)}(e),s=Object(r.range)(0,a,1,"int32").expandDims(1);return function(t,e){return t.mul(e)}(n.matMul(s).toInt().reshape([i,o]).add(Object(r.scalar)(1,"int32")),t).sub(Object(r.scalar)(1,"int32"))})}var g=function(){function t(t){this.graphModel=t}return t.prototype.weights=function(t){return this.getVariable("MobilenetV1/"+t+"/weights")},t.prototype.convBias=function(t,e){return void 0===e&&(e=!0),this.getVariable("MobilenetV1/"+t+"/Conv2D_bias")},t.prototype.depthwiseBias=function(t){return this.getVariable("MobilenetV1/"+t+"/depthwise_bias")},t.prototype.depthwiseWeights=function(t){return this.getVariable("MobilenetV1/"+t+"/depthwise_weights")},t.prototype.getVariable=function(t){return this.graphModel.weights[""+t][0]},t.prototype.dispose=function(){this.graphModel.dispose()},t}();function v(t){return t instanceof r.Tensor?t:r.browser.fromPixels(t)}function b(t,e,n){var i=e[0],o=e[1];void 0===n&&(n=!1);var a,s,u,c,l,f,d=t.shape,h=d[0],p=d[1]/h;if(p>o/i){a=o;var m=i-(s=Math.ceil(a/p));u=0,c=0,l=Math.floor(m/2),f=i-(s+l)}else{s=i;var g=o-(a=Math.ceil(i*p));u=Math.floor(g/2),c=o-(a+u),l=0,f=0}return{resizedAndPadded:Object(r.tidy)(function(){var e;return e=n?t.reverse(1).resizeBilinear([s,a]):t.resizeBilinear([s,a]),Object(r.pad3d)(e,[[l,f],[u,c],[0,0]])}),paddedBy:[[l,f],[u,c]]}}function y(t,e,n,i){var o=e[0],a=e[1],s=n[0],u=n[1],c=i[0],l=c[0],f=c[1],d=i[1],h=d[0],p=d[1];return Object(r.tidy)(function(){return function(t,e,n){var i=e[0],o=e[1],a=n[0],s=a[0],u=a[1],c=n[1],l=c[0],f=c[1],d=t.shape,h=d[0],p=d[1],m=h-(s+u),g=p-(l+f);return Object(r.tidy)(function(){return Object(r.slice3d)(t,[s,l,0],[m,g,t.shape[2]]).resizeBilinear([i,o],!0)})}(t.resizeBilinear([s,u],!0),[o,a],[[l,f],[h,p]])})}var w=[353,257],x=function(){function t(t){this.mobileNet=t}return t.prototype.predictForSegmentation=function(t,e){var n=this;return void 0===e&&(e=16),c(e),Object(r.tidy)(function(){var r=n.mobileNet.predict(t,e);return n.mobileNet.convToOutput(r,"segment_2").sigmoid()})},t.prototype.predictForPartMap=function(t,e){var n=this;return void 0===e&&(e=16),c(e),Object(r.tidy)(function(){var r=n.mobileNet.predict(t,e),i=n.mobileNet.convToOutput(r,"segment_2"),o=n.mobileNet.convToOutput(r,"part_heatmap_2");return{segmentScores:i.sigmoid(),partHeatmapScores:o.sigmoid()}})},t.prototype.estimatePersonSegmentationActivation=function(t,e,n){var i=this;return void 0===e&&(e=16),void 0===n&&(n=.5),c(e),Object(r.tidy)(function(){var r=v(t),o=b(r,w),a=o.resizedAndPadded,s=o.paddedBy,u=i.predictForSegmentation(a,e),c=a.shape,l=c[0],f=c[1],d=r.shape;return p(y(u,[d[0],d[1]],[l,f],s).squeeze(),n)})},t.prototype.estimatePersonSegmentation=function(t,e,n){return void 0===e&&(e=16),void 0===n&&(n=.5),o(this,void 0,void 0,function(){var r,i,o,s,u;return a(this,function(a){switch(a.label){case 0:return r=this.estimatePersonSegmentationActivation(t,e,n),i=r.shape,o=i[0],s=i[1],[4,r.data()];case 1:return u=a.sent(),r.dispose(),[2,{height:o,width:s,data:u}]}})})},t.prototype.estimatePartSegmentationActivation=function(t,e,n){var i=this;return void 0===e&&(e=16),void 0===n&&(n=.5),c(e),Object(r.tidy)(function(){var r=v(t),o=b(r,w),a=o.resizedAndPadded,s=o.paddedBy,u=i.predictForPartMap(a,e),c=u.segmentScores,l=u.partHeatmapScores,f=a.shape,d=f[0],h=f[1],g=r.shape,x=g[0],_=g[1],k=y(c,[x,_],[d,h],s),S=y(l,[x,_],[d,h],s);return m(p(k.squeeze(),n),S)})},t.prototype.estimatePartSegmentation=function(t,e,n){return void 0===e&&(e=16),void 0===n&&(n=.5),o(this,void 0,void 0,function(){var r,i,o,s,u;return a(this,function(a){switch(a.label){case 0:return r=this.estimatePartSegmentationActivation(t,e,n),i=r.shape,o=i[0],s=i[1],[4,r.data()];case 1:return u=a.sent(),r.dispose(),[2,{height:o,width:s,data:u}]}})})},t.prototype.dispose=function(){this.mobileNet.dispose()},t}();function _(t){return void 0===t&&(t=.75),o(this,void 0,void 0,function(){var e,n;return a(this,function(i){switch(i.label){case 0:if(null==r)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");return e=Object.keys(h),r.util.assert("number"==typeof t,function(){return"got multiplier type of "+typeof t+" when it should be a number."}),r.util.assert(e.indexOf(t.toString())>=0,function(){return"invalid multiplier value of "+t+". No checkpoint exists for that multiplier. Must be one of "+e.join(",")+"."}),[4,k.load(t)];case 1:return n=i.sent(),[2,new x(n)]}})})}var k={load:function(t){return o(void 0,void 0,void 0,function(){var e,n,r,o;return a(this,function(a){switch(a.label){case 0:return e=h[t],n=e.url,[4,Object(i.c)(n+"model.json")];case 1:return r=a.sent(),o=new g(r),[2,new f(o,e.architecture)]}})})}},S={};function E(t,e,n,r){var i=t.width,o=t.height,a=e.width,s=e.height;if(i!==a||o!==s)throw new Error("error: dimensions must match. "+n+" has dimensions "+i+"x"+o+", "+r+" has dimensions "+a+"x"+s)}function O(t){var e=t.getContext("2d");e.scale(-1,1),e.translate(-t.width,0)}function A(t,e,n){t.globalCompositeOperation=n,t.drawImage(e,0,0)}function C(t){return S[t]||(S[t]=document.createElement("canvas")),S[t]}function M(t,e,n){var r=C(n);return 0===e?function(t,e){var n=t.width,r=t.height;e.width=n,e.height=r,e.getContext("2d").drawImage(t,0,0,n,r)}(t,r):function(t,e,n){var r=t.height,i=t.width,o=n.getContext("2d");n.width=i,n.height=r,o.clearRect(0,0,i,r),o.save(),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?function(t,e,n){for(var r=t.getContext("2d"),i=0,o=1/(2*Math.PI*5*5),a=n<3?1:2,s=-n;s<=n;s+=a)for(var u=-n;u<=n;u+=a)i+=o*Math.exp(-(u*u+s*s)/50);for(s=-n;s<=n;s+=a)for(u=-n;u<=n;u+=a)r.globalAlpha=o*Math.exp(-(u*u+s*s)/50)/i*n,r.drawImage(e,u,s);r.globalAlpha=1}(n,t,e):(o.filter="blur("+e+"px)",o.drawImage(t,0,0,i,r)),o.restore()}(t,e,r),r}function N(t,e){var n=C(e);return function(t,e){e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t,0,0)}(t,n),n}function T(t,e){void 0===e&&(e=!0);for(var n=t.width,r=t.height,i=t.data,o=new Uint8ClampedArray(n*r*4),a=0;a<r*n;++a){var s=255*(e?1-i[a]:i[a]),u=4*a;o[u+0]=0,o[u+1]=0,o[u+2]=0,o[u+3]=Math.round(s)}return new ImageData(o,n,r)}function I(t,e){for(var n=t.width,r=t.height,i=t.data,o=new Uint8ClampedArray(n*r*4),a=0;a<r*n;++a){var s=Math.round(i[a]),u=4*a;if(-1===s)o[u+0]=255,o[u+1]=255,o[u+2]=255,o[u+3]=255;else{var c=e[s];if(!c)throw new Error("No color could be found for part id "+s);o[u+0]=c[0],o[u+1]=c[1],o[u+2]=c[2],o[u+3]=255}}return new ImageData(o,n,r)}var D={blurred:"blurred",blurredMask:"blurred-mask",mask:"mask",lowresPartMask:"lowres-part-mask"};function j(t,e,n,r,i,o){void 0===r&&(r=.7),void 0===i&&(i=0),void 0===o&&(o=!1),E(e,n,"image","mask");var a=M(N(n,D.mask),i,D.blurredMask);t.width=a.width,t.height=a.height;var s=t.getContext("2d");s.save(),o&&O(t),s.drawImage(e,0,0),s.globalAlpha=r,s.drawImage(a,0,0),s.restore()}function R(t,e,n,r,i,o,a){void 0===r&&(r=.7),void 0===i&&(i=0),void 0===o&&(o=!1),void 0===a&&(a=10),E(e,n,"image","mask");var s=M(N(n,D.mask),i,D.blurredMask);t.width=s.width,t.height=s.height;var u=t.getContext("2d");u.save(),o&&O(t);var c=C(D.lowresPartMask),l=c.getContext("2d");c.width=s.width*(1/a),c.height=s.height*(1/a),l.drawImage(s,0,0,s.width,s.height,0,0,c.width,c.height),u.imageSmoothingEnabled=!1,u.drawImage(c,0,0,c.width,c.height,0,0,t.width,t.height);for(var f=0;f<c.width;f++)u.beginPath(),u.strokeStyle="#ffffff",u.moveTo(a*f,0),u.lineTo(a*f,t.height),u.stroke();for(f=0;f<c.height;f++)u.beginPath(),u.strokeStyle="#ffffff",u.moveTo(0,a*f),u.lineTo(t.width,a*f),u.stroke();u.globalAlpha=1-r,u.drawImage(e,0,0),u.restore()}function F(t,e,n,r,i,o){void 0===r&&(r=3),void 0===i&&(i=3),void 0===o&&(o=!1),E(e,n,"image","segmentation");var a=M(e,r,D.blurred),s=function(t,e){var n=N(T(t,!1),D.mask);return 0===e?n:M(n,e,D.blurredMask)}(n,i),u=t.getContext("2d");u.save(),o&&O(t),u.drawImage(e,0,0),A(u,s,"destination-in"),A(u,a,"destination-over"),u.restore()}var P=["leftFace","rightFace","rightUpperLegFront","rightLowerLegBack","rightUpperLegBack","leftLowerLegFront","leftUpperLegFront","leftUpperLegBack","leftLowerLegBack","rightFeet","rightLowerLegFront","leftFeet","torsoFront","torsoBack","rightUpperArmFront","rightUpperArmBack","rightLowerArmBack","leftLowerArmFront","leftUpperArmFront","leftUpperArmBack","leftLowerArmBack","rightHand","rightLowerArmFront","leftHand"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=v(n(17)),i=v(n(91)),o=v(n(36)),a=v(n(61)),s=v(n(72)),u=v(n(12)),c=v(n(11)),l=v(n(9)),f=v(n(10)),d=g(n(2)),h=g(n(411)),p=v(n(20)),m=v(n(108));function g(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function v(t){return t&&t.__esModule?t:{default:t}}var b={multiplier:.75,outputStride:16,segmentationThreshold:.5,palette:v(n(410)).default,returnTensors:!1},y=function(){function t(e,n,r){(0,l.default)(this,t),this.video=e,this.model=null,this.modelReady=!1,this.modelPath="",this.config={multiplier:n.multiplier||b.multiplier,outputStride:n.outputStride||b.outputStride,segmentationThreshold:n.segmentationThreshold||b.segmentationThreshold,palette:n.palette||b.palette,returnTensors:n.returnTensors||b.returnTensors},this.ready=(0,p.default)(this.loadModel(),r)}return(0,f.default)(t,[{key:"loadModel",value:function(){var t=(0,c.default)(u.default.mark(function t(){return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h.load(this.config.multiplier);case 2:return this.model=t.sent,this.modelReady=!0,t.abrupt("return",this);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"p5Color2RGB",value:function(t){var e=/\(([^)]+)\)/.exec(t.toString("rgb"))[1].split(","),n=(0,s.default)(e,3);return[n[0],n[1],n[2]]}},{key:"convertToP5Image",value:function(){var t=(0,c.default)(u.default.mark(function t(e,n,r){var i,o;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.default.rawToBlob(e,n,r);case 2:return i=t.sent,t.next=5,m.default.blobToP5Image(i);case 5:return o=t.sent,t.abrupt("return",o);case 7:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"bodyPartsSpec",value:function(t){var e=this,n=void 0!==t||(0,a.default)(t).length>=24?t:this.config.palette;return m.default.checkP5()&&void 0!==n&&(0,a.default)(n).length>=24&&(0,a.default)(n).forEach(function(t){n[t].color instanceof window.p5.Color?n[t].color=e.p5Color2RGB(n[t].color):n[t].color=n[t].color}),n}},{key:"segmentWithPartsInternal",value:function(){var t=(0,c.default)(u.default.mark(function t(e,n){var r,s,c,l,f,p,g,v,b,y,w,x=this;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,d.nextFrame();case 4:if(!this.video||0!==this.video.readyState){t.next=7;break}return t.next=7,new o.default(function(t){x.video.onloadeddata=function(){return t()}});case 7:return this.config.palette=n.palette||this.config.palette,this.config.outputStride=n.outputStride||this.config.outputStride,this.config.segmentationThreshold=n.segmentationThreshold||this.config.segmentationThreshold,t.next=12,this.model.estimatePartSegmentation(e,this.config.outputStride,this.config.segmentationThreshold);case 12:return r=t.sent,s=this.bodyPartsSpec(this.config.palette),c=(0,a.default)(s).map(function(t){return s[t].color}),(l={segmentation:r,raw:{personMask:null,backgroundMask:null,partMask:null},tensor:{personMask:null,backgroundMask:null,partMask:null},personMask:null,backgroundMask:null,partMask:null,bodyParts:s}).raw.backgroundMask=h.toMaskImageData(r,!0),l.raw.personMask=h.toMaskImageData(r,!1),l.raw.partMask=h.toColoredPartImageData(r,c),f=d.tidy(function(){var t=d.browser.fromPixels(e),n=d.ones([r.height,r.width,1]).tile([1,1,1]).mul(255);t=t.concat(n,2);var o=d.tensor(r.data,[r.height,r.width,1]),a=d.tensor(r.data,[r.height,r.width,1]),s=d.tensor([].concat((0,i.default)(l.raw.partMask.data)),[r.height,r.width,4]);return{personMask:o=d.cast(o.add(.2).sign().relu().mul(t),"int32"),backgroundMask:a=d.cast(a.add(.2).sign().neg().relu().mul(t),"int32"),partMask:s=d.cast(s,"int32")}}),p=f.personMask,g=f.backgroundMask,v=f.partMask,t.next=22,d.browser.toPixels(p);case 22:return b=t.sent,t.next=25,d.browser.toPixels(g);case 25:return y=t.sent,t.next=28,d.browser.toPixels(v);case 28:if(w=t.sent,l.personMask=b,l.backgroundMask=y,l.partMask=w,!m.default.checkP5()){t.next=42;break}return t.next=35,this.convertToP5Image(b,r.width,r.height);case 35:return l.personMask=t.sent,t.next=38,this.convertToP5Image(y,r.width,r.height);case 38:return l.backgroundMask=t.sent,t.next=41,this.convertToP5Image(w,r.width,r.height);case 41:l.partMask=t.sent;case 42:return this.config.returnTensors?(l.tensor.personMask=p,l.tensor.backgroundMask=g,l.tensor.partMask=v):(p.dispose(),g.dispose(),v.dispose()),t.abrupt("return",l);case 44:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"segmentWithParts",value:function(){var t=(0,c.default)(u.default.mark(function t(e,n,i){var o,a,s;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=this.video,a=void 0,s=this.config,"function"!=typeof e){t.next=8;break}o=this.video,a=e,t.next=26;break;case 8:if(!(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData)){t.next=12;break}o=e,t.next=26;break;case 12:if("object"!==(void 0===e?"undefined":(0,r.default)(e))||!(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)){t.next=16;break}o=e.elt,t.next=26;break;case 16:if(!("object"===(void 0===e?"undefined":(0,r.default)(e))&&e.canvas instanceof HTMLCanvasElement)){t.next=20;break}o=e.canvas,t.next=26;break;case 20:if(!("object"===(void 0===e?"undefined":(0,r.default)(e))&&e.elt instanceof HTMLVideoElement)){t.next=24;break}o=e.elt,t.next=26;break;case 24:if(this.video instanceof HTMLVideoElement){t.next=26;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 26:return"object"===(void 0===n?"undefined":(0,r.default)(n))?s=n:"function"==typeof n&&(a=n),"function"==typeof i&&(a=i),t.abrupt("return",(0,p.default)(this.segmentWithPartsInternal(o,s),a));case 29:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"segmentInternal",value:function(){var t=(0,c.default)(u.default.mark(function t(e,n){var r,i,a,s,c,l,f,p=this;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,d.nextFrame();case 4:if(!this.video||0!==this.video.readyState){t.next=7;break}return t.next=7,new o.default(function(t){p.video.onloadeddata=function(){return t()}});case 7:return this.config.outputStride=n.outputStride||this.config.outputStride,this.config.segmentationThreshold=n.segmentationThreshold||this.config.segmentationThreshold,t.next=11,this.model.estimatePersonSegmentation(e,this.config.outputStride,this.config.segmentationThreshold);case 11:return r=t.sent,(i={segmentation:r,raw:{personMask:null,backgroundMask:null},tensor:{personMask:null,backgroundMask:null},personMask:null,backgroundMask:null}).raw.backgroundMask=h.toMaskImageData(r,!0),i.raw.personMask=h.toMaskImageData(r,!1),a=d.tidy(function(){var t=d.browser.fromPixels(e),n=d.ones([r.height,r.width,1]).tile([1,1,1]).mul(255);t=t.concat(n,2);var i=d.tensor(r.data,[r.height,r.width,1]),o=d.tensor(r.data,[r.height,r.width,1]);return{personMask:i=d.cast(i.neg().add(1).mul(t),"int32"),backgroundMask:o=d.cast(o.mul(t),"int32")}}),s=a.personMask,c=a.backgroundMask,t.next=18,d.browser.toPixels(s);case 18:return l=t.sent,t.next=21,d.browser.toPixels(c);case 21:if(f=t.sent,!m.default.checkP5()){t.next=31;break}return t.next=25,this.convertToP5Image(l,r.width,r.height);case 25:return i.personMask=t.sent,t.next=28,this.convertToP5Image(f,r.width,r.height);case 28:i.backgroundMask=t.sent,t.next=33;break;case 31:i.personMask=l,i.backgroundMask=f;case 33:return this.config.returnTensors?(i.tensor.personMask=s,i.tensor.backgroundMask=c):(s.dispose(),c.dispose()),t.abrupt("return",i);case 35:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"segment",value:function(){var t=(0,c.default)(u.default.mark(function t(e,n,i){var o,a,s;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=this.video,a=void 0,s=this.config,"function"!=typeof e){t.next=8;break}o=this.video,a=e,t.next=26;break;case 8:if(!(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData)){t.next=12;break}o=e,t.next=26;break;case 12:if("object"!==(void 0===e?"undefined":(0,r.default)(e))||!(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)){t.next=16;break}o=e.elt,t.next=26;break;case 16:if(!("object"===(void 0===e?"undefined":(0,r.default)(e))&&e.canvas instanceof HTMLCanvasElement)){t.next=20;break}o=e.canvas,t.next=26;break;case 20:if(!("object"===(void 0===e?"undefined":(0,r.default)(e))&&e.elt instanceof HTMLVideoElement)){t.next=24;break}o=e.elt,t.next=26;break;case 24:if(this.video instanceof HTMLVideoElement){t.next=26;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 26:return"object"===(void 0===n?"undefined":(0,r.default)(n))?s=n:"function"==typeof n&&(a=n),"function"==typeof i&&(a=i),t.abrupt("return",(0,p.default)(this.segmentInternal(o,s),a));case 29:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()}]),t}();e.default=function(t,e,n){var i=void 0,o={},a=n;t instanceof HTMLVideoElement?i=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.elt instanceof HTMLVideoElement?i=t.elt:"object"===(void 0===t?"undefined":(0,r.default)(t))?o=t:"function"==typeof t&&(a=t),"object"===(void 0===e?"undefined":(0,r.default)(e))?o=e:"function"==typeof e&&(a=e);var s=new y(i,o,a);return a?s:s.ready}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=l(n(12)),i=l(n(11)),o=l(n(9)),a=l(n(10)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),u=l(n(20)),c=l(n(173));function l(t){return t&&t.__esModule?t:{default:t}}var f=function(){function t(e,n){(0,o.default)(this,t),this.ready=(0,u.default)(this.loadModel(e),n)}return(0,a.default)(t,[{key:"loadModel",value:function(){var t=(0,i.default)(r.default.mark(function t(e){var n,i,o,a;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n={model:null,metadata:null},"moviereviews"!==e.toLowerCase()){t.next=6;break}n.model="https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/model.json",n.metadata="https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/metadata.json",t.next=14;break;case 6:if(!0!==c.default.isAbsoluteURL(e)){t.next=12;break}i=c.default.getModelPath(e),n.model=i+"/model.json",n.metadata=i+"/metadata.json",t.next=14;break;case 12:return console.error("problem loading model"),t.abrupt("return",this);case 14:return t.next=16,s.loadLayersModel(n.model);case 16:return this.model=t.sent,t.next=19,fetch(n.metadata);case 19:return o=t.sent,t.next=22,o.json();case 22:return a=t.sent,this.indexFrom=a.index_from,this.maxLen=a.max_len,this.wordIndex=a.word_index,this.vocabularySize=a.vocabulary_size,t.abrupt("return",this);case 28:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"predict",value:function(t){var e=this,n=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pre",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"pre",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.map(function(t){if(t.length>e&&("pre"===r?t.splice(0,t.length-e):t.splice(e,t.length-e)),t.length<e){for(var o=[],a=0;a<e-t.length;a+=1)o.push(i);t="pre"===n?o.concat(t):t.concat(o)}return t})}([t.trim().toLowerCase().replace(/[.,?!]/g,"").split(" ").map(function(t){var n=e.wordIndex[t]+e.indexFrom;return n>e.vocabularySize&&(n=2),n})],this.maxLen),r=s.tensor2d(n,[1,this.maxLen]),i=this.model.predict(r),o=i.dataSync()[0];return i.dispose(),r.dispose(),{score:o}}}]),t}();e.default=function(t,e){return new f(t,e)}},function(t){t.exports={name:"ml5",version:"0.4.3",description:"A friendly machine learning library for the web.",main:"dist/ml5.min.js",directories:{examples:"examples",dist:"dist"},scripts:{commit:"git-cz",prebuild:"rimraf dist",start:"webpack-dev-server --open --config webpack.dev.babel.js","manual-test":"webpack-dev-server --open --config webpack.test.babel.js",build:"webpack --config webpack.prod.babel.js",test:"./node_modules/karma/bin/karma start karma.conf.js ","test:single":"./node_modules/karma/bin/karma start karma.conf.js --single-run","test-travis":"./scripts/test-travis.sh","serve:docs":"docsify serve docs","update:readme":"node ./scripts/updateReadme.js","update:docs":"node ./scripts/updateDocVersions.js $oldversion","publish:npm":"npm run build && npm publish","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate"},repository:{type:"git",url:"git+https://github.com/ml5js/ml5-library.git"},keywords:["machine learning"],author:"NYU ITP <cvalenzuela@nyu.edu> (https://github.com/ml5js)",license:"ISC",bugs:{url:"https://github.com/ml5js/ml5-library/issues"},homepage:"https://github.com/ml5js/ml5-library#readme",devDependencies:{"all-contributors-cli":"^6.10.0","babel-cli":"6.26.0","babel-core":"6.26.0","babel-loader":"7.1.4","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-plugin-transform-runtime":"^6.23.0","babel-polyfill":"6.26.0","babel-preset-env":"1.6.1","babel-register":"6.26.0",commitizen:"4.0.3","cz-conventional-changelog":"2.1.0","docsify-cli":"^4.3.0",eslint:"4.18.2","eslint-config-airbnb-base":"12.1.0","eslint-config-prettier":"^4.1.0","eslint-loader":"2.0.0","eslint-plugin-import":"2.9.0","extract-text-webpack-plugin":"4.0.0-beta.0",ghooks:"2.0.2","html-webpack-plugin":"^3.0.7","jasmine-core":"3.1.0",karma:"2.0.0","karma-browserstack-launcher":"^1.5.1","karma-chrome-launcher":"2.2.0","karma-jasmine":"1.1.1","karma-mocha-reporter":"^2.2.5","karma-safari-launcher":"1.0.0","karma-webpack":"3.0.0","npm-run-all":"^4.1.2","regenerator-runtime":"0.11.1",rimraf:"2.6.2","semantic-release":"^15.13.26","uglifyjs-webpack-plugin":"^1.2.5",webpack:"4.1.1","webpack-cli":"2.0.10","webpack-dev-server":"3.1.11","webpack-merge":"^4.1.2"},config:{commitizen:{path:"node_modules/cz-conventional-changelog"}},files:["dist","README.md"],babel:{presets:[["env"]],plugins:["transform-runtime","transform-object-rest-spread"]},dependencies:{"@magenta/sketch":"0.2.0","@tensorflow-models/body-pix":"1.1.2","@tensorflow-models/coco-ssd":"^2.0.0","@tensorflow-models/knn-classifier":"1.2.1","@tensorflow-models/mobilenet":"2.0.3","@tensorflow-models/posenet":"2.1.3","@tensorflow-models/speech-commands":"0.3.9","@tensorflow/tfjs":"~1.2.1","@tensorflow/tfjs-vis":"^1.1.0",events:"^3.0.0","face-api.js":"0.20.1"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=o(n(91)),i=o(n(61));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){if("undefined"==typeof window)return t;if(void 0===window.p5)return t;if(void 0===window.p5.prototype)return t;if(void 0===window.p5.prototype.registerPreloadMethod)return t;var e=t;return(0,i.default)(t).forEach(function(n){var i=t[n];e[n]=function(){for(var e=null,n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];var s=o.length;return"function"==typeof o[s-1]&&(e=o[s-1],s-=1),i.apply(t,[].concat((0,r.default)(o.slice(0,s)),[function(){try{e&&e()}catch(t){console.error(t)}return window._decrementPreload?window._decrementPreload():null}]))},window.p5.prototype.registerPreloadMethod(""+n,t)}),t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=d(n(17)),i=d(n(12)),o=d(n(72)),a=d(n(11)),s=d(n(9)),u=d(n(10)),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),l=d(n(20)),f=d(n(108));function d(t){return t&&t.__esModule?t:{default:t}}var h=function(){function t(e,n,r){(0,s.default)(this,t),this.model={},this.modelPath=e,this.modelInfo={},this.modelPathPrefix="",this.modelReady=!1,this.config={returnTensors:n.returnTensors||!1},this.ready=(0,l.default)(this.loadModel(),r)}return(0,u.default)(t,[{key:"loadModel",value:function(){var t=(0,a.default)(i.default.mark(function t(){var e,n,r,a,s,u;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(this.modelPath);case 2:return e=t.sent,t.next=5,e.json();case 5:return n=t.sent,this.modelInfo=n,r=this.modelPath.split("manifest.json"),a=(0,o.default)(r,1),s=a[0],u=this.isAbsoluteURL(s)?this.modelInfo.model:this.modelPathPrefix+this.modelInfo.model,t.next=11,c.loadLayersModel(u);case 11:return this.model=t.sent,this.modelReady=!0,t.abrupt("return",this);case 14:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"generate",value:function(){var t=(0,a.default)(i.default.mark(function t(e,n){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.abrupt("return",(0,l.default)(this.generateInternal(n),e));case 3:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"compute",value:function(){var t=(0,a.default)(i.default.mark(function t(e,n){var r,o=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=c.tidy(function(){var t=void 0;if(!1===Array.isArray(n))t=c.randomNormal([1,e]);else{for(var r=c.buffer([1,e]),i=0;i<e;i+=1)r.set(n[i],0,i);t=r.toTensor()}return o.model.predict(t).squeeze().transpose([1,2,0]).div(c.scalar(2)).add(c.scalar(.5))}),t.abrupt("return",r);case 2:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"generateInternal",value:function(){var t=(0,a.default)(i.default.mark(function t(e){var n,r,a,s,u,l,d,h,p;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.modelInfo.modelLatentDim,t.next=3,this.compute(n,e);case 3:return r=t.sent,t.next=6,c.browser.toPixels(r);case 6:return a=t.sent,s=(0,o.default)(r.shape,2),u=s[0],l=s[1],t.next=10,f.default.rawToBlob(a,l,u);case 10:if(d=t.sent,h=void 0,!f.default.checkP5()){t.next=16;break}return t.next=15,f.default.blobToP5Image(d);case 15:h=t.sent;case 16:return(p={}).blob=d,p.raw=a,f.default.checkP5()&&(p.image=h),this.config.returnTensors?p.tensor=r:(p.tensor=null,r.dispose()),t.abrupt("return",p);case 22:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"isAbsoluteURL",value:function(t){return!!new RegExp("^(?:[a-z]+:)?//","i").test(t)}}]),t}();e.default=function(t,e,n){var i=void 0,o={};if("string"!=typeof t)throw new Error('Please specify a path to a "manifest.json" file: \n\n "models/face/manifest.json" \n\n\n This "manifest.json" file should include:\n\n {\n "description": "DCGAN, human faces, 64x64",\n "model": "https://raw.githubusercontent.com/viztopia/ml5dcgan/master/model/model.json", // "https://github.com/viztopia/ml5dcgan/blob/master/model/model.json",\n "modelSize": 64,\n "modelLatentDim": 128 \n }\n ');"function"==typeof e?i=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&(o=e,i=n);var a=new h(t,o,i);return i?a:a.ready}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=f(n(72)),i=f(n(36)),o=f(n(12)),a=f(n(11)),s=f(n(9)),u=f(n(10)),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),l=f(n(20));function f(t){return t&&t.__esModule?t:{default:t}}var d=function(){function t(e,n){var r=this;(0,s.default)(this,t),this.ready=!1,this.model={},this.latentDim=c.randomUniform([1,16]),this.modelPath=e,this.modelPathPrefix="",this.jsonLoader().then(function(t){r.modelPathPrefix=r.modelPath.split("manifest.json")[0],r.ready=(0,l.default)(r.loadCVAEModel(r.modelPathPrefix+t.model),n),r.labels=t.labels,r.labelVector=Array(r.labels.length+1).fill(0)})}return(0,u.default)(t,[{key:"loadCVAEModel",value:function(){var t=(0,a.default)(o.default.mark(function t(e){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c.loadLayersModel(e);case 2:return this.model=t.sent,t.abrupt("return",this);case 4:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"generate",value:function(){var t=(0,a.default)(o.default.mark(function t(e,n){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,l.default)(this.generateInternal(e),n));case 1:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"loadAsync",value:function(t){var e=this;return new i.default(function(n,r){e.ready||r(),loadImage(t,function(t){n(t)})})}},{key:"getBlob",value:function(t){var e=this;return new i.default(function(n,r){e.ready||r(),t.toBlob(function(t){n(t)})})}},{key:"checkP5",value:function(){return!!("undefined"!=typeof window&&window.p5&&this&&window.p5.Image&&"function"==typeof window.p5.Image)}},{key:"generateInternal",value:function(){var t=(0,a.default)(o.default.mark(function t(e){var n,i,a,s,u,l,f,d,h,p,m,g,v=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.tidy(function(){v.latentDim=c.randomUniform([1,16]);var t=v.labels.indexOf(e);if(t<0)return console.log("Wrong input of the label!"),[void 0,void 0];v.labelVector=v.labelVector.map(function(){return 0}),v.labelVector[t+1]=1;var n=c.tensor([v.labelVector]),r=v.model.predict([v.latentDim,n]);return r.reshape([r.shape[1],r.shape[2],r.shape[3]])}),t.next=3,c.browser.toPixels(n);case 3:for(i=t.sent,n.dispose(),a=document.createElement("canvas"),s=a.getContext("2d"),u=(0,r.default)(n.shape,2),l=u[0],f=u[1],a.width=l,a.height=f,d=s.createImageData(l,f),h=d.data,p=0;p<l*f*4;p+=1)h[p]=i[p];return s.putImageData(d,0,0),t.t0=URL,t.next=17,this.getBlob(a);case 17:if(t.t1=t.sent,m=t.t0.createObjectURL.call(t.t0,t.t1),g=void 0,!this.checkP5()){t.next=24;break}return t.next=23,this.loadAsync(m);case 23:g=t.sent;case 24:return t.abrupt("return",{src:m,raws:i,image:g});case 25:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"jsonLoader",value:function(){var t=(0,a.default)(o.default.mark(function t(){var e=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new i.default(function(t,n){var r=new XMLHttpRequest;r.open("GET",e.modelPath),r.onload=function(){var e=JSON.parse(r.responseText);t(e)},r.onerror=function(t){n(t)},r.send()}));case 1:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();e.default=function(t,e){return new d(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=d(n(17)),i=d(n(12)),o=d(n(11)),a=d(n(9)),s=d(n(10)),u=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),c=d(n(20)),l=n(62),f=d(n(108));function d(t){return t&&t.__esModule?t:{default:t}}var h={modelPath:"https://raw.githubusercontent.com/zaidalyafeai/HostedModels/master/unet-128/model.json",imageSize:128,returnTensors:!1},p=function(){function t(e,n,r){(0,a.default)(this,t),this.modelReady=!1,this.isPredicting=!1,this.config={modelPath:void 0!==n.modelPath?n.modelPath:h.modelPath,imageSize:void 0!==n.imageSize?n.imageSize:h.imageSize,returnTensors:void 0!==n.returnTensors?n.returnTensors:h.returnTensors},this.ready=(0,c.default)(this.loadModel(),r)}return(0,s.default)(t,[{key:"loadModel",value:function(){var t=(0,o.default)(i.default.mark(function t(){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u.loadLayersModel(this.config.modelPath);case 2:return this.model=t.sent,this.modelReady=!0,t.abrupt("return",this);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"segment",value:function(){var t=(0,o.default)(i.default.mark(function t(e,n){var o,a;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return o=void 0,a=n,e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof ImageData?o=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)?o=e.elt:"function"==typeof e&&(o=this.video,a=e),t.abrupt("return",(0,c.default)(this.segmentInternal(o),a));case 6:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"convertToP5Image",value:function(){var t=(0,o.default)(i.default.mark(function t(e){var n,r;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f.default.rawToBlob(e,this.config.imageSize,this.config.imageSize);case 2:return n=t.sent,t.next=5,f.default.blobToP5Image(n);case 5:return r=t.sent,t.abrupt("return",r);case 7:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"segmentInternal",value:function(){var e=(0,o.default)(i.default.mark(function e(n){var r,o,a,s,c,d,h,p,m,g,v,b,y,w,x=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ready;case 2:if(!(n instanceof HTMLVideoElement)){e.next=5;break}return e.next=5,u.nextFrame();case 5:return this.isPredicting=!0,r=u.tidy(function(){var t=u.browser.fromPixels(n).toFloat(),e=u.image.resizeBilinear(t,[x.config.imageSize,x.config.imageSize]).div(u.scalar(255)),r=e.expandDims(0),i=x.model.predict(r),o=u.ones([128,128,1]).tile([1,1,1]);e=e.concat(o,2);var a=i.squeeze([0]),s=(a=(a=a.tile([1,1,4])).sub(.3).sign().relu().neg().add(1)).mul(e),c=i.squeeze([0]),l=(c=(c=c.tile([1,1,4])).sub(.3).sign().relu()).mul(e),f=u.ones([128,128,1]).tile([1,1,1]).mul(255),d=i.squeeze([0]);return{featureMask:s,backgroundMask:l,segmentation:d=(d=u.cast(d.tile([1,1,3]).sub(.3).sign().relu().mul(255),"int32")).concat(f,2)}}),o=r.featureMask,a=r.backgroundMask,s=r.segmentation,this.isPredicting=!1,e.next=10,u.browser.toPixels(o);case 10:return c=e.sent,e.next=13,u.browser.toPixels(a);case 13:return d=e.sent,e.next=16,u.browser.toPixels(s);case 16:if(h=e.sent,p=(0,l.array3DToImage)(o),m=(0,l.array3DToImage)(a),g=t.dataURLtoBlob(p.src),v=t.dataURLtoBlob(m.src),b=void 0,y=void 0,w=void 0,!f.default.checkP5()){e.next=34;break}return e.next=27,this.convertToP5Image(c);case 27:return b=e.sent,e.next=30,this.convertToP5Image(d);case 30:return y=e.sent,e.next=33,this.convertToP5Image(h);case 33:w=e.sent;case 34:return this.config.returnTensors||(o.dispose(),a.dispose(),s.dispose()),e.abrupt("return",{segmentation:h,blob:{featureMask:g,backgroundMask:v},tensor:{featureMask:o,backgroundMask:a},raw:{featureMask:c,backgroundMask:d},featureMask:b,backgroundMask:y,mask:w});case 36:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}],[{key:"dataURLtoBlob",value:function(t){for(var e=t.split(","),n=e[0].match(/:(.*?);/)[1],r=atob(e[1]),i=r.length,o=new Uint8Array(i);i;)o[i]=r.charCodeAt(i),i-=1;return new Blob([o],{type:n})}}]),t}();e.default=function(t,e,n){var i=null,o={},a=n;return t instanceof HTMLVideoElement?i=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.elt instanceof HTMLVideoElement?i=t.elt:"function"==typeof t?a=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&(o=t),"object"===(void 0===e?"undefined":(0,r.default)(e))?o=e:"function"==typeof e&&(a=e),new p(i,o,a)}},function(t,e,n){"use strict";var r=n(26),i=n(127),o=n(64),a=n(109);t.exports=function(t){r(r.S,t,{from:function(t){var e,n,r,s,u=arguments[1];return i(this),(e=void 0!==u)&&i(u),void 0==t?new this:(n=[],e?(r=0,s=o(u,arguments[2],2),a(t,!1,function(t){n.push(s(t,r++))})):a(t,!1,n.push,n),new this(n))}})}},function(t,e,n){n(419)("Set")},function(t,e,n){"use strict";var r=n(26);t.exports=function(t){r(r.S,t,{of:function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},function(t,e,n){n(421)("Set")},function(t,e,n){var r=n(109);t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},function(t,e,n){var r=n(133),i=n(423);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return i(this)}}},function(t,e,n){var r=n(26);r(r.P+r.R,"Set",{toJSON:n(424)("Set")})},function(t,e,n){var r=n(45),i=n(271),o=n(28)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){var r=n(426);t.exports=function(t,e){return new(r(t))(e)}},function(t,e,n){var r=n(64),i=n(224),o=n(98),a=n(152),s=n(427);t.exports=function(t,e){var n=1==t,u=2==t,c=3==t,l=4==t,f=6==t,d=5==t||f,h=e||s;return function(e,s,p){for(var m,g,v=o(e),b=i(v),y=r(s,p,3),w=a(b.length),x=0,_=n?h(e,w):u?h(e,0):void 0;w>x;x++)if((d||x in b)&&(g=y(m=b[x],x,v),t))if(n)_[x]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return x;case 2:_.push(m)}else if(l)return!1;return f?-1:c||l?l:_}}},function(t,e,n){"use strict";var r=n(29),i=n(26),o=n(180),a=n(78),s=n(68),u=n(182),c=n(109),l=n(185),f=n(45),d=n(111),h=n(46).f,p=n(428)(0),m=n(55);t.exports=function(t,e,n,g,v,b){var y=r[t],w=y,x=v?"set":"add",_=w&&w.prototype,k={};return m&&"function"==typeof w&&(b||_.forEach&&!a(function(){(new w).entries().next()}))?(w=e(function(e,n){l(e,w,t,"_c"),e._c=new y,void 0!=n&&c(n,v,e[x],e)}),p("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(t){var e="add"==t||"set"==t;t in _&&(!b||"clear"!=t)&&s(w.prototype,t,function(n,r){if(l(this,w,t),!e&&b&&!f(n))return"get"==t&&void 0;var i=this._c[t](0===n?0:n,r);return e?this:i})}),b||h(w.prototype,"size",{get:function(){return this._c.size}})):(w=g.getConstructor(e,t,v,x),u(w.prototype,n),o.NEED=!0),d(w,t),k[t]=w,i(i.G+i.W+i.F,k),b||g.setStrong(w,t,v),w}},function(t,e,n){"use strict";var r=n(46).f,i=n(134),o=n(182),a=n(64),s=n(185),u=n(109),c=n(186),l=n(281),f=n(274),d=n(55),h=n(180).fastKey,p=n(261),m=d?"_s":"size",g=function(t,e){var n,r=h(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,c){var l=t(function(t,r){s(t,l,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[m]=0,void 0!=r&&u(r,n,t[c],t)});return o(l.prototype,{clear:function(){for(var t=p(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[m]=0},delete:function(t){var n=p(this,e),r=g(n,t);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[m]--}return!!r},forEach:function(t){p(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(p(this,e),t)}}),d&&r(l.prototype,"size",{get:function(){return p(this,e)[m]}}),l},def:function(t,e,n){var r,i,o=g(t,e);return o?o.v=n:(t._l=o={i:i=h(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[m]++,"F"!==i&&(t._i[i]=o)),t},getEntry:g,setStrong:function(t,e,n){c(t,e,function(t,n){this._t=p(t,e),this._k=n,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?l(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,l(1))},n?"entries":"values",!n,!0),f(e)}}},function(t,e,n){"use strict";var r=n(430),i=n(261);t.exports=n(429)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},function(t,e,n){n(187),n(93),n(110),n(431),n(425),n(422),n(420),t.exports=n(19).Set},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=new(function(t){return t&&t.__esModule?t:{default:t}}(n(262)).default)(["alarm_clock","ambulance","angel","ant","antyoga","backpack","barn","basket","bear","bee","beeflower","bicycle","bird","book","brain","bridge","bulldozer","bus","butterfly","cactus","calendar","castle","cat","catbus","catpig","chair","couch","crab","crabchair","crabrabbitfacepig","cruise_ship","diving_board","dog","dogbunny","dolphin","duck","elephant","elephantpig","eye","face","fan","fire_hydrant","firetruck","flamingo","flower","floweryoga","frog","frogsofa","garden","hand","hedgeberry","hedgehog","helicopter","kangaroo","key","lantern","lighthouse","lion","lionsheep","lobster","map","mermaid","monapassport","monkey","mosquito","octopus","owl","paintbrush","palm_tree","parrot","passport","peas","penguin","pig","pigsheep","pineapple","pool","postcard","power_outlet","rabbit","rabbitturtle","radio","radioface","rain","rhinoceros","rifle","roller_coaster","sandwich","scorpion","sea_turtle","sheep","skull","snail","snowflake","speedboat","spider","squirrel","steak","stove","strawberry","swan","swing_set","the_mona_lisa","tiger","toothbrush","toothpaste","tractor","trombone","truck","whale","windmill","yoga","yogabicycle","everything"]);e.default=r},function(t,e,n){"use strict";function r(t){return new Uint8Array(atob(t).split("").map(function(t){return t.charCodeAt(0)}))}Object.defineProperty(e,"__esModule",{value:!0}),e.stringToUint8array=r,e.stringToArray=function(t){var e=r(t);return new Int16Array(e.buffer)};var i=!1,o=0;function a(){if(i)return i=!1,o;var t=2*Math.random()-1,e=2*Math.random()-1,n=t*t+e*e;if(0===n||n>1)return a();var r=Math.sqrt(-2*Math.log(n)/n);return o=e*r,i=!0,t*r}function s(t,e){return Math.random()*(e-t)+t}function u(t,e){return t+a()*e}function c(t,e){void 0===e&&(e=2);var n=e;function r(t,e){return[t[0]-e[0],t[1]-e[1]]}function i(t,e){return t[0]*e[0]+t[1]*e[1]}function o(t){return t[0]*t[0]+t[1]*t[1]}function a(t,e){return o(r(t,e))}var s,u,c,l,f=t.length,d=[],h=n*n,p=[],m=[];for(p[0]=t[0],s=u=1,l=0;s<f;s++)a(t[s],t[l])<h||(p[u++]=t[s],l=s);for(l<f-1&&(p[u++]=t[f-1]),m[0]=m[u-1]=1,function t(e,n,s,u,c){if(!(u<=s+1)){for(var l,f,d,h,p=s,m=0,g=e*e,v=[n[s],n[u]],b=r(v[1],v[0]),y=o(b),w=s+1;w<u;w++)(d=i(r(n[w],v[0]),b))<=0?h=a(n[w],v[0]):y<=d?h=a(n[w],v[1]):(f=d/y,l=[v[0][0]+f*b[0],v[0][1]+f*b[1]],h=a(n[w],l)),h<=m||(p=w,m=h);m>g&&(c[p]=1,t(e,n,s,p,c),t(e,n,p,u,c))}}(n,p,0,u-1,m),s=c=0;s<u;s++)m[s]&&(d[c++]=p[s]);return d}e.gaussRandom=a,e.randf=s,e.randi=function(t,e){return Math.floor(Math.random()*(e-t)+t)},e.randn=u,e.birandn=function(t,e,n,r,i){var o=u(0,1),a=u(0,1);return[Math.sqrt(1-i*i)*n*o+i*n*a+t,r*a+e]},e.sampleSoftmax=function(t){var e,n=s(0,1),r=t.length,i=0;for(e=0;e<r;e++)if((i+=t[e])>=n)return e;return console.log("error sampling pi index"),-1},e.simplifyLine=c,e.simplifyLines=function(t,e){var n=[],r=2;e&&(r=e);for(var i=0;i<t.length;i++)n.push(c(t[i],r));return n},e.linesToStrokes=function(t){var e,n,r,i,o,a,s,u,c,l,f=0,d=0,h=[];for(s=0;s<t.length;s++)if((c=t[s].length)>1)for(u=0;u<c;u++)e=(l=t[s][u])[0],n=l[1],u===c-1?(a=1,o=0):(a=0,o=1),r=e-f,i=n-d,f=e,d=n,h.push([r,i,o,a,0]);return h.push([0,0,0,0,1]),h.slice(1)},e.lineToStroke=function(t,e){var n,r,i,o,a,s,u,c,l,f,d,h=[];if(l=e[0],f=e[1],(i=t.length)>1)for(d=0;d<i;d++)u=(o=t[d])[0],c=o[1],d===i-1?(r=1,n=0):(r=0,n=1),a=u-l,s=c-f,l=u,f=c,h.push([a,s,n,r,0]);return h}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=n(434),s=function(){function t(t){this.NMIXTURE=20,this.checkpointURL=t,this.initialized=!1}return t.prototype.isInitialized=function(){return this.initialized},t.prototype.instantiateFromJSON=function(t,e,n){var r;this.forgetBias=o.scalar(1),this.info=t,this.setPixelFactor(2),this.weightDims=e,this.numUnits=this.weightDims[0][0],this.weights=[];for(var i=0;i<n.length;i++){for(var s=(r=new Float32Array(a.stringToArray(n[i]))).length,u=0;u<s;u++)r[u]=10*r[u]/32767;this.weights.push(r)}this.outputKernel=o.tensor2d(this.weights[0],[this.weightDims[0][0],this.weightDims[0][1]]),this.outputBias=o.tensor1d(this.weights[1]);var c=o.tensor2d(this.weights[2],[this.weightDims[2][0],this.weightDims[2][1]]),l=o.tensor2d(this.weights[3],[this.weightDims[3][0],this.weightDims[3][1]]);this.lstmKernel=o.concat2d([c,l],0),this.lstmBias=o.tensor1d(this.weights[4]),this.rawVars=[this.outputKernel,this.outputBias,this.lstmKernel,this.lstmBias]},t.prototype.initialize=function(){return r(this,void 0,void 0,function(){var t;return i(this,function(e){switch(e.label){case 0:return this.dispose(),[4,fetch(this.checkpointURL).then(function(t){return t.json()})];case 1:return t=e.sent(),this.instantiateFromJSON(t[0],t[1],t[2]),this.initialized=!0,console.log("Initialized SketchRNN."),[2]}})})},t.prototype.dispose=function(){if(this.rawVars){for(var t=0;t<this.rawVars.length;t++)this.rawVars[t].dispose();this.rawVars=void 0}this.forgetBias&&(this.forgetBias.dispose(),this.forgetBias=void 0),this.initialized=!1},t.prototype.setPixelFactor=function(t){this.pixelFactor=t,this.scaleFactor=this.info.scale_factor/this.pixelFactor},t.prototype.update=function(t,e){var n=this,r=o.tidy(function(){var r=n.numUnits,i=n.scaleFactor,a=[t[0]/i,t[1]/i,t[2],t[3],t[4]],s=o.tensor2d(a,[1,5]),u=o.tensor2d(e.c,[1,r]),c=o.tensor2d(e.h,[1,r]),l=o.basicLSTMCell(n.forgetBias,n.lstmKernel,n.lstmBias,s,u,c);return o.concat(l,1)}),i=r.dataSync();r.dispose();var a=i.slice(0,this.numUnits),s=i.slice(this.numUnits,2*this.numUnits);return{c:new Float32Array(a),h:new Float32Array(s)}},t.prototype.updateStrokes=function(t,e,n){var r=this,i=o.tidy(function(){var i,a,s,u,c,l=r.numUnits,f=r.scaleFactor,d=t.length;n&&(d=n),s=o.tensor2d(e.c,[1,l]),u=o.tensor2d(e.h,[1,l]);for(var h=0;h<d;h++)i=[t[h][0]/f,t[h][1]/f,t[h][2],t[h][3],t[h][4]],a=o.tensor2d(i,[1,5]),s=(c=o.basicLSTMCell(r.forgetBias,r.lstmKernel,r.lstmBias,a,s,u))[0],u=c[1];return o.concat(c,1)}),a=i.dataSync();i.dispose();var s=a.slice(0,this.numUnits),u=a.slice(this.numUnits,2*this.numUnits);return{c:new Float32Array(s),h:new Float32Array(u)}},t.prototype.getPDF=function(t,e,n){var r=this;void 0===e&&(e=.65);var i=e,a=.5+.5*i;n&&(a=n);var s=this.NMIXTURE,u=o.tidy(function(){var e=r.numUnits,n=o.tensor2d(t.h,[1,e]),u=o.scalar(Math.sqrt(i)),c=o.scalar(a),l=o.add(o.matMul(n,r.outputKernel),r.outputBias).squeeze(),f=o.split(l,[3,6*s]),d=f[0],h=f[1],p=o.split(h,6),m=p[0],g=p[1],v=p[2],b=p[3],y=p[4],w=p[5],x=o.softmax(d.div(c)),_=[o.softmax(m.div(c)),g,v,o.exp(b).mul(u),o.exp(y).mul(u),o.tanh(w),x];return o.concat(_)}),c=u.dataSync();return u.dispose(),{pi:new Float32Array(c.slice(0,s)),muX:new Float32Array(c.slice(1*s,2*s)),muY:new Float32Array(c.slice(2*s,3*s)),sigmaX:new Float32Array(c.slice(3*s,4*s)),sigmaY:new Float32Array(c.slice(4*s,15*s)),corr:new Float32Array(c.slice(5*s,6*s)),pen:new Float32Array(c.slice(6*s,6*s+3))}},t.prototype.zeroState=function(){return{c:new Float32Array(this.numUnits),h:new Float32Array(this.numUnits)}},t.prototype.copyState=function(t){return{c:new Float32Array(t.c),h:new Float32Array(t.h)}},t.prototype.zeroInput=function(){return[0,0,1,0,0]},t.prototype.sample=function(t){var e=a.sampleSoftmax(t.pi),n=t.muX[e],r=t.muY[e],i=t.sigmaX[e],o=t.sigmaY[e],s=t.corr[e],u=[0,0,0];u[a.sampleSoftmax(t.pen)]=1;var c=a.birandn(n,r,i,o,s);return[c[0]*this.scaleFactor,c[1]*this.scaleFactor,u[0],u[1],u[2]]},t.prototype.simplifyLine=function(t,e){return a.simplifyLine(t,e)},t.prototype.simplifyLines=function(t,e){return a.simplifyLines(t,e)},t.prototype.linesToStroke=function(t){return a.linesToStrokes(t)},t.prototype.lineToStroke=function(t,e){return a.lineToStroke(t,e)},t}();e.SketchRNN=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(435);e.SketchRNN=r.SketchRNN},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);e.tf=r,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(436))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=f(n(12)),i=f(n(11)),o=f(n(9)),a=f(n(10)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(437)),u=f(n(20)),c=f(n(433)),l=f(n(173));function f(t){return t&&t.__esModule?t:{default:t}}var d={modelPath:"https://storage.googleapis.com/quickdraw-models/sketchRNN/large_models/",modelPath_large:"https://storage.googleapis.com/quickdraw-models/sketchRNN/models/",modelPath_small:"https://storage.googleapis.com/quickdraw-models/sketchRNN/models/",PATH_END:".gen.json",temperature:.65,pixelFactor:3},h=function(){function t(e,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(0,o.default)(this,t);var i=e;if(this.config={temperature:.65,pixelFactor:3,modelPath:d.modelPath,modelPath_small:d.modelPath_small,modelPath_large:d.modelPath_large,PATH_END:d.PATH_END},!0===l.default.isAbsoluteURL(i)){var a=l.default.getModelPath(i);this.config.modelPath=a}else{if(!c.default.has(i))return console.log("no model found!"),this;i=(r?this.config.modelPath:this.config.modelPath_small)+i+this.config.PATH_END,this.config.modelPath=i}this.model=new s.SketchRNN(this.config.modelPath),this.penState=this.model.zeroInput(),this.ready=(0,u.default)(this.model.initialize(),n)}return(0,a.default)(t,[{key:"generateInternal",value:function(){var t=(0,i.default)(r.default.mark(function t(e,n){var i,o,a,s;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=+e.temperature||this.config.temperature,o=+e.pixelFactor||this.config.pixelFactor,t.next=4,this.ready;case 4:return this.rnnState||(this.rnnState=this.model.zeroState(),this.model.setPixelFactor(o)),Array.isArray(n)&&n.length&&(this.rnnState=this.model.updateStrokes(n,this.rnnState)),this.rnnState=this.model.update(this.penState,this.rnnState),a=this.model.getPDF(this.rnnState,i),this.penState=this.model.sample(a),s={dx:this.penState[0],dy:this.penState[1]},1===this.penState[2]?s.pen="down":1===this.penState[3]?s.pen="up":1===this.penState[4]&&(s.pen="end"),t.abrupt("return",s);case 12:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"generate",value:function(){var t=(0,i.default)(r.default.mark(function t(e,n,i){var o,a,s,c;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=void 0,a=void 0,s=void 0,"function"==typeof e?(a={},s=[],o=e):Array.isArray(e)?(a={},s=e,o=n):"function"==typeof n?(a=e||{},s=[],o=n):(a=e||{},s=n||[],o=i),c=s.map(function(t){var e="up"===t.pen?1:0,n="down"===t.pen?1:0,r="end"===t.pen?1:0;return[t.dx,t.dy,n,e,r]}),t.abrupt("return",(0,u.default)(this.generateInternal(a,c),o));case 6:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"reset",value:function(){this.penState=this.model.zeroInput(),this.rnnState&&(this.rnnState=this.model.zeroState())}}]),t}();e.default=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return new h(t,e,n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=s(n(36)),i=s(n(9)),o=s(n(10)),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){(0,i.default)(this,t),this.urlPath=e}return(0,o.default)(t,[{key:"getAllVariables",value:function(){var t=this;return new r.default(function(e,n){var r={};if(t.urlPath in r)e(r[t.urlPath]);else{var i=new XMLHttpRequest;i.open("GET",t.urlPath,!0),i.responseType="arraybuffer",i.onload=function(){if(200===i.status){var o=i.response;if(o){for(var s=[],u=0;u<o.byteLength;){var c=new Uint8Array(o.slice(u,u+4));u+=4;var l=(c[0]<<24)+(c[1]<<16)+(c[2]<<8)+c[3];s.push(o.slice(u,u+l)),u+=l}for(var f=JSON.parse(new TextDecoder("utf8").decode(s[0])),d=new Float32Array(s[1]),h=new Uint8Array(s[2]),p=new Float32Array(h.length),m=0;m<p.length;m+=1)p[m]=d[h[m]];var g={};u=0;for(var v=0;v<f.length;v+=1){var b=f[v].shape,y=b.reduce(function(t,e){return t*e}),w=p.slice(u,u+y),x=a.tensor1d(w,"float32");g[f[v].name]=x.reshape(b),u+=y}r[t.urlPath]=g,e(g)}else n(new Error("invalid arraybuffer"))}else n(new Error("missing model"))},i.send(null)}})}}]),t}();e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=f(n(12)),i=f(n(11)),o=f(n(9)),a=f(n(10)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),u=f(n(439)),c=n(62),l=f(n(20));function f(t){return t&&t.__esModule?t:{default:t}}var d=function(){function t(e,n){(0,o.default)(this,t),this.ready=(0,l.default)(this.loadCheckpoints(e),n)}return(0,a.default)(t,[{key:"loadCheckpoints",value:function(){var t=(0,i.default)(r.default.mark(function t(e){var n;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=new u.default(e),t.next=3,n.getAllVariables();case 3:return this.variables=t.sent,t.abrupt("return",this);case 5:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"transfer",value:function(){var t=(0,i.default)(r.default.mark(function t(e,n){return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,l.default)(this.transferInternal(e),n));case 1:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"transferInternal",value:function(){var e=(0,i.default)(r.default.mark(function e(n){var i,o=this;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=(0,c.array3DToImage)(s.tidy(function(){var e=s.browser.fromPixels(n),r=e.dataSync(),i=s.tensor3d(r,e.shape),a=s.div(i,s.scalar(255)),u=t.preprocess(a),c=[],l=o.variables["generator/encoder_1/conv2d/kernel"],f=o.variables["generator/encoder_1/conv2d/bias"],d=t.conv2d(u,l,f);c.push(d);for(var h=2;h<=8;h+=1){var p="generator/encoder_"+h.toString();l=o.variables[p+"/conv2d/kernel"];var m=o.variables[p+"/conv2d/bias"],g=c[c.length-1],v=s.leakyRelu(g,.2);d=t.conv2d(v,l,m);var b=o.variables[p+"/batch_normalization/gamma"],y=o.variables[p+"/batch_normalization/beta"],w=t.batchnorm(d,b,y);c.push(w)}for(var x=8;x>=2;x-=1){var _=void 0;if(8===x)_=c[c.length-1];else{var k=x-1;_=s.concat([c[c.length-1],c[k]],2)}var S=s.relu(_),E="generator/decoder_"+x.toString();l=o.variables[E+"/conv2d_transpose/kernel"],f=o.variables[E+"/conv2d_transpose/bias"],d=t.deconv2d(S,l,f);var O=o.variables[E+"/batch_normalization/gamma"],A=o.variables[E+"/batch_normalization/beta"],C=t.batchnorm(d,O,A);c.push(C)}var M=s.concat([c[c.length-1],c[0]],2),N=s.relu(M);l=o.variables["generator/decoder_1/conv2d_transpose/kernel"];var T=o.variables["generator/decoder_1/conv2d_transpose/bias"];d=t.deconv2d(N,l,T),N=s.tanh(d),c.push(N);var I=c[c.length-1];return t.deprocess(I)})),e.next=3,s.nextFrame();case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}],[{key:"preprocess",value:function(t){var e=s.tidy(function(){return s.sub(s.mul(t,s.scalar(2)),s.scalar(1))});return t.dispose(),e}},{key:"deprocess",value:function(t){var e=s.tidy(function(){return s.div(s.add(t,s.scalar(1)),s.scalar(2))});return t.dispose(),e}},{key:"batchnorm",value:function(t,e,n){var r=s.tidy(function(){var r=s.moments(t,[0,1]);return s.batchNorm(t,r.mean,r.variance,n,e,1e-5)});return t.dispose(),r}},{key:"conv2d",value:function(t,e){var n=e.clone(),r=s.tidy(function(){return s.conv2d(t,n,[2,2],"same")});return t.dispose(),n.dispose(),r}},{key:"deconv2d",value:function(t,e,n){var r=s.tidy(function(){var r=s.conv2dTranspose(t,e,[2*t.shape[0],2*t.shape[1],e.shape[2]],[2,2],"same");return s.add(r,n)});return t.dispose(),e.dispose(),n.dispose(),r}}]),t}();e.default=function(t,e){var n=new d(t,e);return e?n:n.ready}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){for(var e=Math.random(),n=0,r=void 0,i=0;i<t.length;i+=1)if(e<(n+=t[i])){r=i;break}return r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=h(n(52)),i=h(n(12)),o=h(n(61)),a=h(n(11)),s=h(n(9)),u=h(n(10)),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),l=h(n(441)),f=h(n(263)),d=h(n(20));function h(t){return t&&t.__esModule?t:{default:t}}var p=/cell_[0-9]|lstm_[0-9]/gi,m=/weights|weight|kernel|kernels|w/gi,g=/softmax/gi,v=function(){function t(e,n){(0,s.default)(this,t),this.ready=!1,this.model={},this.cellsAmount=0,this.cells=[],this.zeroState={c:[],h:[]},this.state={c:[],h:[]},this.vocab={},this.vocabSize=0,this.probabilities=[],this.defaults={seed:"a",length:20,temperature:.5,stateful:!1},this.ready=(0,d.default)(this.loadCheckpoints(e),n)}return(0,u.default)(t,[{key:"resetState",value:function(){this.state=this.zeroState}},{key:"setState",value:function(t){this.state=t}},{key:"getState",value:function(){return this.state}},{key:"loadCheckpoints",value:function(){var t=(0,a.default)(i.default.mark(function t(e){var n,r,a=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=new f.default(e),t.next=3,n.getAllVariables();case 3:return r=t.sent,(0,o.default)(r).forEach(function(t){t.match(p)?t.match(m)?(a.model["Kernel_"+t.match(/[0-9]/)[0]]=r[t],a.cellsAmount+=1):a.model["Bias_"+t.match(/[0-9]/)[0]]=r[t]:t.match(g)?t.match(m)?a.model.fullyConnectedWeights=r[t]:a.model.fullyConnectedBiases=r[t]:a.model[t]=r[t]}),t.next=7,this.loadVocab(e);case 7:return t.next=9,this.initCells();case 9:return t.abrupt("return",this);case 10:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"loadVocab",value:function(){var t=(0,a.default)(i.default.mark(function t(e){var n;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e+"/vocab.json").then(function(t){return t.json()}).catch(function(t){return console.error(t)});case 2:n=t.sent,this.vocab=n,this.vocabSize=(0,o.default)(n).length;case 5:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"initCells",value:function(){var t=(0,a.default)(i.default.mark(function t(){var e,n,r,o=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(this.cells=[],this.zeroState={c:[],h:[]},e=c.tensor(1),n=function(t){return function(n,r,i){return c.basicLSTMCell(e,o.model["Kernel_"+t],o.model["Bias_"+t],n,r,i)}},r=0;r<this.cellsAmount;r+=1)this.zeroState.c.push(c.zeros([1,this.model["Bias_"+r].shape[0]/4])),this.zeroState.h.push(c.zeros([1,this.model["Bias_"+r].shape[0]/4])),this.cells.push(n(r));this.state=this.zeroState;case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"generateInternal",value:function(){var t=(0,a.default)(i.default.mark(function t(e){var n,a,s,u,f,d,h,p,m,g,v,b,y,w,x,_,k,S,E,O=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:n=e.seed||this.defaults.seed,a=+e.length||this.defaults.length,s=+e.temperature||this.defaults.temperature,e.stateful||this.defaults.stateful||(this.state=this.zeroState),u=[],f=(0,r.default)(n),d=[],f.forEach(function(t){d.push(O.vocab[t])}),h=d[0],p=[],m=0;case 14:if(!(m<f.length+a+-1)){t.next=36;break}return t.next=17,c.buffer([1,this.vocabSize]);case 17:return(g=t.sent).set(1,0,h),v=g.toTensor(),b=void 0,this.model.embedding?(y=c.matMul(v,this.model.embedding),b=c.multiRNNCell(this.cells,y,this.state.c,this.state.h)):b=c.multiRNNCell(this.cells,v,this.state.c,this.state.h),this.state.c=b[0],this.state.h=b[1],w=this.state.h[1],x=c.matMul(w,this.model.fullyConnectedWeights),_=c.add(x,this.model.fullyConnectedBiases),k=c.div(_,c.tensor(s)),S=c.exp(k),t.next=31,c.div(S,c.sum(S)).data();case 31:p=t.sent,m<f.length-1?h=d[m+1]:(h=(0,l.default)(p),u.push(h));case 33:m+=1,t.next=14;break;case 36:return E="",u.forEach(function(t){var e=(0,o.default)(O.vocab).find(function(e){return O.vocab[e]===t});e&&(E+=e)}),this.probabilities=p,t.abrupt("return",{sample:E,state:this.state});case 40:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"reset",value:function(){this.state=this.zeroState}},{key:"generate",value:function(){var t=(0,a.default)(i.default.mark(function t(e,n){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.reset(),t.abrupt("return",(0,d.default)(this.generateInternal(e),n));case 2:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"predict",value:function(){var t=(0,a.default)(i.default.mark(function t(e,n){var r,a,s,u,f,d,h,p,m,g,v=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=[],a=e>0?e:.1,s=this.state.h[1],u=c.matMul(s,this.model.fullyConnectedWeights),f=c.add(u,this.model.fullyConnectedBiases),d=c.div(f,c.tensor(a)),h=c.exp(d),t.next=9,c.div(h,c.sum(h)).data();case 9:return r=t.sent,p=(0,l.default)(r),m=(0,o.default)(this.vocab).find(function(t){return v.vocab[t]===p}),this.probabilities=r,n&&n(m),g=(0,o.default)(this.vocab).map(function(t){return{char:t,probability:v.probabilities[v.vocab[t]]}}),t.abrupt("return",{sample:m,probabilities:g});case 16:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"feed",value:function(){var t=(0,a.default)(i.default.mark(function t(e,n){var o,a,s,u,l,f,d,h,p=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:o=(0,r.default)(e),a=[],o.forEach(function(t){a.push(p.vocab[t])}),s=a[0],u=0;case 7:if(!(u<o.length)){t.next=21;break}return t.next=10,c.buffer([1,this.vocabSize]);case 10:(l=t.sent).set(1,0,s),f=l.toTensor(),d=void 0,this.model.embedding?(h=c.matMul(f,this.model.embedding),d=c.multiRNNCell(this.cells,h,this.state.c,this.state.h)):d=c.multiRNNCell(this.cells,f,this.state.c,this.state.h),this.state.c=d[0],this.state.h=d[1],s=a[u];case 18:u+=1,t.next=7;break;case 21:n&&n();case 22:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()}]),t}();e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"./",e=arguments[1];return new v(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=v(n(17)),i=v(n(72)),o=v(n(12)),a=v(n(11)),s=v(n(176)),u=v(n(9)),c=v(n(10)),l=v(n(175)),f=v(n(174)),d=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),h=v(n(177)),p=v(n(263)),m=n(62),g=v(n(20));function v(t){return t&&t.__esModule?t:{default:t}}var b=200,y=function(t){function e(t,n,r){(0,u.default)(this,e);var i=(0,l.default)(this,(e.__proto__||(0,s.default)(e)).call(this,n,b));return i.ready=!1,i.variableDictionary={},i.timesScalar=d.scalar(150),i.plusScalar=d.scalar(127.5),i.epsilonScalar=d.scalar(.001),i.video=null,i.ready=(0,g.default)(i.load(t),r),i}return(0,f.default)(e,t),(0,c.default)(e,[{key:"load",value:function(){var t=(0,a.default)(o.default.mark(function t(e){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.videoElt){t.next=4;break}return t.next=3,this.loadVideo();case 3:this.videoReady=!0;case 4:return t.next=6,this.loadCheckpoints(e);case 6:return t.abrupt("return",this);case 7:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"loadCheckpoints",value:function(){var t=(0,a.default)(o.default.mark(function t(e){var n;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=new p.default(e),t.next=3,n.getAllVariables();case 3:this.variables=t.sent;case 4:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"instanceNorm",value:function(t,n){var r=this;return d.tidy(function(){var o=(0,i.default)(t.shape,3),a=o[0],s=o[1],u=o[2],c=d.moments(t,[0,1]),l=c.mean,f=c.variance,h=r.variables[e.getVariableName(n)],p=r.variables[e.getVariableName(n+1)],m=r.epsilonScalar,g=d.div(d.sub(t.asType("float32"),l),d.sqrt(d.add(f,m)));return d.add(d.mul(p,g),h).as3D(a,s,u)})}},{key:"convLayer",value:function(t,n,r,i){var o=d.conv2d(t,this.variables[e.getVariableName(i)],[n,n],"same"),a=this.instanceNorm(o,i+1);return r?d.relu(a):a}},{key:"residualBlock",value:function(t,e){var n=this.convLayer(t,1,!0,e),r=this.convLayer(n,1,!1,e+3);return d.add(r,t)}},{key:"convTransposeLayer",value:function(t,n,r,o){var a=(0,i.default)(t.shape,2),s=[a[0]*r,a[1]*r,n],u=d.conv2dTranspose(t,this.variables[e.getVariableName(o)],s,[r,r],"same"),c=this.instanceNorm(u,o+1);return d.relu(c)}},{key:"transfer",value:function(){var t=(0,a.default)(o.default.mark(function t(e,n){var i,a;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=void 0,a=n,e instanceof HTMLVideoElement||e instanceof HTMLImageElement||e instanceof ImageData?i=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&(e.elt instanceof HTMLVideoElement||e.elt instanceof HTMLImageElement||e.elt instanceof ImageData)?i=e.elt:"function"==typeof e&&(i=this.video,a=e),t.abrupt("return",(0,g.default)(this.transferInternal(i),a));case 4:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"transferInternal",value:function(){var t=(0,a.default)(o.default.mark(function t(e){var n,r,i=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=d.browser.fromPixels(e),r=(0,m.array3DToImage)(d.tidy(function(){var t=i.convLayer(n,1,!0,0),e=i.convLayer(t,2,!0,3),r=i.convLayer(e,2,!0,6),o=i.residualBlock(r,9),a=i.residualBlock(o,15),s=i.residualBlock(a,21),u=i.residualBlock(s,27),c=i.residualBlock(u,33),l=i.convTransposeLayer(c,64,2,39),f=i.convTransposeLayer(l,32,2,42),h=i.convLayer(f,1,!1,45),p=d.tanh(h),m=d.mul(i.timesScalar,p),g=d.add(i.plusScalar,m),v=d.clipByValue(g,0,255);return d.div(v,d.scalar(255))})),n.dispose(),t.next=5,d.nextFrame();case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}],[{key:"getVariableName",value:function(t){return 0===t?"Variable":"Variable_"+t}}]),e}(h.default);e.default=function(t,e,n){var r=n;"function"==typeof e&&(r=e);var i=new y(t,e,r);return r?i:i.ready}},function(t,e,n){"use strict";n.r(e),n.d(e,"decodeMultiplePoses",function(){return T}),n.d(e,"decodeSinglePose",function(){return K}),n.d(e,"MobileNet",function(){return u}),n.d(e,"partChannels",function(){return v}),n.d(e,"partIds",function(){return p}),n.d(e,"partNames",function(){return d}),n.d(e,"poseChain",function(){return m}),n.d(e,"load",function(){return st}),n.d(e,"PoseNet",function(){return at}),n.d(e,"VALID_INPUT_RESOLUTION",function(){return et}),n.d(e,"getAdjacentKeyPoints",function(){return R}),n.d(e,"getBoundingBox",function(){return z}),n.d(e,"getBoundingBoxPoints",function(){return L}),n.d(e,"scalePose",function(){return U});var r=n(0),i=n(32),o=[8,16,32];function a(t){r.util.assert("number"==typeof t,function(){return"outputStride is not a number"}),r.util.assert(o.indexOf(t)>=0,function(){return"outputStride of "+t+" is invalid. It must be either 8, 16, or 32"})}function s(t,e){r.util.assert("number"==typeof t,function(){return"resolution is not a number"}),r.util.assert((t-1)%e==0,function(){return"resolution of "+t+" is invalid for output stride "+e+"."})}var u=function(){function t(t,e){this.model=t;var n=this.model.inputs[0].shape;r.util.assert(-1===n[1]&&-1===n[2],function(){return"Input shape ["+n[1]+", "+n[2]+"] must both be -1"}),this.outputStride=e}return t.prototype.predict=function(t){var e=this;return Object(r.tidy)(function(){var n=function(t){return Object(r.tidy)(function(){return"int32"===t.dtype&&(t=t.toFloat()),t=Object(r.div)(t,127.5),Object(r.sub)(t,1)})}(t).expandDims(0),i=e.model.predict(n),o=i[0],a=i[1],s=i[2],u=i[3];return{heatmapScores:a.squeeze().sigmoid(),offsets:o.squeeze(),displacementFwd:s.squeeze(),displacementBwd:u.squeeze()}})},t.prototype.dispose=function(){this.model.dispose()},t}();function c(t){return Math.floor(t/2)}var l=function(){function t(t,e){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=e}return t.prototype.enqueue=function(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)},t.prototype.dequeue=function(){var t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t},t.prototype.empty=function(){return-1===this.numberOfElements},t.prototype.size=function(){return this.numberOfElements+1},t.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},t.prototype.max=function(){return this.priorityQueue[0]},t.prototype.swim=function(t){for(;t>0&&this.less(c(t),t);)this.exchange(t,c(t)),t=c(t)},t.prototype.sink=function(t){for(;2*t<=this.numberOfElements;){var e=2*t;if(e<this.numberOfElements&&this.less(e,e+1)&&e++,!this.less(t,e))break;this.exchange(t,e),t=e}},t.prototype.getValueAt=function(t){return this.getElementValue(this.priorityQueue[t])},t.prototype.less=function(t,e){return this.getValueAt(t)<this.getValueAt(e)},t.prototype.exchange=function(t,e){var n=this.priorityQueue[t];this.priorityQueue[t]=this.priorityQueue[e],this.priorityQueue[e]=n},t}();function f(t,e,n,r,i,o){for(var a=o.shape,s=a[0],u=a[1],c=!0,l=Math.max(n-i,0),f=Math.min(n+i+1,s),d=l;d<f;++d){for(var h=Math.max(r-i,0),p=Math.min(r+i+1,u),m=h;m<p;++m)if(o.get(d,m,t)>e){c=!1;break}if(!c)break}return c}var d=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],h=d.length,p=d.reduce(function(t,e,n){return t[e]=n,t},{}),m=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]],g=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map(function(t){var e=t[0],n=t[1];return[p[e],p[n]]}),v=["left_face","right_face","right_upper_leg_front","right_lower_leg_back","right_upper_leg_back","left_lower_leg_front","left_upper_leg_front","left_upper_leg_back","left_lower_leg_back","right_feet","right_lower_leg_front","left_feet","torso_front","torso_back","right_upper_arm_front","right_upper_arm_back","right_lower_arm_back","left_lower_arm_front","left_upper_arm_front","left_upper_arm_back","left_lower_arm_back","right_hand","right_lower_arm_front","left_hand"];function b(t,e,n,r){return{y:r.get(t,e,n),x:r.get(t,e,n+h)}}function y(t,e,n){var r=b(t.heatmapY,t.heatmapX,t.id,n),i=r.y,o=r.x;return{x:t.heatmapX*e+o,y:t.heatmapY*e+i}}function w(t,e,n){return t<e?e:t>n?n:t}function x(t,e){return{x:t.x+e.x,y:t.y+e.y}}var _=m.map(function(t){var e=t[0],n=t[1];return[p[e],p[n]]}),k=_.map(function(t){return t[1]}),S=_.map(function(t){return t[0]});function E(t,e,n,r){return{y:w(Math.round(t.y/e),0,n-1),x:w(Math.round(t.x/e),0,r-1)}}function O(t,e,n,r,i,o,a,s){void 0===s&&(s=2);for(var u=r.shape,c=u[0],l=u[1],f=function(t,e,n){var r=n.shape[2]/2;return{y:n.get(e.y,e.x,t),x:n.get(e.y,e.x,r+t)}}(t,E(e.position,o,c,l),a),h=x(e.position,f),p=0;p<s;p++){var m=E(h,o,c,l),g=b(m.y,m.x,n,i);h=x({x:m.x*o,y:m.y*o},{x:g.x,y:g.y})}var v=E(h,o,c,l),y=r.get(v.y,v.x,n);return{position:h,part:d[n],score:y}}function A(t,e,n,r,i,o){var a=e.shape[2],s=k.length,u=new Array(a),c=t.part,l=t.score,f=y(c,r,n);u[c.id]={score:l,part:d[c.id],position:f};for(var h=s-1;h>=0;--h){var p=k[h],m=S[h];u[p]&&!u[m]&&(u[m]=O(h,u[p],m,e,n,r,o))}for(h=0;h<s;++h)p=S[h],m=k[h],u[p]&&!u[m]&&(u[m]=O(h,u[p],m,e,n,r,i));return u}function C(t,e,n,r){var i=n.x,o=n.y;return t.some(function(t){var n=t.keypoints[r].position;return function(t,e,n,r){var i=n-t,o=r-e;return i*i+o*o}(o,i,n.y,n.x)<=e})}function M(t,e,n){return n.reduce(function(n,r,i){var o=r.position,a=r.score;return C(t,e,o,i)||(n+=a),n},0)/n.length}var N=1;function T(t,e,n,r,i,o,a,s){void 0===a&&(a=.5),void 0===s&&(s=20);for(var u=[],c=function(t,e,n){for(var r=n.shape,i=r[0],o=r[1],a=r[2],s=new l(i*o*a,function(t){return t.score}),u=0;u<i;++u)for(var c=0;c<o;++c)for(var d=0;d<a;++d){var h=n.get(u,c,d);h<t||f(d,h,u,c,e,n)&&s.enqueue({score:h,part:{heatmapY:u,heatmapX:c,id:d}})}return s}(a,N,t),d=s*s;u.length<o&&!c.empty();){var h=c.dequeue();if(!C(u,d,y(h.part,i,e),h.part.id)){var p=A(h,t,e,i,n,r),m=M(u,d,p);u.push({keypoints:p,score:m})}}return u}var I=function(){return(I=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function D(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function j(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function R(t,e){return g.reduce(function(n,r){var i=r[0],o=r[1];return function(t,e,n){return t<n||e<n}(t[i].score,t[o].score,e)?n:(n.push([t[i],t[o]]),n)},[])}var F=Number.NEGATIVE_INFINITY,P=Number.POSITIVE_INFINITY;function z(t){return t.reduce(function(t,e){var n=t.maxX,r=t.maxY,i=t.minX,o=t.minY,a=e.position,s=a.x,u=a.y;return{maxX:Math.max(n,s),maxY:Math.max(r,u),minX:Math.min(i,s),minY:Math.min(o,u)}},{maxX:F,maxY:F,minX:P,minY:P})}function L(t){var e=z(t),n=e.minX,r=e.minY,i=e.maxX,o=e.maxY;return[{x:n,y:r},{x:i,y:r},{x:i,y:o},{x:n,y:o}]}function B(t,e){return void 0===e&&(e="float32"),D(this,void 0,void 0,function(){var n;return j(this,function(i){switch(i.label){case 0:return[4,t.data()];case 1:return n=i.sent(),[2,Object(r.buffer)(t.shape,e,n)]}})})}function U(t,e,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),{score:t.score,keypoints:t.keypoints.map(function(t){var o=t.score,a=t.part,s=t.position;return{score:o,part:a,position:{x:s.x*n+i,y:s.y*e+r}}})}}function W(t){return t instanceof r.Tensor?[t.shape[0],t.shape[1]]:[t.height,t.width]}function q(t,e){var n=e[0],i=e[1],o=W(t),a=o[0],s=o[1],u=i/n,c=[0,0,0,0],l=c[0],f=c[1],d=c[2],h=c[3];return s/a<u?(l=0,f=0,d=Math.round(.5*(u*a-s)),h=Math.round(.5*(u*a-s))):(l=Math.round(.5*(1/u*s-a)),f=Math.round(.5*(1/u*s-a)),d=0,h=0),{resized:Object(r.tidy)(function(){var e=function(t){return t instanceof r.Tensor?t:r.browser.fromPixels(t)}(t);return(e=Object(r.pad3d)(e,[[l,f],[d,h],[0,0]])).resizeBilinear([n,i])}),padding:{top:l,left:d,right:h,bottom:f}}}function V(t,e,n,r,i){var o=e[0],a=e[1],s=n[0],u=n[1],c=function(t,e,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),1===n&&1===e&&0===r&&0===i?t:t.map(function(t){return U(t,e,n,r,i)})}(t,(o+r.top+r.bottom)/s,(a+r.left+r.right)/u,-r.top,-r.left);return i?function(t,e){return e<=0?c:c.map(function(t){return function(t,e){return{score:t.score,keypoints:t.keypoints.map(function(t){var n=t.score,r=t.part,i=t.position;return{score:n,part:r,position:{x:e-1-i.x,y:i.y}}})}}(t,e)})}(0,a):c}function H(t){var e=t.shape,n=e[0],i=e[1],o=e[2];return Object(r.tidy)(function(){var e=t.reshape([n*i,o]).argMax(0),a=e.div(Object(r.scalar)(i,"int32")).expandDims(1),s=function(t,e){return Object(r.tidy)(function(){var n=t.div(Object(r.scalar)(e,"int32"));return t.sub(n.mul(Object(r.scalar)(e,"int32")))})}(e,i).expandDims(1);return Object(r.concat)([a,s],1)})}function $(t,e,n,r){return{y:r.get(t,e,n),x:r.get(t,e,n+h)}}function G(t,e,n){return Object(r.tidy)(function(){var i=function(t,e){for(var n=[],i=0;i<h;i++){var o=$(t.get(i,0).valueOf(),t.get(i,1).valueOf(),i,e),a=o.x,s=o.y;n.push(s),n.push(a)}return Object(r.tensor2d)(n,[h,2])}(t,n);return t.toTensor().mul(Object(r.scalar)(e,"int32")).toFloat().add(i)})}function K(t,e,n){return D(this,void 0,void 0,function(){var r,i,o,a,s,u,c,l,f,h;return j(this,function(p){switch(p.label){case 0:return r=0,i=H(t),[4,Promise.all([B(t),B(e),B(i,"int32")])];case 1:return o=p.sent(),a=o[0],s=o[1],u=o[2],[4,B(c=G(u,n,s))];case 2:return l=p.sent(),f=Array.from(function(t,e){for(var n=e.shape[0],r=new Float32Array(n),i=0;i<n;i++){var o=e.get(i,0),a=e.get(i,1);r[i]=t.get(o,a,i)}return r}(a,u)),h=f.map(function(t,e){return r+=t,{position:{y:l.get(e,0),x:l.get(e,1)},part:d[e],score:t}}),i.dispose(),c.dispose(),[2,{keypoints:h,score:r/h.length}]}})})}var X="https://storage.googleapis.com/tfjs-models/savedmodel/posenet/mobilenet/",Y="https://storage.googleapis.com/tfjs-models/savedmodel/posenet/resnet50/",J=function(){function t(t,e){this.model=t;var n=this.model.inputs[0].shape;r.util.assert(-1===n[1]&&-1===n[2],function(){return"Input shape ["+n[1]+", "+n[2]+"] must both be equal to or -1"}),this.outputStride=e}return t.prototype.predict=function(t){var e=this;return Object(r.tidy)(function(){var n=function(t){return Object(r.tidy)(function(){"int32"===t.dtype&&(t=t.toFloat());var e=Object(r.tensor)([-123.15,-115.9,-103.06]);return t.add(e)})}(t).expandDims(0),i=e.model.predict(n),o=i[0],a=i[1],s=i[2];return{heatmapScores:i[3].squeeze().sigmoid(),offsets:s.squeeze(),displacementFwd:o.squeeze(),displacementBwd:a.squeeze()}})},t.prototype.dispose=function(){this.model.dispose()},t}(),Z={architecture:"MobileNetV1",outputStride:16,multiplier:.75,inputResolution:257},Q=["MobileNetV1","ResNet50"],tt={MobileNetV1:[8,16,32],ResNet50:[32,16]},et=[161,193,257,289,321,353,385,417,449,481,513,801],nt={MobileNetV1:[.5,.75,1],ResNet50:[1]},rt=[1,2,4],it={flipHorizontal:!1},ot={flipHorizontal:!1,maxDetections:5,scoreThreshold:.5,nmsRadius:20},at=function(){function t(t,e){this.baseModel=t,this.inputResolution=e}return t.prototype.estimateMultiplePoses=function(t,e){return void 0===e&&(e=ot),D(this,void 0,void 0,function(){var n,r,i,o,u,c,l,f,d,h,p,m,g,v,b,y,w,x,_,k,S;return j(this,function(E){switch(E.label){case 0:return n=I({},ot,e),function(t){var e=t.maxDetections,n=t.scoreThreshold,r=t.nmsRadius;if(e<=0)throw new Error("Invalid maxDetections "+e+". Should be > 0");if(n<0||n>1)throw new Error("Invalid scoreThreshold "+n+". Should be in range [0.0, 1.0]");if(r<=0)throw new Error("Invalid nmsRadius "+r+".")}(e),r=this.baseModel.outputStride,i=this.inputResolution,a(r),s(this.inputResolution,r),o=W(t),u=o[0],c=o[1],l=q(t,[i,i]),f=l.resized,d=l.padding,h=this.baseModel.predict(f),p=h.heatmapScores,m=h.offsets,g=h.displacementFwd,v=h.displacementBwd,[4,function(t){return D(this,void 0,void 0,function(){return j(this,function(e){return[2,Promise.all(t.map(function(t){return B(t,"float32")}))]})})}([p,m,g,v])];case 1:return b=E.sent(),y=b[0],w=b[1],x=b[2],_=b[3],[4,T(y,w,x,_,r,n.maxDetections,n.scoreThreshold,n.nmsRadius)];case 2:return k=E.sent(),S=V(k,[u,c],[i,i],d,n.flipHorizontal),p.dispose(),m.dispose(),g.dispose(),v.dispose(),f.dispose(),[2,S]}})})},t.prototype.estimateSinglePose=function(t,e){return void 0===e&&(e=it),D(this,void 0,void 0,function(){var n,r,i,o,u,c,l,f,d,h,p,m,g,v,b,y;return j(this,function(w){switch(w.label){case 0:return n=I({},it,e),r=this.baseModel.outputStride,i=this.inputResolution,a(r),s(i,r),o=W(t),u=o[0],c=o[1],l=q(t,[i,i]),f=l.resized,d=l.padding,h=this.baseModel.predict(f),p=h.heatmapScores,m=h.offsets,g=h.displacementFwd,v=h.displacementBwd,[4,K(p,m,r)];case 1:return b=w.sent(),y=V([b],[u,c],[i,i],d,n.flipHorizontal),p.dispose(),m.dispose(),g.dispose(),v.dispose(),f.dispose(),[2,y[0]]}})})},t.prototype.estimatePoses=function(t,e){return D(this,void 0,void 0,function(){return j(this,function(n){switch(n.label){case 0:return"single-person"!=e.decodingMethod?[3,2]:[4,this.estimateSinglePose(t,e)];case 1:return[2,[n.sent()]];case 2:return[2,this.estimateMultiplePoses(t,e)]}})})},t.prototype.dispose=function(){this.baseModel.dispose()},t}();function st(t){return void 0===t&&(t=Z),D(this,void 0,void 0,function(){return j(this,function(e){return"ResNet50"===(t=function(t){if(null==(t=t||Z).architecture&&(t.architecture="MobileNetV1"),Q.indexOf(t.architecture)<0)throw new Error("Invalid architecture "+t.architecture+". Should be one of "+Q);if(null==t.inputResolution&&(t.inputResolution=257),et.indexOf(t.inputResolution)<0)throw new Error("Invalid inputResolution "+t.inputResolution+". Should be one of "+et);if(null==t.outputStride&&(t.outputStride=16),tt[t.architecture].indexOf(t.outputStride)<0)throw new Error("Invalid outputStride "+t.outputStride+". Should be one of "+tt[t.architecture]+" for architecutre "+t.architecture+".");if(null==t.multiplier&&(t.multiplier=1),nt[t.architecture].indexOf(t.multiplier)<0)throw new Error("Invalid multiplier "+t.multiplier+". Should be one of "+nt[t.architecture]+" for architecutre "+t.architecture+".");if(null==t.quantBytes&&(t.quantBytes=4),rt.indexOf(t.quantBytes)<0)throw new Error("Invalid quantBytes "+t.quantBytes+". Should be one of "+rt+" for architecutre "+t.architecture+".");return t}(t)).architecture?[2,function(t){return D(this,void 0,void 0,function(){var e,n,o,a,s;return j(this,function(u){switch(u.label){case 0:if(e=t.outputStride,n=t.quantBytes,null==r)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this\n model.");return o=function(t,e){var n="model-stride"+t+".json";return 4==e?Y+"float/"+n:Y+"quant"+e+"/"+n}(e,n),[4,Object(i.c)(t.modelUrl||o)];case 1:return a=u.sent(),s=new J(a,e),[2,new at(s,t.inputResolution)]}})})}(t)]:"MobileNetV1"===t.architecture?[2,function(t){return D(this,void 0,void 0,function(){var e,n,o,a,s,c;return j(this,function(l){switch(l.label){case 0:if(e=t.outputStride,n=t.quantBytes,o=t.multiplier,null==r)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this\n model.");return a=function(t,e,n){var r={1:"100",.75:"075",.5:"050"},i="model-stride"+t+".json";return 4==n?X+"float/"+r[o]+"/"+i:X+"quant"+n+"/"+r[o]+"/"+i}(e,0,n),[4,Object(i.c)(t.modelUrl||a)];case 1:return s=l.sent(),c=new u(s,e),[2,new at(c,t.inputResolution)]}})})}(t)]:[2,null]})})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=b(n(17)),i=b(n(107)),o=b(n(12)),a=b(n(36)),s=b(n(11)),u=b(n(176)),c=b(n(9)),l=b(n(10)),f=b(n(175)),d=b(n(174)),h=b(n(150)),p=v(n(2)),m=v(n(444)),g=b(n(20));function v(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function b(t){return t&&t.__esModule?t:{default:t}}var y={architecture:"MobileNetV1",imageScaleFactor:.3,outputStride:16,flipHorizontal:!1,minConfidence:.5,maxPoseDetections:5,scoreThreshold:.5,nmsRadius:20,detectionType:"multiple",inputResolution:513,multiplier:.75,quantBytes:2},w=function(t){function e(t,n,r,i){(0,c.default)(this,e);var o=(0,f.default)(this,(e.__proto__||(0,u.default)(e)).call(this));return o.video=t,o.modelUrl=n.modelUrl||null,o.architecture=n.architecture||y.architecture,o.detectionType=r||n.detectionType||y.detectionType,o.imageScaleFactor=n.imageScaleFactor||y.imageScaleFactor,o.outputStride=n.outputStride||y.outputStride,o.flipHorizontal=n.flipHorizontal||y.flipHorizontal,o.scoreThreshold=n.scoreThreshold||y.scoreThreshold,o.minConfidence=n.minConfidence||y.minConfidence,o.maxPoseDetections=n.maxPoseDetections||y.maxPoseDetections,o.multiplier=n.multiplier||y.multiplier,o.inputResolution=n.inputResolution||y.inputResolution,o.quantBytes=n.quantBytes||y.quantBytes,o.nmsRadius=n.nmsRadius||y.nmsRadius,o.ready=(0,g.default)(o.load(),i),o}return(0,d.default)(e,t),(0,l.default)(e,[{key:"load",value:function(){var t=(0,s.default)(o.default.mark(function t(){var e,n=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=void 0,e="mobilenetv1"===this.architecture.toLowerCase()?{architecture:this.architecture,outputStride:this.outputStride,inputResolution:this.inputResolution,multiplier:this.multiplier,quantBytes:this.quantBytes,modelUrl:this.modelUrl}:{architecture:this.architecture,outputStride:this.outputStride,inputResolution:this.inputResolution,quantBytes:this.quantBytes},t.next=4,m.load(e);case 4:if(this.net=t.sent,!this.video){t.next=10;break}if(0!==this.video.readyState){t.next=9;break}return t.next=9,new a.default(function(t){n.video.onloadeddata=function(){return t()}});case 9:"single"===this.detectionType?this.singlePose():this.multiPose();case 10:return t.abrupt("return",this);case 11:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"skeleton",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.minConfidence;return m.getAdjacentKeyPoints(t,e)}},{key:"mapParts",value:function(t){var e=JSON.parse((0,i.default)(t));return e.keypoints.forEach(function(t){e[t.part]={x:t.position.x,y:t.position.y,confidence:t.score}}),e}},{key:"getInput",value:function(t){return t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof ImageData)?t.elt:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.canvas instanceof HTMLCanvasElement?t.canvas:this.video}},{key:"singlePose",value:function(){var t=(0,s.default)(o.default.mark(function t(e,n){var r,i,a,s,u=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.getInput(e),t.next=3,this.net.estimateSinglePose(r,{flipHorizontal:this.flipHorizontal});case 3:if(i=t.sent,a=this.mapParts(i),s=[{pose:a,skeleton:this.skeleton(i.keypoints)}],this.emit("pose",s),!this.video){t.next=9;break}return t.abrupt("return",p.nextFrame().then(function(){return u.singlePose()}));case 9:return"function"==typeof n&&n(s),t.abrupt("return",s);case 11:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"multiPose",value:function(){var t=(0,s.default)(o.default.mark(function t(e,n){var r,i,a,s,u=this;return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.getInput(e),t.next=3,this.net.estimateMultiplePoses(r,{flipHorizontal:this.flipHorizontal,maxDetections:this.maxPoseDetections,scoreThreshold:this.scoreThreshold,nmsRadius:this.nmsRadius});case 3:if(i=t.sent,a=i.map(function(t){return u.mapParts(t)}),s=a.map(function(t){return{pose:t,skeleton:u.skeleton(t.keypoints)}}),this.emit("pose",s),!this.video){t.next=9;break}return t.abrupt("return",p.nextFrame().then(function(){return u.multiPose()}));case 9:return"function"==typeof n&&n(s),t.abrupt("return",s);case 11:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()}]),e}(h.default);e.default=function(t,e,n){var i=void 0,o={},a=n,s=null;return t instanceof HTMLVideoElement?i=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.elt instanceof HTMLVideoElement?i=t.elt:"object"===(void 0===t?"undefined":(0,r.default)(t))?o=t:"function"==typeof t&&(a=t),"object"===(void 0===e?"undefined":(0,r.default)(e))?o=e:"string"==typeof e&&(s=e),"function"==typeof e&&(a=e),new w(i,o,s,a)}},function(t,e,n){"use strict";n.r(e),n.d(e,"load",function(){return l}),n.d(e,"ObjectDetection",function(){return f}),n.d(e,"version",function(){return u});var r=n(32),i=n(0);
/**
* @license
* Copyright 2019 Google LLC. 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 o(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function a(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var s={1:{name:"/m/01g317",id:1,displayName:"person"},2:{name:"/m/0199g",id:2,displayName:"bicycle"},3:{name:"/m/0k4j",id:3,displayName:"car"},4:{name:"/m/04_sv",id:4,displayName:"motorcycle"},5:{name:"/m/05czz6l",id:5,displayName:"airplane"},6:{name:"/m/01bjv",id:6,displayName:"bus"},7:{name:"/m/07jdr",id:7,displayName:"train"},8:{name:"/m/07r04",id:8,displayName:"truck"},9:{name:"/m/019jd",id:9,displayName:"boat"},10:{name:"/m/015qff",id:10,displayName:"traffic light"},11:{name:"/m/01pns0",id:11,displayName:"fire hydrant"},13:{name:"/m/02pv19",id:13,displayName:"stop sign"},14:{name:"/m/015qbp",id:14,displayName:"parking meter"},15:{name:"/m/0cvnqh",id:15,displayName:"bench"},16:{name:"/m/015p6",id:16,displayName:"bird"},17:{name:"/m/01yrx",id:17,displayName:"cat"},18:{name:"/m/0bt9lr",id:18,displayName:"dog"},19:{name:"/m/03k3r",id:19,displayName:"horse"},20:{name:"/m/07bgp",id:20,displayName:"sheep"},21:{name:"/m/01xq0k1",id:21,displayName:"cow"},22:{name:"/m/0bwd_0j",id:22,displayName:"elephant"},23:{name:"/m/01dws",id:23,displayName:"bear"},24:{name:"/m/0898b",id:24,displayName:"zebra"},25:{name:"/m/03bk1",id:25,displayName:"giraffe"},27:{name:"/m/01940j",id:27,displayName:"backpack"},28:{name:"/m/0hnnb",id:28,displayName:"umbrella"},31:{name:"/m/080hkjn",id:31,displayName:"handbag"},32:{name:"/m/01rkbr",id:32,displayName:"tie"},33:{name:"/m/01s55n",id:33,displayName:"suitcase"},34:{name:"/m/02wmf",id:34,displayName:"frisbee"},35:{name:"/m/071p9",id:35,displayName:"skis"},36:{name:"/m/06__v",id:36,displayName:"snowboard"},37:{name:"/m/018xm",id:37,displayName:"sports ball"},38:{name:"/m/02zt3",id:38,displayName:"kite"},39:{name:"/m/03g8mr",id:39,displayName:"baseball bat"},40:{name:"/m/03grzl",id:40,displayName:"baseball glove"},41:{name:"/m/06_fw",id:41,displayName:"skateboard"},42:{name:"/m/019w40",id:42,displayName:"surfboard"},43:{name:"/m/0dv9c",id:43,displayName:"tennis racket"},44:{name:"/m/04dr76w",id:44,displayName:"bottle"},46:{name:"/m/09tvcd",id:46,displayName:"wine glass"},47:{name:"/m/08gqpm",id:47,displayName:"cup"},48:{name:"/m/0dt3t",id:48,displayName:"fork"},49:{name:"/m/04ctx",id:49,displayName:"knife"},50:{name:"/m/0cmx8",id:50,displayName:"spoon"},51:{name:"/m/04kkgm",id:51,displayName:"bowl"},52:{name:"/m/09qck",id:52,displayName:"banana"},53:{name:"/m/014j1m",id:53,displayName:"apple"},54:{name:"/m/0l515",id:54,displayName:"sandwich"},55:{name:"/m/0cyhj_",id:55,displayName:"orange"},56:{name:"/m/0hkxq",id:56,displayName:"broccoli"},57:{name:"/m/0fj52s",id:57,displayName:"carrot"},58:{name:"/m/01b9xk",id:58,displayName:"hot dog"},59:{name:"/m/0663v",id:59,displayName:"pizza"},60:{name:"/m/0jy4k",id:60,displayName:"donut"},61:{name:"/m/0fszt",id:61,displayName:"cake"},62:{name:"/m/01mzpv",id:62,displayName:"chair"},63:{name:"/m/02crq1",id:63,displayName:"couch"},64:{name:"/m/03fp41",id:64,displayName:"potted plant"},65:{name:"/m/03ssj5",id:65,displayName:"bed"},67:{name:"/m/04bcr3",id:67,displayName:"dining table"},70:{name:"/m/09g1w",id:70,displayName:"toilet"},72:{name:"/m/07c52",id:72,displayName:"tv"},73:{name:"/m/01c648",id:73,displayName:"laptop"},74:{name:"/m/020lf",id:74,displayName:"mouse"},75:{name:"/m/0qjjc",id:75,displayName:"remote"},76:{name:"/m/01m2v",id:76,displayName:"keyboard"},77:{name:"/m/050k8",id:77,displayName:"cell phone"},78:{name:"/m/0fx9l",id:78,displayName:"microwave"},79:{name:"/m/029bxz",id:79,displayName:"oven"},80:{name:"/m/01k6s3",id:80,displayName:"toaster"},81:{name:"/m/0130jx",id:81,displayName:"sink"},82:{name:"/m/040b_t",id:82,displayName:"refrigerator"},84:{name:"/m/0bt_c3",id:84,displayName:"book"},85:{name:"/m/01x3z",id:85,displayName:"clock"},86:{name:"/m/02s195",id:86,displayName:"vase"},87:{name:"/m/01lsmm",id:87,displayName:"scissors"},88:{name:"/m/0kmg4",id:88,displayName:"teddy bear"},89:{name:"/m/03wvsk",id:89,displayName:"hair drier"},90:{name:"/m/012xff",id:90,displayName:"toothbrush"}},u="2.0.0",c="https://storage.googleapis.com/tfjs-models/savedmodel/";function l(t){return void 0===t&&(t={}),o(this,void 0,void 0,function(){var e,n,r;return a(this,function(o){switch(o.label){case 0:if(null==i)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(e=t.base||"lite_mobilenet_v2",n=t.modelUrl,-1===["mobilenet_v1","mobilenet_v2","lite_mobilenet_v2"].indexOf(e))throw new Error("ObjectDetection constructed with invalid base model "+e+". Valid names are 'mobilenet_v1', 'mobilenet_v2' and 'lite_mobilenet_v2'.");return[4,(r=new f(e,n)).load()];case 1:return o.sent(),[2,r]}})})}var f=function(){function t(t,e){this.modelPath=e||""+c+this.getPrefix(t)+"/model.json"}return t.prototype.getPrefix=function(t){return"lite_mobilenet_v2"===t?"ssd"+t:"ssd_"+t},t.prototype.load=function(){return o(this,void 0,void 0,function(){var t,e,n=this;return a(this,function(s){switch(s.label){case 0:return t=this,[4,Object(r.c)(this.modelPath)];case 1:return t.model=s.sent(),[4,this.model.executeAsync(Object(i.zeros)([1,300,300,3]))];case 2:return(e=s.sent()).map(function(t){return o(n,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,t.data()];case 1:return[2,e.sent()]}})})}),e.map(function(t){return o(n,void 0,void 0,function(){return a(this,function(e){return[2,t.dispose()]})})}),[2]}})})},t.prototype.infer=function(t,e){return o(this,void 0,void 0,function(){var n,r,o,s,u,c,l,f,d,h,p,m;return a(this,function(a){switch(a.label){case 0:return n=Object(i.tidy)(function(){return t instanceof i.Tensor||(t=i.browser.fromPixels(t)),t.expandDims(0)}),r=n.shape[1],o=n.shape[2],[4,this.model.executeAsync(n)];case 1:return s=a.sent(),u=s[0].dataSync(),c=s[1].dataSync(),n.dispose(),Object(i.dispose)(s),l=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}(this.calculateMaxScores(u,s[0].shape[1],s[0].shape[2]),2),f=l[0],d=l[1],h=Object(i.getBackend)(),Object(i.setBackend)("cpu"),p=Object(i.tidy)(function(){var t=Object(i.tensor2d)(c,[s[1].shape[1],s[1].shape[3]]);return i.image.nonMaxSuppression(t,f,e,.5,.5)}),m=p.dataSync(),p.dispose(),Object(i.setBackend)(h),[2,this.buildDetectedObjects(o,r,c,f,m,d)]}})})},t.prototype.buildDetectedObjects=function(t,e,n,r,i,o){for(var a=i.length,u=[],c=0;c<a;c++){for(var l=[],f=0;f<4;f++)l[f]=n[4*i[c]+f];var d=l[0]*e,h=l[1]*t,p=l[2]*e,m=l[3]*t;l[0]=h,l[1]=d,l[2]=m-h,l[3]=p-d,u.push({bbox:l,class:s[o[i[c]]+1].displayName,score:r[i[c]]})}return u},t.prototype.calculateMaxScores=function(t,e,n){for(var r=[],i=[],o=0;o<e;o++){for(var a=Number.MIN_VALUE,s=-1,u=0;u<n;u++)t[o*n+u]>a&&(a=t[o*n+u],s=u);r[o]=a,i[o]=s}return[r,i]},t.prototype.detect=function(t,e){return void 0===e&&(e=20),o(this,void 0,void 0,function(){return a(this,function(n){return[2,this.infer(t,e)]})})},t.prototype.dispose=function(){this.model&&this.model.dispose()},t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=h(n(17)),i=h(n(12)),o=h(n(11)),a=h(n(9)),s=h(n(10)),u=d(n(2)),c=d(n(446)),l=h(n(20)),f=n(62);function d(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function h(t){return t&&t.__esModule?t:{default:t}}var p={base:"mobilenet_v2",modelUrl:void 0},m=function(){function t(e,n,r){(0,a.default)(this,t),this.video=e||null,this.modelReady=!1,this.isPredicting=!1,this.config={base:n.base||p.base,modelUrl:n.modelUrl||p.modelUrl},this.callback=r,this.ready=(0,l.default)(this.loadModel(),this.callback)}return(0,s.default)(t,[{key:"loadModel",value:function(){var t=(0,o.default)(i.default.mark(function t(){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c.load(this.config);case 2:return this.model=t.sent,this.modelReady=!0,t.abrupt("return",this);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"detectInternal",value:function(){var t=(0,o.default)(i.default.mark(function t(e){var n,r;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.isPredicting=!0,t.next=3,this.model.detect(e);case 3:return n=t.sent,r=n.map(function(t){return{label:t.class,confidence:t.score,x:t.bbox[0],y:t.bbox[1],width:t.bbox[2],height:t.bbox[3],normalized:{x:t.bbox[0]/e.width,y:t.bbox[1]/e.height,width:t.bbox[2]/e.width,height:t.bbox[3]/e.height}}}),this.isPredicting=!1,t.abrupt("return",r);case 7:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"detect",value:function(){var t=(0,o.default)(i.default.mark(function t(e,n){var o,a;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,u.nextFrame();case 4:if(o=void 0,a=n,!(0,f.isInstanceOfSupportedElement)(e)){t.next=10;break}o=e,t.next=24;break;case 10:if("object"!==(void 0===e?"undefined":(0,r.default)(e))||!(0,f.isInstanceOfSupportedElement)(e.elt)){t.next=14;break}o=e.elt,t.next=24;break;case 14:if("object"!==(void 0===e?"undefined":(0,r.default)(e))||!(0,f.isInstanceOfSupportedElement)(e.canvas)){t.next=18;break}o=e.canvas,t.next=24;break;case 18:if("function"!=typeof e){t.next=23;break}o=this.video,a=e,t.next=24;break;case 23:throw new Error("Detection subject not supported");case 24:return t.abrupt("return",(0,l.default)(this.detectInternal(o),a));case 25:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()}]),t}();e.default=function(t,e,n){var i=null,o={},a=n;return t instanceof HTMLVideoElement?i=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.elt instanceof HTMLVideoElement?i=t.elt:"function"==typeof t?a=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&(o=t),"object"===(void 0===e?"undefined":(0,r.default)(e))?o=e:"function"==typeof e&&(a=e),new m(i,o,a)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=u(n(17)),i=u(n(101)),o=u(n(9)),a=u(n(264)),s=u(n(447));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e,n,u){var c=void 0,l={},f=u,d=t;if("string"!=typeof d)throw new Error('Please specify a model to use. E.g: "YOLO"');-1===d.indexOf("http")&&(d=t.toLowerCase()),e instanceof HTMLVideoElement?c=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&e.elt instanceof HTMLVideoElement?c=e.elt:"object"===(void 0===e?"undefined":(0,r.default)(e))?l=e:"function"==typeof e&&(f=e),"object"===(void 0===n?"undefined":(0,r.default)(n))?l=n:"function"==typeof n&&(f=n);var h=new function t(e,n,r,u){switch((0,o.default)(this,t),this.video=n,this.modelNameOrUrl=e,this.options=r||{},this.callback=u,e){case"yolo":return this.model=new a.default(this.video,(0,i.default)({disableDeprecationNotice:!0},this.options),u),this;case"cocossd":default:return this.model=new s.default(this.video,this.options,u),this}}(d,c,l,f);return h.model.callback?h.model:h.model.ready}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.nonMaxSuppression=e.boxesToCorners=e.filterBoxes=e.boxIOU=e.boxUnion=e.boxIntersection=void 0;var r=a(n(12)),i=a(n(11));e.filterBoxes=function(){var t=(0,i.default)(r.default.mark(function t(e,n,i,a){return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",o.tidy(function(){for(var t=o.mul(n,i),r=o.argMax(t,-1),s=o.max(t,-1),u=o.greaterEqual(s,o.scalar(a)).dataSync(),c=[],l=0;l<u.length;l+=1)u[l]&&c.push(l);if(0===c.length)return[null,null,null];var f=o.tensor1d(c,"int32");return[o.gather(e.reshape([u.length,4]),f),o.gather(s.flatten(),f),o.gather(r.flatten(),f)]}));case 1:case"end":return t.stop()}},t,this)}));return function(e,n,r,i){return t.apply(this,arguments)}}(),e.head=function(t,e,n){return o.tidy(function(){var r=e.shape[0],i=o.reshape(e,[1,1,r,2]),a=t.shape.slice(1,3),s=a[0],u=a[1],c=o.range(0,a[0]),l=o.range(0,a[1]);c=o.tile(c,[a[1]]),l=o.tile(o.expandDims(l,0),[a[0],1]),l=o.transpose(l).flatten();var f=o.transpose(o.stack([c,l]));f=o.reshape(f,[a[0],a[1],1,2]),f=o.cast(f,t.dtype),t=o.reshape(t,[a[0],a[1],r,n+5]),a=o.cast(o.reshape(o.tensor1d(a),[1,1,1,2]),t.dtype);var d=o.sigmoid(t.slice([0,0,0,0],[s,u,r,2])),h=o.exp(t.slice([0,0,0,2],[s,u,r,2])),p=o.sigmoid(t.slice([0,0,0,4],[s,u,r,1])),m=o.softmax(t.slice([0,0,0,5],[s,u,r,n]));return[d=o.div(o.add(d,f),a),h=o.div(o.mul(h,i),a),p,m]})};var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2));function a(t){return t&&t.__esModule?t:{default:t}}var s=e.boxIntersection=function(t,e){var n=Math.min(t[3],e[3])-Math.max(t[1],e[1]),r=Math.min(t[2],e[2])-Math.max(t[0],e[0]);return n<0||r<0?0:n*r},u=e.boxUnion=function(t,e){var n=s(t,e);return(t[3]-t[1])*(t[2]-t[0])+(e[3]-e[1])*(e[2]-e[0])-n},c=e.boxIOU=function(t,e){return s(t,e)/u(t,e)};e.boxesToCorners=function(t,e){return o.tidy(function(){var n=o.tensor1d([2]),r=o.sub(t,o.div(e,n)),i=o.add(t,o.div(e,n)),a=[r.shape[0],r.shape[1],r.shape[2],1];return o.concat([r.slice([0,0,0,1],a),r.slice([0,0,0,0],a),i.slice([0,0,0,1],a),i.slice([0,0,0,0],a)],3)})},e.nonMaxSuppression=function(t,e,n){return o.tidy(function(){for(var r=[],i=0;i<e.length;i+=1)r.push([e[i],[t[4*i],t[4*i+1],t[4*i+2],t[4*i+3]],i]);var o=[];return r.sort(function(t,e){return e[0]-t[0]}).forEach(function(t){for(var e=!0,r=0;r<o.length;r+=1)if(c(t[1],o[r][1])>n){e=!1;break}e&&o.push(t)}),[o.map(function(t){return t[2]}),o.map(function(t){return t[1]}),o.map(function(t){return t[0]})]})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["person","bicycle","car","motorbike","aeroplane","bus","train","truck","boat","traffic light","fire hydrant","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","backpack","umbrella","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","sofa","pottedplant","bed","diningtable","toilet","tvmonitor","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","book","clock","vase","scissors","teddy bear","hair drier","toothbrush"]},function(t,e,n){var r=n(26);r(r.S,"Object",{create:n(134)})},function(t,e,n){n(451);var r=n(19).Object;t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){t.exports={default:n(452),__esModule:!0}},function(t,e,n){var r=n(45),i=n(56),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(64)(Function.call,n(269).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return o(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:o}},function(t,e,n){var r=n(26);r(r.S,"Object",{setPrototypeOf:n(454).set})},function(t,e,n){n(455),t.exports=n(19).Object.setPrototypeOf},function(t,e,n){t.exports={default:n(456),__esModule:!0}},function(t,e,n){var r=n(98),i=n(282);n(267)("getPrototypeOf",function(){return function(t){return i(r(t))}})},function(t,e,n){n(458),t.exports=n(19).Object.getPrototypeOf},function(t,e,n){var r=n(26),i=n(265)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},function(t,e,n){n(460),t.exports=n(19).Object.values},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=f(n(266)),i=f(n(12)),o=f(n(61)),a=f(n(11)),s=f(n(9)),u=f(n(10)),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),l=f(n(20));function f(t){return t&&t.__esModule?t:{default:t}}var d=function(){function t(e,n){(0,s.default)(this,t),this.model={},this.modelPath=e,this.modelSize=0,this.modelLoaded=!1,this.ready=(0,l.default)(this.loadModel(),n)}return(0,u.default)(t,[{key:"loadModel",value:function(){var t=(0,a.default)(i.default.mark(function t(){var e,n=this;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(this.modelPath).then(function(t){return t.json()});case 2:return e=t.sent,(0,o.default)(e.vectors).forEach(function(t){n.model[t]=c.tensor1d(e.vectors[t])}),this.modelSize=(0,o.default)(this.model).length,this.modelLoaded=!0,t.abrupt("return",this);case 7:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"dispose",value:function(t){(0,r.default)(this.model).forEach(function(t){return t.dispose()}),t&&t()}},{key:"add",value:function(){var e=(0,a.default)(i.default.mark(function e(n,r,o){var a,s,u,l=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.parser(r,o,10),s=a.max,u=a.callback,e.next=3,this.ready;case 3:return e.abrupt("return",c.tidy(function(){var e=t.addOrSubtract(l.model,n,"ADD"),r=t.nearest(l.model,e,n.length,n.length+s);return u&&u(void 0,r),r}));case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"subtract",value:function(){var e=(0,a.default)(i.default.mark(function e(n,r,o){var a,s,u,l=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.parser(r,o,10),s=a.max,u=a.callback,e.next=3,this.ready;case 3:return e.abrupt("return",c.tidy(function(){var e=t.addOrSubtract(l.model,n,"SUBTRACT"),r=t.nearest(l.model,e,n.length,n.length+s);return u&&u(void 0,r),r}));case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"average",value:function(){var e=(0,a.default)(i.default.mark(function e(n,r,o){var a,s,u,l=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.parser(r,o,10),s=a.max,u=a.callback,e.next=3,this.ready;case 3:return e.abrupt("return",c.tidy(function(){var e=t.addOrSubtract(l.model,n,"ADD"),r=c.div(e,c.tensor(n.length)),i=t.nearest(l.model,r,n.length,n.length+s);return u&&u(void 0,i),i}));case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"nearest",value:function(){var e=(0,a.default)(i.default.mark(function e(n,r,o){var a,s,u,c,l;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.parser(r,o,10),s=a.max,u=a.callback,e.next=3,this.ready;case 3:return c=this.model[n],l=void 0,l=c?t.nearest(this.model,c,1,s+1):null,u&&u(void 0,l),e.abrupt("return",l);case 8:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"getRandomWord",value:function(){var t=(0,a.default)(i.default.mark(function t(e){var n,r;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return n=(0,o.default)(this.model),r=n[Math.floor(Math.random()*n.length)],e&&e(void 0,r),t.abrupt("return",r);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}],[{key:"parser",value:function(t,e,n){var r=n,i=e;return"function"==typeof t?i=t:"number"==typeof t&&(r=t),{max:r,callback:i}}},{key:"addOrSubtract",value:function(t,e,n){return c.tidy(function(){var r=[],i=[];if(e.length<2)throw new Error("Invalid input, must be passed more than 1 value");if(e.forEach(function(e){var n=t[e];n?r.push(n):i.push(e)}),i.length>0)throw new Error("Invalid input, vector not found for: "+i.toString());var o=r[0];if("ADD"===n)for(var a=1;a<r.length;a+=1)o=c.add(o,r[a]);else for(var s=1;s<r.length;s+=1)o=c.sub(o,r[s]);return o})}},{key:"nearest",value:function(t,e,n,r){var i=[];return(0,o.default)(t).forEach(function(n){var r=c.util.distSquared(e.dataSync(),t[n].dataSync());i.push({word:n,distance:r})}),i.sort(function(t,e){return t.distance-e.distance}),i.slice(n,r)}}]),t}();e.default=function(t,e){return new d(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=g(n(107)),i=g(n(52)),o=g(n(100)),a=g(n(17)),s=g(n(12)),u=g(n(11)),c=g(n(9)),l=g(n(10)),f=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),d=g(n(177)),h=n(62),p=n(132),m=g(n(20));function g(t){return t&&t.__esModule?t:{default:t}}var v=224,b="https://storage.googleapis.com/tfjs-models/tfjs/mobilenet_v",y={version:1,alpha:.25,topk:3,learningRate:1e-4,hiddenUnits:100,epochs:20,numLabels:2,batchSize:.4,layer:"conv_pw_13_relu"},w={1:{.25:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",.5:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",.75:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",1:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1"},2:{.5:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",.75:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",1:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2"}},x={1:"module_apply_default/MobilenetV1/Logits/global_pool",2:"module_apply_default/MobilenetV2/Logits/AvgPool"},_=function(){function t(e,n){(0,c.default)(this,t),this.mobilenet=null,this.topKPredictions=10,this.hasAnyTrainedClass=!1,this.customModel=null,this.jointModel=null,this.config={epochs:e.epochs||y.epochs,version:e.version||y.version,hiddenUnits:e.hiddenUnits||y.hiddenUnits,numLabels:e.numLabels||y.numLabels,learningRate:e.learningRate||y.learningRate,batchSize:e.batchSize||y.batchSize,layer:e.layer||y.layer,alpha:e.alpha||y.alpha},this.model=null,this.url=w[this.config.version][this.config.alpha],this.normalizationOffset=f.scalar(127.5),this.mobilenetURL=e.mobilenetURL||""+b+this.config.version+"_"+this.config.alpha+"_"+v+"/model.json",this.graphModelURL=e.graphModelURL||this.url,this.isPredicting=!1,this.mapStringToIndex=[],this.usageType=null,this.ready=(0,m.default)(this.loadModel(),n)}return(0,l.default)(t,[{key:"loadModel",value:function(){var t=(0,u.default)(s.default.mark(function t(){var e;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f.loadLayersModel(this.mobilenetURL);case 2:if(this.mobilenet=t.sent,!this.graphModelURL.includes("https://tfhub.dev/")){t.next=9;break}return t.next=6,f.loadGraphModel(this.graphModelURL,{fromTFHub:!0});case 6:this.model=t.sent,t.next=12;break;case 9:return t.next=11,f.loadGraphModel(this.graphModelURL,{fromTFHub:!1});case 11:this.model=t.sent;case 12:return e=this.mobilenet.getLayer(this.config.layer),t.next=15,f.model({inputs:this.mobilenet.inputs,outputs:e.output});case 15:if(this.mobilenetFeatures=t.sent,!this.video){t.next=19;break}return t.next=19,this.mobilenetFeatures.predict((0,h.imgToTensor)(this.video));case 19:return t.abrupt("return",this);case 20:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"classification",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments[2],r=void 0;return this.usageType="classifier","object"===(void 0===e?"undefined":(0,a.default)(e))?(0,o.default)(this.config,e):"function"==typeof e&&(r=e),"function"==typeof n&&(r=n),t&&(0,m.default)(this.loadVideo(t),r),this}},{key:"regression",value:function(t,e){return this.usageType="regressor",t&&(0,m.default)(this.loadVideo(t),e),this}},{key:"loadVideo",value:function(){var t=(0,u.default)(s.default.mark(function t(e){var n,r;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=null,e instanceof HTMLVideoElement?n=e:"object"===(void 0===e?"undefined":(0,a.default)(e))&&e.elt instanceof HTMLVideoElement&&(n=e.elt),!n){t.next=7;break}return r=new d.default(n,v),t.next=6,r.loadVideo();case 6:this.video=t.sent;case 7:return t.abrupt("return",this);case 8:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"addImage",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n,r){var i,o,u;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=void 0,o=void 0,u=r,e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e.elt instanceof ImageData?i=e:"object"===(void 0===e?"undefined":(0,a.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)?i=e.elt:"string"!=typeof e&&"number"!=typeof e||(i=this.video,o=e),"string"==typeof n||"number"==typeof n?o=n:"function"==typeof n&&(u=n),"string"==typeof o&&(o=this.mapStringToIndex.includes(o)?this.mapStringToIndex.indexOf(o):this.mapStringToIndex.push(o)-1),t.abrupt("return",(0,m.default)(this.addImageInternal(i,o),u));case 7:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"addImageInternal",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n){var r=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return f.tidy(function(){var t=e===r.video?null:[v,v],i=(0,h.imgToTensor)(e,t),o=r.mobilenetFeatures.predict(i),a=void 0;if("classifier"===r.usageType?a=f.tidy(function(){return f.oneHot(f.tensor1d([n],"int32"),r.config.numLabels)}):"regressor"===r.usageType&&(a=f.tensor2d([[n]])),null==r.xs)r.xs=f.keep(o),r.ys=f.keep(a),r.hasAnyTrainedClass=!0;else{var s=r.xs;r.xs=f.keep(s.concat(o,0));var u=r.ys;r.ys=f.keep(u.concat(a,0)),s.dispose(),u.dispose(),a.dispose()}}),t.abrupt("return",this);case 4:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"train",value:function(){var t=(0,u.default)(s.default.mark(function t(e){var n,r,i=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.hasAnyTrainedClass){t.next=2;break}throw new Error("Add some examples before training!");case 2:if(this.isPredicting=!1,"classifier"===this.usageType?(this.loss="categoricalCrossentropy",this.customModel=f.sequential({layers:[f.layers.flatten({inputShape:[7,7,256]}),f.layers.dense({units:this.config.hiddenUnits,activation:"relu",kernelInitializer:"varianceScaling",useBias:!0}),f.layers.dense({units:this.config.numLabels,kernelInitializer:"varianceScaling",useBias:!1,activation:"softmax"})]})):"regressor"===this.usageType&&(this.loss="meanSquaredError",this.customModel=f.sequential({layers:[f.layers.flatten({inputShape:[7,7,256]}),f.layers.dense({units:this.config.hiddenUnits,activation:"relu",kernelInitializer:"varianceScaling",useBias:!0}),f.layers.dense({units:1,useBias:!1,kernelInitializer:"Zeros",activation:"linear"})]})),this.jointModel=f.sequential(),this.jointModel.add(this.mobilenetFeatures),this.jointModel.add(this.customModel),n=f.train.adam(this.config.learningRate),this.customModel.compile({optimizer:n,loss:this.loss}),(r=Math.floor(this.xs.shape[0]*this.config.batchSize))>0){t.next=12;break}throw new Error("Batch size is 0 or NaN. Please choose a non-zero fraction.");case 12:return t.abrupt("return",this.customModel.fit(this.xs,this.ys,{batchSize:r,epochs:this.config.epochs,callbacks:{onBatchEnd:function(){var t=(0,u.default)(s.default.mark(function t(n,r){return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e(r.loss.toFixed(5)),t.next=3,f.nextFrame();case 3:case"end":return t.stop()}},t,i)}));return function(e,n){return t.apply(this,arguments)}}(),onTrainEnd:function(){return e(null)}}}));case 13:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n){var r,i;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=void 0,i=void 0,e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof ImageData?r=e:"object"===(void 0===e?"undefined":(0,a.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)?r=e.elt:"function"==typeof e&&(r=this.video,i=e),"function"==typeof n&&(i=n),t.abrupt("return",(0,m.default)(this.classifyInternal(r),i));case 5:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var t=(0,u.default)(s.default.mark(function t(e){var n,r,o=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("classifier"===this.usageType){t.next=2;break}throw new Error("Mobilenet Feature Extraction has not been set to be a classifier.");case 2:return t.next=4,f.nextFrame();case 4:return this.isPredicting=!0,n=f.tidy(function(){var t=e===o.video?null:[v,v],n=(0,h.imgToTensor)(e,t),r=o.jointModel.predict(n);return(0,i.default)(r.as1D().dataSync())}),t.next=8,n.map(function(t,e){return{label:o.mapStringToIndex.length>0&&o.mapStringToIndex[e]?o.mapStringToIndex[e]:e,confidence:t}}).sort(function(t,e){return e.confidence-t.confidence});case 8:return r=t.sent,t.abrupt("return",r);case 10:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"predict",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n){var r,i;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=void 0,i=void 0,e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof ImageData?r=e:"object"===(void 0===e?"undefined":(0,a.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)?r=e.elt:"function"==typeof e&&(r=this.video,i=e),"function"==typeof n&&(i=n),t.abrupt("return",(0,m.default)(this.predictInternal(r),i));case 5:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"predictInternal",value:function(){var t=(0,u.default)(s.default.mark(function t(e){var n,r,i=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("regressor"===this.usageType){t.next=2;break}throw new Error("Mobilenet Feature Extraction has not been set to be a regressor.");case 2:return t.next=4,f.nextFrame();case 4:return this.isPredicting=!0,n=f.tidy(function(){var t=e===i.video?null:[v,v],n=(0,h.imgToTensor)(e,t);return i.jointModel.predict(n).as1D()}),t.next=8,n.data();case 8:return r=t.sent,n.dispose(),t.abrupt("return",{value:r[0]});case 11:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"load",value:function(){var t=(0,u.default)(s.default.mark(function t(){var e,n,r=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=arguments[1];return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("string"==typeof o){t.next=9;break}return e=null,n=null,(0,i.default)(o).forEach(function(t){if(t.name.includes(".json")){e=t;var i=new FileReader;i.onload=function(t){JSON.parse(t.target.result).ml5Specs&&(r.mapStringToIndex=JSON.parse(t.target.result).ml5Specs.mapStringToIndex)},i.readAsText(t)}else t.name.includes(".bin")&&(n=t)}),t.next=6,f.loadLayersModel(f.io.browserFiles([e,n]));case 6:this.jointModel=t.sent,t.next=14;break;case 9:return fetch(o).then(function(t){return t.json()}).then(function(t){t.ml5Specs&&(r.mapStringToIndex=t.ml5Specs.mapStringToIndex)}),t.next=12,f.loadLayersModel(o);case 12:this.jointModel=t.sent,a&&a();case 14:return t.abrupt("return",this.jointModel);case 15:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"save",value:function(){var t=(0,u.default)(s.default.mark(function t(e,n){var i=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.jointModel){t.next=2;break}throw new Error("No model found.");case 2:this.jointModel.save(f.io.withSaveHandler(function(){var t=(0,u.default)(s.default.mark(function t(o){var a;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a="model",n&&(a=n),i.weightsManifest={modelTopology:o.modelTopology,weightsManifest:[{paths:["./"+a+".weights.bin"],weights:o.weightSpecs}],ml5Specs:{mapStringToIndex:i.mapStringToIndex}},t.next=5,(0,p.saveBlob)(o.weightData,a+".weights.bin","application/octet-stream");case 5:return t.next=7,(0,p.saveBlob)((0,r.default)(i.weightsManifest),a+".json","text/plain");case 7:e&&e();case 8:case"end":return t.stop()}},t,i)}));return function(e){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"mobilenetInfer",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t;return r instanceof f.Tensor||r instanceof ImageData||r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement?f.tidy(function(){r instanceof f.Tensor||(r=f.browser.fromPixels(r));var t=r.toFloat().sub(e.normalizationOffset).div(e.normalizationOffset),i=t;r.shape[0]===v&&r.shape[1]===v||(i=f.image.resizeBilinear(t,[v,v],!0));var o=i.reshape([-1,v,v,3]),a=void 0;if(n){var s=x[e.config.version];a=e.model.execute(o,s).squeeze([1,2])}else a=e.model.predict(o).slice([0,1],[-1,1e3]);return a}):null}},{key:"infer",value:function(t,e){var n,r=void 0;if(t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData)r=t;else{if("object"!==(void 0===t?"undefined":(0,a.default)(t))||!(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData))throw new Error("No input image found.");r=t.elt}return n=e&&"string"==typeof e?e:"conv_preds",this.mobilenetInfer(r,n)}}]),t}();e.default=_},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=o(n(17)),i=o(n(463));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e,n){var o;if("string"!=typeof t)throw new Error('Please specify a model to use. E.g: "MobileNet"');o=t.toLowerCase();var a={},s=n;if("object"===(void 0===e?"undefined":(0,r.default)(e))?a=e:"function"==typeof e&&(s=e),"mobilenet"===o)return new i.default(a,s);throw new Error(o+" is not a valid model.")}},function(t,e,n){"use strict";n.r(e),n.d(e,"KNNClassifier",function(){return a}),n.d(e,"create",function(){return s});var r=n(0);function i(t,e){return null==t&&null==e?null:null==t?e.clone():null===e?t.clone():t.concat(e,0)}function o(t,e){for(var n=[],r=0;r<t.length;r++)n.push({value:t[r],index:r});n.sort(function(t,e){return e.value-t.value});var i=new Float32Array(e),o=new Int32Array(e);for(r=0;r<e;r++)i[r]=n[r].value,o[r]=n[r].index;return{values:i,indices:o}}var a=function(){function t(){this.classDatasetMatrices={},this.classExampleCount={},this.labelToClassId={},this.nextClassId=0}return t.prototype.addExample=function(t,e){var n=this;if(null==this.exampleShape&&(this.exampleShape=t.shape),!r.util.arraysEqual(this.exampleShape,t.shape))throw new Error("Example shape provided, "+t.shape+" does not match previously provided example shapes "+this.exampleShape+".");this.clearTrainDatasetMatrix(),e in this.labelToClassId||(this.labelToClassId[e]=this.nextClassId++),Object(r.tidy)(function(){var i=n.normalizeVectorToUnitLength(t.flatten()),o=i.shape[0];if(null==n.classDatasetMatrices[e])n.classDatasetMatrices[e]=i.as2D(1,o);else{var a=n.classDatasetMatrices[e].as2D(n.classExampleCount[e],o).concat(i.as2D(1,o),0);n.classDatasetMatrices[e].dispose(),n.classDatasetMatrices[e]=a}Object(r.keep)(n.classDatasetMatrices[e]),null==n.classExampleCount[e]&&(n.classExampleCount[e]=0),n.classExampleCount[e]++})},t.prototype.similarities=function(t){var e=this;return Object(r.tidy)(function(){var n=e.normalizeVectorToUnitLength(t.flatten()),o=n.shape[0];if(null==e.trainDatasetMatrix){var a=null;for(var s in e.classDatasetMatrices)a=i(a,e.classDatasetMatrices[s]);e.trainDatasetMatrix=a}if(null==e.trainDatasetMatrix)return console.warn("Cannot predict without providing training examples."),null;Object(r.keep)(e.trainDatasetMatrix);var u=e.getNumExamples();return e.trainDatasetMatrix.as2D(u,o).matMul(n.as2D(o,1)).as1D()})},t.prototype.predictClass=function(t,e){return void 0===e&&(e=3),function(t,e,n,r){return new(n||(n=Promise))(function(e,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){t.done?e(t.value):new n(function(e){e(t.value)}).then(o,a)}s((r=r.apply(t,[])).next())})}(this,0,void 0,function(){var n,i,a,s,u=this;return function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,function(c){switch(c.label){case 0:if(e<1)throw new Error("Please provide a positive integer k value to predictClass.");if(0===this.getNumExamples())throw new Error("You have not added any examples to the KNN classifier. Please add examples before calling predictClass.");return n=Object(r.tidy)(function(){return u.similarities(t).asType("float32")}),i=Math.min(e,this.getNumExamples()),s=o,[4,n.data()];case 1:return a=s.apply(void 0,[c.sent(),i]).indices,n.dispose(),[2,this.calculateTopClass(a,i)]}})})},t.prototype.clearClass=function(t){if(null==this.classDatasetMatrices[t])throw new Error("Cannot clear invalid class "+t);delete this.classDatasetMatrices[t],delete this.classExampleCount[t],this.clearTrainDatasetMatrix()},t.prototype.clearAllClasses=function(){for(var t in this.classDatasetMatrices)this.clearClass(t)},t.prototype.getClassExampleCount=function(){return this.classExampleCount},t.prototype.getClassifierDataset=function(){return this.classDatasetMatrices},t.prototype.getNumClasses=function(){return Object.keys(this.classExampleCount).length},t.prototype.setClassifierDataset=function(t){for(var e in this.clearTrainDatasetMatrix(),this.classDatasetMatrices=t,t)this.classExampleCount[e]=t[e].shape[0]},t.prototype.calculateTopClass=function(t,e){var n,r={};if(null==t)return{classIndex:this.labelToClassId[n],label:n,confidences:r};var i={},o=0;for(var a in this.classDatasetMatrices)o+=this.classExampleCount[a],i[a]=o;var s={};for(var a in this.classDatasetMatrices)s[a]=0;for(var u=0;u<t.length;u++){var c=t[u];for(var a in this.classDatasetMatrices)if(c<i[a]){s[a]++;break}}var l=0;for(var a in this.classDatasetMatrices){var f=s[a]/e;f>l&&(l=f,n=a),r[a]=f}return{classIndex:this.labelToClassId[n],label:n,confidences:r}},t.prototype.clearTrainDatasetMatrix=function(){null!=this.trainDatasetMatrix&&(this.trainDatasetMatrix.dispose(),this.trainDatasetMatrix=null)},t.prototype.normalizeVectorToUnitLength=function(t){return Object(r.tidy)(function(){var e=t.norm();return Object(r.div)(t,e)})},t.prototype.getNumExamples=function(){var t=0;for(var e in this.classDatasetMatrices)t+=this.classExampleCount[e];return t},t.prototype.dispose=function(){for(var t in this.clearTrainDatasetMatrix(),this.classDatasetMatrices)this.classDatasetMatrices[t].dispose()},t}();function s(){return new a}},function(t,e,n){var r=n(98),i=n(99);n(267)("keys",function(){return function(t){return i(r(t))}})},function(t,e,n){n(466),t.exports=n(19).Object.keys},function(t,e,n){var r=n(19),i=r.JSON||(r.JSON={stringify:JSON.stringify});t.exports=function(t){return i.stringify.apply(i,arguments)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=m(n(17)),i=m(n(107)),o=m(n(61)),a=m(n(12)),s=m(n(11)),u=m(n(9)),c=m(n(10)),l=p(n(2)),f=p(n(465)),d=p(n(132)),h=m(n(20));function p(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function m(t){return t&&t.__esModule?t:{default:t}}var g=function(){function t(){(0,u.default)(this,t),this.knnClassifier=f.create(),this.mapStringToIndex=[]}return(0,c.default)(t,[{key:"addExample",value:function(t,e){var n,r=void 0;"string"==typeof e?r=this.mapStringToIndex.includes(e)?this.mapStringToIndex.indexOf(e):this.mapStringToIndex.push(e)-1:"number"==typeof e&&(r=e),n=Array.isArray(t)?l.tensor(t):t,this.knnClassifier.addExample(n,r)}},{key:"classify",value:function(){var t=(0,s.default)(a.default.mark(function t(e,n,r){var i,o,s;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=3,o=r,s=void 0,"number"==typeof n?i=n:"function"==typeof n&&(o=n),s=Array.isArray(e)?l.tensor(e):e,t.abrupt("return",(0,h.default)(this.classifyInternal(s,i),o));case 6:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var t=(0,s.default)(a.default.mark(function t(e,n){var r,i,s,u=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(this.knnClassifier.getNumClasses()<=0)){t.next=5;break}throw new Error("There is no example in any class");case 5:return t.next=7,this.knnClassifier.predictClass(e,n);case 7:return r=t.sent,this.mapStringToIndex.length>0&&((r.classIndex||0===r.classIndex)&&(i=this.mapStringToIndex[r.classIndex])&&(r.label=i),r.confidences&&(r.confidencesByLabel={},s=r.confidences,(0,o.default)(s).forEach(function(t){var e=u.mapStringToIndex[t];r.confidencesByLabel[e]=s[t]}))),t.abrupt("return",r);case 10:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"clearLabel",value:function(t){var e=void 0;"string"==typeof t?this.mapStringToIndex.includes(t)&&(e=this.mapStringToIndex.indexOf(t)):"number"==typeof t&&(e=t),this.knnClassifier.clearClass(e)}},{key:"clearAllLabels",value:function(){this.mapStringToIndex=[],this.knnClassifier.clearAllClasses()}},{key:"getCountByLabel",value:function(){var t=this,e=this.knnClassifier.getClassExampleCount();if(this.mapStringToIndex.length>0){var n={};return(0,o.default)(e).forEach(function(r){if(t.mapStringToIndex[r]){var i=t.mapStringToIndex[r];n[i]=e[r]}}),n}return e}},{key:"getCount",value:function(){return this.knnClassifier.getClassExampleCount()}},{key:"getClassifierDataset",value:function(){return this.knnClassifier.getClassifierDataset()}},{key:"setClassifierDataset",value:function(t){this.knnClassifier.setClassifierDataset(t)}},{key:"getNumLabels",value:function(){return this.knnClassifier.getNumClasses()}},{key:"dispose",value:function(){this.knnClassifier.dispose()}},{key:"save",value:function(){var t=(0,s.default)(a.default.mark(function t(e){var n,r,s,u=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.knnClassifier.getClassifierDataset(),this.mapStringToIndex.length>0&&(0,o.default)(n).forEach(function(t){u.mapStringToIndex[t]&&(n[t].label=u.mapStringToIndex[t])}),r=(0,o.default)(n).map(function(t){var e=n[t];return e?e.dataSync():null}),s="myKNN.json",e&&(s=e.endsWith(".json")?e:e+".json"),t.next=7,d.saveBlob((0,i.default)({dataset:n,tensors:r}),s,"application/octet-stream");case 7:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"load",value:function(){var t=(0,s.default)(a.default.mark(function t(e,n){var i,s,u,c,f;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=void 0,"object"!==(void 0===e?"undefined":(0,r.default)(e))){t.next=5;break}i=e,t.next=8;break;case 5:return t.next=7,d.loadFile(e);case 7:i=t.sent;case 8:i&&(u=(s=i).dataset,c=s.tensors,this.mapStringToIndex=(0,o.default)(u).map(function(t){return u[t].label}),f=c.map(function(t,e){if(t){var n=(0,o.default)(t).map(function(e){return t[e]});return l.tensor(n,u[e].shape,u[e].dtype)}return null}).reduce(function(t,e,n){return t[n]=e,t},{}),this.knnClassifier.setClassifierDataset(f),n&&n());case 9:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()}]),t}();e.default=function(){return new g}},function(t,e,n){"use strict";n.r(e),n.d(e,"create",function(){return L}),n.d(e,"utils",function(){return B}),n.d(e,"BACKGROUND_NOISE_TAG",function(){return _}),n.d(e,"Dataset",function(){return k}),n.d(e,"getMaxIntensityFrameIndex",function(){return C}),n.d(e,"spectrogram2IntensityCurve",function(){return A}),n.d(e,"deleteSavedTransferModel",function(){return z}),n.d(e,"listSavedTransferModels",function(){return P}),n.d(e,"UNKNOWN_TAG",function(){return N}),n.d(e,"version",function(){return M});var r=n(2),i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};
/**
* @license
* Copyright 2019 Google LLC. 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(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function s(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function u(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function l(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(c(arguments[e]));return t}var f=null;function d(t){return null==f&&(f=Object(r.backend)().epsilon()),Object(r.tidy)(function(){var e=Object(r.moments)(t),n=e.mean,i=e.variance;return t.sub(n).div(i.sqrt().add(f))})}var h=function(){function t(t){var e=this;if(null==t)throw new Error("Required configuration object is missing for BrowserFftFeatureExtractor constructor");if(null==t.spectrogramCallback)throw new Error("spectrogramCallback cannot be null or undefined");if(!(t.numFramesPerSpectrogram>0))throw new Error("Invalid value in numFramesPerSpectrogram: "+t.numFramesPerSpectrogram);if(t.suppressionTimeMillis<0)throw new Error("Expected suppressionTimeMillis to be >= 0, but got "+t.suppressionTimeMillis);if(this.suppressionTimeMillis=t.suppressionTimeMillis,this.spectrogramCallback=t.spectrogramCallback,this.numFrames=t.numFramesPerSpectrogram,this.sampleRateHz=t.sampleRateHz||44100,this.fftSize=t.fftSize||1024,this.frameDurationMillis=this.fftSize/this.sampleRateHz*1e3,this.columnTruncateLength=t.columnTruncateLength||this.fftSize,this.overlapFactor=t.overlapFactor,this.includeRawAudio=t.includeRawAudio,r.util.assert(this.overlapFactor>=0&&this.overlapFactor<1,function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+e.overlapFactor}),this.columnTruncateLength>this.fftSize)throw new Error("columnTruncateLength "+this.columnTruncateLength+" exceeds fftSize ("+this.fftSize+").");this.audioContextConstructor=window.AudioContext||window.webkitAudioContext}return t.prototype.start=function(t){return a(this,void 0,void 0,function(){var e,n,r;return s(this,function(i){switch(i.label){case 0:if(null!=this.frameIntervalTask)throw new Error("Cannot start already-started BrowserFftFeatureExtractor");return e=this,[4,function(t){return a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.getUserMedia({audio:null==t||t,video:!1})];case 1:return[2,e.sent()]}})})}(t)];case 1:return e.stream=i.sent(),this.audioContext=new this.audioContextConstructor,this.audioContext.sampleRate!==this.sampleRateHz&&console.warn("Mismatch in sampling rate: Expected: "+this.sampleRateHz+"; Actual: "+this.audioContext.sampleRate),n=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=0,n.connect(this.analyser),this.freqDataQueue=[],this.freqData=new Float32Array(this.fftSize),this.includeRawAudio&&(this.timeDataQueue=[],this.timeData=new Float32Array(this.fftSize)),r=Math.max(1,Math.round(this.numFrames*(1-this.overlapFactor))),this.tracker=new g(r,Math.round(this.suppressionTimeMillis/this.frameDurationMillis)),this.frameIntervalTask=setInterval(this.onAudioFrame.bind(this),this.fftSize/this.sampleRateHz*1e3),[2]}})})},t.prototype.onAudioFrame=function(){return a(this,void 0,void 0,function(){var t,e,n,i;return s(this,function(o){switch(o.label){case 0:return this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0?[2]:(this.freqDataQueue.push(this.freqData.slice(0,this.columnTruncateLength)),this.includeRawAudio&&(this.analyser.getFloatTimeDomainData(this.timeData),this.timeDataQueue.push(this.timeData.slice())),this.freqDataQueue.length>this.numFrames&&this.freqDataQueue.shift(),this.tracker.tick()?(t=p(this.freqDataQueue),e=m(t,[1,this.numFrames,this.columnTruncateLength,1]),n=void 0,this.includeRawAudio&&(i=p(this.timeDataQueue),n=m(i,[1,this.numFrames*this.fftSize])),[4,this.spectrogramCallback(e,n)]):[3,2]);case 1:o.sent()&&this.tracker.suppress(),Object(r.dispose)([e,n]),o.label=2;case 2:return[2]}})})},t.prototype.stop=function(){return a(this,void 0,void 0,function(){return s(this,function(t){if(null==this.frameIntervalTask)throw new Error("Cannot stop because there is no ongoing streaming activity.");return clearInterval(this.frameIntervalTask),this.frameIntervalTask=null,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop(),[2]})})},t.prototype.setConfig=function(t){throw new Error("setConfig() is not implemented for BrowserFftFeatureExtractor.")},t.prototype.getFeatures=function(){throw new Error("getFeatures() is not implemented for BrowserFftFeatureExtractor. Use the spectrogramCallback field of the constructor config instead.")},t}();function p(t){var e=t[0].length,n=new Float32Array(t.length*e);return t.forEach(function(t,r){return n.set(t,r*e)}),n}function m(t,e){var n=new Float32Array(r.util.sizeFromShape(e));return n.set(t,n.length-t.length),Object(r.tensor)(n,e)}var g=function(){function t(t,e){var n=this;this.period=t,this.suppressionTime=null==e?0:e,this.counter=0,r.util.assert(this.period>0,function(){return"Expected period to be positive, but got "+n.period})}return t.prototype.tick=function(){return this.counter++,this.counter%this.period==0&&(null==this.suppressionOnset||this.counter-this.suppressionOnset>this.suppressionTime)},t.prototype.suppress=function(){this.suppressionOnset=this.counter},t}();function v(t){var e=0;t.forEach(function(t){e+=t.byteLength});var n=new Uint8Array(e),r=0;return t.forEach(function(t){n.set(new Uint8Array(t),r),r+=t.byteLength}),n.buffer}function b(t){var e=0;t.forEach(function(t){return e+=t.length});var n=new Float32Array(e),r=0;return t.forEach(function(t){n.set(t,r),r+=t.length}),n}function y(t){if(null==t)throw new Error("Received null or undefind string");for(var e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n.buffer}function w(t){if(null==t)throw new Error("Received null or undefind buffer");var e=new Uint8Array(t);return decodeURIComponent(escape(String.fromCharCode.apply(String,l(e))))}var x="TFJSSCDS",_="_background_noise_",k=function(){function t(t){if(this.examples={},this.label2Ids={},null!=t)for(var e=function(t){r.util.assert(null!=t,function(){return"Received null or undefined buffer"});var e=0,n=w(t.slice(e,x.length));r.util.assert(n===x,function(){return"Deserialization error: Invalid descriptor"}),e+=x.length,e+=4;var i=new Uint32Array(t,e,1),o=e+=4;e=o+i[0];var a=w(t.slice(o,e));return{manifest:JSON.parse(a),data:t.slice(e)}}(t),n=0,i=0;i<e.manifest.length;++i){var o=e.manifest[i],a=o.spectrogramNumFrames*o.spectrogramFrameSize;null!=o.rawAudioNumSamples&&(a+=o.rawAudioNumSamples),a*=4,this.addExample(E({spec:o,data:e.data.slice(n,n+a)})),n+=a}}return t.prototype.addExample=function(t){r.util.assert(null!=t,function(){return"Got null or undefined example"}),r.util.assert(null!=t.label&&t.label.length>0,function(){return"Expected label to be a non-empty string, but got "+JSON.stringify(t.label)});var e=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}();return this.examples[e]=t,t.label in this.label2Ids||(this.label2Ids[t.label]=[]),this.label2Ids[t.label].push(e),e},t.prototype.merge=function(t){var e,n,i,o;r.util.assert(t!==this,function(){return"Cannot merge a dataset into itself"});var a=t.getVocabulary();try{for(var s=u(a),c=s.next();!c.done;c=s.next()){var l=c.value,f=t.getExamples(l);try{for(var d=u(f),h=d.next();!h.done;h=d.next()){var p=h.value;this.addExample(p.example)}}catch(t){i={error:t}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},t.prototype.getExampleCounts=function(){var t={};for(var e in this.examples){var n=this.examples[e];n.label in t||(t[n.label]=0),t[n.label]++}return t},t.prototype.getExamples=function(t){var e=this;r.util.assert(null!=t,function(){return"Expected label to be a string, but got "+JSON.stringify(t)}),r.util.assert(t in this.label2Ids,function(){return'No example of label "'+t+'" exists in dataset'});var n=[];return this.label2Ids[t].forEach(function(t){n.push({uid:t,example:e.examples[t]})}),n},t.prototype.getData=function(t,e){var n=this;r.util.assert(this.size()>0,function(){return"Cannot get spectrograms as tensors because the dataset is empty"});var i=this.getVocabulary();null!=t?r.util.assert(-1!==i.indexOf(t),function(){return"Label "+t+" is not in the vocabulary ("+JSON.stringify(i)+")"}):r.util.assert(i.length>1,function(){return"One-hot encoding of labels requires the vocabulary to have at least two words, but it has only "+i.length+" word."}),null==e&&(e={});var o,a,s=this.getSortedUniqueNumFrames();1===s.length?(o=null==e.numFrames?s[0]:e.numFrames,a=null==e.hopFrames?1:e.hopFrames):(o=e.numFrames,r.util.assert(null!=o&&Number.isInteger(o)&&o>0,function(){return"There are "+s.length+" unique lengths among the "+n.size()+" examples of this Dataset, hence numFrames is required. But it is not provided."}),r.util.assert(o<=s[0],function(){return"numFrames ("+o+") exceeds the minimum numFrames ("+s[0]+") among the examples of the Dataset."}),a=e.hopFrames,r.util.assert(null!=a&&Number.isInteger(a)&&a>0,function(){return"There are "+s.length+" unique lengths among the "+n.size()+" examples of this Dataset, hence hopFrames is required. But it is not provided."}));var c=null==e.normalize||e.normalize;return Object(r.tidy)(function(){for(var s,l,f,h=[],p=[],m=[],g=0;g<i.length;++g){var v=i[g];if(null==t||v===t){var b=n.label2Ids[v],y=function(i){var s,l,b=n.examples[i].spectrogram,y=b.frameSize;null==f?f=y:r.util.assert(y===f,function(){return"Mismatch in frameSize ("+y+" vs "+f+")"});var w=b.data.length/y,x=null;v!==_&&(x=null==b.keyFrameIndex?C(b).dataSync()[0]:b.keyFrameIndex);var k=Object(r.tensor3d)(b.data,[w,y,1]),S=O(w,x,o,a),E=function(n){var i=Object(r.tidy)(function(){var t=k.slice([n[0],0,0],[n[1]-n[0],-1,-1]);return c?d(t):t});e.getDataset?p.push(i.dataSync()):h.push(i),null==t&&m.push(g)};try{for(var A=u(S),M=A.next();!M.done;M=A.next())E(M.value)}catch(t){s={error:t}}finally{try{M&&!M.done&&(l=A.return)&&l.call(A)}finally{if(s)throw s.error}}Object(r.dispose)(k)};try{for(var w=u(b),x=w.next();!x.done;x=w.next())y(x.value)}catch(t){s={error:t}}finally{try{x&&!x.done&&(l=w.return)&&l.call(w)}finally{if(s)throw s.error}}}}null!=e.augmentByMixingNoiseRatio&&n.augmentByMixingNoise(e.getDataset?p:h,m,e.augmentByMixingNoiseRatio);var k=null==e.shuffle||e.shuffle;if(e.getDataset){var S=null==e.datasetBatchSize?32:e.datasetBatchSize,E=null==e.datasetValidationSplit?.15:e.datasetValidationSplit;r.util.assert(E>0&&E<1,function(){return"Invalid dataset validation split: "+E});var A=p.map(function(t,e){return[t,m[e]]});r.util.shuffle(A),p=A.map(function(t){return t[0]});var M=A.map(function(t){return t[1]}),N=function(t,e,n){var i,o,a,s,c,l,f,d;r.util.assert(n>0&&n<1,function(){return"validationSplit is expected to be >0 and <1, but got "+n});for(var h=!Array.isArray(t[0]),p=e,m=[],g=0;g<p.length;++g){var v=p[g];null==m[v]&&(m[v]=[]),m[v].push(g)}var b=m.length,y=[],w=[];for(m.map(function(t){return r.util.shuffle(t)}),g=0;g<b;++g)for(var x=m[g],_=Math.round(x.length*(1-n)),k=0;k<x.length;++k)k<_?y.push(x[k]):w.push(x[k]);if(h){var S=[],E=[],O=[],A=[];try{for(var C=u(y),M=C.next();!M.done;M=C.next()){var N=M.value;S.push(t[N]),E.push(e[N])}}catch(t){i={error:t}}finally{try{M&&!M.done&&(o=C.return)&&o.call(C)}finally{if(i)throw i.error}}try{for(var T=u(w),I=T.next();!I.done;I=T.next())N=I.value,O.push(t[N]),A.push(e[N])}catch(t){a={error:t}}finally{try{I&&!I.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}return{trainXs:S,trainYs:E,valXs:O,valYs:A}}S=[],E=[],O=[],A=[];try{for(var D=u(y),j=D.next();!j.done;j=D.next())N=j.value,S.push(t[N]),E.push(e[N])}catch(t){c={error:t}}finally{try{j&&!j.done&&(l=D.return)&&l.call(D)}finally{if(c)throw c.error}}try{for(var R=u(w),F=R.next();!F.done;F=R.next())N=F.value,O.push(t[N]),A.push(e[N])}catch(t){f={error:t}}finally{try{F&&!F.done&&(d=R.return)&&d.call(R)}finally{if(f)throw f.error}}return{trainXs:S,trainYs:E,valXs:O,valYs:A}}(p,M,E),T=N.trainXs,I=N.trainYs,D=N.valXs,j=N.valYs,R=r.data.array(T).map(function(t){return Object(r.tensor3d)(t,[o,f,1])}),F=r.data.array(I).map(function(t){return Object(r.oneHot)([t],i.length).squeeze([0])}),P=r.data.zip({xs:R,ys:F});k&&(P=P.shuffle(p.length)),P=P.batch(S).prefetch(4);var z=r.data.array(D).map(function(t){return Object(r.tensor3d)(t,[o,f,1])}),L=r.data.array(j).map(function(t){return Object(r.oneHot)([t],i.length).squeeze([0])}),B=r.data.zip({xs:z,ys:L});return[P,B=B.batch(S).prefetch(4)]}if(k){var U=[];h.forEach(function(t,e){U.push({x:t,y:m[e]})}),r.util.shuffle(U),h=U.map(function(t){return t.x}),m=U.map(function(t){return t.y})}var W=null==t?Object(r.oneHot)(Object(r.tensor1d)(m,"int32"),i.length).asType("float32"):void 0;return{xs:Object(r.stack)(h),ys:W}})},t.prototype.augmentByMixingNoise=function(t,e,n){var i,o;if(null==t||0===t.length)throw new Error("Cannot perform augmentation because data is null or empty");for(var a=t[0]instanceof Float32Array,s=this.getVocabulary(),c=[],f=[],h=0;h<e.length;++h)s[e[h]]===_?c.push(h):f.push(h);if(0===c.length)throw new Error("Cannot perform augmentation by mixing with noise when there is no example with label "+_);var p=[],m=[],g=function(i){var o=c[function(t,e){return Math.floor((e-0)*Math.random())+0}(0,c.length)],s=a?Object(r.tensor1d)(t[i]):t[i],u=a?Object(r.tensor1d)(t[o]):t[o],l=Object(r.tidy)(function(){return d(s.add(u.mul(n)))});a?p.push(l.dataSync()):p.push(l),m.push(e[i])};try{for(var v=u(f),b=v.next();!b.done;b=v.next())g(b.value)}catch(t){i={error:t}}finally{try{b&&!b.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}console.log("Data augmentation: mixing noise: added "+p.length+" examples"),p.forEach(function(e){return t.push(e)}),e.push.apply(e,l(m))},t.prototype.getSortedUniqueNumFrames=function(){for(var t,e,n=new Set,r=this.getVocabulary(),i=0;i<r.length;++i){var o=r[i],a=this.label2Ids[o];try{for(var s=u(a),c=s.next();!c.done;c=s.next()){var f=c.value,d=this.examples[f].spectrogram,h=d.data.length/d.frameSize;n.add(h)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}var p=l(n);return p.sort(),p},t.prototype.removeExample=function(t){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var e=this.examples[t].label;delete this.examples[t];var n=this.label2Ids[e].indexOf(t);this.label2Ids[e].splice(n,1),0===this.label2Ids[e].length&&delete this.label2Ids[e]},t.prototype.setExampleKeyFrameIndex=function(t,e){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var n=this.examples[t].spectrogram,i=n.data.length/n.frameSize;r.util.assert(e>=0&&e<i&&Number.isInteger(e),function(){return"Invalid keyFrameIndex: "+e+". Must be >= 0, < "+i+", and an integer."}),n.keyFrameIndex=e},t.prototype.size=function(){return Object.keys(this.examples).length},t.prototype.durationMillis=function(){var t=0;for(var e in this.examples){var n=this.examples[e].spectrogram,r=23.22|n.frameDurationMillis;t+=n.data.length/n.frameSize*r}return t},t.prototype.empty=function(){return 0===this.size()},t.prototype.clear=function(){this.examples={}},t.prototype.getVocabulary=function(){var t=new Set;for(var e in this.examples){var n=this.examples[e];t.add(n.label)}var r=l(t);return r.sort(),r},t.prototype.serialize=function(t){var e,n,i,o,a=this.getVocabulary();r.util.assert(!this.empty(),function(){return"Cannot serialize empty Dataset"}),null!=t&&(Array.isArray(t)||(t=[t]),t.forEach(function(t){if(-1===a.indexOf(t))throw new Error('Word label "'+t+'" does not exist in the vocabulary of this dataset. The vocabulary is: '+JSON.stringify(a)+".")}));var s=[],c=[];try{for(var l=u(a),f=l.next();!f.done;f=l.next()){var d=f.value;if(null==t||-1!==t.indexOf(d)){var h=this.label2Ids[d];try{for(var p=u(h),m=p.next();!m.done;m=p.next()){var g=m.value,b=S(this.examples[g]);s.push(b.spec),c.push(b.data)}}catch(t){i={error:t}}finally{try{m&&!m.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}return function(t){var e=y(JSON.stringify(t.manifest)),n=y(x),r=new Uint32Array([1]),i=new Uint32Array([e.byteLength]);return v([v([n,r.buffer,i.buffer]),e,t.data])}({manifest:s,data:v(c)})},t}();function S(t){var e=null!=t.rawAudio,n={label:t.label,spectrogramNumFrames:t.spectrogram.data.length/t.spectrogram.frameSize,spectrogramFrameSize:t.spectrogram.frameSize};null!=t.spectrogram.keyFrameIndex&&(n.spectrogramKeyFrameIndex=t.spectrogram.keyFrameIndex);var r=t.spectrogram.data.buffer.slice(0);return e&&(n.rawAudioNumSamples=t.rawAudio.data.length,n.rawAudioSampleRateHz=t.rawAudio.sampleRateHz,r=v([r,t.rawAudio.data.buffer])),{spec:n,data:r}}function E(t){var e={frameSize:t.spec.spectrogramFrameSize,data:new Float32Array(t.data.slice(0,4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))};null!=t.spec.spectrogramKeyFrameIndex&&(e.keyFrameIndex=t.spec.spectrogramKeyFrameIndex);var n={label:t.spec.label,spectrogram:e};return null!=t.spec.rawAudioNumSamples&&(n.rawAudio={sampleRateHz:t.spec.rawAudioSampleRateHz,data:new Float32Array(t.data.slice(4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))}),n}function O(t,e,n,i){if(r.util.assert(Number.isInteger(t)&&t>0,function(){return"snippetLength must be a positive integer, but got "+t}),null!=e&&r.util.assert(Number.isInteger(e)&&e>=0,function(){return"focusIndex must be a non-negative integer, but got "+e}),r.util.assert(Number.isInteger(n)&&n>0,function(){return"windowLength must be a positive integer, but got "+n}),r.util.assert(Number.isInteger(i)&&i>0,function(){return"windowHop must be a positive integer, but got "+i}),r.util.assert(n<=t,function(){return"windowLength ("+n+") exceeds snippetLength ("+t+")"}),r.util.assert(e<t,function(){return"focusIndex ("+e+") equals or exceeds snippetLength ("+t+")"}),n===t)return[[0,t]];var o=[];if(null==e){for(var a=0;a+n<=t;)o.push([a,a+n]),a+=i;return o}var s=Math.floor(n/2),u=e-s;for(u<0?u=0:u+n>t&&(u=t-n);!(u-i<0||e>=u-i+n);)u-=i;for(;u+n<=t&&!(e<u);)o.push([u,u+n]),u+=i;return o}function A(t){return Object(r.tidy)(function(){var e=t.data.length/t.frameSize;return Object(r.tensor2d)(t.data,[e,t.frameSize]).mean(-1)})}function C(t){return Object(r.tidy)(function(){return A(t).argMax()})}var M="0.3.9",N="_unknown_",T="tfjs-speech-commands-saved-model-metadata",I="indexeddb://tfjs-speech-commands-model/",D={localStorage:"undefined"==typeof window?null:window.localStorage},j=function(){function t(e,n,i){this.MODEL_URL_PREFIX="https://storage.googleapis.com/tfjs-models/tfjs/speech-commands/v"+M.split(".").slice(0,2).join(".")+"/browser_fft",this.SAMPLE_RATE_HZ=44100,this.FFT_SIZE=1024,this.DEFAULT_SUPPRESSION_TIME_MILLIS=0,this.streaming=!1,this.transferRecognizers={},r.util.assert(null==n&&null==i||null!=n&&null!=i,function(){return"modelURL and metadataURL must be both provided or both not provided."}),null==n?(null==e?e=t.DEFAULT_VOCABULARY_NAME:r.util.assert(-1!==t.VALID_VOCABULARY_NAMES.indexOf(e),function(){return"Invalid vocabulary name: '"+e+"'"}),this.vocabulary=e,this.modelArtifactsOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/model.json",this.metadataOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/metadata.json"):(r.util.assert(null==e,function(){return"vocabulary name must be null or undefined when modelURL is provided"}),this.modelArtifactsOrURL=n,this.metadataOrURL=i),this.parameters={sampleRateHz:this.SAMPLE_RATE_HZ,fftSize:this.FFT_SIZE}}return t.prototype.listen=function(t,e){return a(this,void 0,void 0,function(){var n,i,o,u,f,p=this;return s(this,function(m){switch(m.label){case 0:if(this.streaming)throw new Error("Cannot start streaming again when streaming is ongoing.");return[4,this.ensureModelLoaded()];case 1:if(m.sent(),null==e&&(e={}),n=null==e.probabilityThreshold?0:e.probabilityThreshold,e.includeEmbedding&&(n=0),r.util.assert(n>=0&&n<=1,function(){return"Invalid probabilityThreshold value: "+n}),i=null!=e.invokeCallbackOnNoiseAndUnknown&&e.invokeCallbackOnNoiseAndUnknown,e.includeEmbedding&&(i=!0),e.suppressionTimeMillis<0)throw new Error("suppressionTimeMillis is expected to be >= 0, but got "+e.suppressionTimeMillis);return o=null==e.overlapFactor?.5:e.overlapFactor,r.util.assert(o>=0&&o<1,function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+o}),u=function(o,u){return a(p,void 0,void 0,function(){var a,u,f,h,p,m,g,v,b,y,w;return s(this,function(s){switch(s.label){case 0:return u=d(o),e.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,2];case 1:return s.sent(),a=c(this.modelWithEmbeddingOutput.predict(u),2),f=a[0],h=a[1],[3,3];case 2:f=this.model.predict(u),s.label=3;case 3:return[4,f.data()];case 4:return p=s.sent(),[4,(m=f.argMax(-1)).data()];case 5:return g=s.sent()[0],v=Math.max.apply(Math,l(p)),Object(r.dispose)([f,m,u]),v<n?[2,!1]:[3,6];case 6:return b=void 0,e.includeSpectrogram?(y={},[4,o.data()]):[3,8];case 7:y.data=s.sent(),y.frameSize=this.nonBatchInputShape[1],b=y,s.label=8;case 8:return w=!0,i||this.words[g]!==_&&this.words[g]!==N||(w=!1),w&&t({scores:p,spectrogram:b,embedding:h}),[2,w]}})})},f=null==e.suppressionTimeMillis?this.DEFAULT_SUPPRESSION_TIME_MILLIS:e.suppressionTimeMillis,this.audioDataExtractor=new h({sampleRateHz:this.parameters.sampleRateHz,numFramesPerSpectrogram:this.nonBatchInputShape[0],columnTruncateLength:this.nonBatchInputShape[1],suppressionTimeMillis:f,spectrogramCallback:u,overlapFactor:o}),[4,this.audioDataExtractor.start(e.audioTrackConstraints)];case 2:return m.sent(),this.streaming=!0,[2]}})})},t.prototype.ensureModelLoaded=function(){return a(this,void 0,void 0,function(){var t,e,n,i,o=this;return s(this,function(a){switch(a.label){case 0:return null!=this.model?[2]:[4,this.ensureMetadataLoaded()];case 1:return a.sent(),"string"!=typeof this.modelArtifactsOrURL?[3,3]:[4,Object(r.loadLayersModel)(this.modelArtifactsOrURL)];case 2:return t=a.sent(),[3,5];case 3:return[4,Object(r.loadLayersModel)(r.io.fromMemory(this.modelArtifactsOrURL.modelTopology,this.modelArtifactsOrURL.weightSpecs,this.modelArtifactsOrURL.weightData))];case 4:t=a.sent(),a.label=5;case 5:if(1!==t.inputs.length)throw new Error("Expected model to have 1 input, but got a model with "+t.inputs.length+" inputs");if(4!==t.inputs[0].shape.length)throw new Error("Expected model to have an input shape of rank 4, but got an input shape of rank "+t.inputs[0].shape.length);if(1!==t.inputs[0].shape[3])throw new Error("Expected model to have an input shape with 1 as the last dimension, but got input shape"+JSON.stringify(t.inputs[0].shape[3])+"}");if(2!==(e=t.outputShape).length)throw new Error("Expected loaded model to have an output shape of rank 2,but received shape "+JSON.stringify(e));if(e[1]!==this.words.length)throw new Error("Mismatch between the last dimension of model's output shape ("+e[1]+") and number of words ("+this.words.length+").");return this.model=t,this.freezeModel(),this.nonBatchInputShape=t.inputs[0].shape.slice(1),this.elementsPerExample=1,t.inputs[0].shape.slice(1).forEach(function(t){return o.elementsPerExample*=t}),this.warmUpModel(),n=this.parameters.fftSize/this.parameters.sampleRateHz*1e3,i=t.inputs[0].shape[1],this.parameters.spectrogramDurationMillis=i*n,[2]}})})},t.prototype.ensureModelWithEmbeddingOutputCreated=function(){return a(this,void 0,void 0,function(){var t,e;return s(this,function(n){switch(n.label){case 0:return null!=this.modelWithEmbeddingOutput?[2]:[4,this.ensureModelLoaded()];case 1:for(n.sent(),e=this.model.layers.length-2;e>=0;--e)if("Dense"===this.model.layers[e].getClassName()){t=this.model.layers[e];break}if(null==t)throw new Error("Failed to find second last dense layer in the original model.");return this.modelWithEmbeddingOutput=Object(r.model)({inputs:this.model.inputs,outputs:[this.model.outputs[0],t.output]}),[2]}})})},t.prototype.warmUpModel=function(){var t=this;Object(r.tidy)(function(){for(var e=Object(r.zeros)([1].concat(t.nonBatchInputShape)),n=0;n<3;++n)t.model.predict(e)})},t.prototype.ensureMetadataLoaded=function(){return a(this,void 0,void 0,function(){var t,e,r;return s(this,function(i){switch(i.label){case 0:return null!=this.words?[2]:"string"!=typeof this.metadataOrURL?[3,2]:[4,function(t){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,new Promise(function(e,r){0===t.indexOf("http://")||0===t.indexOf("https://")?fetch(t).then(function(t){t.json().then(function(t){return e(t)})}):0===t.indexOf("file://")?n(268).readFile(t.slice("file://".length),{encoding:"utf-8"},function(t,n){return e(JSON.parse(n))}):r(new Error("Unsupported URL scheme in metadata URL: "+t+". Supported schemes are: http://, https://, and (node.js-only) file://"))})]})})}(this.metadataOrURL)];case 1:return e=i.sent(),[3,3];case 2:e=this.metadataOrURL,i.label=3;case 3:if(null==(t=e).wordLabels){if(null==(r=t.words))throw new Error('Cannot find field "words" or "wordLabels" in metadata JSON file');this.words=r}else this.words=t.wordLabels;return[2]}})})},t.prototype.stopListening=function(){return a(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:if(!this.streaming)throw new Error("Cannot stop streaming when streaming is not ongoing.");return[4,this.audioDataExtractor.stop()];case 1:return t.sent(),this.streaming=!1,[2]}})})},t.prototype.isListening=function(){return this.streaming},t.prototype.wordLabels=function(){return this.words},t.prototype.params=function(){return this.parameters},t.prototype.modelInputShape=function(){if(null==this.model)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognize(), or listen().");return this.model.inputs[0].shape},t.prototype.recognize=function(t,e){return a(this,void 0,void 0,function(){var n,i,o,a,u,c,l,f,d,h,p,m,g;return s(this,function(s){switch(s.label){case 0:return null==e&&(e={}),[4,this.ensureModelLoaded()];case 1:return s.sent(),null!=t?[3,3]:[4,this.recognizeOnline()];case 2:n=s.sent(),t=n.data,s.label=3;case 3:if(t instanceof r.Tensor)this.checkInputTensorShape(t),o=t,i=t.shape[0];else{if((t=t).length%this.elementsPerExample)throw new Error("The length of the input Float32Array "+t.length+" is not divisible by the number of tensor elements per per example expected by the model "+this.elementsPerExample+".");i=t.length/this.elementsPerExample,o=Object(r.tensor4d)(t,[i].concat(this.nonBatchInputShape))}return u={scores:null},e.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,5];case 4:return s.sent(),c=this.modelWithEmbeddingOutput.predict(o),a=c[0],u.embedding=c[1],[3,6];case 5:a=this.model.predict(o),s.label=6;case 6:return 1!==i?[3,8]:(l=u,[4,a.data()]);case 7:return l.scores=s.sent(),[3,10];case 8:return f=Object(r.unstack)(a),d=f.map(function(t){return t.data()}),h=u,[4,Promise.all(d)];case 9:h.scores=s.sent(),Object(r.dispose)(f),s.label=10;case 10:return e.includeSpectrogram?(p=u,m={},t instanceof r.Tensor?[4,t.data()]:[3,12]):[3,14];case 11:return g=s.sent(),[3,13];case 12:g=t,s.label=13;case 13:p.spectrogram=(m.data=g,m.frameSize=this.nonBatchInputShape[1],m),s.label=14;case 14:return[2,u]}})})},t.prototype.recognizeOnline=function(){return a(this,void 0,void 0,function(){var t=this;return s(this,function(e){return[2,new Promise(function(e,n){t.audioDataExtractor=new h({sampleRateHz:t.parameters.sampleRateHz,numFramesPerSpectrogram:t.nonBatchInputShape[0],columnTruncateLength:t.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(n){return a(t,void 0,void 0,function(){var t,r,i;return s(this,function(o){switch(o.label){case 0:return t=d(n),[4,this.audioDataExtractor.stop()];case 1:return o.sent(),r=e,i={},[4,t.data()];case 2:return r.apply(void 0,[(i.data=o.sent(),i.frameSize=this.nonBatchInputShape[1],i)]),t.dispose(),[2,!1]}})})},overlapFactor:0}),t.audioDataExtractor.start()})]})})},t.prototype.createTransfer=function(t){if(null==this.model)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognizer(), or listen().");r.util.assert(null!=t&&"string"==typeof t&&t.length>1,function(){return"Expected the name for a transfer-learning recognized to be a non-empty string, but got "+JSON.stringify(t)}),r.util.assert(null==this.transferRecognizers[t],function(){return"There is already a transfer-learning model named '"+t+"'"});var e=new R(t,this.parameters,this.model);return this.transferRecognizers[t]=e,e},t.prototype.freezeModel=function(){var t,e;try{for(var n=u(this.model.layers),r=n.next();!r.done;r=n.next())r.value.trainable=!1}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},t.prototype.checkInputTensorShape=function(t){var e=this.model.inputs[0].shape.length;if(t.shape.length!==e)throw new Error("Expected input Tensor to have rank "+e+", but got rank "+t.shape.length+" that differs ");var n=t.shape.slice(1),i=this.model.inputs[0].shape.slice(1);if(!r.util.arraysEqual(n,i))throw new Error("Expected input to have shape [null,"+i+"], but got shape [null,"+n+"]")},t.VALID_VOCABULARY_NAMES=["18w","directional4w"],t.DEFAULT_VOCABULARY_NAME="18w",t}(),R=function(t){function e(e,n,i){var o=t.call(this)||this;return o.name=e,o.parameters=n,o.baseModel=i,r.util.assert(null!=e&&"string"==typeof e&&e.length>0,function(){return"The name of a transfer model must be a non-empty string, but got "+JSON.stringify(e)}),o.nonBatchInputShape=o.baseModel.inputs[0].shape.slice(1),o.words=null,o.dataset=new k,o}return function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.collectExample=function(t,e){return a(this,void 0,void 0,function(){var n,i,o,u,c=this;return s(this,function(l){if(r.util.assert(!this.streaming,function(){return"Cannot start collection of transfer-learning example because a streaming recognition or transfer-learning example collection is ongoing"}),r.util.assert(null!=t&&"string"==typeof t&&t.length>0,function(){return"Must provide a non-empty string when collecting transfer-learning example"}),null==e&&(e={}),null!=e.durationMultiplier&&null!=e.durationSec)throw new Error("durationMultiplier and durationSec are mutually exclusive, but are both specified.");return null!=e.durationSec?(r.util.assert(e.durationSec>0,function(){return"Expected durationSec to be > 0, but got "+e.durationSec}),i=this.parameters.fftSize/this.parameters.sampleRateHz,n=Math.ceil(e.durationSec/i)):null!=e.durationMultiplier?(r.util.assert(e.durationMultiplier>=1,function(){return"Expected duration multiplier to be >= 1, but got "+e.durationMultiplier}),n=Math.round(this.nonBatchInputShape[0]*e.durationMultiplier)):n=this.nonBatchInputShape[0],null!=e.snippetDurationSec&&(r.util.assert(e.snippetDurationSec>0,function(){return"snippetDurationSec is expected to be > 0, but got "+e.snippetDurationSec}),r.util.assert(null!=e.onSnippet,function(){return"onSnippet must be provided if snippetDurationSec is provided."})),null!=e.onSnippet&&r.util.assert(null!=e.snippetDurationSec,function(){return"snippetDurationSec must be provided if onSnippet is provided."}),o=this.parameters.fftSize/this.parameters.sampleRateHz,u=o*n,this.streaming=!0,[2,new Promise(function(i){var o=null==e.snippetDurationSec?1:e.snippetDurationSec/u,l=1-o,p=Math.round(1/o),m=0,g=-1,v=[];c.audioDataExtractor=new h({sampleRateHz:c.parameters.sampleRateHz,numFramesPerSpectrogram:n,columnTruncateLength:c.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(n,o){return a(c,void 0,void 0,function(){var a,u,c,l,h,y,w,x,_,k,S,E,O,A,C,M,N,T,I,D;return s(this,function(s){switch(s.label){case 0:return null!=e.onSnippet?[3,7]:(a=d(n),c=(u=this.dataset).addExample,l={label:t},h={},[4,a.data()]);case 1:return l.spectrogram=(h.data=s.sent(),h.frameSize=this.nonBatchInputShape[1],h),e.includeRawAudio?(w={},[4,o.data()]):[3,3];case 2:return w.data=s.sent(),w.sampleRateHz=this.audioDataExtractor.sampleRateHz,y=w,[3,4];case 3:y=void 0,s.label=4;case 4:return c.apply(u,[(l.rawAudio=y,l)]),a.dispose(),[4,this.audioDataExtractor.stop()];case 5:return s.sent(),this.streaming=!1,this.collateTransferWords(),x=i,_={},[4,n.data()];case 6:return x.apply(void 0,[(_.data=s.sent(),_.frameSize=this.nonBatchInputShape[1],_)]),[3,13];case 7:return[4,n.data()];case 8:for(k=s.sent(),-1===g&&(g=k.length),S=g-1;0!==k[S]&&S>=0;)S--;return E=g-S-1,g=S+1,O=k.slice(k.length-E,k.length),v.push(O),null!=e.onSnippet&&e.onSnippet({data:O,frameSize:this.nonBatchInputShape[1]}),m++!==p?[3,13]:[4,this.audioDataExtractor.stop()];case 9:return s.sent(),this.streaming=!1,this.collateTransferWords(),A=function(t){if(t.length<2)throw new Error("Cannot normalize a Float32Array with fewer than 2 elements.");return null==f&&(f=Object(r.backend)().epsilon()),Object(r.tidy)(function(){var e=Object(r.moments)(Object(r.tensor1d)(t)),n=e.mean,i=e.variance,o=n.arraySync(),a=Math.sqrt(i.arraySync()),s=Array.from(t).map(function(t){return(t-o)/(a+f)});return new Float32Array(s)})}(b(v)),C={data:A,frameSize:this.nonBatchInputShape[1]},N=(M=this.dataset).addExample,T={label:t,spectrogram:C},e.includeRawAudio?(D={},[4,o.data()]):[3,11];case 10:return D.data=s.sent(),D.sampleRateHz=this.audioDataExtractor.sampleRateHz,I=D,[3,12];case 11:I=void 0,s.label=12;case 12:N.apply(M,[(T.rawAudio=I,T)]),i(C),s.label=13;case 13:return[2,!1]}})})},overlapFactor:l,includeRawAudio:e.includeRawAudio}),c.audioDataExtractor.start(e.audioTrackConstraints)})]})})},e.prototype.clearExamples=function(){var t=this;r.util.assert(null!=this.words&&this.words.length>0&&!this.dataset.empty(),function(){return"No transfer learning examples exist for model name "+t.name}),this.dataset.clear(),this.words=null},e.prototype.countExamples=function(){if(this.dataset.empty())throw new Error("No examples have been collected for transfer-learning model named '"+this.name+"' yet.");return this.dataset.getExampleCounts()},e.prototype.getExamples=function(t){return this.dataset.getExamples(t)},e.prototype.setExampleKeyFrameIndex=function(t,e){this.dataset.setExampleKeyFrameIndex(t,e)},e.prototype.removeExample=function(t){this.dataset.removeExample(t),this.collateTransferWords()},e.prototype.isDatasetEmpty=function(){return this.dataset.empty()},e.prototype.loadExamples=function(t,e){var n,r,i,o;void 0===e&&(e=!1);var a=new k(t);e&&this.clearExamples();var s=a.getVocabulary();try{for(var c=u(s),l=c.next();!l.done;l=c.next()){var f=l.value,d=a.getExamples(f);try{for(var h=u(d),p=h.next();!p.done;p=h.next()){var m=p.value;this.dataset.addExample(m.example)}}catch(t){i={error:t}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}this.collateTransferWords()},e.prototype.serializeExamples=function(t){return this.dataset.serialize(t)},e.prototype.collateTransferWords=function(){this.words=this.dataset.getVocabulary()},e.prototype.collectTransferDataAsTensors=function(t,e){var n=this.nonBatchInputShape[0];t=t||.25;var r=Math.round(t*n),i=this.dataset.getData(null,o({numFrames:n,hopFrames:r},e));return{xs:i.xs,ys:i.ys}},e.prototype.collectTransferDataAsTfDataset=function(t,e,n,r){void 0===e&&(e=.15),void 0===n&&(n=32);var i=this.nonBatchInputShape[0];t=t||.25;var a=Math.round(t*i);return this.dataset.getData(null,o({numFrames:i,hopFrames:a,getDataset:!0,datasetBatchSize:n,datasetValidationSplit:e},r))},e.prototype.train=function(t){return a(this,void 0,void 0,function(){var e,n=this;return s(this,function(i){switch(i.label){case 0:return r.util.assert(null!=this.words&&this.words.length>0,function(){return"Cannot train transfer-learning model '"+n.name+"' because no transfer learning example has been collected."}),r.util.assert(this.words.length>1,function(){return"Cannot train transfer-learning model '"+n.name+"' because only 1 word label ('"+JSON.stringify(n.words)+"') has been collected for transfer learning. Requires at least 2."}),null!=t.fineTuningEpochs&&r.util.assert(t.fineTuningEpochs>=0&&Number.isInteger(t.fineTuningEpochs),function(){return"If specified, fineTuningEpochs must be a non-negative integer, but received "+t.fineTuningEpochs}),null==t&&(t={}),null==this.model&&this.createTransferModelFromBaseModel(),this.secondLastBaseDenseLayer.trainable=!1,this.model.compile({loss:"categoricalCrossentropy",optimizer:t.optimizer||"sgd",metrics:["acc"]}),e=null==t.fitDatasetDurationMillisThreshold?6e4:t.fitDatasetDurationMillisThreshold,this.dataset.durationMillis()>e?(console.log("Detected large dataset: total duration = "+this.dataset.durationMillis()+" ms > "+e+" ms. Training transfer model using fitDataset() instead of fit()"),[4,this.trainOnDataset(t)]):[3,2];case 1:return[2,i.sent()];case 2:return[4,this.trainOnTensors(t)];case 3:return[2,i.sent()]}})})},e.prototype.trainOnDataset=function(t){return a(this,void 0,void 0,function(){var e,n,i,o,a,u,l,f,d;return s(this,function(s){switch(s.label){case 0:return r.util.assert(t.epochs>0,function(){return"Invalid config.epochs"}),e=null==t.batchSize?32:t.batchSize,n=t.windowHopRatio||.25,i=c(this.collectTransferDataAsTfDataset(n,t.validationSplit,e,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),2),o=i[0],a=i[1],u=r.util.now(),[4,this.model.fitDataset(o,{epochs:t.epochs,validationData:t.validationSplit>0?a:null,callbacks:null==t.callback?null:[t.callback]})];case 1:return l=s.sent(),console.log("fitDataset() took "+(r.util.now()-u).toFixed(2)+" ms"),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?(f=r.util.now(),[4,this.fineTuningUsingTfDatasets(t,o,a)]):[3,3];case 2:return d=s.sent(),console.log("fitDataset() (fine-tuning) took "+(r.util.now()-f).toFixed(2)+" ms"),[2,[l,d]];case 3:return[2,l]}})})},e.prototype.trainOnTensors=function(t){return a(this,void 0,void 0,function(){var e,n,i,o,a,u,c,l,f,d;return s(this,function(s){switch(s.label){case 0:e=t.windowHopRatio||.25,n=this.collectTransferDataAsTensors(e,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),i=n.xs,o=n.ys,console.log("Training data: xs.shape = "+i.shape+", ys.shape = "+o.shape),s.label=1;case 1:return s.trys.push([1,,6,7]),null!=t.validationSplit?(l=function(t,e,n){return r.util.assert(n>0&&n<1,function(){return"validationSplit is expected to be >0 and <1, but got "+n}),Object(r.tidy)(function(){for(var i=e.argMax(-1).dataSync(),o=[],a=0;a<i.length;++a){var s=i[a];null==o[s]&&(o[s]=[]),o[s].push(a)}var u=o.length,c=[],l=[];for(o.map(function(t){return r.util.shuffle(t)}),a=0;a<u;++a)for(var f=o[a],d=Math.round(f.length*(1-n)),h=0;h<f.length;++h)h<d?c.push(f[h]):l.push(f[h]);return{trainXs:Object(r.gather)(t,c),trainYs:Object(r.gather)(e,c),valXs:Object(r.gather)(t,l),valYs:Object(r.gather)(e,l)}})}(i,o,t.validationSplit),a=l.trainXs,u=l.trainYs,c=[l.valXs,l.valYs]):(a=i,u=o),[4,this.model.fit(a,u,{epochs:null==t.epochs?20:t.epochs,validationData:c,batchSize:t.batchSize,callbacks:null==t.callback?null:[t.callback]})];case 2:return f=s.sent(),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?[4,this.fineTuningUsingTensors(t,a,u,c)]:[3,4];case 3:return d=s.sent(),[2,[f,d]];case 4:return[2,f];case 5:return[3,7];case 6:return Object(r.dispose)([i,o,a,u,c]),[7];case 7:return[2]}})})},e.prototype.fineTuningUsingTfDatasets=function(t,e,n){return a(this,void 0,void 0,function(){var r,i,o;return s(this,function(a){switch(a.label){case 0:return r=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,i=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:i,metrics:["acc"]}),[4,this.model.fitDataset(e,{epochs:t.fineTuningEpochs,validationData:n,callbacks:null==t.callback?null:[t.callback]})];case 1:return o=a.sent(),this.secondLastBaseDenseLayer.trainable=r,[2,o]}})})},e.prototype.fineTuningUsingTensors=function(t,e,n,r){return a(this,void 0,void 0,function(){var i,o,a;return s(this,function(s){switch(s.label){case 0:return i=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,o=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:o,metrics:["acc"]}),[4,this.model.fit(e,n,{epochs:t.fineTuningEpochs,validationData:r,batchSize:t.batchSize,callbacks:null==t.fineTuningCallback?null:[t.fineTuningCallback]})];case 1:return a=s.sent(),this.secondLastBaseDenseLayer.trainable=i,[2,a]}})})},e.prototype.evaluate=function(t){return a(this,void 0,void 0,function(){var e,n=this;return s(this,function(i){return r.util.assert(null!=t.wordProbThresholds&&t.wordProbThresholds.length>0,function(){return"Received null or empty wordProbThresholds"}),e=0,r.util.assert(this.words[e]===_,function(){return"Cannot perform evaluation when the first tag is not "+_}),[2,Object(r.tidy)(function(){for(var i=[],o=0,a=n.collectTransferDataAsTensors(t.windowHopRatio),s=a.xs,u=a.ys.argMax(-1).dataSync(),c=n.model.predict(s),l=c.slice([0,1],[c.shape[0],c.shape[1]-1]).max(-1),f=c.shape[0],d=0;d<t.wordProbThresholds.length;++d){for(var h=t.wordProbThresholds[d],p=l.greater(Object(r.scalar)(h)).dataSync(),m=0,g=0,v=0,b=0,y=0;y<f;++y)u[y]===e?(m++,p[y]&&v++):(g++,p[y]&&b++);var w=v/m,x=b/g;i.push({probThreshold:h,fpr:w,tpr:x}),console.log("ROC thresh="+h+": fpr="+w.toFixed(4)+", tpr="+x.toFixed(4)),d>0&&(o+=Math.abs(i[d-1].fpr-i[d].fpr)*(i[d-1].tpr+i[d].tpr)/2)}return{rocCurve:i,auc:o}})]})})},e.prototype.createTransferModelFromBaseModel=function(){var t=this;r.util.assert(null!=this.words,function(){return"No word example is available for tranfer-learning model of name "+t.name});for(var e=this.baseModel.layers,n=e.length-2;n>=0&&"dense"!==e[n].getClassName().toLowerCase();)n--;if(n<0)throw new Error("Cannot find a hidden dense layer in the base model.");this.secondLastBaseDenseLayer=e[n];var i=this.secondLastBaseDenseLayer.output;this.transferHead=Object(r.sequential)(),this.transferHead.add(r.layers.dense({units:this.words.length,activation:"softmax",inputShape:i.shape.slice(1),name:"NewHeadDense"}));var o=this.transferHead.apply(i);this.model=Object(r.model)({inputs:this.baseModel.inputs,outputs:o})},e.prototype.modelInputShape=function(){return this.baseModel.inputs[0].shape},e.prototype.getMetadata=function(){return{tfjsSpeechCommandsVersion:M,modelName:this.name,timeStamp:(new Date).toISOString(),wordLabels:this.wordLabels()}},e.prototype.save=function(t){return a(this,void 0,void 0,function(){var e,n,r;return s(this,function(i){return e=null!=t,t=t||F(this.name),e||(n=D.localStorage.getItem(T),(r=null==n?{}:JSON.parse(n))[this.name]=this.getMetadata(),D.localStorage.setItem(T,JSON.stringify(r))),console.log("Saving model to "+t),[2,this.model.save(t)]})})},e.prototype.load=function(t){return a(this,void 0,void 0,function(){var e,n,i;return s(this,function(o){switch(o.label){case 0:if(e=null!=t,t=t||F(this.name),!e){if(null==(n=JSON.parse(D.localStorage.getItem(T)))||null==n[this.name])throw new Error("Cannot find metadata for transfer model named "+this.name+'"');this.words=n[this.name].wordLabels,console.log("Loaded word list for model named "+this.name+": "+this.words)}return i=this,[4,Object(r.loadLayersModel)(t)];case 1:return i.model=o.sent(),console.log("Loaded model from "+t+":"),this.model.summary(),[2]}})})},e.prototype.createTransfer=function(t){throw new Error("Creating transfer-learned recognizer from a transfer-learned recognizer is not supported.")},e}(j);function F(t){return""+I+t}function P(){return a(this,void 0,void 0,function(){var t,e,n;return s(this,function(i){switch(i.label){case 0:return[4,r.io.listModels()];case 1:for(n in t=i.sent(),e=[],t)n.startsWith(I)&&e.push(n.slice(I.length));return[2,e]}})})}function z(t){return a(this,void 0,void 0,function(){var e;return s(this,function(n){switch(n.label){case 0:return null==(e=JSON.parse(D.localStorage.getItem(T)))&&(e={}),null!=e[t]&&delete e[t],D.localStorage.setItem(T,JSON.stringify(e)),[4,r.io.removeModel(F(t))];case 1:return n.sent(),[2]}})})}function L(t,e,n,i){if(r.util.assert(null==n&&null==i||null!=n&&null!=i,function(){return"customModelURL and customMetadataURL must be both provided or both not provided."}),null!=n&&r.util.assert(null==e,function(){return"vocabulary name must be null or undefined when modelURL is provided."}),"BROWSER_FFT"===t)return new j(e,n,i);throw"SOFT_FFT"===t?new Error("SOFT_FFT SpeechCommandRecognizer has not been implemented yet."):new Error("Invalid fftType: '"+t+"'")}var B={concatenateFloat32Arrays:b,playRawAudio:function(t,e){var n=new(window.AudioContext||window.webkitAudioContext),r=n.createBuffer(1,t.data.length,t.sampleRateHz);r.getChannelData(0).set(t.data);var i=n.createBufferSource();i.buffer=r,i.connect(n.destination),i.start(),i.onended=function(){null!=e&&e()}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.load=e.SpeechCommands=void 0;var r=c(n(12)),i=c(n(11)),o=c(n(9)),a=c(n(10)),s=(e.load=function(){var t=(0,i.default)(r.default.mark(function t(e,n){var i;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=new l(e),t.next=3,i.load(n);case 3:return t.abrupt("return",i);case 4:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}(),function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(470))),u=n(178);function c(t){return t&&t.__esModule?t:{default:t}}var l=e.SpeechCommands=function(){function t(e){(0,o.default)(this,t),this.options=e}return(0,a.default)(t,[{key:"load",value:function(){var t=(0,i.default)(r.default.mark(function t(e){var n,i,o;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e?(n=e.split("/"),i=n.slice(0,n.length-1).join("/"),o=i+"/metadata.json",this.model=s.create("BROWSER_FFT",void 0,e,o)):this.model=s.create("BROWSER_FFT"),t.next=3,this.model.ensureModelLoaded();case 3:this.allLabels=this.model.wordLabels();case 4:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.allLabels.length,n=arguments[1];return this.model.listen(function(r){if(r.scores){var i=(0,u.getTopKClassesFromArray)(r.scores,e,t.allLabels).map(function(t){return{label:t.className,confidence:t.probability}});return n(null,i)}return n("ERROR: Cannot find scores in result: "+r)},this.options).catch(function(t){return n("ERROR: "+t.message)})}}]),t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=d(n(17)),i=d(n(12)),o=d(n(11)),a=d(n(9)),s=d(n(10)),u=f(n(2)),c=f(n(471)),l=d(n(20));function f(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function d(t){return t&&t.__esModule?t:{default:t}}var h=["speechcommands18w"],p=function(){function t(e,n,r){if((0,a.default)(this,t),this.model=null,this.options=n,"string"==typeof e)if(h.includes(e))switch(this.modelName=e,this.modelUrl=null,this.modelName){case"speechcommands18w":this.modelToUse=c;break;default:this.modelToUse=null}else this.modelToUse=c,this.modelUrl=e;this.ready=(0,l.default)(this.loadModel(n,this.modelUrl),r)}return(0,s.default)(t,[{key:"loadModel",value:function(){var t=(0,o.default)(i.default.mark(function t(e){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.modelToUse.load(e,this.modelUrl);case 2:return this.model=t.sent,t.abrupt("return",this);case 4:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var t=(0,o.default)(i.default.mark(function t(e,n){return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,u.nextFrame();case 4:return t.abrupt("return",this.model.classify(e,n));case 5:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=(0,o.default)(i.default.mark(function t(){var e,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments[1];return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.topk,n=void 0,"number"==typeof r?e=r:"function"==typeof r&&(n=r),"function"==typeof o&&(n=o),t.abrupt("return",this.classifyInternal(e,n));case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();e.default=function(t,e,n){var i={},o=n,a=t;if("string"!=typeof a)throw new Error('Please specify a model to use. E.g: "SpeechCommands18w"');-1===a.indexOf("http")&&(a=t.toLowerCase()),"object"===(void 0===e?"undefined":(0,r.default)(e))?i=e:"function"==typeof e&&(o=e);var s=new p(a,i,o);return o?s:s.ready}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["flashlight","belt","mushroom","pond","strawberry","pineapple","sun","cow","ear","bush","pliers","watermelon","apple","baseball","feather","shoe","leaf","lollipop","crown","ocean","horse","mountain","mosquito","mug","hospital","saw","castle","angel","underwear","traffic_light","cruise_ship","marker","blueberry","flamingo","face","hockey_stick","bucket","campfire","asparagus","skateboard","door","suitcase","skull","cloud","paint_can","hockey_puck","steak","house_plant","sleeping_bag","bench","snowman","arm","crayon","fan","shovel","leg","washing_machine","harp","toothbrush","tree","bear","rake","megaphone","knee","guitar","calculator","hurricane","grapes","paintbrush","couch","nose","square","wristwatch","penguin","bridge","octagon","submarine","screwdriver","rollerskates","ladder","wine_bottle","cake","bracelet","broom","yoga","finger","fish","line","truck","snake","bus","stitches","snorkel","shorts","bowtie","pickup_truck","tooth","snail","foot","crab","school_bus","train","dresser","sock","tractor","map","hedgehog","coffee_cup","computer","matches","beard","frog","crocodile","bathtub","rain","moon","bee","knife","boomerang","lighthouse","chandelier","jail","pool","stethoscope","frying_pan","cell_phone","binoculars","purse","lantern","birthday_cake","clarinet","palm_tree","aircraft_carrier","vase","eraser","shark","skyscraper","bicycle","sink","teapot","circle","tornado","bird","stereo","mouth","key","hot_dog","spoon","laptop","cup","bottlecap","The_Great_Wall_of_China","The_Mona_Lisa","smiley_face","waterslide","eyeglasses","ceiling_fan","lobster","moustache","carrot","garden","police_car","postcard","necklace","helmet","blackberry","beach","golf_club","car","panda","alarm_clock","t-shirt","dog","bread","wine_glass","lighter","flower","bandage","drill","butterfly","swan","owl","raccoon","squiggle","calendar","giraffe","elephant","trumpet","rabbit","trombone","sheep","onion","church","flip_flops","spreadsheet","pear","clock","roller_coaster","parachute","kangaroo","duck","remote_control","compass","monkey","rainbow","tennis_racquet","lion","pencil","string_bean","oven","star","cat","pizza","soccer_ball","syringe","flying_saucer","eye","cookie","floor_lamp","mouse","toilet","toaster","The_Eiffel_Tower","airplane","stove","cello","stop_sign","tent","diving_board","light_bulb","hammer","scorpion","headphones","basket","spider","paper_clip","sweater","ice_cream","envelope","sea_turtle","donut","hat","hourglass","broccoli","jacket","backpack","book","lightning","drums","snowflake","radio","banana","camel","canoe","toothpaste","chair","picture_frame","parrot","sandwich","lipstick","pants","violin","brain","power_outlet","triangle","hamburger","dragon","bulldozer","cannon","dolphin","zebra","animal_migration","camouflage","scissors","basketball","elbow","umbrella","windmill","table","rifle","hexagon","potato","anvil","sword","peanut","axe","television","rhinoceros","baseball_bat","speedboat","sailboat","zigzag","garden_hose","river","house","pillow","ant","tiger","stairs","cooler","see_saw","piano","fireplace","popsicle","dumbbell","mailbox","barn","hot_tub","teddy-bear","fork","dishwasher","peas","hot_air_balloon","keyboard","microwave","wheel","fire_hydrant","van","camera","whale","candle","octopus","pig","swing_set","helicopter","saxophone","passport","bat","ambulance","diamond","goatee","fence","grass","mermaid","motorbike","microphone","toe","cactus","nail","telephone","hand","squirrel","streetlight","bed","firetruck"]},function(t,e,n){var r=n(56),i=n(184);t.exports=n(19).getIterator=function(t){var e=i(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return r(e.call(t))}},function(t,e,n){n(110),n(93),t.exports=n(474)},function(t,e,n){t.exports={default:n(475),__esModule:!0}},function(t,e,n){var r=n(133),i=n(28)("iterator"),o=n(92);t.exports=n(19).isIterable=function(t){var e=Object(t);return void 0!==e[i]||"@@iterator"in e||o.hasOwnProperty(r(e))}},function(t,e,n){n(110),n(93),t.exports=n(477)},function(t,e,n){t.exports={default:n(478),__esModule:!0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.load=e.Doodlenet=void 0;var r=d(n(12)),i=d(n(11)),o=d(n(9)),a=d(n(10)),s=d(n(72)),u=d(n(17)),c=(e.load=function(){var t=(0,i.default)(r.default.mark(function t(){var e;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=new m,t.next=3,e.load();case 3:return t.abrupt("return",e);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2))),l=n(178),f=d(n(473));function d(t){return t&&t.__esModule?t:{default:t}}var h={DOODLENET_URL:"https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/doodlenet/model.json",IMAGE_SIZE_DOODLENET:28};function p(t,e){var n=void 0;t instanceof c.Tensor?n=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?n=c.browser.fromPixels(t):"object"===(void 0===t?"undefined":(0,u.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(n=c.browser.fromPixels(t.elt));var r=c.scalar(1).sub(n.toFloat().div(c.scalar(255))),i=r;r.shape[0]===e&&r.shape[1]===e||(i=c.image.resizeBilinear(r,[e,e]));var o=c.split(i,3,3),a=(0,s.default)(o,3),l=a[0],f=a[1],d=a[2];return l.add(f).add(d).div(c.scalar(3)).floor().reshape([1,e,e,1])}var m=e.Doodlenet=function(){function t(){(0,o.default)(this,t),this.imgSize=h.IMAGE_SIZE_DOODLENET}return(0,a.default)(t,[{key:"load",value:function(){var t=(0,i.default)(r.default.mark(function t(){var e,n=this;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c.loadLayersModel(h.DOODLENET_URL);case 2:return this.model=t.sent,e=c.tidy(function(){return n.model.predict(c.zeros([1,n.imgSize,n.imgSize,1]))}),t.next=6,e.data();case 6:e.dispose();case 7:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=(0,i.default)(r.default.mark(function t(e){var n,i,o=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=c.tidy(function(){var t=p(e,o.imgSize);return o.model.predict(t)}),t.next=3,(0,l.getTopKClassesFromTensor)(n,a,f.default);case 3:return i=t.sent,n.dispose(),t.abrupt("return",i);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["kit fox","English setter","Siberian husky","Australian terrier","English springer","grey whale","lesser panda","Egyptian cat","ibex","Persian cat","cougar","gazelle","porcupine","sea lion","malamute","badger","Great Dane","Walker hound","Welsh springer spaniel","whippet","Scottish deerhound","killer whale","mink","African elephant","Weimaraner","soft-coated wheaten terrier","Dandie Dinmont","red wolf","Old English sheepdog","jaguar","otterhound","bloodhound","Airedale","hyena","meerkat","giant schnauzer","titi","three-toed sloth","sorrel","black-footed ferret","dalmatian","black-and-tan coonhound","papillon","skunk","Staffordshire bullterrier","Mexican hairless","Bouvier des Flandres","weasel","miniature poodle","Cardigan","malinois","bighorn","fox squirrel","colobus","tiger cat","Lhasa","impala","coyote","Yorkshire terrier","Newfoundland","brown bear","red fox","Norwegian elkhound","Rottweiler","hartebeest","Saluki","grey fox","schipperke","Pekinese","Brabancon griffon","West Highland white terrier","Sealyham terrier","guenon","mongoose","indri","tiger","Irish wolfhound","wild boar","EntleBucher","zebra","ram","French bulldog","orangutan","basenji","leopard","Bernese mountain dog","Maltese dog","Norfolk terrier","toy terrier","vizsla","cairn","squirrel monkey","groenendael","clumber","Siamese cat","chimpanzee","komondor","Afghan hound","Japanese spaniel","proboscis monkey","guinea pig","white wolf","ice bear","gorilla","borzoi","toy poodle","Kerry blue terrier","ox","Scotch terrier","Tibetan mastiff","spider monkey","Doberman","Boston bull","Greater Swiss Mountain dog","Appenzeller","Shih-Tzu","Irish water spaniel","Pomeranian","Bedlington terrier","warthog","Arabian camel","siamang","miniature schnauzer","collie","golden retriever","Irish terrier","affenpinscher","Border collie","hare","boxer","silky terrier","beagle","Leonberg","German short-haired pointer","patas","dhole","baboon","macaque","Chesapeake Bay retriever","bull mastiff","kuvasz","capuchin","pug","curly-coated retriever","Norwich terrier","flat-coated retriever","hog","keeshond","Eskimo dog","Brittany spaniel","standard poodle","Lakeland terrier","snow leopard","Gordon setter","dingo","standard schnauzer","hamster","Tibetan terrier","Arctic fox","wire-haired fox terrier","basset","water buffalo","American black bear","Angora","bison","howler monkey","hippopotamus","chow","giant panda","American Staffordshire terrier","Shetland sheepdog","Great Pyrenees","Chihuahua","tabby","marmoset","Labrador retriever","Saint Bernard","armadillo","Samoyed","bluetick","redbone","polecat","marmot","kelpie","gibbon","llama","miniature pinscher","wood rabbit","Italian greyhound","lion","cocker spaniel","Irish setter","dugong","Indian elephant","beaver","Sussex spaniel","Pembroke","Blenheim spaniel","Madagascar cat","Rhodesian ridgeback","lynx","African hunting dog","langur","Ibizan hound","timber wolf","cheetah","English foxhound","briard","sloth bear","Border terrier","German shepherd","otter","koala","tusker","echidna","wallaby","platypus","wombat","revolver","umbrella","schooner","soccer ball","accordion","ant","starfish","chambered nautilus","grand piano","laptop","strawberry","airliner","warplane","airship","balloon","space shuttle","fireboat","gondola","speedboat","lifeboat","canoe","yawl","catamaran","trimaran","container ship","liner","pirate","aircraft carrier","submarine","wreck","half track","tank","missile","bobsled","dogsled","bicycle-built-for-two","mountain bike","freight car","passenger car","barrow","shopping cart","motor scooter","forklift","electric locomotive","steam locomotive","amphibian","ambulance","beach wagon","cab","convertible","jeep","limousine","minivan","Model T","racer","sports car","go-kart","golfcart","moped","snowplow","fire engine","garbage truck","pickup","tow truck","trailer truck","moving van","police van","recreational vehicle","streetcar","snowmobile","tractor","mobile home","tricycle","unicycle","horse cart","jinrikisha","oxcart","bassinet","cradle","crib","four-poster","bookcase","china cabinet","medicine chest","chiffonier","table lamp","file","park bench","barber chair","throne","folding chair","rocking chair","studio couch","toilet seat","desk","pool table","dining table","entertainment center","wardrobe","Granny Smith","orange","lemon","fig","pineapple","banana","jackfruit","custard apple","pomegranate","acorn","hip","ear","rapeseed","corn","buckeye","organ","upright","chime","drum","gong","maraca","marimba","steel drum","banjo","cello","violin","harp","acoustic guitar","electric guitar","cornet","French horn","trombone","harmonica","ocarina","panpipe","bassoon","oboe","sax","flute","daisy","yellow lady's slipper","cliff","valley","alp","volcano","promontory","sandbar","coral reef","lakeside","seashore","geyser","hatchet","cleaver","letter opener","plane","power drill","lawn mower","hammer","corkscrew","can opener","plunger","screwdriver","shovel","plow","chain saw","cock","hen","ostrich","brambling","goldfinch","house finch","junco","indigo bunting","robin","bulbul","jay","magpie","chickadee","water ouzel","kite","bald eagle","vulture","great grey owl","black grouse","ptarmigan","ruffed grouse","prairie chicken","peacock","quail","partridge","African grey","macaw","sulphur-crested cockatoo","lorikeet","coucal","bee eater","hornbill","hummingbird","jacamar","toucan","drake","red-breasted merganser","goose","black swan","white stork","black stork","spoonbill","flamingo","American egret","little blue heron","bittern","crane","limpkin","American coot","bustard","ruddy turnstone","red-backed sandpiper","redshank","dowitcher","oystercatcher","European gallinule","pelican","king penguin","albatross","great white shark","tiger shark","hammerhead","electric ray","stingray","barracouta","coho","tench","goldfish","eel","rock beauty","anemone fish","lionfish","puffer","sturgeon","gar","loggerhead","leatherback turtle","mud turtle","terrapin","box turtle","banded gecko","common iguana","American chameleon","whiptail","agama","frilled lizard","alligator lizard","Gila monster","green lizard","African chameleon","Komodo dragon","triceratops","African crocodile","American alligator","thunder snake","ringneck snake","hognose snake","green snake","king snake","garter snake","water snake","vine snake","night snake","boa constrictor","rock python","Indian cobra","green mamba","sea snake","horned viper","diamondback","sidewinder","European fire salamander","common newt","eft","spotted salamander","axolotl","bullfrog","tree frog","tailed frog","whistle","wing","paintbrush","hand blower","oxygen mask","snorkel","loudspeaker","microphone","screen","mouse","electric fan","oil filter","strainer","space heater","stove","guillotine","barometer","rule","odometer","scale","analog clock","digital clock","wall clock","hourglass","sundial","parking meter","stopwatch","digital watch","stethoscope","syringe","magnetic compass","binoculars","projector","sunglasses","loupe","radio telescope","bow","cannon","assault rifle","rifle","projectile","computer keyboard","typewriter keyboard","crane","lighter","abacus","cash machine","slide rule","desktop computer","hand-held computer","notebook","web site","harvester","thresher","printer","slot","vending machine","sewing machine","joystick","switch","hook","car wheel","paddlewheel","pinwheel","potter's wheel","gas pump","carousel","swing","reel","radiator","puck","hard disc","sunglass","pick","car mirror","solar dish","remote control","disk brake","buckle","hair slide","knot","combination lock","padlock","nail","safety pin","screw","muzzle","seat belt","ski","candle","jack-o'-lantern","spotlight","torch","neck brace","pier","tripod","maypole","mousetrap","spider web","trilobite","harvestman","scorpion","black and gold garden spider","barn spider","garden spider","black widow","tarantula","wolf spider","tick","centipede","isopod","Dungeness crab","rock crab","fiddler crab","king crab","American lobster","spiny lobster","crayfish","hermit crab","tiger beetle","ladybug","ground beetle","long-horned beetle","leaf beetle","dung beetle","rhinoceros beetle","weevil","fly","bee","grasshopper","cricket","walking stick","cockroach","mantis","cicada","leafhopper","lacewing","dragonfly","damselfly","admiral","ringlet","monarch","cabbage butterfly","sulphur butterfly","lycaenid","jellyfish","sea anemone","brain coral","flatworm","nematode","conch","snail","slug","sea slug","chiton","sea urchin","sea cucumber","iron","espresso maker","microwave","Dutch oven","rotisserie","toaster","waffle iron","vacuum","dishwasher","refrigerator","washer","Crock Pot","frying pan","wok","caldron","coffeepot","teapot","spatula","altar","triumphal arch","patio","steel arch bridge","suspension bridge","viaduct","barn","greenhouse","palace","monastery","library","apiary","boathouse","church","mosque","stupa","planetarium","restaurant","cinema","home theater","lumbermill","coil","obelisk","totem pole","castle","prison","grocery store","bakery","barbershop","bookshop","butcher shop","confectionery","shoe shop","tobacco shop","toyshop","fountain","cliff dwelling","yurt","dock","brass","megalith","bannister","breakwater","dam","chainlink fence","picket fence","worm fence","stone wall","grille","sliding door","turnstile","mountain tent","scoreboard","honeycomb","plate rack","pedestal","beacon","mashed potato","bell pepper","head cabbage","broccoli","cauliflower","zucchini","spaghetti squash","acorn squash","butternut squash","cucumber","artichoke","cardoon","mushroom","shower curtain","jean","carton","handkerchief","sandal","ashcan","safe","plate","necklace","croquet ball","fur coat","thimble","pajama","running shoe","cocktail shaker","chest","manhole cover","modem","tub","tray","balance beam","bagel","prayer rug","kimono","hot pot","whiskey jug","knee pad","book jacket","spindle","ski mask","beer bottle","crash helmet","bottlecap","tile roof","mask","maillot","Petri dish","football helmet","bathing cap","teddy","holster","pop bottle","photocopier","vestment","crossword puzzle","golf ball","trifle","suit","water tower","feather boa","cloak","red wine","drumstick","shield","Christmas stocking","hoopskirt","menu","stage","bonnet","meat loaf","baseball","face powder","scabbard","sunscreen","beer glass","hen-of-the-woods","guacamole","lampshade","wool","hay","bow tie","mailbag","water jug","bucket","dishrag","soup bowl","eggnog","mortar","trench coat","paddle","chain","swab","mixing bowl","potpie","wine bottle","shoji","bulletproof vest","drilling platform","binder","cardigan","sweatshirt","pot","birdhouse","hamper","ping-pong ball","pencil box","pay-phone","consomme","apron","punching bag","backpack","groom","bearskin","pencil sharpener","broom","mosquito net","abaya","mortarboard","poncho","crutch","Polaroid camera","space bar","cup","racket","traffic light","quill","radio","dough","cuirass","military uniform","lipstick","shower cap","monitor","oscilloscope","mitten","brassiere","French loaf","vase","milk can","rugby ball","paper towel","earthstar","envelope","miniskirt","cowboy hat","trolleybus","perfume","bathtub","hotdog","coral fungus","bullet train","pillow","toilet tissue","cassette","carpenter's kit","ladle","stinkhorn","lotion","hair spray","academic gown","dome","crate","wig","burrito","pill bottle","chain mail","theater curtain","window shade","barrel","washbasin","ballpoint","basketball","bath towel","cowboy boot","gown","window screen","agaric","cellular telephone","nipple","barbell","mailbox","lab coat","fire screen","minibus","packet","maze","pole","horizontal bar","sombrero","pickelhaube","rain barrel","wallet","cassette player","comic book","piggy bank","street sign","bell cote","fountain pen","Windsor tie","volleyball","overskirt","sarong","purse","bolo tie","bib","parachute","sleeping bag","television","swimming trunks","measuring cup","espresso","pizza","breastplate","shopping basket","wooden spoon","saltshaker","chocolate sauce","ballplayer","goblet","gyromitra","stretcher","water bottle","dial telephone","soap dispenser","jersey","school bus","jigsaw puzzle","plastic bag","reflex camera","diaper","Band Aid","ice lolly","velvet","tennis ball","gasmask","doormat","Loafer","ice cream","pretzel","quilt","maillot","tape player","clog","iPod","bolete","scuba diver","pitcher","matchstick","bikini","sock","CD player","lens cap","thatch","vault","beaker","bubble","cheeseburger","parallel bars","flagpole","coffee mug","rubber eraser","stole","carbonara","dumbbell"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.load=e.Darknet=void 0;var r=f(n(12)),i=f(n(11)),o=f(n(9)),a=f(n(10)),s=f(n(17)),u=(e.load=function(){var t=(0,i.default)(r.default.mark(function t(e){var n;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("reference"===e||"tiny"===e){t.next=2;break}throw new Error("Please select a version: darknet-reference or darknet-tiny");case 2:return n=new p(e),t.next=5,n.load();case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2))),c=n(178),l=f(n(481));function f(t){return t&&t.__esModule?t:{default:t}}var d={DARKNET_URL:"https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknetreference/model.json",DARKNET_TINY_URL:"https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknettiny/model.json",IMAGE_SIZE_DARKNET:256,IMAGE_SIZE_DARKNET_TINY:224};function h(t,e){var n=void 0;t instanceof u.Tensor?n=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?n=u.browser.fromPixels(t):"object"===(void 0===t?"undefined":(0,s.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(n=u.browser.fromPixels(t.elt));var r=n.toFloat().div(u.scalar(255)),i=r;return r.shape[0]===e&&r.shape[1]===e||(i=u.image.resizeBilinear(r,[e,e],!0)),i.reshape([1,e,e,3])}var p=e.Darknet=function(){function t(e){switch((0,o.default)(this,t),this.version=e,this.version){case"reference":this.imgSize=d.IMAGE_SIZE_DARKNET;break;case"tiny":this.imgSize=d.IMAGE_SIZE_DARKNET_TINY}}return(0,a.default)(t,[{key:"load",value:function(){var t=(0,i.default)(r.default.mark(function t(){var e,n=this;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=this.version,t.next="reference"===t.t0?3:"tiny"===t.t0?7:11;break;case 3:return t.next=5,u.loadLayersModel(d.DARKNET_URL);case 5:return this.model=t.sent,t.abrupt("break",12);case 7:return t.next=9,u.loadLayersModel(d.DARKNET_TINY_URL);case 9:return this.model=t.sent,t.abrupt("break",12);case 11:return t.abrupt("break",12);case 12:return e=u.tidy(function(){return n.model.predict(u.zeros([1,n.imgSize,n.imgSize,3]))}),t.next=15,e.data();case 15:e.dispose();case 16:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=(0,i.default)(r.default.mark(function t(e){var n,i,o=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=u.tidy(function(){var t=h(e,o.imgSize),n=o.model.predict(t);return u.softmax(n)}),t.next=3,(0,c.getTopKClassesFromTensor)(n,a,l.default);case 3:return i=t.sent,n.dispose(),t.abrupt("return",i);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}()},function(t,e,n){"use strict";n.r(e),n.d(e,"load",function(){return l});var r=n(32),i=n(0);
/**
* @license
* Copyright 2019 Google LLC. 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 o(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function a(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var s={0:"tench, Tinca tinca",1:"goldfish, Carassius auratus",2:"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",3:"tiger shark, Galeocerdo cuvieri",4:"hammerhead, hammerhead shark",5:"electric ray, crampfish, numbfish, torpedo",6:"stingray",7:"cock",8:"hen",9:"ostrich, Struthio camelus",10:"brambling, Fringilla montifringilla",11:"goldfinch, Carduelis carduelis",12:"house finch, linnet, Carpodacus mexicanus",13:"junco, snowbird",14:"indigo bunting, indigo finch, indigo bird, Passerina cyanea",15:"robin, American robin, Turdus migratorius",16:"bulbul",17:"jay",18:"magpie",19:"chickadee",20:"water ouzel, dipper",21:"kite",22:"bald eagle, American eagle, Haliaeetus leucocephalus",23:"vulture",24:"great grey owl, great gray owl, Strix nebulosa",25:"European fire salamander, Salamandra salamandra",26:"common newt, Triturus vulgaris",27:"eft",28:"spotted salamander, Ambystoma maculatum",29:"axolotl, mud puppy, Ambystoma mexicanum",30:"bullfrog, Rana catesbeiana",31:"tree frog, tree-frog",32:"tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",33:"loggerhead, loggerhead turtle, Caretta caretta",34:"leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",35:"mud turtle",36:"terrapin",37:"box turtle, box tortoise",38:"banded gecko",39:"common iguana, iguana, Iguana iguana",40:"American chameleon, anole, Anolis carolinensis",41:"whiptail, whiptail lizard",42:"agama",43:"frilled lizard, Chlamydosaurus kingi",44:"alligator lizard",45:"Gila monster, Heloderma suspectum",46:"green lizard, Lacerta viridis",47:"African chameleon, Chamaeleo chamaeleon",48:"Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",49:"African crocodile, Nile crocodile, Crocodylus niloticus",50:"American alligator, Alligator mississipiensis",51:"triceratops",52:"thunder snake, worm snake, Carphophis amoenus",53:"ringneck snake, ring-necked snake, ring snake",54:"hognose snake, puff adder, sand viper",55:"green snake, grass snake",56:"king snake, kingsnake",57:"garter snake, grass snake",58:"water snake",59:"vine snake",60:"night snake, Hypsiglena torquata",61:"boa constrictor, Constrictor constrictor",62:"rock python, rock snake, Python sebae",63:"Indian cobra, Naja naja",64:"green mamba",65:"sea snake",66:"horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",67:"diamondback, diamondback rattlesnake, Crotalus adamanteus",68:"sidewinder, horned rattlesnake, Crotalus cerastes",69:"trilobite",70:"harvestman, daddy longlegs, Phalangium opilio",71:"scorpion",72:"black and gold garden spider, Argiope aurantia",73:"barn spider, Araneus cavaticus",74:"garden spider, Aranea diademata",75:"black widow, Latrodectus mactans",76:"tarantula",77:"wolf spider, hunting spider",78:"tick",79:"centipede",80:"black grouse",81:"ptarmigan",82:"ruffed grouse, partridge, Bonasa umbellus",83:"prairie chicken, prairie grouse, prairie fowl",84:"peacock",85:"quail",86:"partridge",87:"African grey, African gray, Psittacus erithacus",88:"macaw",89:"sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",90:"lorikeet",91:"coucal",92:"bee eater",93:"hornbill",94:"hummingbird",95:"jacamar",96:"toucan",97:"drake",98:"red-breasted merganser, Mergus serrator",99:"goose",100:"black swan, Cygnus atratus",101:"tusker",102:"echidna, spiny anteater, anteater",103:"platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",104:"wallaby, brush kangaroo",105:"koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",106:"wombat",107:"jelly fish",108:"sea anemone, anemone",109:"brain coral",110:"flatworm, platyhelminth",111:"nematode, nematode worm, roundworm",112:"conch",113:"snail",114:"slug",115:"sea slug, nudibranch",116:"chiton, coat-of-mail shell, sea cradle, polyplacophore",117:"chambered nautilus, pearly nautilus, nautilus",118:"Dungeness crab, Cancer magister",119:"rock crab, Cancer irroratus",120:"fiddler crab",121:"king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",122:"American lobster, Northern lobster, Maine lobster, Homarus americanus",123:"spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",124:"crayfish, crawfish, crawdad, crawdaddy",125:"hermit crab",126:"isopod",127:"white stork, Ciconia ciconia",128:"black stork, Ciconia nigra",129:"spoonbill",130:"flamingo",131:"little blue heron, Egretta caerulea",132:"American egret, great white heron, Egretta albus",133:"bittern",134:"crane",135:"limpkin, Aramus pictus",136:"European gallinule, Porphyrio porphyrio",137:"American coot, marsh hen, mud hen, water hen, Fulica americana",138:"bustard",139:"ruddy turnstone, Arenaria interpres",140:"red-backed sandpiper, dunlin, Erolia alpina",141:"redshank, Tringa totanus",142:"dowitcher",143:"oystercatcher, oyster catcher",144:"pelican",145:"king penguin, Aptenodytes patagonica",146:"albatross, mollymawk",147:"grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",148:"killer whale, killer, orca, grampus, sea wolf, Orcinus orca",149:"dugong, Dugong dugon",150:"sea lion",151:"Chihuahua",152:"Japanese spaniel",153:"Maltese dog, Maltese terrier, Maltese",154:"Pekinese, Pekingese, Peke",155:"Shih-Tzu",156:"Blenheim spaniel",157:"papillon",158:"toy terrier",159:"Rhodesian ridgeback",160:"Afghan hound, Afghan",161:"basset, basset hound",162:"beagle",163:"bloodhound, sleuthhound",164:"bluetick",165:"black-and-tan coonhound",166:"Walker hound, Walker foxhound",167:"English foxhound",168:"redbone",169:"borzoi, Russian wolfhound",170:"Irish wolfhound",171:"Italian greyhound",172:"whippet",173:"Ibizan hound, Ibizan Podenco",174:"Norwegian elkhound, elkhound",175:"otterhound, otter hound",176:"Saluki, gazelle hound",177:"Scottish deerhound, deerhound",178:"Weimaraner",179:"Staffordshire bullterrier, Staffordshire bull terrier",180:"American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",181:"Bedlington terrier",182:"Border terrier",183:"Kerry blue terrier",184:"Irish terrier",185:"Norfolk terrier",186:"Norwich terrier",187:"Yorkshire terrier",188:"wire-haired fox terrier",189:"Lakeland terrier",190:"Sealyham terrier, Sealyham",191:"Airedale, Airedale terrier",192:"cairn, cairn terrier",193:"Australian terrier",194:"Dandie Dinmont, Dandie Dinmont terrier",195:"Boston bull, Boston terrier",196:"miniature schnauzer",197:"giant schnauzer",198:"standard schnauzer",199:"Scotch terrier, Scottish terrier, Scottie",200:"Tibetan terrier, chrysanthemum dog",201:"silky terrier, Sydney silky",202:"soft-coated wheaten terrier",203:"West Highland white terrier",204:"Lhasa, Lhasa apso",205:"flat-coated retriever",206:"curly-coated retriever",207:"golden retriever",208:"Labrador retriever",209:"Chesapeake Bay retriever",210:"German short-haired pointer",211:"vizsla, Hungarian pointer",212:"English setter",213:"Irish setter, red setter",214:"Gordon setter",215:"Brittany spaniel",216:"clumber, clumber spaniel",217:"English springer, English springer spaniel",218:"Welsh springer spaniel",219:"cocker spaniel, English cocker spaniel, cocker",220:"Sussex spaniel",221:"Irish water spaniel",222:"kuvasz",223:"schipperke",224:"groenendael",225:"malinois",226:"briard",227:"kelpie",228:"komondor",229:"Old English sheepdog, bobtail",230:"Shetland sheepdog, Shetland sheep dog, Shetland",231:"collie",232:"Border collie",233:"Bouvier des Flandres, Bouviers des Flandres",234:"Rottweiler",235:"German shepherd, German shepherd dog, German police dog, alsatian",236:"Doberman, Doberman pinscher",237:"miniature pinscher",238:"Greater Swiss Mountain dog",239:"Bernese mountain dog",240:"Appenzeller",241:"EntleBucher",242:"boxer",243:"bull mastiff",244:"Tibetan mastiff",245:"French bulldog",246:"Great Dane",247:"Saint Bernard, St Bernard",248:"Eskimo dog, husky",249:"malamute, malemute, Alaskan malamute",250:"Siberian husky",251:"dalmatian, coach dog, carriage dog",252:"affenpinscher, monkey pinscher, monkey dog",253:"basenji",254:"pug, pug-dog",255:"Leonberg",256:"Newfoundland, Newfoundland dog",257:"Great Pyrenees",258:"Samoyed, Samoyede",259:"Pomeranian",260:"chow, chow chow",261:"keeshond",262:"Brabancon griffon",263:"Pembroke, Pembroke Welsh corgi",264:"Cardigan, Cardigan Welsh corgi",265:"toy poodle",266:"miniature poodle",267:"standard poodle",268:"Mexican hairless",269:"timber wolf, grey wolf, gray wolf, Canis lupus",270:"white wolf, Arctic wolf, Canis lupus tundrarum",271:"red wolf, maned wolf, Canis rufus, Canis niger",272:"coyote, prairie wolf, brush wolf, Canis latrans",273:"dingo, warrigal, warragal, Canis dingo",274:"dhole, Cuon alpinus",275:"African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",276:"hyena, hyaena",277:"red fox, Vulpes vulpes",278:"kit fox, Vulpes macrotis",279:"Arctic fox, white fox, Alopex lagopus",280:"grey fox, gray fox, Urocyon cinereoargenteus",281:"tabby, tabby cat",282:"tiger cat",283:"Persian cat",284:"Siamese cat, Siamese",285:"Egyptian cat",286:"cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",287:"lynx, catamount",288:"leopard, Panthera pardus",289:"snow leopard, ounce, Panthera uncia",290:"jaguar, panther, Panthera onca, Felis onca",291:"lion, king of beasts, Panthera leo",292:"tiger, Panthera tigris",293:"cheetah, chetah, Acinonyx jubatus",294:"brown bear, bruin, Ursus arctos",295:"American black bear, black bear, Ursus americanus, Euarctos americanus",296:"ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",297:"sloth bear, Melursus ursinus, Ursus ursinus",298:"mongoose",299:"meerkat, mierkat",300:"tiger beetle",301:"ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",302:"ground beetle, carabid beetle",303:"long-horned beetle, longicorn, longicorn beetle",304:"leaf beetle, chrysomelid",305:"dung beetle",306:"rhinoceros beetle",307:"weevil",308:"fly",309:"bee",310:"ant, emmet, pismire",311:"grasshopper, hopper",312:"cricket",313:"walking stick, walkingstick, stick insect",314:"cockroach, roach",315:"mantis, mantid",316:"cicada, cicala",317:"leafhopper",318:"lacewing, lacewing fly",319:"dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",320:"damselfly",321:"admiral",322:"ringlet, ringlet butterfly",323:"monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",324:"cabbage butterfly",325:"sulphur butterfly, sulfur butterfly",326:"lycaenid, lycaenid butterfly",327:"starfish, sea star",328:"sea urchin",329:"sea cucumber, holothurian",330:"wood rabbit, cottontail, cottontail rabbit",331:"hare",332:"Angora, Angora rabbit",333:"hamster",334:"porcupine, hedgehog",335:"fox squirrel, eastern fox squirrel, Sciurus niger",336:"marmot",337:"beaver",338:"guinea pig, Cavia cobaya",339:"sorrel",340:"zebra",341:"hog, pig, grunter, squealer, Sus scrofa",342:"wild boar, boar, Sus scrofa",343:"warthog",344:"hippopotamus, hippo, river horse, Hippopotamus amphibius",345:"ox",346:"water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",347:"bison",348:"ram, tup",349:"bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",350:"ibex, Capra ibex",351:"hartebeest",352:"impala, Aepyceros melampus",353:"gazelle",354:"Arabian camel, dromedary, Camelus dromedarius",355:"llama",356:"weasel",357:"mink",358:"polecat, fitch, foulmart, foumart, Mustela putorius",359:"black-footed ferret, ferret, Mustela nigripes",360:"otter",361:"skunk, polecat, wood pussy",362:"badger",363:"armadillo",364:"three-toed sloth, ai, Bradypus tridactylus",365:"orangutan, orang, orangutang, Pongo pygmaeus",366:"gorilla, Gorilla gorilla",367:"chimpanzee, chimp, Pan troglodytes",368:"gibbon, Hylobates lar",369:"siamang, Hylobates syndactylus, Symphalangus syndactylus",370:"guenon, guenon monkey",371:"patas, hussar monkey, Erythrocebus patas",372:"baboon",373:"macaque",374:"langur",375:"colobus, colobus monkey",376:"proboscis monkey, Nasalis larvatus",377:"marmoset",378:"capuchin, ringtail, Cebus capucinus",379:"howler monkey, howler",380:"titi, titi monkey",381:"spider monkey, Ateles geoffroyi",382:"squirrel monkey, Saimiri sciureus",383:"Madagascar cat, ring-tailed lemur, Lemur catta",384:"indri, indris, Indri indri, Indri brevicaudatus",385:"Indian elephant, Elephas maximus",386:"African elephant, Loxodonta africana",387:"lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",388:"giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",389:"barracouta, snoek",390:"eel",391:"coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",392:"rock beauty, Holocanthus tricolor",393:"anemone fish",394:"sturgeon",395:"gar, garfish, garpike, billfish, Lepisosteus osseus",396:"lionfish",397:"puffer, pufferfish, blowfish, globefish",398:"abacus",399:"abaya",400:"academic gown, academic robe, judge's robe",401:"accordion, piano accordion, squeeze box",402:"acoustic guitar",403:"aircraft carrier, carrier, flattop, attack aircraft carrier",404:"airliner",405:"airship, dirigible",406:"altar",407:"ambulance",408:"amphibian, amphibious vehicle",409:"analog clock",410:"apiary, bee house",411:"apron",412:"ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",413:"assault rifle, assault gun",414:"backpack, back pack, knapsack, packsack, rucksack, haversack",415:"bakery, bakeshop, bakehouse",416:"balance beam, beam",417:"balloon",418:"ballpoint, ballpoint pen, ballpen, Biro",419:"Band Aid",420:"banjo",421:"bannister, banister, balustrade, balusters, handrail",422:"barbell",423:"barber chair",424:"barbershop",425:"barn",426:"barometer",427:"barrel, cask",428:"barrow, garden cart, lawn cart, wheelbarrow",429:"baseball",430:"basketball",431:"bassinet",432:"bassoon",433:"bathing cap, swimming cap",434:"bath towel",435:"bathtub, bathing tub, bath, tub",436:"beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",437:"beacon, lighthouse, beacon light, pharos",438:"beaker",439:"bearskin, busby, shako",440:"beer bottle",441:"beer glass",442:"bell cote, bell cot",443:"bib",444:"bicycle-built-for-two, tandem bicycle, tandem",445:"bikini, two-piece",446:"binder, ring-binder",447:"binoculars, field glasses, opera glasses",448:"birdhouse",449:"boathouse",450:"bobsled, bobsleigh, bob",451:"bolo tie, bolo, bola tie, bola",452:"bonnet, poke bonnet",453:"bookcase",454:"bookshop, bookstore, bookstall",455:"bottlecap",456:"bow",457:"bow tie, bow-tie, bowtie",458:"brass, memorial tablet, plaque",459:"brassiere, bra, bandeau",460:"breakwater, groin, groyne, mole, bulwark, seawall, jetty",461:"breastplate, aegis, egis",462:"broom",463:"bucket, pail",464:"buckle",465:"bulletproof vest",466:"bullet train, bullet",467:"butcher shop, meat market",468:"cab, hack, taxi, taxicab",469:"caldron, cauldron",470:"candle, taper, wax light",471:"cannon",472:"canoe",473:"can opener, tin opener",474:"cardigan",475:"car mirror",476:"carousel, carrousel, merry-go-round, roundabout, whirligig",477:"carpenter's kit, tool kit",478:"carton",479:"car wheel",480:"cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",481:"cassette",482:"cassette player",483:"castle",484:"catamaran",485:"CD player",486:"cello, violoncello",487:"cellular telephone, cellular phone, cellphone, cell, mobile phone",488:"chain",489:"chainlink fence",490:"chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",491:"chain saw, chainsaw",492:"chest",493:"chiffonier, commode",494:"chime, bell, gong",495:"china cabinet, china closet",496:"Christmas stocking",497:"church, church building",498:"cinema, movie theater, movie theatre, movie house, picture palace",499:"cleaver, meat cleaver, chopper",500:"cliff dwelling",501:"cloak",502:"clog, geta, patten, sabot",503:"cocktail shaker",504:"coffee mug",505:"coffeepot",506:"coil, spiral, volute, whorl, helix",507:"combination lock",508:"computer keyboard, keypad",509:"confectionery, confectionary, candy store",510:"container ship, containership, container vessel",511:"convertible",512:"corkscrew, bottle screw",513:"cornet, horn, trumpet, trump",514:"cowboy boot",515:"cowboy hat, ten-gallon hat",516:"cradle",517:"crane",518:"crash helmet",519:"crate",520:"crib, cot",521:"Crock Pot",522:"croquet ball",523:"crutch",524:"cuirass",525:"dam, dike, dyke",526:"desk",527:"desktop computer",528:"dial telephone, dial phone",529:"diaper, nappy, napkin",530:"digital clock",531:"digital watch",532:"dining table, board",533:"dishrag, dishcloth",534:"dishwasher, dish washer, dishwashing machine",535:"disk brake, disc brake",536:"dock, dockage, docking facility",537:"dogsled, dog sled, dog sleigh",538:"dome",539:"doormat, welcome mat",540:"drilling platform, offshore rig",541:"drum, membranophone, tympan",542:"drumstick",543:"dumbbell",544:"Dutch oven",545:"electric fan, blower",546:"electric guitar",547:"electric locomotive",548:"entertainment center",549:"envelope",550:"espresso maker",551:"face powder",552:"feather boa, boa",553:"file, file cabinet, filing cabinet",554:"fireboat",555:"fire engine, fire truck",556:"fire screen, fireguard",557:"flagpole, flagstaff",558:"flute, transverse flute",559:"folding chair",560:"football helmet",561:"forklift",562:"fountain",563:"fountain pen",564:"four-poster",565:"freight car",566:"French horn, horn",567:"frying pan, frypan, skillet",568:"fur coat",569:"garbage truck, dustcart",570:"gasmask, respirator, gas helmet",571:"gas pump, gasoline pump, petrol pump, island dispenser",572:"goblet",573:"go-kart",574:"golf ball",575:"golfcart, golf cart",576:"gondola",577:"gong, tam-tam",578:"gown",579:"grand piano, grand",580:"greenhouse, nursery, glasshouse",581:"grille, radiator grille",582:"grocery store, grocery, food market, market",583:"guillotine",584:"hair slide",585:"hair spray",586:"half track",587:"hammer",588:"hamper",589:"hand blower, blow dryer, blow drier, hair dryer, hair drier",590:"hand-held computer, hand-held microcomputer",591:"handkerchief, hankie, hanky, hankey",592:"hard disc, hard disk, fixed disk",593:"harmonica, mouth organ, harp, mouth harp",594:"harp",595:"harvester, reaper",596:"hatchet",597:"holster",598:"home theater, home theatre",599:"honeycomb",600:"hook, claw",601:"hoopskirt, crinoline",602:"horizontal bar, high bar",603:"horse cart, horse-cart",604:"hourglass",605:"iPod",606:"iron, smoothing iron",607:"jack-o'-lantern",608:"jean, blue jean, denim",609:"jeep, landrover",610:"jersey, T-shirt, tee shirt",611:"jigsaw puzzle",612:"jinrikisha, ricksha, rickshaw",613:"joystick",614:"kimono",615:"knee pad",616:"knot",617:"lab coat, laboratory coat",618:"ladle",619:"lampshade, lamp shade",620:"laptop, laptop computer",621:"lawn mower, mower",622:"lens cap, lens cover",623:"letter opener, paper knife, paperknife",624:"library",625:"lifeboat",626:"lighter, light, igniter, ignitor",627:"limousine, limo",628:"liner, ocean liner",629:"lipstick, lip rouge",630:"Loafer",631:"lotion",632:"loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",633:"loupe, jeweler's loupe",634:"lumbermill, sawmill",635:"magnetic compass",636:"mailbag, postbag",637:"mailbox, letter box",638:"maillot",639:"maillot, tank suit",640:"manhole cover",641:"maraca",642:"marimba, xylophone",643:"mask",644:"matchstick",645:"maypole",646:"maze, labyrinth",647:"measuring cup",648:"medicine chest, medicine cabinet",649:"megalith, megalithic structure",650:"microphone, mike",651:"microwave, microwave oven",652:"military uniform",653:"milk can",654:"minibus",655:"miniskirt, mini",656:"minivan",657:"missile",658:"mitten",659:"mixing bowl",660:"mobile home, manufactured home",661:"Model T",662:"modem",663:"monastery",664:"monitor",665:"moped",666:"mortar",667:"mortarboard",668:"mosque",669:"mosquito net",670:"motor scooter, scooter",671:"mountain bike, all-terrain bike, off-roader",672:"mountain tent",673:"mouse, computer mouse",674:"mousetrap",675:"moving van",676:"muzzle",677:"nail",678:"neck brace",679:"necklace",680:"nipple",681:"notebook, notebook computer",682:"obelisk",683:"oboe, hautboy, hautbois",684:"ocarina, sweet potato",685:"odometer, hodometer, mileometer, milometer",686:"oil filter",687:"organ, pipe organ",688:"oscilloscope, scope, cathode-ray oscilloscope, CRO",689:"overskirt",690:"oxcart",691:"oxygen mask",692:"packet",693:"paddle, boat paddle",694:"paddlewheel, paddle wheel",695:"padlock",696:"paintbrush",697:"pajama, pyjama, pj's, jammies",698:"palace",699:"panpipe, pandean pipe, syrinx",700:"paper towel",701:"parachute, chute",702:"parallel bars, bars",703:"park bench",704:"parking meter",705:"passenger car, coach, carriage",706:"patio, terrace",707:"pay-phone, pay-station",708:"pedestal, plinth, footstall",709:"pencil box, pencil case",710:"pencil sharpener",711:"perfume, essence",712:"Petri dish",713:"photocopier",714:"pick, plectrum, plectron",715:"pickelhaube",716:"picket fence, paling",717:"pickup, pickup truck",718:"pier",719:"piggy bank, penny bank",720:"pill bottle",721:"pillow",722:"ping-pong ball",723:"pinwheel",724:"pirate, pirate ship",725:"pitcher, ewer",726:"plane, carpenter's plane, woodworking plane",727:"planetarium",728:"plastic bag",729:"plate rack",730:"plow, plough",731:"plunger, plumber's helper",732:"Polaroid camera, Polaroid Land camera",733:"pole",734:"police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",735:"poncho",736:"pool table, billiard table, snooker table",737:"pop bottle, soda bottle",738:"pot, flowerpot",739:"potter's wheel",740:"power drill",741:"prayer rug, prayer mat",742:"printer",743:"prison, prison house",744:"projectile, missile",745:"projector",746:"puck, hockey puck",747:"punching bag, punch bag, punching ball, punchball",748:"purse",749:"quill, quill pen",750:"quilt, comforter, comfort, puff",751:"racer, race car, racing car",752:"racket, racquet",753:"radiator",754:"radio, wireless",755:"radio telescope, radio reflector",756:"rain barrel",757:"recreational vehicle, RV, R.V.",758:"reel",759:"reflex camera",760:"refrigerator, icebox",761:"remote control, remote",762:"restaurant, eating house, eating place, eatery",763:"revolver, six-gun, six-shooter",764:"rifle",765:"rocking chair, rocker",766:"rotisserie",767:"rubber eraser, rubber, pencil eraser",768:"rugby ball",769:"rule, ruler",770:"running shoe",771:"safe",772:"safety pin",773:"saltshaker, salt shaker",774:"sandal",775:"sarong",776:"sax, saxophone",777:"scabbard",778:"scale, weighing machine",779:"school bus",780:"schooner",781:"scoreboard",782:"screen, CRT screen",783:"screw",784:"screwdriver",785:"seat belt, seatbelt",786:"sewing machine",787:"shield, buckler",788:"shoe shop, shoe-shop, shoe store",789:"shoji",790:"shopping basket",791:"shopping cart",792:"shovel",793:"shower cap",794:"shower curtain",795:"ski",796:"ski mask",797:"sleeping bag",798:"slide rule, slipstick",799:"sliding door",800:"slot, one-armed bandit",801:"snorkel",802:"snowmobile",803:"snowplow, snowplough",804:"soap dispenser",805:"soccer ball",806:"sock",807:"solar dish, solar collector, solar furnace",808:"sombrero",809:"soup bowl",810:"space bar",811:"space heater",812:"space shuttle",813:"spatula",814:"speedboat",815:"spider web, spider's web",816:"spindle",817:"sports car, sport car",818:"spotlight, spot",819:"stage",820:"steam locomotive",821:"steel arch bridge",822:"steel drum",823:"stethoscope",824:"stole",825:"stone wall",826:"stopwatch, stop watch",827:"stove",828:"strainer",829:"streetcar, tram, tramcar, trolley, trolley car",830:"stretcher",831:"studio couch, day bed",832:"stupa, tope",833:"submarine, pigboat, sub, U-boat",834:"suit, suit of clothes",835:"sundial",836:"sunglass",837:"sunglasses, dark glasses, shades",838:"sunscreen, sunblock, sun blocker",839:"suspension bridge",840:"swab, swob, mop",841:"sweatshirt",842:"swimming trunks, bathing trunks",843:"swing",844:"switch, electric switch, electrical switch",845:"syringe",846:"table lamp",847:"tank, army tank, armored combat vehicle, armoured combat vehicle",848:"tape player",849:"teapot",850:"teddy, teddy bear",851:"television, television system",852:"tennis ball",853:"thatch, thatched roof",854:"theater curtain, theatre curtain",855:"thimble",856:"thresher, thrasher, threshing machine",857:"throne",858:"tile roof",859:"toaster",860:"tobacco shop, tobacconist shop, tobacconist",861:"toilet seat",862:"torch",863:"totem pole",864:"tow truck, tow car, wrecker",865:"toyshop",866:"tractor",867:"trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",868:"tray",869:"trench coat",870:"tricycle, trike, velocipede",871:"trimaran",872:"tripod",873:"triumphal arch",874:"trolleybus, trolley coach, trackless trolley",875:"trombone",876:"tub, vat",877:"turnstile",878:"typewriter keyboard",879:"umbrella",880:"unicycle, monocycle",881:"upright, upright piano",882:"vacuum, vacuum cleaner",883:"vase",884:"vault",885:"velvet",886:"vending machine",887:"vestment",888:"viaduct",889:"violin, fiddle",890:"volleyball",891:"waffle iron",892:"wall clock",893:"wallet, billfold, notecase, pocketbook",894:"wardrobe, closet, press",895:"warplane, military plane",896:"washbasin, handbasin, washbowl, lavabo, wash-hand basin",897:"washer, automatic washer, washing machine",898:"water bottle",899:"water jug",900:"water tower",901:"whiskey jug",902:"whistle",903:"wig",904:"window screen",905:"window shade",906:"Windsor tie",907:"wine bottle",908:"wing",909:"wok",910:"wooden spoon",911:"wool, woolen, woollen",912:"worm fence, snake fence, snake-rail fence, Virginia fence",913:"wreck",914:"yawl",915:"yurt",916:"web site, website, internet site, site",917:"comic book",918:"crossword puzzle, crossword",919:"street sign",920:"traffic light, traffic signal, stoplight",921:"book jacket, dust cover, dust jacket, dust wrapper",922:"menu",923:"plate",924:"guacamole",925:"consomme",926:"hot pot, hotpot",927:"trifle",928:"ice cream, icecream",929:"ice lolly, lolly, lollipop, popsicle",930:"French loaf",931:"bagel, beigel",932:"pretzel",933:"cheeseburger",934:"hotdog, hot dog, red hot",935:"mashed potato",936:"head cabbage",937:"broccoli",938:"cauliflower",939:"zucchini, courgette",940:"spaghetti squash",941:"acorn squash",942:"butternut squash",943:"cucumber, cuke",944:"artichoke, globe artichoke",945:"bell pepper",946:"cardoon",947:"mushroom",948:"Granny Smith",949:"strawberry",950:"orange",951:"lemon",952:"fig",953:"pineapple, ananas",954:"banana",955:"jackfruit, jak, jack",956:"custard apple",957:"pomegranate",958:"hay",959:"carbonara",960:"chocolate sauce, chocolate syrup",961:"dough",962:"meat loaf, meatloaf",963:"pizza, pizza pie",964:"potpie",965:"burrito",966:"red wine",967:"espresso",968:"cup",969:"eggnog",970:"alp",971:"bubble",972:"cliff, drop, drop-off",973:"coral reef",974:"geyser",975:"lakeside, lakeshore",976:"promontory, headland, head, foreland",977:"sandbar, sand bar",978:"seashore, coast, seacoast, sea-coast",979:"valley, vale",980:"volcano",981:"ballplayer, baseball player",982:"groom, bridegroom",983:"scuba diver",984:"rapeseed",985:"daisy",986:"yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",987:"corn",988:"acorn",989:"hip, rose hip, rosehip",990:"buckeye, horse chestnut, conker",991:"coral fungus",992:"agaric",993:"gyromitra",994:"stinkhorn, carrion fungus",995:"earthstar",996:"hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",997:"bolete",998:"ear, spike, capitulum",999:"toilet tissue, toilet paper, bathroom tissue"},u={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},c={"1.00":{.25:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",inputRange:[0,1]},"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1",inputRange:[0,1]}},"2.00":{"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2",inputRange:[0,1]}}};function l(t){return void 0===t&&(t={version:1,alpha:1}),o(this,void 0,void 0,function(){var e,n,r,o,s,u;return a(this,function(a){switch(a.label){case 0:if(null==i)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(n=t.version.toFixed(2),r=t.alpha?t.alpha.toFixed(2):"",o=-1,s=1,null==t.modelUrl){if(!(n in c))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys(c));if(!(r in c[n]))throw new Error("MobileNet constructed with invalid alpha "+t.alpha+". Valid multipliers for this version are: "+Object.keys(c[n])+".");e=c[n][r].inputRange,o=e[0],s=e[1]}return[4,(u=new f(n,r,t.modelUrl,o,s)).load()];case 1:return a.sent(),[2,u]}})})}var f=function(){function t(t,e,n,r,i){void 0===r&&(r=-1),void 0===i&&(i=1),this.version=t,this.alpha=e,this.modelUrl=n,this.inputMin=r,this.inputMax=i,this.inputRange=i-r}return t.prototype.load=function(){return o(this,void 0,void 0,function(){var t,e,n,o,s=this;return a(this,function(a){switch(a.label){case 0:return this.modelUrl?(t=this,[4,Object(r.c)(this.modelUrl)]):[3,2];case 1:return t.model=a.sent(),[3,4];case 2:return e=c[this.version][this.alpha].url,n=this,[4,Object(r.c)(e,{fromTFHub:!0})];case 3:n.model=a.sent(),a.label=4;case 4:return[4,(o=Object(i.tidy)(function(){return s.model.predict(Object(i.zeros)([1,224,224,3]))})).data()];case 5:return a.sent(),o.dispose(),[2]}})})},t.prototype.infer=function(t,e){var n=this;return void 0===e&&(e=!1),Object(i.tidy)(function(){t instanceof i.Tensor||(t=i.browser.fromPixels(t));var r=t.toFloat().mul(n.inputRange).add(n.inputMin),o=r;224===t.shape[0]&&224===t.shape[1]||(o=i.image.resizeBilinear(r,[224,224],!0));var a,s=o.reshape([-1,224,224,3]);if(e){var c=u[n.version];a=n.model.execute(s,c).squeeze([1,2])}else a=n.model.predict(s).slice([0,1],[-1,1e3]);return a})},t.prototype.classify=function(t,e){return void 0===e&&(e=3),o(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:return[4,function(t,e){return o(this,void 0,void 0,function(){var n,r,i,o,u,c,l;return a(this,function(a){switch(a.label){case 0:return[4,(n=t.softmax()).data()];case 1:for(r=a.sent(),n.dispose(),i=[],l=0;l<r.length;l++)i.push({value:r[l],index:l});for(i.sort(function(t,e){return e.value-t.value}),o=new Float32Array(e),u=new Int32Array(e),l=0;l<e;l++)o[l]=i[l].value,u[l]=i[l].index;for(c=[],l=0;l<u.length;l++)c.push({className:s[u[l]],probability:o[l]});return[2,c]}})})}(n=this.infer(t),e)];case 1:return r=i.sent(),n.dispose(),[2,r]}})})},t}()},function(t,e,n){"use strict";var r=n(46),i=n(126);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},function(t,e,n){"use strict";var r=n(64),i=n(26),o=n(98),a=n(280),s=n(279),u=n(152),c=n(484),l=n(184);i(i.S+i.F*!n(273)(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,i,f,d=o(t),h="function"==typeof this?this:Array,p=arguments.length,m=p>1?arguments[1]:void 0,g=void 0!==m,v=0,b=l(d);if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),void 0==b||h==Array&&s(b))for(n=new h(e=u(d.length));e>v;v++)c(n,v,g?m(d[v],v):d[v]);else for(f=b.call(d),n=new h;!(i=f.next()).done;v++)c(n,v,g?a(f,m,[i.value,v],!0):i.value);return n.length=v,n}})},function(t,e,n){n(93),n(485),t.exports=n(19).Array.from},function(t,e,n){n(179)("observable")},function(t,e,n){n(179)("asyncIterator")},function(t,e,n){var r=n(76),i=n(270).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(r(t))}},function(t,e,n){var r=n(99),i=n(218),o=n(123);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,s=n(t),u=o.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},function(t,e,n){"use strict";var r=n(29),i=n(77),o=n(55),a=n(26),s=n(284),u=n(180).KEY,c=n(78),l=n(220),f=n(111),d=n(151),h=n(28),p=n(181),m=n(179),g=n(490),v=n(271),b=n(56),y=n(45),w=n(76),x=n(225),_=n(126),k=n(134),S=n(489),E=n(269),O=n(46),A=n(99),C=E.f,M=O.f,N=S.f,T=r.Symbol,I=r.JSON,D=I&&I.stringify,j=h("_hidden"),R=h("toPrimitive"),F={}.propertyIsEnumerable,P=l("symbol-registry"),z=l("symbols"),L=l("op-symbols"),B=Object.prototype,U="function"==typeof T,W=r.QObject,q=!W||!W.prototype||!W.prototype.findChild,V=o&&c(function(){return 7!=k(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=C(B,e);r&&delete B[e],M(t,e,n),r&&t!==B&&M(B,e,r)}:M,H=function(t){var e=z[t]=k(T.prototype);return e._k=t,e},$=U&&"symbol"==typeof T.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof T},G=function(t,e,n){return t===B&&G(L,e,n),b(t),e=x(e,!0),b(n),i(z,e)?(n.enumerable?(i(t,j)&&t[j][e]&&(t[j][e]=!1),n=k(n,{enumerable:_(0,!1)})):(i(t,j)||M(t,j,_(1,{})),t[j][e]=!0),V(t,e,n)):M(t,e,n)},K=function(t,e){b(t);for(var n,r=g(e=w(e)),i=0,o=r.length;o>i;)G(t,n=r[i++],e[n]);return t},X=function(t){var e=F.call(this,t=x(t,!0));return!(this===B&&i(z,t)&&!i(L,t))&&(!(e||!i(this,t)||!i(z,t)||i(this,j)&&this[j][t])||e)},Y=function(t,e){if(t=w(t),e=x(e,!0),t!==B||!i(z,e)||i(L,e)){var n=C(t,e);return!n||!i(z,e)||i(t,j)&&t[j][e]||(n.enumerable=!0),n}},J=function(t){for(var e,n=N(w(t)),r=[],o=0;n.length>o;)i(z,e=n[o++])||e==j||e==u||r.push(e);return r},Z=function(t){for(var e,n=t===B,r=N(n?L:w(t)),o=[],a=0;r.length>a;)!i(z,e=r[a++])||n&&!i(B,e)||o.push(z[e]);return o};U||(s((T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(n){this===B&&e.call(L,n),i(this,j)&&i(this[j],t)&&(this[j][t]=!1),V(this,t,_(1,n))};return o&&q&&V(B,t,{configurable:!0,set:e}),H(t)}).prototype,"toString",function(){return this._k}),E.f=Y,O.f=G,n(270).f=S.f=J,n(123).f=X,n(218).f=Z,o&&!n(124)&&s(B,"propertyIsEnumerable",X,!0),p.f=function(t){return H(h(t))}),a(a.G+a.W+a.F*!U,{Symbol:T});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Q.length>tt;)h(Q[tt++]);for(var et=A(h.store),nt=0;et.length>nt;)m(et[nt++]);a(a.S+a.F*!U,"Symbol",{for:function(t){return i(P,t+="")?P[t]:P[t]=T(t)},keyFor:function(t){if(!$(t))throw TypeError(t+" is not a symbol!");for(var e in P)if(P[e]===t)return e},useSetter:function(){q=!0},useSimple:function(){q=!1}}),a(a.S+a.F*!U,"Object",{create:function(t,e){return void 0===e?k(t):K(k(t),e)},defineProperty:G,defineProperties:K,getOwnPropertyDescriptor:Y,getOwnPropertyNames:J,getOwnPropertySymbols:Z}),I&&a(a.S+a.F*(!U||c(function(){var t=T();return"[null]"!=D([t])||"{}"!=D({a:t})||"{}"!=D(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(y(e)||void 0!==t)&&!$(t))return v(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!$(e))return e}),r[1]=e,D.apply(I,r)}}),T.prototype[R]||n(68)(T.prototype,R,T.prototype.valueOf),f(T,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){n(491),n(187),n(488),n(487),t.exports=n(19).Symbol},function(t,e,n){t.exports={default:n(492),__esModule:!0}},function(t,e,n){n(93),n(110),t.exports=n(181).f("iterator")},function(t,e,n){t.exports={default:n(494),__esModule:!0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=v(n(17)),i=v(n(52)),o=v(n(36)),a=v(n(12)),s=v(n(11)),u=v(n(9)),c=v(n(10)),l=g(n(2)),f=g(n(483)),d=g(n(482)),h=g(n(480)),p=v(n(20)),m=n(62);function g(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function v(t){return t&&t.__esModule?t:{default:t}}var b={mobilenet:{version:2,alpha:1,topk:3}},y=["mobilenet","darknet","darknet-tiny","doodlenet"],w=function(){function t(e,n,r,i){if((0,u.default)(this,t),this.video=n,this.model=null,this.mapStringToIndex=[],"string"==typeof e)if(y.includes(e))switch(this.modelName=e,this.modelUrl=null,this.modelName){case"mobilenet":this.modelToUse=f,this.version=r.version||b.mobilenet.version,this.alpha=r.alpha||b.mobilenet.alpha,this.topk=r.topk||b.mobilenet.topk;break;case"darknet":this.version="reference",this.modelToUse=d;break;case"darknet-tiny":this.version="tiny",this.modelToUse=d;break;case"doodlenet":this.modelToUse=h;break;default:this.modelToUse=null}else this.modelUrl=e;this.ready=(0,p.default)(this.loadModel(this.modelUrl),i)}return(0,c.default)(t,[{key:"loadModel",value:function(){var t=(0,s.default)(a.default.mark(function t(e){return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=6;break}return t.next=3,this.loadModelFrom(e);case 3:this.model=t.sent,t.next=9;break;case 6:return t.next=8,this.modelToUse.load({version:this.version,alpha:this.alpha});case 8:this.model=t.sent;case 9:return t.abrupt("return",this);case 10:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"loadModelFrom",value:function(){var t=(0,s.default)(a.default.mark(function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return fetch(n).then(function(t){return t.json()}).then(function(t){t.ml5Specs&&(e.mapStringToIndex=t.ml5Specs.mapStringToIndex)}).then(function(){if(0===e.mapStringToIndex.length){var t=n.split("/"),r=t.slice(0,t.length-1).join("/");fetch(r+"/metadata.json").then(function(t){if(!t.ok)throw console.log("Tried to fetch metadata.json, but it seems to be missing."),Error(t.statusText);return t}).then(function(t){return t.json()}).then(function(t){t.labels&&(e.mapStringToIndex=t.labels)}).catch(function(){return console.log("Error when loading metadata.json")})}}),t.next=3,l.loadLayersModel(n);case 3:return this.model=t.sent,t.abrupt("return",this.model);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var t=(0,s.default)(a.default.mark(function t(e,n){var r,s,u,c,f,d,h=this;return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,l.nextFrame();case 4:if(!(e instanceof HTMLVideoElement&&0===e.readyState)){t.next=8;break}return r=e,t.next=8,new o.default(function(t){r.onloadeddata=function(){return t()}});case 8:if(!this.video||0!==this.video.readyState){t.next=11;break}return t.next=11,new o.default(function(t){h.video.onloadeddata=function(){return t()}});case 11:if(s=[224,224],!this.modelUrl){t.next=20;break}return t.next=15,l.nextFrame();case 15:return u=l.tidy(function(){var t=(0,m.imgToTensor)(e,s),n=h.model.predict(t);return(0,i.default)(n.as1D().dataSync())}),t.next=18,u.map(function(t,e){return{label:h.mapStringToIndex.length>0&&h.mapStringToIndex[e]?h.mapStringToIndex[e]:e,confidence:t}}).sort(function(t,e){return e.confidence-t.confidence});case 18:return c=t.sent,t.abrupt("return",c);case 20:return f=(0,m.imgToTensor)(e,s),d=this.model.classify(f,n).then(function(t){return t.map(function(t){return{label:t.className,confidence:t.probability}})}),f.dispose(),t.abrupt("return",d);case 24:case"end":return t.stop()}},t,this)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"classify",value:function(){var t=(0,s.default)(a.default.mark(function t(e){var n,i,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,u=arguments[2];return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.video,i=this.topk,o=void 0,"function"!=typeof e){t.next=8;break}n=this.video,o=e,t.next=27;break;case 8:if("number"!=typeof e){t.next=13;break}n=this.video,i=e,t.next=27;break;case 13:if(!(e instanceof HTMLVideoElement||e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageData)){t.next=17;break}n=e,t.next=27;break;case 17:if("object"!==(void 0===e?"undefined":(0,r.default)(e))||!(e.elt instanceof HTMLVideoElement||e.elt instanceof HTMLImageElement||e.elt instanceof HTMLCanvasElement||e.elt instanceof ImageData)){t.next=21;break}n=e.elt,t.next=27;break;case 21:if(!("object"===(void 0===e?"undefined":(0,r.default)(e))&&e.canvas instanceof HTMLCanvasElement)){t.next=25;break}n=e.canvas,t.next=27;break;case 25:if(this.video instanceof HTMLVideoElement){t.next=27;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 27:return"number"==typeof s?i=s:"function"==typeof s&&(o=s),"function"==typeof u&&(o=u),t.abrupt("return",(0,p.default)(this.classifyInternal(n,i),o));case 30:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"predict",value:function(){var t=(0,s.default)(a.default.mark(function t(e,n,r){return a.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.classify(e,n||null,r));case 1:case"end":return t.stop()}},t,this)}));return function(e,n,r){return t.apply(this,arguments)}}()}]),t}();e.default=function(t,e,n,i){var o=void 0,a={},s=i,u=t;if("string"!=typeof u)throw new Error('Please specify a model to use. E.g: "MobileNet"');-1===u.indexOf("http")&&(u=t.toLowerCase()),e instanceof HTMLVideoElement?o=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&e.elt instanceof HTMLVideoElement?o=e.elt:"object"===(void 0===e?"undefined":(0,r.default)(e))?a=e:"function"==typeof e&&(s=e),"object"===(void 0===n?"undefined":(0,r.default)(n))?a=n:"function"==typeof n&&(s=n);var c=new w(u,o,a,s);return s?c:c.ready}},function(t,e,n){var r=n(26);r(r.S+r.F*!n(55),"Object",{defineProperty:n(46).f})},function(t,e,n){n(497);var r=n(19).Object;t.exports=function(t,e,n){return r.defineProperty(t,e,n)}},function(t,e,n){"use strict";var r=n(26),i=n(183),o=n(276);r(r.S,"Promise",{try:function(t){var e=i.f(this),n=o(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},function(t,e,n){"use strict";var r=n(26),i=n(19),o=n(29),a=n(278),s=n(275);r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return s(e,t()).then(function(){return n})}:t,n?function(n){return s(e,t()).then(function(){throw n})}:t)}})},function(t,e,n){var r=n(29).navigator;t.exports=r&&r.userAgent||""},function(t,e,n){var r=n(29),i=n(277).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(125)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(u&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,d=document.createTextNode("");new o(c).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){"use strict";var r,i,o,a,s=n(124),u=n(29),c=n(64),l=n(133),f=n(26),d=n(45),h=n(127),p=n(185),m=n(109),g=n(278),v=n(277).set,b=n(502)(),y=n(183),w=n(276),x=n(501),_=n(275),k=u.TypeError,S=u.process,E=S&&S.versions,O=E&&E.v8||"",A=u.Promise,C="process"==l(S),M=function(){},N=i=y.f,T=!!function(){try{var t=A.resolve(1),e=(t.constructor={})[n(28)("species")]=function(t){t(M,M)};return(C||"function"==typeof PromiseRejectionEvent)&&t.then(M)instanceof e&&0!==O.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),I=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},D=function(t,e){if(!t._n){t._n=!0;var n=t._c;b(function(){for(var r=t._v,i=1==t._s,o=0,a=function(e){var n,o,a,s=i?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(i||(2==t._h&&F(t),t._h=1),!0===s?n=r:(l&&l.enter(),n=s(r),l&&(l.exit(),a=!0)),n===e.promise?c(k("Promise-chain cycle")):(o=I(n))?o.call(n,u,c):u(n)):c(r)}catch(t){l&&!a&&l.exit(),c(t)}};n.length>o;)a(n[o++]);t._c=[],t._n=!1,e&&!t._h&&j(t)})}},j=function(t){v.call(u,function(){var e,n,r,i=t._v,o=R(t);if(o&&(e=w(function(){C?S.emit("unhandledRejection",i,t):(n=u.onunhandledrejection)?n({promise:t,reason:i}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",i)}),t._h=C||R(t)?2:1),t._a=void 0,o&&e.e)throw e.v})},R=function(t){return 1!==t._h&&0===(t._a||t._c).length},F=function(t){v.call(u,function(){var e;C?S.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},P=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),D(e,!0))},z=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw k("Promise can't be resolved itself");(e=I(t))?b(function(){var r={_w:n,_d:!1};try{e.call(t,c(z,r,1),c(P,r,1))}catch(t){P.call(r,t)}}):(n._v=t,n._s=1,D(n,!1))}catch(t){P.call({_w:n,_d:!1},t)}}};T||(A=function(t){p(this,A,"Promise","_h"),h(t),r.call(this);try{t(c(z,this,1),c(P,this,1))}catch(t){P.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(182)(A.prototype,{then:function(t,e){var n=N(g(this,A));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=C?S.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&D(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r;this.promise=t,this.resolve=c(z,t,1),this.reject=c(P,t,1)},y.f=N=function(t){return t===A||t===a?new o(t):i(t)}),f(f.G+f.W+f.F*!T,{Promise:A}),n(111)(A,"Promise"),n(274)("Promise"),a=n(19).Promise,f(f.S+f.F*!T,"Promise",{reject:function(t){var e=N(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(s||!T),"Promise",{resolve:function(t){return _(s&&this===a?A:this,t)}}),f(f.S+f.F*!(T&&n(273)(function(t){A.all(t).catch(M)})),"Promise",{all:function(t){var e=this,n=N(e),r=n.resolve,i=n.reject,o=w(function(){var n=[],o=0,a=1;m(t,!1,function(t){var s=o++,u=!1;n.push(void 0),a++,e.resolve(t).then(function(t){u||(u=!0,n[s]=t,--a||r(n))},i)}),--a||r(n)});return o.e&&i(o.v),n.promise},race:function(t){var e=this,n=N(e),r=n.reject,i=w(function(){m(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(t,e){t.exports=function(){}},function(t,e,n){"use strict";var r=n(505),i=n(281),o=n(92),a=n(76);t.exports=n(186)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e,n){var r=n(46),i=n(56),o=n(99);t.exports=n(55)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},function(t,e,n){"use strict";var r=n(134),i=n(126),o=n(111),a={};n(68)(a,n(28)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var r=n(222),i=n(223);t.exports=function(t){return function(e,n){var o,a,s=String(i(e)),u=r(n),c=s.length;return u<0||u>=c?t?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):o:t?s.slice(u,u+2):a-56320+(o-55296<<10)+65536}}},function(t,e,n){n(187),n(93),n(110),n(504),n(500),n(499),t.exports=n(19).Promise},function(t,e){!function(e){"use strict";var n,r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"==typeof t,l=e.regeneratorRuntime;if(l)c&&(t.exports=l);else{(l=e.regeneratorRuntime=c?t.exports:{}).wrap=w;var f="suspendedStart",d="suspendedYield",h="executing",p="completed",m={},g={};g[a]=function(){return this};var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==r&&i.call(b,a)&&(g=b);var y=S.prototype=_.prototype=Object.create(g);k.prototype=y.constructor=S,S.constructor=k,S[u]=k.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===k||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(y),t},l.awrap=function(t){return{__await:t}},E(O.prototype),O.prototype[s]=function(){return this},l.AsyncIterator=O,l.async=function(t,e,n,r){var i=new O(w(t,e,n,r));return l.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},E(y),y[u]="Generator",y[a]=function(){return this},y.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=T,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return s.type="throw",s.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function w(t,e,n,r){var i=e&&e.prototype instanceof _?e:_,o=Object.create(i.prototype),a=new N(r||[]);return o._invoke=function(t,e,n){var r=f;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===p){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=A(a,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=x(t,e,n);if("normal"===u.type){if(r=n.done?p:d,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=p,n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function x(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function _(){}function k(){}function S(){}function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function O(t){var e;this._invoke=function(n,r){function o(){return new Promise(function(e,o){!function e(n,r,o,a){var s=x(t[n],t,r);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(c).then(function(t){u.value=t,o(u)},a)}a(s.arg)}(n,r,e,o)})}return e=e?e.then(o,o):o()}}function A(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,A(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=x(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:I}}function I(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},function(t,e,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(511),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=c(n(12)),i=c(n(11)),o=c(n(9)),a=c(n(10)),s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(2)),u=c(n(20));function c(t){return t&&t.__esModule?t:{default:t}}var l=function(){function t(e,n,r,i){(0,o.default)(this,t),this.model=e,this.audioContext=n,this.stream=r,this.frequency=null,this.ready=(0,u.default)(this.loadModel(e),i)}return(0,a.default)(t,[{key:"loadModel",value:function(){var t=(0,i.default)(r.default.mark(function t(e){return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.loadLayersModel(e+"/model.json");case 2:if(this.model=t.sent,!this.audioContext){t.next=8;break}return t.next=6,this.processStream();case 6:t.next=9;break;case 8:throw new Error("Could not access microphone - getUserMedia not available");case 9:return t.abrupt("return",this);case 10:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"processStream",value:function(){var t=(0,i.default)(r.default.mark(function t(){var e,n,i,o,a;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.nextFrame();case 2:for(e=this.audioContext.createMediaStreamSource(this.stream),n=this.audioContext.sampleRate/16e3*1024,i=4;i<n;)i*=2;(o=this.audioContext.createScriptProcessor(i,1,1)).onaudioprocess=this.processMicrophoneBuffer.bind(this),(a=this.audioContext.createGain()).gain.setValueAtTime(0,this.audioContext.currentTime),e.connect(o),o.connect(a),a.connect(this.audioContext.destination),"running"!==this.audioContext.state&&console.warn("User gesture needed to start AudioContext, please click");case 14:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"processMicrophoneBuffer",value:function(){var e=(0,i.default)(r.default.mark(function e(n){var i=this;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.nextFrame();case 2:this.results={},t.resample(n.inputBuffer,function(t){s.tidy(function(){var e=s.add(s.linspace(0,7180,360),s.tensor(1997.379408437619));i.running=!0;var n=s.tensor(t.slice(0,1024)),r=s.sub(n,s.mean(n)),o=s.tensor(s.norm(r).dataSync()/Math.sqrt(1024)),a=s.div(r,o).reshape([1,1024]),u=i.model.predict([a]).reshape([360]),c=u.max().dataSync()[0],l=u.argMax().dataSync()[0];i.results.confidence=c.toFixed(3);var f=Math.max(0,l-4),d=Math.min(360,l+5),h=u.slice([f],[d-f]),p=e.slice([f],[d-f]),m=s.mul(h,p).dataSync().reduce(function(t,e){return t+e},0)/h.dataSync().reduce(function(t,e){return t+e},0),g=10*Math.pow(2,m/1200),v=c>.5?g:null;i.frequency=v})});case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getPitch",value:function(){var t=(0,i.default)(r.default.mark(function t(e){var n;return r.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.ready;case 2:return t.next=4,s.nextFrame();case 4:return n=this.frequency,e&&e(void 0,n),t.abrupt("return",n);case 7:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}],[{key:"resample",value:function(t,e){for(var n=t.sampleRate%16e3!=0,r=t.sampleRate/16e3,i=t.getChannelData(0),o=new Float32Array(1024),a=0;a<1024;a+=1)if(n){var s=Math.floor(a*r),u=s+1,c=a*r-s;o[a]=(1-c)*i[s]+c*i[u]}else o[a]=i[a*r];e(o)}}]),t}();e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"./",e=arguments[1],n=arguments[2],r=arguments[3];return new l(t,e,n,r)}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(189),o=n(43),a=n(136);e.valuesDistribution=function(t,e){return r(this,void 0,void 0,function*(){const n=o.getDrawArea(t),r=yield a.tensorStats(e),s=yield e.data();i.histogram(n,s,{height:150,stats:r})})}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(43),o=n(135);e.showPerClassAccuracy=function(t,e,n){return r(this,void 0,void 0,function*(){const r=i.getDrawArea(t),a=[];for(let t=0;t<e.length;t++){const r=n?n[t]:t.toString(),i=e[t];a.push([r,i.accuracy,i.count])}return o.table(r,{headers:["Class","Accuracy","# Samples"],values:a})})}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(189),o=n(43),a=n(135),s=n(188),u=n(136);function c(t){let e;return e=Array.isArray(t.outputShape[0])?`[${t.outputShape.map(t=>l(t)).join(", ")}]`:l(t.outputShape),{name:t.name,trainable:t.trainable,parameters:t.countParams(),outputShape:e}}function l(t){const e=t.slice();return 0===e.length?"Scalar":(null===e[0]&&(e[0]="batch"),`[${e.join(",")}]`)}e.modelSummary=function(t,e){return r(this,void 0,void 0,function*(){const n=o.getDrawArea(t),r=e.layers.map(c).map(t=>[t.name,t.outputShape,t.parameters,t.trainable]);a.table(n,{headers:["Layer Name","Output Shape","# Of Params","Trainable"],values:r})})},e.layer=function(t,e){return r(this,void 0,void 0,function*(){const n=o.getDrawArea(t),c=yield function(t){return r(this,void 0,void 0,function*(){const e=t.getWeights(),n=t.weights,r=e.map(u.tensorStats),i=yield Promise.all(r),o=e.map(t=>t.shape);return e.map((t,e)=>({name:n[e].name,stats:i[e],shape:l(o[e]),weight:t}))})}(e),f=s.subSurface(n,"layer-weights-info"),d=c.map(t=>[t.name,t.shape,t.stats.min,t.stats.max,t.weight.size,t.stats.numZeros,t.stats.numNans,t.stats.numInfs]);a.table(f,{headers:["Weight Name","Shape","Min","Max","# Params","# Zeros","# NaNs","# Infinity"],values:d});const h=s.subSurface(n,"select-layer"),p=s.subSurface(n,"param-distribution");!function(t,e,n){const r=`<div><button>Show Values Distribution for:</button>${`\n <select>\n ${t.map(t=>`<option value=${t}>${t}</option>`)}\n </select>\n `}</div>`;e.innerHTML=r;const i=e.querySelector("button"),o=e.querySelector("select");i.addEventListener("click",()=>{n(o.selectedOptions[0].label)})}(c.map(t=>t.name),h,t=>r(this,void 0,void 0,function*(){const e=yield c.filter(e=>e.name===t)[0].weight.data();i.histogram(p,e,{height:150,width:460,stats:!1})}))})}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(285),o=n(43),a=n(188);function s(t,e,n,s={}){return r(this,void 0,void 0,function*(){const r=o.getDrawArea(t),l={};for(const t of n)if(/val_/.test(t)){const r=t.replace("val_","");u(l,r);const i=c(e,t,n.indexOf(t));l[r].series.push(t),l[r].values.push(i)}else{const r=c(e,t,n.indexOf(t));u(l,t),l[t].series.push(t),l[t].values.push(r)}const f=Object.keys(l),d=Object.assign({},{xLabel:"Iteration",yLabel:"Value"},s),h=[];for(const t of f){const e=a.subSurface(r,t),n=l[t].series,o=l[t].values;n.every(t=>Boolean(t.match("acc")))&&(d.zoomToFitAccuracy?d.zoomToFit=!0:(d.yAxisDomain=[0,1],delete d.zoomToFit));const s=i.linechart(e,{values:o,series:n},d);h.push(s)}yield Promise.all(h)})}function u(t,e){null==t[e]&&(t[e]={series:[],values:[]})}function c(t,e,n){if(Array.isArray(t)){const r=Array.isArray(t[0])?t[n]:t,i=[];for(let t=0;t<r.length;t++){const n=r[t];i.push({x:t,y:n[e]})}return i}return t.history[e].map((t,e)=>({x:e,y:t}))}function l(t,e,n){return null==t[e]&&(t[e]={}),null==t[e][n]&&(t[e][n]=[]),t[e][n]}e.history=s,e.fitCallbacks=function(t,e,n={}){const i={},u=n.callbacks||["onEpochEnd","onBatchEnd"],c=o.getDrawArea(t),f=Object.assign({},n);delete f.callbacks;const d={};return u.forEach(t=>{d[t]=function(t){return(n,u)=>r(this,void 0,void 0,function*(){/batch/i.test(t)?f.xLabel="Batch":/epoch/i.test(t)&&(f.xLabel="Epoch");const n=[],r=[];for(const o of e)if(null!=u[o]){r.push(o);const e=l(i,t,o);e.push({[o]:u[o]}),n.push(e)}s(a.subSurface(c,t,{title:t}),n,r,f),yield o.nextFrame()})}(t)}),d}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(90)),a=n(43);e.scatterplot=function(t,e,n={}){return r(this,void 0,void 0,function*(){let r=e.values;const i=null==e.series?[]:e.series,u=[];(r=Array.isArray(r[0])?r:[r]).forEach((t,e)=>{const n=null!=i[e]?i[e]:`Series ${e+1}`,r=t.map(t=>Object.assign({},t,{series:n}));u.push(...r)});const c=a.getDrawArea(t),l=Object.assign({},s,n),f={width:l.width||c.clientWidth,height:l.height||c.clientHeight,padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:l.fontSize,titleFontSize:l.fontSize},text:{fontSize:l.fontSize},legend:{labelFontSize:l.fontSize,titleFontSize:l.fontSize}},data:{values:u},mark:{type:"point",clip:!0,tooltip:{content:"data"}},encoding:{x:{field:"x",type:l.xType,title:l.xLabel,scale:l.zoomToFit?{zero:!1}:null!=l.xAxisDomain?{domain:l.xAxisDomain}:void 0},y:{field:"y",type:l.yType,title:l.yLabel,scale:l.zoomToFit?{zero:!1}:null!=l.yAxisDomain?{domain:l.yAxisDomain}:void 0},color:{field:"series",type:"nominal"},shape:{field:"series",type:"nominal"}}};return yield o.default(c,f,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const s={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const a=i(n(2)),s=o(n(90)),u=n(286),c=n(43);e.heatmap=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=Object.assign({},l,n),i=c.getDrawArea(t);let o=e.values;if(r.rowMajor){let t,e;o instanceof a.Tensor?(t=o.shape,e=o.transpose()):(t=[o.length,o[0].length],e=a.tidy(()=>a.tensor2d(o).transpose())),u.assert(2===e.rank,"Input to renderHeatmap must be a 2d array or Tensor2d"),o=yield e.array(),e.dispose();const n=[o.length,o[0].length];u.assert(t[0]===n[1]&&t[1]===n[0],`Unexpected transposed shape. Original ${t} : Transposed ${n}`)}const f=[],{xTickLabels:d,yTickLabels:h}=e;if(o instanceof a.Tensor){u.assert(2===o.rank,"Input to renderHeatmap must be a 2d array or Tensor2d");const t=o.shape;d&&u.assert(t[0]===d.length,`Length of xTickLabels (${d.length}) must match number of rows\n (${t[0]})`),h&&u.assert(t[1]===h.length,`Length of yTickLabels (${h.length}) must match number of columns\n (${t[1]})`);const e=yield o.data(),[n,r]=t;for(let t=0;t<n;t++){const n=d?d[t]:t;for(let i=0;i<r;i++){const o=h?h[i]:i,a=e[t*r+i];f.push({x:n,y:o,value:a})}}}else{d&&u.assert(o.length===d.length,`Number of rows (${o.length}) must match\n number of xTickLabels (${d.length})`);const t=o;for(let e=0;e<t.length;e++){const n=d?d[e]:e;h&&u.assert(o[e].length===h.length,`Number of columns in row ${e} (${o[e].length})\n must match length of yTickLabels (${h.length})`);for(let r=0;r<t[e].length;r++){const i=h?h[r]:r,o=t[e][r];f.push({x:n,y:i,value:o})}}}const p={width:r.width||i.clientWidth,height:r.height||i.clientHeight,padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},text:{fontSize:r.fontSize},legend:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},scale:{bandPaddingInner:0,bandPaddingOuter:0}},data:{values:f},mark:"rect",encoding:{x:{field:"x",type:r.xType,scale:{domain:d},title:r.xLabel},y:{field:"y",type:r.yType,scale:{domain:h},title:r.yLabel},fill:{field:"value",type:"quantitative"}}};let m;switch(r.colorMap){case"blues":m=["#f7fbff","#4292c6"];break;case"greyscale":m=["#000000","#ffffff"];break;case"viridis":default:m="viridis"}if("viridis"!==m&&(p.encoding.fill.scale={range:m}),r.domain){const t=p.encoding.fill;null!=t.scale?t.scale=Object.assign({},t.scale,{domain:r.domain}):t.scale={domain:r.domain}}yield s.default(i,p,{actions:!1,mode:"vega-lite",defaultStyle:!1})})};const l={xLabel:null,yLabel:null,xType:"ordinal",yType:"ordinal",colorMap:"viridis",fontSize:12,domain:null,rowMajor:!1}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(90)),a=n(43);e.confusionMatrix=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=Object.assign({},s,n),i=a.getDrawArea(t),u=[],c=e.values,l=e.tickLabels||[],f=0===l.length;let d=!0;for(let t=0;t<c.length;t++){const e=f?`Class ${t}`:l[t];f&&l.push(e);for(let n=0;n<c[t].length;n++){const i=f?`Class ${n}`:l[n],o=c[t][n];t!==n||r.shadeDiagonal?(u.push({label:e,prediction:i,count:o}),0!==o&&(d=!1)):u.push({label:e,prediction:i,diagCount:o,noFill:!0})}}if(!r.shadeDiagonal&&d)for(const t of u)!0===t.noFill&&(t.noFill=!1,t.count=t.diagCount);const h={width:r.width||i.clientWidth,height:r.height||i.clientHeight,padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},text:{fontSize:r.fontSize},legend:{labelFontSize:r.fontSize,titleFontSize:r.fontSize}},data:{values:u},encoding:{x:{field:"prediction",type:"ordinal",scale:{domain:l}},y:{field:"label",type:"ordinal",scale:{domain:l}}},layer:[{mark:{type:"rect"},encoding:{fill:{condition:{test:'datum["noFill"] == true',value:"white"},field:"count",type:"quantitative",scale:{range:["#f7fbff","#4292c6"]}},tooltip:{condition:{test:'datum["noFill"] == true',field:"diagCount",type:"nominal"},field:"count",type:"nominal"}}}]};return r.showTextOverlay&&h.layer.push({mark:{type:"text",baseline:"middle"},encoding:{text:{condition:{test:'datum["noFill"] == true',field:"diagCount",type:"nominal"},field:"count",type:"nominal"}}}),yield o.default(i,h,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const s={xLabel:null,yLabel:null,xType:"nominal",yType:"nominal",shadeDiagonal:!0,fontSize:12,showTextOverlay:!0,height:400}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(205),i=n(116),o=n(114);e.Tabs=class extends r.Component{render(){const{tabNames:t,activeTab:e,handleClick:n}=this.props,s=t.length>0?t.map(t=>r.h(a,{key:t,id:t,handleClick:n,isActive:t===e},t)):null,u=i.css(Object.assign({overflowX:"scroll",overflowY:"hidden",whiteSpace:"nowrap"},o.tachyons("bb b--light-gray pb3 mt3")));return r.h("div",{className:`${u} visor-tabs`},s)}};class a extends r.Component{render(){const{children:t,isActive:e,handleClick:n,id:a}=this.props,s=i.css(Object.assign({borderBottomColor:e?"#357EDD":"#AAAAAA",borderBottomWidth:"1px",borderBottomStyle:"solid",cursor:"pointer",":hover":{color:"#357EDD"},display:"inline-block"},o.tachyons("b f5 mr3 pa2")));return r.h("a",{className:`${s} tf-tab`,"data-isactive":e,onClick:()=>n(a)},t)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(205),i=n(116),o=n(114);class a extends r.Component{componentDidMount(){const{name:t,tab:e}=this.props;this.props.registerSurface(t,e,this)}componentDidUpdate(){return!1}render(){const{name:t,visible:e,styles:n}=this.props,s=Object.assign({},a.defaultStyles,n),{width:u,height:c}=s;let{maxHeight:l,maxWidth:f}=s;l=c===a.defaultStyles.height?l:c,f=u===a.defaultStyles.width?f:u;const d=i.css({display:e?"block":"none",backgroundColor:"white",marginTop:"10px",marginBottom:"10px",boxShadow:"0 0 6px -3px #777",padding:"10px !important",height:c,width:u,maxHeight:l,maxWidth:f,overflow:"auto"}),h=i.css(Object.assign({backgroundColor:"white",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",marginBottom:"20px"},o.tachyons("fw6 tc"))),p=i.css({boxSizing:"border-box"});return r.h("div",{className:`${d} tf-surface`,ref:t=>this.container=t,"data-visible":e},r.h("div",{className:`${h} tf-label`,ref:t=>this.label=t},t),r.h("div",{className:`${p} tf-draw-area`,ref:t=>this.drawArea=t}))}}a.defaultStyles={maxWidth:"580px",maxHeight:"580px",height:"auto",width:"auto"},e.SurfaceComponent=a},function(t,e,n){var r=n(112),i=n(138),o=n(37),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return o(t)||i(t)||!!(a&&t&&t[a])}},function(t,e,n){var r=n(303),i=n(523);t.exports=function t(e,n,o,a,s){var u=-1,c=e.length;for(o||(o=i),s||(s=[]);++u<c;){var l=e[u];n>0&&o(l)?n>1?t(l,n-1,o,a,s):r(s,l):a||(s[s.length]=l)}return s}},function(t,e,n){var r=n(524);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},function(t,e){var n="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",r="["+n+"]",i="\\d+",o="[a-z\\xdf-\\xf6\\xf8-\\xff]",a="[^\\ud800-\\udfff"+n+i+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",u="[\\ud800-\\udbff][\\udc00-\\udfff]",c="[A-Z\\xc0-\\xd6\\xd8-\\xde]",l="(?:"+o+"|"+a+")",f="(?:"+c+"|"+a+")",d="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",h="[\\ufe0e\\ufe0f]?"+d+"(?:\\u200d(?:"+["[^\\ud800-\\udfff]",s,u].join("|")+")[\\ufe0e\\ufe0f]?"+d+")*",p="(?:"+["[\\u2700-\\u27bf]",s,u].join("|")+")"+h,m=RegExp([c+"?"+o+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[r,c,"$"].join("|")+")",f+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[r,c+l,"$"].join("|")+")",c+"?"+l+"+(?:['’](?:d|ll|m|re|s|t|ve))?",c+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",i,p].join("|"),"g");t.exports=function(t){return t.match(m)||[]}},function(t,e){var n=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;t.exports=function(t){return n.test(t)}},function(t,e){var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;t.exports=function(t){return t.match(n)||[]}},function(t,e,n){var r=n(528),i=n(527),o=n(192),a=n(526);t.exports=function(t,e,n){return t=o(t),void 0===(e=n?void 0:e)?i(t)?a(t):r(t):t.match(e)||[]}},function(t,e){t.exports=function(t){return function(e){return null==t?void 0:t[e]}}},function(t,e,n){var r=n(530)({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"});t.exports=r},function(t,e,n){var r=n(531),i=n(192),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,a=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");t.exports=function(t){return(t=i(t))&&t.replace(o,r).replace(a,"")}},function(t,e,n){var r=n(287),i=n(532),o=n(529),a=RegExp("['’]","g");t.exports=function(t){return function(e){return r(o(i(e).replace(a,"")),t,"")}}},function(t,e,n){var r=n(533)(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()});t.exports=r},function(t,e,n){"use strict";var r=n(312),i=n(311),o=n(288),a=n(534),s=n(525),u=n(289);t.exports=function(t){var e;e="string"==typeof t?t.split(" "):t;var n=i(e,function(t){var e=u[t];return"string"==typeof e&&(e=u[e]),e?function(t,e){var n=u[r.getAtRuleSize(t)];return o(e,function(e,r,i){var o="."+t+"{"+a(i)+":"+r+";}";return"string"==typeof n&&(o=n+"{"+o+"}"),e.push(o),e},[])}(t,e):(console.error(t+" is not in the list of available Tachyons classes"),[])});return s(n)}},function(t,e){t.exports=function(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}},function(t,e,n){"use strict";var r=n(288),i=n(63),o=n(141),a=n(313);t.exports=function t(e,n){return r(e,function(e,r,s){return!0===i(r)?e[s]=t(r,n):e[s]=o(n)?n(a(r)):a(r),e},{})}},function(t,e){t.exports=["html { line-height: 1.15; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }","body { margin: 0; }","article, aside, footer, header, nav, section { display: block; }","h1 { font-size: 2em; margin: .67em 0; }","figcaption, figure, main { display: block; }","figure { margin: 1em 40px; }","hr { box-sizing: content-box; height: 0; overflow: visible; }","pre { font-family: monospace, monospace; font-size: 1em; }","a { background-color: transparent; -webkit-text-decoration-skip: objects; }","abbr[title] { border-bottom: none; text-decoration: underline; text-decoration: underline dotted; }","b, strong { font-weight: inherit; }","b, strong { font-weight: bolder; }","code, kbd, samp { font-family: monospace, monospace; font-size: 1em; }","dfn { font-style: italic; }","mark { background-color: #ff0; color: #000; }","small { font-size: 80%; }","sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }","sub { bottom: -0.25em; }","sup { top: -0.5em; }","audio, video { display: inline-block; }","audio:not([controls]) { display: none; height: 0; }","img { border-style: none; }","svg:not(:root) { overflow: hidden; }","button, input, optgroup, select, textarea { font-family: sans-serif; font-size: 100%; line-height: 1.15; margin: 0; }","button, input { overflow: visible; }","button, select { text-transform: none; }",'button, html [type="button"], [type="reset"], [type="submit"] { -webkit-appearance: button; }','button::-moz-focus-inner, [type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { border-style: none; padding: 0; }','button:-moz-focusring, [type="button"]:-moz-focusring,[type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring { outline: 1px dotted ButtonText; }',"fieldset { padding: .35em .75em .625em; }","legend { box-sizing: border-box; color: inherit; display: table; max-width: 100%; padding: 0; white-space: normal; }","progress { display: inline-block; vertical-align: baseline; }","textarea { overflow: auto; }",'[type="checkbox"], [type="radio"] { box-sizing: border-box; padding: 0; }','[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button { height: auto; }','[type="search"] { -webkit-appearance: textfield; outline-offset: -2px; }','[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }',"::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }","details, menu { display: block; }","summary { display: list-item; }","canvas { display: inline-block; }","template { display: none; }","[hidden] { display: none; }",'html, body, div, article, section, main, footer, header, form, fieldset, legend,pre, code, a, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, textarea, table,td, th, tr, input[type="email"], input[type="number"], input[type="password"],input[type="tel"], input[type="text"], input[type="url"], .border-box { box-sizing: border-box; }',"img { max-width: 100%; }","code, .code { font-family: Consolas, monaco, monospace; }"]},function(t,e,n){"use strict";var r=n(538);t.exports=function(t){r.forEach(function(e){t.insertRule(e)})}},function(t,e,n){var r=n(113),i=n(94),o=n(198),a=n(63);t.exports=function(t,e,n){if(!a(n))return!1;var s=typeof e;return!!("number"==s?i(n)&&o(e,n.length):"string"==s&&e in n)&&r(n[e],t)}},function(t,e){var n=Date.now;t.exports=function(t){var e=0,r=0;return function(){var i=n(),o=16-(i-r);if(r=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e,n){var r=n(542),i=n(293),o=n(191),a=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:o;t.exports=a},function(t,e,n){var r=n(543),i=n(541)(r);t.exports=i},function(t,e){t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},function(t,e,n){var r=n(545),i=Math.max;t.exports=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=i(o.length-e,0),u=Array(s);++a<s;)u[a]=o[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=o[a];return c[e]=n(u),r(t,this,c)}}},function(t,e,n){var r=n(191),i=n(546),o=n(544);t.exports=function(t,e){return o(i(t,e,r),t+"")}},function(t,e,n){var r=n(547),i=n(540);t.exports=function(t){return r(function(e,n){var r=-1,o=n.length,a=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(o--,a):void 0,s&&i(n[0],n[1],s)&&(a=o<3?void 0:a,o=1),e=Object(e);++r<o;){var u=n[r];u&&t(e,u,r,a)}return e})}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},function(t,e,n){var r=n(63),i=n(195),o=n(549),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=i(t),n=[];for(var s in t)("constructor"!=s||!e&&a.call(t,s))&&n.push(s);return n}},function(t,e,n){var r=n(190),i=n(113),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var a=t[e];o.call(t,e)&&i(a,n)&&(void 0!==n||e in t)||r(t,e,n)}},function(t,e,n){var r=n(551),i=n(190);t.exports=function(t,e,n,o){var a=!n;n||(n={});for(var s=-1,u=e.length;++s<u;){var c=e[s],l=o?o(n[c],t[c],c,n,t):void 0;void 0===l&&(l=t[c]),a?i(n,c,l):r(n,c,l)}return n}},function(t,e,n){var r=n(552),i=n(290);t.exports=function(t){return r(t,i(t))}},function(t,e,n){var r=n(95),i=n(292),o=n(73),a=Function.prototype,s=Object.prototype,u=a.toString,c=s.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||"[object Object]"!=r(t))return!1;var e=i(t);if(null===e)return!0;var n=c.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},function(t,e,n){var r=n(94),i=n(73);t.exports=function(t){return i(t)&&r(t)}},function(t,e,n){var r=n(63),i=Object.create,o=function(){function t(){}return function(e){if(!r(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=o},function(t,e,n){var r=n(556),i=n(292),o=n(195);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:r(i(t))}},function(t,e){t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},function(t,e,n){var r=n(304);t.exports=function(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}},function(t,e,n){var r=n(559);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},function(t,e,n){(function(t){var r=n(53),i="object"==typeof e&&e&&!e.nodeType&&e,o=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=o&&o.exports===i?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=s?s(n):new t.constructor(n);return t.copy(r),r}}).call(this,n(146)(t))},function(t,e,n){var r=n(294),i=n(561),o=n(560),a=n(558),s=n(557),u=n(138),c=n(37),l=n(555),f=n(199),d=n(141),h=n(63),p=n(554),m=n(197),g=n(291),v=n(553);t.exports=function(t,e,n,b,y,w,x){var _=g(t,n),k=g(e,n),S=x.get(k);if(S)r(t,n,S);else{var E=w?w(_,k,n+"",t,e,x):void 0,O=void 0===E;if(O){var A=c(k),C=!A&&f(k),M=!A&&!C&&m(k);E=k,A||C||M?c(_)?E=_:l(_)?E=a(_):C?(O=!1,E=i(k,!0)):M?(O=!1,E=o(k,!0)):E=[]:p(k)||u(k)?(E=_,u(_)?E=v(_):h(_)&&!d(_)||(E=s(k))):O=!1}O&&(x.set(k,E),y(E,k,b,w,x),x.delete(k)),r(t,n,E)}}},function(t,e,n){var r=n(203),i=n(294),o=n(295),a=n(562),s=n(63),u=n(290),c=n(291);t.exports=function t(e,n,l,f,d){e!==n&&o(n,function(o,u){if(d||(d=new r),s(o))a(e,n,u,l,t,f,d);else{var h=f?f(c(e,u),o,u+"",e,n,d):void 0;void 0===h&&(h=o),i(e,u,h)}},u)}},function(t,e,n){var r=n(563),i=n(548)(function(t,e,n){r(t,e,n)});t.exports=i},function(t,e,n){var r=n(94);t.exports=function(t,e){return function(n,i){if(null==n)return n;if(!r(n))return t(n,i);for(var o=n.length,a=e?o:-1,s=Object(n);(e?a--:++a<o)&&!1!==i(s[a],a,s););return n}}},function(t,e){t.exports=function(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}},function(t,e,n){var r=n(295),i=n(200);t.exports=function(t,e){return t&&r(t,e,i)}},function(t,e,n){var r=n(296),i=n(94);t.exports=function(t,e){var n=-1,o=i(t)?Array(t.length):[];return r(t,function(t,r,i){o[++n]=e(t,r,i)}),o}},function(t,e,n){var r=n(298);t.exports=function(t){return function(e){return r(e,t)}}},function(t,e){t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},function(t,e,n){var r=n(570),i=n(569),o=n(194),a=n(137);t.exports=function(t){return o(t)?r(a(t)):i(t)}},function(t,e,n){var r=n(297),i=n(138),o=n(37),a=n(198),s=n(196),u=n(137);t.exports=function(t,e,n){for(var c=-1,l=(e=r(e,t)).length,f=!1;++c<l;){var d=u(e[c]);if(!(f=null!=t&&n(t,d)))break;t=t[d]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&s(l)&&a(d,l)&&(o(t)||i(t))}},function(t,e){t.exports=function(t,e){return null!=t&&e in Object(t)}},function(t,e,n){var r=n(573),i=n(572);t.exports=function(t,e){return null!=t&&i(t,e,r)}},function(t,e,n){var r=n(112),i=n(310),o=n(37),a=n(193),s=r?r.prototype:void 0,u=s?s.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(o(e))return i(e,t)+"";if(a(e))return u?u.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}},function(t,e,n){var r=n(201),i="Expected a function";function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(o.Cache||r),n}o.Cache=r,t.exports=o},function(t,e,n){var r=n(576);t.exports=function(t){var e=r(t,function(t){return 500===n.size&&n.clear(),t}),n=e.cache;return e}},function(t,e,n){var r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=n(577)(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(r,function(t,n,r,o){e.push(r?o.replace(i,"$1"):n||t)}),e});t.exports=o},function(t,e,n){var r=n(298);t.exports=function(t,e,n){var i=null==t?void 0:r(t,e);return void 0===i?n:i}},function(t,e,n){var r=n(306),i=n(579),o=n(574),a=n(194),s=n(300),u=n(299),c=n(137);t.exports=function(t,e){return a(t)&&s(e)?u(c(t),e):function(n){var a=i(n,t);return void 0===a&&a===e?o(n,t):r(e,a,3)}}},function(t,e,n){var r=n(300),i=n(200);t.exports=function(t){for(var e=i(t),n=e.length;n--;){var o=e[n],a=t[o];e[n]=[o,a,r(a)]}return e}},function(t,e,n){var r=n(74)(n(53),"WeakMap");t.exports=r},function(t,e,n){var r=n(74)(n(53),"Set");t.exports=r},function(t,e,n){var r=n(74)(n(53),"Promise");t.exports=r},function(t,e,n){var r=n(74)(n(53),"DataView");t.exports=r},function(t,e,n){var r=n(585),i=n(202),o=n(584),a=n(583),s=n(582),u=n(95),c=n(307),l=c(r),f=c(i),d=c(o),h=c(a),p=c(s),m=u;(r&&"[object DataView]"!=m(new r(new ArrayBuffer(1)))||i&&"[object Map]"!=m(new i)||o&&"[object Promise]"!=m(o.resolve())||a&&"[object Set]"!=m(new a)||s&&"[object WeakMap]"!=m(new s))&&(m=function(t){var e=u(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case d:return"[object Promise]";case h:return"[object Set]";case p:return"[object WeakMap]"}return e}),t.exports=m},function(t,e,n){var r=n(301)(Object.keys,Object);t.exports=r},function(t,e,n){var r=n(195),i=n(587),o=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return i(t);var e=[];for(var n in Object(t))o.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e,n){(function(t){var r=n(308),i="object"==typeof e&&e&&!e.nodeType&&e,o=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=o&&o.exports===i&&r.process,s=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s}).call(this,n(146)(t))},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){var r=n(95),i=n(196),o=n(73),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!a[r(t)]}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(95),i=n(73);t.exports=function(t){return i(t)&&"[object Arguments]"==r(t)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},function(t,e){t.exports=function(){return[]}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}},function(t,e,n){var r=n(596),i=n(595),o=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(t){return null==t?[]:(t=Object(t),r(a(t),function(e){return o.call(t,e)}))}:i;t.exports=s},function(t,e,n){var r=n(303),i=n(37);t.exports=function(t,e,n){var o=e(t);return i(t)?o:r(o,n(t))}},function(t,e,n){var r=n(598),i=n(597),o=n(200);t.exports=function(t){return r(t,o,i)}},function(t,e,n){var r=n(599),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,o,a,s){var u=1&n,c=r(t),l=c.length;if(l!=r(e).length&&!u)return!1;for(var f=l;f--;){var d=c[f];if(!(u?d in e:i.call(e,d)))return!1}var h=s.get(t);if(h&&s.get(e))return h==e;var p=!0;s.set(t,e),s.set(e,t);for(var m=u;++f<l;){var g=t[d=c[f]],v=e[d];if(o)var b=u?o(v,g,d,e,t,s):o(g,v,d,t,e,s);if(!(void 0===b?g===v||a(g,v,n,o,s):b)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){var y=t.constructor,w=e.constructor;y!=w&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w)&&(p=!1)}return s.delete(t),s.delete(e),p}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}},function(t,e,n){var r=n(112),i=n(304),o=n(113),a=n(305),s=n(602),u=n(601),c=r?r.prototype:void 0,l=c?c.valueOf:void 0;t.exports=function(t,e,n,r,c,f,d){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!f(new i(t),new i(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var h=s;case"[object Set]":var p=1&r;if(h||(h=u),t.size!=e.size&&!p)return!1;var m=d.get(t);if(m)return m==e;r|=2,d.set(t,e);var g=a(h(t),h(e),r,c,f,d);return d.delete(t),g;case"[object Symbol]":if(l)return l.call(t)==l.call(e)}return!1}},function(t,e){t.exports=function(t,e){return t.has(e)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},function(t,e,n){var r=n(201),i=n(607),o=n(606);function a(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r;++e<n;)this.add(t[e])}a.prototype.add=a.prototype.push=i,a.prototype.has=o,t.exports=a},function(t,e,n){var r=n(203),i=n(305),o=n(603),a=n(600),s=n(586),u=n(37),c=n(199),l=n(197),f="[object Arguments]",d="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,m,g,v){var b=u(t),y=u(e),w=b?d:s(t),x=y?d:s(e),_=(w=w==f?h:w)==h,k=(x=x==f?h:x)==h,S=w==x;if(S&&c(t)){if(!c(e))return!1;b=!0,_=!1}if(S&&!_)return v||(v=new r),b||l(t)?i(t,e,n,m,g,v):o(t,e,w,n,m,g,v);if(!(1&n)){var E=_&&p.call(t,"__wrapped__"),O=k&&p.call(e,"__wrapped__");if(E||O){var A=E?t.value():t,C=O?e.value():e;return v||(v=new r),g(A,C,n,m,v)}}return!!S&&(v||(v=new r),a(t,e,n,m,g,v))}},function(t,e,n){var r=n(139);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},function(t,e,n){var r=n(139);t.exports=function(t){return r(this,t).has(t)}},function(t,e,n){var r=n(139);t.exports=function(t){return r(this,t).get(t)}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var r=n(139);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e,n){var r=n(140);t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e,n){var r=n(140),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},function(t,e,n){var r=n(140),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(e,t)?e[t]:void 0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var r=n(140);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(t,e,n){var r=n(619),i=n(618),o=n(617),a=n(616),s=n(615);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(620),i=n(143),o=n(202);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var r=n(53)["__core-js_shared__"];t.exports=r},function(t,e,n){var r=n(623),i=function(){var t=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=function(t){return!!i&&i in t}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r=n(112),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(t){}var i=a.call(t);return r&&(e?t[s]=n:delete t[s]),i}},function(t,e,n){var r=n(141),i=n(624),o=n(63),a=n(307),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,d=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?d:s).test(a(t))}},function(t,e,n){var r=n(143),i=n(202),o=n(201);t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!i||a.length<199)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new o(a)}return n.set(t,e),this.size=n.size,this}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e,n){var r=n(143);t.exports=function(){this.__data__=new r,this.size=0}},function(t,e,n){var r=n(142);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},function(t,e,n){var r=n(142);t.exports=function(t){return r(this.__data__,t)>-1}},function(t,e,n){var r=n(142);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},function(t,e,n){var r=n(142),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0||(n==e.length-1?e.pop():i.call(e,n,1),--this.size,0))}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var r=n(203),i=n(306);t.exports=function(t,e,n,o){var a=n.length,s=a,u=!o;if(null==t)return!s;for(t=Object(t);a--;){var c=n[a];if(u&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var l=(c=n[a])[0],f=t[l],d=c[1];if(u&&c[2]){if(void 0===f&&!(l in t))return!1}else{var h=new r;if(o)var p=o(f,d,l,t,e,h);if(!(void 0===p?i(d,f,3,o,h):p))return!1}}return!0}},function(t,e,n){var r=n(638),i=n(581),o=n(299);t.exports=function(t){var e=i(t);return 1==e.length&&e[0][2]?o(e[0][0],e[0][1]):function(n){return n===t||r(n,t,e)}}},function(t,e,n){"use strict";function r(t,e){return t.charCodeAt(e++)+(t.charCodeAt(e++)<<8)+(t.charCodeAt(e++)<<16)+(t.charCodeAt(e)<<24)}function i(t,e){return t.charCodeAt(e++)+(t.charCodeAt(e++)<<8)}function o(t,e){return(65535&(t|=0))*(e|=0)+(((t>>>16)*e&65535)<<16)|0}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){for(var n=1540483477,a=e^t.length,s=t.length,u=0;s>=4;){var c=r(t,u);c=o(c,n),c=o(c^=c>>>24,n),a=o(a,n),a^=c,u+=4,s-=4}switch(s){case 3:a^=i(t,u),a=o(a^=t.charCodeAt(u+2)<<16,n);break;case 2:a=o(a^=i(t,u),n);break;case 1:a=o(a^=t.charCodeAt(u),n)}return a=o(a^=a>>>13,n),(a^=a>>>15)>>>0}},function(t,e,n){"use strict";n.r(e);var r=/[A-Z]/g,i=/^ms-/,o={};function a(t){return"-"+t.toLowerCase()}e.default=function(t){if(o.hasOwnProperty(t))return o[t];var e=t.replace(r,a);return o[t]=i.test(e)?"-"+e:e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return(0,r.default)(t)};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(641));t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,a){if("string"==typeof e&&s.hasOwnProperty(t)){var c=function(t,e){if((0,i.default)(t))return t;for(var n=t.split(/,(?![^()]*(?:\([^()]*\))?\))/g),o=0,a=n.length;o<a;++o){var s=n[o],c=[s];for(var l in e){var f=(0,r.default)(l);if(s.indexOf(f)>-1&&"order"!==f)for(var d=e[l],h=0,p=d.length;h<p;++h)c.unshift(s.replace(f,u[d[h]]+f))}n[o]=c.join(",")}return n.join(",")}(e,a),l=c.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-moz-|-ms-/.test(t)}).join(",");if(t.indexOf("Webkit")>-1)return l;var f=c.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-webkit-|-ms-/.test(t)}).join(",");return t.indexOf("Moz")>-1?f:(n["Webkit"+(0,o.default)(t)]=l,n["Moz"+(0,o.default)(t)]=f,c)}};var r=a(n(642)),i=a(n(115)),o=a(n(314));function a(t){return t&&t.__esModule?t:{default:t}}var s={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},u={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(i.hasOwnProperty(t)&&o.hasOwnProperty(e))return r.map(function(t){return t+e})};var r=["-webkit-","-moz-",""],i={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},o={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("position"===t&&"sticky"===e)return["-webkit-sticky","sticky"]},t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("string"==typeof e&&!(0,r.default)(e)&&e.indexOf("image-set(")>-1)return i.map(function(t){return e.replace(/image-set\(/g,t+"image-set(")})};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(115)),i=["-webkit-",""];t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("string"==typeof e&&!(0,r.default)(e)&&o.test(e))return i.map(function(t){return t+e})};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(115)),i=["-webkit-","-moz-",""],o=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){"flexDirection"===t&&"string"==typeof e&&(e.indexOf("column")>-1?n.WebkitBoxOrient="vertical":n.WebkitBoxOrient="horizontal",e.indexOf("reverse")>-1?n.WebkitBoxDirection="reverse":n.WebkitBoxDirection="normal"),i.hasOwnProperty(t)&&(n[i[t]]=r[e]||e)};var r={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("display"===t&&r.hasOwnProperty(e))return r[e]};var r={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("string"==typeof e&&!(0,r.default)(e)&&e.indexOf("filter(")>-1)return i.map(function(t){return e.replace(/filter\(/g,t+"filter(")})};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(115)),i=["-webkit-",""];t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("string"==typeof e&&!(0,r.default)(e)&&e.indexOf("cross-fade(")>-1)return i.map(function(t){return e.replace(/cross-fade\(/g,t+"cross-fade(")})};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(115)),i=["-webkit-",""];t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if("cursor"===t&&i.hasOwnProperty(e))return r.map(function(t){return t+e})};var r=["-webkit-","-moz-",""],i={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,r,i){for(var o=0,a=t.length;o<a;++o){var s=t[o](e,n,r,i);if(s)return s}},t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){if(t.hasOwnProperty(e))for(var i=t[e],o=0,a=i.length;o<a;++o)n[i[o]+(0,r.default)(e)]=n[e]};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(314));t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=["Webkit"],i=["Moz"],o=["ms"],a=["Webkit","Moz"],s=["Webkit","ms"],u=["Webkit","Moz","ms"];e.default={plugins:[],prefixMap:{appearance:a,userSelect:u,textEmphasisPosition:r,textEmphasis:r,textEmphasisStyle:r,textEmphasisColor:r,boxDecorationBreak:r,clipPath:r,maskImage:r,maskMode:r,maskRepeat:r,maskPosition:r,maskClip:r,maskOrigin:r,maskSize:r,maskComposite:r,mask:r,maskBorderSource:r,maskBorderMode:r,maskBorderSlice:r,maskBorderWidth:r,maskBorderOutset:r,maskBorderRepeat:r,maskBorder:r,maskType:r,textDecorationStyle:r,textDecorationSkip:r,textDecorationLine:r,textDecorationColor:r,filter:r,fontFeatureSettings:r,breakAfter:u,breakBefore:u,breakInside:u,columnCount:a,columnFill:a,columnGap:a,columnRule:a,columnRuleColor:a,columnRuleStyle:a,columnRuleWidth:a,columns:a,columnSpan:a,columnWidth:a,writingMode:s,flex:r,flexBasis:r,flexDirection:r,flexGrow:r,flexFlow:r,flexShrink:r,flexWrap:r,alignContent:r,alignItems:r,alignSelf:r,justifyContent:r,order:r,transform:r,transformOrigin:r,transformOriginX:r,transformOriginY:r,backfaceVisibility:r,perspective:r,perspectiveOrigin:r,transformStyle:r,transformOriginZ:r,animation:r,animationDelay:r,animationDirection:r,animationFillMode:r,animationDuration:r,animationIterationCount:r,animationName:r,animationPlayState:r,animationTimingFunction:r,backdropFilter:r,fontKerning:r,scrollSnapType:s,scrollSnapPointsX:s,scrollSnapPointsY:s,scrollSnapDestination:s,scrollSnapCoordinate:s,shapeImageThreshold:r,shapeImageMargin:r,shapeImageOutside:r,hyphens:u,flowInto:s,flowFrom:s,regionFragment:s,textAlignLast:i,tabSize:i,wrapFlow:o,wrapThrough:o,wrapMargin:o,gridTemplateColumns:o,gridTemplateRows:o,gridTemplateAreas:o,gridTemplate:o,gridAutoColumns:o,gridAutoRows:o,gridAutoFlow:o,grid:o,gridRowStart:o,gridColumnStart:o,gridRowEnd:o,gridRow:o,gridColumn:o,gridColumnEnd:o,gridColumnGap:o,gridRowGap:o,gridArea:o,gridGap:o,textSizeAdjust:s,borderImage:r,borderImageOutset:r,borderImageRepeat:r,borderImageSlice:r,borderImageSource:r,borderImageWidth:r,transitionDelay:r,transitionDuration:r,transitionProperty:r,transitionTimingFunction:r}},t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){for(var e in t){var n=t[e],r=(0,o.default)(v,e,n,t,b);r&&(t[e]=r),(0,i.default)(b,e,t)}return t};var r=g(n(655)),i=g(n(654)),o=g(n(653)),a=g(n(652)),s=g(n(651)),u=g(n(650)),c=g(n(649)),l=g(n(648)),f=g(n(647)),d=g(n(646)),h=g(n(645)),p=g(n(644)),m=g(n(643));function g(t){return t&&t.__esModule?t:{default:t}}var v=[s.default,a.default,u.default,l.default,f.default,d.default,h.default,p.default,m.default,c.default],b=r.default.prefixMap},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.PluginSet=u,e.fallbacks=function(t){if(Object.keys(t.style).map(function(e){return Array.isArray(t.style[e])}).indexOf(!0)>=0){var e=t.style,n=Object.keys(e).reduce(function(t,n){return t[n]=Array.isArray(e[n])?e[n].join("; "+(0,o.processStyleName)(n)+": "):e[n],t},{});return(0,i.default)({},t,{style:n})}return t},e.contentWrap=function(t){if(t.style.content){var e=t.style.content;return c.indexOf(e)>=0?t:/^(attr|calc|counters?|url)\(/.test(e)?t:e.charAt(0)!==e.charAt(e.length-1)||'"'!==e.charAt(0)&&"'"!==e.charAt(0)?r({},t,{style:r({},t.style,{content:'"'+e+'"'})}):t}return t},e.prefixes=function(t){return(0,i.default)({},t,{style:(0,a.default)(r({},t.style))})};var i=s(n(204)),o=n(316),a=s(n(656));function s(t){return t&&t.__esModule?t:{default:t}}function u(t){this.fns=t||[]}(0,i.default)(u.prototype,{add:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];n.forEach(function(e){t.fns.indexOf(e)>=0||(t.fns=[e].concat(t.fns))})},remove:function(t){this.fns=this.fns.filter(function(e){return e!==t})},clear:function(){this.fns=[]},transform:function(t){return this.fns.reduce(function(t,e){return e(t)},t)}});var c=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function i(t){return Array.isArray(t)?function(t){var e=!1,n=[];return t.forEach(function(t){var r=i(t);null!==r&&r===t||(e=!0),null!==r&&n.push(r)}),0==n.length?null:e?n:t}(t):function(t){if(function(t){return null===t||void 0===t||!1===t||"object"===(void 0===t?"undefined":r(t))&&0===Object.keys(t).length}(t))return null;if("object"!==(void 0===t?"undefined":r(t)))return t;for(var e={},n=Object.keys(t),o=!1,a=0;a<n.length;a++){var s=t[n[a]],u=i(s);null!==u&&u===s||(o=!0),null!==u&&(e[n[a]]=u)}return 0===Object.keys(e).length?null:o?e:t}(t)}e.default=i},function(t,e,n){"use strict";t.exports=function(t){var e={};return function(n){return e.hasOwnProperty(n)||(e[n]=t.call(this,n)),e[n]}}},function(t,e,n){"use strict";var r=/([A-Z])/g;t.exports=function(t){return t.replace(r,"-$1").toLowerCase()}},function(t,e,n){"use strict";var r=n(660),i=/^ms-/;t.exports=function(t){return r(t).replace(i,"-ms-")}},function(t,e,n){"use strict";function r(t){return function(){return t}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(t){return t},t.exports=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowStart:!0,gridRowEnd:!0,gridColumn:!0,gridColumnStart:!0,gridColumnEnd:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},i=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(t){i.forEach(function(e){r[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=r[t]})});var o={isUnitlessNumber:r,shorthandPropertyExpansions:{background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}}};e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(n(663));function i(t){return t&&t.__esModule?t:{default:t}}i(n(315));var o=r.default.isUnitlessNumber;e.default=function(t,e,n){return null==e||"boolean"==typeof e||""===e?"":isNaN(e)||0===e||o.hasOwnProperty(t)&&o[t]?""+e:("string"==typeof e&&(e=e.trim()),e+"px")}},function(t,e,n){"use strict";var r=/-(.)/g;t.exports=function(t){return t.replace(r,function(t,e){return e.toUpperCase()})}},function(t,e,n){"use strict";var r=n(665),i=/^-ms-/;t.exports=function(t){return r(t.replace(i,"ms-"))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StyleSheet=f;var r=function(t){return t&&t.__esModule?t:{default:t}}(n(204));function i(t){return t[t.length-1]}function o(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}var a="undefined"!=typeof window,s=!1,u=!1,c=function(){if(a){var t=document.createElement("div");return t.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===t.getElementsByTagName("i").length}}();function l(){var t=document.createElement("style");return t.type="text/css",t.setAttribute("data-glamor",""),t.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(t),t}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.speedy,n=void 0===e?!s&&!u:e,r=t.maxLength,i=void 0===r?a&&c?4e3:65e3:r;this.isSpeedy=n,this.sheet=void 0,this.tags=[],this.maxLength=i,this.ctr=0}(0,r.default)(f.prototype,{getSheet:function(){return o(i(this.tags))},inject:function(){var t=this;if(this.injected)throw new Error("already injected stylesheet!");a?this.tags[0]=l():this.sheet={cssRules:[],insertRule:function(e){t.sheet.cssRules.push({cssText:e})}},this.injected=!0},speedy:function(t){if(0!==this.ctr)throw new Error("cannot change speedy mode after inserting any rule to sheet. Either call speedy("+t+") earlier in your app, or call flush() before speedy("+t+")");this.isSpeedy=!!t},_insert:function(t){try{var e=this.getSheet();e.insertRule(t,-1!==t.indexOf("@import")?0:e.cssRules.length)}catch(e){s&&console.warn("whoops, illegal rule inserted",t)}},insert:function(t){if(a)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(t);else if(-1!==t.indexOf("@import")){var e=i(this.tags);e.insertBefore(document.createTextNode(t),e.firstChild)}else i(this.tags).appendChild(document.createTextNode(t));else this.sheet.insertRule(t,-1!==t.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,a&&this.ctr%this.maxLength==0&&this.tags.push(l()),this.ctr-1},delete:function(t){return this.replace(t,"")},flush:function(){a?(this.tags.forEach(function(t){return t.parentNode.removeChild(t)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},rules:function(){if(!a)return this.sheet.cssRules;var t=[];return this.tags.forEach(function(e){return t.splice.apply(t,[t.length,0].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(Array.from(o(e).cssRules))))}),t}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(205),i=n(116),o=n(114),a=n(522),s=n(521);class u extends r.Component{static render(t,e,n){return r.render(r.h(u,Object.assign({},n)),t,e)}constructor(t){super(t),this.surfaces=new Map;const e=null==t.startOpen||t.startOpen;this.state={isOpen:e,isFullscreen:!1,activeTab:null,tabs:new Set},this.keyHandler=this.keyHandler.bind(this)}close(){this.setState({isOpen:!1})}open(){this.setState({isOpen:!0})}toggle(){this.setState({isOpen:!this.state.isOpen})}toggleFullScreen(){this.setState({isFullscreen:!this.state.isFullscreen})}isOpen(){return this.state.isOpen}isFullscreen(){return this.state.isFullscreen}getSurface(t,e){const n=this.surfaceId(t,e);let r;if(!this.surfaces.has(n))throw Error(`Surface not found with id: ${n}`);return{container:(r=this.surfaces.get(n)).container,label:r.label,drawArea:r.drawArea}}bindKeys(){document.addEventListener("keydown",this.keyHandler,!1)}unbindKeys(){document.removeEventListener("keydown",this.keyHandler)}surfaceId(t,e){return t+e}setTabs(t){const e=t.map(t=>t.tab),n=this.state.tabs;let r;for(const t of e)n.has(t)||(n.add(t),r=t);null!=r&&this.setState({tabs:n,activeTab:r})}getTabs(){return this.state.tabs}registerSurface(t,e,n){const r=this.surfaceId(t,e);this.surfaces.set(r,n)}keyHandler(t){192===t.keyCode&&(t.shiftKey?this.toggleFullScreen():this.toggle())}setActiveTab(t){this.setState({activeTab:t})}componentDidMount(){this.bindKeys()}componentWillMount(){this.setTabs(this.props.surfaceList)}componentWillReceiveProps(t){this.setTabs(t.surfaceList)}render(){const{isOpen:t,isFullscreen:e,activeTab:n}=this.state,{surfaceList:o}=this.props,u=Array.from(this.getTabs().values()),l=e?"90vw":"550px",f=i.css({width:l,height:"100%",backgroundColor:"#fafafa",boxSizing:"border-box",padding:"10px",position:"fixed",top:"0px",transition:"right 0.5s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.5s cubic-bezier(0.645, 0.045, 0.355, 1)",boxShadow:"0 2px 5px rgba(0, 0, 0, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24)",overflow:"auto",fontFamily:"sans-serif",fontSize:"14px",zIndex:1e3}),d=i.css({right:"0"}),h=i.css({right:`calc(-${l} - 10px)`}),p=t?d:h,m=i.css({});return r.h("div",{className:`${f} ${p} visor`,"data-isopen":t,"data-isfullscreen":e},r.h(c,{fullScreenHandler:this.toggleFullScreen.bind(this),closeHandler:this.close.bind(this),isFullScreen:e}),r.h(s.Tabs,{tabNames:u,activeTab:n,handleClick:this.setActiveTab.bind(this)}),r.h("div",{className:`${m} visor-surfaces`},o.map(t=>r.h(a.SurfaceComponent,{key:t.name+t.tab,name:t.name,tab:t.tab,styles:t.styles,registerSurface:this.registerSurface.bind(this),visible:n===t.tab}))))}}function c(t){const{isFullScreen:e,fullScreenHandler:n,closeHandler:a}=t,s=i.css({display:"flex",backgroundColor:"white",border:"1px solid white",padding:"6px",paddingTop:"10px",marginBottom:"10px",borderRadius:"6px",marginTop:"-16px"}),u=i.css(Object.assign({},o.tachyons("f6 link br2 ph3 pv2 near-black"))),c=i.css({marginLeft:"auto"});return r.h("div",{className:`${s} visor-controls`},r.h("button",{className:`${u}`,onClick:n},e?"Minimize":"Maximise"),r.h("button",{className:`${u} ${c}`,onClick:a},"Hide"))}e.VisorComponent=u},function(t,e){},function(t,e){},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(90)),a=n(43);e.barchart=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=a.getDrawArea(t),i=e,c=Object.assign({},s,n);if(u.has(r)){const t=u.get(r);if(a.shallowEquals(c,t.lastOptions)){yield a.nextFrame();const e=t.view,n=e.changeset().remove(()=>!0).insert(i);return void(yield e.change("values",n).runAsync())}}const{xLabel:l,yLabel:f,xType:d,yType:h}=c;let p=null;null!=l&&(p={title:l});let m=null;null!=f&&(m={title:f});const g={width:c.width||r.clientWidth,height:c.height||r.clientHeight,padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:c.fontSize,titleFontSize:c.fontSize},text:{fontSize:c.fontSize},legend:{labelFontSize:c.fontSize,titleFontSize:c.fontSize}},data:{values:i,name:"values"},mark:"bar",encoding:{x:{field:"index",type:d,axis:p},y:{field:"value",type:h,axis:m}}};yield a.nextFrame();const v=yield o.default(r,g,{actions:!1,mode:"vega-lite",defaultStyle:!1});u.set(r,{view:v.view,lastOptions:c})})};const s={xLabel:"",yLabel:"",xType:"ordinal",yType:"quantitative",fontSize:11},u=new Map},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";(function(t,r){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=n(7),a=n(97),s=o.Buffer,u=o.kMaxLength,c=t.crypto||t.msCrypto,l=Math.pow(2,32)-1;function f(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>l||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function d(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>l||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>u)throw new RangeError("buffer too small")}function h(t,e,n,i){if(r.browser){var o=t.buffer,s=new Uint8Array(o,e,n);return c.getRandomValues(s),i?void r.nextTick(function(){i(null,t)}):t}if(!i)return a(n).copy(t,e),t;a(n,function(n,r){if(n)return i(n);r.copy(t,e),i(null,t)})}c&&c.getRandomValues||!r.browser?(e.randomFill=function(e,n,r,i){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)i=n,n=0,r=e.length;else if("function"==typeof r)i=r,r=e.length-n;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return f(n,e.length),d(r,n,e.length),h(e,n,r,i)},e.randomFillSync=function(e,n,r){if(void 0===n&&(n=0),!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return f(n,e.length),void 0===r&&(r=e.length-n),d(r,n,e.length),h(e,n,r)}):(e.randomFill=i,e.randomFillSync=i)}).call(this,n(27),n(44))},function(t,e,n){var r=n(144),i=n(323),o=n(322),a=n(24),s=n(207),u=n(122),c=n(321),l=n(7).Buffer;t.exports=function(t,e,n){var f;f=t.padding?t.padding:n?1:4;var d,h=r(t),p=h.modulus.byteLength();if(e.length>p||new a(e).cmp(h.modulus)>=0)throw new Error("decryption error");d=n?c(new a(e),h):s(e,h);var m=l.alloc(p-d.length);if(d=l.concat([m,d],p),4===f)return function(t,e){var n=t.modulus.byteLength(),r=u("sha1").update(l.alloc(0)).digest(),a=r.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,a+1),c=e.slice(a+1),f=o(s,i(c,a)),d=o(c,i(f,n-a-1));if(function(t,e){t=l.from(t),e=l.from(e);var n=0,r=t.length;t.length!==e.length&&(n++,r=Math.min(t.length,e.length));for(var i=-1;++i<r;)n+=t[i]^e[i];return n}(r,d.slice(0,a)))throw new Error("decryption error");for(var h=a;0===d[h];)h++;if(1!==d[h++])throw new Error("decryption error");return d.slice(h)}(h,d);if(1===f)return function(t,e,n){for(var r=e.slice(0,2),i=2,o=0;0!==e[i++];)if(i>=e.length){o++;break}var a=e.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}(0,d,n);if(3===f)return d;throw new Error("unknown padding")}},function(t,e,n){var r=n(144),i=n(97),o=n(122),a=n(323),s=n(322),u=n(24),c=n(321),l=n(207),f=n(7).Buffer;t.exports=function(t,e,n){var d;d=t.padding?t.padding:n?1:4;var h,p=r(t);if(4===d)h=function(t,e){var n=t.modulus.byteLength(),r=e.length,c=o("sha1").update(f.alloc(0)).digest(),l=c.length,d=2*l;if(r>n-d-2)throw new Error("message too long");var h=f.alloc(n-r-d-2),p=n-l-1,m=i(l),g=s(f.concat([c,h,f.alloc(1,1),e],p),a(m,p)),v=s(m,a(g,l));return new u(f.concat([f.alloc(1),v,g],n))}(p,e);else if(1===d)h=function(t,e,n){var r,o=e.length,a=t.modulus.byteLength();if(o>a-11)throw new Error("message too long");return r=n?f.alloc(a-o-3,255):function(t){for(var e,n=f.allocUnsafe(t),r=0,o=i(2*t),a=0;r<t;)a===o.length&&(o=i(2*t),a=0),(e=o[a++])&&(n[r++]=e);return n}(a-o-3),new u(f.concat([f.from([0,n?1:2]),r,f.alloc(1),e],a))}(p,e,n);else{if(3!==d)throw new Error("unknown padding");if((h=new u(e)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return n?l(h,p):c(h,p)}},function(t,e,n){e.publicEncrypt=n(678),e.privateDecrypt=n(677),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}},function(t,e,n){(function(e){var r=n(31),i=n(24);t.exports=function(t){return new a(t)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(t){this.curveType=o[t],this.curveType||(this.curveType={name:t}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}function s(t,n,r){Array.isArray(t)||(t=t.toArray());var i=new e(t);if(r&&i.length<r){var o=new e(r-i.length);o.fill(0),i=e.concat([o,i])}return n?i.toString(n):i}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},a.prototype.computeSecret=function(t,n,r){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),s(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},a.prototype.getPublicKey=function(t,e){var n=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(n[n.length-1]%2?n[0]=7:n[0]=6),s(n,t)},a.prototype.getPrivateKey=function(t){return s(this.keys.getPrivate(),t)},a.prototype.setPublicKey=function(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this.keys._importPublic(t),this},a.prototype.setPrivateKey=function(t,n){n=n||"utf8",e.isBuffer(t)||(t=new e(t,n));var r=new i(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this}}).call(this,n(18).Buffer)},function(t,e,n){(function(e){var r=n(24),i=n(31).ec,o=n(144),a=n(324);function s(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}t.exports=function(t,n,u,c,l){var f=o(u);if("ec"===f.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=a[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var o=new i(r),s=n.data.subjectPrivateKey.data;return o.verify(e,t,s)}(t,n,f)}if("dsa"===f.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var i=n.data.p,a=n.data.q,u=n.data.g,c=n.data.pub_key,l=o.signature.decode(t,"der"),f=l.s,d=l.r;s(f,a),s(d,a);var h=r.mont(i),p=f.invm(a);return 0===u.toRed(h).redPow(new r(e).mul(p).mod(a)).fromRed().mul(c.toRed(h).redPow(d.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(d)}(t,n,f)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");n=e.concat([l,n]);for(var d=f.modulus.byteLength(),h=[1],p=0;n.length+h.length+2<d;)h.push(255),p++;h.push(0);for(var m=-1;++m<n.length;)h.push(n[m]);h=new e(h);var g=r.mont(f.modulus);t=(t=new r(t).toRed(g)).redPow(new r(f.publicExponent)),t=new e(t.fromRed().toArray());var v=p<8?1:0;for(d=Math.min(t.length,h.length),t.length!==h.length&&(v=1),m=-1;++m<d;)v|=t[m]^h[m];return 0===v}}).call(this,n(18).Buffer)},function(t,e,n){(function(e){var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,a=n(147),s=n(209);t.exports=function(t,n){var u,c=t.toString(),l=c.match(r);if(l){var f="aes"+l[1],d=new e(l[2],"hex"),h=new e(l[3].replace(/[\r\n]/g,""),"base64"),p=a(n,d.slice(0,8),parseInt(l[1],10)).key,m=[],g=s.createDecipheriv(f,p,d);m.push(g.update(h)),m.push(g.final()),u=e.concat(m)}else{var v=c.match(o);u=new e(v[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:u}}}).call(this,n(18).Buffer)},function(t){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},function(t,e,n){"use strict";var r=n(118),i=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),a=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),s=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}),u=r.define("RelativeDistinguishedName",function(){this.setof(o)}),c=r.define("RDNSequence",function(){this.seqof(u)}),l=r.define("Name",function(){this.choice({rdnSequence:this.use(c)})}),f=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),d=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),h=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(l),this.key("validity").use(f),this.key("subject").use(l),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())}),p=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(h),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});t.exports=p},function(t,e,n){var r=n(6),i=n(325);function o(t){i.call(this,t),this.enc="pem"}r(o,i),t.exports=o,o.prototype.encode=function(t,e){for(var n=i.prototype.encode.call(this,t).toString("base64"),r=["-----BEGIN "+e.label+"-----"],o=0;o<n.length;o+=64)r.push(n.slice(o,o+64));return r.push("-----END "+e.label+"-----"),r.join("\n")}},function(t,e,n){var r=e;r.der=n(325),r.pem=n(685)},function(t,e,n){var r=n(6),i=n(18).Buffer,o=n(326);function a(t){o.call(this,t),this.enc="pem"}r(a,o),t.exports=a,a.prototype.decode=function(t,e){for(var n=t.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,u=-1,c=0;c<n.length;c++){var l=n[c].match(a);if(null!==l&&l[2]===r){if(-1!==s){if("END"!==l[1])break;u=c;break}if("BEGIN"!==l[1])break;s=c}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+r);var f=n.slice(s+1,u).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var d=new i(f,"base64");return o.prototype.decode.call(this,d,e)}},function(t,e,n){var r=e;r.der=n(326),r.pem=n(687)},function(t,e,n){var r=n(327);e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=r._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=r._reverse(e.tag)},function(t,e,n){var r=n(117).Reporter,i=n(117).EncoderBuffer,o=n(117).DecoderBuffer,a=n(38),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(t,e){var n={};this._baseState=n,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=c;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){var t=this._baseState,e={};l.forEach(function(n){e[n]=t[n]});var n=new this.constructor(e.parent);return n._baseState=e,n},c.prototype._wrap=function(){var t=this._baseState;u.forEach(function(e){this[e]=function(){var n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}},this)},c.prototype._init=function(t){var e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this),a.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){var e=this._baseState,n=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==n.length&&(a(null===e.children),e.children=n,n.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map(function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach(function(n){n==(0|n)&&(n|=0);var r=t[n];e[r]=n}),e}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(t){c.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),s.forEach(function(t){c.prototype[t]=function(){var e=this._baseState,n=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(n),this}}),c.prototype.use=function(t){a(t);var e=this._baseState;return a(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){var e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){var e=this._baseState;return a(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){var e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},c.prototype.contains=function(t){var e=this._baseState;return a(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){var n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));var r,i=n.default,a=!0,s=null;if(null!==n.key&&(s=t.enterKey(n.key)),n.optional){var u=null;if(null!==n.explicit?u=n.explicit:null!==n.implicit?u=n.implicit:null!==n.tag&&(u=n.tag),null!==u||n.any){if(a=this._peekTag(t,u,n.any),t.isError(a))return a}else{var c=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(c)}}if(n.obj&&a&&(r=t.enterObject()),a){if(null!==n.explicit){var l=this._decodeTag(t,n.explicit);if(t.isError(l))return l;t=l}var f=t.offset;if(null===n.use&&null===n.choice){n.any&&(c=t.save());var d=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(d))return d;n.any?i=t.raw(c):t=d}if(e&&e.track&&null!==n.tag&&e.track(t.path(),f,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),i=n.any?i:null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(n){n._decode(t,e)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){var h=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(h,e)}}return n.obj&&a&&(i=t.leaveObject(r)),null===n.key||null===i&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,n.key,i),i},c.prototype._decodeGeneric=function(t,e,n){var r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){var n=this._baseState;return n.useDecoder=this._use(t,e),a(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},c.prototype._decodeChoice=function(t,e){var n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(o){var a=t.save(),s=n.choice[o];try{var u=s._decode(t,e);if(t.isError(u))return!1;r={type:o,value:u},i=!0}catch(e){return t.restore(a),!1}return!0},this),i?r:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},c.prototype._encode=function(t,e,n){var r=this._baseState;if(null===r.default||r.default!==t){var i=this._encodeValue(t,e,n);if(void 0!==i&&!this._skipDefault(i,e,n))return i}},c.prototype._encodeValue=function(t,e,n){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new r);var o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}var a=null,s=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)a=this._getUse(i.contains,n)._encode(t,e),s=!0;else if(i.children)a=i.children.map(function(n){if("null_"===n._baseState.tag)return n._encode(null,e,t);if(null===n._baseState.key)return e.error("Child should have a key");var r=e.enterKey(n._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var i=n._encode(t[n._baseState.key],e,t);return e.leaveKey(r),i},this).filter(function(t){return t}),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,a=this._createEncoderBuffer(t.map(function(n){var r=this._baseState;return this._getUse(r.args[0],t)._encode(n,e)},u))}else null!==i.use?o=this._getUse(i.use,n)._encode(t,e):(a=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){var c=null!==i.implicit?i.implicit:i.tag,l=null===i.implicit?"universal":"context";null===c?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(c,s,l,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){var n=this._baseState,r=n.choice[t.type];return r||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){var n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},function(t,e,n){var r=n(6);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,n){var r=this._reporterState;this.exitKey(t),null!==r.obj&&(r.obj[e]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){var e=this._reporterState,n=e.obj;return e.obj=t,n},i.prototype.error=function(t){var e,n=this._reporterState,r=t instanceof o;if(e=r?t:new o(n.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw e;return r||n.errors.push(e),e},i.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},r(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e){var n=[].indexOf;t.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(692),Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)e.push(n);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e(t[n],n,t)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(t,e,n){Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0,value:n})}}catch(t){return function(t,e,n){t[e]=n}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(t){if(!(t instanceof Context))throw new TypeError("needs a 'context' argument.");var e=document.createElement("iframe");e.style||(e.style={}),e.style.display="none",document.body.appendChild(e);var n=e.contentWindow,r=n.eval,i=n.execScript;!r&&i&&(i.call(n,"null"),r=n.eval),forEach(Object_keys(t),function(e){n[e]=t[e]}),forEach(globals,function(e){t[e]&&(n[e]=t[e])});var o=Object_keys(n),a=r.call(n,this.code);return forEach(Object_keys(n),function(e){(e in t||-1===indexOf(o,e))&&(t[e]=n[e])}),forEach(globals,function(e){e in t||defineProp(t,e,n[e])}),document.body.removeChild(e),a},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(t){var e=Script.createContext(t),n=this.runInContext(e);return forEach(Object_keys(e),function(n){t[n]=e[n]}),n},forEach(Object_keys(Script.prototype),function(t){exports[t]=Script[t]=function(e){var n=Script(e);return n[t].apply(n,[].slice.call(arguments,1))}}),exports.createScript=function(t){return exports.Script(t)},exports.createContext=Script.createContext=function(t){var e=new Context;return"object"==typeof t&&forEach(Object_keys(t),function(n){e[n]=t[n]}),e}},function(t,e,n){var r=n(118),i=n(6);function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(t){var e;try{e=n(693).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return i(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,n){return this._getDecoder(e).decode(t,n)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,n){return this._getEncoder(e).encode(t,n)}},function(t,e,n){"use strict";var r=n(118);e.certificate=n(684);var i=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});e.RSAPrivateKey=i;var o=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});e.RSAPublicKey=o;var a=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});e.PublicKey=a;var s=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=r.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});e.PrivateKey=u;var c=r.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});e.EncryptedPrivateKey=c;var l=r.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});e.DSAPrivateKey=l,e.DSAparam=r.define("DSAparam",function(){this.int()});var f=r.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())});e.ECPrivateKey=f;var d=r.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});e.signature=r.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},function(t,e,n){"use strict";var r=n(24),i=n(31).utils,o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=s(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof r&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),a(u,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),a(u,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),a(u,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},function(t,e,n){"use strict";var r=n(31).utils,i=r.assert,o=r.parseBytes,a=r.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),a(s,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(s,"privBytes",function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a(s,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),a(s,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),a(s,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),t)},s.prototype.getPublic=function(t){return r.encode(this.pubBytes(),t)},t.exports=s},function(t,e,n){"use strict";var r=n(206),i=n(31),o=i.utils,a=o.assert,s=o.parseBytes,u=n(697),c=n(696);function l(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof l))return new l(t);t=i.curves[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=r.sha512}t.exports=l,l.prototype.sign=function(t,e){t=s(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),u=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},l.prototype.verify=function(t,e,n){t=s(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},l.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},l.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},l.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},l.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=o.intFromLE(n);return this.curve.pointFromY(i,r)},l.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(t){return o.intFromLE(t)},l.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,n){"use strict";var r=n(24),i=n(31).utils,o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new r(t.r,16),this.s=new r(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(t,e){var n=t[e.place++];if(!(128&n))return n;for(var r=15&n,i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a];return e.place=a,i}function u(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function c(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var n=new function(){this.place=0};if(48!==t[n.place++])return!1;if(s(t,n)+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var o=s(t,n),a=t.slice(n.place,o+n.place);if(n.place+=o,2!==t[n.place++])return!1;var u=s(t,n);if(t.length!==u+n.place)return!1;var c=t.slice(n.place,u+n.place);return 0===a[0]&&128&a[1]&&(a=a.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new r(a),this.s=new r(c),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=u(e),n=u(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];c(r,e.length),(r=r.concat(e)).push(2),c(r,n.length);var o=r.concat(n),a=[48];return c(a,o.length),a=a.concat(o),i.encode(a,t)}},function(t,e,n){"use strict";var r=n(24),i=n(31).utils.assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,n){return e instanceof o?e:new o(t,{pub:e,pubEnc:n})},o.fromPrivate=function(t,e,n){return e instanceof o?e:new o(t,{priv:e,privEnc:n})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new r(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.mul(this.priv).getX()},o.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,n){"use strict";var r=n(206),i=n(332),o=n(38);function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),n=i.toArray(t.nonce,t.nonceEnc||"hex"),r=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}t.exports=a,a.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new r.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=i.toArray(t,e),n=i.toArray(n,r),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},a.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,t);return this._update(n),this._reseed++,i.encode(a,e)}},function(t,e,n){"use strict";var r=n(24),i=n(701),o=n(31),a=o.utils.assert,s=n(700),u=n(699);function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(a(o.curves.hasOwnProperty(t),"Unknown curve "+t),t=o.curves[t]),t instanceof o.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=c,c.prototype.keyPair=function(t){return new s(this,t)},c.prototype.keyFromPrivate=function(t,e){return s.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return s.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||o.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),a=this.n.sub(new r(2));;){var s=new r(e.generate(n));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},c.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new r(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),c=t.toArray("be",a),l=new i({hash:this.hash,entropy:s,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new r(1)),d=0;;d++){var h=o.k?o.k(d):new r(l.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=h.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(v=v.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),b^=1),new u({r:g,s:v,recoveryParam:b})}}}}}},c.prototype.verify=function(t,e,n,i){t=this._truncateToN(new r(t,16)),n=this.keyFromPublic(n,i);var o=(e=new u(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),l=c.mul(t).umod(this.n),f=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,n.getPublic(),f)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(l,n.getPublic(),f)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(t,e,n,i){a((3&n)===n,"The recovery param is more than two bits"),e=new u(e,i);var o=this.n,s=new r(t),c=e.r,l=e.s,f=1&n,d=n>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");c=d?this.curve.pointFromX(c.add(this.curve.n),f):this.curve.pointFromX(c,f);var h=e.r.invm(o),p=o.sub(s).mul(h).umod(o),m=l.mul(h).umod(o);return this.g.mulAdd(p,c,m)},c.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new u(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,n){"use strict";var r=n(54),i=n(38);function o(t,e,n){if(!(this instanceof o))return new o(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,n))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e,n){"use strict";var r=n(54),i=n(119),o=r.rotl32,a=r.sum32,s=r.sum32_3,u=r.sum32_4,c=i.BlockHash;function l(){if(!(this instanceof l))return new l;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function d(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function h(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}r.inherits(l,c),e.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],c=this.h[3],l=this.h[4],b=n,y=r,w=i,x=c,_=l,k=0;k<80;k++){var S=a(o(u(n,f(k,r,i,c),t[p[k]+e],d(k)),g[k]),l);n=l,l=c,c=o(i,10),i=r,r=S,S=a(o(u(b,f(79-k,y,w,x),t[m[k]+e],h(k)),v[k]),_),b=_,_=x,x=o(w,10),w=y,y=S}S=s(this.h[1],i,x),this.h[1]=s(this.h[2],c,_),this.h[2]=s(this.h[3],l,b),this.h[3]=s(this.h[4],n,y),this.h[4]=s(this.h[0],r,w),this.h[0]=S},l.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"little"):r.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(t,e,n){"use strict";var r=n(54),i=n(329);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}},function(t,e,n){"use strict";var r=n(54),i=n(330);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}},function(t,e,n){"use strict";var r=n(54),i=n(119),o=n(331),a=r.rotl32,s=r.sum32,u=r.sum32_5,c=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(d,l),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],l=this.h[2],d=this.h[3],h=this.h[4];for(r=0;r<n.length;r++){var p=~~(r/20),m=u(a(i,5),c(p,o,l,d),h,n[r],f[p]);h=d,d=l,l=a(o,30),o=i,i=m}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],l),this.h[3]=s(this.h[3],d),this.h[4]=s(this.h[4],h)},d.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";e.sha1=n(708),e.sha224=n(707),e.sha256=n(330),e.sha384=n(706),e.sha512=n(329)},function(t,e,n){"use strict";var r,i=e,o=n(206),a=n(31),s=a.utils.assert;function u(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var n=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(703)}catch(t){r=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},function(t,e,n){"use strict";var r=n(145),i=n(31),o=n(24),a=n(6),s=r.base,u=i.utils.assert;function c(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function l(t,e,n,r,i){s.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(e,16),this.y=new o(n,16),this.z=r?new o(r,16):this.curve.one,this.t=i&&new o(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(c,s),t.exports=c,c.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},c.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=r.redMul(i.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},c.prototype.pointFromY=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=r.redMul(i.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},c.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},a(l,s.BasePoint),c.prototype.pointFromJSON=function(t){return l.fromJSON(this,t)},c.prototype.point=function(t,e,n,r){return new l(this,t,e,n,r)},l.fromJSON=function(t,e){return new l(t,e[0],e[1],e[2])},l.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},l.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),f=a.redMul(o);return this.curve.point(u,c,f,l)},l.prototype._projDbl=function(){var t,e,n,r=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)t=r.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),e=a.redMul(c.redSub(o)),n=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);t=r.redSub(i).redISub(o).redMul(u),e=a.redMul(c.redSub(o)),n=a.redMul(u)}}else{var c=i.redAdd(o);s=this.curve._mulC(this.z).redSqr(),u=c.redSub(s).redSub(s),t=this.curve._mulC(r.redISub(c)).redMul(u),e=this.curve._mulC(c).redMul(i.redISub(o)),n=c.redMul(u)}return this.curve.point(t,e,n)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},l.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),l=s.redMul(u),f=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,f)},l.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),f=r.redMul(u).redMul(l);return this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(f,e,n)},l.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},l.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},l.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},l.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},l.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},l.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()},l.prototype.getY=function(){return this.normalize(),this.y.fromRed()},l.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},l.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},l.prototype.toP=l.prototype.normalize,l.prototype.mixedAdd=l.prototype.add},function(t,e,n){"use strict";var r=n(145),i=n(24),o=n(6),a=r.base,s=n(31).utils;function u(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(t,e,n){a.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),t.exports=u,u.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},o(c,a.BasePoint),u.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},u.prototype.point=function(t,e){return new c(this,t,e)},u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(t,e){return new c(t,e[0],e[1]||t.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},c.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,n){"use strict";var r=n(145),i=n(31),o=n(24),a=n(6),s=r.base,u=i.utils.assert;function c(t){s.call(this,"short",t),this.a=new o(t.a,16).toRed(this.red),this.b=new o(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function l(t,e,n,r){s.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(e,16),this.y=new o(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,e,n,r){s.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(e,16),this.y=new o(n,16),this.z=new o(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(c,s),t.exports=c,c.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new o(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new o(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?n=i[0]:(n=i[1],u(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:n,basis:t.basis?t.basis.map(function(t){return{a:new o(t.a,16),b:new o(t.b,16)}}):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:o.mont(t),n=new o(2).toRed(e).redInvm(),r=n.redNeg(),i=new o(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},c.prototype._getEndoBasis=function(t){for(var e,n,r,i,a,s,u,c,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,h=this.n.clone(),p=new o(1),m=new o(0),g=new o(0),v=new o(1),b=0;0!==d.cmpn(0);){var y=h.div(d);c=h.sub(y.mul(d)),l=g.sub(y.mul(p));var w=v.sub(y.mul(m));if(!r&&c.cmp(f)<0)e=u.neg(),n=p,r=c.neg(),i=l;else if(r&&2==++b)break;u=c,h=d,d=c,g=p,p=l,v=m,m=w}a=c.neg(),s=l;var x=r.sqr().add(i.sqr());return a.sqr().add(s.sqr()).cmp(x)>=0&&(a=e,s=n),r.negative&&(r=r.neg(),i=i.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:r,b:i},{a:a,b:s}]},c.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},c.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},c.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},a(l,s.BasePoint),c.prototype.point=function(t,e,n){return new l(this,t,e,n)},c.prototype.pointFromJSON=function(t,e){return l.fromJSON(this,t,e)},l.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},l.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},l.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},l.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},l.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},l.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},l.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},l.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},l.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,s.BasePoint),c.prototype.jpoint=function(t,e,n){return new f(this,t,e,n)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),f=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(f).redISub(f),h=u.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,h,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),f=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(c)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(n=0;n<t;n++){var l=o.redSqr(),f=c.redSqr(),d=f.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(f),m=h.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),v=h.redMul(g);v=v.redIAdd(v).redISub(d);var b=c.redMul(s);n+1<t&&(u=u.redMul(d)),o=m,s=b,c=v}return this.curve.jpoint(o,c.redMul(i),s)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),h=this.x.redAdd(f).redSqr().redISub(l).redISub(d);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(h).redISub(h),e=p.redMul(h.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},f.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),d=this.x.redMul(f),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);t=h.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=h.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},f.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),f=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=s.redMul(f).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,h,p)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(s).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(f,d,h)},f.prototype.mul=function(t,e){return t=new o(t,e),this.curve._wnafMul(this,t)},f.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},f.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,n){"use strict";var r=n(24),i=n(31).utils,o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new r(e.p,16),this.red=e.prime?r.red(e.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=e.n&&new r(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var n=t._getDoubles(),r=o(e,1),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var a=[],u=0;u<r.length;u+=n.step){var c=0;for(e=u+n.step-1;e>=u;e--)c=(c<<1)+r[e];a.push(c)}for(var l=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(u=0;u<a.length;u++)(c=a[u])===d?f=f.mixedAdd(n.points[u]):c===-d&&(f=f.mixedAdd(n.points[u].neg()));l=l.add(f)}return l.toP()},u.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,a=o(e,n),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(e=0;c>=0&&0===a[c];c--)e++;if(c>=0&&e++,u=u.dblp(e),c<0)break;var l=a[c];s(0!==l),u="affine"===t.type?l>0?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):l>0?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,n,r,i){for(var s=this._wnafT1,u=this._wnafT2,c=this._wnafT3,l=0,f=0;f<r;f++){var d=(E=e[f])._getNAFPoints(t);s[f]=d.wnd,u[f]=d.points}for(f=r-1;f>=1;f-=2){var h=f-1,p=f;if(1===s[h]&&1===s[p]){var m=[e[h],null,null,e[p]];0===e[h].y.cmp(e[p].y)?(m[1]=e[h].add(e[p]),m[2]=e[h].toJ().mixedAdd(e[p].neg())):0===e[h].y.cmp(e[p].y.redNeg())?(m[1]=e[h].toJ().mixedAdd(e[p]),m[2]=e[h].add(e[p].neg())):(m[1]=e[h].toJ().mixedAdd(e[p]),m[2]=e[h].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=a(n[h],n[p]);l=Math.max(v[0].length,l),c[h]=new Array(l),c[p]=new Array(l);for(var b=0;b<l;b++){var y=0|v[0][b],w=0|v[1][b];c[h][b]=g[3*(y+1)+(w+1)],c[p][b]=0,u[h]=m}}else c[h]=o(n[h],s[h]),c[p]=o(n[p],s[p]),l=Math.max(c[h].length,l),l=Math.max(c[p].length,l)}var x=this.jpoint(null,null,null),_=this._wnafT4;for(f=l;f>=0;f--){for(var k=0;f>=0;){var S=!0;for(b=0;b<r;b++)_[b]=0|c[b][f],0!==_[b]&&(S=!1);if(!S)break;k++,f--}if(f>=0&&k++,x=x.dblp(k),f<0)break;for(b=0;b<r;b++){var E,O=_[b];0!==O&&(O>0?E=u[b][O-1>>1]:O<0&&(E=u[b][-O-1>>1].neg()),x="affine"===E.type?x.mixedAdd(E):x.add(E))}}for(f=0;f<r;f++)u[f]=null;return i?x:x.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}},function(t,e,n){"use strict";var r=e,i=n(24),o=n(38),a=n(332);r.assert=o,r.toArray=a.toArray,r.zero2=a.zero2,r.toHex=a.toHex,r.encode=a.encode,r.getNAF=function(t,e){for(var n=[],r=1<<e+1,i=t.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var a=i.andln(r-1);o=a>(r>>1)-1?(r>>1)-a:a,i.isubn(o)}else o=0;n.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(r-1)?e+1:1,u=1;u<s;u++)n.push(0);i.iushrn(s)}return n},r.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r=0,i=0;t.cmpn(-r)>0||e.cmpn(-i)>0;){var o,a,s,u=t.andln(3)+r&3,c=e.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!=(s=t.andln(7)+r&7)&&5!==s||2!==c?u:-u,n[0].push(o),a=0==(1&c)?0:3!=(s=e.andln(7)+i&7)&&5!==s||2!==u?c:-c,n[1].push(a),2*r===o+1&&(r=1-r),2*i===a+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return n},r.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new i(t,"hex","le")}},function(t){t.exports={_args:[["elliptic@6.4.1","/Users/codingtrain/Documents/ml5/ml5-library"]],_development:!0,_from:"elliptic@6.4.1",_id:"elliptic@6.4.1",_inBundle:!1,_integrity:"sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.4.1",name:"elliptic",escapedName:"elliptic",rawSpec:"6.4.1",saveSpec:null,fetchSpec:"6.4.1"},_requiredBy:["/browserify-sign","/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",_spec:"6.4.1",_where:"/Users/codingtrain/Documents/ml5/ml5-library",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.1"}},function(t,e,n){(function(e){var r=n(347),i=n(207),o=n(31).ec,a=n(24),s=n(144),u=n(324);function c(t,n,i,o){if((t=new e(t.toArray())).length<n.byteLength()){var a=new e(n.byteLength()-t.length);a.fill(0),t=e.concat([a,t])}var s=i.length,u=function(t,n){t=(t=l(t,n)).mod(n);var r=new e(t.toArray());if(r.length<n.byteLength()){var i=new e(n.byteLength()-r.length);i.fill(0),r=e.concat([i,r])}return r}(i,n),c=new e(s);c.fill(1);var f=new e(s);return f.fill(0),f=r(o,f).update(c).update(new e([0])).update(t).update(u).digest(),c=r(o,f).update(c).digest(),{k:f=r(o,f).update(c).update(new e([1])).update(t).update(u).digest(),v:c=r(o,f).update(c).digest()}}function l(t,e){var n=new a(t),r=(t.length<<3)-e.bitLength();return r>0&&n.ishrn(r),n}function f(t,n,i){var o,a;do{for(o=new e(0);8*o.length<t.bitLength();)n.v=r(i,n.k).update(n.v).digest(),o=e.concat([o,n.v]);a=l(o,t),n.k=r(i,n.k).update(n.v).update(new e([0])).digest(),n.v=r(i,n.k).update(n.v).digest()}while(-1!==a.cmp(t));return a}function d(t,e,n,r){return t.toRed(a.mont(n)).redPow(e).fromRed().mod(r)}t.exports=function(t,n,r,h,p){var m=s(n);if(m.curve){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");return function(t,n){var r=u[n.curve.join(".")];if(!r)throw new Error("unknown curve "+n.curve.join("."));var i=new o(r).keyFromPrivate(n.privateKey).sign(t);return new e(i.toDER())}(t,m)}if("dsa"===m.type){if("dsa"!==h)throw new Error("wrong private key type");return function(t,n,r){for(var i,o=n.params.priv_key,s=n.params.p,u=n.params.q,h=n.params.g,p=new a(0),m=l(t,u).mod(u),g=!1,v=c(o,u,t,r);!1===g;)p=d(h,i=f(u,v,r),s,u),0===(g=i.invm(u).imul(m.add(o.mul(p))).mod(u)).cmpn(0)&&(g=!1,p=new a(0));return function(t,n){t=t.toArray(),n=n.toArray(),128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n));var r=[48,t.length+n.length+4,2,t.length];return r=r.concat(t,[2,n.length],n),new e(r)}(p,g)}(t,m,r)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");t=e.concat([p,t]);for(var g=m.modulus.byteLength(),v=[0,1];t.length+v.length+1<g;)v.push(255);v.push(0);for(var b=-1;++b<t.length;)v.push(t[b]);return i(v,m)},t.exports.getKey=c,t.exports.makeKey=f}).call(this,n(18).Buffer)},function(t,e,n){(function(e){var r=n(122),i=n(216),o=n(6),a=n(717),s=n(681),u=n(345);function c(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=r(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=r(e.hash),this._tag=e.id,this._signType=e.sign}function f(t){return new c(t)}function d(t){return new l(t)}Object.keys(u).forEach(function(t){u[t].id=new e(u[t].id,"hex"),u[t.toLowerCase()]=u[t]}),o(c,i.Writable),c.prototype._write=function(t,e,n){this._hash.update(t),n()},c.prototype.update=function(t,n){return"string"==typeof t&&(t=new e(t,n)),this._hash.update(t),this},c.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=a(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},o(l,i.Writable),l.prototype._write=function(t,e,n){this._hash.update(t),n()},l.prototype.update=function(t,n){return"string"==typeof t&&(t=new e(t,n)),this._hash.update(t),this},l.prototype.verify=function(t,n,r){"string"==typeof n&&(n=new e(n,r)),this.end();var i=this._hash.digest();return s(n,i,t,this._signType,this._tag)},t.exports={Sign:f,Verify:d,createSign:f,createVerify:d}}).call(this,n(18).Buffer)},function(t,e,n){(function(e){var r=n(24),i=new(n(334)),o=new r(24),a=new r(11),s=new r(10),u=new r(3),c=new r(7),l=n(335),f=n(97);function d(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this._pub=new r(t),this}function h(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this._priv=new r(t),this}t.exports=m;var p={};function m(t,e,n){this.setGenerator(e),this.__prime=new r(t),this._prime=r.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=d,this.setPrivateKey=h):this._primeCode=8}function g(t,n){var r=new e(t.toArray());return n?r.toString(n):r}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var n=e.toString("hex"),r=[n,t.toString(16)].join("_");if(r in p)return p[r];var f,d=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!i.test(t))return d+=1,d+="02"===n||"05"===n?8:4,p[r]=d,d;switch(i.test(t.shrn(1))||(d+=2),n){case"02":t.mod(o).cmp(a)&&(d+=8);break;case"05":(f=t.mod(s)).cmp(u)&&f.cmp(c)&&(d+=8);break;default:d+=4}return p[r]=d,d}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new r(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var n=(t=(t=new r(t)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new e(n.toArray()),o=this.getPrime();if(i.length<o.length){var a=new e(o.length-i.length);a.fill(0),i=e.concat([a,i])}return i},m.prototype.getPublicKey=function(t){return g(this._pub,t)},m.prototype.getPrivateKey=function(t){return g(this._priv,t)},m.prototype.getPrime=function(t){return g(this.__prime,t)},m.prototype.getGenerator=function(t){return g(this._gen,t)},m.prototype.setGenerator=function(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this.__gen=t,this._gen=new r(t),this}}).call(this,n(18).Buffer)},function(t){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},function(t,e){},function(t,e){},function(t,e,n){(function(t){var r=n(335),i=n(720),o=n(719),a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var n=new t(i[e].prime,"hex"),r=new t(i[e].gen,"hex");return new o(n,r)},e.createDiffieHellman=e.DiffieHellman=function e(n,i,s,u){return t.isBuffer(i)||void 0===a[i]?e(n,"binary",i,s):(i=i||"binary",u=u||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,u)),"number"==typeof n?new o(r(n,s),s,!0):(t.isBuffer(n)||(n=new t(n,i)),new o(n,s,!0)))}}).call(this,n(18).Buffer)},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,n){var r=n(337),i=n(7).Buffer,o=n(208),a=n(336),s=n(67),u=n(148),c=n(147);function l(t,e,n){s.call(this),this._cache=new f,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(n),this._mode=t,this._autopadding=!0}function f(){this.cache=i.allocUnsafe(0)}function d(t,e,n){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=i.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof e&&(e=i.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,n,!0):"auth"===s.type?new r(s.module,e,n,!0):new l(s.module,e,n)}n(6)(l,s),l.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,e),r.push(n);return i.concat(r)},l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var n=-1;++n<e;)if(t[n+(16-e)]!==e)throw new Error("unable to decrypt data");if(16!==e)return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},f.prototype.add=function(t){this.cache=i.concat([this.cache,t])},f.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var n=o[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(e,!1,n.key,n.iv);return d(t,r.key,r.iv)},e.createDecipheriv=d},function(t,e,n){var r=n(7).Buffer,i=r.alloc(16,0);function o(t){var e=r.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,n=function(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}(this.h),r=[0,0,0,0],i=-1;++i<128;){for(0!=(this.state[~~(i/8)]&1<<7-i%8)&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),e=0!=(1&n[3]),t=3;t>0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,e&&(n[0]=n[0]^225<<24)}this.state=o(r)},a.prototype.update=function(t){var e;for(this.cache=r.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=a},function(t,e,n){(function(t){var r=n(120);function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(e,n){for(;e._cache.length<n.length;)e._cache=t.concat([e._cache,i(e)]);var o=e._cache.slice(0,n.length);return e._cache=e._cache.slice(n.length),r(n,o)}}).call(this,n(18).Buffer)},function(t,e,n){var r=n(7).Buffer;function i(t,e,n){for(var r,i,a,s=-1,u=0;++s<8;)r=t._cipher.encryptBlock(t._prev),i=e&1<<7-s?128:0,u+=(128&(a=r[0]^i))>>s%8,t._prev=o(t._prev,n?i:a);return u}function o(t,e){var n=t.length,i=-1,o=r.allocUnsafe(t.length);for(t=r.concat([t,r.from([e])]);++i<n;)o[i]=t[i]<<1|t[i+1]>>7;return o}e.encrypt=function(t,e,n){for(var o=e.length,a=r.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],n);return a}},function(t,e,n){var r=n(7).Buffer;function i(t,e,n){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=r.concat([t._prev.slice(1),r.from([n?e:i])]),i}e.encrypt=function(t,e,n){for(var o=e.length,a=r.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],n);return a}},function(t,e,n){var r=n(7).Buffer,i=n(120);function o(t,e,n){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=r.concat([t._prev,n?e:a]),a}e.encrypt=function(t,e,n){for(var i,a=r.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=r.allocUnsafe(0)),!(t._cache.length<=e.length)){a=r.concat([a,o(t,e,n)]);break}i=t._cache.length,a=r.concat([a,o(t,e.slice(0,i),n)]),e=e.slice(i)}return a}},function(t,e,n){var r=n(120);e.encrypt=function(t,e){var n=r(e,t._prev);return t._prev=t._cipher.encryptBlock(n),t._prev},e.decrypt=function(t,e){var n=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return r(i,n)}},function(t,e){e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},function(t,e,n){var r=n(208),i=n(337),o=n(7).Buffer,a=n(336),s=n(67),u=n(148),c=n(147);function l(t,e,n){s.call(this),this._cache=new d,this._cipher=new u.AES(e),this._prev=o.from(n),this._mode=t,this._autopadding=!0}n(6)(l,s),l.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get();)n=this._mode.encrypt(this,e),r.push(n);return o.concat(r)};var f=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function h(t,e,n){var s=r[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===s.type?new a(s.module,e,n):"auth"===s.type?new i(s.module,e,n):new l(s.module,e,n)}l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},d.prototype.add=function(t){this.cache=o.concat([this.cache,t])},d.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),n=-1;++n<t;)e.writeUInt8(t,n);return o.concat([this.cache,e])},e.createCipheriv=h,e.createCipher=function(t,e){var n=r[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=c(e,!1,n.key,n.iv);return h(t,i.key,i.iv)}},function(t,e,n){"use strict";var r=n(38),i=n(6),o=n(210),a=o.Cipher,s=o.DES;function u(t){a.call(this,t);var e=new function(t,e){r.equal(e.length,24,"Invalid key length");var n=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:n})]}(this.type,this.options.key);this._edeState=e}i(u,a),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,n,r){var i=this._edeState;i.ciphers[0]._update(t,e,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},u.prototype._pad=s.prototype._pad,u.prototype._unpad=s.prototype._unpad},function(t,e,n){"use strict";var r=n(38),i=n(6),o={};e.instantiate=function(t){function e(e){t.call(this,e),this._cbcInit()}i(e,t);for(var n=Object.keys(o),r=0;r<n.length;r++){var a=n[r];e.prototype[a]=o[a]}return e.create=function(t){return new e(t)},e},o._cbcInit=function(){var t=new function(t){r.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}(this.options.iv);this._cbcState=t},o._update=function(t,e,n,r){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=t[e+s];for(o._update.call(this,a,0,n,r),s=0;s<this.blockSize;s++)a[s]=n[r+s]}else{for(o._update.call(this,t,e,n,r),s=0;s<this.blockSize;s++)n[r+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=t[e+s]}}},function(t,e,n){"use strict";var r=n(38),i=n(6),o=n(210),a=o.utils,s=o.Cipher;function u(t){s.call(this,t);var e=new function(){this.tmp=new Array(2),this.keys=null};this._desState=e,this.deriveKeys(e,t.key)}i(u,s),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),r.equal(e.length,this.blockSize,"Invalid key length");var n=a.readUInt32BE(e,0),i=a.readUInt32BE(e,4);a.pc1(n,i,t.tmp,0),n=t.tmp[0],i=t.tmp[1];for(var o=0;o<t.keys.length;o+=2){var s=c[o>>>1];n=a.r28shl(n,s),i=a.r28shl(i,s),a.pc2(n,i,t.keys,o)}},u.prototype._update=function(t,e,n,r){var i=this._desState,o=a.readUInt32BE(t,e),s=a.readUInt32BE(t,e+4);a.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],a.writeUInt32BE(n,o,r),a.writeUInt32BE(n,s,r+4)},u.prototype._pad=function(t,e){for(var n=t.length-e,r=e;r<t.length;r++)t[r]=n;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],n=t.length-e;n<t.length;n++)r.equal(t[n],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,n,r,i){for(var o=e,s=n,u=0;u<t.keys.length;u+=2){var c=t.keys[u],l=t.keys[u+1];a.expand(s,t.tmp,0),c^=t.tmp[0],l^=t.tmp[1];var f=a.substitute(c,l),d=s;s=(o^a.permute(f))>>>0,o=d}a.rip(s,o,r,i)},u.prototype._decrypt=function(t,e,n,r,i){for(var o=n,s=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],l=t.keys[u+1];a.expand(o,t.tmp,0),c^=t.tmp[0],l^=t.tmp[1];var f=a.substitute(c,l),d=o;o=(s^a.permute(f))>>>0,s=d}a.rip(o,s,r,i)}},function(t,e,n){"use strict";var r=n(38);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),r=0;r<n;r++)this.buffer[this.bufferOff+r]=t[e+r];return this.bufferOff+=n,n},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,n=0,r=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(r*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,n),n+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,n=0,r=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(r*this.blockSize);r>0;r--)e+=this._buffer(t,e),n+=this._flushBuffer(i,n);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){r.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,n){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},e.rip=function(t,e,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.pc1=function(t,e,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,n,i){for(var o=0,a=0,s=r.length>>>1,u=0;u<s;u++)o<<=1,o|=t>>>r[u]&1;for(u=s;u<r.length;u++)a<<=1,a|=e>>>r[u]&1;n[i+0]=o>>>0,n[i+1]=a>>>0},e.expand=function(t,e,n){var r=0,i=0;r=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,r=0;r<4;r++)n<<=4,n|=i[64*r+(t>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=i[256+64*r+(e>>>18-6*r&63)];return n>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n<o.length;n++)e<<=1,e|=t>>>o[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length<e;)r="0"+r;for(var i=[],o=0;o<e;o+=n)i.push(r.slice(o,o+n));return i.join(" ")}},function(t,e,n){var r=n(67),i=n(210),o=n(6),a=n(7).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){r.call(this);var e,n=t.mode.toLowerCase(),i=s[n];e=t.decrypt?"decrypt":"encrypt";var o=t.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==n&&"des-ede-cbc"!==n||(o=a.concat([o,o.slice(0,8)]));var u=t.iv;a.isBuffer(u)||(u=a.from(u)),this._des=i.create({key:o,iv:u,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=u,o(u,r),u.prototype._update=function(t){return a.from(this._des.update(t))},u.prototype._final=function(){return a.from(this._des.final())}},function(t,e,n){var r=n(739),i=n(209),o=n(208),a=n(724),s=n(147);function u(t,e,n){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,n);if(a[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,n);if(a[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");n=8*a[t].key,r=a[t].iv}var i=s(e,!1,n,r);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");n=8*a[t].key,r=a[t].iv}var i=s(e,!1,n,r);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},function(t,e,n){(function(e,r){var i,o=n(343),a=n(342),s=n(341),u=n(7).Buffer,c=e.crypto&&e.crypto.subtle,l={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},f=[];function d(t,e,n,r,i){return c.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(t){return c.deriveBits({name:"PBKDF2",salt:e,iterations:n,hash:{name:i}},t,r<<3)}).then(function(t){return u.from(t)})}t.exports=function(t,n,h,p,m,g){"function"==typeof m&&(g=m,m=void 0);var v=l[(m=m||"sha1").toLowerCase()];if(!v||"function"!=typeof e.Promise)return r.nextTick(function(){var e;try{e=s(t,n,h,p,m)}catch(t){return g(t)}g(null,e)});if(o(t,n,h,p),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");u.isBuffer(t)||(t=u.from(t,a)),u.isBuffer(n)||(n=u.from(n,a)),function(t,e){t.then(function(t){r.nextTick(function(){e(null,t)})},function(t){r.nextTick(function(){e(t)})})}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==f[t])return f[t];var n=d(i=i||u.alloc(8),i,10,128,t).then(function(){return!0}).catch(function(){return!1});return f[t]=n,n}(v).then(function(e){return e?d(t,n,h,p,v):s(t,n,h,p,m)}),g)}}).call(this,n(27),n(44))},function(t,e,n){t.exports=n(345)},function(t,e,n){"use strict";var r=n(6),i=n(7).Buffer,o=n(67),a=i.alloc(128),s=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>s?e=t(e):e.length<s&&(e=i.concat([e,a],s));for(var n=this._ipad=i.allocUnsafe(s),r=this._opad=i.allocUnsafe(s),u=0;u<s;u++)n[u]=54^e[u],r[u]=92^e[u];this._hash=[n]}r(u,o),u.prototype._update=function(t){this._hash.push(t)},u.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=u},function(t,e,n){var r=n(6),i=n(348),o=n(96),a=n(7).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},function(t,e,n){var r=n(6),i=n(349),o=n(96),a=n(7).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,n){var r=n(6),i=n(96),o=n(7).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<1|t>>>31}function l(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function d(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0;u<16;++u)e[u]=t.readInt32BE(4*u);for(;u<80;++u)e[u]=c(e[u-3]^e[u-8]^e[u-14]^e[u-16]);for(var h=0;h<80;++h){var p=~~(h/20),m=l(n)+d(p,r,i,o)+s+e[h]+a[p]|0;s=o,o=i,i=f(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,n){var r=n(6),i=n(96),o=n(7).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function l(t){return t<<30|t>>>2}function f(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0;u<16;++u)e[u]=t.readInt32BE(4*u);for(;u<80;++u)e[u]=e[u-3]^e[u-8]^e[u-14]^e[u-16];for(var d=0;d<80;++d){var h=~~(d/20),p=c(n)+f(h,r,i,o)+s+e[d]+a[h]|0;s=o,o=i,i=l(r),r=n,n=p}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,n){t.exports=n(215).PassThrough},function(t,e,n){t.exports=n(215).Transform},function(t,e,n){t.exports=n(75)},function(t,e,n){t.exports=n(214)},function(t,e,n){"use strict";t.exports=o;var r=n(350),i=n(121);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(6),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(27))},function(t,e){},function(t,e,n){"use strict";var r=n(7).Buffer,i=n(754);function o(t,e,n){t.copy(e,n)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e=r.allocUnsafe(t>>>0),n=this.head,i=0;n;)o(n.data,e,i),i+=n.data.length,n=n.next;return e},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i=1,o={},a=!1,s=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){l(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&l(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),r=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){l(t.data)},r=function(e){t.port2.postMessage(e)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var t=s.documentElement;r=function(e){var n=s.createElement("script");n.onreadystatechange=function(){l(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():r=function(t){setTimeout(l,0,t)},u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var a={callback:t,args:e};return o[i]=a,r(i),i++},u.clearImmediate=c}function c(t){delete o[t]}function l(t){if(a)setTimeout(l,0,t);else{var e=o[t];if(e){a=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{c(t),a=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(27),n(44))},function(t,e){e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=t[e+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=c}return(h?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[n+h]=255&a,h+=p,a/=256,c-=8);t[n+h-p]|=128*m}},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){for(var e,n=c(t),r=n[0],a=n[1],s=new o(3*(r+a)/4-a),u=0,l=a>0?r-4:r,f=0;f<l;f+=4)e=i[t.charCodeAt(f)]<<18|i[t.charCodeAt(f+1)]<<12|i[t.charCodeAt(f+2)]<<6|i[t.charCodeAt(f+3)],s[u++]=e>>16&255,s[u++]=e>>8&255,s[u++]=255&e;return 2===a&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,s[u++]=255&e),1===a&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e),s},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(f(t,a,a+16383>s?s:a+16383));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(l(r));return i.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e,n){var r=n(222),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,n){var r=n(76),i=n(152),o=n(760);t.exports=function(t){return function(e,n,a){var s,u=r(e),c=i(u.length),l=o(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){"use strict";var r=n(99),i=n(218),o=n(123),a=n(98),s=n(224),u=Object.assign;t.exports=!u||n(78)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=r})?function(t,e){for(var n=a(t),u=arguments.length,c=1,l=i.f,f=o.f;u>c;)for(var d,h=s(arguments[c++]),p=l?r(h).concat(l(h)):r(h),m=p.length,g=0;m>g;)f.call(h,d=p[g++])&&(n[d]=h[d]);return n}:u},function(t,e,n){var r=n(26);r(r.S+r.F,"Object",{assign:n(762)})},function(t,e,n){n(763),t.exports=n(19).Object.assign},function(t,e,n){"use strict";var r=D(n(101)),i=D(n(100)),o=I(n(2)),a=I(n(320)),s=D(n(513)),u=D(n(496)),c=D(n(472)),l=D(n(469)),f=D(n(464)),d=D(n(462)),h=D(n(264)),p=D(n(448)),m=D(n(445)),g=I(n(62)),v=D(n(443)),b=D(n(442)),y=D(n(440)),w=D(n(438)),x=D(n(418)),_=D(n(417)),k=D(n(416)),S=D(n(415)),E=n(414),O=D(n(413)),A=D(n(412)),C=D(n(409)),M=D(n(403)),N=D(n(402)),T=D(n(108));function I(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function D(t){return t&&t.__esModule?t:{default:t}}var j={charRNN:b.default,CVAE:_.default,DCGAN:k.default,featureExtractor:f.default,imageClassifier:u.default,kmeans:N.default,soundClassifier:c.default,pitchDetection:s.default,pix2pix:y.default,poseNet:m.default,sketchRNN:w.default,styleTransfer:v.default,word2vec:d.default,YOLO:h.default,objectDetector:p.default,uNet:x.default,sentiment:O.default,bodyPix:A.default,faceApi:M.default};t.exports=(0,i.default)({p5Utils:T.default},(0,S.default)(j),(0,r.default)({KNNClassifier:l.default},g,{tf:o,tfvis:a,version:E.version,neuralNetwork:C.default}))},function(t,e){t.exports=function(t,e){var n=e===Object(e)?function(t){return e[t]}:e;return function(e){return String(e).replace(t,n)}}},function(t,e,n){var r=n(3),i=n(766)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(t){return i(t)}})},function(t,e,n){n(767),t.exports=n(51).RegExp.escape},function(t,e,n){(function(e){!function(e){"use strict";var n,r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"==typeof t,l=e.regeneratorRuntime;if(l)c&&(t.exports=l);else{(l=e.regeneratorRuntime=c?t.exports:{}).wrap=w;var f="suspendedStart",d="suspendedYield",h="executing",p="completed",m={},g={};g[a]=function(){return this};var v=Object.getPrototypeOf,b=v&&v(v(T([])));b&&b!==r&&i.call(b,a)&&(g=b);var y=S.prototype=_.prototype=Object.create(g);k.prototype=y.constructor=S,S.constructor=k,S[u]=k.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===k||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(y),t},l.awrap=function(t){return{__await:t}},E(O.prototype),O.prototype[s]=function(){return this},l.AsyncIterator=O,l.async=function(t,e,n,r){var i=new O(w(t,e,n,r));return l.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},E(y),y[u]="Generator",y[a]=function(){return this},y.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=T,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return s.type="throw",s.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function w(t,e,n,r){var i=e&&e.prototype instanceof _?e:_,o=Object.create(i.prototype),a=new N(r||[]);return o._invoke=function(t,e,n){var r=f;return function(i,o){if(r===h)throw new Error("Generator is already running");if(r===p){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=A(a,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=x(t,e,n);if("normal"===u.type){if(r=n.done?p:d,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=p,n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function x(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function _(){}function k(){}function S(){}function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function O(t){function n(e,r,o,a){var s=x(t[e],t,r);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?Promise.resolve(c.__await).then(function(t){n("next",t,o,a)},function(t){n("throw",t,o,a)}):Promise.resolve(c).then(function(t){u.value=t,o(u)},a)}a(s.arg)}var r;"object"==typeof e.process&&e.process.domain&&(n=e.process.domain.bind(n)),this._invoke=function(t,e){function i(){return new Promise(function(r,i){n(t,e,r,i)})}return r=r?r.then(i,i):i()}}function A(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,A(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=x(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:I}}function I(){return{value:n,done:!0}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,n(27))},function(t,e,n){for(var r=n(233),i=n(86),o=n(34),a=n(8),s=n(35),u=n(103),c=n(15),l=c("iterator"),f=c("toStringTag"),d=u.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=i(h),m=0;m<p.length;m++){var g,v=p[m],b=h[v],y=a[v],w=y&&y.prototype;if(w&&(w[l]||s(w,l,d),w[f]||s(w,f,v),u[v]=d,b))for(g in r)w[g]||o(w,g,r[g],!0)}},function(t,e,n){var r=n(3),i=n(230);r(r.G+r.B,{setImmediate:i.set,clearImmediate:i.clear})},function(t,e,n){var r=n(8),i=n(3),o=n(158),a=[].slice,s=/MSIE .\./.test(o),u=function(t){return function(e,n){var r=arguments.length>2,i=!!r&&a.call(arguments,2);return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,n)}};i(i.G+i.B+i.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},function(t,e,n){"use strict";var r=n(3),i=n(8),o=n(51),a=n(229)(),s=n(15)("observable"),u=n(30),c=n(5),l=n(81),f=n(79),d=n(35),h=n(80),p=h.RETURN,m=function(t){return null==t?void 0:u(t)},g=function(t){var e=t._c;e&&(t._c=void 0,e())},v=function(t){return void 0===t._o},b=function(t){v(t)||(t._o=void 0,g(t))},y=function(t,e){c(t),this._c=void 0,this._o=t,t=new w(this);try{var n=e(t),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:u(n),this._c=n)}catch(e){return void t.error(e)}v(this)&&g(this)};y.prototype=f({},{unsubscribe:function(){b(this)}});var w=function(t){this._s=t};w.prototype=f({},{next:function(t){var e=this._s;if(!v(e)){var n=e._o;try{var r=m(n.next);if(r)return r.call(n,t)}catch(t){try{b(e)}finally{throw t}}}},error:function(t){var e=this._s;if(v(e))throw t;var n=e._o;e._o=void 0;try{var r=m(n.error);if(!r)throw t;t=r.call(n,t)}catch(t){try{g(e)}finally{throw t}}return g(e),t},complete:function(t){var e=this._s;if(!v(e)){var n=e._o;e._o=void 0;try{var r=m(n.complete);t=r?r.call(n,t):void 0}catch(t){try{g(e)}finally{throw t}}return g(e),t}}});var x=function(t){l(this,x,"Observable","_f")._f=u(t)};f(x.prototype,{subscribe:function(t){return new y(t,this._f)},forEach:function(t){var e=this;return new(o.Promise||i.Promise)(function(n,r){u(t);var i=e.subscribe({next:function(e){try{return t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:n})})}}),f(x,{from:function(t){var e="function"==typeof this?this:x,n=m(c(t)[s]);if(n){var r=c(n.call(t));return r.constructor===e?r:new e(function(t){return r.subscribe(t)})}return new e(function(e){var n=!1;return a(function(){if(!n){try{if(h(t,!1,function(t){if(e.next(t),n)return p})===p)return}catch(t){if(n)throw t;return void e.error(t)}e.complete()}}),function(){n=!0}})},of:function(){for(var t=0,e=arguments.length,n=new Array(e);t<e;)n[t]=arguments[t++];return new("function"==typeof this?this:x)(function(t){var e=!1;return a(function(){if(!e){for(var r=0;r<n.length;++r)if(t.next(n[r]),e)return;t.complete()}}),function(){e=!0}})}}),d(x.prototype,s,function(){return this}),r(r.G,{Observable:x}),n(82)("Observable")},function(t,e,n){var r=n(3),i=n(229)(),o=n(8).process,a="process"==n(49)(o);r(r.G,{asap:function(t){var e=a&&o.domain;i(e?e.bind(t):t)}})},function(t,e,n){var r=n(65),i=n(5),o=n(30),a=r.key,s=r.set;r.exp({metadata:function(t,e){return function(n,r){s(t,e,(void 0!==r?i:o)(n),a(r))}}})},function(t,e,n){var r=n(65),i=n(5),o=r.has,a=r.key;r.exp({hasOwnMetadata:function(t,e){return o(t,i(e),arguments.length<3?void 0:a(arguments[2]))}})},function(t,e,n){var r=n(65),i=n(5),o=n(39),a=r.has,s=r.key,u=function(t,e,n){if(a(t,e,n))return!0;var r=o(e);return null!==r&&u(t,r,n)};r.exp({hasMetadata:function(t,e){return u(t,i(e),arguments.length<3?void 0:s(arguments[2]))}})},function(t,e,n){var r=n(65),i=n(5),o=r.keys,a=r.key;r.exp({getOwnMetadataKeys:function(t){return o(i(t),arguments.length<2?void 0:a(arguments[1]))}})},function(t,e,n){var r=n(65),i=n(5),o=r.get,a=r.key;r.exp({getOwnMetadata:function(t,e){return o(t,i(e),arguments.length<3?void 0:a(arguments[2]))}})},function(t,e,n){var r=n(370),i=n(361),o=n(65),a=n(5),s=n(39),u=o.keys,c=o.key,l=function(t,e){var n=u(t,e),o=s(t);if(null===o)return n;var a=l(o,e);return a.length?n.length?i(new r(n.concat(a))):a:n};o.exp({getMetadataKeys:function(t){return l(a(t),arguments.length<2?void 0:c(arguments[1]))}})},function(t,e,n){var r=n(65),i=n(5),o=n(39),a=r.has,s=r.get,u=r.key,c=function(t,e,n){if(a(t,e,n))return s(t,e,n);var r=o(e);return null!==r?c(t,r,n):void 0};r.exp({getMetadata:function(t,e){return c(t,i(e),arguments.length<3?void 0:u(arguments[2]))}})},function(t,e,n){var r=n(65),i=n(5),o=r.key,a=r.map,s=r.store;r.exp({deleteMetadata:function(t,e){var n=arguments.length<3?void 0:o(arguments[2]),r=a(i(e),n,!1);if(void 0===r||!r.delete(t))return!1;if(r.size)return!0;var u=s.get(e);return u.delete(n),!!u.size||s.delete(e)}})},function(t,e,n){var r=n(65),i=n(5),o=r.key,a=r.set;r.exp({defineMetadata:function(t,e,n,r){a(t,e,i(n),o(r))}})},function(t,e,n){"use strict";var r=n(3),i=n(228),o=n(374);r(r.S,"Promise",{try:function(t){var e=i.f(this),n=o(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},function(t,e,n){"use strict";var r=n(3),i=n(51),o=n(8),a=n(128),s=n(373);r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return s(e,t()).then(function(){return n})}:t,n?function(n){return s(e,t()).then(function(){throw n})}:t)}})},function(t,e,n){var r=n(3);r(r.S,"Math",{signbit:function(t){return(t=+t)!=t?t:0==t?1/t==1/0:t>0}})},function(t,e,n){var r=n(3);r(r.S,"Math",{umulh:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r,a=n>>>16,s=r>>>16,u=(a*o>>>0)+(i*o>>>16);return a*s+(u>>>16)+((i*s>>>0)+(65535&u)>>>16)}})},function(t,e,n){var r=n(3);r(r.S,"Math",{scale:n(360)})},function(t,e,n){var r=n(3),i=Math.PI/180;r(r.S,"Math",{radians:function(t){return t*i}})},function(t,e,n){var r=n(3);r(r.S,"Math",{RAD_PER_DEG:180/Math.PI})},function(t,e,n){var r=n(3);r(r.S,"Math",{imulh:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r,a=n>>16,s=r>>16,u=(a*o>>>0)+(i*o>>>16);return a*s+(u>>16)+((i*s>>>0)+(65535&u)>>16)}})},function(t,e,n){var r=n(3);r(r.S,"Math",{isubh:function(t,e,n,r){var i=t>>>0,o=n>>>0;return(e>>>0)-(r>>>0)-((~i&o|~(i^o)&i-o>>>0)>>>31)|0}})},function(t,e,n){var r=n(3);r(r.S,"Math",{iaddh:function(t,e,n,r){var i=t>>>0,o=n>>>0;return(e>>>0)+(r>>>0)+((i&o|(i|o)&~(i+o>>>0))>>>31)|0}})},function(t,e,n){var r=n(3),i=n(360),o=n(381);r(r.S,"Math",{fscale:function(t,e,n,r,a){return o(i(t,e,n,r,a))}})},function(t,e,n){var r=n(3),i=180/Math.PI;r(r.S,"Math",{degrees:function(t){return t*i}})},function(t,e,n){var r=n(3);r(r.S,"Math",{DEG_PER_RAD:Math.PI/180})},function(t,e,n){var r=n(3);r(r.S,"Math",{clamp:function(t,e,n){return Math.min(n,Math.max(e,t))}})},function(t,e,n){var r=n(3),i=n(49);r(r.S,"Error",{isError:function(t){return"Error"===i(t)}})},function(t,e,n){var r=n(3);r(r.S,"System",{global:n(8)})},function(t,e,n){var r=n(3);r(r.G,{global:n(8)})},function(t,e,n){n(153)("WeakSet")},function(t,e,n){n(153)("WeakMap")},function(t,e,n){n(153)("Set")},function(t,e,n){n(153)("Map")},function(t,e,n){n(154)("WeakSet")},function(t,e,n){n(154)("WeakMap")},function(t,e,n){n(154)("Set")},function(t,e,n){n(154)("Map")},function(t,e,n){var r=n(3);r(r.P+r.R,"Set",{toJSON:n(362)("Set")})},function(t,e,n){var r=n(3);r(r.P+r.R,"Map",{toJSON:n(362)("Map")})},function(t,e,n){"use strict";var r=n(3),i=n(25),o=n(60),a=n(39),s=n(40).f;n(22)&&r(r.P+n(155),"Object",{__lookupSetter__:function(t){var e,n=i(this),r=o(t,!0);do{if(e=s(n,r))return e.set}while(n=a(n))}})},function(t,e,n){"use strict";var r=n(3),i=n(25),o=n(60),a=n(39),s=n(40).f;n(22)&&r(r.P+n(155),"Object",{__lookupGetter__:function(t){var e,n=i(this),r=o(t,!0);do{if(e=s(n,r))return e.get}while(n=a(n))}})},function(t,e,n){"use strict";var r=n(3),i=n(25),o=n(30),a=n(21);n(22)&&r(r.P+n(155),"Object",{__defineSetter__:function(t,e){a.f(i(this),t,{set:o(e),enumerable:!0,configurable:!0})}})},function(t,e,n){"use strict";var r=n(3),i=n(25),o=n(30),a=n(21);n(22)&&r(r.P+n(155),"Object",{__defineGetter__:function(t,e){a.f(i(this),t,{get:o(e),enumerable:!0,configurable:!0})}})},function(t,e,n){var r=n(3),i=n(363)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},function(t,e,n){var r=n(3),i=n(363)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},function(t,e,n){var r=n(3),i=n(366),o=n(41),a=n(40),s=n(237);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=o(t),u=a.f,c=i(r),l={},f=0;c.length>f;)void 0!==(n=u(r,e=c[f++]))&&s(l,e,n);return l}})},function(t,e,n){n(252)("observable")},function(t,e,n){n(252)("asyncIterator")},function(t,e,n){"use strict";var r=n(3),i=n(59),o=n(16),a=n(162),s=n(129),u=RegExp.prototype,c=function(t,e){this._r=t,this._s=e};n(241)(c,"RegExp String",function(){var t=this._r.exec(this._s);return{value:t,done:null===t}}),r(r.P,"String",{matchAll:function(t){if(i(this),!a(t))throw TypeError(t+" is not a regexp!");var e=String(this),n="flags"in u?String(t.flags):s.call(t),r=new RegExp(t.source,~n.indexOf("g")?n:"g"+n);return r.lastIndex=o(t.lastIndex),new c(r,e)}})},function(t,e,n){"use strict";n(104)("trimRight",function(t){return function(){return t(this,2)}},"trimEnd")},function(t,e,n){"use strict";n(104)("trimLeft",function(t){return function(){return t(this,1)}},"trimStart")},function(t,e,n){"use strict";var r=n(3),i=n(364),o=n(158);r(r.P+r.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(o),"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,e,n){"use strict";var r=n(3),i=n(364),o=n(158);r(r.P+r.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(o),"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,e,n){"use strict";var r=n(3),i=n(163)(!0);r(r.P,"String",{at:function(t){return i(this,t)}})},function(t,e,n){"use strict";var r=n(3),i=n(365),o=n(25),a=n(16),s=n(48),u=n(235);r(r.P,"Array",{flatten:function(){var t=arguments[0],e=o(this),n=a(e.length),r=u(e,0);return i(r,e,e,n,0,void 0===t?1:s(t)),r}}),n(69)("flatten")},function(t,e,n){"use strict";var r=n(3),i=n(365),o=n(25),a=n(16),s=n(30),u=n(235);r(r.P,"Array",{flatMap:function(t){var e,n,r=o(this);return s(t),e=a(r.length),n=u(r,0),i(n,r,r,e,0,1,t,arguments[1]),n}}),n(69)("flatMap")},function(t,e,n){"use strict";var r=n(3),i=n(166)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(69)("includes")},function(t,e,n){var r=n(3),i=n(248);i&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},function(t,e,n){var r=n(21),i=n(40),o=n(39),a=n(42),s=n(3),u=n(88),c=n(5),l=n(14);s(s.S,"Reflect",{set:function t(e,n,s){var f,d,h=arguments.length<4?e:arguments[3],p=i.f(c(e),n);if(!p){if(l(d=o(e)))return t(d,n,s,h);p=u(0)}if(a(p,"value")){if(!1===p.writable||!l(h))return!1;if(f=i.f(h,n)){if(f.get||f.set||!1===f.writable)return!1;f.value=s,r.f(h,n,f)}else r.f(h,n,u(0,s));return!0}return void 0!==p.set&&(p.set.call(h,s),!0)}})},function(t,e,n){var r=n(3),i=n(5),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},function(t,e,n){var r=n(3);r(r.S,"Reflect",{ownKeys:n(366)})},function(t,e,n){var r=n(3),i=n(5),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},function(t,e,n){var r=n(3);r(r.S,"Reflect",{has:function(t,e){return e in t}})},function(t,e,n){var r=n(3),i=n(39),o=n(5);r(r.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},function(t,e,n){var r=n(40),i=n(3),o=n(5);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(o(t),e)}})},function(t,e,n){var r=n(40),i=n(39),o=n(42),a=n(3),s=n(14),u=n(5);a(a.S,"Reflect",{get:function t(e,n){var a,c,l=arguments.length<3?e:arguments[2];return u(e)===l?e[n]:(a=r.f(e,n))?o(a,"value")?a.value:void 0!==a.get?a.get.call(l):void 0:s(c=i(e))?t(c,n,l):void 0}})},function(t,e,n){"use strict";var r=n(3),i=n(5),o=function(t){this._t=i(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)};n(241)(o,"Object",function(){var t,e=this._k;do{if(this._i>=e.length)return{value:void 0,done:!0}}while(!((t=e[this._i++])in this._t));return{value:t,done:!1}}),r(r.S,"Reflect",{enumerate:function(t){return new o(t)}})},function(t,e,n){var r=n(3),i=n(40).f,o=n(5);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=i(o(t),e);return!(n&&!n.configurable)&&delete t[e]}})},function(t,e,n){var r=n(21),i=n(3),o=n(5),a=n(60);i(i.S+i.F*n(13)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,n){o(t),e=a(e,!0),o(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},function(t,e,n){var r=n(3),i=n(84),o=n(30),a=n(5),s=n(14),u=n(13),c=n(388),l=(n(8).Reflect||{}).construct,f=u(function(){function t(){}return!(l(function(){},[],t)instanceof t)}),d=!u(function(){l(function(){})});r(r.S+r.F*(f||d),"Reflect",{construct:function(t,e){o(t),a(e);var n=arguments.length<3?t:o(arguments[2]);if(d&&!f)return l(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var u=n.prototype,h=i(s(u)?u:Object.prototype),p=Function.apply.call(t,h,e);return s(p)?p:h}})},function(t,e,n){var r=n(3),i=n(30),o=n(5),a=(n(8).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(13)(function(){a(function(){})}),"Reflect",{apply:function(t,e,n){var r=i(t),u=o(n);return a?a(r,e,u):s.call(r,e,u)}})},function(t,e,n){n(66)("Float64",8,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Float32",4,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Uint32",4,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Int32",4,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Uint16",2,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Int16",2,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Uint8",1,function(t){return function(e,n,r){return t(this,e,n,r)}},!0)},function(t,e,n){n(66)("Uint8",1,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){n(66)("Int8",1,function(t){return function(e,n,r){return t(this,e,n,r)}})},function(t,e,n){var r=n(3);r(r.G+r.W+r.F*!n(156).ABV,{DataView:n(227).DataView})},function(t,e,n){"use strict";var r=n(3),i=n(156),o=n(227),a=n(5),s=n(85),u=n(16),c=n(14),l=n(8).ArrayBuffer,f=n(128),d=o.ArrayBuffer,h=o.DataView,p=i.ABV&&l.isView,m=d.prototype.slice,g=i.VIEW;r(r.G+r.W+r.F*(l!==d),{ArrayBuffer:d}),r(r.S+r.F*!i.CONSTR,"ArrayBuffer",{isView:function(t){return p&&p(t)||c(t)&&g in t}}),r(r.P+r.U+r.F*n(13)(function(){return!new d(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(t,e){if(void 0!==m&&void 0===e)return m.call(a(this),t);for(var n=a(this).byteLength,r=s(t,n),i=s(void 0===e?n:e,n),o=new(f(this,d))(u(i-r)),c=new h(this),l=new h(o),p=0;r<i;)l.setUint8(p++,c.getUint8(r++));return o}}),n(82)("ArrayBuffer")},function(t,e,n){"use strict";var r=n(368),i=n(102);n(157)("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(i(this,"WeakSet"),t,!0)}},r,!1,!0)},function(t,e,n){"use strict";var r,i,o,a,s=n(70),u=n(8),c=n(50),l=n(105),f=n(3),d=n(14),h=n(30),p=n(81),m=n(80),g=n(128),v=n(230).set,b=n(229)(),y=n(228),w=n(374),x=n(158),_=n(373),k=u.TypeError,S=u.process,E=S&&S.versions,O=E&&E.v8||"",A=u.Promise,C="process"==l(S),M=function(){},N=i=y.f,T=!!function(){try{var t=A.resolve(1),e=(t.constructor={})[n(15)("species")]=function(t){t(M,M)};return(C||"function"==typeof PromiseRejectionEvent)&&t.then(M)instanceof e&&0!==O.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),I=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},D=function(t,e){if(!t._n){t._n=!0;var n=t._c;b(function(){for(var r=t._v,i=1==t._s,o=0,a=function(e){var n,o,a,s=i?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(i||(2==t._h&&F(t),t._h=1),!0===s?n=r:(l&&l.enter(),n=s(r),l&&(l.exit(),a=!0)),n===e.promise?c(k("Promise-chain cycle")):(o=I(n))?o.call(n,u,c):u(n)):c(r)}catch(t){l&&!a&&l.exit(),c(t)}};n.length>o;)a(n[o++]);t._c=[],t._n=!1,e&&!t._h&&j(t)})}},j=function(t){v.call(u,function(){var e,n,r,i=t._v,o=R(t);if(o&&(e=w(function(){C?S.emit("unhandledRejection",i,t):(n=u.onunhandledrejection)?n({promise:t,reason:i}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",i)}),t._h=C||R(t)?2:1),t._a=void 0,o&&e.e)throw e.v})},R=function(t){return 1!==t._h&&0===(t._a||t._c).length},F=function(t){v.call(u,function(){var e;C?S.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},P=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),D(e,!0))},z=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw k("Promise can't be resolved itself");(e=I(t))?b(function(){var r={_w:n,_d:!1};try{e.call(t,c(z,r,1),c(P,r,1))}catch(t){P.call(r,t)}}):(n._v=t,n._s=1,D(n,!1))}catch(t){P.call({_w:n,_d:!1},t)}}};T||(A=function(t){p(this,A,"Promise","_h"),h(t),r.call(this);try{t(c(z,this,1),c(P,this,1))}catch(t){P.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(79)(A.prototype,{then:function(t,e){var n=N(g(this,A));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=C?S.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&D(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r;this.promise=t,this.resolve=c(z,t,1),this.reject=c(P,t,1)},y.f=N=function(t){return t===A||t===a?new o(t):i(t)}),f(f.G+f.W+f.F*!T,{Promise:A}),n(106)(A,"Promise"),n(82)("Promise"),a=n(51).Promise,f(f.S+f.F*!T,"Promise",{reject:function(t){var e=N(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(s||!T),"Promise",{resolve:function(t){return _(s&&this===a?A:this,t)}}),f(f.S+f.F*!(T&&n(161)(function(t){A.all(t).catch(M)})),"Promise",{all:function(t){var e=this,n=N(e),r=n.resolve,i=n.reject,o=w(function(){var n=[],o=0,a=1;m(t,!1,function(t){var s=o++,u=!1;n.push(void 0),a++,e.resolve(t).then(function(t){u||(u=!0,n[s]=t,--a||r(n))},i)}),--a||r(n)});return o.e&&i(o.v),n.promise},race:function(t){var e=this,n=N(e),r=n.reject,i=w(function(){m(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(t,e,n){"use strict";var r=n(162),i=n(5),o=n(128),a=n(231),s=n(16),u=n(160),c=n(232),l=Math.min,f=[].push,d=!!function(){try{return new RegExp("x","y")}catch(t){}}();n(159)("split",2,function(t,e,n,h){var p;return p="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!r(t))return n.call(i,t,e);for(var o,a,s,u=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),d=0,h=void 0===e?4294967295:e>>>0,p=new RegExp(t.source,l+"g");(o=c.call(p,i))&&!((a=p.lastIndex)>d&&(u.push(i.slice(d,o.index)),o.length>1&&o.index<i.length&&f.apply(u,o.slice(1)),s=o[0].length,d=a,u.length>=h));)p.lastIndex===o.index&&p.lastIndex++;return d===i.length?!s&&p.test("")||u.push(""):u.push(i.slice(d)),u.length>h?u.slice(0,h):u}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,r){var i=t(this),o=void 0==n?void 0:n[e];return void 0!==o?o.call(n,i,r):p.call(String(i),n,r)},function(t,e){var r=h(p,t,this,e,p!==n);if(r.done)return r.value;var c=i(t),f=String(this),m=o(c,RegExp),g=c.unicode,v=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(d?"y":"g"),b=new m(d?c:"^(?:"+c.source+")",v),y=void 0===e?4294967295:e>>>0;if(0===y)return[];if(0===f.length)return null===u(b,f)?[f]:[];for(var w=0,x=0,_=[];x<f.length;){b.lastIndex=d?x:0;var k,S=u(b,d?f:f.slice(x));if(null===S||(k=l(s(b.lastIndex+(d?0:x)),f.length))===w)x=a(f,x,g);else{if(_.push(f.slice(w,x)),_.length===y)return _;for(var E=1;E<=S.length-1;E++)if(_.push(S[E]),_.length===y)return _;x=w=k}}return _.push(f.slice(w)),_}]})},function(t,e,n){"use strict";var r=n(5),i=n(389),o=n(160);n(159)("search",1,function(t,e,n,a){return[function(n){var r=t(this),i=void 0==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=a(n,t,this);if(e.done)return e.value;var s=r(t),u=String(this),c=s.lastIndex;i(c,0)||(s.lastIndex=0);var l=o(s,u);return i(s.lastIndex,c)||(s.lastIndex=c),null===l?-1:l.index}]})},function(t,e,n){"use strict";var r=n(5),i=n(25),o=n(16),a=n(48),s=n(231),u=n(160),c=Math.max,l=Math.min,f=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g,p=function(t){return void 0===t?t:String(t)};n(159)("replace",2,function(t,e,n,m){return[function(r,i){var o=t(this),a=void 0==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=m(n,t,this,e);if(i.done)return i.value;var f=r(t),d=String(this),h="function"==typeof e;h||(e=String(e));var v=f.global;if(v){var b=f.unicode;f.lastIndex=0}for(var y=[];;){var w=u(f,d);if(null===w)break;if(y.push(w),!v)break;""===String(w[0])&&(f.lastIndex=s(d,o(f.lastIndex),b))}for(var x="",_=0,k=0;k<y.length;k++){w=y[k];for(var S=String(w[0]),E=c(l(a(w.index),d.length),0),O=[],A=1;A<w.length;A++)O.push(p(w[A]));var C=w.groups;if(h){var M=[S].concat(O,E,d);void 0!==C&&M.push(C);var N=String(e.apply(void 0,M))}else N=g(S,d,E,O,C,e);E>=_&&(x+=d.slice(_,E)+N,_=E+S.length)}return x+d.slice(_)}];function g(t,e,r,o,a,s){var u=r+t.length,c=o.length,l=h;return void 0!==a&&(a=i(a),l=d),n.call(s,l,function(n,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(u);case"<":s=a[i.slice(1,-1)];break;default:var l=+i;if(0===l)return i;if(l>c){var d=f(l/10);return 0===d?i:d<=c?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):i}s=o[l-1]}return void 0===s?"":s})}})},function(t,e,n){"use strict";var r=n(5),i=n(16),o=n(231),a=n(160);n(159)("match",1,function(t,e,n,s){return[function(n){var r=t(this),i=void 0==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=s(n,t,this);if(e.done)return e.value;var u=r(t),c=String(this);if(!u.global)return a(u,c);var l=u.unicode;u.lastIndex=0;for(var f,d=[],h=0;null!==(f=a(u,c));){var p=String(f[0]);d[h]=p,""===p&&(u.lastIndex=o(c,i(u.lastIndex),l)),h++}return 0===h?null:d}]})},function(t,e,n){"use strict";n(375);var r=n(5),i=n(129),o=n(22),a=/./.toString,s=function(t){n(34)(RegExp.prototype,"toString",t,!0)};n(13)(function(){return"/a/b"!=a.call({source:"a",flags:"b"})})?s(function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)}):"toString"!=a.name&&s(function(){return a.call(this)})},function(t,e,n){var r=n(8),i=n(246),o=n(21).f,a=n(83).f,s=n(162),u=n(129),c=r.RegExp,l=c,f=c.prototype,d=/a/g,h=/a/g,p=new c(d)!==d;if(n(22)&&(!p||n(13)(function(){return h[n(15)("match")]=!1,c(d)!=d||c(h)==h||"/a/i"!=c(d,"i")}))){c=function(t,e){var n=this instanceof c,r=s(t),o=void 0===e;return!n&&r&&t.constructor===c&&o?t:i(p?new l(r&&!o?t.source:t,e):l((r=t instanceof c)?t.source:t,r&&o?u.call(t):e),n?this:f,c)};for(var m=function(t){t in c||o(c,t,{configurable:!0,get:function(){return l[t]},set:function(e){l[t]=e}})},g=a(l),v=0;g.length>v;)m(g[v++]);f.constructor=c,c.prototype=f,n(34)(r,"RegExp",c)}n(82)("RegExp")},function(t,e,n){n(82)("Array")},function(t,e,n){"use strict";var r=n(3),i=n(57)(6),o="findIndex",a=!0;o in[]&&Array(1)[o](function(){a=!1}),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(69)(o)},function(t,e,n){"use strict";var r=n(3),i=n(57)(5),o=!0;"find"in[]&&Array(1).find(function(){o=!1}),r(r.P+r.F*o,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(69)("find")},function(t,e,n){var r=n(3);r(r.P,"Array",{fill:n(234)}),n(69)("fill")},function(t,e,n){var r=n(3);r(r.P,"Array",{copyWithin:n(378)}),n(69)("copyWithin")},function(t,e,n){"use strict";var r=n(3),i=n(41),o=n(48),a=n(16),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(47)(s)),"Array",{lastIndexOf:function(t){if(u)return s.apply(this,arguments)||0;var e=i(this),n=a(e.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,o(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in e&&e[r]===t)return r||0;return-1}})},function(t,e,n){"use strict";var r=n(3),i=n(166)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(47)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(3),i=n(379);r(r.P+r.F*!n(47)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},function(t,e,n){"use strict";var r=n(3),i=n(379);r(r.P+r.F*!n(47)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},function(t,e,n){"use strict";var r=n(3),i=n(57)(4);r(r.P+r.F*!n(47)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(3),i=n(57)(3);r(r.P+r.F*!n(47)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(3),i=n(57)(2);r(r.P+r.F*!n(47)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(3),i=n(57)(1);r(r.P+r.F*!n(47)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(14),i=n(164),o=n(15)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){"use strict";var r=n(3),i=n(57)(0),o=n(47)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(3),i=n(30),o=n(25),a=n(13),s=[].sort,u=[1,2,3];r(r.P+r.F*(a(function(){u.sort(void 0)})||!a(function(){u.sort(null)})||!n(47)(s)),"Array",{sort:function(t){return void 0===t?s.call(o(this)):s.call(o(this),i(t))}})},function(t,e,n){"use strict";var r=n(3),i=n(249),o=n(49),a=n(85),s=n(16),u=[].slice;r(r.P+r.F*n(13)(function(){i&&u.call(i)}),"Array",{slice:function(t,e){var n=s(this.length),r=o(this);if(e=void 0===e?n:e,"Array"==r)return u.call(this,t,e);for(var i=a(t,n),c=a(e,n),l=s(c-i),f=new Array(l),d=0;d<l;d++)f[d]="String"==r?this.charAt(i+d):this[i+d];return f}})},function(t,e,n){"use strict";var r=n(3),i=n(41),o=[].join;r(r.P+r.F*(n(131)!=Object||!n(47)(o)),"Array",{join:function(t){return o.call(i(this),void 0===t?",":t)}})},function(t,e,n){"use strict";var r=n(3),i=n(237);r(r.S+r.F*n(13)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);e>t;)i(n,t,arguments[t++]);return n.length=e,n}})},function(t,e,n){"use strict";var r=n(50),i=n(3),o=n(25),a=n(380),s=n(238),u=n(16),c=n(237),l=n(236);i(i.S+i.F*!n(161)(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,i,f,d=o(t),h="function"==typeof this?this:Array,p=arguments.length,m=p>1?arguments[1]:void 0,g=void 0!==m,v=0,b=l(d);if(g&&(m=r(m,p>2?arguments[2]:void 0,2)),void 0==b||h==Array&&s(b))for(n=new h(e=u(d.length));e>v;v++)c(n,v,g?m(d[v],v):d[v]);else for(f=b.call(d),n=new h;!(i=f.next()).done;v++)c(n,v,g?a(f,m,[i.value,v],!0):i.value);return n.length=v,n}})},function(t,e,n){var r=n(3);r(r.S,"Array",{isArray:n(164)})},function(t,e,n){"use strict";var r=n(5),i=n(60);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),"number"!=t)}},function(t,e,n){var r=n(15)("toPrimitive"),i=Date.prototype;r in i||n(35)(i,r,n(883))},function(t,e,n){var r=Date.prototype,i=r.toString,o=r.getTime;new Date(NaN)+""!="Invalid Date"&&n(34)(r,"toString",function(){var t=o.call(this);return t==t?i.call(this):"Invalid Date"})},function(t,e,n){"use strict";var r=n(13),i=Date.prototype.getTime,o=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=r(function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-5e13-1))})||!r(function(){o.call(new Date(NaN))})?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:o},function(t,e,n){var r=n(3),i=n(886);r(r.P+r.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},function(t,e,n){"use strict";var r=n(3),i=n(25),o=n(60);r(r.P+r.F*n(13)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var e=i(this),n=o(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},function(t,e,n){var r=n(3);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,e,n){"use strict";n(33)("sup",function(t){return function(){return t(this,"sup","","")}})},function(t,e,n){"use strict";n(33)("sub",function(t){return function(){return t(this,"sub","","")}})},function(t,e,n){"use strict";n(33)("strike",function(t){return function(){return t(this,"strike","","")}})},function(t,e,n){"use strict";n(33)("small",function(t){return function(){return t(this,"small","","")}})},function(t,e,n){"use strict";n(33)("link",function(t){return function(e){return t(this,"a","href",e)}})},function(t,e,n){"use strict";n(33)("italics",function(t){return function(){return t(this,"i","","")}})},function(t,e,n){"use strict";n(33)("fontsize",function(t){return function(e){return t(this,"font","size",e)}})},function(t,e,n){"use strict";n(33)("fontcolor",function(t){return function(e){return t(this,"font","color",e)}})},function(t,e,n){"use strict";n(33)("fixed",function(t){return function(){return t(this,"tt","","")}})},function(t,e,n){"use strict";n(33)("bold",function(t){return function(){return t(this,"b","","")}})},function(t,e,n){"use strict";n(33)("blink",function(t){return function(){return t(this,"blink","","")}})},function(t,e,n){"use strict";n(33)("big",function(t){return function(){return t(this,"big","","")}})},function(t,e,n){"use strict";n(33)("anchor",function(t){return function(e){return t(this,"a","name",e)}})},function(t,e,n){"use strict";var r=n(3),i=n(16),o=n(240),a="".startsWith;r(r.P+r.F*n(239)("startsWith"),"String",{startsWith:function(t){var e=o(this,t,"startsWith"),n=i(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return a?a.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){var r=n(3);r(r.P,"String",{repeat:n(245)})},function(t,e,n){"use strict";var r=n(3),i=n(240);r(r.P+r.F*n(239)("includes"),"String",{includes:function(t){return!!~i(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){"use strict";var r=n(3),i=n(16),o=n(240),a="".endsWith;r(r.P+r.F*n(239)("endsWith"),"String",{endsWith:function(t){var e=o(this,t,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=i(e.length),s=void 0===n?r:Math.min(i(n),r),u=String(t);return a?a.call(e,u,s):e.slice(s-u.length,s)===u}})},function(t,e,n){"use strict";var r=n(3),i=n(163)(!1);r(r.P,"String",{codePointAt:function(t){return i(this,t)}})},function(t,e,n){"use strict";var r=n(163)(!0);n(242)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){"use strict";n(104)("trim",function(t){return function(){return t(this,3)}})},function(t,e,n){var r=n(3),i=n(41),o=n(16);r(r.S,"String",{raw:function(t){for(var e=i(t.raw),n=o(e.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(e[s++])),s<r&&a.push(String(arguments[s]));return a.join("")}})},function(t,e,n){var r=n(3),i=n(85),o=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,a=0;r>a;){if(e=+arguments[a++],i(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?o(e):o(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},function(t,e,n){var r=n(3);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,e,n){var r=n(3),i=n(243),o=Math.exp;r(r.S,"Math",{tanh:function(t){var e=i(t=+t),n=i(-t);return e==1/0?1:n==1/0?-1:(e-n)/(o(t)+o(-t))}})},function(t,e,n){var r=n(3),i=n(243),o=Math.exp;r(r.S+r.F*n(13)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},function(t,e,n){var r=n(3);r(r.S,"Math",{sign:n(244)})},function(t,e,n){var r=n(3);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,e,n){var r=n(3);r(r.S,"Math",{log1p:n(382)})},function(t,e,n){var r=n(3);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,e,n){var r=n(3),i=Math.imul;r(r.S+r.F*n(13)(function(){return-5!=i(4294967295,5)||2!=i.length}),"Math",{imul:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r;return 0|i*o+((65535&n>>>16)*o+i*(65535&r>>>16)<<16>>>0)}})},function(t,e,n){var r=n(3),i=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,o=0,a=0,s=arguments.length,u=0;a<s;)u<(n=i(arguments[a++]))?(o=o*(r=u/n)*r+1,u=n):o+=n>0?(r=n/u)*r:n;return u===1/0?1/0:u*Math.sqrt(o)}})},function(t,e,n){var r=n(3);r(r.S,"Math",{fround:n(381)})},function(t,e,n){var r=n(3),i=n(243);r(r.S+r.F*(i!=Math.expm1),"Math",{expm1:i})},function(t,e,n){var r=n(3),i=Math.exp;r(r.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},function(t,e,n){var r=n(3);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,e,n){var r=n(3),i=n(244);r(r.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,e,n){var r=n(3),i=Math.atanh;r(r.S+r.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,e,n){var r=n(3),i=Math.asinh;r(r.S+r.F*!(i&&1/i(0)>0),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},function(t,e,n){var r=n(3),i=n(382),o=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},function(t,e,n){var r=n(3),i=n(386);r(r.S+r.F*(Number.parseInt!=i),"Number",{parseInt:i})},function(t,e,n){var r=n(3),i=n(385);r(r.S+r.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},function(t,e,n){var r=n(3);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,e,n){var r=n(3);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,e,n){var r=n(3),i=n(383),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},function(t,e,n){var r=n(3);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,e,n){var r=n(3);r(r.S,"Number",{isInteger:n(383)})},function(t,e,n){var r=n(3),i=n(8).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},function(t,e,n){var r=n(3);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,e,n){"use strict";var r=n(3),i=n(13),o=n(384),a=1..toPrecision;r(r.P+r.F*(i(function(){return"1"!==a.call(1,void 0)})||!i(function(){a.call({})})),"Number",{toPrecision:function(t){var e=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},function(t,e,n){"use strict";var r=n(3),i=n(48),o=n(384),a=n(245),s=1..toFixed,u=Math.floor,c=[0,0,0,0,0,0],l="Number.toFixed: incorrect invocation!",f=function(t,e){for(var n=-1,r=e;++n<6;)r+=t*c[n],c[n]=r%1e7,r=u(r/1e7)},d=function(t){for(var e=6,n=0;--e>=0;)n+=c[e],c[e]=u(n/t),n=n%t*1e7},h=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==c[t]){var n=String(c[t]);e=""===e?n:e+a.call("0",7-n.length)+n}return e},p=function(t,e,n){return 0===e?n:e%2==1?p(t,e-1,n*t):p(t*t,e/2,n)};r(r.P+r.F*(!!s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(13)(function(){s.call({})})),"Number",{toFixed:function(t){var e,n,r,s,u=o(this,l),c=i(t),m="",g="0";if(c<0||c>20)throw RangeError(l);if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return String(u);if(u<0&&(m="-",u=-u),u>1e-21)if(n=(e=function(t){for(var e=0,n=u*p(2,69,1);n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}()-69)<0?u*p(2,-e,1):u/p(2,e,1),n*=4503599627370496,(e=52-e)>0){for(f(0,n),r=c;r>=7;)f(1e7,0),r-=7;for(f(p(10,r,1),0),r=e-1;r>=23;)d(1<<23),r-=23;d(1<<r),f(1,1),d(2),g=h()}else f(0,n),f(1<<-e,0),g=h()+a.call("0",c);return c>0?m+((s=g.length)<=c?"0."+a.call("0",c-s)+g:g.slice(0,s-c)+"."+g.slice(s-c)):m+g}})},function(t,e,n){"use strict";var r=n(8),i=n(42),o=n(49),a=n(246),s=n(60),u=n(13),c=n(83).f,l=n(40).f,f=n(21).f,d=n(104).trim,h=r.Number,p=h,m=h.prototype,g="Number"==o(n(84)(m)),v="trim"in String.prototype,b=function(t){var e=s(t,!1);if("string"==typeof e&&e.length>2){var n,r,i,o=(e=v?e.trim():d(e,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(e.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+e}for(var a,u=e.slice(2),c=0,l=u.length;c<l;c++)if((a=u.charCodeAt(c))<48||a>i)return NaN;return parseInt(u,r)}}return+e};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof h&&(g?u(function(){m.valueOf.call(n)}):"Number"!=o(n))?a(new p(b(e)),n,h):b(e)};for(var y,w=n(22)?c(p):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;w.length>x;x++)i(p,y=w[x])&&!i(h,y)&&f(h,y,l(p,y));h.prototype=m,m.constructor=h,n(34)(r,"Number",h)}},function(t,e,n){var r=n(3),i=n(385);r(r.G+r.F*(parseFloat!=i),{parseFloat:i})},function(t,e,n){var r=n(3),i=n(386);r(r.G+r.F*(parseInt!=i),{parseInt:i})},function(t,e,n){"use strict";var r=n(14),i=n(39),o=n(15)("hasInstance"),a=Function.prototype;o in a||n(21).f(a,o,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},function(t,e,n){var r=n(21).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||n(22)&&r(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},function(t,e,n){var r=n(3);r(r.P,"Function",{bind:n(388)})},function(t,e,n){"use strict";var r=n(105),i={};i[n(15)("toStringTag")]="z",i+""!="[object z]"&&n(34)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){var r=n(3);r(r.S,"Object",{setPrototypeOf:n(248).set})},function(t,e,n){var r=n(3);r(r.S,"Object",{is:n(389)})},function(t,e,n){var r=n(3);r(r.S+r.F,"Object",{assign:n(390)})},function(t,e,n){var r=n(14);n(58)("isExtensible",function(t){return function(e){return!!r(e)&&(!t||t(e))}})},function(t,e,n){var r=n(14);n(58)("isSealed",function(t){return function(e){return!r(e)||!!t&&t(e)}})},function(t,e,n){var r=n(14);n(58)("isFrozen",function(t){return function(e){return!r(e)||!!t&&t(e)}})},function(t,e,n){var r=n(14),i=n(71).onFreeze;n(58)("preventExtensions",function(t){return function(e){return t&&r(e)?t(i(e)):e}})},function(t,e,n){var r=n(14),i=n(71).onFreeze;n(58)("seal",function(t){return function(e){return t&&r(e)?t(i(e)):e}})},function(t,e,n){var r=n(14),i=n(71).onFreeze;n(58)("freeze",function(t){return function(e){return t&&r(e)?t(i(e)):e}})},function(t,e,n){n(58)("getOwnPropertyNames",function(){return n(391).f})},function(t,e,n){var r=n(25),i=n(86);n(58)("keys",function(){return function(t){return i(r(t))}})},function(t,e,n){var r=n(25),i=n(39);n(58)("getPrototypeOf",function(){return function(t){return i(r(t))}})},function(t,e,n){var r=n(41),i=n(40).f;n(58)("getOwnPropertyDescriptor",function(){return function(t,e){return i(r(t),e)}})},function(t,e,n){var r=n(3);r(r.S+r.F*!n(22),"Object",{defineProperties:n(392)})},function(t,e,n){var r=n(3);r(r.S+r.F*!n(22),"Object",{defineProperty:n(21).f})},function(t,e,n){var r=n(3);r(r.S,"Object",{create:n(84)})},function(t,e,n){var r=n(86),i=n(165),o=n(130);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,s=n(t),u=o.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},function(t,e,n){"use strict";var r=n(8),i=n(42),o=n(22),a=n(3),s=n(34),u=n(71).KEY,c=n(13),l=n(167),f=n(106),d=n(87),h=n(15),p=n(394),m=n(252),g=n(963),v=n(164),b=n(5),y=n(14),w=n(41),x=n(60),_=n(88),k=n(84),S=n(391),E=n(40),O=n(21),A=n(86),C=E.f,M=O.f,N=S.f,T=r.Symbol,I=r.JSON,D=I&&I.stringify,j=h("_hidden"),R=h("toPrimitive"),F={}.propertyIsEnumerable,P=l("symbol-registry"),z=l("symbols"),L=l("op-symbols"),B=Object.prototype,U="function"==typeof T,W=r.QObject,q=!W||!W.prototype||!W.prototype.findChild,V=o&&c(function(){return 7!=k(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=C(B,e);r&&delete B[e],M(t,e,n),r&&t!==B&&M(B,e,r)}:M,H=function(t){var e=z[t]=k(T.prototype);return e._k=t,e},$=U&&"symbol"==typeof T.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof T},G=function(t,e,n){return t===B&&G(L,e,n),b(t),e=x(e,!0),b(n),i(z,e)?(n.enumerable?(i(t,j)&&t[j][e]&&(t[j][e]=!1),n=k(n,{enumerable:_(0,!1)})):(i(t,j)||M(t,j,_(1,{})),t[j][e]=!0),V(t,e,n)):M(t,e,n)},K=function(t,e){b(t);for(var n,r=g(e=w(e)),i=0,o=r.length;o>i;)G(t,n=r[i++],e[n]);return t},X=function(t){var e=F.call(this,t=x(t,!0));return!(this===B&&i(z,t)&&!i(L,t))&&(!(e||!i(this,t)||!i(z,t)||i(this,j)&&this[j][t])||e)},Y=function(t,e){if(t=w(t),e=x(e,!0),t!==B||!i(z,e)||i(L,e)){var n=C(t,e);return!n||!i(z,e)||i(t,j)&&t[j][e]||(n.enumerable=!0),n}},J=function(t){for(var e,n=N(w(t)),r=[],o=0;n.length>o;)i(z,e=n[o++])||e==j||e==u||r.push(e);return r},Z=function(t){for(var e,n=t===B,r=N(n?L:w(t)),o=[],a=0;r.length>a;)!i(z,e=r[a++])||n&&!i(B,e)||o.push(z[e]);return o};U||(s((T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(n){this===B&&e.call(L,n),i(this,j)&&i(this[j],t)&&(this[j][t]=!1),V(this,t,_(1,n))};return o&&q&&V(B,t,{configurable:!0,set:e}),H(t)}).prototype,"toString",function(){return this._k}),E.f=Y,O.f=G,n(83).f=S.f=J,n(130).f=X,n(165).f=Z,o&&!n(70)&&s(B,"propertyIsEnumerable",X,!0),p.f=function(t){return H(h(t))}),a(a.G+a.W+a.F*!U,{Symbol:T});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Q.length>tt;)h(Q[tt++]);for(var et=A(h.store),nt=0;et.length>nt;)m(et[nt++]);a(a.S+a.F*!U,"Symbol",{for:function(t){return i(P,t+="")?P[t]:P[t]=T(t)},keyFor:function(t){if(!$(t))throw TypeError(t+" is not a symbol!");for(var e in P)if(P[e]===t)return e},useSetter:function(){q=!0},useSimple:function(){q=!1}}),a(a.S+a.F*!U,"Object",{create:function(t,e){return void 0===e?k(t):K(k(t),e)},defineProperty:G,defineProperties:K,getOwnPropertyDescriptor:Y,getOwnPropertyNames:J,getOwnPropertySymbols:Z}),I&&a(a.S+a.F*(!U||c(function(){var t=T();return"[null]"!=D([t])||"{}"!=D({a:t})||"{}"!=D(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(y(e)||void 0!==t)&&!$(t))return v(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!$(e))return e}),r[1]=e,D.apply(I,r)}}),T.prototype[R]||n(35)(T.prototype,R,T.prototype.valueOf),f(T,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){n(964),n(962),n(961),n(960),n(959),n(958),n(957),n(956),n(955),n(954),n(953),n(952),n(951),n(950),n(949),n(948),n(947),n(946),n(945),n(944),n(943),n(942),n(941),n(940),n(939),n(938),n(937),n(936),n(935),n(934),n(933),n(932),n(931),n(930),n(929),n(928),n(927),n(926),n(925),n(924),n(923),n(922),n(921),n(920),n(919),n(918),n(917),n(916),n(915),n(914),n(913),n(912),n(911),n(910),n(909),n(908),n(907),n(906),n(905),n(904),n(903),n(902),n(901),n(900),n(899),n(898),n(897),n(896),n(895),n(894),n(893),n(892),n(891),n(890),n(889),n(888),n(887),n(885),n(884),n(882),n(881),n(880),n(879),n(878),n(877),n(876),n(874),n(873),n(872),n(871),n(870),n(869),n(868),n(867),n(866),n(865),n(864),n(863),n(862),n(233),n(861),n(376),n(860),n(375),n(859),n(858),n(857),n(856),n(855),n(372),n(370),n(369),n(854),n(853),n(852),n(851),n(850),n(849),n(848),n(847),n(846),n(845),n(844),n(843),n(842),n(841),n(840),n(839),n(838),n(837),n(836),n(835),n(834),n(833),n(832),n(831),n(830),n(829),n(828),n(827),n(826),n(825),n(824),n(823),n(822),n(821),n(820),n(819),n(818),n(817),n(816),n(815),n(814),n(813),n(812),n(811),n(810),n(809),n(808),n(807),n(806),n(805),n(804),n(803),n(802),n(801),n(800),n(799),n(798),n(797),n(796),n(795),n(794),n(793),n(792),n(791),n(790),n(789),n(788),n(787),n(786),n(785),n(784),n(783),n(782),n(781),n(780),n(779),n(778),n(777),n(776),n(775),n(774),n(773),n(772),n(771),n(770),t.exports=n(51)},function(t,e,n){"use strict";(function(t){if(n(965),n(769),n(768),t._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");t._babelPolyfill=!0;var e="defineProperty";function r(t,n,r){t[n]||Object[e](t,n,{writable:!0,configurable:!0,value:r})}r(String.prototype,"padLeft","".padStart),r(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(t){[][t]&&r(Array,t,Function.call.bind([][t]))})}).call(this,n(27))},function(t,e,n){n(966),t.exports=n(765)}])});
//# sourceMappingURL=ml5.min.js.map