Last active
July 26, 2018 23:21
-
-
Save tado/6fe72d45649ee7d9c80c9bfd4a35366a to your computer and use it in GitHub Desktop.
ml5.js Feature Extractor Classify Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Image Classification using Feature Extraction with MobileNet. Built with p5.js</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.dom.min.js"></script> | |
<script src="ml5.min.js" type="text/javascript"></script> | |
<style> | |
button { | |
margin: 2px; | |
padding: 4px; | |
} | |
video { | |
width: 300; | |
height: 300; | |
} | |
p { | |
display: inline; | |
font-size: 14px; | |
} | |
h6 { | |
margin: 4px; | |
font-weight: lighter; | |
font-size: 14px; | |
margin-bottom: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>Feature ExtractionとMobileNetで画像をクラス分けしてみる</h2> | |
<h3>(猫か犬かの区別をニューラルネットで学習)</h3> | |
<div id="videoContainer"></div> | |
<h6><span id="modelStatus">Loading base model...</span></h6> | |
<p> | |
<button id="catButton">Add Cat Image</button> | |
<p> | |
<span id="amountOfCatImages">0</span> Cat Images</p> | |
<br> | |
<button id="dogButton">Add Dog Image</button> | |
<p> | |
<span id="amountOfDogImages">0</span> Dog Images</p> | |
</p> | |
<br/> | |
<p> | |
<button id="train">Train</button> | |
<span id="loss"></span> | |
</p> | |
<br/> | |
<p> | |
<button id="buttonPredict">Start guessing!</button> | |
<br> Your custom model labeled this as: | |
<span id="result">...</span> | |
</p> | |
<script src="sketch.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ml5=t():e.ml5=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=546)}([function(e,t,n){"use strict";n.r(t),n.d(t,"assertArgumentsAreTensors",function(){return o}),n.d(t,"shuffle",function(){return i}),n.d(t,"clamp",function(){return s}),n.d(t,"randUniform",function(){return u}),n.d(t,"distSquared",function(){return c}),n.d(t,"assert",function(){return l}),n.d(t,"assertShapesMatch",function(){return f}),n.d(t,"assertTypesMatch",function(){return p}),n.d(t,"flatten",function(){return h}),n.d(t,"inferShape",function(){return d}),n.d(t,"sizeFromShape",function(){return m}),n.d(t,"isScalarShape",function(){return g}),n.d(t,"arraysEqual",function(){return y}),n.d(t,"isInt",function(){return v}),n.d(t,"tanh",function(){return b}),n.d(t,"sizeToSquarishShape",function(){return w}),n.d(t,"createShuffledIndices",function(){return x}),n.d(t,"rightPad",function(){return k}),n.d(t,"repeatedTry",function(){return O}),n.d(t,"getQueryParams",function(){return S}),n.d(t,"inferFromImplicitShape",function(){return N}),n.d(t,"squeezeShape",function(){return E}),n.d(t,"getTypedArrayFromDType",function(){return I}),n.d(t,"isTensorInList",function(){return T}),n.d(t,"checkForNaN",function(){return A}),n.d(t,"flattenNameArrayMap",function(){return C}),n.d(t,"unflattenToNameArrayMap",function(){return P}),n.d(t,"hasEncodingLoss",function(){return _}),n.d(t,"copyTypedArray",function(){return R}),n.d(t,"isTypedArray",function(){return M}),n.d(t,"bytesPerElement",function(){return j}),n.d(t,"isFunction",function(){return D}),n.d(t,"extractTensorsFromContainer",function(){return L}),n.d(t,"extractTensorsFromAny",function(){return z});var r=n(6);function a(e,t,n){l(e instanceof r.a,"Argument '"+t+"' passed to '"+n+"' must be a Tensor, but got "+typeof e+".")}function o(e,t){var n=function(n){var r=e[n];Array.isArray(r)?r.forEach(function(e,r){a(e,n+"["+r+"]",t)}):a(r,n,t)};for(var r in e)n(r)}function i(e){for(var t=e.length,n=0,r=0;t>0;)r=Math.random()*t|0,n=e[--t],e[t]=e[r],e[r]=n}function s(e,t,n){return Math.max(e,Math.min(t,n))}function u(e,t){return Math.random()*(t-e)+e}function c(e,t){for(var n=0,r=0;r<e.length;r++){var a=Number(e[r])-Number(t[r]);n+=a*a}return n}function l(e,t){if(!e)throw new Error(t)}function f(e,t,n){void 0===n&&(n=""),l(y(e,t),n+" Shapes "+e+" and "+t+" must match")}function p(e,t){l(e.dtype===t.dtype," The dtypes of the first("+e.dtype+") and second("+t.dtype+") input must match")}function h(e,t){if(void 0===t&&(t=[]),Array.isArray(e))for(var n=0;n<e.length;++n)h(e[n],t);else t.push(e);return t}function d(e){if(M(e))return[e.length];if(!Array.isArray(e))return[];for(var t=[];e instanceof Array;)t.push(e.length),e=e[0];return t}function m(e){if(0===e.length)return 1;for(var t=e[0],n=1;n<e.length;n++)t*=e[n];return t}function g(e){return 0===e.length}function y(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function v(e){return e%1==0}function b(e){if(null!=Math.tanh)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;var t=Math.exp(2*e);return(t-1)/(t+1)}function w(e){for(var t=Math.floor(Math.sqrt(e));t>1;--t)if(e%t==0)return[t,e/t];return[1,e]}function x(e){for(var t=new Uint32Array(e),n=0;n<e;++n)t[n]=n;return i(t),t}function k(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function O(e,t,n){return void 0===t&&(t=function(e){return 0}),new Promise(function(r,a){var o=0,i=function(){if(e())r();else{var s=t(++o);null!=n&&o>=n?a():setTimeout(i,s)}};setTimeout(i,0)})}function S(e){var t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")}),t}function N(e,t){for(var n=1,r=-1,a=0;a<e.length;++a)if(e[a]>0)n*=e[a];else if(-1===e[a]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found - 1 at dim "+r+" and dim "+a);r=a}else if(e[a]<=0)throw Error("Shapes can not be <= 0. Found "+e[a]+" at dim "+a);if(-1===r){if(t>0&&t!==n)throw Error("Size("+t+") must match the product of shape "+e);return e}if(t%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+t+" / "+n);var o=e.slice();return o[r]=t/n,o}function E(e,t){for(var n=[],r=[],a=0,o=0;o<e.length;++o){if(null!=t){if(t[a]===o&&e[o]>1)throw new Error("Can't squeeze axis "+o+" since its dim '"+e[o]+"' is not 1");(null==t[a]||t[a]>o)&&1===e[o]&&(n.push(e[o]),r.push(o)),t[a]<=o&&a++}e[o]>1&&(n.push(e[o]),r.push(o))}return{newShape:n,keptDims:r}}function I(e,t){var n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else{if("bool"!==e)throw new Error("Unknown data type "+e);n=new Uint8Array(t)}return n}function T(e,t){for(var n=0;n<t.length;n++)if(t[n].id===e.id)return!0;return!1}function A(e,t,n){if("float32"===t)for(var r=0;r<e.length;r++)if(isNaN(e[r]))throw Error("The result of the '"+n+"' has NaNs.")}function C(e,t){var n=[];if(e instanceof r.a)n.push(e);else for(var a=e,o=0;o<t.length;o++)n.push(a[t[o]]);return n}function P(e,t){if(e.length!==t.length)throw new Error("Cannot unflatten Tensor[], keys and arrays are not of same length.");for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n}function _(e,t){return!("float32"===t||"int32"===t&&"float32"!==e||"bool"===t&&"bool"===e)}function R(e,t){if(null==t||"float32"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){for(var n=new Uint8Array(e.length),r=0;r<n.length;++r)0!==Math.round(e[r])&&(n[r]=1);return n}throw new Error("Unknown data type "+t)}function M(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array}function j(e){if("float32"===e||"int32"===e)return 4;if("bool"===e)return 1;throw new Error("Unknown dtype "+e)}function D(e){return!!(e&&e.constructor&&e.call&&e.apply)}function L(e){return z(e)}function z(e){if(null==e)return[];if(e instanceof r.a)return[e];var t,n=[],a=e;if(t=a,!Array.isArray(t)&&"object"!=typeof t)return[];for(var o in a){var i=h(a[o]).filter(function(e){return e instanceof r.a});n.push.apply(n,i)}return n}},function(e,t,n){"use strict";var r=n(9),a=n(2),o=n(3),i=n(0),s=n(11),u=n(4),c=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},l=function(){function e(){}return e.batchNormalization2d=function(t,n,r,a,o,s){return void 0===a&&(a=.001),i.assert(2===t.rank,"Error in batchNormalization3D: x must be rank 3 but got rank "+t.rank+"."),i.assert(2===n.rank||1===n.rank,"Error in batchNormalization2D: mean must be rank 2 or rank 1 but got rank "+n.rank+"."),i.assert(2===r.rank||1===r.rank,"Error in batchNormalization2D: variance must be rank 2 or rank 1 but got rank "+r.rank+"."),null!=o&&i.assert(2===o.rank||1===o.rank,"Error in batchNormalization2D: scale must be rank 2 or rank 1 but got rank "+o.rank+"."),null!=s&&i.assert(2===s.rank||1===s.rank,"Error in batchNormalization2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."),e.batchNormalization(t,n,r,a,o,s)},e.batchNormalization3d=function(t,n,r,a,o,s){return void 0===a&&(a=.001),i.assert(3===t.rank,"Error in batchNormalization3D: x must be rank 3 but got rank "+t.rank+"."),i.assert(3===n.rank||1===n.rank,"Error in batchNormalization3D: mean must be rank 3 or rank 1 but got rank "+n.rank+"."),i.assert(3===r.rank||1===r.rank,"Error in batchNormalization3D: variance must be rank 3 or rank 1 but got rank "+r.rank+"."),null!=o&&i.assert(3===o.rank||1===o.rank,"Error in batchNormalization3D: scale must be rank 3 or rank 1 but got rank "+o.rank+"."),null!=s&&i.assert(3===s.rank||1===s.rank,"Error in batchNormalization3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."),e.batchNormalization(t,n,r,a,o,s)},e.batchNormalization4d=function(t,n,r,a,o,s){return void 0===a&&(a=.001),i.assert(4===t.rank,"Error in batchNormalization4D: x must be rank 4 but got rank "+t.rank+"."),i.assert(4===n.rank||1===n.rank,"Error in batchNormalization4D: mean must be rank 4 or rank 1 but got rank "+n.rank+"."),i.assert(4===r.rank||1===r.rank,"Error in batchNormalization4D: variance must be rank 4 or rank 1 but got rank "+r.rank+"."),null!=o&&i.assert(4===o.rank||1===o.rank,"Error in batchNormalization4D: scale must be rank 4 or rank 1 but got rank "+o.rank+"."),null!=s&&i.assert(4===s.rank||1===s.rank,"Error in batchNormalization4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."),e.batchNormalization(t,n,r,a,o,s)},e.batchNormalization=function(e,t,n,a,u,c){var l;return void 0===a&&(a=.001),i.assertArgumentsAreTensors({x:e,mean:t,variance:n},"batchNormalization"),null!=u&&i.assertArgumentsAreTensors({scale:u},"batchNormalization"),null!=c&&i.assertArgumentsAreTensors({offset:c},"batchNormalization"),i.assert(t.rank===n.rank,"Batch normalization gradient requires mean and variance to have equal ranks."),i.assert(null==c||t.rank===c.rank,"Batch normalization gradient requires mean and offset to have equal ranks."),i.assert(null==u||t.rank===u.rank,"Batch normalization gradient requires mean and scale to have equal ranks."),l=0===e.rank||1===e.rank?e.as4D(1,1,1,e.size):2===e.rank?e.as4D(1,1,e.shape[0],e.shape[1]):3===e.rank?e.as4D(1,e.shape[0],e.shape[1],e.shape[2]):e,o.ENV.engine.runKernel(function(e){return e.batchNormalization(l,f(t),f(n),a,f(u),f(c))},{x:e,mean:t,variance:n,scale:u,offset:c},function(o){var i=null==u?r.a.scalar(1):u,c=Object(s.d)(t.shape,l.shape),f=[];if(1===t.rank){for(var p=0;p<l.shape.length-1;++p)f.push(l.shape[p]);f.push(1)}var h=e.sub(t),d=o.mul(i),m=Ft(n.add(r.a.scalar(a))),g=m.mul(m).mul(m).mul(r.a.scalar(-.5));return{x:function(){return 1===t.rank?o.mul(r.a.tile(m.as4D(1,1,1,t.shape[0]),f)).mul(i).reshape(e.shape):o.mul(m).mul(i).reshape(e.shape)},mean:function(){var e=m.mul(r.a.scalar(-1)).mul(d);return 1===t.rank&&(e=e.sum(c)),e.reshape(t.shape)},variance:function(){var e=g.mul(h).mul(d);return 1===t.rank&&(e=e.sum(c)),e.reshape(t.shape)},scale:function(){var e=h.mul(m),n=o.mul(e);return 1===t.rank&&(n=n.sum(c)),n.reshape(t.shape)},offset:function(){var e=o;return 1===t.rank&&(e=e.sum(c)),e.reshape(t.shape)}}}).reshape(e.shape)},c([u.a],e,"batchNormalization2d",null),c([u.a],e,"batchNormalization3d",null),c([u.a],e,"batchNormalization4d",null),c([Object(a.a)({heading:"Operations",subheading:"Normalization"})],e,"batchNormalization",null),e}();function f(e){return null==e?null:0===e.rank?e.as1D():1===e.rank?e:2===e.rank?e.as4D(1,1,e.shape[0],e.shape[1]):3===e.rank?e.as4D(1,e.shape[0],e.shape[1],e.shape[2]):e}var p=n(20),h=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},d=function(){function e(){}return e.add=function(e,t){i.assertArgumentsAreTensors({a:e,b:t},"add"),i.assertTypesMatch(e,t);var n=s.a(e.shape,t.shape);return o.ENV.engine.runKernel(function(n){return n.add(e,t)},{a:e,b:t},function(r){return{a:function(){var t=r,a=s.d(e.shape,n);return a.length>0&&(t=t.sum(a)),t.reshape(e.shape)},b:function(){var e=r,a=s.d(t.shape,n);return a.length>0&&(e=e.sum(a)),e.reshape(t.shape)}}})},e.addStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in addStrict: "),e.add(t)},e.sub=function(e,t){i.assertArgumentsAreTensors({a:e,b:t},"sub"),i.assertTypesMatch(e,t);var n=s.a(e.shape,t.shape);return o.ENV.engine.runKernel(function(n){return n.subtract(e,t)},{a:e,b:t},function(r){return{a:function(){var t=r,a=s.d(e.shape,n);return a.length>0&&(t=t.sum(a)),t.reshape(e.shape)},b:function(){var e=r,a=s.d(t.shape,n);return a.length>0&&(e=e.sum(a)),e.neg().reshape(t.shape)}}})},e.subStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in subStrict: "),e.sub(t)},e.pow=function(e,t){i.assertArgumentsAreTensors({base:e,exp:t},"pow");var n=s.a(e.shape,t.shape);return e=e.cast(Object(p.c)(e.dtype,t.dtype)),t=t.cast(Object(p.c)(e.dtype,t.dtype)),o.ENV.engine.runKernel(function(n,r){return r(n.pow(e,t))},{base:e,exp:t},function(r,a){var o=a[0];return{base:function(){var a=r.mul(t.toFloat().mul(o.div(e))),i=s.d(e.shape,n);return i.length>0&&(a=a.sum(i)),a.reshape(e.shape)},exp:function(){var a=r.mul(o.mul(e.log()).toFloat()),i=s.d(t.shape,n);return i.length>0&&(a=a.sum(i)),a.reshape(t.shape)}}})},e.powStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in powStrict: "),e.pow(t)},e.mul=function(e,t){i.assertArgumentsAreTensors({a:e,b:t},"mul"),i.assertTypesMatch(e,t);var n=s.a(e.shape,t.shape);return o.ENV.engine.runKernel(function(n){return n.multiply(e,t)},{a:e,b:t},function(r){return{a:function(){var a=r.mul(t.toFloat()),o=s.d(e.shape,n);return o.length>0?a.sum(o).reshape(e.shape):a},b:function(){var a=r.mul(e.toFloat()),o=s.d(t.shape,n);return o.length>0?a.sum(o).reshape(t.shape):a}}})},e.mulStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)},e.div=function(e,t){i.assertArgumentsAreTensors({a:e,b:t},"div"),i.assertTypesMatch(e,t);var n=s.a(e.shape,t.shape);return o.ENV.engine.runKernel(function(n){return n.divide(e,t)},{a:e,b:t},function(r){return{a:function(){var a=r.div(t.toFloat()),o=s.d(e.shape,n);return o.length>0?a.sum(o).reshape(e.shape):a},b:function(){var a=r.mul(e.toFloat()),o=s.d(t.shape,n);o.length>0&&(a=a.sum(o).reshape(t.shape));var i=t.square();return a.div(i.toFloat()).neg()}}})},e.divStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in divideStrict: "),e.div(t)},e.mod=function(e,t){i.assertArgumentsAreTensors({a:e,b:t},"mod"),i.assertTypesMatch(e,t);var n=s.a(e.shape,t.shape);return o.ENV.engine.runKernel(function(n){return n.mod(e,t)},{a:e,b:t},function(r){return{a:function(){var t=s.d(e.shape,n);return t.length>0?r.sum(t).reshape(e.shape):r},b:function(){var a=r.mul(e.div(t).floor().neg()),o=s.d(t.shape,n);return o.length>0?a.sum(o).reshape(t.shape):a}}})},e.modStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in modStrict: "),e.mod(t)},e.minimum=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"minimum"),i.assertTypesMatch(e,t),"bool"===e.dtype&&(e=e.toInt()),"bool"===t.dtype&&(t=t.toInt()),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.minimum(e,t)},{a:e,b:t},function(n){return{a:function(){return n.mul(e.lessEqual(t).toFloat())},b:function(){return n.mul(e.greater(t).toFloat())}}})},e.minimumStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)},e.maximum=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"maximum"),i.assertTypesMatch(e,t),"bool"===e.dtype&&(e=e.toInt()),"bool"===t.dtype&&(t=t.toInt()),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.maximum(e,t)},{a:e,b:t},function(n){return{a:function(){return n.mul(e.greaterEqual(t).toFloat())},b:function(){return n.mul(e.less(t).toFloat())}}})},e.maximumStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in minimumStrict: "),e.maximum(t)},e.squaredDifference=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"squaredDifference"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.squaredDifference(e,t)},{a:e,b:t},function(n){var r=Dn(2);return{a:function(){return n.mul(e.sub(t).mul(r))},b:function(){return n.mul(t.sub(e).mul(r))}}})},e.squaredDifferenceStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)},e.atan2=function(t,n){i.assertArgumentsAreTensors({a:t,b:n},"atan2"),i.assertTypesMatch(t,n);var r=s.a(t.shape,n.shape);return o.ENV.engine.runKernel(function(e){return e.atan2(t,n)},{a:t,b:n},function(a){return{a:function(){var o=e.add(Bt(t),Bt(n)),i=a.mul(n.div(o)),u=s.d(t.shape,r);return u.length>0&&(i=i.sum(u)),i.reshape(t.shape)},b:function(){var o=e.add(Bt(t),Bt(n)),i=Tt(a.mul(t.div(o))),u=s.d(n.shape,r);return u.length>0&&(i=i.sum(u)),i.reshape(n.shape)}}})},h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"add",null),h([u.a],e,"addStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"sub",null),h([u.a],e,"subStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"pow",null),h([u.a],e,"powStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"mul",null),h([u.a],e,"mulStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"div",null),h([u.a],e,"divStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"mod",null),h([u.a],e,"modStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"minimum",null),h([u.a],e,"minimumStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"maximum",null),h([u.a],e,"maximumStrict",null),h([Object(a.a)({heading:"Operations",subheading:"Arithmetic"}),u.a],e,"squaredDifference",null),h([u.a],e,"squaredDifferenceStrict",null),h([u.a],e,"atan2",null),e}(),m=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},g=function(){function e(){}return e.notEqual=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"notEqual"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.notEqual(e,t)},{a:e,b:t})},e.notEqualStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in notEqualStrict: "),e.notEqual(t)},e.less=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"less"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.less(e,t)},{a:e,b:t})},e.lessStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in lessStrict: "),e.less(t)},e.equal=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"equal"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.equal(e,t)},{a:e,b:t})},e.equalStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in equalStrict: "),e.equal(t)},e.lessEqual=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"lessEqual"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.lessEqual(e,t)},{a:e,b:t})},e.lessEqualStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in lessEqualStrict: "),e.lessEqual(t)},e.greater=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"greater"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.greater(e,t)},{a:e,b:t})},e.greaterStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in greaterStrict: "),e.greater(t)},e.greaterEqual=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"greaterEqual"),i.assertTypesMatch(e,t),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.greaterEqual(e,t)},{a:e,b:t})},e.greaterEqualStrict=function(e,t){return i.assertShapesMatch(e.shape,t.shape,"Error in greaterEqualStrict: "),e.greaterEqual(t)},m([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"notEqual",null),m([u.a],e,"notEqualStrict",null),m([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"less",null),m([u.a],e,"lessStrict",null),m([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"equal",null),m([u.a],e,"equalStrict",null),m([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"lessEqual",null),m([u.a],e,"lessEqualStrict",null),m([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"greater",null),m([u.a],e,"greaterStrict",null),m([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"greaterEqual",null),m([u.a],e,"greaterEqualStrict",null),e}(),y=n(59);function v(e,t,n,r,a,o){void 0===o&&(o="channelsLast");var i,s=w(t),u=s[0],c=s[1];if("channelsLast"===o)i=[u,c,e[3],e[3]];else{if("channelsFirst"!==o)throw new Error("Unknown dataFormat "+o);i=[u,c,e[1],e[1]]}return b(e,i,n,1,r,a,!1,o)}function b(e,t,n,r,a,o,s,u){void 0===s&&(s=!1),void 0===u&&(u="channelsLast");var c=[-1,-1,-1,-1],l=c[0],f=c[1],p=c[2],h=c[3];if("channelsLast"===u)l=e[0],f=e[1],p=e[2],h=e[3];else{if("channelsFirst"!==u)throw new Error("Unknown dataFormat "+u);l=e[0],h=e[1],f=e[2],p=e[3]}var d,m=t[0],g=t[1],y=t[3],v=w(n),b=v[0],O=v[1],S=w(r),N=S[0],E=S[1],I=function(e,t,n,r,a,o,s,u){var c,l,f;if("number"==typeof e){c={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};var p=function(e,t,n,r,a,o){null==a&&(a=function(e,t,n,r){void 0===r&&(r=1);var a=x(t,r);return Math.floor((e[0]*(n-1)-n+a)/2)}(e,t,r));var s=e[1],u=k((e[0]-t+2*a)/r+1,o);i.assert(i.isInt(u),"The output # of rows ("+u+") must be an integer. Change the stride and/or zero pad parameters");var c=k((s-t+2*a)/r+1,o);return i.assert(i.isInt(c),"The output # of columns ("+c+") must be an integer. Change the stride and/or zero pad parameters"),[u,c,1]}([t,n,1],o,0,r,e,u);l=p[0],f=p[1]}else if("same"===e){var h=((l=Math.ceil(t/r))-1)*r+o-t,d=((f=Math.ceil(n/a))-1)*a+s-n,m=Math.floor(h/2),g=h-m,y=Math.floor(d/2);c={top:m,bottom:g,left:y,right:d-y,type:"SAME"}}else{if("valid"!==e)throw Error("Unknown padding parameter: "+e);c={top:0,bottom:0,left:0,right:0,type:"VALID"},l=Math.ceil((t-o+1)/r),f=Math.ceil((n-s+1)/a)}return{padInfo:c,outHeight:l,outWidth:f}}(a,f,p,b,O,x(m,N),x(g,E),o),T=I.padInfo,A=I.outHeight,C=I.outWidth,P=s?y*h:y;return"channelsFirst"===u?d=[l,P,A,C]:"channelsLast"===u&&(d=[l,A,C,P]),{batchSize:l,dataFormat:u,inHeight:f,inWidth:p,inChannels:h,outHeight:A,outWidth:C,outChannels:P,padInfo:T,strideHeight:b,strideWidth:O,filterHeight:m,filterWidth:g,dilationHeight:N,dilationWidth:E,inShape:e,outShape:d,filterShape:t}}function w(e){return"number"==typeof e?[e,e]:e}function x(e,t){return t<=1?e:e+(e-1)*(t-1)}function k(e,t){if(!t)return e;switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error("Unknown roundingMode "+t)}}var O=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},S=function(){function e(){}return e.conv1d=function(t,n,r,a,o,s,u){void 0===o&&(o="NWC"),void 0===s&&(s=1),i.assertArgumentsAreTensors({x:t,filter:n},"conv1d");var c=t,l=!1;2===t.rank&&(l=!0,c=t.as3D(1,t.shape[0],t.shape[1])),i.assert(3===c.rank,"Error in conv1d: input must be rank 3, but got rank "+c.rank+"."),i.assert(3===n.rank,"Error in conv1d: filter must be rank 3, but got rank "+n.rank+"."),null!=u&&i.assert(i.isInt(a),"Error in conv1d: pad must be an integer when using, dimRoundingMode "+u+" but got pad "+a+"."),i.assert(c.shape[2]===n.shape[1],"Error in conv1d: depth of input ("+c.shape[2]+") must match input depth for filter "+n.shape[1]+"."),i.assert(E(r,s),"Error in conv1D: Either stride or dilation must be 1. Got stride "+r+" and dilation '"+s+"'"),i.assert("NWC"===o,"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported.");var f=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]),p=c.as4D(c.shape[0],1,c.shape[1],c.shape[2]),h=[1,r],d=[1,s],m=e.conv2d(p,f,h,a,"NHWC",d,u);return l?m.as2D(m.shape[2],m.shape[3]):m.as3D(m.shape[0],m.shape[2],m.shape[3])},e.conv2d=function(t,n,r,a,s,u,c){void 0===s&&(s="NHWC"),void 0===u&&(u=[1,1]),i.assertArgumentsAreTensors({x:t,filter:n},"conv2d");var l=t,f=!1;3===t.rank&&(f=!0,l=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),i.assert(4===l.rank,"Error in conv2d: input must be rank 4, but got rank "+l.rank+"."),i.assert(4===n.rank,"Error in conv2d: filter must be rank 4, but got rank "+n.rank+"."),null!=c&&i.assert(i.isInt(a),"Error in conv2d: pad must be an integer when using, dimRoundingMode "+c+" but got pad "+a+"."),i.assert(l.shape[3]===n.shape[2],"Error in conv2d: depth of input ("+l.shape[3]+") must match input depth for filter "+n.shape[2]+"."),i.assert(E(r,u),"Error in conv2D: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+u+"'"),i.assert("NHWC"===s,"Error in conv2d: got dataFormat of "+s+" but only NHWC is currently supported.");var p=b(l.shape,n.shape,r,u,a,c),h=o.ENV.engine.runKernel(function(e){return e.conv2d(l,n,p)},{x:l,filter:n},function(t){return i.assert(N(u),"Error in gradient of conv2D: dilation rates greater than 1 are notyet supported in gradients. Got dilations '"+u+"'"),{x:function(){return e.conv2dDerInput(l.shape,t,n,r,a)},filter:function(){return e.conv2dDerFilter(l,t,n.shape,r,a)}}});return f?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h},e.conv2dDerInput=function(e,t,n,r,a,s){i.assertArgumentsAreTensors({dy:t,filter:n},"conv2dDerInput"),i.assert(e.length===t.rank,"Length of inShape ("+e.length+") and rank of dy ("+t.rank+") must match");var u=e,c=t,l=!1;3===t.rank&&(l=!0,c=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]),u=[1,e[0],e[1],e[2]]);var f=u[3],p=c.shape[3];i.assert(4===u.length,"Error in conv2dDerInput: inShape must be length 4, but got length "+u.length+"."),i.assert(4===c.rank,"Error in conv2dDerInput: dy must be rank 4, but got rank "+c.rank),i.assert(4===n.rank,"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank),i.assert(f===n.shape[2],"Error in conv2dDerInput: depth of input ("+f+") must match input depth for filter "+n.shape[2]+"."),i.assert(p===n.shape[3],"Error in conv2dDerInput: depth of output ("+p+") must match output depth for filter "+n.shape[3]+"."),null!=s&&i.assert(i.isInt(a),"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+".");var h=b(u,n.shape,r,1,a,s),d=o.ENV.engine.runKernel(function(e){return e.conv2dDerInput(c,n,h)},{dy4D:c});return l?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d},e.conv2dDerFilter=function(e,t,n,r,a,s){i.assertArgumentsAreTensors({x:e,dy:t},"conv2dDerFilter");var u=e;3===e.rank&&(u=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var c=t;3===c.rank&&(c=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),i.assert(4===u.rank,"Error in conv2dDerFilter: input must be rank 4, but got shape "+u.shape+"."),i.assert(4===c.rank,"Error in conv2dDerFilter: dy must be rank 4, but got shape "+c.shape+"."),i.assert(4===n.length,"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."),i.assert(u.shape[3]===n[2],"Error in conv2dDerFilter: depth of input "+u.shape[3]+") must match input depth in filter ("+n[2]+"."),i.assert(c.shape[3]===n[3],"Error in conv2dDerFilter: depth of dy ("+c.shape[3]+") must match output depth for filter ("+n[3]+")."),null!=s&&i.assert(i.isInt(a),"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+".");var l=b(u.shape,n,r,1,a,s);return o.ENV.engine.runKernel(function(e){return e.conv2dDerFilter(u,c,l)},{x4D:u,dy4D:c})},e.conv2dTranspose=function(t,n,r,a,o,s){return i.assertArgumentsAreTensors({x:t,filter:n},"conv2dTranspose"),e.conv2dDerInput(r,t,n,a,o,s)},e.depthwiseConv2d=function(e,t,n,r,a,s,u){void 0===a&&(a="NHWC"),void 0===s&&(s=[1,1]),i.assertArgumentsAreTensors({x:e,filter:t},"depthwiseConv2d");var c=e,l=!1;3===e.rank&&(l=!0,c=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),i.assert(4===c.rank,"Error in depthwiseConv2d: input must be rank 4, but got rank "+c.rank+"."),i.assert(4===t.rank,"Error in depthwiseConv2d: filter must be rank 4, but got rank "+t.rank+"."),i.assert(c.shape[3]===t.shape[2],"Error in depthwiseConv2d: number of input channels ("+c.shape[3]+") must match the inChannels dimension in filter "+t.shape[2]+"."),null==s&&(s=[1,1]),i.assert(E(n,s),"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+s+"'"),null!=u&&i.assert(i.isInt(r),"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+u+" but got pad "+r+".");var f=b(c.shape,t.shape,n,s,r,u,!0),p=o.ENV.engine.runKernel(function(e){return e.depthwiseConv2D(c,t,f)},{x:c,filter:t},function(e){return i.assert(N(s),"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+s+"'"),{x:function(){return function(e,t,n,r){var a=t,i=!1;3===t.rank&&(i=!0,a=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var s=o.ENV.engine.runKernel(function(e){return e.depthwiseConv2DDerInput(a,n,r)},{dy4D:a});return i?s.as3D(s.shape[1],s.shape[2],s.shape[3]):s}(c.shape,e,t,f)},filter:function(){return function(e,t,n,r){var a=e;3===e.rank&&(a=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var i=t;return 3===i.rank&&(i=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),o.ENV.engine.runKernel(function(e){return e.depthwiseConv2DDerFilter(a,i,r)},{x4D:a,dy4D:i})}(c,e,t.shape,f)}}});return l?p.as3D(p.shape[1],p.shape[2],p.shape[3]):p},e.separableConv2d=function(t,n,r,a,o,s,u){void 0===s&&(s=[1,1]),void 0===u&&(u="NHWC"),i.assertArgumentsAreTensors({x:t,depthwiseFilter:n,pointwiseFilter:r},"separableConv2d");var c=t,l=!1;if(3===t.rank&&(l=!0,c=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),"NCHW"===u)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");i.assert(4===c.rank,"Error in separableConv2d: input must be rank 4, but got rank "+c.rank+"."),i.assert(4===n.rank,"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+n.rank+"."),i.assert(4===r.rank,"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+n.rank+"."),i.assert(1===r.shape[0],"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+r.shape[0]+"."),i.assert(1===r.shape[1],"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+r.shape[1]+".");var f=n.shape[2],p=n.shape[3];i.assert(r.shape[2]===f*p,"Error in separableConv2d: the third dimension of pointwise filter must be "+f*p+", but got "+r.shape[2]+".");var h=e.depthwiseConv2d(c,n,a,o,u,s),d=e.conv2d(h,r,1,"valid",u);return l?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d},O([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"conv1d",null),O([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"conv2d",null),O([u.a],e,"conv2dDerInput",null),O([u.a],e,"conv2dDerFilter",null),O([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"conv2dTranspose",null),O([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"depthwiseConv2d",null),O([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"separableConv2d",null),e}();function N(e){var t=function(e){return"number"==typeof e?[e,e]:e}(e),n=t[0],r=t[1];return 1===n&&1===r}function E(e,t){return N(e)||N(t)}var I=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},T=function(){function e(){}return e.resizeBilinear=function(e,t,n){void 0===n&&(n=!1),i.assertArgumentsAreTensors({images:e},"resizeBilinear"),i.assert(3===e.rank||4===e.rank,"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+e.rank+"."),i.assert(2===t.length,"Error in resizeBilinear: new shape must 2D, but got shape "+t+".");var r=e,a=!1;3===e.rank&&(a=!0,r=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=t[0],u=t[1],c=o.ENV.engine.runKernel(function(e,t){return e.resizeBilinear(r,s,u,n)},{batchImages:r},function(e,t){return{batchImages:function(){return o.ENV.engine.runKernel(function(t){return t.resizeBilinearBackprop(e,r,n)},{})}}});return a?c.as3D(c.shape[1],c.shape[2],c.shape[3]):c},e.resizeNearestNeighbor=function(e,t,n){void 0===n&&(n=!1),i.assertArgumentsAreTensors({images:e},"resizeNearestNeighbor"),i.assert(3===e.rank||4===e.rank,"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+e.rank+"."),i.assert(2===t.length,"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+t+"."),i.assert("float32"===e.dtype||"int32"===e.dtype,"`images` must have `int32` or `float32` as dtype");var r=e,a=!1;3===e.rank&&(a=!0,r=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=t[0],u=t[1],c=o.ENV.engine.runKernel(function(e){return e.resizeNearestNeighbor(r,s,u,n)},{batchImages:r});return a?c.as3D(c.shape[1],c.shape[2],c.shape[3]):c},I([Object(a.a)({heading:"Operations",subheading:"Images",namespace:"image"}),u.a],e,"resizeBilinear",null),I([Object(a.a)({heading:"Operations",subheading:"Images",namespace:"image"}),u.a],e,"resizeNearestNeighbor",null),e}(),A=n(77),C=function(){function e(){}return e.gramSchmidt=function(e){var t;if(Array.isArray(e)){t=!1,Object(i.assert)(null!=e&&e.length>0,"Gram-Schmidt process: input must not be null, undefined, or empty");for(var n=e[0].shape[0],r=1;r<e.length;++r)Object(i.assert)(e[r].shape[0]===n,"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+e[r].shape[0]+" vs. "+n+")")}else t=!0,e=qn(e,e.shape[0],0).map(function(e){return In(e,[0])});Object(i.assert)(e.length<=e[0].shape[0],"Gram-Schmidt: Number of vectors ("+e.length+") exceeds number of dimensions ("+e[0].shape[0]+").");var a=[],o=e,s=function(e){a.push(A.a.tidy(function(){var t=o[e];if(e>0)for(var n=0;n<e;++n){var r=We(a[n].mulStrict(t)).mul(a[n]);t=t.sub(r)}return t.div(fn(t,"euclidean"))}))};for(r=0;r<e.length;++r)s(r);return t?Wn(a,0):a},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Operations",subheading:"Linear Algebra"}),u.a],e,"gramSchmidt",null),e}(),P=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},_=function(){function e(){}return e.logicalNot=function(e){return i.assertArgumentsAreTensors({x:e},"logicalNot"),i.assert("bool"===e.dtype,"Error Array must be of type bool."),o.ENV.engine.runKernel(function(t){return t.logicalNot(e)},{x:e})},e.logicalAnd=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"logicalAnd"),i.assert("bool"===e.dtype&&"bool"===t.dtype,"Error Array must be of type bool."),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.logicalAnd(e,t)},{a:e,b:t})},e.logicalOr=function(e,t){return i.assertArgumentsAreTensors({a:e,b:t},"logicalOr"),i.assert("bool"===e.dtype&&"bool"===t.dtype,"Error Array must be of type bool."),s.a(e.shape,t.shape),o.ENV.engine.runKernel(function(n){return n.logicalOr(e,t)},{a:e,b:t})},e.logicalXor=function(t,n){return i.assertArgumentsAreTensors({a:t,b:n},"logicalXor"),i.assert("bool"===t.dtype&&"bool"===n.dtype,"Error Array must be of type bool."),s.a(t.shape,n.shape),e.logicalOr(t,n).logicalAnd(e.logicalAnd(t,n).logicalNot())},e.where=function(e,t,n){i.assertArgumentsAreTensors({condition:e,a:t,b:n},"where"),i.assert("bool"===e.dtype,"Error Condition must be of type bool."),i.assertShapesMatch(t.shape,n.shape,"Error in where: "),1===e.rank?i.assert(e.shape[0]===t.shape[0],"The first dimension of `a` must match the size of `condition`."):i.assertShapesMatch(e.shape,n.shape,"Error in where: ");var r=p.c(t.dtype,n.dtype);return o.ENV.engine.runKernel(function(a){return a.where(e,t,n,r)},{condition:e,a:t,b:n})},P([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"logicalNot",null),P([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"logicalAnd",null),P([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"logicalOr",null),P([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"logicalXor",null),P([Object(a.a)({heading:"Operations",subheading:"Logical"}),u.a],e,"where",null),e}(),R=n(39),M=function(){function e(){}return e.localResponseNormalization=function(e,t,n,r,a){void 0===t&&(t=5),void 0===n&&(n=1),void 0===r&&(r=1),void 0===a&&(a=.5),i.assertArgumentsAreTensors({x:e},"localResponseNormalization"),i.assert(4===e.rank||3===e.rank,"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank "+e.rank+"."),i.assert(i.isInt(t),"Error in localResponseNormalization3D: radius must be an integer\n but got radius "+t+".");var s=e,u=!1;3===e.rank&&(u=!0,s=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var c=o.ENV.engine.runKernel(function(e){return e.localResponseNormalization4D(s,t,n,r,a)},{x4D:s});return u?c.as3D(c.shape[1],c.shape[2],c.shape[3]):c},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Operations",subheading:"Normalization"}),u.a],e,"localResponseNormalization",null),e}(),j=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},D=function(){function e(){}return e.multiRNNCell=function(e,t,n,r){i.assertArgumentsAreTensors({data:t,c:n,h:r},"multiRNNCell");for(var a=t,o=[],s=0;s<e.length;s++){var u=e[s](a,n[s],r[s]);o.push(u[0]),o.push(u[1]),a=u[1]}var c=[],l=[];for(s=0;s<o.length;s+=2)c.push(o[s]),l.push(o[s+1]);return[c,l]},e.basicLSTMCell=function(e,t,n,r,a,o){i.assertArgumentsAreTensors({forgetBias:e,lstmKernel:t,lstmBias:n,data:r,c:a,h:o},"basicLSTMCell");var s=r.concat(o,1).matMul(t).add(n),u=s.shape[0],c=s.shape[1]/4,l=[u,c],f=s.slice([0,0],l),p=s.slice([0,c],l),h=s.slice([0,2*c],l),d=s.slice([0,3*c],l),m=f.sigmoid().mulStrict(p.tanh()).addStrict(a.mulStrict(e.add(h).sigmoid()));return[m,m.tanh().mulStrict(d.sigmoid())]},j([Object(a.a)({heading:"Operations",subheading:"RNN"}),u.a],e,"multiRNNCell",null),j([Object(a.a)({heading:"Operations",subheading:"RNN"}),u.a],e,"basicLSTMCell",null),e}(),L=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},z=function(){function e(){}return e.matMul=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1),i.assertArgumentsAreTensors({a:e,b:t},"matMul");var a=n?e.shape[0]:e.shape[1],s=r?t.shape[1]:t.shape[0];return i.assert(2===e.rank&&2===t.rank,"Error in matMul: inputs must be rank 2, got ranks "+e.rank+" and "+t.rank+"."),i.assert(a===s,"Error in matMul: inner shapes ("+a+") and ("+s+") of Tensors with shapes "+e.shape+" and "+t.shape+" and transposeA="+n+" and transposeB="+r+" must match."),o.ENV.engine.runKernel(function(a){return a.matMul(e,t,n,r)},{a:e,b:t},function(a){return n||r?!n&&r?{a:function(){return a.matMul(t.toFloat(),!1,!1)},b:function(){return a.matMul(e.toFloat(),!0,!1)}}:n&&!r?{a:function(){return t.toFloat().matMul(a,!1,!0)},b:function(){return e.toFloat().matMul(a,!1,!1)}}:{a:function(){return t.toFloat().matMul(a,!0,!0)},b:function(){return a.matMul(e.toFloat(),!0,!0)}}:{a:function(){return a.matMul(t.toFloat(),!1,!0)},b:function(){return e.toFloat().matMul(a,!0,!1)}}})},e.vectorTimesMatrix=function(e,t){return i.assert(1===e.rank,"Error in vectorTimesMatrix: first input must be rank 1, but got rank "+e.rank+"."),i.assert(2===t.rank,"Error in vectorTimesMatrix: second input must be rank 2, but got rank "+t.rank+"."),i.assert(e.size===t.shape[0],"Error in vectorTimesMatrix: size of vector ("+e.size+") must match first dimension of matrix ("+t.shape[0]+")"),e.as2D(1,-1).matMul(t).as1D()},e.matrixTimesVector=function(e,t){return i.assert(1===t.rank,"Error in matrixTimesVector: second input must rank 1, but got rank "+t.rank+"."),i.assert(2===e.rank,"Error in matrixTimesVector: first input must be a rank 2, but got rank "+e.rank+"."),i.assert(t.size===e.shape[1],"Error in matrixTimesVector: size of first rank 1 input "+t.size+" must match inner dimension of second rank 2 input, but got shape "+e.shape+"."),e.matMul(t.as2D(-1,1)).as1D()},e.dotProduct=function(e,t){return i.assert(1===e.rank&&1===t.rank,"Error in dotProduct: inputs must be rank 1, but got ranks "+e.rank+" and "+t.rank+"."),i.assert(e.size===t.size,"Error in dotProduct: size of inputs ("+e.size+") and ("+t.size+") must match."),e.as2D(1,-1).matMul(t.as2D(-1,1)).asScalar()},e.outerProduct=function(e,t){return i.assert(1===e.rank&&1===t.rank,"Error in outerProduct: inputs must be rank 1, but got ranks "+e.rank+" and "+t.rank+"."),e.as2D(-1,1).matMul(t.as2D(1,-1))},e.dot=function(e,t){i.assert(!(1!==e.rank&&2!==e.rank||1!==t.rank&&2!==t.rank),"Error in dot: inputs must all be rank 1 or 2, but got ranks "+e.rank+" and "+t.rank+".");var n=1===e.rank?e.size:e.shape[1],r=1===t.rank?t.size:t.shape[0];return i.assert(n===r,"Error in dot: inner dimensions of inputs must match, but got "+n+" and "+r+"."),1===e.rank&&1===t.rank?e.as2D(1,-1).matMul(t.as2D(-1,1)).asScalar():1===e.rank&&2===t.rank?e.as2D(1,-1).matMul(t.as2D(t.shape[0],t.shape[1])).as1D():2===e.rank&&1===t.rank?e.matMul(t.as2D(-1,1)).as1D():e.matMul(t.as2D(t.shape[0],t.shape[1]))},L([Object(a.a)({heading:"Operations",subheading:"Matrices"}),u.a],e,"matMul",null),L([u.a],e,"vectorTimesMatrix",null),L([u.a],e,"matrixTimesVector",null),L([u.a],e,"dotProduct",null),L([Object(a.a)({heading:"Operations",subheading:"Matrices"}),u.a],e,"outerProduct",null),L([Object(a.a)({heading:"Operations",subheading:"Matrices"}),u.a],e,"dot",null),e}(),F=function(){function e(){}return e.movingAverage=function(e,t,n,a,o){void 0===o&&(o=!0),i.assertArgumentsAreTensors({v:e,x:t},"movingAverage"),i.assertTypesMatch(e,t),i.assert(i.arraysEqual(e.shape,t.shape),"Shape mismatch in v and x");var s=r.a.scalar(1);n="number"==typeof n?r.a.scalar(n):n;var u=s.sub(n),c=t.sub(e).mul(u);return o&&(i.assert(null!=a,"When using zeroDebias: true, step is required."),a="number"==typeof a?r.a.scalar(a):a,c=c.div(s.sub(d.pow(n,a)))),e.add(c)},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Operations",subheading:"Moving Average"}),u.a],e,"movingAverage",null),e}(),B=n(8),V=function(){function e(){}return e.norm=function(e,t,n,r){void 0===t&&(t="euclidean"),void 0===n&&(n=null),void 0===r&&(r=!1),i.assertArgumentsAreTensors({x:e},"norm");var a=function e(t,n,r){if(void 0===r&&(r=null),0===t.rank)return t.abs();if(1!==t.rank&&null===r)return e(t.reshape([-1]),n,r);if(1===t.rank||"number"==typeof r||r instanceof Array&&1===r.length){if(1===n)return t.abs().sum(r);if(n===1/0)return t.abs().max(r);if(n===-1/0)return t.abs().min(r);if("euclidean"===n||2===n)return t.abs().pow(Dn(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(r instanceof Array&&2===r.length){if(1===n)return t.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return t.abs().sum(r[1]).max(r[0]);if(n===-1/0)return t.abs().sum(r[1]).min(r[0]);if("fro"===n||"euclidean"===n)return t.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+r)}(e,t,n),o=a.shape;if(r){var s=B.g(n,e.shape);o=B.c(a.shape,s)}return a.reshape(o)},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Operations",subheading:"Matrices"}),u.a],e,"norm",null),e}(),U=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},W=function(){function e(){}return e.maxPool=function(t,n,r,a,s){i.assertArgumentsAreTensors({x:t},"maxPool");var u=t,c=!1;3===t.rank&&(c=!0,u=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),i.assert(4===u.rank,"Error in maxPool: input must be rank 4 but got rank "+u.rank+"."),null!=s&&i.assert(i.isInt(a),"Error in maxPool: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+".");var l=v(u.shape,n,r,a,s),f=o.ENV.engine.runKernel(function(e,t){return t(e.maxPool(u,l))},{x:u},function(t,o){var i=o[0];return{x:function(){return e.maxPoolBackprop(t,u,i,n,r,a)}}});return c?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f},e.maxPoolBackprop=function(e,t,n,r,a,s,u){i.assertArgumentsAreTensors({dy:e,input:t,output:n},"maxPoolBackprop"),i.assert(t.rank===e.rank,"Rank of input ("+t.rank+") does not match rank of dy ("+e.rank+")"),i.assert(4===e.rank,"Error in maxPoolBackprop: dy must be rank 4 but got rank "+e.rank+"."),i.assert(4===t.rank,"Error in maxPoolBackprop: input must be rank 4 but got rank "+t.rank+"."),null!=u&&i.assert(i.isInt(s),"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+u+" but got pad "+s+".");var c=v(t.shape,r,a,s,u);return o.ENV.engine.runKernel(function(r){return r.maxPoolBackprop(e,t,n,c)},{dy:e,input:t})},e.avgPool=function(t,n,r,a,s){i.assertArgumentsAreTensors({x:t},"avgPool"),i.assert("float32"===t.dtype,"The input dtype to avgPool must be float32");var u=t,c=!1;3===t.rank&&(c=!0,u=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),i.assert(4===u.rank,"Error in avgPool: x must be rank 4 but got rank "+u.rank+"."),null!=s&&i.assert(i.isInt(a),"Error in avgPool: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+".");var l=v(u.shape,n,r,a),f=o.ENV.engine.runKernel(function(e){return e.avgPool(u,l)},{x:u},function(t){return{x:function(){return e.avgPoolBackprop(t,u,n,r,a)}}});return f=f.cast(t.dtype),c?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f},e.avgPoolBackprop=function(e,t,n,r,a){i.assertArgumentsAreTensors({dy:e,input:t},"avgPoolBackprop"),i.assert(t.rank===e.rank,"Rank of input ("+t.rank+") does not match rank of dy ("+e.rank+")");var s=t,u=e,c=!1;3===t.rank&&(c=!0,s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]),u=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),i.assert(4===u.rank,"Error in avgPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."),i.assert(4===s.rank,"Error in avgPoolBackprop: input must be rank 4 but got rank "+s.rank+".");var l=v(s.shape,n,r,a),f=o.ENV.engine.runKernel(function(e){return e.avgPoolBackprop(u,s,l)},{dy4D:u,input4D:s});return c?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f},U([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"maxPool",null),U([u.a],e,"maxPoolBackprop",null),U([Object(a.a)({heading:"Operations",subheading:"Convolution"}),u.a],e,"avgPool",null),U([u.a],e,"avgPoolBackprop",null),e}(),G=n(34),q=function(){function e(){}return e.reverse1d=function(t){return i.assert(1===t.rank,"Error in reverse1D: x must be rank 1 but got\n rank "+t.rank+"."),e.reverse(t,0)},e.reverse2d=function(t,n){return i.assert(2===t.rank,"Error in reverse2D: x must be rank 2 but got\n rank "+t.rank+"."),e.reverse(t,n)},e.reverse3d=function(t,n){return i.assert(3===t.rank,"Error in reverse3D: x must be rank 3 but got\n rank "+t.rank+"."),e.reverse(t,n)},e.reverse4d=function(t,n){return i.assert(4===t.rank,"Error in reverse4D: x must be rank 4 but got\n rank "+t.rank+"."),e.reverse(t,n)},e.reverse=function(e,t){if(i.assertArgumentsAreTensors({x:e},"reverse"),0===e.rank)return e.clone();var n=Object(B.g)(t,e.shape);return o.ENV.engine.runKernel(function(t){return t.reverse(e,n)},{x:e},function(e){return{x:function(){return e.reverse(n)}}}).reshapeAs(e)},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Tensors",subheading:"Slicing and Joining"}),u.a],e,"reverse",null),e}(),H=n(87),K=function(){function e(){}return e.slice1d=function(t,n,r){return i.assert(1===t.rank,"slice1d expects a rank-1 tensor, but got a rank-"+t.rank+" tensor"),e.slice(t,[n],[r])},e.slice2d=function(t,n,r){return i.assert(2===t.rank,"slice1d expects a rank-2 tensor, but got a rank-"+t.rank+" tensor"),e.slice(t,n,r)},e.slice3d=function(t,n,r){return i.assert(3===t.rank,"slice1d expects a rank-3 tensor, but got a rank-"+t.rank+" tensor"),e.slice(t,n,r)},e.slice4d=function(t,n,r){return i.assert(4===t.rank,"slice1d expects a rank-4 tensor, but got a rank-"+t.rank+" tensor"),e.slice(t,n,r)},e.slice=function(e,t,n){if(i.assertArgumentsAreTensors({x:e},"slice"),0===e.rank)throw new Error("Slicing scalar is not possible");var r,a;r="number"==typeof t?[t].concat(new Array(e.rank-1).fill(0)):t.length<e.rank?t.concat(new Array(e.rank-t.length).fill(0)):t,a=(a=null==n?new Array(e.rank).fill(-1):"number"==typeof n?[n].concat(new Array(e.rank-1).fill(-1)):n.length<e.rank?n.concat(new Array(e.rank-n.length).fill(-1)):n).map(function(t,n){return t>=0?t:(i.assert(-1===t,"Bad value in size"),e.shape[n]-r[n])}),H.a(e,r,a);var s=e.shape;return o.ENV.engine.runKernel(function(t){return t.slice(e,r,a)},{x:e},function(e){for(var t=[],n=0;n<e.rank;n++)t.push([r[n],s[n]-r[n]-a[n]]);return{x:function(){return e.pad(t)}}})},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Tensors",subheading:"Slicing and Joining"}),u.a],e,"slice",null),e}(),X=n(7),J=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},Y=function(){function e(){}return e.softmax=function(e,t){if(void 0===t&&(t=-1),i.assertArgumentsAreTensors({logits:e},"softmax"),-1===t&&(t=e.rank-1),t!==e.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+e.rank+" and dim was "+t);return Object(X.a)(function(e){var n=e.logSumExp([t],!0),r=e.toFloat().sub(n).exp();return{value:r,gradFunc:function(e){var n=e.mul(r);return n.sub(n.sum([t],!0).mul(r))}}})(e)},e.softmaxCrossEntropy=function(e,t,n){if(void 0===n&&(n=-1),i.assertArgumentsAreTensors({labels:e,logits:t},"softmaxCrossEntropy"),i.assertShapesMatch(e.shape,t.shape,"Error in softmaxCrossEntropy: "),-1===n&&(n=t.rank-1),n!==t.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+t.rank+" and dim was "+n);return Object(X.a)(function(e,t){var r=t.softmax(n);return{value:Dn(1e-5).add(r).log().mul(e).neg().sum([n]),gradFunc:function(t){var a=B.c(t.shape,[n]);return[t.reshape(a).mul(e.toFloat().sub(r)),t.reshape(a).mul(r.sub(e.toFloat()))]}}})(e,t)},J([Object(a.a)({heading:"Operations",subheading:"Normalization"}),u.a],e,"softmax",null),J([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),u.a],e,"softmaxCrossEntropy",null),e}(),Q=function(){function e(){}return e.stridedSlice=function(e,t,n,r,a,s){return void 0===a&&(a=0),void 0===s&&(s=0),i.assertArgumentsAreTensors({x:e},"stridedSlice"),o.ENV.engine.runKernel(function(o){return o.stridedSlice(e,t,n,r,a,s)},{x:e})},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Operations",subheading:"Slicing and Joining"}),u.a],e,"stridedSlice",null),e}(),Z=function(){function e(){}return e.transpose=function(e,t){return i.assertArgumentsAreTensors({x:e},"transpose"),null==t&&(t=e.shape.map(function(e,t){return t}).reverse()),i.assert(e.rank===t.length,"Error in transpose: rank of input "+e.rank+" must match length of perm "+t+"."),t.forEach(function(n){i.assert(n>=0&&n<e.rank,"All entries in 'perm' must be between 0 and "+(e.rank-1)+" but got "+t)}),e.rank<=1?e.clone():o.ENV.engine.runKernel(function(n){return n.transpose(e,t)},{x:e},function(e){var n=B.f(t);return{x:function(){return e.transpose(n)}}})},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(a.a)({heading:"Operations",subheading:"Matrices"}),u.a],e,"transpose",null),e}(),$=n(52),ee=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},te=function(){function e(){}return e.neg=function(e){return i.assertArgumentsAreTensors({x:e},"neg"),o.ENV.engine.runKernel(function(t){return t.neg(e)},{x:e},function(e){return{x:function(){return e.neg()}}})},e.ceil=function(e){return i.assertArgumentsAreTensors({x:e},"ceil"),o.ENV.engine.runKernel(function(t){return t.ceil(e)},{x:e},function(e){return{x:function(){return bn(e)}}})},e.floor=function(e){return i.assertArgumentsAreTensors({x:e},"floor"),o.ENV.engine.runKernel(function(t){return t.floor(e)},{x:e},function(e){return{x:function(){return bn(e)}}})},e.sign=function(e){return i.assertArgumentsAreTensors({x:e},"sign"),o.ENV.engine.runKernel(function(t){return t.sign(e)},{x:e},function(e){return{x:function(){return bn(e)}}})},e.round=function(e){return i.assertArgumentsAreTensors({x:e},"round"),o.ENV.engine.runKernel(function(t){return t.round(e)},{x:e},function(e){return{x:function(){return bn(e)}}})},e.exp=function(e){return i.assertArgumentsAreTensors({x:e},"exp"),o.ENV.engine.runKernel(function(t,n){return n(t.exp(e))},{x:e},function(e,t){var n=t[0];return{x:function(){return e.mulStrict(n)}}})},e.expm1=function(e){return i.assertArgumentsAreTensors({x:e},"expm1"),o.ENV.engine.runKernel(function(t){return t.expm1(e)},{x:e},function(t){return{x:function(){return t.mulStrict(e.exp())}}})},e.log=function(e){return i.assertArgumentsAreTensors({x:e},"log"),o.ENV.engine.runKernel(function(t){return t.log(e)},{x:e},function(t){return{x:function(){return t.divStrict(e.toFloat())}}})},e.log1p=function(e){return i.assertArgumentsAreTensors({x:e},"log1p"),o.ENV.engine.runKernel(function(t){return t.log1p(e)},{x:e},function(t){return{x:function(){return t.divStrict(e.add(Dn(1)))}}})},e.sqrt=function(e){return i.assertArgumentsAreTensors({x:e},"sqrt"),o.ENV.engine.runKernel(function(t){return t.sqrt(e)},{x:e},function(t){return{x:function(){return t.divStrict(e.toFloat().sqrt().mul(Dn(2)))}}})},e.rsqrt=function(e){return i.assertArgumentsAreTensors({x:e},"rsqrt"),o.ENV.engine.runKernel(function(t){return t.rsqrt(e)},{x:e},function(t){return{x:function(){return t.divStrict(e.pow(Dn(1.5)).mul(Dn(2))).neg()}}})},e.square=function(e){return i.assertArgumentsAreTensors({x:e},"square"),o.ENV.engine.runKernel(function(t){return t.square(e)},{x:e},function(t){return{x:function(){return t.mulStrict(e.toFloat().mul(Dn(2)))}}})},e.reciprocal=function(e){return i.assertArgumentsAreTensors({x:e},"reciprocal"),o.ENV.engine.runKernel(function(t){return t.reciprocal(e)},{x:e},function(t){return{x:function(){return t.divStrict(e.square().neg())}}})},e.abs=function(e){return i.assertArgumentsAreTensors({x:e},"abs"),o.ENV.engine.runKernel(function(t){return t.abs(e)},{x:e},function(t){return{x:function(){return t.mulStrict(e.toFloat().step(-1))}}})},e.clipByValue=function(e,t,n){return i.assertArgumentsAreTensors({x:e},"clipByValue"),i.assert(t<=n,"Error in clip: min ("+t+") must be less than or equal to max ("+n+")."),o.ENV.engine.runKernel(function(r){return r.clip(e,t,n)},{x:e},function(r){return{x:function(){return r.where(e.greater(Dn(t)).logicalAnd(e.less(Dn(n))),bn(r))}}})},e.relu=function(e){return i.assertArgumentsAreTensors({x:e},"relu"),"bool"===e.dtype?e.toInt():o.ENV.engine.runKernel(function(t){return t.relu(e)},{x:e},function(t){var n=e.step();return{x:function(){return t.mulStrict(n.toFloat())}}})},e.elu=function(e){return i.assertArgumentsAreTensors({x:e},"elu"),o.ENV.engine.runKernel(function(t,n){return n(t.elu(e))},{x:e},function(e,t){var n=t[0];return{x:function(){return o.ENV.engine.runKernel(function(t){return t.eluDer(e,n)},{dy:e,y:n})}}})},e.selu=function(e){return i.assertArgumentsAreTensors({x:e},"selu"),o.ENV.engine.runKernel(function(t){return t.selu(e)},{x:e},function(t){return{x:function(){var n=e.greater(Dn(0)),r=Dn($.b),a=Dn($.a),o=t.mul(a),i=t.mul(r).mul(e.toFloat().exp());return st(n,o,i)}}})},e.leakyRelu=function(e,t){return void 0===t&&(t=.2),i.assertArgumentsAreTensors({x:e},"leakyRelu"),Yt(Dn(t).mul(e),e)},e.prelu=function(e,t){i.assertArgumentsAreTensors({x:e,alpha:t},"prelu");var n=Dn(0);return Yt(n,e).add(t.mul(Zt(n,e)))},e.sigmoid=function(e){return i.assertArgumentsAreTensors({x:e},"sigmoid"),o.ENV.engine.runKernel(function(t,n){return n(t.sigmoid(e))},{x:e},function(e,t){var n=t[0];return{x:function(){return e.mulStrict(n.mul(Dn(1).sub(n)))}}})},e.logSigmoid=function(e){return i.assertArgumentsAreTensors({x:e},"logSigmoid"),o.ENV.engine.runKernel(function(t){return t.softplus(e.neg()).neg()},{x:e},function(t){return{x:function(){return t.mulStrict(e.neg().sigmoid())}}})},e.softplus=function(e){return i.assertArgumentsAreTensors({x:e},"softplus"),o.ENV.engine.runKernel(function(t){return t.softplus(e)},{x:e},function(t){return{x:function(){return t.mulStrict(e.sigmoid())}}})},e.sin=function(e){return i.assertArgumentsAreTensors({x:e},"sin"),o.ENV.engine.runKernel(function(t){return t.sin(e)},{x:e},function(t){return{x:function(){return e.toFloat().cos().mulStrict(t)}}})},e.cos=function(e){return i.assertArgumentsAreTensors({x:e},"cos"),o.ENV.engine.runKernel(function(t){return t.cos(e)},{x:e},function(t){return{x:function(){return e.toFloat().sin().neg().mulStrict(t)}}})},e.tan=function(e){return i.assertArgumentsAreTensors({x:e},"tan"),o.ENV.engine.runKernel(function(t){return t.tan(e)},{x:e},function(t){return{x:function(){return t.divStrict(e.cos().square())}}})},e.asin=function(t){return i.assertArgumentsAreTensors({x:t},"asin"),o.ENV.engine.runKernel(function(e){return e.asin(t)},{x:t},function(n){return{x:function(){return n.divStrict(e.sqrt(Dn(1).sub(t.toFloat().square())))}}})},e.acos=function(t){return i.assertArgumentsAreTensors({x:t},"acos"),o.ENV.engine.runKernel(function(e){return e.acos(t)},{x:t},function(n){return{x:function(){return n.divStrict(e.sqrt(Dn(1).sub(t.toFloat().square()))).neg()}}})},e.atan=function(e){return i.assertArgumentsAreTensors({x:e},"atan"),o.ENV.engine.runKernel(function(t){return t.atan(e)},{x:e},function(t){return{x:function(){return t.divStrict(Dn(1).add(e.toFloat().square()))}}})},e.sinh=function(e){return i.assertArgumentsAreTensors({x:e},"sinh"),o.ENV.engine.runKernel(function(t){return t.sinh(e)},{x:e},function(t){return{x:function(){return e.toFloat().cosh().mulStrict(t)}}})},e.cosh=function(e){return i.assertArgumentsAreTensors({x:e},"cosh"),o.ENV.engine.runKernel(function(t){return t.cosh(e)},{x:e},function(t){return{x:function(){return e.toFloat().sinh().mulStrict(t)}}})},e.tanh=function(e){return i.assertArgumentsAreTensors({x:e},"tanh"),o.ENV.engine.runKernel(function(t,n){return n(t.tanh(e))},{x:e},function(e,t){var n=t[0];return{x:function(){return Dn(1).sub(n.square()).mulStrict(e)}}})},e.asinh=function(t){return i.assertArgumentsAreTensors({x:t},"asinh"),o.ENV.engine.runKernel(function(e){return e.asinh(t)},{x:t},function(n){return{x:function(){return n.divStrict(e.sqrt(Dn(1).add(t.toFloat().square())))}}})},e.acosh=function(t){return i.assertArgumentsAreTensors({x:t},"acosh"),o.ENV.engine.runKernel(function(e){return e.acosh(t)},{x:t},function(n){return{x:function(){return n.divStrict(e.sqrt(t.toFloat().square().sub(Dn(1))))}}})},e.atanh=function(e){return i.assertArgumentsAreTensors({x:e},"atanh"),o.ENV.engine.runKernel(function(t){return t.atanh(e)},{x:e},function(t){return{x:function(){return t.divStrict(Dn(1).sub(e.toFloat().square()))}}})},e.erf=function(e){return i.assert("int32"===e.dtype||"float32"===e.dtype,"Input dtype must be `int32` or `float32`."),"int32"===e.dtype&&(e=e.toFloat()),o.ENV.engine.runKernel(function(t){return t.erf(e)},{x:e},function(t){return{x:function(){return t.mulStrict(Dn(2/Math.sqrt(Math.PI)).mul(e.square().neg().exp()))}}})},e.step=function(e,t){return void 0===t&&(t=0),i.assertArgumentsAreTensors({x:e},"step"),o.ENV.engine.runKernel(function(n){return n.step(e,t)},{x:e},function(e){return{x:function(){return bn(e)}}})},ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"neg",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"ceil",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"floor",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"sign",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"round",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"exp",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"expm1",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"log",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"log1p",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"sqrt",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"rsqrt",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"square",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"reciprocal",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"abs",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"clipByValue",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"relu",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"elu",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"selu",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"leakyRelu",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"prelu",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"sigmoid",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"logSigmoid",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"softplus",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"sin",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"cos",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"tan",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"asin",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"acos",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"atan",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"sinh",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"cosh",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"tanh",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"asinh",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"acosh",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"atanh",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"erf",null),ee([Object(a.a)({heading:"Operations",subheading:"Basic math"}),u.a],e,"step",null),e}(),ne=n(6);n.d(t,"o",function(){return re}),n.d(t,"p",function(){return ae}),n.d(t,"q",function(){return oe}),n.d(t,"r",function(){return ie}),n.d(t,"x",function(){return se}),n.d(t,"y",function(){return ue}),n.d(t,"z",function(){return ce}),n.d(t,"A",function(){return le}),n.d(t,"B",function(){return fe}),n.d(t,"C",function(){return pe}),n.d(t,"D",function(){return he}),n.d(t,"E",function(){return de}),n.d(t,"I",function(){return me}),n.d(t,"Ub",function(){return ge}),n.d(t,"Ua",function(){return ye}),n.d(t,"Va",function(){return ve}),n.d(t,"ub",function(){return be}),n.d(t,"Fc",function(){return we}),n.d(t,"L",function(){return xe}),n.d(t,"m",function(){return ke}),n.d(t,"Xa",function(){return Oe}),n.d(t,"Bc",function(){return Se}),n.d(t,"Lb",function(){return Ne}),n.d(t,"Mb",function(){return Ee}),n.d(t,"Nb",function(){return Ie}),n.d(t,"Ob",function(){return Te}),n.d(t,"Pb",function(){return Ae}),n.d(t,"Zb",function(){return Ce}),n.d(t,"ac",function(){return Pe}),n.d(t,"bc",function(){return _e}),n.d(t,"cc",function(){return Re}),n.d(t,"dc",function(){return Me}),n.d(t,"oc",function(){return je}),n.d(t,"f",function(){return De}),n.d(t,"g",function(){return Le}),n.d(t,"Oa",function(){return ze}),n.d(t,"Wa",function(){return Fe}),n.d(t,"ab",function(){return Be}),n.d(t,"bb",function(){return Ve}),n.d(t,"gb",function(){return Ue}),n.d(t,"rc",function(){return We}),n.d(t,"Dc",function(){return Ge}),n.d(t,"N",function(){return qe}),n.d(t,"O",function(){return He}),n.d(t,"Y",function(){return Ke}),n.d(t,"Ba",function(){return Xe}),n.d(t,"Z",function(){return Je}),n.d(t,"Aa",function(){return Ye}),n.d(t,"Ea",function(){return Qe}),n.d(t,"Ha",function(){return Ze}),n.d(t,"Fa",function(){return $e}),n.d(t,"Ga",function(){return et}),n.d(t,"ob",function(){return tt}),n.d(t,"pb",function(){return nt}),n.d(t,"Qa",function(){return rt}),n.d(t,"Pa",function(){return at}),n.d(t,"Ra",function(){return ot}),n.d(t,"Sa",function(){return it}),n.d(t,"Gc",function(){return st}),n.d(t,"a",function(){return ut}),n.d(t,"b",function(){return ct}),n.d(t,"c",function(){return lt}),n.d(t,"h",function(){return ft}),n.d(t,"i",function(){return pt}),n.d(t,"j",function(){return ht}),n.d(t,"l",function(){return dt}),n.d(t,"u",function(){return mt}),n.d(t,"v",function(){return gt}),n.d(t,"F",function(){return yt}),n.d(t,"G",function(){return vt}),n.d(t,"M",function(){return bt}),n.d(t,"Q",function(){return wt}),n.d(t,"S",function(){return xt}),n.d(t,"V",function(){return kt}),n.d(t,"Wb",function(){return Ot}),n.d(t,"Da",function(){return St}),n.d(t,"La",function(){return Nt}),n.d(t,"Ma",function(){return Et}),n.d(t,"Na",function(){return It}),n.d(t,"mb",function(){return Tt}),n.d(t,"Cb",function(){return At}),n.d(t,"Jb",function(){return Ct}),n.d(t,"Ib",function(){return Pt}),n.d(t,"Qb",function(){return _t}),n.d(t,"Tb",function(){return Rt}),n.d(t,"Vb",function(){return Mt}),n.d(t,"Xb",function(){return jt}),n.d(t,"Yb",function(){return Dt}),n.d(t,"fc",function(){return Lt}),n.d(t,"hc",function(){return zt}),n.d(t,"Rb",function(){return Ft}),n.d(t,"ic",function(){return Bt}),n.d(t,"nc",function(){return Vt}),n.d(t,"sc",function(){return Ut}),n.d(t,"tc",function(){return Wt}),n.d(t,"P",function(){return Gt}),n.d(t,"d",function(){return qt}),n.d(t,"e",function(){return Ht}),n.d(t,"k",function(){return Kt}),n.d(t,"J",function(){return Xt}),n.d(t,"K",function(){return Jt}),n.d(t,"Ya",function(){return Yt}),n.d(t,"Za",function(){return Qt}),n.d(t,"cb",function(){return Zt}),n.d(t,"db",function(){return $t}),n.d(t,"eb",function(){return en}),n.d(t,"fb",function(){return tn}),n.d(t,"ib",function(){return nn}),n.d(t,"jb",function(){return rn}),n.d(t,"Ab",function(){return an}),n.d(t,"Bb",function(){return on}),n.d(t,"pc",function(){return sn}),n.d(t,"qc",function(){return un}),n.d(t,"jc",function(){return cn}),n.d(t,"kc",function(){return ln}),n.d(t,"nb",function(){return fn}),n.d(t,"t",function(){return pn}),n.d(t,"w",function(){return hn}),n.d(t,"W",function(){return dn}),n.d(t,"Ac",function(){return mn}),n.d(t,"rb",function(){return gn}),n.d(t,"sb",function(){return yn}),n.d(t,"Hc",function(){return vn}),n.d(t,"Ic",function(){return bn}),n.d(t,"T",function(){return wn}),n.d(t,"Eb",function(){return xn}),n.d(t,"Fb",function(){return kn}),n.d(t,"Cc",function(){return On}),n.d(t,"Gb",function(){return Sn}),n.d(t,"lb",function(){return Nn}),n.d(t,"Kb",function(){return En}),n.d(t,"lc",function(){return In}),n.d(t,"zc",function(){return Tn}),n.d(t,"X",function(){return An}),n.d(t,"qb",function(){return Cn}),n.d(t,"Ja",function(){return Pn}),n.d(t,"Hb",function(){return _n}),n.d(t,"s",function(){return Rn}),n.d(t,"U",function(){return Mn}),n.d(t,"uc",function(){return jn}),n.d(t,"Sb",function(){return Dn}),n.d(t,"vc",function(){return Ln}),n.d(t,"wc",function(){return zn}),n.d(t,"xc",function(){return Fn}),n.d(t,"yc",function(){return Bn}),n.d(t,"Db",function(){return Vn}),n.d(t,"R",function(){return Un}),n.d(t,"mc",function(){return Wn}),n.d(t,"Ec",function(){return Gn}),n.d(t,"gc",function(){return qn}),n.d(t,"H",function(){return Hn}),n.d(t,"vb",function(){return Kn}),n.d(t,"wb",function(){return Xn}),n.d(t,"xb",function(){return Jn}),n.d(t,"yb",function(){return Yn}),n.d(t,"zb",function(){return Qn}),n.d(t,"hb",function(){return Zn}),n.d(t,"n",function(){return $n}),n.d(t,"kb",function(){return er}),n.d(t,"ec",function(){return tr}),n.d(t,"Ka",function(){return nr}),n.d(t,"Ia",function(){return rr}),n.d(t,"Ta",function(){return ar}),n.d(t,"Ca",function(){return or}),n.d(t,"tb",function(){return u.a});var re=l.batchNormalization,ae=l.batchNormalization2d,oe=l.batchNormalization3d,ie=l.batchNormalization4d,se=y.a.concat,ue=y.a.concat1d,ce=y.a.concat2d,le=y.a.concat3d,fe=y.a.concat4d,pe=S.conv1d,he=S.conv2d,de=S.conv2dTranspose,me=S.depthwiseConv2d,ge=S.separableConv2d,ye=z.matMul,ve=z.matrixTimesVector,be=z.outerProduct,we=z.vectorTimesMatrix,xe=z.dot,ke=W.avgPool,Oe=W.maxPool,Se=Z.transpose,Ne=q.reverse,Ee=q.reverse1d,Ie=q.reverse2d,Te=q.reverse3d,Ae=q.reverse4d,Ce=K.slice,Pe=K.slice1d,_e=K.slice2d,Re=K.slice3d,Me=K.slice4d,je=Q.stridedSlice,De=G.a.argMax,Le=G.a.argMin,ze=G.a.logSumExp,Fe=G.a.max,Be=G.a.mean,Ve=G.a.min,Ue=G.a.moments,We=G.a.sum,Ge=G.a.unsortedSegmentSum,qe=g.equal,He=g.equalStrict,Ke=g.greater,Xe=g.greaterStrict,Je=g.greaterEqual,Ye=g.greaterEqualStrict,Qe=g.less,Ze=g.lessStrict,$e=g.lessEqual,et=g.lessEqualStrict,tt=g.notEqual,nt=g.notEqualStrict,rt=_.logicalNot,at=_.logicalAnd,ot=_.logicalOr,it=_.logicalXor,st=_.where,ut=te.abs,ct=te.acos,lt=te.acosh,ft=te.asin,pt=te.asinh,ht=te.atan,dt=te.atanh,mt=te.ceil,gt=te.clipByValue,yt=te.cos,vt=te.cosh,bt=te.elu,wt=te.exp,xt=te.expm1,kt=te.floor,Ot=te.sign,St=te.leakyRelu,Nt=te.log,Et=te.log1p,It=te.logSigmoid,Tt=te.neg,At=te.prelu,Ct=te.relu,Pt=te.reciprocal,_t=te.round,Rt=te.selu,Mt=te.sigmoid,jt=te.sin,Dt=te.sinh,Lt=te.softplus,zt=te.sqrt,Ft=te.rsqrt,Bt=te.square,Vt=te.step,Ut=te.tan,Wt=te.tanh,Gt=te.erf,qt=d.add,Ht=d.addStrict,Kt=d.atan2,Xt=d.div,Jt=d.divStrict,Yt=d.maximum,Qt=d.maximumStrict,Zt=d.minimum,$t=d.minimumStrict,en=d.mod,tn=d.modStrict,nn=d.mul,rn=d.mulStrict,an=d.pow,on=d.powStrict,sn=d.sub,un=d.subStrict,cn=d.squaredDifference,ln=d.squaredDifferenceStrict,fn=V.norm,pn=r.a.cast,hn=r.a.clone,dn=r.a.fromPixels,mn=r.a.toPixels,gn=r.a.ones,yn=r.a.onesLike,vn=r.a.zeros,bn=r.a.zerosLike,wn=r.a.eye,xn=r.a.rand,kn=r.a.randomNormal,On=r.a.truncatedNormal,Sn=r.a.randomUniform,Nn=r.a.multinomial,En=r.a.reshape,In=r.a.squeeze,Tn=r.a.tile,An=r.a.gather,Cn=r.a.oneHot,Pn=r.a.linspace,_n=r.a.range,Rn=r.a.buffer,Mn=r.a.fill,jn=r.a.tensor,Dn=r.a.scalar,Ln=r.a.tensor1d,zn=r.a.tensor2d,Fn=r.a.tensor3d,Bn=r.a.tensor4d,Vn=r.a.print,Un=r.a.expandDims,Wn=r.a.stack,Gn=r.a.unstack,qn=r.a.split,Hn=r.a.cumsum,Kn=r.a.pad,Xn=r.a.pad1d,Jn=r.a.pad2d,Yn=r.a.pad3d,Qn=r.a.pad4d,Zn=F.movingAverage,$n=D.basicLSTMCell,er=D.multiRNNCell,tr=Y.softmax,nr=M.localResponseNormalization,rr=C;ne.a,p.a,R.b;var ar={absoluteDifference:R.a.absoluteDifference,computeWeightedLoss:R.a.computeWeightedLoss,cosineDistance:R.a.cosineDistance,hingeLoss:R.a.hingeLoss,huberLoss:R.a.huberLoss,logLoss:R.a.logLoss,meanSquaredError:R.a.meanSquaredError,softmaxCrossEntropy:Y.softmaxCrossEntropy},or={resizeBilinear:T.resizeBilinear,resizeNearestNeighbor:T.resizeNearestNeighbor}},function(e,t,n){"use strict";function r(e){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"Type",function(){return r}),n.d(t,"URL_PROPERTIES",function(){return c}),n.d(t,"Environment",function(){return d}),n.d(t,"ENV",function(){return v});var r,a=n(240),o=n(2),i=n(226),s=n(0),u=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};!function(e){e[e.NUMBER=0]="NUMBER",e[e.BOOLEAN=1]="BOOLEAN",e[e.STRING=2]="STRING"}(r||(r={}));var c=[{name:"DEBUG",type:r.BOOLEAN},{name:"IS_BROWSER",type:r.BOOLEAN},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",type:r.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",type:r.BOOLEAN},{name:"WEBGL_VERSION",type:r.NUMBER},{name:"WEBGL_FLOAT_TEXTURE_ENABLED",type:r.BOOLEAN},{name:"WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED",type:r.BOOLEAN},{name:"BACKEND",type:r.STRING}];function l(e,t){return null!=e.getExtension(t)}function f(e){if(0===e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var t=document.createElement("canvas");return 1===e?t.getContext("webgl")||t.getContext("experimental-webgl"):t.getContext("webgl2")}function p(e){if(null!=e){var t=e.getExtension("WEBGL_lose_context");if(null==t)throw new Error("Extension WEBGL_lose_context not supported on this browser.");t.loseContext()}}function h(e){var t=f(e);return null!=t&&(p(t),!0)}var d=function(){function e(e){this.features={},this.registry={},null!=e&&(this.features=e),this.get("DEBUG")&&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.")}return e.setBackend=function(e,t){if(void 0===t&&(t=!1),!(e in v.registry))throw new Error("Backend type '"+e+"' not found in registry");v.initBackend(e,t)},e.getBackend=function(){return v.initDefaultBackend(),v.currentBackend},e.disposeVariables=function(){v.engine.disposeVariables()},e.memory=function(){return v.engine.memory()},e.prototype.get=function(e){return e in this.features?this.features[e]:(this.features[e]=this.evaluateFeature(e),this.features[e])},e.prototype.set=function(e,t){this.features[e]=t},e.prototype.getBestBackendType=function(){var e=this;if(0===Object.keys(this.registry).length)throw new Error("No backend found in registry.");return Object.keys(this.registry).map(function(t){return{name:t,entry:e.registry[t]}}).sort(function(e,t){return t.entry.priority-e.entry.priority})[0].name},e.prototype.evaluateFeature=function(e){if("DEBUG"===e)return!1;if("IS_BROWSER"===e)return"undefined"!=typeof window;if("BACKEND"===e)return this.getBestBackendType();if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"===e){var t=this.get("WEBGL_VERSION");return 0===t?0:function(e){if(0===e)return 0;var t,n=f(e);return t=l(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:l(n,"EXT_disjoint_timer_query")?1:0,null!=n&&p(n),t}(t)}if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE"===e)return this.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!a.a();if("WEBGL_VERSION"===e)return h(2)?2:h(1)?1:0;if("WEBGL_FLOAT_TEXTURE_ENABLED"===e)return function(e){if(0===e)return!1;var t=f(e);if(1===e){if(!l(t,"OES_texture_float"))return!1}else if(!l(t,"EXT_color_buffer_float"))return!1;var n=t.createFramebuffer(),r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);var a=2===e?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,a,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;t.readPixels(0,0,1,1,t.RGBA,t.FLOAT,new Float32Array(4));var i=t.getError()===t.NO_ERROR;return p(t),o&&i}(this.get("WEBGL_VERSION"));if("WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED"===e)return function(e){if(e>0)return!1;if(2!==e)return!1;var t=f(e),n=l(t,"WEBGL_get_buffer_sub_data_async");return p(t),n}(this.get("WEBGL_VERSION"));throw new Error("Unknown feature "+e+".")},e.prototype.setFeatures=function(e){this.features=e},e.prototype.reset=function(){this.features=g(),null!=this.globalEngine&&(this.globalEngine.dispose(),this.globalEngine=null)},e.prototype.initBackend=function(e,t){void 0===t&&(t=!1),this.currentBackend=e,null!=this.globalEngine&&this.globalEngine.dispose();var n=v.findBackend(e);this.globalEngine=new i.a(n,t)},e.prototype.findBackend=function(e){return e in this.registry?this.registry[e].backend:null},e.prototype.registerBackend=function(e,t,n){void 0===n&&(n=1),e in this.registry&&console.warn(e+" backend was already registered");try{var r=t();return this.registry[e]={backend:r,priority:n},!0}catch(e){return console.warn(e.message),!1}},e.prototype.removeBackend=function(e){if(!(e in this.registry))throw new Error(e+" backend not found in registry");this.registry[e].backend.dispose(),delete this.registry[e]},Object.defineProperty(e.prototype,"engine",{get:function(){return this.initDefaultBackend(),this.globalEngine},enumerable:!0,configurable:!0}),e.prototype.initDefaultBackend=function(){null==this.globalEngine&&this.initBackend(v.get("BACKEND"),!1)},u([Object(o.a)({heading:"Environment"})],e,"setBackend",null),u([Object(o.a)({heading:"Environment"})],e,"getBackend",null),u([Object(o.a)({heading:"Environment"})],e,"disposeVariables",null),u([Object(o.a)({heading:"Performance",subheading:"Memory"})],e,"memory",null),e}(),m="tfjsflags";function g(){var e={};if("undefined"==typeof window||void 0===window.location)return e;var t=s.getQueryParams(window.location.search);if(m in t){var n={};t[m].split(",").forEach(function(e){var t=e.split(":"),r=t[0],a=t[1];n[r]=a}),c.forEach(function(t){t.name in n&&(console.log("Setting feature override from URL "+t.name+": "+n[t.name]),t.type===r.NUMBER?e[t.name]=+n[t.name]:t.type===r.BOOLEAN?e[t.name]="true"===n[t.name]:t.type===r.STRING?e[t.name]=n[t.name]:console.warn("Unknown URL param: "+t.name+"."))})}return e}var y,v=((y=function(){var t;if("undefined"!=typeof window)t=window;else{if(void 0===e)throw new Error("Could not find a global object");t=e}return t}()).ENV=y.ENV||new d(g()),y.ENV)}.call(this,n(96))},function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(7);function a(e,t,n){var a=n.value;return n.value=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Object(r.f)(t,function(){return a.apply(void 0,e)})},n}},function(e,t,n){var r=n(13),a=n(48),o=n(28),i=n(27),s=n(38),u=function(e,t,n){var c,l,f,p,h=e&u.F,d=e&u.G,m=e&u.S,g=e&u.P,y=e&u.B,v=d?r:m?r[t]||(r[t]={}):(r[t]||{}).prototype,b=d?a:a[t]||(a[t]={}),w=b.prototype||(b.prototype={});for(c in d&&(n=t),n)f=((l=!h&&v&&void 0!==v[c])?v:n)[c],p=y&&l?s(f,r):g&&"function"==typeof f?s(Function.call,f):f,v&&i(v,c,f,e&u.U),b[c]!=f&&o(b,c,p),g&&w[c]!=f&&(w[c]=f)};r.core=a,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){"use strict";n.d(t,"b",function(){return f}),n.d(t,"a",function(){return p}),n.d(t,"c",function(){return h}),n.d(t,"d",function(){return d});var r,a=n(2),o=n(3),i=n(1),s=n(121),u=n(0),c=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},f=function(){function e(e,t,n){if(this.dtype=t,null!=n){var r=n.length,a=u.sizeFromShape(e);u.assert(r===a,"Length of values '"+r+"' does not match the size inferred by the shape '"+a+"'")}this.shape=e.slice(),this.values=n||u.getTypedArrayFromDType(t,u.sizeFromShape(e)),this.strides=m(e),this.size=u.sizeFromShape(e)}return e.prototype.set=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];0===t.length&&(t=[0]),u.assert(t.length===this.rank,"The number of provided coordinates ("+t.length+") must match the rank ("+this.rank+")");var r=this.locToIndex(t);this.values[r]=e},e.prototype.get=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];0===e.length&&(e=[0]);for(var n=e[e.length-1],r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return this.values[n]},e.prototype.locToIndex=function(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];for(var t=e[e.length-1],n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t},e.prototype.indexToLoc=function(e){if(0===this.rank)return[];if(1===this.rank)return[e];for(var t=new Array(this.shape.length),n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t},Object.defineProperty(e.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),e.prototype.toTensor=function(){return p.make(this.shape,{values:this.values},this.dtype)},l([Object(a.a)({heading:"Tensors",subheading:"Creation"})],e.prototype,"set",null),l([Object(a.a)({heading:"Tensors",subheading:"Creation"})],e.prototype,"get",null),l([Object(a.a)({heading:"Tensors",subheading:"Creation"})],e.prototype,"toTensor",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e)}(),p=function(){function e(e,n,r,a){this.isDisposed=!1,this.size=u.sizeFromShape(e),null!=r&&u.assert(this.size===r.length,"Constructing tensor of shape ("+this.size+") should match the length of values ("+r.length+")"),this.shape=e.slice(),this.dtype=n||"float32",this.strides=m(e),this.dataId=null!=a?a:{},this.id=t.nextId++,this.rankType=this.rank<5?this.rank.toString():"higher",o.ENV.engine.registerTensor(this),null!=r&&o.ENV.engine.write(this.dataId,r)}return t=e,e.make=function(e,n,r){return new t(e,r,n.values,n.dataId)},e.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},e.prototype.asScalar=function(){return this.throwIfDisposed(),u.assert(1===this.size,"The array must have only 1 element."),this.reshape([])},e.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},e.prototype.as2D=function(e,t){return this.throwIfDisposed(),this.reshape([e,t])},e.prototype.as3D=function(e,t,n){return this.throwIfDisposed(),this.reshape([e,t,n])},e.prototype.as4D=function(e,t,n,r){return this.throwIfDisposed(),this.reshape([e,t,n,r])},e.prototype.asType=function(e){return this.throwIfDisposed(),i.t(this,e)},Object.defineProperty(e.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),e.prototype.get=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];u.assert(e.length===this.rank,"Number of coordinates in get() must match the rank of the tensor"),this.throwIfDisposed(),0===e.length&&(e=[0]);for(var n=e[e.length-1],r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return this.dataSync()[n]},e.prototype.buffer=function(){return i.s(this.shape,this.dtype,this.dataSync())},e.prototype.data=function(){return e=this,t=void 0,r=function(){return function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,function(e){return this.throwIfDisposed(),[2,o.ENV.engine.read(this.dataId)]})},new((n=void 0)||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())});var e,t,n,r},e.prototype.dataSync=function(){return this.throwIfDisposed(),o.ENV.engine.readSync(this.dataId)},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,o.ENV.engine.disposeTensor(this))},e.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},e.prototype.toFloat=function(){return this.asType("float32")},e.prototype.toInt=function(){return this.asType("int32")},e.prototype.toBool=function(){return this.asType("bool")},e.prototype.print=function(e){return void 0===e&&(e=!1),i.Db(this,e)},e.prototype.reshape=function(e){return this.throwIfDisposed(),i.Kb(this,e)},e.prototype.reshapeAs=function(e){return this.throwIfDisposed(),this.reshape(e.shape)},e.prototype.expandDims=function(e){return void 0===e&&(e=0),i.R(this,e)},e.prototype.cumsum=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=!1),void 0===n&&(n=!1),i.H(this,e,t,n)},e.prototype.squeeze=function(e){return this.throwIfDisposed(),i.lc(this,e)},e.prototype.clone=function(){return this.throwIfDisposed(),i.w(this)},e.prototype.toString=function(e){return void 0===e&&(e=!1),s.a(this,e)},e.prototype.tile=function(e){return this.throwIfDisposed(),i.zc(this,e)},e.prototype.gather=function(e,t){return void 0===t&&(t=0),this.throwIfDisposed(),i.X(this,e,t)},e.prototype.matMul=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!1),this.throwIfDisposed(),i.Ua(this,e,t,n)},e.prototype.dot=function(e){return this.throwIfDisposed(),i.L(this,e)},e.prototype.norm=function(e,t,n){return void 0===e&&(e="euclidean"),void 0===t&&(t=null),void 0===n&&(n=!1),this.throwIfDisposed(),i.nb(this,e,t,n)},e.prototype.slice=function(e,t){return this.throwIfDisposed(),i.Zb(this,e,t)},e.prototype.reverse=function(e){return this.throwIfDisposed(),i.Lb(this,e)},e.prototype.concat=function(e,t){return void 0===t&&(t=0),this.throwIfDisposed(),i.x([this,e],t)},e.prototype.stack=function(e,t){return void 0===t&&(t=0),i.mc([this,e],t)},e.prototype.unstack=function(e,t){return void 0===t&&(t=0),i.Ec(this,t)},e.prototype.pad=function(e,t){return void 0===t&&(t=0),i.vb(this,e,t)},e.prototype.batchNormalization=function(e,t,n,r,a){return void 0===n&&(n=.001),this.throwIfDisposed(),i.o(this,e,t,n,r,a)},e.prototype.logSumExp=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),i.Oa(this,e,t)},e.prototype.sum=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),i.rc(this,e,t)},e.prototype.mean=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),i.ab(this,e,t)},e.prototype.min=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),i.bb(this,e,t)},e.prototype.max=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),i.Wa(this,e,t)},e.prototype.argMin=function(e){return void 0===e&&(e=null),this.throwIfDisposed(),i.g(this,e)},e.prototype.argMax=function(e){return void 0===e&&(e=null),this.throwIfDisposed(),i.f(this,e)},e.prototype.cast=function(e){return this.throwIfDisposed(),i.t(this,e)},e.prototype.add=function(e){return this.throwIfDisposed(),i.d(this,e)},e.prototype.addStrict=function(e){return this.throwIfDisposed(),i.e(this,e)},e.prototype.sub=function(e){return this.throwIfDisposed(),i.pc(this,e)},e.prototype.subStrict=function(e){return this.throwIfDisposed(),i.qc(this,e)},e.prototype.pow=function(e){return this.throwIfDisposed(),i.Ab(this,e)},e.prototype.powStrict=function(e){return this.throwIfDisposed(),i.Bb(this,e)},e.prototype.mul=function(e){return this.throwIfDisposed(),i.ib(this,e)},e.prototype.mulStrict=function(e){return this.throwIfDisposed(),i.jb(this,e)},e.prototype.div=function(e){return this.throwIfDisposed(),i.J(this,e)},e.prototype.divStrict=function(e){return this.throwIfDisposed(),i.K(this,e)},e.prototype.minimum=function(e){return this.throwIfDisposed(),i.cb(this,e)},e.prototype.minimumStrict=function(e){return this.throwIfDisposed(),i.db(this,e)},e.prototype.maximum=function(e){return this.throwIfDisposed(),i.Ya(this,e)},e.prototype.maximumStrict=function(e){return this.throwIfDisposed(),i.Za(this,e)},e.prototype.mod=function(e){return this.throwIfDisposed(),i.eb(this,e)},e.prototype.modStrict=function(e){return this.throwIfDisposed(),i.fb(this,e)},e.prototype.squaredDifference=function(e){return this.throwIfDisposed(),i.jc(this,e)},e.prototype.squaredDifferenceStrict=function(e){return this.throwIfDisposed(),i.kc(this,e)},e.prototype.transpose=function(e){return this.throwIfDisposed(),i.Bc(this,e)},e.prototype.notEqual=function(e){return this.throwIfDisposed(),i.ob(this,e)},e.prototype.notEqualStrict=function(e){return this.throwIfDisposed(),i.pb(this,e)},e.prototype.less=function(e){return this.throwIfDisposed(),i.Ea(this,e)},e.prototype.lessStrict=function(e){return this.throwIfDisposed(),i.Ha(this,e)},e.prototype.equal=function(e){return this.throwIfDisposed(),i.N(this,e)},e.prototype.equalStrict=function(e){return this.throwIfDisposed(),i.O(this,e)},e.prototype.lessEqual=function(e){return this.throwIfDisposed(),i.Fa(this,e)},e.prototype.lessEqualStrict=function(e){return this.throwIfDisposed(),i.Ga(this,e)},e.prototype.greater=function(e){return this.throwIfDisposed(),i.Y(this,e)},e.prototype.greaterStrict=function(e){return this.throwIfDisposed(),i.Ba(this,e)},e.prototype.greaterEqual=function(e){return this.throwIfDisposed(),i.Z(this,e)},e.prototype.greaterEqualStrict=function(e){return this.throwIfDisposed(),i.Aa(this,e)},e.prototype.logicalAnd=function(e){return this.throwIfDisposed(),i.Pa(this,e)},e.prototype.logicalOr=function(e){return this.throwIfDisposed(),i.Ra(this,e)},e.prototype.logicalNot=function(){return this.throwIfDisposed(),i.Qa(this)},e.prototype.logicalXor=function(e){return this.throwIfDisposed(),i.Sa(this,e)},e.prototype.where=function(e,t){return this.throwIfDisposed(),i.Gc(e,this,t)},e.prototype.neg=function(){return this.throwIfDisposed(),i.mb(this)},e.prototype.ceil=function(){return this.throwIfDisposed(),i.u(this)},e.prototype.floor=function(){return this.throwIfDisposed(),i.V(this)},e.prototype.sign=function(){return this.throwIfDisposed(),i.Wb(this)},e.prototype.exp=function(){return this.throwIfDisposed(),i.Q(this)},e.prototype.expm1=function(){return this.throwIfDisposed(),i.S(this)},e.prototype.log=function(){return this.throwIfDisposed(),i.La(this)},e.prototype.log1p=function(){return this.throwIfDisposed(),i.Ma(this)},e.prototype.sqrt=function(){return this.throwIfDisposed(),i.hc(this)},e.prototype.rsqrt=function(){return this.throwIfDisposed(),i.Rb(this)},e.prototype.square=function(){return this.throwIfDisposed(),i.ic(this)},e.prototype.reciprocal=function(){return this.throwIfDisposed(),i.Ib(this)},e.prototype.abs=function(){return this.throwIfDisposed(),i.a(this)},e.prototype.clipByValue=function(e,t){return this.throwIfDisposed(),i.v(this,e,t)},e.prototype.relu=function(){return this.throwIfDisposed(),i.Jb(this)},e.prototype.elu=function(){return this.throwIfDisposed(),i.M(this)},e.prototype.selu=function(){return this.throwIfDisposed(),i.Tb(this)},e.prototype.leakyRelu=function(e){return void 0===e&&(e=.2),this.throwIfDisposed(),i.Da(this,e)},e.prototype.prelu=function(e){return this.throwIfDisposed(),i.Cb(this,e)},e.prototype.sigmoid=function(){return this.throwIfDisposed(),i.Vb(this)},e.prototype.logSigmoid=function(){return this.throwIfDisposed(),i.Na(this)},e.prototype.softplus=function(){return this.throwIfDisposed(),i.fc(this)},e.prototype.sin=function(){return this.throwIfDisposed(),i.Xb(this)},e.prototype.cos=function(){return this.throwIfDisposed(),i.F(this)},e.prototype.tan=function(){return this.throwIfDisposed(),i.sc(this)},e.prototype.asin=function(){return this.throwIfDisposed(),i.h(this)},e.prototype.acos=function(){return this.throwIfDisposed(),i.b(this)},e.prototype.atan=function(){return this.throwIfDisposed(),i.j(this)},e.prototype.sinh=function(){return this.throwIfDisposed(),i.Yb(this)},e.prototype.cosh=function(){return this.throwIfDisposed(),i.G(this)},e.prototype.tanh=function(){return this.throwIfDisposed(),i.tc(this)},e.prototype.asinh=function(){return this.throwIfDisposed(),i.i(this)},e.prototype.acosh=function(){return this.throwIfDisposed(),i.c(this)},e.prototype.atanh=function(){return this.throwIfDisposed(),i.l(this)},e.prototype.erf=function(){return this.throwIfDisposed(),i.P(this)},e.prototype.round=function(){return this.throwIfDisposed(),i.Qb(this)},e.prototype.step=function(e){return void 0===e&&(e=0),this.throwIfDisposed(),i.nc(this,e)},e.prototype.softmax=function(e){return void 0===e&&(e=-1),this.throwIfDisposed(),i.ec(this,e)},e.prototype.resizeBilinear=function(e,t){return void 0===t&&(t=!1),this.throwIfDisposed(),i.Ca.resizeBilinear(this,e,t)},e.prototype.resizeNearestNeighbor=function(e,t){return void 0===t&&(t=!1),this.throwIfDisposed(),i.Ca.resizeNearestNeighbor(this,e,t)},e.prototype.conv1d=function(e,t,n,r,a,o){return void 0===r&&(r="NWC"),void 0===a&&(a=1),this.throwIfDisposed(),i.C(this,e,t,n,r,a,o)},e.prototype.conv2d=function(e,t,n,r,a,o){return void 0===r&&(r="NHWC"),void 0===a&&(a=[1,1]),this.throwIfDisposed(),i.D(this,e,t,n,r,a,o)},e.prototype.conv2dTranspose=function(e,t,n,r,a){return this.throwIfDisposed(),i.E(this,e,t,n,r,a)},e.prototype.depthwiseConv2D=function(e,t,n,r,a,o){return void 0===r&&(r="NHWC"),void 0===a&&(a=[1,1]),this.throwIfDisposed(),i.I(this,e,t,n,r,a,o)},e.prototype.avgPool=function(e,t,n,r){return this.throwIfDisposed(),i.m(this,e,t,n,r)},e.prototype.maxPool=function(e,t,n,r){return this.throwIfDisposed(),i.Xa(this,e,t,n,r)},e.prototype.localResponseNormalization=function(e,t,n,r){return void 0===e&&(e=5),void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=.5),i.Ka(this,e,t,n,r)},e.prototype.variable=function(e,t,n){return void 0===e&&(e=!0),this.throwIfDisposed(),h.variable(this,e,t,n)},e.prototype.unsortedSegmentSum=function(e,t,n){return void 0===n&&(n=0),this.throwIfDisposed(),i.Dc(this,e,t,n)},e.nextId=0,l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"flatten",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"asScalar",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"as1D",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"as2D",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"as3D",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"as4D",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"asType",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"buffer",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"data",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"dataSync",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"dispose",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"toFloat",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"toInt",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"toBool",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"print",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"reshape",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"reshapeAs",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"expandDims",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"cumsum",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"squeeze",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"clone",null),l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e.prototype,"toString",null),t=l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],e);var t}(),h=function(e){function t(t,r,a){void 0===r&&(r=!0);var i=e.call(this,t.shape,t.dtype,null,t.dataId)||this;return i.trainable=r,i.name=a,null==i.name&&(i.name=n.nextVarId.toString(),n.nextVarId++),o.ENV.engine.registerVariable(i),i}return c(t,e),n=t,t.variable=function(e,t,r,a){return void 0===t&&(t=!0),null!=a&&a!==e.dtype&&(e=e.asType(a)),new n(e,t,r)},t.prototype.assign=function(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value ("+e.dtype+") and previous value ("+this.dtype+") must match");if(!u.arraysEqual(e.shape,this.shape))throw new Error("shape of the new value ("+e.shape+") and previous value ("+this.shape+") must match");o.ENV.engine.disposeTensor(this),this.dataId=e.dataId,o.ENV.engine.registerTensor(this)},t.nextVarId=0,l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],t.prototype,"assign",null),l([Object(a.a)({heading:"Tensors",subheading:"Creation"})],t,"variable",null),n=l([Object(a.a)({heading:"Tensors",subheading:"Classes"})],t);var n}(p),d=h.variable;function m(e){var t=e.length;if(t<2)return[];var n=new Array(t-1);n[t-2]=e[t-1];for(var r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}},function(e,t,n){"use strict";var r=n(2),a=n(3),o=n(6),i=n(0),s=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},u=function(){function e(){}return e.gradScope=function(e,t){return f(e,t,!0)},e.grad=function(e){return i.assert(i.isFunction(e),"The f passed in grad(f) must be a function"),function(t,n){return i.assert(t instanceof o.a,"The x passed in grad(f)(x) must be a tensor"),i.assert(null==n||n instanceof o.a,"The dy passed in grad(f)(x, dy) must be a tensor"),f(function(){var r=a.ENV.engine.gradients(function(){return e(t)},[t],n),o=r.value,s=r.grads;return null!=n&&i.assertShapesMatch(o.shape,n.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),c(s),s[0]})}},e.grads=function(e){return i.assert(i.isFunction(e),"The f passed in grads(f) must be a function"),function(t,n){return i.assert(Array.isArray(t)&&t.every(function(e){return e instanceof o.a}),"The args passed in grads(f)(args) must be an array of tensors"),i.assert(null==n||n instanceof o.a,"The dy passed in grads(f)(args, dy) must be a tensor"),f(function(){var r=a.ENV.engine.gradients(function(){return e.apply(void 0,t)},t,n),o=r.value,s=r.grads;return null!=n&&i.assertShapesMatch(o.shape,n.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),c(s),s})}},e.valueAndGrad=function(e){return i.assert(i.isFunction(e),"The f passed in valueAndGrad(f) must be a function"),function(t,n){i.assert(t instanceof o.a,"The x passed in valueAndGrad(f)(x) must be a tensor"),i.assert(null==n||n instanceof o.a,"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");var r=a.ENV.engine.gradients(function(){return e(t)},[t],n),s=r.grads,u=r.value;return c(s),{grad:s[0],value:u}}},e.valueAndGrads=function(e){return i.assert(i.isFunction(e),"The f passed in valueAndGrads(f) must be a function"),function(t,n){i.assert(Array.isArray(t)&&t.every(function(e){return e instanceof o.a}),"The args passed in valueAndGrads(f)(args) must be array of tensors"),i.assert(null==n||n instanceof o.a,"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");var r=a.ENV.engine.gradients(function(){return e.apply(void 0,t)},t,n);return null!=n&&i.assertShapesMatch(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),c(r.grads),r}},e.variableGrads=function(e,t){if(i.assert(i.isFunction(e),"The f passed in variableGrads(f) must be a function"),i.assert(null==t||Array.isArray(t)&&t.every(function(e){return e instanceof o.c}),"The varList passed in variableGrads(f, varList) must be an array of variables"),null==t)for(var n in t=[],a.ENV.engine.registeredVariables)t.push(a.ENV.engine.registeredVariables[n]);var r=t.length;t=t.filter(function(e){return e.trainable}),i.assert(t.length>0,"variableGrads() expects at least one of the input variables to be trainable, but none of the "+r+" variables is trainable.");var s=a.ENV.engine.gradients(e,t,null,!0),u=s.value,c=s.grads;i.assert(c.some(function(e){return null!=e}),"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()."),i.assert(0===u.rank,"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+u.rank+" tensor");var l={};return t.forEach(function(e,t){null!=c[t]&&(l[e.name]=c[t])}),{value:u,grads:l}},e.customGrad=function(e){return a.ENV.engine.customGrad(e)},s([Object(r.a)({heading:"Training",subheading:"Gradients"})],e,"grad",null),s([Object(r.a)({heading:"Training",subheading:"Gradients"})],e,"grads",null),s([Object(r.a)({heading:"Training",subheading:"Gradients"})],e,"valueAndGrad",null),s([Object(r.a)({heading:"Training",subheading:"Gradients"})],e,"valueAndGrads",null),s([Object(r.a)({heading:"Training",subheading:"Gradients"})],e,"variableGrads",null),s([Object(r.a)({heading:"Training",subheading:"Gradients"})],e,"customGrad",null),e}();function c(e){if(e.filter(function(e){return null==e}).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 l=n(77);n.d(t,"f",function(){return f}),n.d(t,"e",function(){return p}),n.d(t,"b",function(){return h}),n.d(t,"g",function(){return d}),n.d(t,"c",function(){return m}),n.d(t,"h",function(){return g}),n.d(t,"d",function(){return y}),n.d(t,"i",function(){return v}),n.d(t,"j",function(){return b}),n.d(t,"a",function(){return w});var f=l.a.tidy,p=l.a.keep,h=l.a.dispose,d=l.a.time,m=u.grad,g=u.valueAndGrad,y=u.grads,v=u.valueAndGrads,b=u.variableGrads,w=u.customGrad},function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"c",function(){return i}),n.d(t,"g",function(){return s}),n.d(t,"a",function(){return u}),n.d(t,"d",function(){return c}),n.d(t,"f",function(){return l}),n.d(t,"e",function(){return f});var r=n(0);function a(e,t){for(var n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function o(e,t){for(var n=[],r=e.length,a=0;a<r;a++)-1===t.indexOf(a)&&n.push(e[a]);return[n,t.map(function(t){return e[t]})]}function i(e,t){return function(e,t,n){for(var r=e.length+t.length,a=[],o=0,i=0,s=0;s<r;s++)-1===n.indexOf(s)?a.push(e[o++]):a.push(t[i++]);return a}(e,t.map(function(e){return 1}),t)}function s(e,t){var n=t.length;return e=null==e?t.map(function(e,t){return t}):[].concat(e),r.assert(e.every(function(e){return e>=-n&&e<n}),"All values in axis param must be in range [-"+n+", "+n+") but got axis "+e),r.assert(e.every(function(e){return r.isInt(e)}),"All values in axis param must be integers but got axis "+e),e.map(function(e){return e<0?n+e:e})}function u(e,t,n){r.assert(a(t,n),e+" supports only inner-most axes for now. Got axes "+t+" and rank-"+n+" input.")}function c(e,t){if(a(e,t))return null;for(var n=[],r=0;r<t;++r)-1===e.indexOf(r)&&n.push(r);return e.forEach(function(e){return n.push(e)}),n}function l(e){return e.map(function(e,t){return[t,e]}).sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})}function f(e,t){for(var n=[],r=t-e;r<t;++r)n.push(r);return n}},function(e,t,n){"use strict";var r=n(2),a=n(3),o=n(6),i=n(121),s=n(0),u=n(8),c=n(59),l=n(4),f=n(120),p=function(){function e(e,t,n,r,a){this.mean=e,this.stdDev=t,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=a||Math.random();this.random=f.alea(o.toString())}return e.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var e=this.nextVal;return this.nextVal=NaN,e}for(var t,n,r=!1;!r;){var a=void 0,o=void 0,i=void 0;do{i=(a=2*this.random()-1)*a+(o=2*this.random()-1)*o}while(i>=1||0===i);var s=Math.sqrt(-2*Math.log(i)/i);t=this.mean+this.stdDev*a*s,n=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(t)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(t)},e.prototype.convertValue=function(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)},e.prototype.isValidTruncated=function(e){return e<=this.upper&&e>=this.lower},e}(),h=n(34);n.d(t,"a",function(){return m});var d=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},m=function(){function e(){}return e.tensor=function(e,t,n){void 0===n&&(n="float32");var r=s.inferShape(e);return null!=t&&1!==r.length&&s.assertShapesMatch(t,r,"Error creating a new Tensor. Inferred shape ("+r+") does not match the provided shape ("+t+"). "),s.isTypedArray(e)||Array.isArray(e)||(e=[e]),t=t||r,o.a.make(t,{values:function(e,t){return function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t)?e:(Array.isArray(e)&&(e=s.flatten(e)),s.copyTypedArray(e,t))}(e,n)},n)},e.scalar=function(t,n){if(void 0===n&&(n="float32"),s.isTypedArray(t)||Array.isArray(t))throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean)");return e.tensor(t,[],n)},e.tensor1d=function(t,n){void 0===n&&(n="float32");var r=s.inferShape(t);if(1!==r.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return e.tensor(t,r,n)},e.tensor2d=function(t,n,r){if(void 0===r&&(r="float32"),null!=n&&2!==n.length)throw new Error("tensor2d() requires shape to have two numbers");var a=s.inferShape(t);if(2!==a.length&&1!==a.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===a.length&&null==n)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return n=n||a,e.tensor(t,n,r)},e.tensor3d=function(t,n,r){if(void 0===r&&(r="float32"),null!=n&&3!==n.length)throw new Error("tensor3d() requires shape to have three numbers");var a=s.inferShape(t);if(3!==a.length&&1!==a.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===a.length&&null==n)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return n=n||a,e.tensor(t,n,r)},e.tensor4d=function(t,n,r){if(void 0===r&&(r="float32"),null!=n&&4!==n.length)throw new Error("tensor4d() requires shape to have four numbers");var a=s.inferShape(t);if(4!==a.length&&1!==a.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===a.length&&null==n)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return n=n||a,e.tensor(t,n,r)},e.ones=function(e,t){void 0===t&&(t="float32");var n=function(e,t){for(var n=g(e,t),r=0;r<n.length;r++)n[r]=1;return n}(s.sizeFromShape(e),t);return o.a.make(e,{values:n},t)},e.zeros=function(e,t){void 0===t&&(t="float32");var n=g(s.sizeFromShape(e),t);return o.a.make(e,{values:n},t)},e.fill=function(e,t,n){void 0===n&&(n="float32");var r=s.getTypedArrayFromDType(n,s.sizeFromShape(e));return r.fill(t),o.a.make(e,{values:r},n)},e.onesLike=function(t){return s.assertArgumentsAreTensors({x:t},"onesLike"),e.ones(t.shape,t.dtype)},e.zerosLike=function(t){return s.assertArgumentsAreTensors({x:t},"zerosLike"),e.zeros(t.shape,t.dtype)},e.clone=function(e){return s.assertArgumentsAreTensors({x:e},"clone"),a.ENV.engine.runKernel(function(t){return o.a.make(e.shape,{dataId:e.dataId},e.dtype)},{x:e},function(e){return{x:function(){return e.toFloat()}}})},e.eye=function(t,n,r,a){void 0===a&&(a="float32"),null==n&&(n=t);for(var o=e.buffer([t,n],a),i=t<=n?t:n,s=0;s<i;++s)o.set(1,s,s);var u=o.toTensor().as2D(t,n);if(null==r)return u;if(1===r.length)return e.tile(e.expandDims(u,0),[r[0],1,1]);if(2===r.length)return e.tile(e.expandDims(e.expandDims(u,0),0),[r[0],r[1],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+r.length+"D.")},e.randomNormal=function(t,n,r,a,o){if(void 0===n&&(n=0),void 0===r&&(r=1),null!=a&&"bool"===a)throw new Error("Unsupported data type "+a);for(var i=new p(n,r,a,!1,o),s=e.buffer(t,a),u=0;u<s.values.length;u++)s.values[u]=i.nextValue();return s.toTensor()},e.truncatedNormal=function(t,n,r,a,o){if(void 0===n&&(n=0),void 0===r&&(r=1),null!=a&&"bool"===a)throw new Error("Unsupported data type "+a);for(var i=new p(n,r,a,!0,o),s=e.buffer(t,a),u=0;u<s.values.length;u++)s.values[u]=i.nextValue();return s.toTensor()},e.randomUniform=function(t,n,r,a){void 0===n&&(n=0),void 0===r&&(r=1),void 0===a&&(a="float32");for(var o=e.buffer(t,a),i=0;i<o.values.length;i++)o.values[i]=s.randUniform(n,r);return o.toTensor()},e.rand=function(e,t,n){var r=s.sizeFromShape(e),a=null;if(null==n||"float32"===n)a=new Float32Array(r);else if("int32"===n)a=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type "+n);a=new Uint8Array(r)}for(var i=0;i<r;i++)a[i]=t();return o.a.make(e,{values:a},n)},e.multinomial=function(e,t,n,r){void 0===r&&(r=!1),s.assertArgumentsAreTensors({logits:e},"multinomial");var o=e.size,i=e.rank;if(o<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+o+".");if(i>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+i);n=n||Math.random();var u=1===i?e.as2D(1,-1):e,c=a.ENV.engine.runKernel(function(e){return e.multinomial(u,r,t,n)},{logits2D:u});return 1===i?c.as1D():c},e.oneHot=function(e,t,n,r){if(void 0===n&&(n=1),void 0===r&&(r=0),s.assert("int32"===e.dtype,"Indices must be of dtype `int32`"),t<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+t);return a.ENV.engine.runKernel(function(a){return a.oneHot(e,t,n,r)},{indices:e})},e.fromPixels=function(e,t){if(void 0===t&&(t=3),t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");return a.ENV.engine.fromPixels(e,t)},e.toPixels=function(e,t){return function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function(){var n,r,a,o,i,u,c,l,f,p,h,d,m,g,y,v,b,w,x;return function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,function(k){switch(k.label){case 0:if(s.assertArgumentsAreTensors({img:e},"toPixels"),2!==e.rank&&3!==e.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+e.rank+".");if(n=e.shape.slice(0,2),r=n[0],a=n[1],(o=2===e.rank?1:e.shape[2])>4||2===o)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+o);return i=e.min(),u=e.max(),[4,i.data()];case 1:return c=k.sent()[0],[4,u.data()];case 2:if(l=k.sent()[0],i.dispose(),u.dispose(),"float32"===e.dtype){if(c<0||l>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+c+" - "+l+"].")}else{if("int32"!==e.dtype)throw new Error("Unsupported type for toPixels: "+e.dtype+". Please use float32 or int32 tensors.");if(c<0||l>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+c+" - "+l+"].")}return[4,e.data()];case 3:for(f=k.sent(),p="float32"===e.dtype?255:1,h=new Uint8ClampedArray(a*r*4),d=0;d<r*a;++d)m=void 0,g=void 0,y=void 0,v=void 0,1===o?(m=f[d]*p,g=f[d]*p,y=f[d]*p,v=255):3===o?(m=f[3*d]*p,g=f[3*d+1]*p,y=f[3*d+2]*p,v=255):4===o&&(m=f[4*d]*p,g=f[4*d+1]*p,y=f[4*d+2]*p,v=f[4*d+3]*p),h[0+(b=4*d)]=Math.round(m),h[b+1]=Math.round(g),h[b+2]=Math.round(y),h[b+3]=Math.round(v);return null!=t&&(t.width=a,t.height=r,w=t.getContext("2d"),x=new ImageData(h,a,r),w.putImageData(x,0,0)),[2,h]}})})},e.reshape=function(e,t){return s.assertArgumentsAreTensors({x:e},"reshape"),t=s.inferFromImplicitShape(t,e.size),s.assert(e.size===s.sizeFromShape(t),"new shape and old shape must have the same number of elements."),a.ENV.engine.runKernel(function(n){return n.reshape(e,t)},{x:e},function(t){return{x:function(){return t.reshape(e.shape)}}})},e.squeeze=function(t,n){return s.assertArgumentsAreTensors({x:t},"squeeze"),e.reshape(t,s.squeezeShape(t.shape,n).newShape)},e.cast=function(e,t){return s.assertArgumentsAreTensors({x:e},"cast"),a.ENV.engine.runKernel(function(n){return n.cast(e,t)},{x:e},function(e){return{x:function(){return e.clone()}}})},e.tile=function(t,n){return s.assertArgumentsAreTensors({x:t},"tile"),s.assert(t.rank===n.length,"Error in transpose: rank of input "+t.rank+" must match length of reps "+n+"."),a.ENV.engine.runKernel(function(e){return e.tile(t,n)},{x:t},function(r){return{x:function(){var a=e.zerosLike(t);if(1===t.rank)for(var o=0;o<n[0];++o)a=a.add(r.slice([o*t.shape[0]],[t.shape[0]]));else if(2===t.rank)for(o=0;o<n[0];++o)for(var i=0;i<n[1];++i)a=a.add(r.slice([o*t.shape[0],i*t.shape[1]],[t.shape[0],t.shape[1]]));else if(3===t.rank)for(o=0;o<n[0];++o)for(i=0;i<n[1];++i)for(var s=0;s<n[2];++s)a=a.add(r.slice([o*t.shape[0],i*t.shape[1],s*t.shape[2]],[t.shape[0],t.shape[1],t.shape[2]]));else{if(4!==t.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+t.rank+" tensors yet.");for(o=0;o<n[0];++o)for(i=0;i<n[1];++i)for(s=0;s<n[2];++s)for(var u=0;u<n[3];++u)a=a.add(r.slice([o*t.shape[0],i*t.shape[1],s*t.shape[2],u*t.shape[3]],[t.shape[0],t.shape[1],t.shape[2],t.shape[3]]))}return a}}})},e.gather=function(e,t,n){return void 0===n&&(n=0),s.assertArgumentsAreTensors({x:e,indices:t},"gather"),s.assert("int32"===t.dtype,"Indices must be of dtype `int32`"),n=Object(u.g)(n,e.shape)[0],a.ENV.engine.runKernel(function(r){return r.gather(e,t,n)},{x:e},function(r){return{x:function(){return h.a.unsortedSegmentSum(r,t,e.shape[n],n)}}})},e.pad1d=function(t,n,r){return void 0===r&&(r=0),s.assert(2===n.length,"Invalid number of paddings. Must be length of 2."),e.pad(t,[n],r)},e.pad2d=function(t,n,r){return void 0===r&&(r=0),s.assert(2===n.length&&2===n[0].length&&2===n[1].length,"Invalid number of paddings. Must be length of 2 each."),e.pad(t,n,r)},e.pad3d=function(t,n,r){return void 0===r&&(r=0),s.assert(3===n.length&&2===n[0].length&&2===n[1].length&&2===n[2].length,"Invalid number of paddings. Must be length of 2 each."),e.pad(t,n,r)},e.pad4d=function(t,n,r){return void 0===r&&(r=0),s.assert(4===n.length&&2===n[0].length&&2===n[1].length&&2===n[2].length&&2===n[3].length,"Invalid number of paddings. Must be length of 2 each."),e.pad(t,n,r)},e.pad=function(e,t,n){if(void 0===n&&(n=0),s.assertArgumentsAreTensors({x:e},"pad"),0===e.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var r=t.map(function(e){return e[0]});return a.ENV.engine.runKernel(function(r){return r.pad(e,t,n)},{x:e},function(t){return{x:function(){return t.slice(r,e.shape)}}})},e.stack=function(e,t){if(void 0===t&&(t=0),s.assertArgumentsAreTensors({tensors:e},"stack"),s.assert(e.length>=1,"Pass at least one tensor to tf.stack"),1===e.length)return e[0].expandDims(t);var n=e[0].rank,r=e[0].shape,a=e[0].dtype;s.assert(t<=n,"Axis must be <= rank of the tensor"),e.forEach(function(e){s.assertShapesMatch(r,e.shape,"All tensors passed to stack must have matching shapes")}),e.forEach(function(e){s.assert(a===e.dtype,"All tensors passed to stack must have matching dtypes")});var o=e.map(function(e){return e.expandDims(t)});return c.a.concat(o,t)},e.unstack=function(e,t){void 0===t&&(t=0);for(var n,r=e.shape[t],a=Array(e.rank-1).fill(0),o=0,i=0;i<e.rank;i++)i!==t&&(a[o]=e.shape[i],o++);n=Array(r).fill(1);var s=Array(e.rank).fill(0),u=e.shape.slice();return n.map(function(n){u[t]=n;var r=e.slice(s,u);return s[t]+=n,r.reshape(a)})},e.split=function(e,t,n){var r;void 0===n&&(n=0),s.assertArgumentsAreTensors({x:e},"split"),n=Object(u.g)(n,e.shape)[0],"number"==typeof t?(s.assert(e.shape[n]%t==0,"Number of splits must evenly divide the axis."),r=Array(t).fill(e.shape[n]/t)):(s.assert(e.shape[n]===t.reduce(function(e,t){return e+t}),"The sum of sizes must match the size of the axis dimension."),r=t);var a=Array(e.rank).fill(0),o=e.shape.slice();return r.map(function(t){o[n]=t;var r=e.slice(a,o);return a[n]+=t,r})},e.cumsum=function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===r&&(r=!1),s.assertArgumentsAreTensors({x:e},"cumsum"),t|=0;var o=Object(u.d)([t],e.rank),i=e;null!=o&&(i=e.transpose(o));var c=Object(u.e)(1,e.rank)[0],l=a.ENV.engine.runKernel(function(e){return e.cumsum(i,c,n,r)},{permutedX:i},function(e){return{permutedX:function(){return e.cumsum(t,n,!r)}}});return null!=o&&(l=l.transpose(o)),l},e.expandDims=function(t,n){void 0===n&&(n=0),s.assertArgumentsAreTensors({x:t},"expandDims"),s.assert(n<=t.rank,"Axis must be <= rank of the tensor");var r=t.shape.slice();return r.splice(n,0,1),e.reshape(t,r)},e.linspace=function(t,n,r){if(0===r)throw new Error("Cannot request zero samples");var a=(n-t)/(r-1),o=g(r,"float32");o[0]=t;for(var i=1;i<o.length;i++)o[i]=o[i-1]+a;return e.tensor1d(o,"float32")},e.range=function(t,n,r,a){if(void 0===r&&(r=1),void 0===a&&(a="float32"),0===r)throw new Error("Cannot have a step of zero");if(t===n||t<n&&r<0||n<t&&r>1)return e.zeros([0],a);var o=g(Math.abs(Math.ceil((n-t)/r)),a);n<t&&1===r&&(r=-1),o[0]=t;for(var i=1;i<o.length;i++)o[i]=o[i-1]+r;return e.tensor1d(o,a)},e.buffer=function(e,t,n){return void 0===t&&(t="float32"),new o.b(e,t,n)},e.print=function(e,t){void 0===t&&(t=!1),console.log(i.a(e,t))},d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"tensor",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"scalar",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"tensor1d",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"tensor2d",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"tensor3d",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"tensor4d",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"ones",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"zeros",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"fill",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"onesLike",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"zerosLike",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"clone",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"eye",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"randomNormal",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"truncatedNormal",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"randomUniform",null),d([l.a],e,"rand",null),d([l.a],e,"multinomial",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"oneHot",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"}),l.a],e,"fromPixels",null),d([Object(r.a)({heading:"Visualization"})],e,"toPixels",null),d([Object(r.a)({heading:"Tensors",subheading:"Transformations"}),l.a],e,"reshape",null),d([Object(r.a)({heading:"Tensors",subheading:"Transformations"})],e,"squeeze",null),d([Object(r.a)({heading:"Tensors",subheading:"Transformations"}),l.a],e,"cast",null),d([Object(r.a)({heading:"Tensors",subheading:"Slicing and Joining"}),l.a],e,"tile",null),d([Object(r.a)({heading:"Tensors",subheading:"Slicing and Joining"}),l.a],e,"gather",null),d([Object(r.a)({heading:"Tensors",subheading:"Transformations"}),l.a],e,"pad",null),d([Object(r.a)({heading:"Tensors",subheading:"Slicing and Joining"}),l.a],e,"stack",null),d([Object(r.a)({heading:"Tensors",subheading:"Slicing and Joining"}),l.a],e,"unstack",null),d([Object(r.a)({heading:"Tensors",subheading:"Slicing and Joining"}),l.a],e,"split",null),d([Object(r.a)({heading:"Operations",subheading:"Scan"})],e,"cumsum",null),d([Object(r.a)({heading:"Tensors",subheading:"Transformations"}),l.a],e,"expandDims",null),d([l.a,Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"linspace",null),d([l.a,Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"range",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"buffer",null),d([Object(r.a)({heading:"Tensors",subheading:"Creation"})],e,"print",null),e}();function g(e,t){if(null==t||"float32"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error("Unknown data type $ {dtype}")}},function(e,t,n){"use strict";n.r(t);var r={};n.d(r,"createWebGLRenderingContext",function(){return oe}),n.d(r,"createWebGLRenderingContextFromCanvas",function(){return ie}),n.d(r,"callAndCheck",function(){return se}),n.d(r,"enableDebugWebGLErrorChecking",function(){return ce}),n.d(r,"checkWebGLError",function(){return le}),n.d(r,"getWebGLErrorMessage",function(){return fe}),n.d(r,"getExtensionOrThrow",function(){return pe}),n.d(r,"createVertexShader",function(){return he}),n.d(r,"createFragmentShader",function(){return de}),n.d(r,"createProgram",function(){return ge}),n.d(r,"linkProgram",function(){return ye}),n.d(r,"validateProgram",function(){return ve}),n.d(r,"createStaticVertexBuffer",function(){return be}),n.d(r,"createStaticIndexBuffer",function(){return we}),n.d(r,"queryMaxTextureSize",function(){return xe}),n.d(r,"getChannelsPerTexture",function(){return ke}),n.d(r,"createTexture",function(){return Oe}),n.d(r,"validateTextureSize",function(){return Se}),n.d(r,"createFramebuffer",function(){return Ne}),n.d(r,"bindVertexBufferToProgramAttribute",function(){return Ee}),n.d(r,"bindTextureUnit",function(){return Ie}),n.d(r,"unbindTextureUnit",function(){return Te}),n.d(r,"getProgramUniformLocationOrThrow",function(){return Ae}),n.d(r,"getProgramUniformLocation",function(){return Ce}),n.d(r,"bindTextureToProgramUniformSampler",function(){return Pe}),n.d(r,"bindCanvasToFramebuffer",function(){return _e}),n.d(r,"bindColorTextureToFramebuffer",function(){return Re}),n.d(r,"unbindColorTextureFromFramebuffer",function(){return Me}),n.d(r,"validateFramebuffer",function(){return je}),n.d(r,"getFramebufferErrorMessage",function(){return De}),n.d(r,"getTextureShapeFromLogicalShape",function(){return Fe});var a={};n.d(a,"getWebGLContextAttributes",function(){return Ue}),n.d(a,"createWebGLContext",function(){return We}),n.d(a,"createVertexShader",function(){return Ge}),n.d(a,"createVertexBuffer",function(){return qe}),n.d(a,"createIndexBuffer",function(){return He}),n.d(a,"createMatrixTexture",function(){return Ye}),n.d(a,"createColorMatrixTexture",function(){return Qe}),n.d(a,"createPackedMatrixTexture",function(){return Ze}),n.d(a,"bindVertexProgramAttributeStreams",function(){return $e}),n.d(a,"uploadPixelDataToTexture",function(){return et}),n.d(a,"uploadMatrixToTexture",function(){return nt}),n.d(a,"uploadMatrixToPackedTexture",function(){return rt}),n.d(a,"downloadMatrixFromOutputTextureAsync",function(){return it}),n.d(a,"downloadMatrixFromOutputTexture",function(){return st}),n.d(a,"downloadMatrixFromRGBAColorTexture",function(){return ut}),n.d(a,"downloadMatrixFromPackedOutputTexture",function(){return ct});var o={};n.d(o,"browserFiles",function(){return Un}),n.d(o,"browserHTTPRequest",function(){return Yn}),n.d(o,"copyModel",function(){return tr}),n.d(o,"decodeWeights",function(){return Qt}),n.d(o,"encodeWeights",function(){return Yt}),n.d(o,"getLoadHandlers",function(){return er}),n.d(o,"getModelArtifactsInfoForJSON",function(){return tn}),n.d(o,"getSaveHandlers",function(){return $n}),n.d(o,"listModels",function(){return nr}),n.d(o,"loadWeights",function(){return Hn}),n.d(o,"moveModel",function(){return rr}),n.d(o,"registerLoadRouter",function(){return Zn}),n.d(o,"registerSaveRouter",function(){return Qn}),n.d(o,"removeModel",function(){return ar});var i={};n.d(i,"Serializable",function(){return or}),n.d(i,"SerializationMap",function(){return ir});var s={};n.d(s,"WEBGL_ENVS",function(){return sr}),n.d(s,"CPU_ENVS",function(){return ur}),n.d(s,"ALL_ENVS",function(){return cr}),n.d(s,"TEST_EPSILON",function(){return lr}),n.d(s,"expectArraysClose",function(){return fr}),n.d(s,"expectPromiseToFail",function(){return pr}),n.d(s,"expectArraysEqual",function(){return hr}),n.d(s,"expectNumbersClose",function(){return dr}),n.d(s,"expectValuesInRange",function(){return gr});var u={};n.d(u,"MathBackendWebGL",function(){return Bt}),n.d(u,"GPGPUContext",function(){return pt}),n.d(u,"gpgpu_util",function(){return a}),n.d(u,"webgl_util",function(){return r});var c=n(3),l=n(8),f=n(1),p=30;function h(e){return e<=p?e:function(e,t){for(var n=t;n<e;++n)if(e%n==0)return n;return e}(e,Math.floor(Math.sqrt(e)))}var d=n(87),m=n(6),g=n(20),y=n(0),v=n(9);function b(e,t,n){if(!y.hasEncodingLoss(e.dtype,t))return m.a.make(e.shape,{dataId:e.dataId},t);if("int32"===t)return n.int(e);if("bool"===t)return n.notEqual(e,v.a.scalar(0,e.dtype));throw new Error("Error in Cast: unknown dtype argument ("+t+")")}function w(e,t){return m.a.make(t,{dataId:e.dataId},e.dtype)}var x,k=function(e,t,n){this.variableNames=["A"];var r=e.windowSize,a=e.batchSize,o=e.inSize,i=Math.ceil(o/r);n||this.variableNames.push("bestIndicesA"),this.outputShape=[a,i];var s="max"===t?">":"<",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 = 0;\n float bestValue = getA(batch, inOffset);\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 "},O=function(e){this.variableNames=["dy"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=n-1-e.padInfo.left,s=1/(t*n);this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\n const float avgMultiplier = float("+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 < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.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 "},S=n(11),N=function(e,t,n,r,a,o){this.outputShape=[],this.supportsBroadcasting=!0,this.variableNames=["x","mean","variance"],S.a(e,t),S.a(e,n);var i="0.0";null!=r&&(S.a(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");var s="1.0";null!=a&&(S.a(e,a),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=e,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+i+";\n float scale = "+s+";\n float inv = scale * inversesqrt(variance + float("+o+"));\n setOutput((x - mean) * inv + offset);\n }\n "},E=function(e,t,n){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.outputShape=S.a(t,n),this.userCode="\n float binaryOperation(float a, float b) {\n "+e+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},I=function(e,t,n){this.variableNames=["A"],this.outputShape=e;var r=t.toFixed(20),a=n.toFixed(20);this.userCode="\n void main() {\n float value = getAAtOutCoords();\n if (isNaN(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, "+r+", "+a+"));\n }\n "},T=n(58),A=function(e,t){this.variableNames=["A","B"],this.outputShape=[],this.outputShape=T.c(e,t,1),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n float value = 0.0;\n if (yC < "+e[1]+") {\n value = getA(yR, yC);\n } else {\n yC -= "+e[1]+";\n value = getB(yR, yC);\n }\n\n setOutput(value);\n }\n "},C=function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.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 < "+e.batchSize+"; b++) {\n for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n int xR = wR + yR * "+t+" - "+r+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+a+";\n\n if (xC < 0 || xC >= "+e.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 "},P=function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=n-1-e.padInfo.left;this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\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 < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+t+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.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 < "+e.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 "},_=function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.padInfo.left,o=e.outChannels/e.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 < "+e.batchSize+"; b++) {\n for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n int xR = wR + yR * "+t+" - "+r+";\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+a+";\n\n if (xC < 0 || xC >= "+e.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 "},R=function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=n-1-e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\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 < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+t+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.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 "},M=function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.padInfo.top,n=e.padInfo.left,r=e.strideHeight,a=e.strideWidth,o=e.dilationHeight,i=e.dilationWidth,s=e.filterHeight,u=e.filterWidth,c=4*Math.floor(e.inChannels/4),l=e.inChannels%4;this.userCode="\n const ivec2 strides = ivec2("+r+", "+a+");\n const ivec2 pads = ivec2("+t+", "+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 >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+u+"; wC++) {\n int xC = xCCorner + wC * "+i+";\n\n if (xC < 0 || xC >= "+e.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 "},j=function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.inHeight,n=e.inWidth,r=e.padInfo.top,a=e.padInfo.left,o=e.strideHeight,i=e.strideWidth,s=e.dilationHeight,u=e.dilationWidth,c=e.filterHeight,l=e.filterWidth,f=e.outChannels/e.inChannels;this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+r+", "+a+");\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 >= "+t+") {\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 "};function D(e,t){return[t,e]}function L(e,t){return e*t}!function(e){e[e.FLOAT=0]="FLOAT",e[e.UNSIGNED_BYTE=1]="UNSIGNED_BYTE"}(x||(x={}));var z=-2e4,F=(2e4-z)/255,B=[1,1/255,1/65025,1/16581375],V=[1,255,65025],U=0;function W(e,t){return[Math.ceil(t/2),Math.ceil(e/2)]}function G(e,t){var n=W(e,t);return n[0]*n[1]*4}function q(e,t,n,r){var a=c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")?X:H,o=c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")?J:K,i=e.map(function(e){return"uniform sampler2D "+e.name+";"}).join("\n"),s=e.map(function(e){return function(e,t,n){var r=function(e){var t=e.name,n=e.shapeInfo.texShape,r="get"+t.charAt(0).toUpperCase()+t.slice(1)+"Flat",a=n[0],o=n[1];return 1===o&&1===a?"\n float "+r+"(int index) {\n return sampleTexture("+t+", halfCR);\n }\n ":1===o?"\n float "+r+"(int index) {\n vec2 uv = vec2(0.5, (float(index) + 0.5) / "+a+".0);\n return sampleTexture("+t+", uv);\n }\n ":1===a?"\n float "+r+"(int index) {\n vec2 uv = vec2((float(index) + 0.5) / "+o+".0, 0.5);\n return sampleTexture("+t+", uv);\n }\n ":"\n float "+r+"(int index) {\n vec2 uv = UVfrom1D("+a+", "+o+", index);\n return sampleTexture("+t+", uv);\n }\n "}(e);return r+=function e(t){var n,r=t.shapeInfo.logicalShape;switch(r.length){case 0:return"\n float get"+(n=t.name).charAt(0).toUpperCase()+n.slice(1)+"() {\n return sampleTexture("+n+", halfCR);\n }\n ";case 1:return function(e){var t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);return"\n float "+n+"(int index) {\n return "+n+"Flat(index);\n }\n "}(t);case 2:return function(t){var n=t.shapeInfo.logicalShape,r=t.shapeInfo.texShape,a=t.name,o="get"+a.charAt(0).toUpperCase()+a.slice(1),i=r[0],s=r[1];if(y.arraysEqual(n,r))return"\n float "+o+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+s+".0, "+i+".0);\n return sampleTexture("+a+", uv);\n }\n ";var u=y.squeezeShape(n),c=u.newShape,l=u.keptDims,f=c;if(f.length<n.length){var p=Z(t,f);return"\n "+e(p)+"\n float "+o+"(int row, int col) {\n return "+o+"("+$(["row","col"],l)+");\n }\n "}return 1===s?"\n float "+o+"(int row, int col) {\n int index = row * "+n[1]+" + col;\n vec2 uv = vec2(0.5, (float(index) + 0.5) / "+i+".0);\n return sampleTexture("+a+", uv);\n }\n ":1===i?"\n float "+o+"(int row, int col) {\n int index = row * "+n[1]+" + col;\n vec2 uv = vec2((float(index) + 0.5) / "+s+".0, 0.5);\n return sampleTexture("+a+", uv);\n }\n ":"\n float "+o+"(int row, int col) {\n vec2 uv = UVfrom2D("+i+", "+s+", "+n[1]+", row, col);\n return sampleTexture("+a+", uv);\n }\n"}(t);case 3:return function(t){var n=t.shapeInfo.texShape,r=t.shapeInfo.logicalShape,a=t.name,o="get"+a.charAt(0).toUpperCase()+a.slice(1),i=n[0],s=n[1],u=r[1]*r[2],c=r[2],l=y.squeezeShape(r),f=l.newShape,p=l.keptDims,h=f;if(h.length<r.length){var d=Z(t,h);return"\n "+e(d)+"\n float "+o+"(int row, int col, int depth) {\n return "+o+"("+$(["row","col","depth"],p)+");\n }\n "}return s===u?"\n float "+o+"(int row, int col, int depth) {\n int texR = row;\n int texC = col * "+c+" + depth;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+s+".0, "+i+".0);\n return sampleTexture("+a+", uv);\n }\n ":s===c?"\n float "+o+"(int row, int col, int depth) {\n int texR = row * "+r[1]+" + col;\n int texC = depth;\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+s+".0, "+i+".0);\n return sampleTexture("+a+", uv);\n }\n ":"\n float "+o+"(int row, int col, int depth) {\n vec2 uv = UVfrom3D(\n "+i+", "+s+", "+u+", "+c+", row, col, depth);\n return sampleTexture("+a+", uv);\n }\n "}(t);case 4:return function(t){var n=t.shapeInfo.logicalShape,r=t.shapeInfo.texShape,a=t.name,o="get"+a.charAt(0).toUpperCase()+a.slice(1),i=r[0],s=r[1],u=n[3],c=n[2]*u,l=n[1]*c,f=y.squeezeShape(n),p=f.newShape,h=f.keptDims;if(p.length<n.length){var d=Z(t,p);return"\n "+e(d)+"\n float "+o+"(int row, int col, int depth, int depth2) {\n return "+o+"("+$(["row","col","depth","depth2"],h)+");\n }\n "}return s===l?"\n float "+o+"(int row, int col, int depth, int depth2) {\n int texR = row;\n int texC = col * "+c+" + depth * "+u+" + depth2;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+s+".0, "+i+".0);\n return sampleTexture("+a+", uv);\n }\n ":s===u?"\n float "+o+"(int row, int col, int depth, int depth2) {\n int texR = row * "+n[1]*n[2]+" + col * "+n[2]+" + depth;\n int texC = depth2;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+s+".0, "+i+".0);\n return sampleTexture("+a+", uv);\n }\n ":"\n float "+o+"(int row, int col, int depth, int depth2) {\n vec2 uv = UVfrom4D("+i+", "+s+", "+l+", "+c+",\n "+u+", row, col, depth, depth2);\n return sampleTexture("+a+", uv);\n }\n "}(t);default:throw new Error(r.length+"-D input sampling is not yet supported")}}(e),(n||y.arraysEqual(e.shapeInfo.logicalShape,t.logicalShape))&&(r+=function(e,t,n){var r=e.shapeInfo.texShape,a=e.name,o=a.charAt(0).toUpperCase()+a.slice(1),i="get"+o+"AtOutCoords",s=S.c(e.shapeInfo.logicalShape,t.logicalShape),u=e.shapeInfo.logicalShape.length,c=t.logicalShape.length,l=n&&(c>u||s.length>0),f=S.b(s);if(l&&!f)return function(e,t,n,r){var a=e.shapeInfo.logicalShape.length,o=t.logicalShape.length,i="int";2===o?i="ivec2":3===o?i="ivec3":4===o&&(i="ivec4");var s=S.c(e.shapeInfo.logicalShape,t.logicalShape),u=o-a;return"\n float "+r+"() {\n "+i+" coords = getOutputCoords();\n "+(0===a?"":o<2&&s.length>=1?"coords = 0;":s.map(function(e){return"coords["+(e+u)+"] = 0;"}).join("\n"))+"\n return get"+n+"("+(o<2&&a>0?"coords":e.shapeInfo.logicalShape.map(function(e,t){return"coords["+(t+u)+"]"}).join(", "))+");\n }\n "}(e,t,o,i);var p=t.texShape;if(y.arraysEqual(r,p))return"\n float "+i+"() {\n return sampleTexture("+a+", resultUV);\n }\n ";var h=y.sizeFromShape(r),d="";return l&&f&&(d="\n int mainPart = index / "+h+";\n index -= mainPart * "+h+";\n "),"\n float "+i+"() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+p[0]+", "+p[1]+"));\n int index = resTexRC.x * "+p[1]+" + resTexRC.y;\n "+d+"\n int texR = index / "+r[1]+";\n int texC = index - texR * "+r[1]+";\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+r[1]+".0, "+r[0]+".0);\n\n return sampleTexture("+a+", uv);\n }\n "}(e,t,n)),r}(e,t,r)}).join("\n"),u=t.texShape,l=function(e,t){switch(e.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(e,t){return 1===t[0]?"\n int getOutputCoords() {\n return int(resultUV.x * "+t[1]+".0);\n }\n ":1===t[1]?"\n int getOutputCoords() {\n return int(resultUV.y * "+t[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n return resTexRC.x * "+t[1]+" + resTexRC.y;\n }\n "}(0,t);case 2:return function(e,t){return y.arraysEqual(e,t)?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2("+t[0]+", "+t[1]+"));\n }\n ":1===e[1]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n return ivec2(index, 0);\n }\n ":1===e[0]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n int r = index / "+e[1]+";\n int c = index - r * "+e[1]+";\n return ivec2(r, c);\n }\n "}(e,t);case 3:return r=t,a=(n=e)[1]*n[2],o=n[2],"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+r[0]+", "+r[1]+"));\n int index = resTexRC.x * "+r[1]+" + resTexRC.y;\n int r = index / "+a+";\n index -= r * "+a+";\n int c = index / "+o+";\n int d = index - c * "+o+";\n return ivec3(r, c, d);\n }\n ";case 4:return function(e,t){var n=e[3],r=e[2]*n,a=e[1]*r;return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+t[0]+", "+t[1]+"));\n int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n int r = index / "+a+";\n index -= r * "+a+";\n\n int c = index / "+r+";\n index -= c * "+r+";\n\n int d = index / "+n+";\n int d2 = index - d * "+n+";\n\n return ivec4(r, c, d, d2);\n }\n "}(e,t);default:throw new Error(e.length+"-D output sampling is not yet supported")}var n,r,a,o}(t.logicalShape,u);return[Y,a,o,i,l,s,n].join("\n")}var H="\n uniform float NaN;\n\n const vec4 floatDeltas = vec4(\n 1.0,\n 1.0 / 255.0,\n 1.0 / (255.0 * 255.0),\n 1.0 / (255.0 * 255.0 * 255.0)\n );\n const float minValue = "+z+".0;\n const float maxValue = 20000.0;\n const float range = (maxValue - minValue) / 255.0;\n const vec2 dotRange = vec2(1.0, range);\n\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n vec4 sampleValue = texture2D(textureSampler, uv);\n if (all(equal(sampleValue, vec4("+U+")))) {\n return NaN;\n }\n\n vec4 encValue = floor(sampleValue * 255.0 + 0.5);\n float decodedValue = dot(encValue, floatDeltas);\n return dot(vec2(minValue, decodedValue), dotRange);\n }\n",K="\n const vec4 floatPowers = vec4(\n 1.0,\n 255.0,\n 255.0 * 255.0,\n 255.0 * 255.0 * 255.0\n );\n const vec2 recipRange = vec2(1.0/range);\n const vec2 recipRange255 = vec2(1.0/(maxValue - minValue));\n\n void setOutput(float decodedValue) {\n if (isNaN(decodedValue)) {\n gl_FragColor = vec4("+U+");\n return;\n }\n\n float a = dot(vec2(decodedValue, -minValue), recipRange);\n float b = fract(a) * 255.0;\n float c = fract(b) * 255.0;\n float d = fract(c) * 255.0;\n gl_FragColor = floor(vec4(a, b, c, d)) / 255.0;\n\n // TODO(dsmilkov): Version above gets better accuracy but probably slower\n // than the version below. Benchmark to determine if the accuracy is worth\n // the cost.\n\n // float normValue = dot(vec2(decodedValue, -minValue), recipRange255);\n // vec4 f = normValue * floatPowers;\n // gl_FragColor = floor(fract(f) * 255.0) / 255.0;\n }\n",X="\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return texture2D(textureSampler, uv).r;\n }\n",J="\n void setOutput(float val) {\n gl_FragColor = vec4(val, 0, 0, 0);\n }\n",Y="\n precision highp float;\n precision highp int;\n varying vec2 resultUV;\n const vec2 halfCR = vec2(0.5, 0.5);\n\n bool isNaN(float val) {\n float v1 = val * val;\n float v2 = val * val;\n return v1 == v2 ? false : true;\n }\n\n bool hasNaN(vec4 values) {\n vec4 v1 = values * values;\n vec4 v2 = values * values;\n return any(notEqual(v1, v2));\n }\n\n float getNaN(vec4 values) {\n return dot(vec4(1), values);\n }\n\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n int imod(int x, int y) {\n return x - y * (x / y);\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 \nvec2 UVfrom1D(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}\n\n \nvec2 UVfrom2D(int texNumR, int texNumC, int numC, int row, int col) {\n int index = row * numC + col;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n\n \nvec2 UVfrom3D(int texNumR, int texNumC, int stride0,\n int stride1, int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n\n \nvec2 UVfrom4D(int texNumR, int texNumC, int stride0,\n int stride1, int stride2, int row, int col, int depth,\n int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * stride0 + col * stride1 + depth * stride2 + depth2;\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n\n";function Q(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";throw Error("GPU for rank "+e+" is not yet supported")}function Z(e,t){var n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function $(e,t){return t.map(function(t){return e[t]}).join(", ")}var ee=function(e,t,n){this.variableNames=["x"],this.outputShape=e;var r=e.length,a=e[e.length-1],o=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+a+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+Q(r)+" coords = getOutputCoords();\n int end = "+te(r,"coords")+";\n float val = 0.0;\n for (int i = "+a+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+o+" end) {\n continue;\n }\n if (idx == end && "+t+") {\n continue;\n }\n "+te(r,"coords")+" = idx;\n val += getX("+function(e,t){if(1===e)return""+t;if(2===e)return t+".x, "+t+".y";if(3===e)return t+".x, "+t+".y, "+t+".z";if(4===e)return t+".x, "+t+".y, "+t+".z, "+t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}(r,"coords")+");\n }\n setOutput(val);\n }\n "};function te(e,t){if(1===e)return""+t;if(2===e)return t+".y";if(3===e)return t+".z";if(4===e)return t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}var ne=function(e){this.variableNames=["A"];var t=e[0],n=e[1];this.outputShape=e,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("+n+".0, "+t+".0);\n\n vec4 values = 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 "},re=function(e,t,n){this.variableNames=["A","indices"];var r=e.slice();r[n]=t,this.outputShape=r,this.rank=r.length;var a=Q(this.rank),o=function(e,t){var n=e.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"],a=[],o=0;o<e.length;o++)o===t?a.push("int(getIndices("+r[o]+"))"):a.push(""+r[o]);return a.join()}(e,n);this.userCode="\n void main() {\n "+a+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "},ae=null;function oe(e){var t=document.createElement("canvas");return t.width=1,t.height=1,ie(t,e)}function ie(e,t){var n,r=c.ENV.get("WEBGL_VERSION");if(2===r?n=e.getContext("webgl2",t):1===r&&(n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)),0===r||null==n)throw new Error("This browser does not support WebGL.");return n}function se(e,t){var n=t();return le(e),n}var ue=!1;function ce(e){ue=e}function le(e){if(ue){var t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+fe(e,t))}}function fe(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+t}}function pe(e,t){return Le(e,function(){return e.getExtension(t)},'Extension "'+t+'" not supported on this browser.')}function he(e,t){var n=Le(e,function(){return e.createShader(e.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(se(e,function(){return e.shaderSource(n,t)}),se(e,function(){return e.compileShader(n)}),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function de(e,t){var n=Le(e,function(){return e.createShader(e.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(se(e,function(){return e.shaderSource(n,t)}),se(e,function(){return e.compileShader(n)}),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw function(e,t){var n=me.exec(t);if(null==n)return console.log("Couldn't parse line number in error: "+t),void console.log(e);for(var r=+n[1],a=e.split("\n"),o=a.length.toString().length+2,i=a.map(function(e,t){return y.rightPad((t+1).toString(),o)+e}),s=0,u=0;u<i.length;u++)s=Math.max(i[u].length,s);var c=i.slice(0,r-1),l=i.slice(r-1,r),f=i.slice(r);console.log(c.join("\n")),console.log(t.split("\n")[0]),console.log("%c "+y.rightPad(l[0],s),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(f.join("\n"))}(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var me=/ERROR: [0-9]+:([0-9]+):/g;function ge(e){return Le(e,function(){return e.createProgram()},"Unable to create WebGLProgram.")}function ye(e,t){if(se(e,function(){return e.linkProgram(t)}),!1===e.getProgramParameter(t,e.LINK_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function ve(e,t){if(se(e,function(){return e.validateProgram(t)}),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function be(e,t){var n=Le(e,function(){return e.createBuffer()},"Unable to create WebGLBuffer");return se(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,n)}),se(e,function(){return e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)}),n}function we(e,t){var n=Le(e,function(){return e.createBuffer()},"Unable to create WebGLBuffer");return se(e,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)}),se(e,function(){return e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)}),n}function xe(e){return null!=ae?ae:ae=se(e,function(){return e.getParameter(e.MAX_TEXTURE_SIZE)})}function ke(){return c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")&&2===c.ENV.get("WEBGL_VERSION")?1:4}function Oe(e){return Le(e,function(){return e.createTexture()},"Unable to create WebGLTexture.")}function Se(e,t,n){var r=xe(e);if(t<=0||n<=0){var a="["+t+"x"+n+"]";throw new Error("Requested texture size "+a+" is invalid.")}if(t>r||n>r)throw a="["+t+"x"+n+"]",new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU ["+r+"x"+r+"].")}function Ne(e){return Le(e,function(){return e.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function Ee(e,t,n,r,a,o,i){var s=e.getAttribLocation(t,n);return-1!==s&&(se(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,r)}),se(e,function(){return e.vertexAttribPointer(s,a,e.FLOAT,!1,o,i)}),se(e,function(){return e.enableVertexAttribArray(s)}),!0)}function Ie(e,t,n){ze(e,n),se(e,function(){return e.activeTexture(e.TEXTURE0+n)}),se(e,function(){return e.bindTexture(e.TEXTURE_2D,t)})}function Te(e,t){ze(e,t),se(e,function(){return e.activeTexture(e.TEXTURE0+t)}),se(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function Ae(e,t,n){return Le(e,function(){return e.getUniformLocation(t,n)},'uniform "'+n+'" not present in program.')}function Ce(e,t,n){return e.getUniformLocation(t,n)}function Pe(e,t,n,r,a){se(e,function(){return Ie(e,n,a)}),se(e,function(){return e.uniform1i(r,a)})}function _e(e){se(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),se(e,function(){return e.viewport(0,0,e.canvas.width,e.canvas.height)}),se(e,function(){return e.scissor(0,0,e.canvas.width,e.canvas.height)})}function Re(e,t,n){se(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,n)}),se(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)})}function Me(e,t){se(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)}),se(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)})}function je(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+De(e,t))}function De(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+t}}function Le(e,t,n){var r=se(e,function(){return t()});if(null==r)throw new Error(n);return r}function ze(e,t){var n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function Fe(e,t){2!==t.length&&(t=y.squeezeShape(t).newShape);var n=xe(e),r=y.sizeFromShape(t);return t.length<=1&&r<=n?[r,1]:2===t.length&&t[0]<=n&&t[1]<=n?t:3===t.length&&t[0]<=n&&t[1]*t[2]<=n?[t[0],t[1]*t[2]]:4===t.length&&t[0]<=n&&t[1]*t[2]*t[3]<=n?[t[0],t[1]*t[2]*t[3]]:y.sizeToSquarishShape(r)}var Be=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Ve=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function Ue(){return{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0}}function We(e){var t,n={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};return se(t=null!=e?ie(e,n):oe(n),function(){return t.disable(t.DEPTH_TEST)}),se(t,function(){return t.disable(t.STENCIL_TEST)}),se(t,function(){return t.disable(t.BLEND)}),se(t,function(){return t.disable(t.DITHER)}),se(t,function(){return t.disable(t.POLYGON_OFFSET_FILL)}),se(t,function(){return t.disable(t.SAMPLE_COVERAGE)}),se(t,function(){return t.enable(t.SCISSOR_TEST)}),se(t,function(){return t.enable(t.CULL_FACE)}),se(t,function(){return t.cullFace(t.BACK)}),t}function Ge(e){return he(e,"\n precision highp float;\n attribute vec3 clipSpacePos;\n attribute vec2 uv;\n varying vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function qe(e){return be(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function He(e){return we(e,new Uint16Array([0,1,2,2,1,3]))}function Ke(e,t){return c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")&&2===c.ENV.get("WEBGL_VERSION")?4===t?e.RGBA:e.RED:e.RGBA}function Xe(e){return c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")?e.FLOAT:e.UNSIGNED_BYTE}function Je(e,t,n,r){Se(e,t,n);var a=Oe(e),o=e.TEXTURE_2D,i=function(e,t){return c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")&&2===c.ENV.get("WEBGL_VERSION")?4===t?e.RGBA32F:e.R32F:e.RGBA}(e,r),s=Ke(e,r);return se(e,function(){return e.bindTexture(o,a)}),se(e,function(){return e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)}),se(e,function(){return e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}),se(e,function(){return e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST)}),se(e,function(){return e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST)}),se(e,function(){return e.texImage2D(o,0,i,t,n,0,s,Xe(e),null)}),se(e,function(){return e.bindTexture(e.TEXTURE_2D,null)}),a}function Ye(e,t,n){var r=D(t,n);return Je(e,r[0],r[1],1)}function Qe(e,t,n){var r=function(e,t){return[4*n,e]}(t);return Je(e,r[0],r[1],4)}function Ze(e,t,n){var r=W(t,n);return Je(e,r[0],r[1],4)}function $e(e,t,n){return se(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,n)}),Ee(e,t,"clipSpacePos",n,3,20,0)&&Ee(e,t,"uv",n,2,20,12)}function et(e,t,n){se(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),se(e,function(){return e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}),se(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function tt(e,t,n,r,a,o){var i=Ke(e,o);Se(e,n,r),se(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),se(e,function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,i,Xe(e),a)}),se(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function nt(e,t,n,r,a,o){var i,s=D(n,r),u=s[0],l=s[1];if(c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")){var f=1===o?ke():o;1===f?i=a:function(e,t,n){var r=L(e.length,n);if(t.length<r)throw new Error("unpackedArray length ("+t.length+") must be >= "+r);for(var a=0,o=0;o<e.length;++o)t[a]=e[o],a+=n}(a,i=new Float32Array(L(a.length,f)),f)}else i=function(e){for(var t=new Uint8Array(4*e.length),n=function(n){var r=e[n/4];if(isNaN(r))return t[n]=U,t[n+1]=U,t[n+2]=U,t[n+3]=U,"continue";var a=(r-z)/F,o=V.map(function(e){return e*a}).map(function(e){return Math.floor(e%1*255)});t[n]=Math.floor(a),t[n+1]=o[0],t[n+2]=o[1],t[n+3]=o[2]},r=0;r<t.length;r+=4)n(r);return t}(a);tt(e,t,u,l,i,o)}function rt(e,t,n,r,a){var o=W(n,r),i=o[0],s=o[1],u=new Float32Array(G(n,r));!function(e,t,n,r){var a=G(t,n);if(r.length<a)throw new Error("packedRGBA length ("+r.length+") must be >= "+a);for(var o=W(t,n),i=o[0],s=o[1],u=n%2==1,c=t%2==1,l=Math.floor(n/2),f=Math.floor(t/2),p=u?4:0,h=n,d=0,m=0;m<f;++m){for(var g=2*m*n,y=0;y<l;++y){var v=g+2*y;r[d]=e[v],r[d+1]=e[v+1],r[d+2]=e[v+h],r[d+3]=e[v+h+1],d+=4}d+=p}if(u){v=n-1,d=4*(i-1);var b=2*n;for(p=4*i,m=0;m<f;++m)r[d]=e[v],r[d+2]=e[v+n],v+=b,d+=p}if(c)for(v=(t-1)*n,d=(s-1)*i*4,y=0;y<l;++y)r[d++]=e[v++],r[d++]=e[v++],d+=2;u&&c&&(r[r.length-4]=e[e.length-1])}(a,n,r,u),tt(e,t,i,s,u,4)}function at(e,t,n){return c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")?new Float32Array(L(e*t,n)):new Uint8Array(e*t*n)}function ot(e,t,n,r){if(c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")){var a=new Float32Array(t*n);return function(e,t,n){var r=function(e,t){if(e%t!=0)throw new Error("unpackedSize ("+e+") must be a multiple of "+t);return e/t}(e.length,n);if(t.length<r)throw new Error("matrix length ("+t.length+") must be >= "+r);for(var a=0,o=0;o<e.length;o+=n)t[a++]=e[o]}(e,a,r),a}return function(e){for(var t=new Float32Array(e.length/4),n=function(n){if(e[n]===U&&e[n+1]===U&&e[n+2]===U&&e[n+3]===U)return t[n/4]=NaN,"continue";var r=0;B.forEach(function(t,a){r+=t*e[n+a]});var a=r*F+z;t[n/4]=a},r=0;r<e.length;r+=4)n(r);return t}(e)}function it(e,t,n,r){return Be(this,void 0,void 0,function(){var a,o,i,s,u;return Ve(this,function(c){switch(c.label){case 0:return a=e,i=at(n,r,o=4),s=i instanceof Float32Array?4*i.length:i,u=e.createBuffer(),se(e,function(){return e.bindBuffer(a.PIXEL_PACK_BUFFER,u)}),se(e,function(){return e.bufferData(a.PIXEL_PACK_BUFFER,s,e.STATIC_DRAW)}),se(e,function(){return a.readPixels(0,0,r,n,e.RGBA,Xe(e),0)}),[4,t.getBufferSubDataAsync(a.PIXEL_PACK_BUFFER,0,i)];case 1:return c.sent(),[2,ot(i,n,r,o)]}})})}function st(e,t,n){var r=D(t,n),a=r[0],o=r[1],i=at(t,n,4);return se(e,function(){return e.readPixels(0,0,a,o,e.RGBA,Xe(e),i)}),ot(i,t,n,4)}function ut(e,t,n,r){var a=t*n*4,o=new Uint8Array(a);se(e,function(){return e.readPixels(0,0,n,t,e.RGBA,e.UNSIGNED_BYTE,o)});for(var i=new Float32Array(a),s=0;s<o.length;s++)i[s]=o[s];var u=new Float32Array(t*n*r);return function(e,t,n){var r=e.length*n/4;if(t.length<r)throw new Error("matrix length ("+t.length+") must be >= "+r);for(var a=0,o=0;o<e.length;o+=4)for(var i=0;i<n;i++)t[a++]=e[o+i]}(i,u,r),u}function ct(e,t,n){var r=W(t,n),a=r[0],o=r[1],i=new Float32Array(G(t,n));se(e,function(){return e.readPixels(0,0,a,o,e.RGBA,Xe(e),i)});var s=new Float32Array(t*n);return function(e,t,n,r){var a=t*n;if(a<r.length)throw new Error("matrix length ("+r.length+") must be >= "+a);for(var o=n%2==1,i=t%2==1,s=Math.floor(n/2),u=Math.floor(t/2),c=W(t,n),l=c[0],f=c[1],p=o?4:0,h=n+(o?1:0),d=0,m=0,g=n,y=0;y<u;++y){for(var v=0;v<s;++v)r[m++]=e[d++],r[m++]=e[d++],r[g++]=e[d++],r[g++]=e[d++];d+=p,m+=h,g+=h}if(o){d=4*(l-1);var b=n-1;for(p=4*l,h=2*n,y=0;y<u;++y)r[b]=e[d],r[b+n]=e[d+2],d+=p,b+=h}if(i)for(d=(f-1)*l*4,b=(t-1)*n,v=0;v<s;++v)r[b++]=e[d++],r[b++]=e[d++],d+=2;return o&&i&&(r[r.length-1]=e[e.length-4]),r}(i,t,n,s)}var lt=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},ft=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},pt=function(){function e(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.autoDebugValidate=!1,this.vertexAttrsAreBound=!1,this.gl=null!=e?e:We(),1===c.ENV.get("WEBGL_VERSION")?(this.textureFloatExtension=pe(this.gl,"OES_texture_float"),this.colorBufferFloatExtension=this.gl.getExtension("WEBGL_color_buffer_float")):this.colorBufferFloatExtension=pe(this.gl,"EXT_color_buffer_float"),this.loseContextExtension=pe(this.gl,"WEBGL_lose_context"),c.ENV.get("WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED")&&(this.getBufferSubDataAsyncExtension=this.gl.getExtension("WEBGL_get_buffer_sub_data_async")),this.vertexBuffer=qe(this.gl),this.indexBuffer=He(this.gl),this.framebuffer=Ne(this.gl)}return e.prototype.dispose=function(){var e=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 t=this.gl;se(t,function(){return t.finish()}),se(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),se(t,function(){return t.deleteFramebuffer(e.framebuffer)}),se(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,null)}),se(t,function(){return t.deleteBuffer(e.vertexBuffer)}),se(t,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}),se(t,function(){return t.deleteBuffer(e.indexBuffer)}),this.loseContextExtension.loseContext(),this.disposed=!0}},e.prototype.enableAutomaticDebugValidation=function(e){this.autoDebugValidate=e,ce(e)},e.prototype.createMatrixTexture=function(e,t){return this.throwIfDisposed(),Ye(this.gl,e,t)},e.prototype.uploadPixelDataToTexture=function(e,t){this.throwIfDisposed(),et(this.gl,e,t)},e.prototype.createPackedMatrixTexture=function(e,t){return this.throwIfDisposed(),Ze(this.gl,e,t)},e.prototype.deleteMatrixTexture=function(e){var t=this;this.throwIfDisposed(),this.outputTexture===e&&(Me(this.gl,this.framebuffer),this.outputTexture=null),se(this.gl,function(){return t.gl.deleteTexture(e)})},e.prototype.uploadMatrixToTexture=function(e,t,n,r){return this.throwIfDisposed(),nt(this.gl,e,t,n,r,1)},e.prototype.uploadMatrixToPackedTexture=function(e,t,n,r){return this.throwIfDisposed(),rt(this.gl,e,t,n,r)},e.prototype.downloadMatrixFromTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return st(r.gl,t,n)})},e.prototype.downloadMatrixFromTextureAsync=function(e,t,n){return lt(this,void 0,void 0,function(){var r=this;return ft(this,function(a){if(null==this.getBufferSubDataAsyncExtension)throw new Error("Cannot download matrix from output texture asynchronously, WEBGL_get_buffer_sub_data_async is not enabled.");return[2,this.downloadMatrixDriverAsync(e,function(){return it(r.gl,r.getBufferSubDataAsyncExtension,t,n)})]})})},e.prototype.downloadMatrixFromRGBAColorTexture=function(e,t,n,r){var a=this;return this.downloadMatrixDriver(e,function(){return ut(a.gl,t,n,r)})},e.prototype.downloadMatrixFromPackedTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return ct(r.gl,t,n)})},e.prototype.createProgram=function(e){this.throwIfDisposed();var t=this.gl,n=de(t,e),r=Ge(t),a=ge(t);return se(t,function(){return t.attachShader(a,r)}),se(t,function(){return t.attachShader(a,n)}),ye(t,a),this.autoDebugValidate&&ve(t,a),this.vertexAttrsAreBound||(this.setProgram(a),this.vertexAttrsAreBound=$e(t,this.program,this.vertexBuffer)),a},e.prototype.deleteProgram=function(e){var t=this;this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&se(this.gl,function(){return t.gl.deleteProgram(e)})},e.prototype.setProgram=function(e){var t=this;this.throwIfDisposed(),this.program=e,null!=this.program&&this.autoDebugValidate&&ve(this.gl,this.program),se(this.gl,function(){return t.gl.useProgram(e)})},e.prototype.getUniformLocation=function(e,t,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?Ae(this.gl,e,t):Ce(this.gl,e,t)},e.prototype.getAttributeLocation=function(e,t){var n=this;return this.throwIfDisposed(),se(this.gl,function(){return n.gl.getAttribLocation(e,t)})},e.prototype.getUniformLocationNoThrow=function(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)},e.prototype.setInputMatrixTexture=function(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),Pe(this.gl,this.program,e,t,n)},e.prototype.setOutputMatrixTexture=function(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)},e.prototype.setOutputPackedMatrixTexture=function(e,t,n){this.throwIfDisposed();var r=W(t,n),a=r[0],o=r[1];this.setOutputMatrixTextureDriver(e,a,o)},e.prototype.setOutputMatrixWriteRegion=function(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)},e.prototype.setOutputPackedMatrixWriteRegion=function(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},e.prototype.debugValidate=function(){null!=this.program&&ve(this.gl,this.program),je(this.gl)},e.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var e=this.gl;this.autoDebugValidate&&this.debugValidate(),se(e,function(){return e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)})},e.prototype.blockUntilAllProgramsCompleted=function(){var e=this;this.throwIfDisposed(),se(this.gl,function(){return e.gl.finish()})},e.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=pe(this.gl,2===c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},e.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},e.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},e.prototype.runQuery=function(e){var t=this.beginQuery();return e(),this.endQuery(),this.pollQueryTime(t)},e.prototype.beginQuery=function(){if(2===c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),a=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,a),a},e.prototype.endQuery=function(){if(2!==c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}else{var t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT)}},e.prototype.isQueryAvailable=function(e,t){if(0===t)return!0;if(2===t){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),a=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE),o=this.gl.getParameter(r.GPU_DISJOINT_EXT);return a&&!o}return a=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(e,r.QUERY_RESULT_AVAILABLE_EXT),o=this.gl.getParameter(r.GPU_DISJOINT_EXT),a&&!o},e.prototype.pollQueryTime=function(e){var t=this;return new Promise(function(n,r){var a=c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION");y.repeatedTry(function(){return t.isQueryAvailable(e,a)}).then(function(){return n(t.getQueryTime(e,a))}).catch(function(){console.warn("Disjoint query timer never available."),n(-1)})})},e.prototype.getQueryTime=function(e,t){if(0===t)return null;if(2===t){var n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(e,r.QUERY_RESULT_EXT)/1e6},e.prototype.downloadMatrixDriverSetup=function(e){this.throwIfDisposed(),Re(this.gl,e,this.framebuffer),this.autoDebugValidate&&je(this.gl)},e.prototype.downloadMatrixDriverTeardown=function(){null!=this.outputTexture?(Re(this.gl,this.outputTexture,this.framebuffer),this.autoDebugValidate&&je(this.gl)):Me(this.gl,this.framebuffer)},e.prototype.downloadMatrixDriver=function(e,t){this.downloadMatrixDriverSetup(e);var n=t();return this.downloadMatrixDriverTeardown(),n},e.prototype.downloadMatrixDriverAsync=function(e,t){return lt(this,void 0,void 0,function(){var n;return ft(this,function(r){switch(r.label){case 0:return this.downloadMatrixDriverSetup(e),[4,t()];case 1:return n=r.sent(),this.downloadMatrixDriverTeardown(),[2,n]}})})},e.prototype.setOutputMatrixTextureDriver=function(e,t,n){this.throwIfDisposed();var r=this.gl;Re(r,e,this.framebuffer),this.autoDebugValidate&&je(r),this.outputTexture=e,se(r,function(){return r.viewport(0,0,t,n)}),se(r,function(){return r.scissor(0,0,t,n)})},e.prototype.setOutputMatrixWriteRegionDriver=function(e,t,n,r){var a=this;this.throwIfDisposed(),se(this.gl,function(){return a.gl.scissor(e,t,n,r)})},e.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},e.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},e}();function ht(){return!c.ENV.get("WEBGL_FLOAT_TEXTURE_ENABLED")}function dt(e,t){if(e.length!==t.length)throw Error("Binary was compiled with "+e.length+" inputs, but was executed with "+t.length+" inputs");e.forEach(function(e,n){var r=e.logicalShape,a=e.texShape,o=t[n].tensor.shape,i=t[n].texData.texShape;if(!y.arraysEqual(r,o))throw Error("Binary was compiled with different shapes than the current args. Shapes "+r+" and "+o+" must match");if(!y.arraysEqual(a,i))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+a+" and "+i+" must match")})}var mt=function(e,t,n){var r,a;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)a="resRC",r="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],s=[],u=0;u<t.length;u++)s.push(""+o[u]),u<e&&i.push(""+o[u]);r=i.join(),a=s.join()}var c=Q(n);this.userCode="\n void main() {\n "+c+" resRC = getOutputCoords();\n float cVal = getC("+r+");\n if (cVal >= 1.0) {\n setOutput(getA("+a+"));\n } else {\n setOutput(getB("+a+"));\n }\n }\n "},gt=function(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[];var o,i=t,s=e[3]-1;this.outputShape=e;var u="float("+n+") + float("+r+") * sum";o=.5===a?"inversesqrt("+u+")":1===a?"1.0/("+u+")":"exp(log("+u+") * float(-"+a+"));",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 = -"+i+"; j <= "+i+"; 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 "},yt=function(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,o=t-1-e.padInfo.top,i=n-1-e.padInfo.left,s=t*n-1;this.userCode="\n const ivec2 pads = ivec2("+o+", "+i+");\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 < "+t+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+e.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 = "+s+" - 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 * "+n+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "},vt=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1),this.variableNames=["matrixA","matrixB"];var a=n?e[1]:e[0],o=r?t[0]:t[1],i=n?e[0]:e[1];this.outputShape=[a,o];var s=function(e,t){return n?t+" + "+e+", aRow":"aRow, "+t+" + "+e},u=function(e,t){return r?"bCol, "+t+" + "+e:t+" + "+e+", bCol"},c=4*Math.floor(i/4),l=i%4;this.userCode=" float dotARowBCol(int aRow, int bCol) {\n float result = 0.0;\n for (int i = 0; i < "+c+"; i += 4) {\n vec4 a = vec4(\n getMatrixA("+s(0,"i")+"),\n getMatrixA("+s(1,"i")+"),\n getMatrixA("+s(2,"i")+"),\n getMatrixA("+s(3,"i")+")\n );\n vec4 b = vec4(\n getMatrixB("+u(0,"i")+"),\n getMatrixB("+u(1,"i")+"),\n getMatrixB("+u(2,"i")+"),\n getMatrixB("+u(3,"i")+")\n );\n\n result += dot(a, b);\n }\n\n if ("+(1===l)+") {\n result += getMatrixA("+s(0,c)+") *\n getMatrixB("+u(0,c)+");\n } else if ("+(2===l)+") {\n vec2 a = vec2(\n getMatrixA("+s(0,c)+"),\n getMatrixA("+s(1,c)+")\n );\n vec2 b = vec2(\n getMatrixB("+u(0,c)+"),\n getMatrixB("+u(1,c)+")\n );\n result += dot(a, b);\n } else if ("+(3===l)+") {\n vec3 a = vec3(\n getMatrixA("+s(0,c)+"),\n getMatrixA("+s(1,c)+"),\n getMatrixA("+s(2,c)+")\n );\n vec3 b = vec3(\n getMatrixB("+u(0,c)+"),\n getMatrixB("+u(1,c)+"),\n getMatrixB("+u(2,c)+")\n );\n result += dot(a, b);\n }\n\n return result;\n }\n\n void main() {\n ivec2 resRC = getOutputCoords();\n setOutput(dotARowBCol(resRC.x, resRC.y));\n }\n "},bt=function(){function e(e,t,n){this.variableNames=["probs"],this.outputShape=[e,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 < "+(t-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("+(t-1)+"));\n }\n "}return e.prototype.getCustomSetupFunc=function(e){var t=this;return function(n,r){null==t.seedLoc&&(t.seedLoc=n.getUniformLocation(r,"seed")),n.gl.uniform1f(t.seedLoc,e)}},e}(),wt=function(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],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 "},xt=function(e,t,n){this.variableNames=["x"],this.outputShape=t.map(function(t,n){return t[0]+e[n]+t[1]});var r=e.length,a=Q(r),o=t.map(function(e){return e[0]}).join(","),i=t.map(function(t,n){return t[0]+e[n]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n "+a+" start = "+a+"("+o+");\n "+a+" end = "+a+"("+i+");\n\n void main() {\n "+a+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+n+"));\n } else {\n "+a+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+o+";\n int end = "+i+";\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 "},kt=function(e,t,n){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");var r=e.filterHeight,a=e.filterWidth,o=e.strideHeight,i=e.strideWidth,s=e.padInfo.top,u=e.padInfo.left;this.outputShape=e.outShape;var c="avg"===t,l="0.0";if(c||(l="-1.0 / 0.0"),n)this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+s+", "+u+");\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 < "+r+"; wR++) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+a+"; wC++) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+e.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 * "+a+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var f=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===t&&(f="avgValue / count");var p=4*Math.floor(a/4),h=a%4,d="\n if ("+c+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+s+", "+u+");\n const float initializationValue = "+l+";\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 >= "+e.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("+l+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+r+"; wR++) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+e.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+p+"; wC += 4) {\n int xC = xCCorner + wC;\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n getValue(batch, xR, xC + 2, d),\n getValue(batch, xR, xC + 3, d)\n );\n\n "+d+"\n }\n\n int xC = xCCorner + "+p+";\n if ("+(1===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+d+"\n } else if ("+(2===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n initializationValue,\n initializationValue\n );\n\n "+d+"\n } else if ("+(3===h)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + 1, d),\n getValue(batch, xR, xC + 2, d),\n initializationValue\n );\n\n "+d+"\n }\n }\n setOutput("+f+");\n }\n "}},Ot=function(e,t){this.variableNames=["x"];var n=e.windowSize,r=e.batchSize,a=e.inSize,o=Math.ceil(a/n);this.outputShape=[r,o];var i="sum"===t,s="0.0";i||(s="min"===t?"1.0 / 0.0":"-1.0 / 0.0");var u="min"===t?"min":"max",c=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===t&&(c="sumValue");var l=4*Math.floor(n/4),f=n%4,p="\n if ("+i+") {\n sumValue += dot(values, ones);\n } else {\n minMaxValue = "+u+"(values, minMaxValue);\n }\n ",h="";a%n>0&&(h="\n if (inIdx < 0 || inIdx >= "+a+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+s+";\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("+s+");\n float sumValue = 0.0;\n\n for (int i = 0; i < "+l+"; 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 "+p+"\n }\n\n int inIdx = inOffset + "+l+";\n if ("+(1===f)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n "+p+"\n } else if ("+(2===f)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n "+p+"\n } else if ("+(3===f)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n "+p+"\n }\n setOutput("+c+");\n }\n "},St=function(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var r=t.shape,a=r[1],o=r[2],i=e.shape,s=i[1],u=i[2],c=[n&&s>1?a-1:a,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],p=c[1]/l[1],h=1/f,d=1/p,m=2*Math.ceil(h)+2,g=2*Math.ceil(d)+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("+p+");\n\n const float invHeightScale = float("+h+");\n const float invWidthScale = float("+d+");\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), "+(a-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 "},Nt=function(e,t,n,r){this.variableNames=["A"],this.outputShape=[];var a=e[0],o=e[1],i=e[2],s=e[3];this.outputShape=[a,t,n,s];var u=[r&&t>1?o-1:o,r&&n>1?i-1:i],c=[r&&t>1?t-1:t,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, "+i+".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 "},Et=function(e,t,n,r){this.variableNames=["A"],this.outputShape=[];var a=e[0],o=e[1],i=e[2],s=e[3];this.outputShape=[a,t,n,s];var u=r?[o-1,i-1]:[o,i],c=r?[t-1,n-1]:[t,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, "+i+".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 "},It=function(e,t){this.variableNames=["x"];var n=e.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=e,1!==n){var r=e.map(function(n,r){return function(n){return-1!==t.indexOf(n)&&1!==e[n]?e[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(r)}).join(","),a=Q(n);this.userCode="\n void main() {\n "+a+" coords = getOutputCoords();\n setOutput(getX("+r+"));\n }\n "}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+e[0]+" - coord - 1));\n }\n "},Tt=function(){function e(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;var t=Q(this.rank),n=function(e){if(1===e)return"sourceLoc";if(2===e)return"sourceLoc.x, sourceLoc.y";if(3===e)return"sourceLoc.x, sourceLoc.y, sourceLoc.z";if(4===e)return"sourceLoc.x, sourceLoc.y, sourceLoc.z, sourceLoc.w";throw Error("Slicing for rank "+e+" is not yet supported")}(this.rank);this.userCode="\n uniform "+t+" start;\n\n void main() {\n "+t+" sourceLoc = start + getOutputCoords();\n setOutput(getSource("+n+"));\n }\n "}return e.prototype.getCustomSetupFunc=function(e){var t=this;if(e.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+e.length+")");return function(n,r){if(null!=t.startLoc||(t.startLoc=n.getUniformLocationNoThrow(r,"start"),null!=t.startLoc))if(1===t.rank)n.gl.uniform1i(t.startLoc,e[0]);else if(2===t.rank)n.gl.uniform2i(t.startLoc,e[0],e[1]);else if(3===t.rank)n.gl.uniform3i(t.startLoc,e[0],e[1],e[2]);else{if(4!==t.rank)throw Error("Slicing for rank "+t.rank+" is not yet supported");n.gl.uniform4i(t.startLoc,e[0],e[1],e[2],e[3])}}},e}(),At=function(e,t,n){this.variableNames=["x"],this.outputShape=n,this.rank=n.length;var r,a=Q(this.rank);r=1===this.rank?"coords * strides + begin":n.map(function(e,t){return"coords["+t+"] * strides["+t+"] + begin["+t+"]"}).join(","),this.userCode="\n "+a+" begin = "+a+"("+e+");\n "+a+" strides = "+a+"("+t+");\n\n void main() {\n "+a+" coords = getOutputCoords();\n setOutput(getX("+r+"));\n }\n "},Ct=function(){function e(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.allocatedTextures=[],this.usedTextureCount={}}return e.prototype.acquireTexture=function(e,t){void 0===t&&(t=x.FLOAT);var n=Pt(e,t);if(n in this.freeTextures||(this.freeTextures[n]=[]),n in this.usedTextureCount||(this.usedTextureCount[n]=0),this.usedTextureCount[n]++,this.freeTextures[n].length>0)return this.numFreeTextures--,this.numUsedTextures++,this.log(),this.freeTextures[n].shift();this.numUsedTextures++,this.log();var r=this.gpgpu.createMatrixTexture(e[0],e[1]);return this.allocatedTextures.push(r),r},e.prototype.releaseTexture=function(e,t,n){void 0===n&&(n=x.FLOAT);var r=Pt(t,n);r in this.freeTextures||(this.freeTextures[r]=[]),this.freeTextures[r].push(e),this.numFreeTextures++,this.numUsedTextures--,this.usedTextureCount[r]--,this.log()},e.prototype.log=function(){if(this.logEnabled){var e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+e+")")}},e.prototype.getNumUsedTextures=function(){return this.numUsedTextures},e.prototype.getNumFreeTextures=function(){return this.numFreeTextures},e.prototype.dispose=function(){var e=this;null!=this.allocatedTextures&&(this.allocatedTextures.forEach(function(t){e.gpgpu.deleteMatrixTexture(t)}),this.freeTextures=null,this.allocatedTextures=null,this.usedTextureCount=null,this.numUsedTextures=0,this.numFreeTextures=0)},e}();function Pt(e,t){return e[0]+"_"+e[1]+"_"+t}var _t=function(e,t){this.variableNames=["A"];for(var n=new Array(e.length),r=0;r<n.length;r++)n[r]=e[r]*t[r];this.outputShape=n,this.rank=n.length;var a=Q(this.rank),o=function(e){var t=e.length;if(t>4)throw Error("Tile for rank "+t+" is not yet supported");if(1===t)return"imod(resRC, "+e[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[],a=0;a<e.length;a++)r.push("imod("+n[a]+", "+e[a]+")");return r.join()}(e);this.userCode="\n void main() {\n "+a+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "},Rt=function(e,t){this.variableNames=["A"];for(var n=new Array(e.length),r=0;r<n.length;r++)n[r]=e[t[r]];this.outputShape=n,this.rank=n.length;var a=Q(this.rank),o=function(e){var t=e.length;if(t>4)throw Error("Transpose for rank "+t+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=new Array(t),a=0;a<e.length;a++)r[e[a]]=n[a];return r.join()}(t);this.userCode="\n void main() {\n "+a+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "},Mt=n(52),jt=function(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode="\n float unaryOperation(float x) {\n "+t+"\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Dt="if (isNaN(x)) return x;",Lt="\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = "+Mt.b+";\n float scale = "+Mt.a+";\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n",zt=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Ft=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bt=function(){function e(e,t){if(void 0===t&&(t=!0),this.gpgpu=e,this.delayedStorage=t,this.texData=new WeakMap,this.uploadWaitMs=0,this.downloadWaitMs=0,this.binaryCache={},this.disposed=!1,c.ENV.get("WEBGL_VERSION")<1)throw new Error("WebGL is not supported on this device");"undefined"!=typeof document&&(this.canvas=document.createElement("canvas")),null==e?(this.gpgpu=new pt(We(this.canvas)),this.gpgpuCreatedLocally=!0):this.gpgpuCreatedLocally=!1,this.textureManager=new Ct(this.gpgpu)}return e.prototype.register=function(e,t,n){if(this.texData.has(e))throw new Error("Data buffer is already registered");this.texData.set(e,{shape:t,dtype:n,values:null,texture:null,texShape:null,texType:x.FLOAT})},e.prototype.fromPixels=function(e,t){if(null==e)throw new Error("MathBackendWebGL.writePixels(): pixels can not be null");var n=[e.height,e.width],r=[e.height,e.width,t];if(e instanceof HTMLVideoElement){if(null==this.fromPixelsCanvas){if("undefined"==typeof document)throw new Error("Can't read pixels from HTMLImageElement outside the browser.");if("complete"!==document.readyState)throw new Error("The DOM is not ready yet. Please call tf.fromPixels() once the DOM is ready. One way to do that is to add an event listener for `DOMContentLoaded` on the document object");this.fromPixelsCanvas=document.createElement("canvas")}this.fromPixelsCanvas.width=e.width,this.fromPixelsCanvas.height=e.height,this.fromPixelsCanvas.getContext("2d").drawImage(e,0,0,e.width,e.height),e=this.fromPixelsCanvas}var a=m.a.make(n,{},"int32");this.texData.get(a.dataId).texType=x.UNSIGNED_BYTE,this.gpgpu.uploadPixelDataToTexture(this.getTexture(a.dataId),e);var o=new ne(r),i=this.compileAndRun(o,[a]);return a.dispose(),i},e.prototype.write=function(e,t){if(null==t)throw new Error("MathBackendWebGL.write(): values can not be null");this.throwIfNoData(e);var n=this.texData.get(e),r=n.texture,a=n.texShape,o=n.texType;null!=r&&(this.textureManager.releaseTexture(r,a,o),n.texture=null,n.texShape=null),n.values=t,this.delayedStorage||this.uploadToGPU(e)},e.prototype.readSync=function(e){this.throwIfNoData(e);var t=this.texData.get(e),n=t.texture,r=t.values,a=t.texShape;if(null!=r)return this.cacheOnCPU(e),r;var o,i=null!=this.activeTimers;i&&(o=performance.now());var s=this.gpgpu.downloadMatrixFromTexture(n,a[0],a[1]);return i&&(this.downloadWaitMs+=performance.now()-o),this.cacheOnCPU(e,s),t.values},e.prototype.read=function(e){return zt(this,void 0,void 0,function(){var t,n,r,a,o;return Ft(this,function(i){switch(i.label){case 0:return this.throwIfNoData(e),t=this.texData.get(e),n=t.texture,r=t.values,a=t.texShape,null!=r?(this.cacheOnCPU(e),[2,r]):c.ENV.get("WEBGL_GET_BUFFER_SUB_DATA_ASYNC_EXTENSION_ENABLED")?[4,this.gpgpu.downloadMatrixFromTextureAsync(n,a[0],a[1])]:[3,2];case 1:return o=i.sent(),this.cacheOnCPU(e,o),[2,t.values];case 2:return 0===c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?[2,this.readSync(e)]:[4,this.gpgpu.runQuery(function(){})];case 3:return i.sent(),[2,this.readSync(e)]}})})},e.prototype.time=function(e){return zt(this,void 0,void 0,function(){var t,n,r,a,o,i;return Ft(this,function(s){switch(s.label){case 0:return t=this.activeTimers,n=[],r=!1,null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,e(),a=y.flatten(this.activeTimers),this.activeTimers=t,r&&(this.programTimersStack=null),[4,Promise.all(a).then(function(e){var t=0;return e.forEach(function(e){return t+=e}),t})];case 1:return o=s.sent(),i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:o,wallMs:null},this.uploadWaitMs=0,this.downloadWaitMs=0,[2,i]}})})},e.prototype.memory=function(){return{unreliable:!1}},e.prototype.startTimer=function(){return c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},e.prototype.endTimer=function(e){return c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(this.gpgpu.endQuery(),e):(e.endMs=performance.now(),e)},e.prototype.getQueryTime=function(e){return zt(this,void 0,void 0,function(){var t;return Ft(this,function(n){return c.ENV.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?[2,this.gpgpu.pollQueryTime(e)]:[2,(t=e).endMs-t.startMs]})})},e.prototype.disposeData=function(e){if(this.texData.has(e)){var t=this.texData.get(e),n=t.texture,r=t.texShape,a=t.texType;null!=n&&this.textureManager.releaseTexture(n,r,a),this.texData.delete(e)}},e.prototype.getTexture=function(e){return this.uploadToGPU(e),this.texData.get(e).texture},e.prototype.getTextureData=function(e){return this.uploadToGPU(e),this.texData.get(e)},e.prototype.getGPGPUContext=function(){return this.gpgpu},e.prototype.getCanvas=function(){return this.canvas},e.prototype.slice=function(e,t,n){var r=new Tt(n),a=r.getCustomSetupFunc(t);return this.compileAndRun(r,[e],null,a)},e.prototype.stridedSlice=function(e,t,n,r,a,o){var i=Object(d.b)(e.shape,t,n,r,a,o),s=i[0],u=i[1];if(u.some(function(e){return 0===e}))return f.uc([],u);var c=new At(s,r,u);return this.compileAndRun(c,[e])},e.prototype.reverse=function(e,t){var n=new It(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.concat=function(e,t){var n=new A(e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.neg=function(e){var t=new jt(e.shape,"return -x;");return this.compileAndRun(t,[e])},e.prototype.matMul=function(e,t,n,r){var a=new vt(e.shape,t.shape,n,r);return this.compileAndRun(a,[e,t])},e.prototype.multiply=function(e,t){var n=new E("return a * b;",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,g.c(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],r)},e.prototype.batchNormalization=function(e,t,n,r,a,o){var i=[e,t,n],s=null;null!=o&&(s=o.shape,i.push(o));var u=null;null!=a&&(u=a.shape,i.push(a));var c=new N(e.shape,t.shape,n.shape,s,u,r);return this.compileAndRun(c,i)},e.prototype.localResponseNormalization4D=function(e,t,n,r,a){var o=new gt(e.shape,t,n,r,a);return this.compileAndRun(o,[e])},e.prototype.tile=function(e,t){var n=new _t(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.pad=function(e,t,n){var r=new xt(e.shape,t,n);return this.compileAndRun(r,[e])},e.prototype.transpose=function(e,t){var n=new Rt(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.gather=function(e,t,n){var r=new re(e.shape,t.size,n);return this.compileAndRun(r,[e,t])},e.prototype.reduce=function(e,t,n){var r=e.shape[0],a=e.shape[1],o=h(a),i=new Ot({windowSize:o,inSize:a,batchSize:r},t),s=i.outputShape,u=s[0],c=s[1],l=this.makeOutputArray([u,c],n);return this.compileAndRun(i,[e],l),1===l.shape[1]?l:this.reduce(l,t,n)},e.prototype.argReduce=function(e,t,n){void 0===n&&(n=null);var r=e.shape[0],a=e.shape[1];null!=n&&(r=n.shape[0],a=n.shape[1]);var o=h(a),i=new k({windowSize:o,inSize:a,batchSize:r},t,null==n),s=i.outputShape,u=s[0],c=s[1],l=this.makeOutputArray([u,c],"int32"),f=[e];return null!=n&&f.push(n),this.compileAndRun(i,f,l),1===l.shape[1]?l:this.argReduce(e,t,l)},e.prototype.sum=function(e,t){l.a("sum",t,e.rank);var n=l.b(e.shape,t),r=n[0],a=n[1],o=y.sizeFromShape(a),i=e.as2D(-1,o),s=g.b(e.dtype);return this.reduce(i,"sum",s).reshape(r)},e.prototype.argMin=function(e,t){var n=[t];l.a("argMin",n,e.rank);var r=l.b(e.shape,n),a=r[0],o=r[1],i=y.sizeFromShape(o),s=e.as2D(-1,i);return this.argReduce(s,"min").reshape(a)},e.prototype.argMax=function(e,t){var n=[t];l.a("argMax",n,e.rank);var r=l.b(e.shape,n),a=r[0],o=r[1],i=y.sizeFromShape(o),s=e.as2D(-1,i);return this.argReduce(s,"max").reshape(a)},e.prototype.cumsum=function(e,t,n,r){if(t!==e.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(e.rank-1)+" but got axis="+t);var a=new ee(e.shape,n,r);return this.compileAndRun(a,[e])},e.prototype.equal=function(e,t){var n=new E("return float(a == b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.notEqual=function(e,t){var n=new E("return float(a != b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.less=function(e,t){var n=new E("return float(a < b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.lessEqual=function(e,t){var n=new E("return float(a <= b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.greater=function(e,t){var n=new E("return float(a > b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.greaterEqual=function(e,t){var n=new E("return float(a >= b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.logicalNot=function(e){var t=new jt(e.shape,"return float(!(x >= 1.0));");return this.compileAndRun(t,[e])},e.prototype.logicalAnd=function(e,t){var n=new E("return float(a >= 1.0 && b >= 1.0);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.logicalOr=function(e,t){var n=new E("return float(a >= 1.0 || b >= 1.0);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.where=function(e,t,n,r){var a=new mt(e.rank,t.shape,t.rank),o=this.makeOutputArray(a.outputShape,r);return this.compileAndRun(a,[e,t,n],o)},e.prototype.topKValues=function(e,t){throw new Error("topKValues GPU not yet implemented!")},e.prototype.topKIndices=function(e,t){throw new Error("topKIndices GPU not yet implemented!")},e.prototype.min=function(e,t){l.a("min",t,e.rank);var n=l.b(e.shape,t),r=n[0],a=n[1],o=y.sizeFromShape(a),i=e.as2D(-1,o);return this.reduce(i,"min",i.dtype).reshape(r)},e.prototype.minimum=function(e,t){var n=new E("\n if (isNaN(a)) return a;\n if (isNaN(b)) return b;\n\n return min(a, b);\n",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.mod=function(e,t){var n=new E("return mod(a, b);",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.max=function(e,t){l.a("max",t,e.rank);var n=l.b(e.shape,t),r=n[0],a=n[1],o=y.sizeFromShape(a),i=e.as2D(-1,o);return this.reduce(i,"max",i.dtype).reshape(r)},e.prototype.maximum=function(e,t){var n=new E("\n if (isNaN(a)) return a;\n if (isNaN(b)) return b;\n\n return max(a, b);\n",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.squaredDifference=function(e,t){var n=new E("return (a - b) * (a - b);",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.divide=function(e,t){var n,r;"int32"===e.dtype&&"int32"===t.dtype?(n="\n float resultSign = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n int result = ia / ib;\n int amodb = ia - ib * result;\n\n if (resultSign < 0.0 && amodb != 0) {\n result -= 1;\n }\n return float(result);\n",r="int32"):(n="return a / b;",r="float32");var a=new E(n,e.shape,t.shape),o=this.makeOutputArray(a.outputShape,r);return this.compileAndRun(a,[e,t],o)},e.prototype.add=function(e,t){var n=new E("return a + b;",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,g.c(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],r)},e.prototype.subtract=function(e,t){var n=new E("return a - b;",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,g.c(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],r)},e.prototype.pow=function(e,t){var n=new E("\n return (round(mod(b, 2.0)) == 0 || round(mod(b, 2.0)) == 2) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,g.c(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],r)},e.prototype.ceil=function(e){var t=new jt(e.shape,"return ceil(x);");return this.compileAndRun(t,[e])},e.prototype.floor=function(e){var t=new jt(e.shape,"return floor(x);");return this.compileAndRun(t,[e])},e.prototype.sign=function(e){var t=new jt(e.shape,"\n if (isNaN(x)) { return 0.0; }\n return sign(x);\n");return this.compileAndRun(t,[e])},e.prototype.round=function(e){var t=new jt(e.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(t,[e])},e.prototype.exp=function(e){var t=new jt(e.shape,"return exp(x);");return this.compileAndRun(t,[e])},e.prototype.expm1=function(e){var t=new jt(e.shape,"return exp(x) - 1.0;");return this.compileAndRun(t,[e])},e.prototype.log=function(e){var t=new jt(e.shape,"return log(x);");return this.compileAndRun(t,[e])},e.prototype.log1p=function(e){var t=new jt(e.shape,"return log(1.0 + x);");return this.compileAndRun(t,[e])},e.prototype.sqrt=function(e){var t=new jt(e.shape,"return sqrt(x);");return this.compileAndRun(t,[e])},e.prototype.rsqrt=function(e){var t=new jt(e.shape,"return inversesqrt(x);");return this.compileAndRun(t,[e])},e.prototype.square=function(e){var t=new jt(e.shape,"return x * x;");return this.compileAndRun(t,[e])},e.prototype.reciprocal=function(e){var t=new jt(e.shape,"return 1.0 / x;");return this.compileAndRun(t,[e])},e.prototype.relu=function(e){var t=new jt(e.shape,"if (isNaN(x)) return x;\n return (x < 0.0) ? 0.0 : x;\n");return this.compileAndRun(t,[e])},e.prototype.elu=function(e){var t=new jt(e.shape,"return (x >= 0.0) ? x : (exp(x) - 1.0);");return this.compileAndRun(t,[e])},e.prototype.eluDer=function(e,t){var n=new E("return (b >= 1.0) ? a : a * (b + 1.0);",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.selu=function(e){var t=new jt(e.shape,Lt);return this.compileAndRun(t,[e])},e.prototype.int=function(e){var t=new jt(e.shape,"return float(int(x));"),n=this.makeOutputArray(t.outputShape,"int32");return this.compileAndRun(t,[e],n)},e.prototype.clip=function(e,t,n){var r=new I(e.shape,t,n);return this.compileAndRun(r,[e])},e.prototype.abs=function(e){var t=new jt(e.shape,"return abs(x);");return this.compileAndRun(t,[e])},e.prototype.sigmoid=function(e){var t=new jt(e.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(t,[e])},e.prototype.softplus=function(e){var t=new jt(e.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(t,[e])},e.prototype.sin=function(e){var t=new jt(e.shape,"return sin(x);");return this.compileAndRun(t,[e])},e.prototype.cos=function(e){var t=new jt(e.shape,"return cos(x);");return this.compileAndRun(t,[e])},e.prototype.tan=function(e){var t=new jt(e.shape,"return tan(x);");return this.compileAndRun(t,[e])},e.prototype.asin=function(e){var t=new jt(e.shape,"return asin(x);");return this.compileAndRun(t,[e])},e.prototype.acos=function(e){var t=new jt(e.shape,"return acos(x);");return this.compileAndRun(t,[e])},e.prototype.atan=function(e){var t=new jt(e.shape,"if (isNaN(x)) return x;\n return atan(x);\n");return this.compileAndRun(t,[e])},e.prototype.atan2=function(e,t){var n=new E("\n if (isNaN(a)) return a;\n if (isNaN(b)) return b;\n\n return atan(a, b);\n",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.sinh=function(e){var t=new jt(e.shape,"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(t,[e])},e.prototype.cosh=function(e){var t=new jt(e.shape,"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(t,[e])},e.prototype.tanh=function(e){var t=new jt(e.shape,"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(t,[e])},e.prototype.asinh=function(e){var t=new jt(e.shape,"return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(t,[e])},e.prototype.acosh=function(e){var t=new jt(e.shape,"return log(x + sqrt(x * x - 1.0));");return this.compileAndRun(t,[e])},e.prototype.atanh=function(e){var t=new jt(e.shape,"return (log(1.0 + x) - log(1.0 - x)) / 2.0;");return this.compileAndRun(t,[e])},e.prototype.erf=function(e){var t=new jt(e.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(t,[e])},e.prototype.step=function(e,t){var n=new jt(e.shape,function(e){return void 0===e&&(e=0),Dt+"\n return x > 0.0 ? 1.0 : float("+e+");\n "}(t));return this.compileAndRun(n,[e])},e.prototype.conv2d=function(e,t,n){var r=new M(n);return this.compileAndRun(r,[e,t])},e.prototype.conv2dDerInput=function(e,t,n){var r=new P(n);return this.compileAndRun(r,[e,t])},e.prototype.conv2dDerFilter=function(e,t,n){var r=new C(n);return this.compileAndRun(r,[e,t])},e.prototype.depthwiseConv2D=function(e,t,n){var r=new j(n);return this.compileAndRun(r,[e,t])},e.prototype.depthwiseConv2DDerInput=function(e,t,n){var r=new R(n);return this.compileAndRun(r,[e,t])},e.prototype.depthwiseConv2DDerFilter=function(e,t,n){var r=new _(n);return this.compileAndRun(r,[e,t])},e.prototype.maxPool=function(e,t){var n=new kt(t,"max",!1),r=this.makeOutputArray(n.outputShape,e.dtype);return this.compileAndRun(n,[e],r)},e.prototype.avgPool=function(e,t){var n=new kt(t,"avg",!1),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[e],r)},e.prototype.maxPoolBackprop=function(e,t,n,r){var a=new kt(r,"max",!0),o=this.compileAndRun(a,[t]),i=new yt(r),s=this.makeOutputArray(i.outputShape,t.dtype),u=this.compileAndRun(i,[e,o],s);return o.dispose(),u},e.prototype.avgPoolBackprop=function(e,t,n){var r=new O(n),a=this.makeOutputArray(r.outputShape,t.dtype);return this.compileAndRun(r,[e],a)},e.prototype.cast=function(e,t){return b(e,t,this)},e.prototype.reshape=function(e,t){return w(e,t)},e.prototype.resizeBilinear=function(e,t,n,r){var a=new Nt(e.shape,t,n,r);return this.compileAndRun(a,[e])},e.prototype.resizeBilinearBackprop=function(e,t,n){var r=new St(e,t,n);return this.compileAndRun(r,[e])},e.prototype.resizeNearestNeighbor=function(e,t,n,r){var a=new Et(e.shape,t,n,r);return this.compileAndRun(a,[e])},e.prototype.multinomial=function(e,t,n,r){var a=t?e:f.ec(e),o=a.shape[0],i=a.shape[1],s=new bt(o,i,n),u=this.makeOutputArray(s.outputShape,"int32"),c=s.getCustomSetupFunc(r);return this.compileAndRun(s,[a],u,c)},e.prototype.oneHot=function(e,t,n,r){var a=new wt(e.size,t,n,r);return this.compileAndRun(a,[e])},e.prototype.makeOutputArray=function(e,t){return m.a.make(e,{},t)},e.prototype.compileAndRun=function(e,t,n,r){var a=this;null==n&&(n=this.makeOutputArray(e.outputShape,t[0].dtype));var o=t.map(function(e){return a.uploadToGPU(e.dataId),{tensor:e,texData:a.texData.get(e.dataId)}});this.uploadToGPU(n.dataId);var i,s={tensor:n,texData:this.texData.get(n.dataId)},u=function(e,t,n){var r="";t.concat(n).forEach(function(e){r+=e.tensor.shape+"_"+e.texData.texShape});var a=e.userCode,o=(!0===e.supportsBroadcasting).toString();return e.constructor.name+"_"+o+"_"+r+"_"+a}(e,o,s),c=this.getAndSaveBinary(u,function(){return function(e,t,n,r){for(var a=t.userCode,o=n.map(function(e,n){var r={logicalShape:e.tensor.shape,texShape:e.texData.texShape};return{name:t.variableNames[n],shapeInfo:r}}),i=o.map(function(e){return e.shapeInfo}),s={logicalShape:r.tensor.shape,texShape:r.texData.texShape},u=q(o,s,a,!0===t.supportsBroadcasting),c=e.createProgram(u),l={},f=0;f<t.variableNames.length;f++){var p=t.variableNames[f];l[p]=e.getUniformLocation(c,p)}return ht()&&(l.NaN=e.getUniformLocation(c,"NaN",!1)),{program:t,source:u,webGLProgram:c,uniformLocations:l,gpgpu:e,inShapeInfos:i,outShapeInfo:s}}(a.gpgpu,e,o,s)}),l=null!=this.activeTimers;return l&&(i=this.startTimer()),function(e,t,n,r){dt(e.inShapeInfos,t),dt([e.outShapeInfo],[n]);var a=n.texData.texture,o=n.texData.texShape,i=e.gpgpu;i.setOutputMatrixTexture(a,o[0],o[1]),i.setProgram(e.webGLProgram),t.forEach(function(t,n){var r=t.texData.texture,a=e.program.variableNames[n],o=e.uniformLocations[a];i.setInputMatrixTexture(r,o,n)}),ht()&&i.gl.uniform1f(e.uniformLocations.NaN,NaN),null!=r&&r(i,e.webGLProgram),i.executeProgram()}(c,o,s,r),l&&(i=this.endTimer(i),this.activeTimers.push(this.getQueryTime(i))),n},e.prototype.getAndSaveBinary=function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]},e.prototype.getTextureManager=function(){return this.textureManager},e.prototype.dispose=function(){if(!this.disposed){for(var e in this.binaryCache)this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram);this.textureManager.dispose(),this.canvas.remove(),null!=this.fromPixelsCanvas&&this.fromPixelsCanvas.remove(),this.gpgpuCreatedLocally&&this.gpgpu.dispose(),this.disposed=!0}},e.prototype.throwIfNoData=function(e){if(!this.texData.has(e))throw new Error("WebGL backend: No data found for this tensor. Did you change your backend in the middle of the program? New backends can't use Tensors created with previous backends")},e.prototype.uploadToGPU=function(e){this.throwIfNoData(e);var t=this.texData.get(e),n=t.shape,r=t.values,a=t.texture,o=(t.dtype,t.texType);if(null==a){var i,s=null!=this.activeTimers;s&&(i=performance.now());var u=Fe(this.gpgpu.gl,n);t.texShape=u;var c,l=this.textureManager.acquireTexture(u,o);t.texture=l,null!=r&&(this.gpgpu.uploadMatrixToTexture(l,u[0],u[1],(c=r)instanceof Float32Array?c:new Float32Array(c)),t.values=null,s&&(this.uploadWaitMs+=performance.now()-i))}},e.prototype.cacheOnCPU=function(e,t){var n=this.delayedStorage,r=this.texData.get(e),a=r.texture,o=r.texShape,i=r.dtype,s=r.texType;n&&null!=a&&(this.textureManager.releaseTexture(a,o,s),r.texture=null,r.texShape=null),null!=t&&(r.values=function(e,t){if("float32"===t)return e;if("int32"===t||"bool"===t){for(var n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length),r=0;r<n.length;++r)n[r]=Math.round(e[r]);return n}throw new Error("Unknown dtype "+t)}(t,i))},e}();c.ENV.registerBackend("webgl",function(){return new Bt},2);var Vt=n(120),Ut=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Wt=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Gt=function(){function e(){this.data=new WeakMap,"undefined"!=typeof document&&(this.canvas=document.createElement("canvas"))}return e.prototype.register=function(e,t,n){if(this.data.has(e))throw new Error("Data buffer is already registered");this.data.set(e,null)},e.prototype.write=function(e,t){if(null==t)throw new Error("MathBackendCPU.write(): values can not be null");this.throwIfNoData(e),this.data.set(e,t)},e.prototype.fromPixels=function(e,t){if(null==e)throw new Error("MathBackendCPU.writePixels(): pixels can not be null");var n,r;if(e instanceof ImageData)n=e.data;else if(e instanceof HTMLCanvasElement)n=e.getContext("2d").getImageData(0,0,e.width,e.height).data;else{if(!(e instanceof HTMLImageElement||e instanceof HTMLVideoElement))throw new Error("pixels is of unknown type: "+e.constructor.name);if(null==this.canvas)throw new Error("Can't read pixels from HTMLImageElement outside the browser.");this.canvas.width=e.width,this.canvas.height=e.height,this.canvas.getContext("2d").drawImage(e,0,0,e.width,e.height),n=this.canvas.getContext("2d").getImageData(0,0,e.width,e.height).data}if(4===t)r=new Int32Array(n);else{var a=e.width*e.height;r=new Int32Array(a*t);for(var o=0;o<a;o++)for(var i=0;i<t;++i)r[o*t+i]=n[4*o+i]}var s=[e.height,e.width,t];return Object(f.xc)(r,s,"int32")},e.prototype.read=function(e){return Ut(this,void 0,void 0,function(){return Wt(this,function(t){return[2,this.readSync(e)]})})},e.prototype.readSync=function(e){return this.throwIfNoData(e),this.data.get(e)},e.prototype.disposeData=function(e){this.data.has(e)&&this.data.delete(e)},e.prototype.time=function(e){return Ut(this,void 0,void 0,function(){var t;return Wt(this,function(n){return t=performance.now(),e(),[2,{kernelMs:performance.now()-t}]})})},e.prototype.memory=function(){return{unreliable:!0}},e.prototype.throwIfNoData=function(e){if(!this.data.has(e))throw new Error("CPU backend: No data found for this tensor. Did you change your backend in the middle of the program? New backends can't use Tensors created with previous backends")},e.prototype.slice=function(e,t,n){for(var r=f.s(n,e.dtype),a=0;a<r.size;++a){var o=r.indexToLoc(a),i=o.map(function(e,n){return e+t[n]});r.set.apply(r,[e.get.apply(e,i)].concat(o))}return r.toTensor()},e.prototype.stridedSlice=function(e,t,n,r,a,o){var i=Object(d.b)(e.shape,t,n,r,a,o),s=i[0],u=i[1];if(u.some(function(e){return 0===e}))return f.uc([],u);for(var c=f.s(u,e.dtype),l=0;l<c.size;l++){for(var p=c.indexToLoc(l),h=new Array(p.length),m=0;m<h.length;m++)h[m]=p[m]*r[m]+s[m];c.set.apply(c,[e.get.apply(e,h)].concat(p))}return c.toTensor()},e.prototype.reverse=function(e,t){for(var n=f.s(e.shape,e.dtype),r=e.buffer(),a=function(a){var o=n.indexToLoc(a),i=o.slice();t.forEach(function(t){return i[t]=e.shape[t]-1-i[t]}),n.set.apply(n,[r.get.apply(r,i)].concat(o))},o=0;o<n.size;o++)a(o);return n.toTensor()},e.prototype.concat=function(e,t){var n=T.c(e.shape,t.shape,1),r=f.s(n,e.dtype);if(1===e.shape[0]&&1===t.shape[0]){var a=e.dataSync(),o=t.dataSync(),i=r.values;return i.set(a,0),i.set(o,e.size),r.toTensor()}for(var s=0;s<n[0];++s){for(var u=0;u<e.shape[1];++u)r.set(e.get(s,u),s,u);for(u=0;u<t.shape[1];++u)r.set(t.get(s,u),s,u+e.shape[1])}return r.toTensor()},e.prototype.neg=function(e){return this.multiply(f.Sb(-1),e)},e.prototype.add=function(e,t){return this.broadcastedBinaryOp(e,t,g.c(e.dtype,t.dtype),function(e,t){return e+t})},e.prototype.subtract=function(e,t){return this.broadcastedBinaryOp(e,t,g.c(e.dtype,t.dtype),function(e,t){return e-t})},e.prototype.pow=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.pow(e,t)})},e.prototype.matMul=function(e,t,n,r){for(var a=n?e.shape[0]:e.shape[1],o=n?e.shape[1]:e.shape[0],i=r?t.shape[0]:t.shape[1],s=e.dataSync(),u=t.dataSync(),c=n?[1,e.strides[0]]:[e.strides[0],1],l=c[0],p=c[1],h=r?[t.strides[0],1]:[1,t.strides[0]],d=h[0],m=h[1],g=o*l,y=i*d,v=new Float32Array(o*i),b=0,w=0;w<g;w+=l)for(var x=0;x<y;x+=d){for(var k=w,O=x,S=0,N=0;N<a;++N)S+=s[k]*u[O],k+=p,O+=m;v[b++]=S}return f.wc(v,[o,i])},e.prototype.multiply=function(e,t){return this.broadcastedBinaryOp(e,t,g.c(e.dtype,t.dtype),function(e,t){return e*t})},e.prototype.divide=function(e,t){var n,r;return"int32"===e.dtype&&"int32"===t.dtype?(r="int32",n=function(e,t){return Math.floor(e/t)}):(r="float32",n=function(e,t){return e/t}),this.broadcastedBinaryOp(e,t,r,n)},e.prototype.sum=function(e,t){l.a("sum",t,e.rank);for(var n=l.b(e.shape,t),r=n[0],a=n[1],o=g.c(e.dtype,"int32"),i=f.Hc(r,o),s=y.sizeFromShape(a),u=i.dataSync(),c=e.dataSync(),p=0;p<u.length;++p){for(var h=p*s,d=0,m=0;m<s;++m)d+=c[h+m];u[p]=d}return i},e.prototype.argMin=function(e,t){var n=[t];l.a("argMin",n,e.rank);for(var r=l.b(e.shape,n),a=r[0],o=r[1],i=f.Hc(a,"int32"),s=y.sizeFromShape(o),u=i.dataSync(),c=e.dataSync(),p=0;p<u.length;++p){for(var h=p*s,d=c[h],m=0,g=0;g<s;++g){var v=c[h+g];v<d&&(d=v,m=g)}u[p]=m}return i},e.prototype.argMax=function(e,t){var n=[t];l.a("argMax",n,e.rank);for(var r=l.b(e.shape,n),a=r[0],o=r[1],i=f.Hc(a,"int32"),s=y.sizeFromShape(o),u=i.dataSync(),c=e.dataSync(),p=0;p<u.length;++p){for(var h=p*s,d=c[h],m=0,g=0;g<s;++g){var v=c[h+g];v>d&&(d=v,m=g)}u[p]=m}return i},e.prototype.cumsum=function(e,t,n,r){if(t!==e.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(e.rank-1)+" but got axis="+t);for(var a=g.c(e.dtype,"int32"),o=f.Hc(e.shape,a),i=o.dataSync(),s=e.dataSync(),u=e.shape[e.rank-1],c=r?function(e,t){return e+u-t-1}:function(e,t){return e+t},l=0;l<s.length;l+=u)for(var p=0;p<u;p++){var h=c(l,p);if(0===p)i[h]=n?0:s[h];else{var d=c(l,p-1);i[h]=n?s[d]+i[d]:s[h]+i[d]}}return o},e.prototype.equal=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e===t?1:0})},e.prototype.notEqual=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e!==t?1:0})},e.prototype.less=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e<t?1:0})},e.prototype.lessEqual=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e<=t?1:0})},e.prototype.greater=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e>t?1:0})},e.prototype.greaterEqual=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e>=t?1:0})},e.prototype.logicalNot=function(e){for(var t=e.dataSync(),n=new Int32Array(t.length),r=0;r<t.length;++r)n[r]=t[r]?0:1;return m.a.make(e.shape,{values:n},"bool")},e.prototype.logicalAnd=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e&&t})},e.prototype.logicalOr=function(e,t){return this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e||t})},e.prototype.where=function(e,t,n,r){for(var a=e.dataSync(),o=t.dataSync(),i=n.dataSync(),s=f.Hc(t.shape,r),u=s.dataSync(),c=0,l=0===e.rank||e.rank>1||1===t.rank?1:t.shape[1],p=0;p<a.length;p++)for(var h=0;h<l;h++)1===a[p]?u[c++]=o[p]:u[c++]=i[p];return s},e.prototype.topKValues=function(e,t){return this.topK(e,t).values},e.prototype.topKIndices=function(e,t){return this.topK(e,t).indices},e.prototype.topK=function(e,t){for(var n=e.dataSync(),r=[],a=0;a<n.length;a++)r.push({value:n[a],index:a});r.sort(function(e,t){return t.value-e.value});var o=y.getTypedArrayFromDType(e.dtype,t),i=new Int32Array(t);for(a=0;a<t;a++)o[a]=r[a].value,i[a]=r[a].index;return{values:f.vc(o,e.dtype),indices:f.vc(i,"int32")}},e.prototype.min=function(e,t){l.a("min",t,e.rank);for(var n=l.b(e.shape,t),r=n[0],a=n[1],o=f.Hc(r,e.dtype),i=y.sizeFromShape(a),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var p=c*i,h=u[0],d=0;d<i;++d){var m=u[p+d];m<h&&(h=m)}s[c]=h}return o},e.prototype.minimum=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.min(e,t)})},e.prototype.mod=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){var n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t})},e.prototype.max=function(e,t){l.a("max",t,e.rank);for(var n=l.b(e.shape,t),r=n[0],a=n[1],o=f.Hc(r,e.dtype),i=y.sizeFromShape(a),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var p=c*i,h=u[p],d=0;d<i;++d){var m=u[p+d];m>h&&(h=m)}s[c]=h}return o},e.prototype.maximum=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.max(e,t)})},e.prototype.squaredDifference=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){var n=e-t;return n*n})},e.prototype.ceil=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.ceil(t[r]);return m.a.make(e.shape,{values:n})},e.prototype.floor=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.floor(t[r]);return m.a.make(e.shape,{values:n})},e.prototype.sign=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)t[r]<0?n[r]=-1:t[r]>0?n[r]=1:n[r]=0;return m.a.make(e.shape,{values:n})},e.prototype.round=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var a=Math.floor(t[r]);t[r]-a<.5?n[r]=Math.floor(t[r]):t[r]-a>.5?n[r]=Math.ceil(t[r]):n[r]=a%2==0?a:a+1}return m.a.make(e.shape,{values:n})},e.prototype.exp=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.exp(t[r]);return m.a.make(e.shape,{values:n})},e.prototype.expm1=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.expm1(t[r]);return m.a.make(e.shape,{values:n})},e.prototype.log=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var a=t[r];n[r]=Math.log(a)}return m.a.make(e.shape,{values:n})},e.prototype.log1p=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var a=t[r];n[r]=Math.log1p(a)}return m.a.make(e.shape,{values:n})},e.prototype.sqrt=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var a=t[r];n[r]=Math.sqrt(a)}return m.a.make(e.shape,{values:n})},e.prototype.rsqrt=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var a=t[r];n[r]=1/Math.sqrt(a)}return m.a.make(e.shape,{values:n})},e.prototype.square=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var a=t[r];n[r]=a*a}return m.a.make(e.shape,{values:n})},e.prototype.reciprocal=function(e){for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=1/t[r];return m.a.make(e.shape,{values:n})},e.prototype.relu=function(e){for(var t=f.Hc(e.shape,e.dtype),n=t.dataSync(),r=e.dataSync(),a=0;a<r.length;++a)n[a]=Math.max(0,r[a]);return t},e.prototype.elu=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r){var a=n[r];t[r]=a>=0?a:Math.exp(a)-1}return m.a.make(e.shape,{values:t})},e.prototype.eluDer=function(e,t){for(var n=new Float32Array(t.size),r=t.dataSync(),a=e.dataSync(),o=0;o<r.length;++o){var i=r[o];n[o]=i>=1?a[o]:a[o]*(i+1)}return m.a.make(t.shape,{values:n})},e.prototype.selu=function(e){for(var t=Mt.b,n=Mt.a,r=new Float32Array(e.size),a=e.dataSync(),o=0;o<a.length;++o){var i=a[o];r[o]=i>=0?n*i:t*(Math.exp(i)-1)}return m.a.make(e.shape,{values:r})},e.prototype.clip=function(e,t,n){for(var r=new Float32Array(e.size),a=e.dataSync(),o=0;o<a.length;++o)r[o]=Math.min(n,Math.max(t,a[o]));return m.a.make(e.shape,{values:r})},e.prototype.abs=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.abs(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.int=function(e){for(var t=new Int32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=n[r];return m.a.make(e.shape,{values:t},"int32")},e.prototype.sigmoid=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=1/(1+Math.exp(-n[r]));return m.a.make(e.shape,{values:t})},e.prototype.softplus=function(e){for(var t=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(e.size),r=e.dataSync(),a=0;a<r.length;++a){var o,i=r[a]>-t,s=r[a]<t,u=Math.exp(r[a]);o=s?u:i?r[a]:Math.log(1+u),n[a]=o}return m.a.make(e.shape,{values:n})},e.prototype.sin=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.sin(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.cos=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.cos(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.tan=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.tan(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.asin=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.asin(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.acos=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.acos(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.atan=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.atan(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.atan2=function(e,t){return this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.atan2(e,t)})},e.prototype.sinh=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.sinh(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.cosh=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.cosh(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.tanh=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=y.tanh(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.asinh=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.asinh(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.acosh=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.acosh(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.atanh=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.atanh(n[r]);return m.a.make(e.shape,{values:t})},e.prototype.erf=function(e){for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r){var a=n[r],o=1/(1+.3275911*a);t[r]=1-((((1.061405429*o-1.453152027)*o+1.421413741)*o-.284496736)*o+.254829592)*o*Math.exp(-a*a)}return m.a.make(e.shape,{values:t})},e.prototype.step=function(e,t){void 0===t&&(t=0);for(var n=new Float32Array(e.size),r=e.dataSync(),a=0;a<r.length;++a){var o=r[a];isNaN(o)?n[a]=NaN:n[a]=o>0?1:t}return m.a.make(e.shape,{values:n})},e.prototype.conv2d=function(e,t,n){for(var r=n.filterHeight,a=n.filterWidth,o=n.dilationHeight,i=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=f.s(n.outShape,e.dtype),l=0;l<n.batchSize;++l)for(var p=0;p<n.outChannels;++p)for(var h=0;h<n.outHeight;++h)for(var d=h*n.strideHeight-s,m=0;m<n.outWidth;++m){for(var g=m*n.strideWidth-u,y=0,v=0;v<r;v++){var b=d+v*o;if(!(b<0||b>=n.inHeight))for(var w=0;w<a;w++){var x=g+w*i;if(!(x<0||x>=n.inWidth))for(var k=0;k<n.inChannels;++k)y+=e.get(l,b,x,k)*t.get(v,w,k,p)}}c.set(y,l,h,m,p)}return c.toTensor()},e.prototype.conv2dDerInput=function(e,t,n){for(var r=f.s(n.inShape,"float32"),a=r.values,o=r.strides,i=o[0],s=o[1],u=o[2],c=e.dataSync(),l=e.strides,p=l[0],h=l[1],d=l[2],m=t.dataSync(),g=t.strides,y=g[0],v=g[1],b=g[2],w=n.batchSize,x=n.filterHeight,k=n.filterWidth,O=n.inChannels,S=n.inHeight,N=n.inWidth,E=n.outChannels,I=n.outHeight,T=n.outWidth,A=n.strideHeight,C=n.strideWidth,P=x-1-n.padInfo.top,_=k-1-n.padInfo.left,R=0;R<w;++R)for(var M=0;M<O;++M)for(var j=0;j<S;++j)for(var D=j-P,L=Math.max(0,Math.ceil(D/A)),z=Math.min(I,(x+D)/A),F=0;F<N;++F){for(var B=F-_,V=Math.max(0,Math.ceil(B/C)),U=Math.min(T,(k+B)/C),W=0,G=L;G<z;++G)for(var q=G*A-D,H=V;H<U;++H)for(var K=p*R+h*G+d*H,X=y*(x-1-q)+v*(k-1-(H*C-B))+b*M,J=0;J<E;++J)W+=c[K+J]*m[X+J];a[i*R+s*j+u*F+M]=W}return r.toTensor()},e.prototype.conv2dDerFilter=function(e,t,n){for(var r=n.strideHeight,a=n.strideWidth,o=n.filterHeight,i=n.filterWidth,s=f.s(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=0;l<o;++l)for(var p=Math.max(0,Math.ceil((c-l)/r)),h=Math.min(n.outHeight,(n.inHeight+c-l)/r),d=0;d<i;++d)for(var m=Math.max(0,Math.ceil((u-d)/a)),g=Math.min(n.outWidth,(n.inWidth+u-d)/a),y=0;y<n.inChannels;++y)for(var v=0;v<n.outChannels;++v){for(var b=0,w=0;w<n.batchSize;++w)for(var x=p;x<h;++x)for(var k=l+x*r-c,O=m;O<g;++O){var S=d+O*a-u;b+=e.get(w,k,S,y)*t.get(w,x,O,v)}s.set(b,l,d,y,v)}return s.toTensor()},e.prototype.depthwiseConv2D=function(e,t,n){for(var r=n.filterHeight,a=n.filterWidth,o=n.dilationHeight,i=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=n.outChannels/n.inChannels,l=f.s(n.outShape,e.dtype),p=0;p<n.batchSize;++p)for(var h=0;h<n.inChannels;++h)for(var d=0;d<n.outHeight;++d)for(var m=d*n.strideHeight-s,g=0;g<n.outWidth;++g)for(var y=g*n.strideWidth-u,v=0;v<c;++v){for(var b=0,w=0;w<r;++w){var x=m+w*o;if(!(x<0||x>=n.inHeight))for(var k=0;k<a;++k){var O=y+k*i;O<0||O>=n.inWidth||(b+=e.get(p,x,O,h)*t.get(w,k,h,v))}}l.set(b,p,d,g,h*c+v)}return l.toTensor()},e.prototype.depthwiseConv2DDerInput=function(e,t,n){for(var r=f.s(n.inShape,"float32"),a=r.values,o=r.strides,i=o[0],s=o[1],u=o[2],c=e.dataSync(),l=e.strides,p=l[0],h=l[1],d=l[2],m=t.dataSync(),g=t.strides,y=g[0],v=g[1],b=g[2],w=n.batchSize,x=n.filterHeight,k=n.filterWidth,O=n.inChannels,S=n.inHeight,N=n.inWidth,E=n.outChannels,I=n.outHeight,T=n.outWidth,A=n.strideHeight,C=n.strideWidth,P=x-1-n.padInfo.top,_=k-1-n.padInfo.left,R=E/O,M=0;M<w;++M)for(var j=0;j<O;++j)for(var D=0;D<S;++D)for(var L=D-P,z=Math.max(0,Math.ceil(L/A)),F=Math.min(I,(x+L)/A),B=0;B<N;++B){for(var V=B-_,U=Math.max(0,Math.ceil(V/C)),W=Math.min(T,(k+V)/C),G=0,q=z;q<F;++q)for(var H=q*A-L,K=U;K<W;++K)for(var X=p*M+h*q+d*K,J=y*(x-1-H)+v*(k-1-(K*C-V))+b*j,Y=0;Y<R;++Y)G+=c[X+(j*R+Y)]*m[J+Y];a[i*M+s*D+u*B+j]=G}return r.toTensor()},e.prototype.depthwiseConv2DDerFilter=function(e,t,n){for(var r=n.strideHeight,a=n.strideWidth,o=n.filterHeight,i=n.filterWidth,s=f.s(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=n.outChannels/n.inChannels,p=0;p<o;++p)for(var h=Math.max(0,Math.ceil((c-p)/r)),d=Math.min(n.outHeight,(n.inHeight+c-p)/r),m=0;m<i;++m)for(var g=Math.max(0,Math.ceil((u-m)/a)),y=Math.min(n.outWidth,(n.inWidth+u-m)/a),v=0;v<n.outChannels;++v){for(var b=Math.trunc(v/l),w=v%l,x=0,k=0;k<n.batchSize;++k)for(var O=h;O<d;++O)for(var S=p+O*r-c,N=g;N<y;++N){var E=m+N*a-u;x+=e.get(k,S,E,b)*t.get(k,O,N,v)}s.set(x,p,m,b,w)}return s.toTensor()},e.prototype.tile=function(e,t){for(var n=new Array(e.rank),r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];var a=f.s(n,e.dtype),o=e.buffer();for(r=0;r<a.values.length;++r){for(var i=a.indexToLoc(r),s=new Array(e.rank),u=0;u<s.length;u++)s[u]=i[u]%e.shape[u];var c=o.locToIndex(s);a.values[r]=o.values[c]}return a.toTensor()},e.prototype.pad=function(e,t,n){var r=t.map(function(t,n){return t[0]+e.shape[n]+t[1]}),a=t.map(function(e){return e[0]}),o=e.buffer(),i=f.s(r,e.dtype);0!==n&&i.values.fill(n);for(var s=0;s<e.size;s++){var u=o.indexToLoc(s),c=u.map(function(e,t){return e+a[t]});i.set.apply(i,[e.get.apply(e,u)].concat(c))}return i.toTensor()},e.prototype.transpose=function(e,t){for(var n=new Array(e.rank),r=0;r<n.length;r++)n[r]=e.shape[t[r]];var a=e.dataSync(),o=Object(f.s)(n,e.dtype),i=e.buffer();for(r=0;r<e.size;++r){for(var s=i.indexToLoc(r),u=new Array(s.length),c=0;c<u.length;c++)u[c]=s[t[c]];var l=o.locToIndex(u);o.values[l]=a[r]}return o.toTensor()},e.prototype.gather=function(e,t,n){var r=e.shape.slice(),a=t.dataSync();r[n]=a.length;for(var o=Object(f.s)(r,e.dtype),i=e.buffer(),s=0;s<o.size;++s){var u=o.indexToLoc(s),c=u.slice();c[n]=a[u[n]];var l=i.locToIndex(c);o.values[s]=i.values[l]}return o.toTensor()},e.prototype.pool=function(e,t,n){for(var r=t.strideHeight,a=t.strideWidth,o=t.filterHeight,i=t.filterWidth,s=f.s(t.outShape,"float32"),u=t.padInfo.top,c=t.padInfo.left,l=0;l<t.batchSize;++l)for(var p=0;p<t.inChannels;++p)for(var h=0;h<t.outHeight;++h)for(var d=h*r-u,m=Math.max(0,d),g=Math.min(t.inHeight,o+d),y=0;y<t.outWidth;++y){for(var v=y*a-c,b=Math.max(0,v),w=Math.min(t.inWidth,i+v),x="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,k=0,O=0,S=m;S<g;++S){for(var N=b;N<w;++N){var E=e.get(l,S,N,p);"max"===n&&E>x?x=E:"avg"===n&&(k+=E,O++)}if(isNaN(x))break}s.set("avg"===n?k/O:x,l,h,y,p)}return s.toTensor()},e.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},e.prototype.maxPoolPositions=function(e,t){for(var n=f.s(t.outShape,"int32"),r=t.strideHeight,a=t.strideWidth,o=t.filterHeight,i=t.filterWidth,s=t.padInfo.top,u=t.padInfo.left,c=0;c<t.batchSize;++c)for(var l=0;l<t.inChannels;++l)for(var p=0;p<t.outHeight;++p)for(var h=p*r-s,d=Math.max(0,h),m=Math.min(t.inHeight,o+h),g=0;g<t.outWidth;++g){for(var y=g*a-u,v=Math.max(0,y),b=Math.min(t.inWidth,i+y),w=Number.NEGATIVE_INFINITY,x=-1,k=d;k<m;++k)for(var O=k-h,S=v;S<b;++S){var N=S-y,E=e.get(c,k,S,l);E>w&&(w=E,x=O*i+N)}n.set(x,c,p,g,l)}return n.toTensor()},e.prototype.maxPoolBackprop=function(e,t,n,r){for(var a=this.maxPoolPositions(t,r),o=r.strideHeight,i=r.strideWidth,s=r.filterHeight,u=r.filterWidth,c=u-1-r.padInfo.left,l=s-1-r.padInfo.top,p=f.s(t.shape,"float32"),h=0;h<r.batchSize;++h)for(var d=0;d<r.inChannels;++d)for(var m=0;m<r.inHeight;++m)for(var g=0;g<r.inWidth;++g){for(var y=m-l,v=g-c,b=0,w=0;w<s;++w){var x=(y+w)/o;if(!(x<0||x>=r.outHeight||Math.floor(x)!==x))for(var k=0;k<u;++k){var O=(v+k)/i;if(!(O<0||O>=r.outWidth||Math.floor(O)!==O)){var S=s*u-1-a.get(h,x,O,d)===w*u+k?1:0;0!==S&&(b+=e.get(h,x,O,d)*S)}}}p.set(b,h,m,g,d)}return p.toTensor()},e.prototype.avgPoolBackprop=function(e,t,n){for(var r=n.strideHeight,a=n.strideWidth,o=n.filterHeight,i=n.filterWidth,s=i-1-n.padInfo.left,u=o-1-n.padInfo.top,c=f.s(t.shape,"float32"),l=1/(o*i),p=0;p<n.batchSize;++p)for(var h=0;h<n.inChannels;++h)for(var d=0;d<n.inHeight;++d)for(var m=0;m<n.inWidth;++m){for(var g=d-u,y=m-s,v=0,b=0;b<o;++b){var w=(g+b)/r;if(!(w<0||w>=n.outHeight||Math.floor(w)!==w))for(var x=0;x<i;++x){var k=(y+x)/a;k<0||k>=n.outWidth||Math.floor(k)!==k||(v+=e.get(p,w,k,h))}}c.set(v*l,p,d,m,h)}return c.toTensor()},e.prototype.cast=function(e,t){return b(e,t,this)},e.prototype.reshape=function(e,t){return w(e,t)},e.prototype.avgPool=function(e,t){return this.pool(e,t,"avg").toFloat()},e.prototype.resizeBilinear=function(e,t,n,r){for(var a=e.shape,o=a[0],i=a[1],s=a[2],u=a[3],c=f.s([o,t,n,u],e.dtype),l=[r&&t>1?i-1:i,r&&n>1?s-1:s],p=[r&&t>1?t-1:t,r&&n>1?n-1:n],h=0;h<o;h++)for(var d=0;d<t;d++)for(var m=0;m<n;m++)for(var g=0;g<u;g++){var y=l[0]*d/p[0],v=l[1]*m/p[1],b=Math.floor(y),w=Math.min(i-1,Math.ceil(y)),x=Math.floor(v),k=Math.min(s-1,Math.ceil(v)),O=e.get(h,b,x,g),S=e.get(h,w,x,g),N=v-x,E=O+(e.get(h,b,k,g)-O)*N,I=E+(S+(e.get(h,w,k,g)-S)*N-E)*(y-b);c.set(I,h,d,m,g)}return c.toTensor()},e.prototype.resizeBilinearBackprop=function(e,t,n){for(var r=t.shape,a=r[0],o=r[1],i=r[2],s=r[3],u=e.shape,c=u[1],l=u[2],p=f.s([a,o,i,s],t.dtype),h=[n&&c>1?o-1:o,n&&l>1?i-1:i],d=[n&&c>1?c-1:c,n&&l>1?l-1:l],m=h[0]/d[0],g=h[1]/d[1],y=0;y<a;y++)for(var v=0;v<c;v++)for(var b=v*m,w=Math.floor(b),x=Math.min(Math.ceil(b),o-1),k=b-w,O=1-k,S=0;S<l;S++)for(var N=S*g,E=Math.floor(N),I=Math.min(Math.ceil(N),i-1),T=N-E,A=1-T,C=0;C<s;C++){var P=e.get(y,v,S,C),_=p.get(y,w,E,C);_+=P*O*A,p.set(_,y,w,E,C);var R=p.get(y,w,I,C);R+=P*O*T,p.set(R,y,w,I,C);var M=p.get(y,x,E,C);M+=P*k*A,p.set(M,y,x,E,C);var j=p.get(y,x,I,C);j+=P*k*T,p.set(j,y,x,I,C)}return p.toTensor()},e.prototype.resizeNearestNeighbor=function(e,t,n,r){for(var a=e.shape,o=a[0],i=a[1],s=a[2],u=a[3],c=f.s([o,t,n,u],e.dtype),l=r?[i-1,s-1]:[i,s],p=r?[t-1,n-1]:[t,n],h=0;h<o;h++)for(var d=0;d<t;d++)for(var m=0;m<n;m++)for(var g=0;g<u;g++){var y=l[0]*d/p[0],v=l[1]*m/p[1],b=Math.min(i-1,r?Math.round(y):Math.floor(y)),w=Math.min(s-1,r?Math.round(v):Math.floor(v)),x=e.get(h,b,w,g);c.set(x,h,d,m,g)}return c.toTensor()},e.prototype.batchNormalization=function(e,t,n,r,a,o){for(var i=e.dataSync(),s=t.dataSync(),u=n.dataSync(),c=a?a.dataSync():new Float32Array([1]),l=o?o.dataSync():new Float32Array([0]),p=new Float32Array(i.length),h=0;h<i.length;h++)p[h]=l[h%l.length]+(i[h]-s[h%s.length])*c[h%c.length]/Math.sqrt(u[h%u.length]+r);return Object(f.yc)(p,e.shape)},e.prototype.localResponseNormalization4D=function(e,t,n,r,a){var o=f.s(e.shape,"float32"),i=t,s=o.shape[3]-1;function u(t,n,r,a){for(var o=0,u=Math.max(0,a-i);u<=Math.min(a+i,s);u++){var c=e.get(t,n,r,u);o+=c*c}return o}for(var c=0;c<o.shape[0];c++)for(var l=0;l<=o.shape[1];l++)for(var p=0;p<o.shape[2];p++)for(var h=0;h<o.shape[3];h++){var d=u(c,l,p,h),m=e.get(c,l,p,h)*Math.pow(n+r*d,-a);o.set(m,c,l,p,h)}return o.toTensor()},e.prototype.multinomial=function(e,t,n,r){for(var a=t?e:f.ec(e),o=a.shape[0],i=a.shape[1],s=f.Hc([o,n],"int32"),u=s.dataSync(),c=a.dataSync(),l=0;l<o;++l){var p=l*i,h=new Float32Array(i-1);h[0]=c[p];for(var d=1;d<h.length;++d)h[d]=h[d-1]+c[p+d];for(var m=Vt.alea(r.toString()),g=l*n,y=0;y<n;++y){var v=m();u[g+y]=h.length;for(var b=0;b<h.length;b++)if(v<h[b]){u[g+y]=b;break}}}return s},e.prototype.oneHot=function(e,t,n,r){var a=new Float32Array(e.size*t);a.fill(r);for(var o=0;o<e.size;++o)a[o*t+e.get(o)]=n;return f.wc(a,[e.size,t])},e.prototype.broadcastedBinaryOp=function(e,t,n,r){for(var a=S.a(e.shape,t.shape),o=f.s(a,n),i=e.dataSync(),s=t.dataSync(),u=S.c(e.shape,a),c=S.c(t.shape,a),l=e.buffer(),p=t.buffer(),h=function(n){var a=o.indexToLoc(n),f=a.slice(-e.rank);u.forEach(function(e){return f[e]=0});var h=l.locToIndex(f),d=a.slice(-t.rank);c.forEach(function(e){return d[e]=0});var m=p.locToIndex(d);o.values[n]=r(i[h],s[m])},d=0;d<o.values.length;++d)h(d);return o.toTensor()},e.prototype.dispose=function(){},e}();c.ENV.registerBackend("cpu",function(){return new Gt},1);var qt=n(2),Ht=function(){function e(){}return e.nextFrame=function(){return new Promise(function(e){return requestAnimationFrame(function(){return e()})})},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(qt.a)({heading:"Performance",subheading:"Timing"})],e,"nextFrame",null),e}(),Kt={float32:4,int32:4,uint16:2,uint8:1,bool:1},Xt=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Jt=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function Yt(e){return Xt(this,void 0,void 0,function(){var t,n,r,a;return Jt(this,function(o){switch(o.label){case 0:for(r in t=[],n=[],e){if("float32"!==(a=e[r]).dtype&&"int32"!==a.dtype&&"bool"!==a.dtype)throw new Error("Unsupported dtype in weight '"+r+"': "+a.dtype);t.push({name:r,shape:a.shape,dtype:a.dtype}),n.push(a.data())}return[4,Promise.all(n)];case 1:return[2,{data:function(e){if(null===e)throw new Error("Invalid input value: "+JSON.stringify(e));var t=0;e.forEach(function(e){if(e instanceof Float32Array||e instanceof Int32Array)t+=4*e.length;else{if(!(e instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+e.constructor.name);t+=e.length}});var n=new Uint8Array(t),r=0;return e.forEach(function(e){n.set(new Uint8Array(e.buffer),r),e instanceof Float32Array||e instanceof Int32Array?r+=4*e.length:r+=e.length}),n.buffer}(o.sent()),specs:t}]}})})}function Qt(e,t){for(var n={},r=0,a=0,o=t;a<o.length;a++){var i=o[a],s=i.name,u=i.dtype,c=i.shape;if(null!=i.quantization)throw new Error("decodeWeights does not support quantization yet, but encountered weight '"+s+" with quantization.'");var l=Object(y.sizeFromShape)(c),f=void 0;if("float32"===u)f=v.a.tensor(new Float32Array(e,r,l),c,"float32");else if("int32"===u)f=v.a.tensor(new Int32Array(e,r,l),c,"int32");else{if("bool"!==u)throw new Error("Unsupported dtype in weight '"+s+"': "+u);f=v.a.tensor(new Uint8Array(e,r,l),c,"bool")}n[s]=f,r+=l*Kt[u]}return n}function Zt(e){return new Blob([e]).size}function $t(e){var t=0;e.forEach(function(e){t+=e.byteLength});var n=new Uint8Array(t),r=0;return e.forEach(function(e){n.set(new Uint8Array(e),r),r+=e.byteLength}),n.buffer}function en(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);var t=e.split("/");return t[t.length-1]}function tn(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:Zt(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:Zt(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:e.weightData.byteLength}}var nn=function(){function e(){this.saveRouters=[],this.loadRouters=[]}return e.getInstance=function(){return null==e.instance&&(e.instance=new e),e.instance},e.registerSaveRouter=function(t){e.getInstance().saveRouters.push(t)},e.registerLoadRouter=function(t){e.getInstance().loadRouters.push(t)},e.getSaveHandlers=function(t){return e.getHandlers(t,"save")},e.getLoadHandlers=function(t){return e.getHandlers(t,"load")},e.getHandlers=function(e,t){var n=[];return("load"===t?this.getInstance().loadRouters:this.getInstance().saveRouters).forEach(function(t){var r=t(e);null!==r&&n.push(r)}),n},e}(),rn=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},an=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},on=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},sn="://",un=function(){function e(){this.managers={}}return e.getInstance=function(){return null==e.instance&&(e.instance=new e),e.instance},e.registerManager=function(t,n){Object(y.assert)(null!=t,"scheme must not be undefined or null."),t.endsWith(sn)&&(t=t.slice(0,t.indexOf(sn))),Object(y.assert)(t.length>0,"scheme must not be an empty string.");var r=e.getInstance();Object(y.assert)(null==r.managers[t],"A model store manager is already registered for scheme '"+t+"'."),r.managers[t]=n},e.getManager=function(e){var t=this.getInstance().managers[e];if(null==t)throw new Error("Cannot find model manager for scheme '"+e+"'");return t},e.getSchemes=function(){return Object.keys(this.getInstance().managers)},e}();function cn(e){if(-1===e.indexOf(sn))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+un.getSchemes().join(","));return{scheme:e.split(sn)[0],path:e.split(sn)[1]}}function ln(e,t,n){return void 0===n&&(n=!1),an(this,void 0,void 0,function(){var r,a,o,i,s,u,c,l,f;return on(this,function(p){switch(p.label){case 0:return Object(y.assert)(e!==t,"Old path and new path are the same: '"+e+"'"),r=nn.getLoadHandlers(e),Object(y.assert)(r.length>0,"Copying failed because no load handler is found for source URL "+e+"."),Object(y.assert)(r.length<2,"Copying failed because more than one ("+r.length+") load handlers for source URL "+e+"."),a=r[0],o=nn.getSaveHandlers(t),Object(y.assert)(o.length>0,"Copying failed because no save handler is found for destination URL "+t+"."),Object(y.assert)(o.length<2,"Copying failed because more than one ("+r.length+") save handlers for destination URL "+t+"."),i=o[0],s=cn(e).scheme,u=cn(e).path,c=s===cn(e).scheme,[4,a.load()];case 1:return l=p.sent(),n&&c?[4,un.getManager(s).removeModel(u)]:[3,3];case 2:p.sent(),p.label=3;case 3:return[4,i.save(l)];case 4:return f=p.sent(),!n||c?[3,6]:[4,un.getManager(s).removeModel(u)];case 5:p.sent(),p.label=6;case 6:return[2,f.modelArtifactsInfo]}})})}var fn=function(){function e(){}return e.listModels=function(){return an(this,void 0,void 0,function(){var e,t,n,r,a,o,i;return on(this,function(s){switch(s.label){case 0:e=un.getSchemes(),t={},n=0,r=e,s.label=1;case 1:return n<r.length?(a=r[n],[4,un.getManager(a).listModels()]):[3,4];case 2:for(i in o=s.sent())t[a+sn+i]=o[i];s.label=3;case 3:return n++,[3,1];case 4:return[2,t]}})})},e.removeModel=function(e){return an(this,void 0,void 0,function(){var t;return on(this,function(n){switch(n.label){case 0:return t=cn(e),[4,un.getManager(t.scheme).removeModel(t.path)];case 1:return[2,n.sent()]}})})},e.copyModel=function(e,t){return an(this,void 0,void 0,function(){return on(this,function(n){switch(n.label){case 0:return[4,ln(e,t,!1)];case 1:return[2,n.sent()]}})})},e.moveModel=function(e,t){return an(this,void 0,void 0,function(){return on(this,function(n){switch(n.label){case 0:return[4,ln(e,t,!0)];case 1:return[2,n.sent()]}})})},rn([Object(qt.a)({heading:"Models",subheading:"Management"})],e,"listModels",null),rn([Object(qt.a)({heading:"Models",subheading:"Management"})],e,"removeModel",null),rn([Object(qt.a)({heading:"Models",subheading:"Management"})],e,"copyModel",null),rn([Object(qt.a)({heading:"Models",subheading:"Management"})],e,"moveModel",null),e}(),pn=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},hn=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},dn="tensorflowjs",mn="models_store",gn="model_info_store";function yn(){if(!c.ENV.get("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var e=window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function vn(e){var t=e.result;t.createObjectStore(mn,{keyPath:"modelPath"}),t.createObjectStore(gn,{keyPath:"modelPath"})}var bn=function(){function e(e){if(this.indexedDB=yn(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}return e.prototype.save=function(e){return pn(this,void 0,void 0,function(){return hn(this,function(t){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,e)]})})},e.prototype.load=function(){return pn(this,void 0,void 0,function(){return hn(this,function(e){return[2,this.databaseAction(this.modelPath)]})})},e.prototype.databaseAction=function(e,t){var n=this;return new Promise(function(e,r){var a=n.indexedDB.open(dn,1);a.onupgradeneeded=function(){return vn(a)},a.onsuccess=function(){var o=a.result;if(null==t){var i=o.transaction(mn,"readonly"),s=i.objectStore(mn).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."));e(s.result.modelArtifacts)},s.onerror=function(e){return o.close(),r(s.error)},i.oncomplete=function(){return o.close()}}else{var u,c=tn(t),l=o.transaction(gn,"readwrite"),f=l.objectStore(gn),p=f.put({modelPath:n.modelPath,modelArtifactsInfo:c});p.onsuccess=function(){var a=(u=o.transaction(mn,"readwrite")).objectStore(mn).put({modelPath:n.modelPath,modelArtifacts:t,modelArtifactsInfo:c});a.onsuccess=function(){return e({modelArtifactsInfo:c})},a.onerror=function(e){var t=(f=l.objectStore(gn)).delete(n.modelPath);t.onsuccess=function(){return o.close(),r(a.error)},t.onerror=function(e){return o.close(),r(a.error)}}},p.onerror=function(e){return o.close(),r(p.error)},l.oncomplete=function(){null==u?o.close():u.oncomplete=function(){return o.close()}}}},a.onerror=function(e){return r(a.error)}})},e.URL_SCHEME="indexeddb://",e}(),wn=function(e){return c.ENV.get("IS_BROWSER")&&e.startsWith(bn.URL_SCHEME)?(t=e.slice(bn.URL_SCHEME.length),new bn(t)):null;var t};nn.registerSaveRouter(wn),nn.registerLoadRouter(wn);var xn=function(){function e(){this.indexedDB=yn()}return e.prototype.listModels=function(){return pn(this,void 0,void 0,function(){var e=this;return hn(this,function(t){return[2,new Promise(function(t,n){var r=e.indexedDB.open(dn,1);r.onupgradeneeded=function(){return vn(r)},r.onsuccess=function(){var e=r.result,a=e.transaction(gn,"readonly"),o=a.objectStore(gn).getAll();o.onsuccess=function(){for(var e={},n=0,r=o.result;n<r.length;n++){var a=r[n];e[a.modelPath]=a.modelArtifactsInfo}t(e)},o.onerror=function(t){return e.close(),n(o.error)},a.oncomplete=function(){return e.close()}},r.onerror=function(e){return n(r.error)}})]})})},e.prototype.removeModel=function(e){return pn(this,void 0,void 0,function(){var t=this;return hn(this,function(n){var r;return e=(r=e).startsWith(bn.URL_SCHEME)?r.slice(bn.URL_SCHEME.length):r,[2,new Promise(function(n,r){var a=t.indexedDB.open(dn,1);a.onupgradeneeded=function(){return vn(a)},a.onsuccess=function(){var t,o=a.result,i=o.transaction(gn,"readwrite"),s=i.objectStore(gn),u=s.get(e);u.onsuccess=function(){if(null==u.result)return o.close(),r(new Error("Cannot find model with path '"+e+"' in IndexedDB."));var a=s.delete(e),i=function(){var a=(t=o.transaction(mn,"readwrite")).objectStore(mn).delete(e);a.onsuccess=function(){return n(u.result.modelArtifactsInfo)},a.onerror=function(e){return r(u.error)}};a.onsuccess=i,a.onerror=function(e){return i(),o.close(),r(u.error)}},u.onerror=function(e){return o.close(),r(u.error)},i.oncomplete=function(){null==t?o.close():t.oncomplete=function(){return o.close()}}},a.onerror=function(e){return r(a.error)}})]})})},e}();if(c.ENV.get("IS_BROWSER"))try{un.registerManager(bn.URL_SCHEME,new xn)}catch(e){}var kn=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},On=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Sn="/",Nn="tensorflowjs_models",En="info",In="model_topology",Tn="weight_specs",An="weight_data";function Cn(e){return{info:[Nn,e,En].join(Sn),topology:[Nn,e,In].join(Sn),weightSpecs:[Nn,e,Tn].join(Sn),weightData:[Nn,e,An].join(Sn)}}function Pn(e){var t=e.split(Sn);if(t.length<3)throw new Error("Invalid key format: "+e);return t.slice(1,t.length-1).join(Sn)}var _n=function(){function e(e){if(!c.ENV.get("IS_BROWSER")||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Cn(this.modelPath)}return e.prototype.save=function(e){return kn(this,void 0,void 0,function(){var t,n,r,a;return On(this,function(o){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),r=tn(e);try{return this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,(i=e.weightData,btoa(String.fromCharCode.apply(null,new Uint8Array(i))))),[2,{modelArtifactsInfo:r}]}catch(e){for(a in this.keys)this.LS.removeItem(this.keys[a]);throw 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 i;return[2]})})},e.prototype.load=function(){return kn(this,void 0,void 0,function(){var e,t,n,r,a;return On(this,function(o){if(null==(e=JSON.parse(this.LS.getItem(this.keys.info))))throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(t={},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(t.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(t.weightSpecs=r,null==(a=this.LS.getItem(this.keys.weightData)))throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return t.weightData=function(e){for(var t=atob(a),n=new Uint8Array(t.length),r=0;r<t.length;++r)n.set([t.charCodeAt(r)],r);return n.buffer}(),[2,t]})})},e.URL_SCHEME="localstorage://",e}(),Rn=function(e){return c.ENV.get("IS_BROWSER")&&e.startsWith(_n.URL_SCHEME)?(t=e.slice(_n.URL_SCHEME.length),new _n(t)):null;var t};nn.registerSaveRouter(Rn),nn.registerLoadRouter(Rn);var Mn=function(){function e(){Object(y.assert)(c.ENV.get("IS_BROWSER"),"Current environment is not a web browser"),Object(y.assert)(void 0!==window.localStorage,"Current browser does not appear to support localStorage"),this.LS=window.localStorage}return e.prototype.listModels=function(){return kn(this,void 0,void 0,function(){var e,t,n,r,a,o;return On(this,function(i){for(e={},t=Nn+Sn,n=Sn+En,r=0;r<this.LS.length;++r)(a=this.LS.key(r)).startsWith(t)&&a.endsWith(n)&&(o=Pn(a),e[o]=JSON.parse(this.LS.getItem(a)));return[2,e]})})},e.prototype.removeModel=function(e){return kn(this,void 0,void 0,function(){var t,n;return On(this,function(r){var a;if(e=(a=e).startsWith(_n.URL_SCHEME)?a.slice(_n.URL_SCHEME.length):a,t=Cn(e),null==this.LS.getItem(t.info))throw new Error("Cannot find model at path '"+e+"'");return n=JSON.parse(this.LS.getItem(t.info)),this.LS.removeItem(t.info),this.LS.removeItem(t.topology),this.LS.removeItem(t.weightSpecs),this.LS.removeItem(t.weightData),[2,n]})})},e}();if(c.ENV.get("IS_BROWSER"))try{un.registerManager(_n.URL_SCHEME,new Mn)}catch(e){}var jn=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Dn=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Ln="model",zn=".json",Fn=".weights.bin",Bn=function(){function e(t){if(!c.ENV.get("IS_BROWSER"))throw new Error("triggerDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(e.URL_SCHEME)&&(t=t.slice(e.URL_SCHEME.length)),null!=t&&0!==t.length||(t=Ln),this.modelTopologyFileName=t+zn,this.weightDataFileName=t+Fn}return e.prototype.save=function(e){return jn(this,void 0,void 0,function(){var t,n,r,a,o,i;return Dn(this,function(s){if(t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"})),e.modelTopology instanceof ArrayBuffer)throw new Error("DownloadTrigger.save() does not support saving model topology in binary formats yet.");return n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,weightsManifest:n},a=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=a,o.click(),null!=e.weightData&&((i=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,i.href=t,i.click()),[2,{modelArtifactsInfo:tn(e)}]})})},e.URL_SCHEME="downloads://",e}(),Vn=function(){function e(e){if(null==e||e.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+e);this.files=e}return e.prototype.load=function(){return jn(this,void 0,void 0,function(){var e,t,n=this;return Dn(this,function(r){return e=this.files[0],t=this.files.slice(1),[2,new Promise(function(r,a){var o=new FileReader;o.onload=function(o){var i=JSON.parse(o.target.result),s=i.modelTopology;if(null!=s){0===t.length&&r({modelTopology:s});var u=i.weightsManifest;if(null!=u){var c;try{c=n.checkManifestAndWeightFiles(u,t)}catch(e){return void a(e)}var l=[],f=[],p=[];u.forEach(function(e){e.paths.forEach(function(e){f.push(e),p.push(null)}),l.push.apply(l,e.weights)}),u.forEach(function(e){e.paths.forEach(function(e){var t=new FileReader;t.onload=function(t){var n=t.target.result,a=f.indexOf(e);p[a]=n,-1===p.indexOf(null)&&r({modelTopology:s,weightSpecs:l,weightData:$t(p)})},t.onerror=function(t){a("Failed to weights data from file of path '"+e+"'.")},t.readAsArrayBuffer(c[e])})})}else a(new Error("weightManifest field is missing from file "+e.name))}else a(new Error("modelTopology field is missing from file "+e.name))},o.onerror=function(t){a("Failed to read model topology and weights manifest JSON from file '"+e.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},o.readAsText(e)})]})})},e.prototype.checkManifestAndWeightFiles=function(e,t){for(var n=[],r=t.map(function(e){return en(e.name)}),a={},o=0,i=e;o<i.length;o++)i[o].paths.forEach(function(e){var o=en(e);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.");a[e]=t[r.indexOf(o)]});if(n.length!==t.length)throw new Error("Mismatch in the number of files in weights manifest ("+n.length+") and the number of weight files provided ("+t.length+").");return a},e}();function Un(e){return new Vn(e)}nn.registerSaveRouter(function(e){return c.ENV.get("IS_BROWSER")&&e.startsWith(Bn.URL_SCHEME)?(void 0===(t=e.slice(Bn.URL_SCHEME.length))&&(t="model"),new Bn(t)):null;var t});var Wn=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Gn=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function qn(e,t){return Wn(this,void 0,void 0,function(){var n,r;return Gn(this,function(a){switch(a.label){case 0:return n=e.map(function(e){return fetch(e,t)}),[4,Promise.all(n)];case 1:return r=a.sent(),[4,Promise.all(r.map(function(e){return e.arrayBuffer()}))];case 2:return[2,a.sent()]}})})}function Hn(e,t,n,r){return void 0===t&&(t=""),Wn(this,void 0,void 0,function(){var a,o,i,s,u,c,l,p,h,d;return Gn(this,function(m){switch(m.label){case 0:if(a=e.map(function(){return!1}),o={},i=null!=n?n.map(function(){return!1}):[],s=[],e.forEach(function(e,t){var r=0;e.weights.forEach(function(e){var u="quantization"in e?e.quantization.dtype:e.dtype,c=Kt[u]*y.sizeFromShape(e.shape),l=function(){a[t]=!0,null==o[t]&&(o[t]=[]),o[t].push({manifestEntry:e,groupOffset:r,sizeBytes:c})};null!=n?n.forEach(function(t,n){t===e.name&&(l(),i[n]=!0)}):l(),s.push(e.name),r+=c})}),!i.every(function(e){return e}))throw u=n.filter(function(e,t){return!i[t]}),new Error("Could not find weights in manifest with names: "+u.join(", ")+". \nManifest JSON has weights with names: "+s.join(", ")+".");return c=a.reduce(function(e,t,n){return t&&e.push(n),e},[]),l=[],c.forEach(function(n){e[n].paths.forEach(function(e){var n=t+(t.endsWith("/")?"":"/")+e;l.push(n)})}),[4,qn(l,r)];case 1:return p=m.sent(),h={},d=0,c.forEach(function(t){for(var n=e[t].paths.length,r=0,a=0;a<n;a++)r+=p[d+a].byteLength;for(var i=new ArrayBuffer(r),s=new Uint8Array(i),u=0,c=0;c<n;c++){var l=new Uint8Array(p[d+c]);s.set(l,u),u+=l.byteLength}o[t].forEach(function(e){var t,n=i.slice(e.groupOffset,e.groupOffset+e.sizeBytes),r=e.manifestEntry.dtype;if("quantization"in e.manifestEntry){var a=e.manifestEntry.quantization;if("uint8"!==a.dtype&&"uint16"!==a.dtype)throw new Error("Weight "+e.manifestEntry.name+" has unknown quantization dtype "+a.dtype+".");var o="uint8"===a.dtype?new Uint8Array(n):new Uint16Array(n);if("float32"===r)t=Float32Array.from(o,function(e){return e*a.scale+a.min});else{if("int32"!==r)throw new Error("Weight "+e.manifestEntry.name+" has a dtype not supported by quantization: "+r);t=Int32Array.from(o,function(e){return Math.round(e*a.scale+a.min)})}}else if("float32"===r)t=new Float32Array(n);else{if("int32"!==r)throw new Error("Weight "+e.manifestEntry.name+" has unknown dtype "+r+".");t=new Int32Array(n)}var s=e.manifestEntry.name;if(null!=h[s])throw new Error("Duplicate weight with name "+s+". Please make sure weights names are unique in the manifest JSON.");h[s]=Object(f.uc)(t,e.manifestEntry.shape,e.manifestEntry.dtype)}),d+=n}),[2,h]}})})}var Kn=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Xn=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Jn=function(){function e(e,t){if(this.DEFAULT_METHOD="POST",!c.ENV.get("IS_BROWSER"))throw new Error("browserHTTPRequest is not supported outside the web browser.");if(Object(y.assert)(null!=e&&e.length>0,"URL path for browserHTTPRequest must not be null, undefined or empty."),this.path=e,null!=t&&null!=t.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t||{}}return e.prototype.save=function(e){return Kn(this,void 0,void 0,function(){var t,n,r,a;return Xn(this,function(o){switch(o.label){case 0:if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,weightsManifest:n},t.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=e.weightData&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,fetch(this.path,t)];case 1:if(200===(a=o.sent()).status)return[2,{modelArtifactsInfo:tn(e),responses:[a]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+a.status+".")}})})},e.prototype.load=function(){return Kn(this,void 0,void 0,function(){var e,t,n,r,a,o,i,s,u,c,l,f;return Xn(this,function(p){switch(p.label){case 0:return[4,fetch(this.path,this.requestInit)];case 1:return[4,p.sent().json()];case 2:if(e=p.sent(),t=e.modelTopology,n=e.weightsManifest,null==t&&null==n)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");if(null==n)return[3,4];for(o=e.weightsManifest,r=[],i=0,s=o;i<s.length;i++)u=s[i],r.push.apply(r,u.weights);return(c=this.path.substring(0,this.path.lastIndexOf("/"))).endsWith("/")||(c+="/"),l=[],o.forEach(function(e){e.paths.forEach(function(e){l.push(c+e)})}),f=$t,[4,qn(l,this.requestInit)];case 3:a=f.apply(void 0,[p.sent()]),p.label=4;case 4:return[2,{modelTopology:t,weightSpecs:r,weightData:a}]}})})},e.URL_SCHEMES=["http://","https://"],e}();function Yn(e,t){return new Jn(e,t)}nn.registerSaveRouter(function(e){if(c.ENV.get("IS_BROWSER")){for(var t=0,n=Jn.URL_SCHEMES;t<n.length;t++){var r=n[t];if(e.startsWith(r))return Yn(e)}return null}return null});var Qn=nn.registerSaveRouter,Zn=nn.registerLoadRouter,$n=nn.getSaveHandlers,er=nn.getLoadHandlers,tr=fn.copyModel,nr=fn.listModels,rr=fn.moveModel,ar=fn.removeModel,or=function(){function e(){}return e.prototype.getClassName=function(){return this.constructor.className},e.fromConfig=function(e,t){return new e(t)},e}(),ir=function(){function e(){this.classNameMap={}}return e.getMap=function(){return null==e.instance&&(e.instance=new e),e.instance},e.register=function(e){this.getMap().classNameMap[e.className]=[e,e.fromConfig]},e}(),sr={BACKEND:"test-webgl"},ur={BACKEND:"test-cpu"},cr={},lr=.001;function fr(e,t,n){if(void 0===n&&(n=lr),e instanceof m.a||t instanceof m.a){if(e instanceof m.a&&t instanceof m.a){if(e.dtype!==t.dtype)throw new Error("Arrays are of different type actual: "+e.dtype+" vs expected: "+t.dtype+".");if(!y.arraysEqual(e.shape,t.shape))throw new Error("Arrays are of different shape actual: "+e.shape+" vs expected: "+t.shape+".")}}else{var r=e.constructor.name,a=t.constructor.name;if(r!==a)throw new Error("Arrays are of different type actual: "+r+" vs expected: "+a)}var o,i;if(o=e instanceof m.a?e.dataSync():e,i=t instanceof m.a?t.dataSync():t,o.length!==i.length)throw new Error("Arrays have different lengths actual: "+o.length+" vs expected: "+i.length+".\nActual: "+o+".\nExpected: "+i+".");for(var s=0;s<i.length;++s){var u=o[s],c=i[s];if(!mr(u,Number(c),n))throw new Error("Arrays differ: actual["+s+"] = "+u+", expected["+s+"] = "+c+".\nActual: "+o+".\nExpected: "+i+".")}}function pr(e,t){e().then(function(){return t.fail()},function(){return t()})}function hr(e,t){return fr(e,t,0)}function dr(e,t,n){if(void 0===n&&(n=lr),!mr(e,t,n))throw new Error("Numbers differ: actual === "+e+", expected === "+t)}function mr(e,t,n){return!(!isNaN(e)||!isNaN(t))||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function gr(e,t,n){var r;r=e instanceof m.a?e.dataSync():e;for(var a=0;a<r.length;a++)if(r[a]<t||r[a]>n)throw new Error("Value out of range:"+r[a]+" low: "+t+", high: "+n)}var yr,vr=n(7),br=(yr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}yr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),wr=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},xr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return br(t,e),t.prototype.minimize=function(e,t,n){void 0===t&&(t=!1);var r=this.computeGradients(e,n),a=r.value,o=r.grads;return this.applyGradients(o),Object.keys(o).forEach(function(e){return o[e].dispose()}),t?a:(a.dispose(),null)},t.prototype.computeGradients=function(e,t){return Object(vr.j)(e,t)},wr([Object(qt.a)({heading:"Training",subheading:"Optimizers"})],t.prototype,"minimize",null),wr([Object(qt.a)({heading:"Training",subheading:"Classes",namespace:"train"})],t)}(or),kr=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Or=function(e){function t(t,n,r){void 0===r&&(r=1e-8);var a=e.call(this)||this;return a.learningRate=t,a.rho=n,a.epsilon=r,a.accumulatedGrads={},a.accumulatedUpdates={},a.c=Object(vr.e)(Object(f.Sb)(-t)),a.epsilonScalar=Object(vr.e)(Object(f.Sb)(r)),a.rhoScalar=Object(vr.e)(Object(f.Sb)(n)),a.oneMinusRho=Object(vr.e)(Object(f.Sb)(1-n)),a}return kr(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var a=c.ENV.engine.registeredVariables[n];null==r.accumulatedGrads[n]&&Object(vr.f)(function(){t.accumulatedGrads[n]=Object(f.Ic)(a).variable(!1)}),null==r.accumulatedUpdates[n]&&Object(vr.f)(function(){t.accumulatedUpdates[n]=Object(f.Ic)(a).variable(!1)});var o=e[n],i=r.accumulatedGrads[n],s=r.accumulatedUpdates[n];Object(vr.f)(function(){var e=t.rhoScalar.mul(i).add(t.oneMinusRho.mul(o.square())),r=s.add(t.epsilonScalar).sqrt().div(i.add(t.epsilonScalar).sqrt()).mul(o),u=t.rhoScalar.mul(s).add(t.oneMinusRho.mul(r.square()));t.accumulatedGrads[n].assign(e),t.accumulatedUpdates[n].assign(u);var c=t.c.mul(r).add(a);a.assign(c)})},r=this;for(var a in e)n(a)},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.rhoScalar.dispose(),this.oneMinusRho.dispose(),null!=this.accumulatedUpdates&&(Object.keys(this.accumulatedUpdates).forEach(function(t){return e.accumulatedUpdates[t].dispose()}),Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},t.className="AdadeltaOptimizer",t}(xr);ir.register(Or);var Sr=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Nr=function(e){function t(t,n){void 0===n&&(n=.1);var r=e.call(this)||this;return r.learningRate=t,r.initialAccumulatorValue=n,r.accumulatedGrads={},r.c=Object(vr.e)(Object(f.Sb)(-t)),r.epsilon=Object(vr.e)(Object(f.Sb)(1e-8)),r}return Sr(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var a=c.ENV.engine.registeredVariables[n];null==r.accumulatedGrads[n]&&Object(vr.f)(function(){t.accumulatedGrads[n]=Object(f.U)(a.shape,t.initialAccumulatorValue).variable(!1)});var o=e[n],i=r.accumulatedGrads[n];Object(vr.f)(function(){var e=i.add(o.square());t.accumulatedGrads[n].assign(e);var r=t.c.mul(o.div(e.add(t.epsilon).sqrt())).add(a);a.assign(r)})},r=this;for(var a in e)n(a)},t.prototype.dispose=function(){var e=this;this.epsilon.dispose(),this.c.dispose(),null!=this.accumulatedGrads&&Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},t.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},t.className="AdagradOptimizer",t}(xr);ir.register(Nr);var Er=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ir=function(e){function t(t,n,r,a){void 0===a&&(a=1e-8);var o=e.call(this)||this;return o.learningRate=t,o.beta1=n,o.beta2=r,o.epsilon=a,o.accumulatedFirstMoment={},o.accumulatedSecondMoment={},o.c=Object(vr.e)(Object(f.Sb)(-t)),o.epsScalar=Object(vr.e)(Object(f.Sb)(a)),o.beta1Scalar=Object(vr.e)(Object(f.Sb)(n)),o.beta2Scalar=Object(vr.e)(Object(f.Sb)(r)),Object(vr.f)(function(){o.accBeta1=Object(f.Sb)(n).variable(),o.accBeta2=Object(f.Sb)(r).variable()}),o.oneMinusBeta1=Object(vr.e)(Object(f.Sb)(1-n)),o.oneMinusBeta2=Object(vr.e)(Object(f.Sb)(1-r)),o.one=Object(vr.e)(Object(f.Sb)(1)),o}return Er(t,e),t.prototype.applyGradients=function(e){var t=this;Object(vr.f)(function(){var n=t.one.sub(t.accBeta1),r=t.one.sub(t.accBeta2);for(var a in e){var o=c.ENV.engine.registeredVariables[a];if(null==t.accumulatedFirstMoment[a]){var i=!1;t.accumulatedFirstMoment[a]=Object(f.Ic)(o).variable(i)}null==t.accumulatedSecondMoment[a]&&(i=!1,t.accumulatedSecondMoment[a]=Object(f.Ic)(o).variable(i));var s=e[a],u=t.accumulatedFirstMoment[a],l=t.accumulatedSecondMoment[a],p=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),h=t.beta2Scalar.mul(l).add(t.oneMinusBeta2.mul(s.square())),d=p.div(n),m=h.div(r);t.accumulatedFirstMoment[a].assign(p),t.accumulatedSecondMoment[a].assign(h);var g=t.c.mul(d.div(t.epsScalar.add(m.sqrt()))).add(o);o.assign(g)}t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar)),t.accBeta2.assign(t.accBeta2.mul(t.beta2Scalar))})},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.accBeta1.dispose(),this.accBeta2.dispose(),this.oneMinusBeta1.dispose(),this.oneMinusBeta2.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedSecondMoment&&Object.keys(this.accumulatedSecondMoment).forEach(function(t){return e.accumulatedSecondMoment[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)},t.className="AdamOptimizer",t}(xr);ir.register(Ir);var Tr=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ar=function(e){function t(t,n,r,a,o){void 0===a&&(a=1e-8),void 0===o&&(o=0);var i=e.call(this)||this;return i.learningRate=t,i.beta1=n,i.beta2=r,i.epsilon=a,i.decay=o,i.accumulatedFirstMoment={},i.accumulatedWeightedInfNorm={},i.c=Object(vr.e)(Object(f.Sb)(-t)),i.epsScalar=Object(vr.e)(Object(f.Sb)(a)),i.beta1Scalar=Object(vr.e)(Object(f.Sb)(n)),i.beta2Scalar=Object(vr.e)(Object(f.Sb)(r)),i.decayScalar=Object(vr.e)(Object(f.Sb)(o)),Object(vr.f)(function(){i.iteration=Object(f.Sb)(0).variable(),i.accBeta1=Object(f.Sb)(n).variable()}),i.oneMinusBeta1=Object(vr.e)(Object(f.Sb)(1-n)),i.one=Object(vr.e)(Object(f.Sb)(1)),i}return Tr(t,e),t.prototype.applyGradients=function(e){var t=this;Object(vr.f)(function(){var n=t.one.sub(t.accBeta1),r=t.c.div(t.one.add(t.decayScalar.mul(t.iteration)));for(var a in e){var o=c.ENV.engine.registeredVariables[a];if(null==t.accumulatedFirstMoment[a]){var i=!1;t.accumulatedFirstMoment[a]=Object(f.Ic)(o).variable(i)}null==t.accumulatedWeightedInfNorm[a]&&(i=!1,t.accumulatedWeightedInfNorm[a]=Object(f.Ic)(o).variable(i));var s=e[a],u=t.accumulatedFirstMoment[a],l=t.accumulatedWeightedInfNorm[a],p=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),h=t.beta2Scalar.mul(l),d=s.abs(),m=h.maximum(d);t.accumulatedFirstMoment[a].assign(p),t.accumulatedWeightedInfNorm[a].assign(m);var g=r.div(n).mul(p.div(t.epsScalar.add(m))).add(o);o.assign(g)}t.iteration.assign(t.iteration.add(t.one)),t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar))})},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.accBeta1.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.oneMinusBeta1.dispose(),this.decayScalar.dispose(),this.iteration.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedWeightedInfNorm&&Object.keys(this.accumulatedWeightedInfNorm).forEach(function(t){return e.accumulatedWeightedInfNorm[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},t.className="AdamaxOptimizer",t}(xr);ir.register(Ar);var Cr=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pr=function(e){function t(t){var n=e.call(this)||this;return n.learningRate=t,n.setLearningRate(t),n}return Cr(t,e),t.prototype.applyGradients=function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n],a=c.ENV.engine.registeredVariables[n];Object(vr.f)(function(){var e=t.c.mul(r).add(a);a.assign(e)})})},t.prototype.setLearningRate=function(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=Object(vr.e)(Object(f.Sb)(-e))},t.prototype.dispose=function(){this.c.dispose()},t.prototype.getConfig=function(){return{learningRate:this.learningRate}},t.fromConfig=function(e,t){return new e(t.learningRate)},t.className="SGDOptimizer",t}(xr);ir.register(Pr);var _r=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Rr=function(e){function t(t,n,r){void 0===r&&(r=!1);var a=e.call(this,t)||this;return a.learningRate=t,a.momentum=n,a.useNesterov=r,a.m=Object(f.Sb)(a.momentum),a.accumulations={},a}return _r(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var a=c.ENV.engine.registeredVariables[n];null==r.accumulations[n]&&Object(vr.f)(function(){t.accumulations[n]=Object(f.Ic)(a).variable(!1)});var o=r.accumulations[n],i=e[n];Object(vr.f)(function(){var e,r=t.m.mul(o).add(i);e=t.useNesterov?t.c.mul(i.add(r.mul(t.m))).add(a):t.c.mul(r).add(a),t.accumulations[n].assign(r),a.assign(e)})},r=this;for(var a in e)n(a)},t.prototype.dispose=function(){if(e.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var t in this.accumulations)this.accumulations[t].dispose()},t.prototype.setMomentum=function(e){this.momentum=e},t.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},t.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},t.className="MomentumOptimizer",t}(Pr);ir.register(Rr);var Mr=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),jr=function(e){function t(t,n,r,a,o){void 0===n&&(n=.9),void 0===r&&(r=0),void 0===a&&(a=1e-8),void 0===o&&(o=!1);var i=e.call(this)||this;return i.learningRate=t,i.decay=n,i.momentum=r,i.epsilon=a,i.accumulatedMeanSquares={},i.accumulatedMeanGrads={},i.accumulatedMoments={},i.c=Object(vr.e)(Object(f.Sb)(t)),i.epsilonScalar=Object(vr.e)(Object(f.Sb)(a)),i.decayScalar=Object(vr.e)(Object(f.Sb)(n)),i.momentumScalar=Object(vr.e)(Object(f.Sb)(r)),i.oneMinusDecay=Object(vr.e)(Object(f.Sb)(1-n)),i.centered=o,i}return Mr(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var a=c.ENV.engine.registeredVariables[n];null==r.accumulatedMeanSquares[n]&&Object(vr.f)(function(){t.accumulatedMeanSquares[n]=Object(f.Ic)(a).variable(!1)}),null==r.accumulatedMeanGrads[n]&&r.centered&&Object(vr.f)(function(){t.accumulatedMeanGrads[n]=Object(f.Ic)(a).variable(!1)}),null==r.accumulatedMoments[n]&&Object(vr.f)(function(){t.accumulatedMoments[n]=Object(f.Ic)(a).variable(!1)});var o=r.accumulatedMeanSquares[n],i=r.accumulatedMeanGrads[n],s=r.accumulatedMoments[n],u=e[n];Object(vr.f)(function(){var e=t.decayScalar.mul(o).add(t.oneMinusDecay.mul(u.square()));if(t.centered){var r=t.decayScalar.mul(i).add(t.oneMinusDecay.mul(u)),c=t.momentumScalar.mul(s).add(t.c.mul(u).div(e.sub(r.square().add(t.epsilonScalar)).sqrt()));t.accumulatedMeanSquares[n].assign(e),t.accumulatedMeanGrads[n].assign(r),t.accumulatedMoments[n].assign(c);var l=a.sub(c);a.assign(l)}else{var f=t.decayScalar.mul(o).add(t.oneMinusDecay.mul(u.square()));c=t.momentumScalar.mul(s).add(t.c.mul(u).div(f.add(t.epsilonScalar).sqrt())),t.accumulatedMeanSquares[n].assign(f),t.accumulatedMoments[n].assign(c),l=a.sub(c),a.assign(l)}})},r=this;for(var a in e)n(a)},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.decayScalar.dispose(),this.momentumScalar.dispose(),this.oneMinusDecay.dispose(),null!=this.accumulatedMeanSquares&&Object.keys(this.accumulatedMeanSquares).forEach(function(t){return e.accumulatedMeanSquares[t].dispose()}),null!=this.accumulatedMeanGrads&&this.centered&&Object.keys(this.accumulatedMeanGrads).forEach(function(t){return e.accumulatedMeanGrads[t].dispose()}),null!=this.accumulatedMoments&&Object.keys(this.accumulatedMoments).forEach(function(t){return e.accumulatedMoments[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},t.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},t.className="RMSPropOptimizer",t}(xr);ir.register(jr);var Dr=n(39),Lr=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},zr=function(){function e(){}return e.sgd=function(e){return new Pr(e)},e.momentum=function(e,t,n){return void 0===n&&(n=!1),new Rr(e,t,n)},e.rmsprop=function(e,t,n,r,a){return void 0===t&&(t=.9),void 0===n&&(n=0),void 0===r&&(r=1e-8),void 0===a&&(a=!1),new jr(e,t,n,r,a)},e.adam=function(e,t,n,r){return void 0===e&&(e=.001),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=1e-8),new Ir(e,t,n,r)},e.adadelta=function(e,t,n){return void 0===e&&(e=.001),void 0===t&&(t=.95),void 0===n&&(n=1e-8),new Or(e,t,n)},e.adamax=function(e,t,n,r,a){return void 0===e&&(e=.002),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=1e-8),void 0===a&&(a=0),new Ar(e,t,n,r,a)},e.adagrad=function(e,t){return void 0===t&&(t=.1),new Nr(e,t)},Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"sgd",null),Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"momentum",null),Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"rmsprop",null),Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adam",null),Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adadelta",null),Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adamax",null),Lr([Object(qt.a)({heading:"Training",subheading:"Optimizers",namespace:"train"})],e,"adagrad",null),e}(),Fr={sgd:zr.sgd,momentum:zr.momentum,adadelta:zr.adadelta,adagrad:zr.adagrad,rmsprop:zr.rmsprop,adamax:zr.adamax,adam:zr.adam},Br=c.Environment.setBackend,Vr=c.Environment.getBackend,Ur=c.Environment.disposeVariables,Wr=c.Environment.memory,Gr=Ht.nextFrame,qr=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Hr=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return qr(t,e),t}(Error),Kr=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return qr(t,e),t}(Error),Xr=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return qr(t,e),t}(Error),Jr=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return qr(t,e),t}(Error),Yr=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return qr(t,e),t}(Error),Qr=(function(e){qr(function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r},e)}(Error),Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e});function Zr(e,t){if(Array.isArray(e)){for(var n=[],r=0;r<t;r++)n=n.concat(e);return n}return(n=new Array(t)).fill(e),n}function $r(e,t){if(!e)throw new Yr(t)}function ea(e,t){for(var n=0,r=0,a=e;r<a.length;r++)a[r]===t&&n++;return n}function ta(e){return 1===e.length?e[0]:e}function na(e){return Array.isArray(e)?e:[e]}function ra(e){return Array.isArray(e)&&Array.isArray(e[0])}function aa(e){return 0===e.length?[]:Array.isArray(e[0])?e:[e]}function oa(e){var t=e.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return"_"!==t[0]?t:"private"+t}function ia(e){return e.length<=1?e:-1===e.indexOf("_")?e:e.replace(/[_]+(\w|$)/g,function(e,t){return t.toUpperCase()})}var sa={};function ua(e){return null===e||void 0===e?null:{className:e.getClassName(),config:e.getConfig()}}function ca(e,t,n,r){if(void 0===t&&(t={}),void 0===n&&(n={}),void 0===r&&(r="object"),"string"==typeof e){var a=e,o=void 0;if(a in n)o=n[a];else if(a in sa)o=sa[a];else if(null==(o=t[a]))throw new Xr("Unknown "+r+": "+e);return o}var i=e;if(null==i.className||null==i.config)throw new Xr(r+": Improper config format: "+JSON.stringify(i)+".\n'className' and 'config' must set.");var s,u,c,l=i.className,f=void 0,p=void 0;if(l in n?(f=(s=n.get(l))[0],p=s[1]):l in sa?(f=(u=sa.className)[0],p=u[1]):l in t&&(f=(c=t[l])[0],p=c[1]),null==f)throw new Xr("Unknown "+r+": "+l);if(null!=p){for(var h={},d=0,m=Object.keys(sa);d<m.length;d++)h[x=m[d]]=sa[x];for(var g=0,y=Object.keys(n);g<y.length;g++)h[x=y[g]]=n[x];i.config.customObjects=h;for(var v=Qr({},sa),b=0,w=Object.keys(n);b<w.length;b++){var x=w[b];sa[x]=n[x]}var k=p(f,i.config);return sa=Qr({},v),k}v=Qr({},sa);for(var O=0,S=Object.keys(n);O<S.length;O++)x=S[O],sa[x]=n[x];return k=new f(i.config),sa=Qr({},v),k}function la(e){var t;if(Array.isArray(e)){if(1!==e.length)throw new Xr("Expected Tensor length to be 1; got "+e.length);t=e[0]}else t=e;return t}function fa(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return(e=e)[0];throw new Xr("Expected exactly 1 Shape; got "+e.length)}return e}function pa(e,t){return-1*function(e,t){return e<t?-1:e>t?1:0}(e,t)}function ha(e){if(null==e)return e;for(var t=[],n=0,r=e;n<r.length;n++){var a=r[n];-1===t.indexOf(a)&&t.push(a)}return t}function da(e){if(null==e)throw new Xr("Invalid value in obj: "+JSON.stringify(e));for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function ma(e,t,n){if(null!=n&&e.indexOf(n)<0)throw new Xr(n+" is not a valid "+t+". Valid values are "+e+" or null/undefined.")}var ga=new Map,ya=["channelsFirst","channelsLast"];function va(e){ma(ya,"DataFormat",e)}var ba=["valid","same","causal"];function wa(e){ma(ba,"PaddingMode",e)}var xa=["max","avg"],ka=[],Oa="/";function Sa(e){if(!Ia(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===ka.length?"":ka.join(Oa)+Oa)+e}function Na(e){if(!Ia(e))throw new Error("Not a valid tensor name: '"+e+"'");ga.has(e)||ga.set(e,0);var t=ga.get(e);if(ga.set(e,ga.get(e)+1),t>0){var n=e+"_"+t;return ga.set(n,1),n}return e}var Ea=new RegExp(/^[A-Za-z][A-Za-z0-9\._\/]*$/);function Ia(e){return!!e.match(Ea)}function Ta(e,t,n){null==t&&(t=0),null==n&&(n=e.length);for(var r=1,a=t;a<n;++a)r*=e[a];return r}function Aa(e){return e=Array.isArray(e)?new Float32Array(e):e,Object(f.vc)(e)}function Ca(e){return f.bb(Aa(e)).dataSync()[0]}function Pa(e){return f.Wa(Aa(e)).dataSync()[0]}function _a(e,t){if(t<e)throw new Xr("end ("+t+") < begin ("+e+") is forbidden.");for(var n=[],r=e;r<t;++r)n.push(r);return n}var Ra=0;function Ma(){return Ra++}var ja=function(){function e(e,t,n,r,a,o,i){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=r,this.callArgs=a,this.outputTensorIndex=i,this.id=Ma(),null!=o&&(this.originalName=Sa(o),this.name=Na(this.originalName)),this.rank=t.length}return function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}([Object(qt.a)({heading:"Models",subheading:"Classes"})],e)}(),Da="Variable",La=function(){function e(e,t,n,r,a){void 0===t&&(t="float32"),void 0===n&&(n=Da),void 0===r&&(r=!0),void 0===a&&(a=null),this.dtype=null==t?"float32":t,this.shape=e.shape,this.id=Ma(),n=null==n?Da:n,this.originalName=Sa(n),this.name=Na(this.originalName),this.trainable=r,this.constraint=a,this.val=m.d(e,this.trainable,this.name,this.dtype)}return e.prototype.read=function(){return this.val},e.prototype.write=function(e){return function(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}(this.val,e),this.val.assign(e),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val)),this},e}();function za(e){return e.map(function(e){return e.read()})}function Fa(e){e.map(function(e){e[0].write(e[1])})}var Ba="float32",Va={float32:{},int32:{}};function Ua(e,t){return void 0===t&&(t=Ba),null==Va[t][e]&&(Va[t][e]=Object(f.Sb)(e,t),vr.e(Va[t][e])),Va[t][e]}var Wa=function(){return 1e-7};function Ga(e){return e.shape}function qa(e){return e.shape}function Ha(e){return e instanceof m.a?Ba:e.dtype}function Ka(e,t){return e.asType(t)}function Xa(e,t){void 0===t&&(t=-1);var n=Ga(e).slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),e.reshape(n)}function Ja(e,t,n){return Object(vr.f)(function(){switch(e.rank){case 1:return f.ac(e,t,n);case 2:return f.bc(e,[t,0],[n,e.shape[1]]);case 3:return f.cc(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return f.dc(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);default:throw new Xr("sliceAlongFirstAxis() received an unsupported tensor rank: "+e.rank)}})}function Ya(e,t,n){return Object(vr.f)(function(){switch(e.rank){case 1:return f.ac(e,t,n);case 2:return f.bc(e,[0,t],[e.shape[0],n]);case 3:return f.cc(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return f.dc(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new Xr("sliceAlongLastAxis() received an unsupported tensor rank: "+e.rank)}})}function Qa(e,t,n,r){return Object(vr.f)(function(){switch(e.rank){case 1:return f.ac(e,t,n);case 2:switch(r){case 1:return Ja(e,t,n);case 2:return Ya(e,t,n);default:throw new Xr("The axis is not within the rank of the tensor "+r)}case 3:switch(r){case 1:return Ja(e,t,n);case 2:return f.cc(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return Ya(e,t,n);default:throw new Xr("The axis is not within the rank of the tensor "+r)}case 4:switch(r){case 1:return Ja(e,t,n);case 2:return f.dc(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return f.dc(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return Ya(e,t,n);default:throw new Xr("The axis is not within the rank of the tensor "+r)}default:throw new Xr("sliceAlongLastAxis() received an unsupported tensor rank: "+e.rank)}})}function Za(e,t){var n;return void 0===t&&(t=-1),t<0&&(t=0!==(n=e[0].rank)?n:0),t===e[0].rank&&(t=-1),f.x(e,t)}function $a(e,t){switch(e.rank){case 1:return f.y([e,t]);case 2:return f.z([e,t],0);case 3:return f.A([e,t],0);case 4:return f.B([e,t],0);default:throw new Xr("concatAlongFirstAxis() received an unsupported tensor rank: "+e.rank)}}function eo(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new Xr("The length of input n ("+t.length+") does not match the number of dimensions in input x ("+e.rank+")");return f.zc(e,t)}function to(e){return e.clone()}function no(e,t){return f.ib(e,t)}function ro(e,t){return f.d(e,t)}function ao(e,t,n,r,a){return void 0===t&&(t=0),void 0===n&&(n=1),f.Fb(e,t,n,r,a)}function oo(e,t){if(2!==t.rank)throw new Jr("dot support for y other than rank 2 is not yet implemented: y shape = "+Ga);if(2===e.rank)return f.Ua(e,t);if(3===e.rank){var n=e.shape[0],r=e.shape[1],a=e.shape[2];return e=e.reshape([n*r,a]),f.Ua(e,t).reshape([n,r,t.shape[1]])}throw new Jr("dot support for x of rank "+e.rank+" is not yet implemented: x shape = "+Ga)}function io(e,t,n){return Object(vr.f)(function(){return t=Array.isArray(t)?Object(f.vc)(t,"int32"):t.toInt(),f.X(e,t,n)})}function so(e){return f.jb(e,e)}function uo(e,t,n){return Object(vr.f)(function(){if(null==n&&(n="channelsLast"),va(n),1!==t.rank&&t.rank!==e.rank)throw new Xr("Unexpected bias dimensions: "+t.rank+"; expected it to be 1 or "+e.rank);var r,a=t.shape;if(5===e.rank)"channelsFirst"===n?r=1===a.length?e.add(t.reshape([1,a[0],1,1,1])):e.add(t.reshape([1,a[3],a[0],a[1],a[2]])):"channelsLast"===n&&(r=1===a.length?e.add(t.reshape([1,1,1,1,a[0]])):e.add(t.reshape([1].concat(a))));else if(4===e.rank)"channelsFirst"===n?r=1===a.length?e.add(t.reshape([1,a[0],1,1])):e.add(t.reshape([1,a[2],a[0],a[1]])):"channelsLast"===n&&(r=1===a.length?e.add(t.reshape([1,1,1,a[0]])):e.add(t.reshape([1].concat(a))));else if(3===e.rank)"channelsFirst"===n?r=1===a.length?e.add(t.reshape([1,a[0],1])):e.add(t.reshape([1,a[1],a[0]])):"channelsLast"===n&&(r=1===a.length?e.add(t.reshape([1,1,a[0]])):e.add(t.reshape([1].concat(a))));else{if(!(e.rank<3))throw new Xr("Unsupported input rank by biasAdd: "+e.rank);r=e.add(t)}return r})}function co(e,t){return function(e,t){ka.push(e);try{var n=t();return ka.pop(),n}catch(e){throw ka.pop(),e}}(e,t)}var lo={};function fo(e){return void 0===e&&(e=""),e in lo||(lo[e]=0),lo[e]+=1,e+lo[e].toString()}var po=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function ho(e,t){return Object(vr.f)(function(){return f.hc(f.rc(so(e),t,!0))})}var mo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return po(t,e),t.prototype.getConfig=function(){return{}},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}([Object(qt.a)({heading:"Constraints",subheading:"Classes",namespace:"constraints"})],t)}(i.Serializable),go=function(e){function t(t){var n=e.call(this)||this;return n.defaultMaxValue=2,n.defaultAxis=0,n.maxValue=null!=t.maxValue?t.maxValue:n.defaultMaxValue,n.axis=null!=t.axis?t.axis:n.defaultAxis,n}return po(t,e),t.prototype.apply=function(e){var t=this;return Object(vr.f)(function(){var n=ho(e,t.axis),r=f.v(n,0,t.maxValue);return f.ib(e,f.J(r,ro(Ua(Wa()),n)))})},t.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},t.className="MaxNorm",t}(mo);i.SerializationMap.register(go);var yo=function(e){function t(t){var n=e.call(this)||this;return n.defaultAxis=0,n.axis=null!=t.axis?t.axis:n.defaultAxis,n}return po(t,e),t.prototype.apply=function(e){var t=this;return Object(vr.f)(function(){return f.J(e,ro(Ua(Wa()),ho(e,t.axis)))})},t.prototype.getConfig=function(){return{axis:this.axis}},t.className="UnitNorm",t}(mo);i.SerializationMap.register(yo);var vo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return po(t,e),t.prototype.apply=function(e){return f.Jb(e)},t.className="NonNeg",t}(mo);i.SerializationMap.register(vo);var bo=function(e){function t(t){var n=e.call(this)||this;return n.defaultMinValue=0,n.defaultMaxValue=1,n.defaultRate=1,n.defaultAxis=0,n.minValue=null!=t.minValue?t.minValue:n.defaultMinValue,n.maxValue=null!=t.maxValue?t.maxValue:n.defaultMaxValue,n.rate=null!=t.rate?t.rate:n.defaultRate,n.axis=null!=t.axis?t.axis:n.defaultAxis,n}return po(t,e),t.prototype.apply=function(e){var t=this;return Object(vr.f)(function(){var n=ho(e,t.axis),r=f.d(no(Ua(t.rate),f.v(n,t.minValue,t.maxValue)),no(Ua(1-t.rate),n));return f.ib(e,f.J(r,ro(Ua(Wa()),n)))})},t.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},t.className="MinMaxNorm",t}(mo);i.SerializationMap.register(bo);var wo={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function xo(e){return ua(e)}function ko(e,t){return void 0===t&&(t={}),ca(e,i.SerializationMap.getMap().classNameMap,t,"constraint")}function Oo(e){return null==e?null:"string"==typeof e?ko({className:e in wo?wo[e]:e,config:{}}):e instanceof mo?e:ko(e)}function So(e,t){return void 0===t&&(t={}),ca(e,i.SerializationMap.getMap().classNameMap,t,"layer")}function No(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}function Eo(e,t){if(null===e)return null;if("string"==typeof e)return ia(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){for(var n=[],r=e.length,a=0;a<r;++a){var o=e[a];No(t,a,o)?n.push(o):n.push(Eo(o,t))}return n}for(var i={},s=0,u=Object.keys(e);s<u.length;s++){var c=u[s],l=e[c];if("name"===c&&"string"==typeof l)i[c]=l;else{var f=ia(c);i[f]=Eo(l,f)}}return i}var Io=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),To=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},Ao=function(e){this.dtype=e.dtype,this.shape=e.shape,null!=e.shape?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}},Co=0,Po=function(){function e(e,t){this.callArgs=t,this.id=Co++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(var n=0,r=e.inboundLayers;n<r.length;n++){var a=r[n];null!=a&&a.outboundNodes.push(this)}e.outboundLayer.inboundNodes.push(this)}return e.prototype.getConfig=function(){for(var e=[],t=0,n=this.inboundLayers;t<n.length;t++){var r=n[t];null!=r?e.push(r.name):e.push(null)}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}},e}(),_o=0,Ro=function(e){function t(t){var n=e.call(this)||this;n._callHook=null,n._addedWeightNames=[],n._stateful=!1,n.id=_o++,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=t.name;if(!r){var a=n.getClassName();r=oa(a)+"_"+fo(a)}if(n.name=r,n.trainable=null==t.trainable||t.trainable,n.updatable=null==t.updatable||t.updatable,null!=t.inputShape||null!=t.batchInputShape){var o=void 0;if(null!=t.batchInputShape)o=t.batchInputShape;else if(null!=t.inputShape){var i=null;null!=t.batchSize&&(i=t.batchSize),o=[i].concat(t.inputShape)}n.batchInputShape=o;var s=t.dtype;null==s&&(s=t.inputDType),null==s&&(s="float32"),n.dtype=s}return null!=t.weights?n.initialWeights=t.weights:n.initialWeights=null,n}return Io(t,e),t.nodeKey=function(e,t){return e.name+"_ib-"+t.toString()},t.prototype.getNodeAtIndex=function(e,t){if(0===this.inboundNodes.length)throw new Kr("The layer has never been called and thus has no defined "+t+".");if(this.inboundNodes.length<=e)throw new Xr("Asked to get "+t+" at node "+e+", but the layer has only "+this.inboundNodes.length+" inbound nodes.");return this.inboundNodes[e]},t.prototype.getInputAt=function(e){return ta(this.getNodeAtIndex(e,"input").inputTensors)},t.prototype.getOutputAt=function(e){return ta(this.getNodeAtIndex(e,"output").outputTensors)},Object.defineProperty(t.prototype,"input",{get:function(){if(this.inboundNodes.length>1)throw new Hr("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 Hr("Layer "+this.name+" is not connected, no input to return.");return ta(this.getNodeAtIndex(0,"input").inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){if(0===this.inboundNodes.length)throw new Hr("Layer "+this.name+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new Hr("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return ta(this.getNodeAtIndex(0,"output").outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"losses",{get:function(){return this._losses},enumerable:!0,configurable:!0}),t.prototype.calculateLosses=function(){return this.losses.map(function(e){return e()})},Object.defineProperty(t.prototype,"updates",{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"built",{get:function(){return this._built},set:function(e){this._built=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this._trainableWeights:[]},set:function(e){this._trainableWeights=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this._nonTrainableWeights:this._trainableWeights.concat(this._nonTrainableWeights)},set:function(e){this._nonTrainableWeights=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stateful",{get:function(){return this._stateful},enumerable:!0,configurable:!0}),t.prototype.assertInputCompatibility=function(e){if(e=na(e),null!=this.inputSpec&&0!==this.inputSpec.length){var t=na(this.inputSpec);if(e.length!==t.length)throw new Xr("Layer "+this.name+" expects "+t.length+" inputs, but it received "+e.length+" input tensors. Input received: "+e);for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(null!=a){var o=r.rank;if(null!=a.ndim&&o!==a.ndim)throw new Xr("Input "+n+" is incompatible with layer "+this.name+": expected ndim="+a.ndim+", found ndim="+o);if(null!=a.maxNDim&&o>a.maxNDim)throw new Xr("Input "+n+" is incompatible with layer "+this.name+": expected max_ndim="+a.maxNDim+", found ndim="+o);if(null!=a.minNDim&&o<a.minNDim)throw new Xr("Input "+n+" is incompatible with layer "+this.name+": expected min_ndim="+a.minNDim+", found ndim="+o+".");if(null!=a.dtype&&Ha(r)!==a.dtype){var i=Ha(r);throw new Xr("Input "+n+" is incompatible with layer "+this.name+" : expected dtype="+a.dtype+", found dtype="+i+".")}if(a.axes){var s=qa(r);for(var u in a.axes){var c=Number(u),l=a.axes[u],f=c>=0?s[c]:s[s.length+c];if(null!=l&&-1===[l,null].indexOf(f))throw new Xr("Input "+n+" is incompatible with layer "+this.name+": expected axis "+c+" of input shape to have value "+l+" but got shape "+s+".")}}if(null!=a.shape){s=qa(r);for(var p=0;p<a.shape.length;++p){var h=a.shape[p],d=s[p];if(null!=h&&null!=d&&h!==d)throw new Xr("Input "+n+" is incompatible with layer "+this.name+": expected shape="+a.shape+", found shape=${xShape}.")}}}}}},t.prototype.call=function(e,t){return e},t.prototype.invokeCallHook=function(e,t){null!=this._callHook&&this._callHook(e,t)},t.prototype.setCallHook=function(e){this._callHook=e},t.prototype.clearCallHook=function(){this._callHook=null},t.prototype.apply=function(e,t){var n=this;t=t||{};for(var r=na(e),a=!0,o=0,i=r;o<i.length;o++)if(!(i[o]instanceof ja)){a=!1;break}for(var s=!0,u=0,c=r;u<c.length;u++)if(c[u]instanceof ja){s=!1;break}if(a===s)throw new Xr("Arguments to apply() must be all SymbolicTensors or all Tensors");return co(this.name,function(){if(!n.built){n.assertInputCompatibility(e);for(var a=[],o=0,i=na(e);o<i.length;o++){var u=i[o];a.push(qa(u))}n.build(ta(a)),n.built=!0,n.initialWeights&&n.setWeights(n.initialWeights)}if(n.assertInputCompatibility(e),s){for(var c=[],l=0,f=na(m=n.call(e,t));l<f.length;l++){var p=f[l];-1!==r.indexOf(p)&&(p=to(p)),c.push(p)}if(m=ta(c),null!=n.activityRegularizer)throw new Jr("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return m}var h=function(e){for(var t=[],n=0,r=e=na(e);n<r.length;n++){var a=r[n];t.push(qa(a))}return ta(t)}(e),d=n.computeOutputShape(h),m=void 0;if(m=null!=d&&d.length>0&&Array.isArray(d[0])?d.map(function(r,a){return new ja("float32",r,n,na(e),t,n.name,a)}):new ja("float32",d,n,na(e),t,n.name),n.addInboundNode(e,m,null,null,h,d,t),null!=n.activityRegularizer)throw new Jr("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return m})},t.prototype.build=function(e){this.built=!0},t.prototype.getWeights=function(e){return void 0===e&&(e=!1),za(e?this.trainableWeights:this.weights)},t.prototype.setWeights=function(e){var t=this;Object(vr.f)(function(){var n=t.weights;if(n.length!==e.length)throw new Xr('You called setWeights(weights) on layer "'+t.name+'" with a weight list of length '+e.length+", but the layer was expecting "+n.length+" weights. Provided weights: "+e+"...");if(0!==n.length){for(var r=[],a=za(n),o=0;o<a.length;++o){var i=a[o],s=n[o],u=e[o];if(!y.arraysEqual(i.shape,u.shape))throw new Xr("Layer weight shape "+i.shape+" not compatible with provided weight shape "+u.shape);r.push([s,u])}Fa(r)}})},t.prototype.addWeight=function(e,t,n,r,a,o,i){if(-1!==this._addedWeightNames.indexOf(e))throw new Xr("Duplicate weight name "+e+" for layer "+this.name);this._addedWeightNames.push(e),null==n&&(n="float32");var s=new La(r.apply(t,n),n,e,o,i);return null!=a&&this.addLoss(function(){return a.apply(s.read())}),null==o&&(o=!0),o?this._trainableWeights.push(s):this._nonTrainableWeights.push(s),s},t.prototype.addLoss=function(e){var t;null==e||Array.isArray(e)&&0===e.length||(e=na(e),void 0!==this._losses&&null!==this._losses&&(t=this.losses).push.apply(t,e))},t.prototype.computeOutputShape=function(e){return e},t.prototype.computeMask=function(e,t){var n=this;if(!this.supportsMasking){if(null!=t){if(!Array.isArray(t))throw new TypeError("Layer "+this.name+" does not support masking,but was passed an inputMask.");t.forEach(function(e){if(null!=e)throw new TypeError("Layer "+n.name+" does not support masking,but was passed an inputMask.")})}return null}return t},t.prototype.addInboundNode=function(e,t,n,r,a,o,i){void 0===i&&(i=null);var s=na(e);t=na(t),n=na(n),r=na(r),a=aa(a),o=aa(o);for(var u=[],c=[],l=[],f=0,p=s;f<p.length;f++){var h=p[f];u.push(h.sourceLayer),c.push(h.nodeIndex),l.push(h.tensorIndex)}new Po({outboundLayer:this,inboundLayers:u,nodeIndices:c,tensorIndices:l,inputTensors:s,outputTensors:t,inputMasks:n,outputMasks:r,inputShapes:a,outputShapes:o},i);for(var d=0;d<t.length;d++)t[d].sourceLayer=this,t[d].nodeIndex=this.inboundNodes.length-1,t[d].tensorIndex=d},t.prototype.getConfig=function(){var e={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(e.batchInputShape=this.batchInputShape),null!=this.dtype&&(e.dtype=this.dtype),e},To([Object(qt.a)({heading:"Models",subheading:"Classes"})],t.prototype,"apply",null),To([Object(qt.a)({heading:"Layers",subheading:"Classes",namespace:"layers"})],t)}(i.Serializable),Mo=function(e){function t(t){var n=e.call(this,{dtype:t.dtype,name:null!=t.name?t.name:fo("input").toString()})||this;if(null==t.batchSize&&(t.batchSize=null),null==t.sparse&&(t.sparse=!1),n.trainable=!1,n.built=!0,n.sparse=t.sparse,null!=t.inputShape&&null!=t.batchInputShape)throw new Xr("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");var r=t.batchInputShape;if(null==r){if(null==t.inputShape)throw new Xr("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");r=[t.batchSize].concat(t.inputShape)}else if(null!=t.batchSize)throw new Xr("Cannot specify batchSize if batchInputShape isspecified when creating an InputLayer.");var a=t.dtype||"float32";n.batchInputShape=r,n.dtype=a,n.inputSpec=[{shape:r}];var o=new ja(n.dtype,n.batchInputShape,n,[],{},n.name);return o.nodeIndex=0,o.tensorIndex=0,new Po({outboundLayer:n,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[o],outputTensors:[o],inputMasks:[null],outputMasks:[null],inputShapes:[r],outputShapes:[r]}),n}return Io(t,e),t.prototype.apply=function(e,t){throw new Xr("Cannot pass any input to an InputLayer's apply() method. InputLayer name: "+this.name)},t.prototype.getConfig=function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}},t.className="InputLayer",t}(Ro);function jo(e){if(null==e.batchShape&&null==e.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!=e.batchShape&&null!=e.shape)throw new Xr("Please provide either a `shape` or `batchShape` argument to Input, but not both.");var t=e.batchShape;null!=e.shape&&null==t&&(t=[null].concat(e.shape));var n=e.dtype;return null==n&&(n="float32"),new Mo({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse}).inboundNodes[0].outputTensors[0]}i.SerializationMap.register(Mo);var Do=function(e){function t(n){var r=e.call(this,{})||this;if(r.containerNodes=new Set,r.name=n.name,null==r.name){var a=r.getClassName().toLowerCase();r.name=fo(a)}if(r.supportsMasking=!1,r.trainable=!0,r.updatable=!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],ha(r.inputs).length!==r.inputs.length)throw new Xr("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+r.inputs.map(function(e){return e.name}));ha(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(e){return e.name})),r.inputLayers=[],r.inputLayersNodeIndices=[],r.inputLayersTensorIndices=[],r.outputLayers=[],r.outputLayersNodeIndices=[],r.outputLayersTensorIndices=[],r.layers=[];for(var o=0,i=r.outputs;o<i.length;o++){var s=(E=i[o]).sourceLayer,u=E.nodeIndex,c=E.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=(E=f[l]).sourceLayer,u=E.nodeIndex,c=E.tensorIndex,$r(0===u,"input layer has >1 nodes"),$r(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 Mo))throw new TypeError("Input layers to a Model 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 h=0,d=r.outputLayers;h<d.length;h++)s=d[h],r.outputNames.push(s.name);r.internalInputShapes=r.inputs.map(function(e){return e.shape}),r.internalOutputShapes=r.outputs.map(function(e){return e.shape});for(var m={},g={},y={},v={},b={},w=[],x=function(e,n,a,o,i,s){null!=o&&null!=i&&null!=s||(o=e.sourceLayer,i=e.nodeIndex,s=e.tensorIndex);var u=o.inboundNodes[i];if(-1!==a.indexOf(u))throw new Kr("The tensor "+e.name+' at layer "'+o.name+'" is part of a cycle.');if(-1===n.indexOf(u)){r.containerNodes.add(t.nodeKey(o,i)),o.id in b||(b[o.id]=Object.keys(b).length),-1===a.indexOf(u)&&a.push(u);for(var c=u.inboundLayers.length,l=0;l<c;l++){var f=u.inputTensors[l],p=u.inboundLayers[l],h=u.nodeIndices[l],d=u.tensorIndices[l];x(f,n,a,p,h,d)}for(n.push(u);a.indexOf(u)>=0;)a.splice(a.indexOf(u),1);w.push(u)}},k=[],O=[],S=0,N=r.outputs;S<N.length;S++){var E=N[S];x(E,k,O)}for(var I=0,T=w.slice().reverse();I<T.length;I++){g[(Y=T[I]).id]=Y,Y.id in m||(m[Y.id]=0);var A=m[Y.id],C=null==y[Y.outboundLayer.id]?0:y[Y.outboundLayer.id];for(A=Math.max(A,C),y[Y.outboundLayer.id]=A,v[Y.outboundLayer.id]=Y.outboundLayer,m[Y.id]=A,p=0;p<Y.inboundLayers.length;p++){var P=Y.inboundLayers[p],_=(u=Y.nodeIndices[p],P.inboundNodes[u]),R=null==m[_.id]?0:m[_.id];m[_.id]=Math.max(A+1,R),g[_.id]=_}}var M={};for(var j in m)(A=m[j])in M||(M[A]=[]),M[A].push(g[j]);var D={};for(var L in y)(A=y[L])in D||(D[A]=[]),D[A].push(v[L]);var z=Object.keys(D).map(function(e){return parseInt(e,10)}).sort(pa);r.layers=[];for(var F=0,B=z;F<B.length;F++){var V=D[A=B[F]];V.sort(function(e,t){var n=b[e.id],r=b[t.id];return n<r?-1:n>r?1:0});for(var U=0,W=V;U<W.length;U++)s=W[U],r.layers.push(s)}r.layersByDepth=D,z=Object.keys(M).map(function(e){return parseInt(e,10)}).sort(pa);for(var G=r.inputs.slice(),q=[],H=0,K=z;H<K.length;H++)for(var X=0,J=M[A=K[H]];X<J.length;X++){var Y;if(null!=(s=(Y=J[X]).outboundLayer)){for(var Q=0,Z=Y.inputTensors;Q<Z.length;Q++)if(E=Z[Q],-1===G.indexOf(E))throw new Kr("Graph disconnected: cannot obtain value for tensor "+E+' at layer "'+s.name+'". The following previous layers were accessed without issue: '+q);for(var $=0,ee=Y.outputTensors;$<ee.length;$++)E=ee[$],G.push(E);q.push(s.name)}}r.nodesByDepth=M;for(var te=r.layers.map(function(e){return e.name}),ne=function(e){var t=te.filter(function(t){return t===e}).length;if(1!==t)throw new Kr('The name "'+e+'" is used '+t+" times in the model. All layer names should be unique. Layer names: "+JSON.stringify(te))},re=0,ae=te;re<ae.length;re++)ne(ae[re]);return r.outboundNodes=[],r.inboundNodes=[],new Po({outboundLayer:r,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:r.inputs,outputTensors:r.outputs,inputMasks:r.inputs.map(function(e){return null}),outputMasks:r.outputs.map(function(e){return null}),inputShapes:r.inputs.map(function(e){return e.shape}),outputShapes:r.outputs.map(function(e){return e.shape})}),r.built=!0,r}return Io(t,e),Object.defineProperty(t.prototype,"trainableWeights",{get:function(){if(this._trainableWeights.length>0)throw new Xr("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 e=[],t=0,n=this.layers;t<n.length;t++){var r=n[t];e=e.concat(r.trainableWeights)}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){for(var e=[],t=0,n=this.layers;t<n.length;t++){var r=n[t];e.push.apply(e,r.nonTrainableWeights)}if(!this.trainable){for(var a=[],o=0,i=this.layers;o<i.length;o++)r=i[o],a.push.apply(a,r.trainableWeights);return a.concat(e)}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),t.prototype.loadWeights=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1),n?function(e,t){for(var n={},r=0,a=0,o=t;a<o.length;a++)for(var i=0,s=o[a].weights;i<s.length;i++){var u=s[i];if(null!=n[u.originalName])throw new Xr("Duplicate weight name: "+u.originalName);n[u.originalName]=u,r++}var c=[];for(var l in e)c.push([n[l],e[l]]),delete n[l];var f=[];for(var p in n)f.push(p);if(f.length>0)throw new Xr(f.length+" of "+r+" weights are not set: "+f);Fa(c)}(e,this.layers):function(e,t,n){void 0===n&&(n=!1);for(var r=e.keras_version,a=e.backend,o=t.map(function(e){return e.name}),i={},s=0,u=t;s<u.length;s++){null!=(x=u[s]).name&&(null==i[x.name]&&(i[x.name]=[]),i[x.name].push(x))}for(var c=e.weights,l=[],f=0;f<o.length;++f){var p=o[f],h=c[p];null==h&&(h=[]);for(var d=[],g=0;g<h.length;++g){var v=h[g];d.push(new La((S=v.dtype,N=v.shape,E=v.value,I=function(e){switch(e){case"float32":return"float32";default:throw new Xr("Invalid dtype: "+e)}}(S),m.a.make(N,{values:0===N.length?E:y.flatten(E)},I))))}for(var b=0,w=i[p];b<w.length;b++){var x,k=(x=w[b]).weights;if((d=Lo(x,d,r,a)).length!==k.length){if(!n)throw new Xr("Layer #"+f+' (named "'+x.name+'") expects '+k.length+" weight(s), but the saved weights have "+d.length+" element(s).");console.warn("Skipping loading of weights of layer "+x.name+" due to mismatch in number of weights: ("+d.length+" vs "+k.length+").")}for(var O=0;O<d.length;++O)!n||y.arraysEqual(k[O].shape,d[O].shape)?l.push([k[O],d[O].read()]):console.warn("Skipping loading of weights for layer "+x.name+" due to mismatch in shape ("+k[O].shape+" vs "+d[O].shape+")")}}var S,N,E,I;Fa(l)}(e,this.layers,t)},t.prototype.updatedConfig=function(){var e=this.getConfig();return{className:this.getClassName(),config:e,kerasVersion:"tfjs-layers 0.6.4",backend:"TensorFlow.js"}},t.prototype.toJSON=function(e,t){void 0===t&&(t=!0);var n=function e(t,n){if(null===t||void 0===t)return null;if("string"==typeof t)return oa(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){for(var r=[],a=t.length,o=0;o<a;++o){var i=t[o];No(n,o,i)?r.push(i):r.push(e(i,n))}return r}for(var s={},u=0,c=Object.keys(t);u<c.length;u++){var l=c[u],f=t[l];s[oa(l)]="name"!==l&&"className"!==l||"string"!=typeof f?e(f,l):f}return s}(this.updatedConfig());return t?JSON.stringify(n):n},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var r;return e=na(e),r="mask"in t?na(t.mask):Zr(null,e.length),n.runInternalGraph(e,r)[0]})},t.prototype.computeMask=function(e,t){var n=this;return Object(vr.f)(function(){var r;return e=na(e),r=null==t?Zr(null,e.length):na(t),n.runInternalGraph(e,r)[1]})},t.prototype.computeOutputShape=function(e){var t=aa(e);if(t.length!==this.inputLayers.length)throw new Xr("Invalid inputShape argument "+e+": model has "+this.inputLayers.length+" tensor inputs.");for(var n={},r=0;r<t.length;r++){var a=this.inputLayers[r],o=t[r];n[O=a.name+"_0_0"]=o}var i=Object.keys(this.nodesByDepth).map(function(e){return parseInt(e,10)}).sort(pa);if(i.length>1)for(var s=0,u=i;s<u.length;s++)for(var c=u[s],l=0,f=this.nodesByDepth[c];l<f.length;l++){var p=f[l];if(a=p.outboundLayer,-1===this.inputLayers.map(function(e){return e.id}).indexOf(a.id)){for(var h=[],d=0;d<p.inboundLayers.length;d++){var m=p.inboundLayers[d],g=p.nodeIndices[d],y=p.tensorIndices[d],v=n[O=m.name+"_"+g+"_"+y];h.push(v)}var b=aa(a.computeOutputShape(ta(h))),w=a.inboundNodes.indexOf(p);for(d=0;d<b.length;d++)n[O=a.name+"_"+w+"_"+d]=b[d]}}var x=[],k=[];for(r=0;r<this.outputLayers.length;r++){a=this.outputLayers[r],w=this.outputLayersNodeIndices[r],y=this.outputLayersTensorIndices[r];var O=a.name+"_"+w+"_"+y;k.push(O)}for(r=0;r<k.length;r++){var S=k[r];$r(S in n),x.push(n[S])}return ta(x)},t.prototype.runInternalGraph=function(e,t){null==t&&(t=Zr(null,e.length));for(var n={},r=0;r<this.inputs.length;++r){var a=this.inputs[r],o=e[r],i=t[r];n[a.id]=[o,i]}for(var s=0,u=Object.keys(this.nodesByDepth).map(function(e){return parseInt(e,10)}).sort(pa);s<u.length;s++)for(var c=u[s],l=0,f=this.nodesByDepth[c];l<f.length;l++){for(var p=f[l],h=p.outboundLayer,d=p.inputTensors,m=p.outputTensors,g=new Array,y=0,v=d;y<v.length;y++)(a=v[y]).id in n&&g.push(n[a.id]);if(g.length===d.length){var b={},w=void 0,x=void 0,k=void 0,O=void 0;if(null!=p.callArgs&&(b=p.callArgs),1===g.length){var S=g[0],N=S[0],E=S[1];null==b.mask&&(b.mask=E),k=na(h.call(N,b)),O=na(h.computeMask(N,E)),w=[N],x=[E]}else w=g.map(function(e){return e[0]}),x=g.map(function(e){return e[1]}),null==b.mask&&(b.mask=x),k=na(h.call(w,b)),O=na(h.computeMask(w,x));if(h.activityRegularizer)throw new Jr("Model invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(r=0;r<m.length;++r)a=m[r],o=k[r],i=O[r],n[a.id]=[o,i]}}for(var I=[],T=[],A=[],C=0,P=this.outputs;C<P.length;C++){$r((a=P[C]).id in n,"Could not compute output "+a.name+" : "+a.id);var _=n[a.id],R=_[0];i=_[1],A.push(R.shape),I.push(R),T.push(i)}return[I,T,A]},t.prototype.buildNodeConversionMap=function(e){for(var n,r={},a=0,o=this.layers;a<o.length;a++){var i=o[a];n=i instanceof t?1:0;for(var s=0;s<i.inboundNodes.length;s++){var u=t.nodeKey(i,s);u in this.containerNodes&&(r[u]=n,n+=1)}}return r},t.prototype.getLayer=function(e,t){if(null!=t){if(this.layers.length<=t)throw new Xr("Was asked to retrieve layer at index "+t+", but model only has "+this.layers.length+" layer(s).");return this.layers[t]}if(null==e)throw new Xr("Provide either a layer name or layer index");for(var n=0,r=this.layers;n<r.length;n++){var a=r[n];if(a.name===e)return a}throw new Xr("No such layer: "+e)},t.prototype.calculateLosses=function(){var e=this;return Object(vr.f)(function(){for(var n=[],r=0,a=e.layers;r<a.length;r++)for(var o=a[r],i=0;i<o.inboundNodes.length;++i){var s=t.nodeKey(o,i);e.containerNodes.has(s)&&n.push.apply(n,o.calculateLosses())}return n})},t.prototype.getConfig=function(){for(var e={name:this.name},n=this.buildNodeConversionMap(this.layers),r=[],a=0,o=this.layers;a<o.length;a++){for(var i=(b=o[a]).getClassName(),s=b.getConfig(),u=[],c=0;c<b.inboundNodes.length;c++){var l=b.inboundNodes[c],f=t.nodeKey(b,c),p={};if(this.containerNodes.has(f)&&(l.callArgs&&(-1===JSON.stringify(l.callArgs).indexOf("undefined")?p=l.callArgs:(console.warn("Layer "+b.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)."),p={})),l.inboundLayers.length>0)){for(var h=[],d=0;d<l.inboundLayers.length;d++){var m=l.inboundLayers[d],g=l.nodeIndices[d],y=l.tensorIndices[d];null!==(x=n[t.nodeKey(m,g)])&&void 0!==x||(x=0),h.push([m.name,x,y,p])}u.push(h)}}r.push({name:b.name,className:i,config:s,inboundNodes:u})}e.layers=r;var v=[];for(d=0;d<this.inputLayers.length;d++){var b=this.inputLayers[d];g=this.inputLayersNodeIndices[d],f=t.nodeKey(b,g),this.containerNodes.has(f)&&(null!==(x=n[f])&&void 0!==x||(x=0),y=this.inputLayersTensorIndices[d],v.push([b.name,x,y]))}e.inputLayers=v;var w=[];for(d=0;d<this.outputLayers.length;d++){var x;if(b=this.outputLayers[d],g=this.outputLayersNodeIndices[d],f=t.nodeKey(b,g),this.containerNodes.has(f))null!==(x=n[f])&&void 0!==x||(x=0),y=this.outputLayersTensorIndices[d],w.push([b.name,x,y])}return e.outputLayers=w,e},t.fromConfig=function(e,t){var n={},r={};function a(e,t){e.name in r?r[e.name].push(t):r[e.name]=[t]}function o(e,t){for(var r,o=[],i=0,s=t;i<s.length;i++){var u=s[i],c=u[0],l=u[1],f=u[2];if(3===u.length)r={};else{if(4!==u.length)throw new Xr("Improperly formatted model config for layer "+JSON.stringify(e)+": "+JSON.stringify(u));r=u[3]}if(!(c in n))return void a(e,t);var p=n[c];if(p.inboundNodes.length<=l)return void a(e,t);var h=p.inboundNodes[l];o.push(h.outputTensors[f])}o.length>0&&e.apply(ta(o),r)}function i(e){var r=e.name,o=So(e,null!=t.customObjects?t.customObjects:{});n[r]=o;for(var i=0,s=e.inboundNodes;i<s.length;i++){var u=s[i];if(!(u instanceof Array))throw new Xr("Corrupted configuration, expected array for nodeData: "+u);a(o,u)}}for(var s=t.name,u=t.layers,c=0,l=u;c<l.length;c++)i(h=l[c]);for(;!da(r);)for(var f=0,p=u;f<p.length;f++){var h=p[f];if((E=n[h.name]).name in r){for(var d=0,m=r[E.name];d<m.length;d++)o(E,m[d]);delete r[E.name]}}for(var g=[],y=[],v=0,b=t.inputLayers;v<b.length;v++){var w=(h=b[v])[0],x=h[1],k=h[2];$r(w in n);var O=(E=n[w]).inboundNodes[x].outputTensors;g.push(O[k])}for(var S=0,N=t.outputLayers;S<N.length;S++){var E;w=(h=N[S])[0],x=h[1],k=h[2],$r(w in n),O=(E=n[w]).inboundNodes[x].outputTensors,y.push(O[k])}return new e({inputs:g,outputs:y,name:s})},Object.defineProperty(t.prototype,"stateful",{get:function(){if(this._stateful)throw new Xr("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 e=0,t=this.layers;e<t.length;e++)if(t[e].stateful)return!0;return!1},enumerable:!0,configurable:!0}),To([Object(qt.a)({heading:"Layers",subheading:"Classes",namespace:"layers",subclasses:["Model"]})],t.prototype,"getLayer",null),t}(Ro);function Lo(e,t,n,r){if(!n.startsWith("2."))throw new Xr("Unsupported Keras version in weights being loaded: "+n);return t}var zo=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fo=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Bo=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Vo=function(){function e(){this.validationData=null,this.model=null}return e.prototype.setParams=function(e){this.params=e},e.prototype.setModel=function(e){this.model=e},e.prototype.onEpochBegin=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return[2]})})},e.prototype.onEpochEnd=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return[2]})})},e.prototype.onBatchBegin=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return[2]})})},e.prototype.onBatchEnd=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return[2]})})},e.prototype.onTrainBegin=function(e){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return[2]})})},e.prototype.onTrainEnd=function(e){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return[2]})})},e}(),Uo=function(){function e(e,t){void 0===t&&(t=10),null==e&&(e=[]),this.callbacks=e,this.queueLength=t}return e.prototype.append=function(e){this.callbacks.push(e)},e.prototype.setParams=function(e){for(var t=0,n=this.callbacks;t<n.length;t++)n[t].setParams(e)},e.prototype.setModel=function(e){for(var t=0,n=this.callbacks;t<n.length;t++)n[t].setModel(e)},e.prototype.onEpochBegin=function(e,t){return Fo(this,void 0,void 0,function(){var n,r;return Bo(this,function(a){switch(a.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,a.label=1;case 1:return n<r.length?[4,r[n].onEpochBegin(e,t)]:[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onEpochEnd=function(e,t){return Fo(this,void 0,void 0,function(){var n,r;return Bo(this,function(a){switch(a.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,a.label=1;case 1:return n<r.length?[4,r[n].onEpochEnd(e,t)]:[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onBatchBegin=function(e,t){return Fo(this,void 0,void 0,function(){var n,r;return Bo(this,function(a){switch(a.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,a.label=1;case 1:return n<r.length?[4,r[n].onBatchBegin(e,t)]:[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onBatchEnd=function(e,t){return Fo(this,void 0,void 0,function(){var n,r;return Bo(this,function(a){switch(a.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,a.label=1;case 1:return n<r.length?[4,r[n].onBatchEnd(e,t)]:[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onTrainBegin=function(e){return Fo(this,void 0,void 0,function(){var t,n;return Bo(this,function(r){switch(r.label){case 0:null==e&&(e={}),t=0,n=this.callbacks,r.label=1;case 1:return t<n.length?[4,n[t].onTrainBegin(e)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e.prototype.onTrainEnd=function(e){return Fo(this,void 0,void 0,function(){var t,n;return Bo(this,function(r){switch(r.label){case 0:null==e&&(e={}),t=0,n=this.callbacks,r.label=1;case 1:return t<n.length?[4,n[t].onTrainEnd(e)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e}(),Wo=function(e){function t(){return e.call(this)||this}return zo(t,e),t.prototype.onEpochBegin=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return this.seen=0,this.totals={},[2]})})},t.prototype.onBatchEnd=function(e,t){return Fo(this,void 0,void 0,function(){var e,n,r,a,o=this;return Bo(this,function(i){for(a in null==t&&(t={}),e=null==t.size?0:t.size,this.seen+=e,n=function(n){var a=t[n];"number"==typeof a?(r.totals.hasOwnProperty(n)||(r.totals[n]=0),r.totals[n]=r.totals[n]+a*e):(r.totals.hasOwnProperty(n)||(r.totals[n]=Ua(0)),Object(vr.f)(function(){o.totals[n]=ro(o.totals[n],Object(f.ib)(a,Ua(e))),Object(vr.e)(o.totals[n])}))},r=this,t)n(a);return[2]})})},t.prototype.onEpochEnd=function(e,t){return Fo(this,void 0,void 0,function(){var e,n,r,a,o,i=this;return Bo(this,function(s){if(null!=t)for(e=function(e){if(null==n.totals[e])return"continue";"number"==typeof n.totals[e]?t[e]=n.totals[e]/n.seen:Object(vr.f)(function(){t[e]=no(Object(f.J)(Ua(1),Ua(i.seen)),i.totals[e]),i.totals[e].dispose(),Object(vr.e)(t[e])})},n=this,r=0,a=this.params.metrics;r<a.length;r++)o=a[r],e(o);return[2]})})},t}(Vo);function Go(e){return Fo(this,void 0,void 0,function(){var t,n,r,a,o,i,s;return Bo(this,function(u){switch(u.label){case 0:if(null==e)return[2];for(r in t=[],n=[],e)"number"!=typeof(a=e[r])&&(o=a,t.push(o.data()),n.push(r));return[4,Promise.all(t)];case 1:for(i=u.sent(),s=0;s<i.length;++s)e[n[s]]=i[s][0];return[2]}})})}var qo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return zo(t,e),t.prototype.onTrainBegin=function(e){return Fo(this,void 0,void 0,function(){return Bo(this,function(e){return this.epoch=[],this.history={},[2]})})},t.prototype.onEpochEnd=function(e,t){return Fo(this,void 0,void 0,function(){var n;return Bo(this,function(r){for(n in null==t&&(t={}),this.epoch.push(e),t)null==this.history[n]&&(this.history[n]=[]),this.history[n].push(t[n]);return[2]})})},t.prototype.syncData=function(){return Fo(this,void 0,void 0,function(){var e,t,n,r,a,o,i,s,u;return Bo(this,function(c){switch(c.label){case 0:for(r in e=[],t=[],n=[],this.history)for(a=this.history[r],o=0;o<a.length;++o)"number"!=typeof a[o]&&(i=a[o],e.push(i.data()),t.push(r),n.push(o));return[4,Promise.all(e)];case 1:for(s=c.sent(),u=0;u<s.length;++u)this.history[t[u]][n[u]].dispose(),this.history[t[u]][n[u]]=s[u][0];return[2]}})})},t}(Vo),Ho=function(e){function t(t){var n=e.call(this)||this;return n.trainBegin=t.onTrainBegin,n.trainEnd=t.onTrainEnd,n.epochBegin=t.onEpochBegin,n.epochEnd=t.onEpochEnd,n.batchBegin=t.onBatchBegin,n.batchEnd=t.onBatchEnd,n}return zo(t,e),t.prototype.onEpochBegin=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(n){switch(n.label){case 0:return null==this.epochBegin?[3,3]:[4,Go(t)];case 1:return n.sent(),[4,this.epochBegin(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onEpochEnd=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(n){switch(n.label){case 0:return null==this.epochEnd?[3,3]:[4,Go(t)];case 1:return n.sent(),[4,this.epochEnd(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onBatchBegin=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(n){switch(n.label){case 0:return null==this.batchBegin?[3,3]:[4,Go(t)];case 1:return n.sent(),[4,this.batchBegin(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onBatchEnd=function(e,t){return Fo(this,void 0,void 0,function(){return Bo(this,function(n){switch(n.label){case 0:return null==this.batchEnd?[3,3]:[4,Go(t)];case 1:return n.sent(),[4,this.batchEnd(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onTrainBegin=function(e){return Fo(this,void 0,void 0,function(){return Bo(this,function(t){switch(t.label){case 0:return null==this.trainBegin?[3,3]:[4,Go(e)];case 1:return t.sent(),[4,this.trainBegin(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},t.prototype.onTrainEnd=function(e){return Fo(this,void 0,void 0,function(){return Bo(this,function(t){switch(t.label){case 0:return null==this.trainEnd?[3,3]:[4,Go(e)];case 1:return t.sent(),[4,this.trainEnd(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},t}(Vo);function Ko(e,t){return Object(vr.f)(function(){var n=f.rc(so(e),t,!0),r=no(Object(f.Sb)(Wa()),f.sb(e)),a=f.hc(f.Ya(n,r));return f.J(e,a)})}function Xo(e,t){return Object(vr.f)(function(){return f.ab(so(f.pc(t,e)),-1)})}function Jo(e,t){return Object(vr.f)(function(){return f.ab(f.a(f.pc(t,e)),-1)})}function Yo(e,t){return Object(vr.f)(function(){var n=f.pc(e,t),r=f.v(f.a(e),Wa(),Number.MAX_VALUE),a=f.a(f.J(n,r));return no(Ua(100),f.ab(a,-1))})}function Qo(e,t){return Object(vr.f)(function(){var n=Ua(1),r=f.v(t,Wa(),Number.MAX_VALUE),a=f.La(ro(n,r)),o=f.v(e,Wa(),Number.MAX_VALUE),i=f.La(ro(n,o));return f.ab(so(f.pc(a,i)),-1)})}function Zo(e,t){return Object(vr.f)(function(){var n=Ua(0),r=Ua(1),a=f.Ya(n,f.pc(r,f.ib(e,t)));return f.ab(so(a),-1)})}function $o(e,t){return Object(vr.f)(function(){var n=Ua(0),r=Ua(1),a=f.Ya(n,f.pc(r,f.ib(e,t)));return f.ab(a,-1)})}function ei(e,t){return Object(vr.f)(function(){var n=Ua(0),r=Ua(1),a=f.rc(f.ib(e,t),-1),o=f.Wa(f.ib(f.pc(r,e),t),-1);return f.Ya(n,ro(r,f.pc(o,a)))})}function ti(e,t){return Object(vr.f)(function(){var n=Ua(Math.log(2)),r=f.pc(t,e),a=f.pc(f.d(r,f.fc(no(Ua(-2),r))),n);return f.ab(a,-1)})}function ni(e,t,n){return void 0===n&&(n=!1),Object(vr.f)(function(){if(n)t=f.ec(t);else{var r=f.rc(t,Ga(t).length-1,!0);t=f.J(t,r)}return t=f.v(t,Wa(),1-Wa()),f.mb(f.rc(f.ib(e.toFloat(),f.La(t)),Ga(t).length-1))})}function ri(e,t,n){return void 0===n&&(n=!1),Object(vr.f)(function(){var r,a,o=f.V((r=e,a=[Ta(r.shape)],r.reshape(a))).toInt(),i=Ga(t);return ni(f.qb(o,i[i.length-1]).reshape(i),t,n)})}function ai(e,t){return Object(vr.f)(function(){var n,r,a;return n=f.v(t,Wa(),1-Wa()),n=f.La(f.J(n,f.pc(f.sb(n),n))),f.ab((r=e,a=n,Object(vr.f)(function(){var e=f.Ya(a,f.Ic(a)),t=f.ib(a,r),n=f.La(f.d(Ua(1),f.Q(f.mb(f.a(a)))));return f.d(f.pc(e,t),n)})),-1)})}function oi(e,t){return Object(vr.f)(function(){var n=f.v(e,Wa(),1),r=f.v(t,Wa(),1);return f.rc(f.ib(e,f.La(f.J(n,r))),-1)})}function ii(e,t){return Object(vr.f)(function(){var n=f.La(ro(Ua(Wa()),t));return f.ab(f.pc(t,f.ib(e,n)),-1)})}function si(e,t){return Object(vr.f)(function(){var n=Ko(e,-1),r=Ko(t,-1),a=f.ib(n,r);return f.mb(f.rc(a,-1))})}function ui(e){var t={meanSquaredError:Xo,meanAbsoluteError:Jo,meanAbsolutePercentageError:Yo,meanSquaredLogarithmicError:Qo,squaredHinge:Zo,hinge:$o,categoricalHinge:ei,logcosh:ti,categoricalCrossentropy:ni,sparseCategoricalCrossentropy:ri,binaryCrossentropy:ai,kullbackLeiblerDivergence:oi,poisson:ii,cosineProximity:si};if("string"==typeof e){if(e in t)return t[e];throw new Xr("Unknown loss "+e)}return e}function ci(e,t){return Object(vr.f)(function(){var n=no(Ua(.5),f.sb(t)),r=Ka(f.Y(t,n),e.dtype);return f.ab(f.N(e,r),-1)})}function li(e,t){return Object(vr.f)(function(){return Ka(f.N(f.f(e,-1),f.f(t,-1)),"float32")})}function fi(e,t){return ai(e,t)}function pi(e,t){throw new Jr}var hi=Xo,di=Xo,mi=Jo,gi=Jo,yi=Yo,vi=Yo,bi=ni,wi=si,xi=ri,ki=function(){function e(t){if(this.id2Value={},t instanceof e)for(var n in t.id2Value)this.id2Value[n]=t.id2Value[n];else{if(null==t)return;for(var r=0,a=t;r<a.length;r++){var o=a[r];this.add(o.key,o.value)}}}return e.prototype.add=function(e,t){if(function(e,t){if(null!=e.dtype&&e.dtype!==t.dtype)throw new Xr("The dtype of the feed ("+t.dtype+") is incompatible with that of the key '"+e.name+"' ("+e.dtype+").");if(null!=e.shape){if(e.shape.length!==t.shape.length)throw new Xr("The rank of feed ("+t.shape.length+") does not match the rank of the key ("+e.shape.length+").");for(var n=0;n<e.shape.length;++n)if(null!=e.shape[n]&&e.shape[n]!==t.shape[n])throw new Xr("The "+n+"-th dimension of the feed ("+t.shape[n]+") is incompatible with that of the key ("+e.shape[n]+").")}}(e,t),null!=this.id2Value[e.id])throw new Xr("Duplicate key: name="+e.name+", id="+e.id);return this.id2Value[e.id]=t,this},e.prototype.addFeed=function(e){this.add(e.key,e.value)},e.prototype.hasKey=function(e){return null!=this.id2Value[e.id]},e.prototype.getValue=function(e){if(null==this.id2Value[e.id])throw new Xr("Nonexistent key: "+JSON.stringify(e));return this.id2Value[e.id]},e}();function Oi(e,t,n){for(var r=Array.isArray(e),a=r?e:[e],o=[],i=new ki(t),s=0,u=a;s<u.length;s++){var c=u[s];o.push(Si(c,i,n))}return r?o:o[0]}function Si(e,t,n){if(t.hasKey(e))return t.getValue(e);if(e.sourceLayer instanceof Mo)throw new Xr("Missing a feed value for SymbolicTensor from InputLayer '"+Mo.name+"'");for(var r=[],a=0,o=e.inputs;a<o.length;a++){var i=Si(o[a],t,n);r.push(i)}var s=e.sourceLayer.apply(r,n);Array.isArray(s)||(s=[s]);for(var u=function(e){var t;if(1===e.sourceLayer.inboundNodes.length)t=e.sourceLayer.output;else{for(var n=null,r=0;r<e.sourceLayer.inboundNodes.length;++r)for(var a=0,o=e.sourceLayer.inboundNodes[r].outputTensors;a<o.length;a++){if(o[a].id===e.id){n=r;break}}t=e.sourceLayer.getOutputAt(n)}return t}(e),c=Array.isArray(u)?u:[u],l=0;l<c.length;++l)t.add(c[l],s[l]);return 1===s.length?s[0]:s[e.outputTensorIndex]}var Ni,Ei,Ii=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ti=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},Ai=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Ci=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function Pi(e){return Array.isArray(e)}function _i(e){return!function(e){return e instanceof m.a}(e)&&!Pi(e)}function Ri(e,t,n,r,a){if(void 0===r&&(r=!0),void 0===a&&(a=""),null==t||0===t.length){if(null!=e){var o=!1;if(Pi(e)&&e.length>0)o=!0;else if(_i(e)){for(var i in e)if(e.hasOwnProperty(i)){o=!0;break}}else o=!0;if(o)throw new Xr("Error when checking model "+a+" expected no data, but got "+e)}return[]}if(null==e)return t.map(function(e){return null});var s;if(_i(e)){e=e,s=[];for(var u=0,c=t;u<c.length;u++){var l=c[u];if(null==e[l])throw new Xr('No data provided for "'+l+'". Need data for each key in: '+t);s.push(e[l])}}else if(Pi(e)){if((e=e).length!==t.length)throw new Xr("Error when checking model "+a+": the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see "+t.length+" Tensor(s), but instead got the following list of Tensor(s): "+e);s=e}else{if(e=e,t.length>1)throw new Xr("The model "+a+" expects "+t.length+" Tensor(s), but only received one Tensor. Found: Tensor with shape "+e.shape);s=[e]}for(var f=0;f<t.length;++f)1===(p=s[f]).shape.length&&(s[f]=Xa(p,1));if(null!=n)for(f=0;f<t.length;++f)if(null!=n[f]){var p;if((p=s[f]).shape.length!==n[f].length)throw new Xr("Error when checking "+a+": expected "+t[f]+" to have "+n[f].length+" dimension(s). but got array with shape "+p.shape);for(var h=0;h<n[f].length;++h)if(0!==h||r){var d=p.shape[h],m=n[f][h];if(null!=m&&m>=0&&d!==m)throw new Xr("Error when checking "+a+": expected "+t[f]+" to have shape ["+n[f]+"], but got array with shape ["+p.shape+"].")}}return s}function Mi(e,t){for(var n=[],r=0,a=null;r<e;)(a=r+t)>=e&&(a=e),n.push([r,a]),r=a;return n}function ji(e,t,n){return null==e?[null]:Array.isArray(e)?e.map(function(e){return Ja(e,t,n-t)}):Ja(e,t,n-t)}function Di(e,t){return null==e?null:Array.isArray(e)?e.map(function(e){return Di(e,t)}):io(e,"int32"===t.dtype?t:t.toInt())}function Li(e,t,n,r,a){var o;if(void 0===r&&(r=!0),void 0===a&&(a=""),Array.isArray(e)){if(e.length!==t.length)throw new Xr("Error when checking model "+a+": the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see "+t.length+" Tensor(s), but instead got "+e.length+" Tensors(s).");o=e}else{if(t.length>1)throw new Xr("The model expects "+t.length+" "+a+" Tensors, but only received one Tensor. Found: array with shape "+JSON.stringify(e.shape)+".");o=[e]}if(null!=n)for(var i=0;i<t.length;++i)if(null!=n[i]){var s=o[i];if(s.shape.length!==n[i].length)throw new Xr("Error when checking "+a+": expected "+t[i]+" to have "+n[i].length+" dimension(s), but got array with shape "+JSON.stringify(s.shape));for(var u=0;u<n[i].length;++u)if(0!==u||r){var c=s.shape[u],l=n[i][u];if(null!=l&&l!==c)throw new Xr("Error when checking "+a+": expected "+t[i]+" to have shape "+JSON.stringify(n[i])+" but got array with shape "+JSON.stringify(s.shape)+".")}}}(Ei=Ni||(Ni={}))[Ei.SILENT=0]="SILENT",Ei[Ei.VERBOSE=1]="VERBOSE";var zi=function(e){function t(t){return e.call(this,t)||this}return Ii(t,e),t.prototype.compile=function(e){var t=this;if(null==e.loss&&(e.loss=[]),this.loss=e.loss,"string"==typeof e.optimizer)this.optimizer=function(e){var t={Adagrad:function(){return Fr.adagrad(.01)},Adam:function(){return Fr.adam(.001,.9,.999,Wa())},RMSProp:function(){return Fr.rmsprop(.001,.9,null,Wa())},SGD:function(){return Fr.sgd(.01)}};if(t.adagrad=t.Adagrad,t.adam=t.Adam,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new Xr("Unknown Optimizer "+e)}(e.optimizer);else{if(!(e.optimizer instanceof xr))throw new Xr("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer=e.optimizer}var n=[];if(Array.isArray(e.loss)||"string"==typeof e.loss||"function"==typeof e.loss)if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new Xr("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="+e.loss+".");var r=e.loss;n=r.map(function(e){return ui(e)})}else{var a=ui(e.loss);this.outputs.map(function(e){n.push(a)})}else{for(var o in e.loss=e.loss,e.loss)if(-1===this.outputNames.indexOf(o))throw new Xr('Unknown entry in loss dictionary: "'+o+'". Only expect the following keys: '+this.outputNames);for(var i in this.outputNames)null==e.loss[i]&&console.warn('Output "'+i+'" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to '+i+" during training"),n.push(ui(e.loss[i]))}this.lossFunctions=n,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(var s=0;s<this.outputs.length;++s){var u=this.internalOutputShapes[s],c=this.outputNames[s];this.feedOutputNames.push(c),this.feedOutputShapes.push(u),this.feedLossFns.push(this.lossFunctions[s])}var l=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],co("loss",function(){for(var e=0;e<t.outputs.length;++e)if(-1===l.indexOf(e)){var n=t.lossFunctions[e];t.outputs.length>1&&(t.metricsTensors.push([n,e]),t.metricsNames.push(t.outputNames[e]+"_loss"))}});var f=function(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map(function(e){return[]});if(Array.isArray(e))return t.map(function(t){return e});if(null!=e){for(var n=[],r=0,a=t;r<a.length;r++){var o=a[r],i=e.hasOwnProperty(o)?e[o]:[];Array.isArray(i)||(i=[i]),n.push(i)}return n}throw new TypeError("Type of metrics argument not understood. Expected an Array or Object, found: "+e)}(e.metrics,this.outputNames);co("metric",function(){for(var e=function(e){if(-1!==l.indexOf(e))return"continue";!function(n){for(var r,a,o,i=function(n){if(-1!==["accuracy","acc","crossentropy","ce"].indexOf(n)){var i=t.internalOutputShapes[e];1===i[i.length-1]||t.lossFunctions[e]===ai?-1!==["accuracy","acc"].indexOf(n)?a=ci:-1!==["crossentropy","ce"].indexOf(n)&&(a=fi):t.lossFunctions[e]===ri?-1!==["accuracy","acc"].indexOf(n)?a=pi:-1!==["crossentropy","ce"].indexOf(n)&&(a=xi):-1!==["accuracy","acc"].indexOf(n)?a=li:-1!==["crossentropy","ce"].indexOf(n)&&(a=bi);var s=void 0;-1!==["accuracy","acc"].indexOf(n)?s="acc":-1!==["crossentropy","ce"].indexOf(n)&&(s="ce"),o=a,r=""+s}else{var u=function(e){var t={binaryAccuracy:ci,categoricalAccuracy:li,categoricalCrossentropy:bi,sparseCategoricalCrossentropy:xi,mse:hi,MSE:di,mae:mi,MAE:gi,mape:yi,MAPE:vi,cosine:wi};if("string"==typeof e&&e in t)return t[e];if("string"!=typeof e&&null!=e)return e;throw new Xr("Unknown metric "+e)}(n);o=u,r=""+n}var c;co(r,function(){c=o}),function(e,n,r){t.outputNames.length>1&&(n=t.outputNames[e]+"_"+n),t.metricsNames.push(n),t.metricsTensors.push([r,e])}(e,r,c)},s=0,u=f[e];s<u.length;s++)i(u[s])}()},n=0;n<t.outputs.length;++n)e(n)}),this.collectedTrainableWeights=this.trainableWeights},t.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?")},t.prototype.evaluate=function(e,t,n){void 0===n&&(n={});var r=null==n.batchSize?32:n.batchSize,a=this.standardizeUserData(e,t,!0,r),o=a[0].concat(a[1]);this.makeTestFunction();var i=this.testFunction;return ta(this.testLoop(i,o,r,n.verbose,n.steps))},t.prototype.checkNumSamples=function(e,t,n,r){var a;if(void 0===r&&(r="steps"),null!=n){if(a=null,null!=t)throw new Xr("If "+r+" is set, batchSize must be null or undefined.Got batchSize = "+t)}else{if(null==e)throw new Xr("Either the input data should have a defined shape, or "+r+" shoud be specified.");a=Array.isArray(e)?e[0].shape[0]:e.shape[0]}return a},t.prototype.predictLoop=function(e,t,n){var r=this;void 0===t&&(t=32),void 0===n&&(n=!1);var a=this.checkNumSamples(e);if(n)throw new Jr("Verbose predictLoop() is not implemented yet.");for(var o=Mi(a,t),i=[],s=function(t){var n=vr.f(function(){var n=o[t][0],a=o[t][1],i=ji(e,n,a),s=[];if(Array.isArray(i))for(var u=0;u<i.length;++u)s.push({key:r.inputs[u],value:i[u]});else s.push({key:r.inputs[0],value:i});var c=new ki(s);return Oi(r.outputs,c)});if(0===t)for(var a=0,s=n;a<s.length;a++){var u=s[a];i.push(u)}else for(var c=0;c<n.length;++c)i[c]=$a(i[c],n[c])},u=0;u<o.length;++u)s(u);return ta(i)},t.prototype.predict=function(e,t){void 0===t&&(t={}),Li(e,this.inputNames,this.feedInputShapes,!1);var n=null==t.batchSize?32:t.batchSize;return this.predictLoop(e,n)},t.prototype.predictOnBatch=function(e){return Li(e,this.inputNames,this.feedInputShapes,!0),this.predictLoop(e,e.shape[0])},t.prototype.standardizeUserData=function(e,t,n,r){if(void 0===n&&(n=!0),null==this.optimizer)throw new Kr("You must compile a model before training/testing. Use Model.compile(modelCompileConfig).");for(var a=[],o=0;o<this.feedOutputShapes.length;++o){var i=this.feedOutputShapes[o];this.feedLossFns[o]===ri?a.push(i.slice(0,i.length-1).concat([1])):a.push(i)}if(function(e,t,n){var r=ha(e.map(function(e){return e.shape[0]}));r.sort();var a=ha(t.map(function(e){return e.shape[0]}));if(a.sort(),r.length>1)throw new Xr("All input Tensors (x) should have the same number of samples. Got array shapes: "+JSON.stringify(e.map(function(e){return e.shape})));if(a.length>1)throw new Xr("All target Tensors (y) should have the same number of samples. Got array shapes: "+JSON.stringify(t.map(function(e){return e.shape})));if(r.length>0&&a.length>0&&!y.arraysEqual(r,a))throw new Xr("Input Tensors should have the same number of samples as target Tensors. Found "+r[0]+" input sample(s) and "+a[0]+" target sample(s).")}(e=Ri(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=Ri(t,this.feedOutputNames,a,!1,"target")),function(e,t,n){for(var r=[Xo,ai,ni],a=0;a<e.length;++a){var o=e[a],i=t[a],s=n[a];if(null!=i){if(i===ni&&1===o.shape[o.shape.length-1])throw new Xr("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(i))for(var u=o.shape.slice(1),c=s.slice(1),l=0;l<u.length;++l){var f=u[l],p=c[l];if(null!=p&&f!==p)throw new Xr("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.")}}}}(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=r&&r>0&&e[0].shape[0]%r!=0)throw new Xr("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+r+". Found: "+e[0].shape[0]+" sample(s).");return[e,t,null]},t.prototype.fitLoop=function(e,t,n,r,a,o,i,s,u,c,l,p,h,d){return void 0===p&&(p=0),Ai(this,void 0,void 0,function(){var m,g,v,b,w,x,k,O=this;return Ci(this,function(S){switch(S.label){case 0:if(null==r&&(r=32),null==a&&(a=1),null==c&&(c=!0),null==p&&(p=0),m=!1,null!=s&&null!=u&&(m=!0),null!=d&&(m=!0,null==h))throw new Xr("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");if(null!=(g=this.checkNumSamples(t,r,h,"steps_per_epoch"))&&(v=_a(0,g)),this.history=new qo,i=(i=null==i?[new Wo]:[new Wo].concat(i)).concat([this.history]),o>0)throw new Jr("Verbose mode is not implemented yet.");return(b=new Uo(i)).setModel(this),b.setParams({epochs:a,steps:h,verbose:o,doValidation:m,metrics:l}),[4,b.onTrainBegin()];case 1:S.sent(),this.stopTraining=!1,w=function(a){var o,i,l,p,d;return Ci(this,function(w){switch(w.label){case 0:return[4,b.onEpochBegin(a)];case 1:if(w.sent(),o={},null==h)return[3,2];throw new Jr("stepsPerEpoch mode is not implemented yet.");case 2:if("batch"===c)throw new Jr("batch shuffling is not implemneted yet");c&&y.shuffle(v),i=Object(f.vc)(v),l=Mi(g,r),p=function(a){var c;return Ci(this,function(f){switch(f.label){case 0:return c={},[4,b.onBatchBegin(a,c)];case 1:return f.sent(),vr.f(function(){var f=l[a][0],p=l[a][1],h=Ja(i,f,p-f);c.batch=a,c.size=p-f;for(var d=Di(t,h),g=e(d),y=0;y<n.length;++y){var v=n[y],b=g[y];c[v]=b,vr.e(b)}if(a===l.length-1&&m){var w=O.testLoop(s,u,r);for(y=0;y<n.length;++y)v=n[y],b=w[y],vr.e(b),o["val_"+v]=b}}),[4,b.onBatchEnd(a,c)];case 2:return f.sent(),function(e){if(null!=e)for(var t in e){var n=e[t];"number"!=typeof n&&n.dispose()}}(c),x.stopTraining?[2,"break"]:[2]}})},d=0,w.label=3;case 3:return d<l.length?[5,p(d)]:[3,6];case 4:if("break"===w.sent())return[3,6];w.label=5;case 5:return++d,[3,3];case 6:i.dispose(),w.label=7;case 7:return[4,b.onEpochEnd(a,o)];case 8:return w.sent(),x.stopTraining?[2,"break"]:[2]}})},x=this,k=p,S.label=2;case 2:return k<a?[5,w(k)]:[3,5];case 3:if("break"===S.sent())return[3,5];S.label=4;case 4:return++k,[3,2];case 5:return[4,b.onTrainEnd()];case 6:return S.sent(),[4,this.history.syncData()];case 7:return S.sent(),[2,this.history]}})})},t.prototype.testLoop=function(e,t,n,r,a){void 0===r&&(r=0);var o=this.checkNumSamples(t,n,a,"steps"),i=[];if(1===r)throw new Jr("Verbose mode is not implemented yet.");if(null!=a)throw new Jr("steps mode in testLoop() is not implemented yet");for(var s=Mi(o,n),u=Object(f.vc)(_a(0,o)),c=0;c<s.length;++c){var l=s[c][0],p=s[c][1],h=e(Di(t,Ja(u,l,p-l)));if(0===c)for(var d=0;d<h.length;++d)i.push(Ua(0));for(d=0;d<h.length;++d){var m=h[d];i[d]=f.d(i[d],no(Ua(p-l),m))}}for(d=0;d<i.length;++d)i[d]=f.J(i[d],Ua(o));return i},t.prototype.getDedupedMetricsNames=function(){for(var e=this.metricsNames,t=[],n=0;n<e.length;++n){var r=e[n],a=r;ea(e,r)>1&&(a+="_"+ea(e.slice(0,n),r)),t.push(a)}return t},t.prototype.makeTestFunction=function(){var e=this;this.testFunction=function(t){return vr.f(function(){for(var n,r=[],a=t.slice(0,e.inputs.length),o=t.slice(e.inputs.length,e.inputs.length+e.outputs.length),i=[],s=0;s<e.inputs.length;++s)i.push({key:e.inputs[s],value:a[s]});var u=new ki(i),c=Oi(e.outputs,u);for(s=0;s<e.lossFunctions.length;++s){var l=e.lossFunctions[s],p=f.ab(l(o[s],c[s]));n=0===s?p:f.d(n,p),r.push(n)}for(s=0;s<e.metricsTensors.length;++s){var h=e.metricsTensors[s][0],d=e.metricsTensors[s][1],m=f.ab(h(o[d],c[d]));r.push(m)}return r})}},t.prototype.fit=function(e,t,n){return void 0===n&&(n={}),Ai(this,void 0,void 0,function(){var r,a,o,i,s,u,c,l,p,h,d,m,g,y,v,b,w,x,k,O=this;return Ci(this,function(S){switch(S.label){case 0:if(r=null==n.batchSize?32:n.batchSize,a=this.standardizeUserData(e,t,!1,r),o=a[0],i=a[1],s=!1,p=!1,null!=n.validationData&&n.validationData.length>0){if(s=!0,2!==n.validationData.length)throw 3===n.validationData.length?new Jr("validationData including sample weights is not supported yet."):new Xr("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+n.validationData+" is invalid.");u=n.validationData[0],c=n.validationData[1],h=this.standardizeUserData(u,c,!0,r),u=h[0],c=h[1],l=u.concat(c)}else null!=n.validationSplit&&n.validationSplit>0&&n.validationSplit<1?(s=!0,d=Math.floor(o[0].shape[0]*(1-n.validationSplit)),m=o[0].shape[0],u=ji(o,d,m),o=ji(o,0,d),c=ji(i,d,m),i=ji(i,0,d),p=!0,l=u.concat(c)):null!=n.validationSteps&&(s=!0);return g=o.concat(i),this.checkTrainableWeightsConsistency(),y=function(e){var t=[],n=[],r=e.slice(0,O.inputs.length),a=e.slice(O.inputs.length,O.inputs.length+O.outputs.length),o=[],i=O.collectedTrainableWeights.map(function(e){return e.read()});return[O.optimizer.minimize(function(){for(var e=[],i=0;i<O.inputs.length;++i)e.push({key:O.inputs[i],value:r[i]});var s,u=new ki(e),c=Oi(O.outputs,u,{training:!0});for(i=0;i<O.lossFunctions.length;++i){var l=(0,O.lossFunctions[i])(a[i],c[i]);t.push(l);var p=f.ab(l);n.push(p),s=0===i?l:f.d(s,l)}for(i=0;i<O.metricsTensors.length;++i){var h=O.metricsTensors[i][0],d=O.metricsTensors[i][1],m=f.ab(h(a[d],c[d]));vr.e(m),o.push(m)}return s=f.ab(s),O.calculateLosses().forEach(function(e){s=f.d(s,e)}),s},!0,i)].concat(o)},v=this.getDedupedMetricsNames(),s?(this.makeTestFunction(),b=this.testFunction,w=v.slice().concat(v.map(function(e){return"val_"+e}))):(b=null,l=[],w=v.slice()),x=function(e){return null==e?null:e instanceof Vo?[e]:Array.isArray(e)&&e[0]instanceof Vo?e:na(e).map(function(e){return new Ho(e)})}(n.callbacks),[4,this.fitLoop(y,g,v,r,n.epochs,n.verbose,x,b,l,n.shuffle,w,null,null,null)];case 1:return k=S.sent(),p&&(l.forEach(function(e){return e.dispose()}),o.forEach(function(e){return e.dispose()}),i.forEach(function(e){return e.dispose()})),[2,k]}})})},t.prototype.getNamedWeights=function(e){for(var t={},n=null!=e&&e.trainableOnly,r=n?this.trainableWeights:this.weights,a=this.getWeights(n),o=0;o<r.length;++o)n&&!r[o].trainable||(t[r[o].originalName]=a[o]);return t},t.prototype.save=function(e,t){return Ai(this,void 0,void 0,function(){var n,r,a,i,s;return Ci(this,function(u){switch(u.label){case 0:if("string"==typeof e){if(0===(n=o.getSaveHandlers(e)).length)throw new Xr("Cannot find any save handlers for URL '"+e+"'");if(n.length>1)throw new Xr("Found more than one ("+n.length+") save handlers for URL '"+e+"'");e=n[0]}if(null==e.save)throw new Xr("Model.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[4,o.encodeWeights(this.getNamedWeights(t))];case 1:return r=u.sent(),a=!1,i=null,s=this.toJSON(i,a),[2,e.save({modelTopology:s,weightData:r.data,weightSpecs:r.specs})]}})})},t.className="Model",Ti([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[0]})],t.prototype,"compile",null),Ti([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[2]})],t.prototype,"evaluate",null),Ti([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[1]})],t.prototype,"predict",null),Ti([Object(qt.a)({heading:"Models",subheading:"Classes"})],t.prototype,"predictOnBatch",null),Ti([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[2]})],t.prototype,"fit",null),Ti([Object(qt.a)({heading:"Models",subheading:"Classes"})],t)}(Do);i.SerializationMap.register(zi);var Fi=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bi=["fanIn","fanOut","fanAvg"],Vi=["normal","uniform"],Ui=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Fi(t,e),t.prototype.fromConfigUsesCustomObjects=function(){return!1},t.prototype.getConfig=function(){return{}},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}([Object(qt.a)({heading:"Initializers",subheading:"Classes",namespace:"initializers"})],t)}(i.Serializable),Wi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Fi(t,e),t.prototype.apply=function(e,t){return Object(f.Hc)(e,t)},t.className="Zeros",t}(Ui);i.SerializationMap.register(Wi);var Gi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Fi(t,e),t.prototype.apply=function(e,t){return Object(f.rb)(e,t)},t.className="Ones",t}(Ui);i.SerializationMap.register(Gi);var qi=function(e){function t(t){var n=e.call(this)||this;return n.value=t.value,n}return Fi(t,e),t.prototype.apply=function(e,t){var n=this;return Object(vr.f)(function(){return no(Object(f.Sb)(n.value),Object(f.rb)(e,t))})},t.prototype.getConfig=function(){return{value:this.value}},t.className="Constant",t}(Ui);i.SerializationMap.register(qi);var Hi=function(e){function t(t){var n=e.call(this)||this;return n.DEFAULT_MINVAL=-.05,n.DEFAULT_MAXVAL=.05,n.minval=t.minval||n.DEFAULT_MINVAL,n.maxval=t.maxval||n.DEFAULT_MAXVAL,n.seed=t.seed,n}return Fi(t,e),t.prototype.apply=function(e,t){return Object(f.Gb)(e,this.minval,this.maxval,t)},t.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},t.className="RandomUniform",t}(Ui);i.SerializationMap.register(Hi);var Ki=function(e){function t(t){var n=e.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=t.mean||n.DEFAULT_MEAN,n.stddev=t.stddev||n.DEFAULT_STDDEV,n.seed=t.seed,n}return Fi(t,e),t.prototype.apply=function(e,t){if("bool"===t)throw new Jr("randomNormal does not support dType bool.");return ao(e,this.mean,this.stddev,t,this.seed)},t.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},t.className="RandomNormal",t}(Ui);i.SerializationMap.register(Ki);var Xi=function(e){function t(t){var n=e.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=t.mean||n.DEFAULT_MEAN,n.stddev=t.stddev||n.DEFAULT_STDDEV,n.seed=t.seed,n}return Fi(t,e),t.prototype.apply=function(e,t){if("bool"===t)throw new Jr("truncatedNormal does not support dType bool.");return Object(f.Cc)(e,this.mean,this.stddev,t,this.seed)},t.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},t.className="TruncatedNormal",t}(Ui);i.SerializationMap.register(Xi);var Ji=function(e){function t(t){var n=e.call(this)||this;return n.gain=null!=t.gain?Object(f.Sb)(t.gain):Ua(1),n}return Fi(t,e),t.prototype.apply=function(e,t){var n=this;return Object(vr.f)(function(){if(2!==e.length||e[0]!==e[1])throw new Xr("Identity matrix initializer can only be used for 2D square matrices.");return no(n.gain,Object(f.T)(e[0]))})},t.prototype.getConfig=function(){return{gain:this.gain.get()}},t.className="Identity",t}(Ui);i.SerializationMap.register(Ji);var Yi=function(e){function t(t){var n,r=e.call(this)||this;if(t.scale<0)throw new Xr("scale must be a positive float. Got: "+t.scale);return r.scale=null==t.scale?1:t.scale,r.mode=t.mode,n=r.mode,ma(Bi,"FanMode",n),r.distribution=t.distribution,function(e){ma(Vi,"Distribution",e)}(r.distribution),r.seed=t.seed,r}return Fi(t,e),t.prototype.apply=function(e,t){var n=function(e,t){var n,r;if(void 0===t&&(t="channelsLast"),va(t),2===e.length)n=e[0],r=e[1];else if(-1!==[3,4,5].indexOf(e.length))if("channelsFirst"===t){var a=Ta(e,2);n=e[1]*a,r=e[0]*a}else"channelsLast"===t&&(a=Ta(e,0,e.length-2),n=e[e.length-2]*a,r=e[e.length-1]*a);else{var o=Ta(e);n=Math.sqrt(o),r=Math.sqrt(o)}return[n,r]}(e),r=n[0],a=n[1],o=this.scale;if("fanIn"===this.mode?o/=Math.max(1,r):"fanOut"===this.mode?o/=Math.max(1,a):o/=Math.max(1,(r+a)/2),"normal"===this.distribution){var i=Math.sqrt(o);if("bool"===t)throw new Jr(this.getClassName()+" does not support dType bool.");return Object(f.Cc)(e,0,i,t,this.seed)}var s=Math.sqrt(3*o);return Object(f.Gb)(e,-s,s,t)},t.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},t.className="VarianceScaling",t}(Ui);i.SerializationMap.register(Yi);var Qi=function(e){function t(t){return e.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:null==t?null:t.seed})||this}return Fi(t,e),t.prototype.getClassName=function(){return Yi.className},t}(Yi),Zi=function(e){function t(t){return e.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:null==t?null:t.seed})||this}return Fi(t,e),t.prototype.getClassName=function(){return Yi.className},t}(Yi),$i=function(e){function t(t){return e.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}return Fi(t,e),t.prototype.getClassName=function(){return Yi.className},t}(Yi),es=function(e){function t(t){return e.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}return Fi(t,e),t.prototype.getClassName=function(){return Yi.className},t}(Yi),ts=function(e){function t(t){var n=e.call(this)||this;if(n.DEFAULT_GAIN=1,n.gain=null==t.gain?n.DEFAULT_GAIN:t.gain,n.seed=t.seed,null!=n.seed)throw new Jr("Random seed is not implemented for Orthogonal Initializer yet.");return n}return Fi(t,e),t.prototype.apply=function(e,t){var n=this;return Object(vr.f)(function(){if(2!==e.length)throw new Jr("The Orthogonal Initializer does not support non-2D shapes yet.");e[0]*e[1]>2e3&&console.warn("Orthogonal initializer is being called on a matrix with more than 2000 ("+e[0]*e[1]+") elements: Slowness may result.");var t=ao(e[0]>e[1]?[e[1],e[0]]:e,0,1,"float32"),r=f.Ia.gramSchmidt(t);return e[0]>e[1]&&(r=r.transpose()),no(Ua(n.gain),r)})},t.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},t.className="Orthogonal",t}(Ui);i.SerializationMap.register(ts);var ns={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",identity:"Identity",leCunNormal:"LeCunNormal",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function rs(e,t){return void 0===t&&(t={}),ca(e,i.SerializationMap.getMap().classNameMap,t,"initializer")}function as(e){return ua(e)}function os(e){if("string"==typeof e){var t=e in ns?ns[e]:e;return"GlorotUniform"===t?new Qi:"GlorotNormal"===t?new Zi:"HeNormal"===t?new $i:"LeCunNormal"===t?new es:rs({className:t,config:{}})}return e instanceof Ui?e:rs(e)}var is=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ss=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.getConfig=function(){return{}},t}(i.Serializable),us=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e,t){return void 0===t&&(t=1),function(e,t){if(void 0===t&&(t=1),1!==t)throw new Jr("Support for alpha values other than 1 ("+t+") is not implemented yet.");return f.M(e)}(e,t)},t.className="elu",t}(ss);i.SerializationMap.register(us);var cs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return f.Tb(e)},t.className="selu",t}(ss);i.SerializationMap.register(cs);var ls=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return f.Jb(e)},t.className="relu",t}(ss);i.SerializationMap.register(ls);var fs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return Object(vr.f)(function(){return f.cb(Ua(6),f.Jb(e))})},t.className="relu6",t}(ss);i.SerializationMap.register(fs);var ps=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return e},t.className="linear",t}(ss);i.SerializationMap.register(ps);var hs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return f.Vb(e)},t.className="sigmoid",t}(ss);i.SerializationMap.register(hs);var ds=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return function(e){return Object(vr.f)(function(){var t=ro(Ua(.5),no(Ua(.2),e));return f.v(t,0,1)})}(e)},t.className="hardSigmoid",t}(ss);i.SerializationMap.register(ds);var ms=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return f.fc(e)},t.className="softplus",t}(ss);i.SerializationMap.register(ms);var gs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return function(e){return Object(vr.f)(function(){return f.J(e,f.d(Ua(1),f.a(e)))})}(e)},t.className="softsign",t}(ss);i.SerializationMap.register(gs);var ys=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e){return f.tc(e)},t.className="tanh",t}(ss);i.SerializationMap.register(ys);var vs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return is(t,e),t.prototype.apply=function(e,t){return void 0===t&&(t=-1),f.ec(e,t)},t.className="softmax",t}(ss);function bs(e){return e.getClassName()}function ws(e,t){return void 0===t&&(t={}),ca(e,i.SerializationMap.getMap().classNameMap,t,"activation")}function xs(e){return null==e?ws({className:"linear",config:{}}):"string"==typeof e?ws({className:e,config:{}}):e instanceof ss?e:ws(e)}i.SerializationMap.register(vs);var ks=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Os=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.DEFAULT_ALPHA=.3,null==t&&(t={}),n.alpha=null==t.alpha?n.DEFAULT_ALPHA:t.alpha,n}return ks(t,e),t.prototype.call=function(e,t){var n=la(e);return Object(f.Da)(n,this.alpha)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={alpha:this.alpha},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="LeakyReLU",t}(Ro);i.SerializationMap.register(Os);var Ss=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;if(n.DEFAULT_ALPHA=1,null==t&&(t={}),null!=t.alpha&&t.alpha!==n.DEFAULT_ALPHA)throw new Jr("Non-default alpha value ("+t.alpha+") is not supported by the ELU layer yet.");return n.alpha=null==t.alpha?n.DEFAULT_ALPHA:t.alpha,n}return ks(t,e),t.prototype.call=function(e,t){var n=la(e);return Object(f.M)(n)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={alpha:this.alpha},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ELU",t}(Ro);i.SerializationMap.register(Ss);var Ns=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.DEFAULT_THETA=1,null==t&&(t={}),n.theta=null==t.theta?n.DEFAULT_THETA:t.theta,n.thetaTensor=Ua(n.theta),n}return ks(t,e),t.prototype.call=function(e,t){var n=la(e);return n.mul(Ka(n.greater(this.thetaTensor),"float32"))},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={theta:this.theta},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ThresholdedReLU",t}(Ro);i.SerializationMap.register(Ns);var Es=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.DEFAULT_AXIS=1,null==t&&(t={}),n.softmax=(new vs).apply,n.axis=null==t.axis?n.DEFAULT_AXIS:t.axis,n}return ks(t,e),t.prototype.call=function(e,t){var n=la(e);return this.softmax(n,this.axis)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={axis:this.axis},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Softmax",t}(Ro);i.SerializationMap.register(Es);var Is=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ts=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Is(t,e),t}(i.Serializable),As=function(e){function t(t){var n=e.call(this)||this,r=null==t||null==t.l1?.01:t.l1,a=null==t||null==t.l2?.01:t.l2;return n.hasL1=0!==r,n.hasL2=0!==a,n.l1=Ua(r),n.l2=Ua(a),n}return Is(t,e),t.prototype.apply=function(e){var t=this;return Object(vr.f)(function(){var n=Object(f.Hc)([1]);return t.hasL1&&(n=Object(f.d)(n,Object(f.rc)(no(t.l1,Object(f.a)(e))))),t.hasL2&&(n=Object(f.d)(n,Object(f.rc)(no(t.l2,so(e))))),n.asScalar()})},t.prototype.getConfig=function(){return{l1:this.l1.dataSync()[0],l2:this.l2.dataSync()[0]}},t.fromConfig=function(e,t){return new e({l1:t.l1,l2:t.l2})},t.className="L1L2",function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}([Object(qt.a)({heading:"Regularizers",namespace:"regularizers"})],t)}(Ts);i.SerializationMap.register(As);var Cs={l1l2:"L1L2"};function Ps(e){return ua(e)}function _s(e,t){return void 0===t&&(t={}),ca(e,i.SerializationMap.getMap().classNameMap,t,"regularizer")}function Rs(e){return null==e?null:"string"==typeof e?_s({className:e in Cs?Cs[e]:e,config:{}}):e instanceof Ts?e:_s(e)}function Ms(e,t,n){if("number"==typeof e)return Zr(e,t);if(e.length!==t)throw new Xr("The "+n+" argument must be a tuple of "+t+" integers. Received: "+e.length+" elements.");for(var r=0;r<t;++r){var a=e[r];if((o=a)!==parseInt(o.toString(),10))throw new Xr("The "+n+" argument must be a tuple of "+t+" integers. Received: "+JSON.stringify(e)+" including a non-integer number "+a)}return e;var o}function js(e,t,n,r,a){return void 0===a&&(a=1),null==e?e:(o="same"===n?e:e-(t+(t-1)*(a-1))+1,Math.floor((o+r-1)/r));var o}function Ds(e,t,n,r){if(null==e)return null;if("valid"===r)e=e*t+Pa([n-t,0]);else{if("same"!==r)throw new Xr("Unsupport padding mode: "+r+".");e*=t}return e}var Ls=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function zs(e,t){return Object(vr.f)(function(){return va(t),"channelsFirst"===t?f.Bc(e,[0,2,3,1]):e})}var Fs=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.kernel=null,r.bias=null,r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_BIAS_INITIALIZER="zeros",r.rank=t,1!==r.rank&&2!==r.rank)throw new Jr("Convolution layer for rank other than 1 or 2 ("+r.rank+") is not implemented yet.");if(r.filters=n.filters,r.kernelSize=Ms(n.kernelSize,t,"kernelSize"),r.strides=Ms(null==n.strides?1:n.strides,t,"strides"),r.padding=null==n.padding?"valid":n.padding,wa(r.padding),r.dataFormat=null==n.dataFormat?"channelsLast":n.dataFormat,va(r.dataFormat),r.dilationRate=null==n.dilationRate?1:n.dilationRate,1===r.rank&&Array.isArray(r.dilationRate)&&1!==r.dilationRate.length)throw new Xr("dilationRate must be a number or an array of a single number for 1D convolution, but received "+JSON.stringify(r.dilationRate));if(2===r.rank)if("number"==typeof r.dilationRate)r.dilationRate=[r.dilationRate,r.dilationRate];else if(2!==r.dilationRate.length)throw new Xr("dilationRate must be a number or array of two numbers for 2D convolution, but received "+JSON.stringify(r.dilationRate));return r.activation=xs(n.activation),r.useBias=null==n.useBias||n.useBias,r.kernelInitializer=os(n.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.biasInitializer=os(n.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.kernelConstraint=Oo(n.kernelConstraint),r.biasConstraint=Oo(n.biasConstraint),r.kernelRegularizer=Rs(n.kernelRegularizer),r.biasRegularizer=Rs(n.biasRegularizer),r.activityRegularizer=Rs(n.activityRegularizer),r}return Ls(t,e),t.prototype.build=function(e){e=fa(e);var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new Xr("The channel dimension of the input should be defined. Found "+e[t]);var n,r=e[t],a=this.kernelSize.concat([r,this.filters]);this.kernel=this.addWeight("kernel",a,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:(n={},n[t]=r,n)}],this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var t;e=la(e);var r=null==n.bias?null:n.bias.read();if(1===n.rank)t=function(e,t,n,r,a,o,i){return void 0===r&&(r=1),void 0===a&&(a="valid"),void 0===i&&(i=1),Object(vr.f)(function(){if(null==o&&(o="channelsLast"),va(o),3!==e.shape.length)throw new Xr("The input of a conv1dWithBias operation should be 3, but is "+e.shape.length+" instead.");if(3!==t.shape.length)throw new Xr("The kernel for a conv1dWithBias operation should be 3, but is "+t.shape.length+" instead");if(null!=n&&1!==n.shape.length)throw new Xr("The bias for a conv1dWithBias operation should be 1, but is "+t.shape.length+" instead");if("channelsFirst"===o&&(e=f.Bc(e,[0,2,1])),"causal"===a)throw new Jr("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");var s=f.C(e,t,r,"same"===a?"same":"valid","NWC",i);return null!=n&&(s=uo(s,n)),s})}(e,n.kernel.read(),r,n.strides[0],n.padding,n.dataFormat,n.dilationRate);else if(2===n.rank)t=function(e,t,n,r,a,o,i){return void 0===r&&(r=[1,1]),void 0===a&&(a="valid"),Object(vr.f)(function(){if(null==o&&(o="channelsLast"),va(o),3!==e.rank&&4!==e.rank)throw new Xr("conv2dWithBias expects input to be of rank 3 or 4, but received "+e.rank+".");if(3!==t.rank&&4!==t.rank)throw new Xr("conv2dWithBias expects kernel to be of rank 3 or 4, but received "+e.rank+".");var s=zs(e,o);if("causal"===a)throw new Jr("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return s=f.D(s,t,r,"same"===a?"same":"valid","NHWC",i),null!=n&&(s=uo(s,n)),"channelsFirst"===o&&(s=f.Bc(s,[0,3,1,2])),s})}(e,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate);else if(3===n.rank)throw new Jr("3D convolution is not implemented yet.");return null!=n.activation&&(t=n.activation.apply(t)),t})},t.prototype.computeOutputShape=function(e){e=fa(e);for(var t=[],n="channelsLast"===this.dataFormat?e.slice(1,e.length-1):e.slice(2),r=0;r<n.length;++r){var a=js(n[r],this.kernelSize[r],this.padding,this.strides[r],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[r]);t.push(a)}var o=[e[0]];return"channelsLast"===this.dataFormat?(o=o.concat(t)).push(this.filters):(o.push(this.filters),o=o.concat(t)),o},t.prototype.getConfig=function(){var t={rank:this.rank,filters:this.filters,kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),biasInitializer:as(this.biasInitializer),kernelRegularizer:Ps(this.kernelRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),biasConstraint:xo(this.biasConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(Ro),Bs=function(e){function t(t){return e.call(this,2,t)||this}return Ls(t,e),t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,t},t.className="Conv2D",t}(Fs);i.SerializationMap.register(Bs);var Vs=function(e){function t(t){var n=e.call(this,t)||this;if(n.inputSpec=[new Ao({ndim:4})],"same"!==n.padding&&"valid"!==n.padding)throw new Xr("Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode "+n.padding);return n}return Ls(t,e),t.prototype.build=function(e){if(4!==(e=fa(e)).length)throw new Xr("Input should have rank 4; Received input shape: "+JSON.stringify(e));var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new Xr("The channel dimension of the inputs should be defined. Found `None`.");var n,r=e[t],a=this.kernelSize.concat([this.filters,r]);this.kernel=this.addWeight("kernel",a,"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 Ao({ndim:4,axes:(n={},n[t]=r,n)})],this.built=!0},t.prototype.call=function(e,t){var n=this;return vr.f(function(){var t=la(e);if(4!==t.shape.length)throw new Xr("Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-"+t.shape.length);var r,a,o=t.shape,i=o[0];"channelsFirst"===n.dataFormat?(r=2,a=3):(r=1,a=2);var s=o[r],u=o[a],c=n.kernelSize[0],l=n.kernelSize[1],p=n.strides[0],h=n.strides[1],d=[i,Ds(s,p,c,n.padding),Ds(u,h,l,n.padding),n.filters];"channelsLast"!==n.dataFormat&&(t=f.Bc(t,[0,2,3,1]));var m=f.E(t,n.kernel.read(),d,n.strides,n.padding);return"channelsLast"!==n.dataFormat&&(m=f.Bc(m,[0,3,1,2])),null!=n.bias&&(m=uo(m,n.bias.read(),n.dataFormat)),null!=n.activation&&(m=n.activation.apply(m)),m})},t.prototype.computeOutputShape=function(e){var t,n,r,a=(e=fa(e)).slice();"channelsFirst"===this.dataFormat?(t=1,n=2,r=3):(t=3,n=1,r=2);var o=this.kernelSize[0],i=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return a[t]=this.filters,a[n]=Ds(a[n],s,o,this.padding),a[r]=Ds(a[r],u,i,this.padding),a},t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.dilationRate,t},t.className="Conv2DTranspose",t}(Bs);i.SerializationMap.register(Vs);var Us=function(e){function t(t){return e.call(this,2,t)||this}return Ls(t,e),t.className="SeparableConv2D",t}(function(e){function t(t,n){var r=e.call(this,t,n)||this;if(r.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",r.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",r.depthwiseKernel=null,r.pointwiseKernel=null,null==n.filters)throw new Xr("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=n.kernelInitializer||null!=n.kernelRegularizer||null!=n.kernelConstraint)throw new Xr("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 Xr("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=os(n.depthwiseInitializer||r.DEFAULT_DEPTHWISE_INITIALIZER),r.depthwiseRegularizer=Rs(n.depthwiseRegularizer),r.depthwiseConstraint=Oo(n.depthwiseConstraint),r.pointwiseInitializer=os(n.depthwiseInitializer||r.DEFAULT_POINTWISE_INITIALIZER),r.pointwiseRegularizer=Rs(n.pointwiseRegularizer),r.pointwiseConstraint=Oo(n.pointwiseConstraint),r}return Ls(t,e),t.prototype.build=function(e){if((e=fa(e)).length<this.rank+2)throw new Xr("Inputs to SeparableConv"+this.rank+"D should have rank "+(this.rank+2)+", but received input shape: "+JSON.stringify(e));var t,n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n]||e[n]<0)throw new Xr("The channel dimension of the inputs should be defined, but found "+JSON.stringify(e[n]));for(var r=e[n],a=this.kernelSize.concat([r,this.depthMultiplier]),o=[],i=0;i<this.rank;++i)o.push(1);o.push(r*this.depthMultiplier,this.filters),this.depthwiseKernel=this.addWeight("depthwise_kernel",a,"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 Ao({ndim:this.rank+2,axes:(t={},t[n]=r,t)})],this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var t;if(e=la(e),1===n.rank)throw new Jr("1D separable convolution is not implemented yet.");return 2===n.rank&&("channelsFirst"===n.dataFormat&&(e=f.Bc(e,[0,2,3,1])),t=f.Ub(e,n.depthwiseKernel.read(),n.pointwiseKernel.read(),n.strides,n.padding,n.dilationRate,"NHWC")),n.useBias&&(t=uo(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),"channelsFirst"===n.dataFormat&&(t=f.Bc(t,[0,3,1,2])),t})},t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,delete t.kernelInitializer,delete t.kernelRegularizer,delete t.kernelConstraint,t.depthwiseInitializer=as(this.depthwiseInitializer),t.pointwiseInitializer=as(this.pointwiseInitializer),t.depthwiseRegularizer=Ps(this.depthwiseRegularizer),t.pointwiseRegularizer=Ps(this.pointwiseRegularizer),t.depthwiseConstraint=xo(this.depthwiseConstraint),t.pointwiseConstraint=xo(this.pointwiseConstraint),t},t.className="SeparableConv",t}(Fs));i.SerializationMap.register(Us);var Ws=function(e){function t(t){var n=e.call(this,1,t)||this;return n.inputSpec=[{ndim:3}],n}return Ls(t,e),t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,delete t.dataFormat,t},t.className="Conv1D",t}(Fs);i.SerializationMap.register(Ws);var Gs=function(e){function t(t){var n=e.call(this,t)||this;return"number"==typeof t.cropping?n.cropping=[[t.cropping,t.cropping],[t.cropping,t.cropping]]:"number"==typeof t.cropping[0]?n.cropping=[[t.cropping[0],t.cropping[0]],[t.cropping[1],t.cropping[1]]]:n.cropping=t.cropping,n.dataFormat=void 0===t.dataFormat?"channelsLast":t.dataFormat,n.inputSpec=[{ndim:4}],n}return Ls(t,e),t.prototype.computeOutputShape=function(e){return"channelsFirst"===this.dataFormat?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){return e=la(e),"channelsLast"===n.dataFormat?Qa(Qa(e,n.cropping[0][0],e.shape[1]-n.cropping[0][0]-n.cropping[0][1],2),n.cropping[1][0],e.shape[2]-n.cropping[1][1]-n.cropping[1][0],3):Qa(Qa(e,n.cropping[0][0],e.shape[2]-n.cropping[0][0]-n.cropping[0][1],3),n.cropping[1][0],e.shape[3]-n.cropping[1][1]-n.cropping[1][0],4)})},t.prototype.getConfig=function(){var t={cropping:this.cropping,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Cropping2D",t}(Ro);i.SerializationMap.register(Gs);var qs=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_SIZE=[2,2],n.inputSpec=[{ndim:4}],n.size=void 0===t.size?n.DEFAULT_SIZE:t.size,n.dataFormat=void 0===t.dataFormat?"channelsLast":t.dataFormat,n}return Ls(t,e),t.prototype.computeOutputShape=function(e){if("channelsFirst"===this.dataFormat){var t=this.size[0]*e[2],n=this.size[1]*e[3];return[e[0],e[1],t,n]}return t=this.size[0]*e[1],n=this.size[1]*e[2],[e[0],t,n,e[3]]},t.prototype.call=function(e,t){var n=this;return vr.f(function(){var t=la(e),r=t.shape;if("channelsFirst"===n.dataFormat){t=f.Bc(t,[0,2,3,1]);var a=n.size[0]*r[2],o=n.size[1]*r[3],i=t.resizeNearestNeighbor([a,o]);return f.Bc(i,[0,3,1,2])}return a=n.size[0]*r[1],o=n.size[1]*r[2],t.resizeNearestNeighbor([a,o])})},t.prototype.getConfig=function(){var t={size:this.size,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="UpSampling2D",t}(Ro);i.SerializationMap.register(qs);var Hs=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ks=function(e){function t(t){var n=e.call(this,t)||this;return n.depthwiseKernel=null,n.depthMultiplier=null==t.depthMultiplier?1:t.depthMultiplier,n.depthwiseInitializer=os(t.depthwiseInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.depthwiseConstraint=Oo(t.depthwiseConstraint),n.depthwiseRegularizer=Rs(t.depthwiseRegularizer),n}return Hs(t,e),t.prototype.build=function(e){if((e=fa(e)).length<4)throw new Xr("Inputs to DepthwiseConv2D should have rank 4. Received input shape: "+JSON.stringify(e)+".");var t="channelsFirst"===this.dataFormat?1:3;if(null==e[t]||e[t]<0)throw new Xr("The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not ("+e[t]+").");var n=e[t],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},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){e=la(e);var t,r,a,o,i,s=(t=e,r=n.depthwiseKernel.read(),a=n.strides,o=n.padding,i=n.dataFormat,null,void 0===a&&(a=[1,1]),void 0===o&&(o="valid"),Object(vr.f)(function(){null==i&&(i="channelsLast"),va(i);var e=zs(t,i);if(4!==t.rank)throw new Xr("Input for depthwiseConv2d is required to be 4-D, but is instead "+t.rank+"-D");if(4!==r.rank)throw new Xr("depthwiseKernel is required to be 4-D, but is instead "+r.rank+"-D");return e=f.I(e,r,a,"same"===o?"same":"valid","NHWC",null),"channelsFirst"===i&&(e=f.Bc(e,[0,3,1,2])),e}));return n.useBias&&(s=uo(s,n.bias.read(),n.dataFormat)),null!=n.activation&&(s=n.activation.apply(s)),s})},t.prototype.computeOutputShape=function(e){e=fa(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,a=js(t,this.kernelSize[0],this.padding,this.strides[0]),o=js(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[e[0],r,a,o]:[e[0],a,o,r]},t.className="DepthwiseConv2D",t}(Bs);i.SerializationMap.register(Ks);var Xs=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Js=function(e){function t(t){var n=e.call(this,t)||this;if(n.rate=Math.max(Math.min(t.rate,1),0),n.rateScalar=Ua(n.rate),n.noiseShape=t.noiseShape,n.seed=t.seed,null!=n.seed)throw new Jr("Non-default seed is not implemented in Dropout layer yet: "+n.seed);return n.supportsMasking=!0,n}return Xs(t,e),t.prototype.getNoiseShape=function(e){if(null==this.noiseShape)return this.noiseShape;for(var t=e.shape,n=[],r=0;r<this.noiseShape.length;++r)n.push(null==this.noiseShape[r]?t[r]:this.noiseShape[r]);return n},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){n.invokeCallHook(e,t);var r=la(e);if(null!=n.noiseShape&&!y.arraysEqual(r.shape,n.noiseShape))throw new Jr("Non-default noise shape is not implemented in Dropout layer yet: "+JSON.stringify(n.noiseShape));if(0<n.rate&&n.rate<1){var a=null!=t.training&&t.training,o=n.getNoiseShape(r);return function(e,t,n){return void 0===n&&(n=!1),n?e():r}(function(){return e=r,t=n.rateScalar,a=o,i=n.seed,Object(vr.f)(function(){if(null!=a&&!y.arraysEqual(e.shape,a))throw new Jr("Non-default noise shape is not implemented yet: "+JSON.stringify(a));if(null!=i)throw new Jr("seed is not implemented for dropout yet.");var n=f.nc(f.d(f.mb(t),f.Gb(e.shape,0,1,"float32")));return n=f.ib(f.J(Ua(1),f.pc(Ua(1),t)),n),f.ib(e,n)});var e,t,a,i},0,a)}return e})},t.prototype.getConfig=function(){var t={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Dropout",t}(Ro);i.SerializationMap.register(Js);var Ys=function(e){function t(t){var n=e.call(this,t)||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==t.batchInputShape&&null==t.inputShape&&null!=t.inputDim){var r=null;null!=t.batchSize&&(r=t.batchSize),n.batchInputShape=[r,t.inputDim]}return n.units=t.units,n.activation=xs(t.activation),null!=t.useBias&&(n.useBias=t.useBias),n.kernelInitializer=os(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.biasInitializer=os(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelConstraint=Oo(t.kernelConstraint),n.biasConstraint=Oo(t.biasConstraint),n.kernelRegularizer=Rs(t.kernelRegularizer),n.biasRegularizer=Rs(t.biasRegularizer),n.activityRegularizer=Rs(t.activityRegularizer),n.inputSpec=[{minNDim:2}],n}return Xs(t,e),t.prototype.build=function(e){var t,n=(e=fa(e))[e.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:(t={},t[-1]=n,t)}],this.built=!0},t.prototype.computeOutputShape=function(e){var t=(e=fa(e)).slice();return t[t.length-1]=this.units,t},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){n.invokeCallHook(e,t);var r=oo(la(e),n.kernel.read());return null!=n.bias&&(r=uo(r,n.bias.read())),null!=n.activation&&(r=n.activation.apply(r)),r})},t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),biasInitializer:as(this.biasInitializer),kernelRegularizer:Ps(this.kernelRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),biasConstraint:xo(this.biasConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Dense",t}(Ro);i.SerializationMap.register(Ys);var Qs=function(e){function t(t){var n=e.call(this,t||{})||this;return n.inputSpec=[{minNDim:3}],n}return Xs(t,e),t.prototype.computeOutputShape=function(e){for(var t=0,n=(e=fa(e)).slice(1);t<n.length;t++)if(null==n[t])throw new Xr('The shape of the input to "Flatten" is not fully defined (got '+e.slice(1)+'). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.');return[e[0],Ta(e,1)]},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){return n.invokeCallHook(e,t),function(e){if(e.rank<=1)throw new Xr("batchFlatten requires a minimum rank of 2. Got rank: "+e.rank+".");var t=[e.shape[0],Ta(e.shape,1)];return e.reshape(t)}(la(e))})},t.className="Flatten",t}(Ro);i.SerializationMap.register(Qs);var Zs=function(e){function t(t){var n=e.call(this,t)||this;return n.supportsMasking=!0,n.activation=xs(t.activation),n}return Xs(t,e),t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){n.invokeCallHook(e,t);var r=la(e);return n.activation.apply(r)})},t.prototype.getConfig=function(){var t={activation:bs(this.activation)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Activation",t}(Ro);i.SerializationMap.register(Zs);var $s=function(e){function t(t){var n=e.call(this,t)||this;return n.n=t.n,n.inputSpec=[{ndim:2}],n}return Xs(t,e),t.prototype.computeOutputShape=function(e){return[e[0],this.n,e[1]]},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){return e=la(e),t=e,r=n.n,Object(vr.f)(function(){if(2!==t.shape.length)throw new Xr("repeat() expects a rank-2 tensor, but received a rank-"+t.shape.length+" tensor.");return eo(Xa(t,1),[1,r,1])});var t,r})},t.prototype.getConfig=function(){var t={n:this.n},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="RepeatVector",t}(Ro);i.SerializationMap.register($s);var eu=function(e){function t(t){var n=e.call(this,t)||this;n.targetShape=t.targetShape;for(var r=0;r<n.targetShape.length;++r)n.isUnknown(n.targetShape[r])&&(n.targetShape[r]=null);return n}return Xs(t,e),t.prototype.isUnknown=function(e){return e<0||null==e},t.prototype.fixUnknownDimension=function(e,t){for(var n="Total size of new array must be unchanged.",r=t.slice(),a=1,o=null,i=0;i<r.length;++i){var s=r[i];if(this.isUnknown(s)){if(null!==o)throw new Xr("Can only specifiy one unknown dimension.");o=i}else a*=s}var u=Ta(e);if(null!==o){if(0===a||u%a!=0)throw new Xr(n);r[o]=u/a}else if(u!==a)throw new Xr(n);return r},t.prototype.computeOutputShape=function(e){for(var t=!1,n=0;n<e.length;++n)if(this.isUnknown(e[n])){t=!0;break}return t?e.slice(0,1).concat(this.targetShape):e.slice(0,1).concat(this.fixUnknownDimension(e.slice(1),this.targetShape))},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){n.invokeCallHook(e,t);var r=la(e),a=Ga(r),o=a.slice(0,1).concat(n.fixUnknownDimension(a.slice(1),n.targetShape));return r.reshape(o)})},t.prototype.getConfig=function(){var t={targetShape:this.targetShape},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Reshape",t}(Ro);i.SerializationMap.register(eu);var tu=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nu=function(e){function t(t){var n=e.call(this,t)||this;if(n.embeddings=null,n.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==t.batchInputShape&&null==t.inputShape){var r=null;null!=t.batchSize&&(r=t.batchSize),null==t.inputLength?n.batchInputShape=[r,null]:n.batchInputShape=[r].concat(na(t.inputLength))}return n.inputDim=t.inputDim,n.outputDim=t.outputDim,n.embeddingsInitializer=os(t.embeddingsInitializer||n.DEFAULT_EMBEDDINGS_INITIALIZER),n.embeddingsRegularizer=Rs(t.embeddingsRegularizer),n.activityRegularizer=Rs(t.activityRegularizer),n.embeddingsConstraint=Oo(t.embeddingsConstraint),n.maskZero=t.maskZero,n.inputLength=t.inputLength,n}return tu(t,e),t.prototype.build=function(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0},t.prototype.computeMask=function(e,t){throw new Jr("computeMask has not been implemented for Embedding yet")},t.prototype.computeOutputShape=function(e){if(e=fa(e),null==this.inputLength)return e.concat([this.outputDim]);var t=na(this.inputLength);if(t.length!==e.length-1)throw new Xr('"inputLength" is '+this.inputLength+", but received input shape has shape "+e);for(var n=0,r=0;r<t.length;++r){var a=t[r],o=e[r+1];if(null!=a&&null!=o&&a!==o)throw new Xr('"inputLength" is '+this.inputLength+", but received input shape has shape "+e);null==a&&(t[n]=o),n++}return[e[0]].concat(t,[this.outputDim])},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){n.invokeCallHook(e,t);var r=la(e);return"int32"!==Ha(r)&&(r=Ka(r,"int32")),io(n.embeddings.read(),r.as1D()).reshape(fa(n.computeOutputShape(r.shape)))})},t.prototype.getConfig=function(){var t={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:as(this.embeddingsInitializer),embeddingsRegularizer:Ps(this.embeddingsRegularizer),activityRegularizer:Ps(this.activityRegularizer),embeddingsConstraint:xo(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Embedding",t}(Ro);i.SerializationMap.register(nu);var ru=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),au=function(e){function t(t){var n=e.call(this,t||{})||this;return n.supportsMasking=!0,n}return ru(t,e),t.prototype.mergeFunction=function(e){throw new Jr},t.prototype.computeElementwiseOpOutputShape=function(e,t){if(null==e||null==t)return null;if(e.length<t.length)return this.computeElementwiseOpOutputShape(t,e);if(0===t.length)return e;for(var n=e.slice(0,e.length-t.length),r=0;r<t.length;++r){var a=e[e.length-t.length+r],o=t[r];if(null==a||null==o||a<0||o<0)n.push(null);else if(1===a)n.push(o);else if(1===o)n.push(a);else{if(a!==o)throw new Xr("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(a)}}return n},t.prototype.build=function(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[fa(e)]),(e=e).length<2)throw new Xr("A merge layer should be called on an Array of at least 2 inputs. Got "+e.length+" input(s).");for(var t=[],n=0,r=e;n<r.length;n++)null!=(i=r[n])&&null!==i[0]&&t.push(i[0]);if((t=ha(t)).length>1)throw new Xr("Can not merge tensors with different batch sizes. Got tensors with shapes: "+JSON.stringify(e)+".");for(var a=null==e[0]?null:e[0].slice(1),o=1;o<e.length;++o){var i=null==e[o]?null:e[o].slice(1);a=this.computeElementwiseOpOutputShape(a,i)}var s=e.map(function(e){return e.length});-1===e.indexOf(null)&&1===ha(s).length?this.reshapeRequired=!1:this.reshapeRequired=!0},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){if(e=e,n.reshapeRequired){var t=[],r=e.map(function(e){return e.rank});if(-1===r.indexOf(null)){for(var a=Pa(r),o=0,i=e;o<i.length;o++){for(var s=(h=i[o]).rank,u=0;u<a-s;++u)h=Xa(h,1);t.push(h)}return n.mergeFunction(t)}for(var c=!1,l=0,p=e;l<p.length;l++){var h;if(null==(s=(h=p[l]).rank)){var d=Ga(h),m=d[0],g=d.slice(1).concat([m]),y=h.reshape([m].concat(Ta(d.slice(1))));y=(y=f.Bc(y,[1,0])).reshape(g),t.push(y),c=!0}else if(s>1){var v=_a(1,s).concat([0]);t.push(f.Bc(h,v)),c=!0}else t.push(h)}var b=n.mergeFunction(t),w=b.rank;if(c)if(null==w){var x=Ga(b);g=[m=x[x.length-1]].concat(x.slice(0,x.length-1)),b=f.Bc(b.reshape([-1,m]),[1,0]).reshape(g)}else w>1&&(v=[w-1].concat(_a(0,w-1)),b=f.Bc(b,v));return b}return n.mergeFunction(e)})},t.prototype.computeOutputShape=function(e){var t;t=null==(e=e)[0]?null:e[0].slice(1);for(var n=1;n<e.length;++n){var r=null==e[n]?null:e[n].slice(1);t=this.computeElementwiseOpOutputShape(t,r)}for(var a=[],o=0,i=e;o<i.length;o++)null!=(r=i[o])&&null!==r[0]&&a.push(r[0]);return 1===(a=ha(a)).length?a.concat(t):[null].concat(t)},t}(Ro),ou=function(e){function t(t){return e.call(this,t)||this}return ru(t,e),t.prototype.mergeFunction=function(e){return Object(vr.f)(function(){for(var t=f.Hc(e[0].shape),n=0,r=e;n<r.length;n++){var a=r[n];t=f.d(t,a)}return t})},t.className="Add",t}(au);i.SerializationMap.register(ou);var iu=function(e){function t(t){return e.call(this,t)||this}return ru(t,e),t.prototype.mergeFunction=function(e){return Object(vr.f)(function(){for(var t=f.rb(e[0].shape),n=0,r=e;n<r.length;n++){var a=r[n];t=f.ib(t,a)}return t})},t.className="Multiply",t}(au);i.SerializationMap.register(iu);var su=function(e){function t(t){return e.call(this,t)||this}return ru(t,e),t.prototype.mergeFunction=function(e){return Object(vr.f)(function(){for(var t=f.Hc(e[0].shape),n=0,r=e;n<r.length;n++){var a=r[n];t=f.d(t,a)}return no(Ua(1/e.length),t)})},t.className="Average",t}(au);i.SerializationMap.register(su);var uu=function(e){function t(t){return e.call(this,t)||this}return ru(t,e),t.prototype.mergeFunction=function(e){return Object(vr.f)(function(){for(var t=e[0],n=1;n<e.length;++n)t=f.Ya(t,e[n]);return t})},t.className="Maximum",t}(au);i.SerializationMap.register(uu);var cu=function(e){function t(t){return e.call(this,t)||this}return ru(t,e),t.prototype.mergeFunction=function(e){return Object(vr.f)(function(){for(var t=e[0],n=1;n<e.length;++n)t=f.cb(t,e[n]);return t})},t.className="Minimum",t}(au);i.SerializationMap.register(cu);var lu=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_AXIS=-1,null==t&&(t={}),n.axis=null==t.axis?n.DEFAULT_AXIS:t.axis,n.supportsMasking=!0,n.reshapeRequired=!1,n}return ru(t,e),t.prototype.build=function(e){if(!Array.isArray(e)||!Array.isArray(e[0])||1===e.length)throw new Xr("A `Concatenate` layer should be called on a list of at least 2 inputs");for(var t=!0,n=0,r=e=e;n<r.length;n++)if(null!=(l=r[n])){t=!1;break}if(!t){for(var a=[],o=0;o<e.length;++o){var i=e[o].slice();i.splice(this.axis,1);for(var s=!1,u=0,c=a;u<c.length;u++){var l=c[u];if(y.arraysEqual(l,i)){s=!0;break}}s||a.push(i)}if(a.length>1)throw new Xr("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}},t.prototype.mergeFunction=function(e){var t=this;return Object(vr.f)(function(){return Za(e,t.axis)})},t.prototype.computeOutputShape=function(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new Xr("A `Concatenate` layer should be called on a list of inputs.");for(var t=e,n=t[0].slice(),r=this.axis<0?n.length+this.axis:this.axis,a=0,o=t.slice(1);a<o.length;a++){var i=o[a];if(null==n[r]||null==i[r]){n[r]=null;break}n[r]+=i[r]}return n},t.prototype.getConfig=function(){var t={axis:this.axis},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Concatenate",t}(au);i.SerializationMap.register(lu);var fu=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function pu(e,t,n,r,a,o){var i;if(void 0===o&&(o=.001),2===e.rank)i=f.p(e,t,n,o,a,r);else if(3===e.rank)i=f.q(e,t,n,o,a,r);else{if(4!==e.rank)throw new Jr("batchNormalization is not implememnted for array of rank "+e.rank+" yet");i=f.r(e,t,n,o,a,r)}return i}var hu=function(e){function t(t){var n=e.call(this,t)||this;return n.supportsMasking=!0,n.axis=null==t.axis?-1:t.axis,n.momentum=null==t.momentum?.99:t.momentum,n.epsilon=null==t.epsilon?.001:t.epsilon,n.center=null==t.center||t.center,n.scale=null==t.scale||t.scale,n.betaInitializer=os(t.betaInitializer||"zeros"),n.gammaInitializer=os(t.gammaInitializer||"ones"),n.movingMeanInitializer=os(t.movingMeanInitializer||"zeros"),n.movingVarianceInitializer=os(t.movingVarianceInitializer||"ones"),n.betaConstraint=Oo(t.betaConstraint),n.gammaConstraint=Oo(t.gammaConstraint),n.betaRegularizer=Rs(t.betaRegularizer),n.gammaRegularizer=Rs(t.gammaRegularizer),n.stepCount=0,n}return fu(t,e),t.prototype.build=function(e){e=fa(e);var t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new Xr("Axis "+t+" of input tensor should have a defined dimension but the layer received an input with shape "+JSON.stringify(e)+".");this.inputSpec=[new Ao({ndim:e.length,axes:(r={},r[t]=n,r)})];var r,a=[n];this.scale&&(this.gamma=this.addWeight("gamma",a,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",a,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",a,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",a,null,this.movingVarianceInitializer,null,!1),this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var r=null!=t.training&&t.training,a=la(e),o=Ga(a),i=o.length,s=_a(0,i),u=n.axis>=0?n.axis:n.axis+i;s.splice(u,1);var c=Zr(1,i);c[u]=o[u];var l=s.slice();l.sort();var p=!y.arraysEqual(l,_a(0,i).slice(0,i-1));if(!r)return function(){if(p){var e=n.movingMean.read().reshape(c),t=n.movingVariance.read().reshape(c),r=n.center?n.beta.read().reshape(c):null,o=n.scale?n.gamma.read().reshape(c):null;return pu(a,e,t,r,o,n.epsilon)}return pu(a,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(e,t,n,r,a){return void 0===a&&(a=.001),y.arraysEqual(r.slice().sort(),_a(0,e.rank-1))?function(e,t,n,r,a){return void 0===a&&(a=.001),Object(vr.f)(function(){var o=f.gb(e,r),i=o.mean,s=o.variance;return[pu(e,i,s,n,t,a),i,s]})}(e,t,n,r,a):function(e,t,n,r,a){return void 0===a&&(a=.001),Object(vr.f)(function(){for(var o=f.gb(e,r),i=o.mean,s=o.variance,u=[],c=0,l=_a(0,e.rank);c<l.length;c++){var p=l[c];-1!==r.indexOf(p)?u.push(1):u.push(e.shape[p])}var h=i.reshape(u),d=s.reshape(u),m=null==t?null:t.reshape(u),g=null==n?null:n.reshape(u);return[pu(e,h,d,g,m,a),i,s]})}(e,t,n,r,a)}(a,n.gamma.read(),n.beta.read(),s,n.epsilon),d=h[0],m=h[1],g=h[2],v=Ta(s.map(function(e){return a.shape[e]})),b=g.mul(Ua(v/(v-(1+n.epsilon))));return function(){n.stepCount++;var e=f.hb(n.movingMean.read(),m,n.momentum,n.stepCount);n.movingMean.write(e);var t=f.hb(n.movingVariance.read(),b,n.momentum,n.stepCount);n.movingVariance.write(t)}(),d})},t.prototype.getConfig=function(){var t={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:as(this.betaInitializer),gammaInitializer:as(this.gammaInitializer),movingMeanInitializer:as(this.movingMeanInitializer),movingVarianceInitializer:as(this.movingVarianceInitializer),betaRegularizer:Ps(this.betaRegularizer),gammaRegularizer:Ps(this.gammaRegularizer),betaConstraint:xo(this.betaConstraint),gammaConstraint:xo(this.gammaConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="BatchNormalization",t}(Ro);i.SerializationMap.register(hu);var du=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mu=function(e){function t(t){var n=this;if(null==t&&(t={}),(n=e.call(this,t)||this).dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,null==t.padding)n.padding=[[1,1],[1,1]];else if("number"==typeof t.padding)n.padding=[[t.padding,t.padding],[t.padding,t.padding]];else{if(t.padding=t.padding,2!==t.padding.length)throw new Xr("ZeroPadding2D expects padding to be a length-2 array, but received a length-"+t.padding.length+" array.");var r=void 0,a=void 0;if("number"==typeof t.padding[0])r=[t.padding[0],t.padding[0]],a=[t.padding[1],t.padding[1]];else{if(t.padding=t.padding,2!==t.padding[0].length)throw new Xr("ZeroPadding2D expects height padding to be a length-2 array, but received a length-"+t.padding[0].length+" array.");if(r=t.padding[0],2!==t.padding[1].length)throw new Xr("ZeroPadding2D expects width padding to be a length-2 array, but received a length-"+t.padding[1].length+" array.");a=t.padding[1]}n.padding=[r,a]}return n.inputSpec=[new Ao({ndim:4})],n}return du(t,e),t.prototype.computeOutputShape=function(e){var t,n;return e=fa(e),"channelsFirst"===this.dataFormat?(t=null!=e[2]&&e[2]>=0?e[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[3]&&e[3]>=0?e[3]+this.padding[1][0]+this.padding[1][1]:null,[e[0],e[1],t,n]):(t=null!=e[1]&&e[1]>=0?e[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[2]&&e[2]>=0?e[2]+this.padding[1][0]+this.padding[1][1]:null,[e[0],t,n,e[3]])},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){return t=la(e),r=n.padding,a=n.dataFormat,Object(vr.f)(function(){if(4!==t.rank)throw new Xr("temporalPadding expects input tensor to be 4-D, but received a "+t.rank+"-D tensor.");if(null==r&&(r=[[1,1],[1,1]]),2!==r.length||2!==r[0].length||2!==r[1].length)throw new Xr("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==a&&(a="channelsLast"),"channelsLast"!==a&&"channelsFirst"!==a)throw new Xr("Unknown data format: "+a+". Supported data formats are 'channelsLast' and 'channelsFirst.");var e;return e="channelsFirst"===a?[[0,0],[0,0],r[0],r[1]]:[[0,0],r[0],r[1],[0,0]],f.vb(t,e)});var t,r,a})},t.prototype.getConfig=function(){var t={padding:this.padding,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ZeroPadding2D",t}(Ro);i.SerializationMap.register(mu);var gu=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function yu(e,t,n,r,a,o){return Object(vr.f)(function(){var i;va(a),ma(xa,"PoolMode",o),wa(r),null==n&&(n=[1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==o&&(o="max"),e=zs(e,a);var s="same"===r?"same":"valid";return i="max"===o?f.Xa(e,t,n,s):f.m(e,t,n,s),"channelsFirst"===a&&(i=f.Bc(i,[0,3,1,2])),i})}var vu=function(e){function t(t){var n=this;if(null==t.poolSize&&(t.poolSize=2),n=e.call(this,t)||this,"number"==typeof t.poolSize)n.poolSize=[t.poolSize];else{if(!Array.isArray(t.poolSize)||1!==t.poolSize.length||"number"!=typeof t.poolSize[0])throw new Xr("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.poolSize));n.poolSize=t.poolSize}if(null==t.strides)n.strides=n.poolSize;else if("number"==typeof t.strides)n.strides=[t.strides];else{if(!Array.isArray(t.strides)||1!==t.strides.length||"number"!=typeof t.strides[0])throw new Xr("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.strides));n.strides=t.strides}return n.padding=null==t.padding?"valid":t.padding,wa(n.padding),n.inputSpec=[new Ao({ndim:3})],n}return gu(t,e),t.prototype.computeOutputShape=function(e){var t=js((e=fa(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){n.invokeCallHook(e,t),e=Xa(la(e),2);var r=n.poolingFunction(la(e),[n.poolSize[0],1],[n.strides[0],1],n.padding,"channelsLast");return f.lc(r,[2])})},t.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(Ro),bu=function(e){function t(t){return e.call(this,t)||this}return gu(t,e),t.prototype.poolingFunction=function(e,t,n,r,a){return va(a),wa(r),yu(e,t,n,r,a,"max")},t.className="MaxPooling1D",t}(vu);i.SerializationMap.register(bu);var wu=function(e){function t(t){return e.call(this,t)||this}return gu(t,e),t.prototype.poolingFunction=function(e,t,n,r,a){return va(a),wa(r),yu(e,t,n,r,a,"avg")},t.className="AveragePooling1D",t}(vu);i.SerializationMap.register(wu);var xu=function(e){function t(t){var n=this;return null==t.poolSize&&(t.poolSize=[2,2]),(n=e.call(this,t)||this).poolSize=Array.isArray(t.poolSize)?t.poolSize:[t.poolSize,t.poolSize],n.strides=null==t.strides?n.poolSize:t.strides,n.padding=null==t.padding?"valid":t.padding,n.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,va(n.dataFormat),wa(n.padding),n.inputSpec=[new Ao({ndim:4})],n}return gu(t,e),t.prototype.computeOutputShape=function(e){e=fa(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=js(t,this.poolSize[0],this.padding,this.strides[0]),n=js(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n]:[e[0],t,n,e[3]]},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){return n.invokeCallHook(e,t),n.poolingFunction(la(e),n.poolSize,n.strides,n.padding,n.dataFormat)})},t.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(Ro),ku=function(e){function t(t){return e.call(this,t)||this}return gu(t,e),t.prototype.poolingFunction=function(e,t,n,r,a){return va(a),wa(r),yu(e,t,n,r,a,"max")},t.className="MaxPooling2D",t}(xu);i.SerializationMap.register(ku);var Ou=function(e){function t(t){return e.call(this,t)||this}return gu(t,e),t.prototype.poolingFunction=function(e,t,n,r,a){return va(a),wa(r),yu(e,t,n,r,a,"avg")},t.className="AveragePooling2D",t}(xu);i.SerializationMap.register(Ou);var Su=function(e){function t(t){var n=e.call(this,t)||this;return n.inputSpec=[new Ao({ndim:3})],n}return gu(t,e),t.prototype.computeOutputShape=function(e){return[e[0],e[2]]},t.prototype.call=function(e,t){throw new Jr},t}(Ro),Nu=function(e){function t(t){return e.call(this,t)||this}return gu(t,e),t.prototype.call=function(e,t){return Object(vr.f)(function(){var t=la(e);return f.ab(t,1)})},t.className="GlobalAveragePooling1D",t}(Su);i.SerializationMap.register(Nu);var Eu=function(e){function t(t){return e.call(this,t)||this}return gu(t,e),t.prototype.call=function(e,t){return Object(vr.f)(function(){var t=la(e);return f.Wa(t,1)})},t.className="GlobalMaxPooling1D",t}(Su);i.SerializationMap.register(Eu);var Iu=function(e){function t(t){var n=e.call(this,t)||this;return n.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,va(n.dataFormat),n.inputSpec=[new Ao({ndim:4})],n}return gu(t,e),t.prototype.computeOutputShape=function(e){return e=e,"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]},t.prototype.call=function(e,t){throw new Jr},t.prototype.getConfig=function(){var t={dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(Ro),Tu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return gu(t,e),t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var t=la(e);return"channelsLast"===n.dataFormat?f.ab(t,[1,2]):f.ab(t,[2,3])})},t.className="GlobalAveragePooling2D",t}(Iu);i.SerializationMap.register(Tu);var Au=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return gu(t,e),t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var t=la(e);return"channelsLast"===n.dataFormat?f.Wa(t,[1,2]):f.Wa(t,[2,3])})},t.className="GlobalMaxPooling2D",t}(Iu);i.SerializationMap.register(Au);var Cu=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Pu(e,t,n,r,a,o,i,s){void 0===r&&(r=!1),void 0===i&&(i=!1);var u=t.shape.length;if(u<3)throw new Xr("Input should be at least 3D, but is "+u+"D.");var c,l,p=[1,0].concat(_a(2,u));if(t=f.Bc(t,p),null!=a)throw new Jr("The rnn() function of the deeplearn.js backend does not support masking yet.");if(null!=o)throw new Jr("The rnn() functoin of the deeplearn.js backend does not support constants yet.");i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),r&&(t=f.Lb(t,0));for(var h=n,d=t.shape[0],m=0;m<d;++m){var g=Ja(t,m,1),y=e(g=g.reshape(g.shape.slice(1)),h);l=y[0],c=0===m?l.reshape([1].concat(l.shape)):$a(c,l.reshape([1].concat(l.shape))),h=y[1]}return[l,f.Bc(c,[1,0].concat(_a(2,c.shape.length))),h]}var _u=function(e){function t(t){var n,r=e.call(this,t)||this;if(null==t.cell)throw new Xr("cell property is missing for the constructor of RNN.");if(null==(n=Array.isArray(t.cell)?new Bu({cells:t.cell}):t.cell).stateSize)throw new Xr("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");return r.cell=n,r.returnSequences=null!=t.returnSequences&&t.returnSequences,r.returnState=null!=t.returnState&&t.returnState,r.goBackwards=null!=t.goBackwards&&t.goBackwards,r._stateful=null!=t.stateful&&t.stateful,r.unroll=null!=t.unroll&&t.unroll,r.supportsMasking=!0,r.inputSpec=[new Ao({ndim:3})],r.stateSpec=null,r.states=null,r.numConstants=null,r}return Cu(t,e),t.prototype.getStates=function(){return null==this.states?_a(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map(function(e){return null}):this.states},t.prototype.setStates=function(e){this.states=e},t.prototype.computeOutputShape=function(e){ra(e)&&(e=e[0]),e=e;var t=this.cell.stateSize;Array.isArray(t)||(t=[t]);var n,r=t[0];if(n=this.returnSequences?[e[0],e[1],r]:[e[0],r],this.returnState){for(var a=[],o=0,i=t;o<i.length;o++){var s=i[o];a.push([e[0],s])}return[n].concat(a)}return n},t.prototype.computeMask=function(e,t){throw new Jr("computeMask has not been implemented for RNN yet")},t.prototype.build=function(e){if(null!=this.numConstants)throw new Jr("Constants support is not implemented in RNN yet.");ra(e)&&(e=e[0]),e=e;var t=this.stateful?e[0]:null,n=e[e.length-1];this.inputSpec[0]=new Ao({shape:[t,null,n]});var r,a=[e[0]].concat(e.slice(2));if(this.cell.build(a),r=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!y.arraysEqual(this.stateSpec.map(function(e){return e.shape[e.shape.length-1]}),r))throw new Xr("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=r.map(function(e){return new Ao({shape:[null,e]})});if(this.stateful)throw new Jr("stateful RNN layer is not implemented yet")},t.prototype.resetStates=function(e){var t=this;Object(vr.f)(function(){if(!t.stateful)throw new Hr("Cannot call resetState() on an RNN Layer that is not stateful.");var n=t.inputSpec[0].shape[0];if(null==n)throw new Xr("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==t.states)Array.isArray(t.cell.stateSize)?t.states=t.cell.stateSize.map(function(e){return f.Hc([n,e])}):t.states=[f.Hc([n,t.cell.stateSize])];else if(null==e)Array.isArray(t.cell.stateSize)?t.states=t.cell.stateSize.map(function(e){return f.Hc([n,e])}):t.states[0]=f.Hc([n,t.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==t.states.length)throw new Xr("Layer "+t.name+" expects "+t.states.length+" state(s), but it received "+e.length+" state value(s). Input received: "+e);for(var r=0;r<t.states.length;++r){var a=e[r],o=Array.isArray(t.cell.stateSize)?t.cell.stateSize[r]:t.cell.stateSize,i=[n,o];if(!y.arraysEqual(a.shape,i))throw new Xr("State "+r+" is incompatible with layer "+t.name+": expected shape="+i+", received shape="+a.shape);t.states[r]=a}}})},t.prototype.standardizeArgs=function(e,t,n){if(Array.isArray(e)){if(null!=t||null!=n)throw new Xr("When inputs is an array, neither initialState or constants should be provided");null!=this.numConstants&&(n=e.slice(e.length-this.numConstants,e.length),e=e.slice(0,e.length-this.numConstants)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function r(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=r(t),constants:n=r(n)}},t.prototype.apply=function(t,n){var r=null==n?null:n.initialState,a=null==n?null:n.constants;null==n&&(n={});var o=this.standardizeArgs(t,r,a);t=o.inputs,r=o.initialState,a=o.constants;var i=[],s=[];if(null!=r){n.initialState=r,i=i.concat(r),this.stateSpec=[];for(var u=0,c=r;u<c.length;u++){var l=c[u];this.stateSpec.push(new Ao({shape:l.shape}))}s=s.concat(this.stateSpec)}if(null!=a&&(n.constants=a,i=i.concat(a),this.numConstants=a.length),i[0]instanceof ja){var f=[t].concat(i),p=this.inputSpec.concat(s),h=this.inputSpec;this.inputSpec=p;var d=e.prototype.apply.call(this,f,n);return this.inputSpec=h,d}return e.prototype.apply.call(this,t,n)},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){var r=null==t?null:t.mask,a=null==t?null:t.training,o=null==t?null:t.initialState;if(e=la(e),null==o){if(n.stateful)throw new Jr("stateful RNN layer is not implemented yet.");o=n.getInitialState(e)}if(null!=r)throw new Jr("Masking is not implemented for RNN yet");var i=Array.isArray(n.cell.stateSize)?n.cell.stateSize.length:1;if(o.length!==i)throw new Xr("RNN Layer has "+i+" state(s) but was passed "+o.length+" initial state(s).");e.shape[1],n.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");var s={training:a},u=Pu(function(e,t){var r=n.cell.call([e].concat(t),s);return[r[0],r.slice(1)]},e,o,n.goBackwards,null,null,n.unroll),c=u[0],l=u[1],f=u[2];if(n.stateful)throw new Jr("stateful RNN layer is not implemented yet");var p=n.returnSequences?l:c;return n.returnState?[p].concat(f):p})},t.prototype.getInitialState=function(e){var t=this;return Object(vr.f)(function(){var n=f.Hc(e.shape);return n=Xa(n=f.rc(n,[1,2])),Array.isArray(t.cell.stateSize)?t.cell.stateSize.map(function(e){return e>1?eo(n,[1,e]):n}):t.cell.stateSize>1?[eo(n,[1,t.cell.stateSize])]:[n]})},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);var n=this.cell.getConfig();t.cell={className:this.cell.getClassName(),config:n};var r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="RNN",t}(Ro);i.SerializationMap.register(_u);var Ru=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cu(t,e),function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i}([Object(qt.a)({heading:"Layers",subheading:"Classes"})],t)}(Ro),Mu=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=t.units,n.activation=xs(null==t.activation?n.DEFAULT_ACTIVATION:t.activation),n.useBias=null==t.useBias||t.useBias,n.kernelInitializer=os(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=os(t.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=os(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=Rs(t.kernelRegularizer),n.recurrentRegularizer=Rs(t.recurrentRegularizer),n.biasRegularizer=Rs(t.biasRegularizer),n.kernelConstraint=Oo(t.kernelConstraint),n.recurrentConstraint=Oo(t.recurrentConstraint),n.biasConstraint=Oo(t.biasConstraint),n.dropout=Ca([1,Pa([0,null==t.dropout?0:t.dropout])]),n.recurrentDropout=Ca([1,Pa([0,null==t.recurrentDropout?0:t.recurrentDropout])]),n.stateSize=n.units,n}return Cu(t,e),t.prototype.build=function(e){e=fa(e),this.kernel=this.addWeight("kernel",[e[e.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},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){if(2!==(e=e).length)throw new Xr("SimpleRNNCell expects 2 input Tensors, got "+e.length+".");var t=e[1];if(e=e[0],0!==n.dropout||0!==n.recurrentDropout)throw new Jr("Dropout is not implemented for SimpleRNNCell yet");var r=oo(e,n.kernel.read());null!=n.bias&&(r=uo(r,n.bias.read()));var a=f.d(r,oo(t,n.recurrentKernel.read()));return null!=n.activation&&(a=n.activation.apply(a)),[a,a]})},t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),recurrentInitializer:as(this.recurrentInitializer),biasInitializer:as(this.biasInitializer),kernelRegularizer:Ps(this.kernelRegularizer),recurrentRegularizer:Ps(this.recurrentRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),recurrentConstraint:xo(this.recurrentConstraint),biasConstraint:xo(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="SimpleRNNCell",t}(Ru);i.SerializationMap.register(Mu);var ju=function(e){function t(t){return t.cell=new Mu(t),e.call(this,t)||this}return Cu(t,e),t.prototype.call=function(t,n){var r=this;return Object(vr.f)(function(){var a=null==n?null:n.mask,o=null==n?null:n.training,i=null==n?null:n.initialState;return e.prototype.call.call(r,t,{mask:a,training:o,initialState:i})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),recurrentInitializer:as(this.recurrentInitializer),biasInitializer:as(this.biasInitializer),kernelRegularizer:Ps(this.kernelRegularizer),recurrentRegularizer:Ps(this.recurrentRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),recurrentConstraint:xo(this.recurrentConstraint),biasConstraint:xo(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=e.prototype.getConfig.call(this);return delete n.cell,Object.assign(t,n),t},t.className="SimpleRNN",t}(_u);i.SerializationMap.register(ju);var Du=function(e){function t(t){var n=e.call(this,t)||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=t.units,n.activation=xs(void 0===t.activation?n.DEFAULT_ACTIVATION:t.activation),n.recurrentActivation=xs(void 0===t.activation?n.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),n.useBias=null==t.useBias||t.useBias,n.kernelInitializer=os(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=os(t.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=os(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=Rs(t.kernelRegularizer),n.recurrentRegularizer=Rs(t.recurrentRegularizer),n.biasRegularizer=Rs(t.biasRegularizer),n.kernelConstraint=Oo(t.kernelConstraint),n.recurrentConstraint=Oo(t.recurrentConstraint),n.biasConstraint=Oo(t.biasConstraint),n.dropout=Ca([1,Pa([0,null==t.dropout?0:t.dropout])]),n.recurrentDropout=Ca([1,Pa([0,null==t.recurrentDropout?0:t.recurrentDropout])]),n.implementation=t.implementation,n.stateSize=n.units,n}return Cu(t,e),t.prototype.build=function(e){var t=(e=fa(e))[e.length-1];this.kernel=this.addWeight("kernel",[t,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},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){if(0!==n.dropout||0!==n.recurrentDropout)throw new Jr("Dropout is not implemented for GRUCell yet");if(2!==(e=e).length)throw new Xr("GRUCell expects 2 input Tensors (inputs, h, c), got "+e.length+".");var t,r,a,o=e[1];if(e=e[0],1===n.implementation){var i=Ya(n.kernel.read(),0,n.units),s=Ya(n.kernel.read(),n.units,n.units),u=Ya(n.kernel.read(),2*n.units,n.units),c=Ya(n.recurrentKernel.read(),0,n.units),l=Ya(n.recurrentKernel.read(),n.units,n.units),p=Ya(n.recurrentKernel.read(),2*n.units,n.units),h=e,d=e,m=oo(e,i),g=oo(h,s),y=oo(d,u);if(n.useBias){var v=Ja(n.bias.read(),0,n.units),b=Ja(n.bias.read(),n.units,n.units),w=Ja(n.bias.read(),2*n.units,n.units);m=uo(m,v),g=uo(g,b),y=uo(y,w)}var x=o,k=o,O=o;t=n.recurrentActivation.apply(f.d(m,oo(x,c))),r=n.recurrentActivation.apply(f.d(g,oo(k,l))),a=n.activation.apply(f.d(y,oo(f.ib(r,O),p)))}else{var S=oo(e,n.kernel.read());n.useBias&&(S=uo(S,n.bias.read()));var N=oo(o,Ya(n.recurrentKernel.read(),0,2*n.units)),E=(m=Ya(S,0,n.units),g=Ya(S,n.units,n.units),Ya(N,0,n.units)),I=Ya(N,n.units,n.units);t=n.recurrentActivation.apply(f.d(m,E)),r=n.recurrentActivation.apply(f.d(g,I)),y=Ya(S,2*n.units,n.units);var T=oo(f.ib(r,o),Ya(n.recurrentKernel.read(),2*n.units,n.units));a=n.activation.apply(f.d(y,T))}var A=f.d(f.ib(t,o),f.ib(ro(Ua(1),f.mb(t)),a));return[A,A]})},t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),recurrentInitializer:as(this.recurrentInitializer),biasInitializer:as(this.biasInitializer),kernelRegularizer:Ps(this.kernelRegularizer),recurrentRegularizer:Ps(this.recurrentRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),recurrentConstraint:xo(this.recurrentConstraint),biasConstraint:xo(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="GRUCell",t}(Ru);i.SerializationMap.register(Du);var Lu=function(e){function t(t){return 0===t.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),t.cell=new Du(t),e.call(this,t)||this}return Cu(t,e),t.prototype.call=function(t,n){var r=this;return Object(vr.f)(function(){var a=null==n?null:n.mask,o=null==n?null:n.training,i=null==n?null:n.initialState;return e.prototype.call.call(r,t,{mask:a,training:o,initialState:i})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),recurrentInitializer:as(this.recurrentInitializer),biasInitializer:as(this.biasInitializer),kernelRegularizer:Ps(this.kernelRegularizer),recurrentRegularizer:Ps(this.recurrentRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),recurrentConstraint:xo(this.recurrentConstraint),biasConstraint:xo(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return delete n.cell,Object.assign(t,n),t},t.fromConfig=function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)},t.className="GRU",t}(_u);i.SerializationMap.register(Lu);var zu=function(e){function t(t){var n=e.call(this,t)||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=t.units,n.activation=xs(void 0===t.activation?n.DEFAULT_ACTIVATION:t.activation),n.recurrentActivation=xs(void 0===t.activation?n.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),n.useBias=null==t.useBias||t.useBias,n.kernelInitializer=os(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=os(t.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=os(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.unitForgetBias=t.unitForgetBias,n.kernelRegularizer=Rs(t.kernelRegularizer),n.recurrentRegularizer=Rs(t.recurrentRegularizer),n.biasRegularizer=Rs(t.biasRegularizer),n.kernelConstraint=Oo(t.kernelConstraint),n.recurrentConstraint=Oo(t.recurrentConstraint),n.biasConstraint=Oo(t.biasConstraint),n.dropout=Ca([1,Pa([0,null==t.dropout?0:t.dropout])]),n.recurrentDropout=Ca([1,Pa([0,null==t.recurrentDropout?0:t.recurrentDropout])]),n.implementation=t.implementation,n.stateSize=[n.units,n.units],n}return Cu(t,e),t.prototype.build=function(e){var t,n,r=(e=fa(e))[e.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 a=this.biasInitializer,o=this.units;t=new((n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cu(t,e),t.prototype.apply=function(e,t){var n=a.apply([o]),r=(new Gi).apply([o]),i=a.apply([2*o]);return $a($a(n,r),i)},t}(Ui)).className="CustomInit",n)}else t=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,t,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){if(0!==n.dropout||0!==n.recurrentDropout)throw new Jr("Dropout is not implemented for LSTMCell yet");if(3!==(e=e).length)throw new Xr("LSTMCell expects 3 input Tensors (inputs, h, c), got "+e.length+".");var t,r,a,o,i=e[1],s=e[2];if(e=e[0],1===n.implementation){var u=Ya(n.kernel.read(),0,n.units),c=Ya(n.kernel.read(),n.units,n.units),l=Ya(n.kernel.read(),2*n.units,n.units),p=Ya(n.kernel.read(),3*n.units,n.units),h=Ya(n.recurrentKernel.read(),0,n.units),d=Ya(n.recurrentKernel.read(),n.units,n.units),m=Ya(n.recurrentKernel.read(),2*n.units,n.units),g=Ya(n.recurrentKernel.read(),3*n.units,n.units),y=e,v=e,b=e,w=oo(e,u),x=oo(y,c),k=oo(v,l),O=oo(b,p);if(n.useBias){var S=Ja(n.bias.read(),0,n.units),N=Ja(n.bias.read(),n.units,n.units),E=Ja(n.bias.read(),2*n.units,n.units),I=Ja(n.bias.read(),3*n.units,n.units);w=uo(w,S),x=uo(x,N),k=uo(k,E),O=uo(O,I)}var T=i,A=i,C=i,P=i;t=n.recurrentActivation.apply(f.d(w,oo(T,h))),r=n.recurrentActivation.apply(f.d(x,oo(A,d))),a=f.d(f.ib(r,s),f.ib(t,n.activation.apply(f.d(k,oo(C,m))))),o=n.recurrentActivation.apply(f.d(O,oo(P,g)))}else{var _=oo(e,n.kernel.read());_=f.d(_,oo(i,n.recurrentKernel.read())),n.useBias&&(_=uo(_,n.bias.read()));var R=Ya(_,0,n.units),M=Ya(_,n.units,n.units),j=Ya(_,2*n.units,n.units),D=Ya(_,3*n.units,n.units);t=n.recurrentActivation.apply(R),r=n.recurrentActivation.apply(M),a=f.d(f.ib(r,s),f.ib(t,n.activation.apply(j))),o=n.recurrentActivation.apply(D)}var L=f.ib(o,n.activation.apply(a));return[L,L,a]})},t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),recurrentInitializer:as(this.recurrentInitializer),biasInitializer:as(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:Ps(this.kernelRegularizer),recurrentRegularizer:Ps(this.recurrentRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),recurrentConstraint:xo(this.recurrentConstraint),biasConstraint:xo(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="LSTMCell",t}(Ru);i.SerializationMap.register(zu);var Fu=function(e){function t(t){return 0===t.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),t.cell=new zu(t),e.call(this,t)||this}return Cu(t,e),t.prototype.call=function(t,n){var r=this;return Object(vr.f)(function(){var a=null==n?null:n.mask,o=null==n?null:n.training,i=null==n?null:n.initialState;return e.prototype.call.call(r,t,{mask:a,training:o,initialState:i})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"unitForgetBias",{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:bs(this.activation),useBias:this.useBias,kernelInitializer:as(this.kernelInitializer),recurrentInitializer:as(this.recurrentInitializer),biasInitializer:as(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:Ps(this.kernelRegularizer),recurrentRegularizer:Ps(this.recurrentRegularizer),biasRegularizer:Ps(this.biasRegularizer),activityRegularizer:Ps(this.activityRegularizer),kernelConstraint:xo(this.kernelConstraint),recurrentConstraint:xo(this.recurrentConstraint),biasConstraint:xo(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return delete n.cell,Object.assign(t,n),t},t.fromConfig=function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)},t.className="LSTM",t}(_u);i.SerializationMap.register(Fu);var Bu=function(e){function t(t){var n=e.call(this,t)||this;return n.cells=t.cells,n}return Cu(t,e),Object.defineProperty(t.prototype,"stateSize",{get:function(){for(var e=[],t=0,n=this.cells.slice().reverse();t<n.length;t++){var r=n[t];Array.isArray(r.stateSize)?e.push.apply(e,r.stateSize):e.push(r.stateSize)}return e},enumerable:!0,configurable:!0}),t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){for(var r=(e=e).slice(1),a=[],o=0,i=n.cells.slice().reverse();o<i.length;o++){var s=i[o];Array.isArray(s.stateSize)?a.push(r.splice(0,s.stateSize.length)):a.push(r.splice(0,1))}a.reverse();for(var u,c=[],l=0;l<n.cells.length;++l)s=n.cells[l],r=a[l],u=0===l?[e[0]].concat(r):[u[0]].concat(r),u=s.call(u,t),c.push(u.slice(1));r=[];for(var f=0,p=c.slice().reverse();f<p.length;f++){var h=p[f];r.push.apply(r,h)}return[u[0]].concat(r)})},t.prototype.build=function(e){var t;ra(e)&&(e=e[0]),e=e;for(var n=0,r=this.cells;n<r.length;n++){var a=r[n];a.build(e),t=Array.isArray(a.stateSize)?a.stateSize[0]:a.stateSize,e=[e[0],t]}this.built=!0},t.prototype.getConfig=function(){for(var t=[],n=0,r=this.cells;n<r.length;n++){var a=r[n];t.push({className:this.getClassName(),config:a.getConfig()})}var o={cells:t},i=e.prototype.getConfig.call(this);return Object.assign(o,i),o},t.fromConfig=function(e,t,n){void 0===n&&(n={});for(var r=[],a=0,o=t.cells;a<o.length;a++){var i=o[a];r.push(So(i,n))}return new e({cells:r})},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){if(!this.trainable)return[];for(var e=[],t=0,n=this.cells;t<n.length;t++){var r=n[t];e.push.apply(e,r.trainableWeights)}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){for(var e=[],t=0,n=this.cells;t<n.length;t++){var r=n[t];e.push.apply(e,r.nonTrainableWeights)}if(!this.trainable){for(var a=[],o=0,i=this.cells;o<i.length;o++)r=i[o],a.push.apply(a,r.trainableWeights);return a.concat(e)}return e},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){for(var e=[],t=0,n=this.cells;t<n.length;t++){var r=n[t];e.push.apply(e,r.weights)}return za(e)},t.prototype.setWeights=function(e){for(var t=[],n=0,r=this.cells;n<r.length;n++)for(var a=r[n],o=a.weights.length,i=e.splice(o),s=0;s<a.weights.length;++s)t.push([a.weights[s],i[s]]);Fa(t)},t.className="StackedRNNCells",t}(Ru);i.SerializationMap.register(Bu);var Vu=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Uu=function(e){function t(t){var n=e.call(this,t)||this;return n.layer=t.layer,n}return Vu(t,e),t.prototype.build=function(e){this.built=!0},Object.defineProperty(t.prototype,"trainable",{get:function(){return null!=this.layer&&this.layer.trainable},set:function(e){null!=this.layer&&(this.layer.trainable=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.layer.trainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.layer.nonTrainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updates",{get:function(){return this.layer._updates},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"losses",{get:function(){return this.layer.losses},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){return this.layer.getWeights()},t.prototype.setWeights=function(e){this.layer.setWeights(e)},t.prototype.getConfig=function(){var t={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.fromConfig=function(e,t,n){void 0===n&&(n={});var r=So(t.layer,n);delete t.layer;var a={layer:r};return Object.assign(a,t),new e(a)},t}(Ro),Wu=function(e){function t(t){var n=e.call(this,t)||this;return n.supportsMasking=!0,n}return Vu(t,e),t.prototype.build=function(t){if((t=fa(t)).length<3)throw new Xr("TimeDistributed layer expects an input shape >= 3D, but received input shape "+JSON.stringify(t));this.inputSpec=[{shape:t}];var n=[t[0]].concat(t.slice(2));this.layer.built||(this.layer.build(n),this.layer.built=!0),e.prototype.build.call(this,t)},t.prototype.computeOutputShape=function(e){var t=[(e=fa(e))[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),r=e[1];return[n[0],r].concat(n.slice(1))},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){return Pu(function(e,r){return[n.layer.call(e,t),[]]},e=la(e),[],!1,null,null,!1,e.shape[1])[1]})},t.className="TimeDistributed",t}(Uu);i.SerializationMap.register(Wu);var Gu=["sum","mul","concat","ave"],qu=function(e){function t(t){var n,r=e.call(this,t)||this,a=t.layer.getConfig();if(r.forwardLayer=So({className:t.layer.getClassName(),config:a}),a.goBackwards=!0!==a.goBackwards,r.backwardLayer=So({className:t.layer.getClassName(),config:a}),r.forwardLayer.name="forward_"+r.forwardLayer.name,r.backwardLayer.name="backward_"+r.backwardLayer.name,n=t.mergeMode,ma(Gu,"BidirectionalMergeMode",n),r.mergeMode=t.mergeMode,t.weights)throw new Jr("weights support is not implemented for Bidirectional layer yet.");return r._stateful=t.layer.stateful,r.returnSequences=t.layer.returnSequences,r.returnState=t.layer.returnState,r.supportsMasking=!0,r._trainable=!0,r.inputSpec=t.layer.inputSpec,r}return Vu(t,e),Object.defineProperty(t.prototype,"trainable",{get:function(){return this._trainable},set:function(e){this._trainable=e,null!=this.forwardLayer&&(this.forwardLayer.trainable=e),null!=this.backwardLayer&&(this.backwardLayer.trainable=e)},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},t.prototype.setWeights=function(e){var t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))},t.prototype.computeOutputShape=function(e){var t,n,r,a=this.forwardLayer.computeOutputShape(e);return Array.isArray(a)&&Array.isArray(a[0])||(a=[a]),a=a,this.returnState?(r=a.slice(1),t=a[0]):t=a[0],t=t,"concat"===this.mergeMode?(t[t.length-1]*=2,n=[t]):n=null==this.mergeMode?[t,t.slice()]:[t],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[t].concat(r).concat(r.slice()):ta(n)},t.prototype.apply=function(t,n){var r=null;if(null!=n&&(r=n.initialState),Array.isArray(t)&&(r=t.slice(1),t=t[0]),null==r||0===r.length)return e.prototype.apply.call(this,t,n);throw new Jr("The support for initial states is not implemented for Bidirectional layers yet.")},t.prototype.call=function(e,t){var n=this;return Object(vr.f)(function(){if(null!=t.mask)throw new Jr("The support for masking is not implemented for Bidirectional layers yet.");if(null!=t.initialState)throw new Jr("The support for initial states is not implemented for Bidirectional layers yet.");var r,a,o=n.forwardLayer.call(e,t),i=n.backwardLayer.call(e,t);return n.returnState&&(Array.isArray(o)&&(r=o.slice(1).concat(i.slice(1))),o=o[0],i=i[0]),n.returnSequences&&(i=f.Lb(i,1)),"concat"===n.mergeMode?a=Za([o,i]):"sum"===n.mergeMode?a=f.d(o,i):"ave"===n.mergeMode?a=no(Ua(.5),f.d(o,i)):"mul"===n.mergeMode?a=f.ib(o,i):null==n.mergeMode&&(a=[o,i]),n.returnState?null==n.mergeMode?a.concat(r):[a].concat(r):a})},t.prototype.resetStates=function(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},t.prototype.build=function(e){var t=this;co(this.forwardLayer.name,function(){t.forwardLayer.build(e)}),co(this.backwardLayer.name,function(){t.backwardLayer.build(e)}),this.built=!0},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={mergeMode:this.mergeMode},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.fromConfig=function(e,t){var n=So(t.layer);if(delete t.layer,null!=t.numConstants)throw new Jr("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var r=t;return r.layer=n,new e(r)},t.className="Bidirectional",t}(Uu);i.SerializationMap.register(qu);var Hu=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ku=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},Xu=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Ju=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};var Yu=function(e){function t(t){var n=e.call(this,{inputs:[],outputs:[]})||this;if(t=t||{},n.trainable=!0,n._updatable=!0,n.built=!1,n.name=null!=t.name?t.name:fo("sequential_"),null!=t.layers)for(var r=0,a=t.layers;r<a.length;r++){var o=a[r];n.add(o)}return n}return Hu(t,e),n=t,t.prototype.add=function(e){if(0===this.outputs.length){if(0===e.inboundNodes.length){if(null==e.batchInputShape)throw new Xr("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");var t=jo({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(t)}if(1!==e.inboundNodes.length)throw new Xr("A layer added to a Sequential model must not already be connected somewhere else. Model received layer "+e.name+" which has "+e.inboundNodes.length+" pre-existing inbound connections.");if(1!==e.inboundNodes[0].outputTensors.length)throw new Xr("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=function e(t,n,r){if((null==n||null!=r&&r>0)&&(n=t.sourceLayer,r=t.nodeIndex),0===n.inboundNodes.length)return[t];var a=n.inboundNodes[r];if(0===a.inboundLayers.length)return a.inputTensors;for(var o=[],i=0;i<a.inboundLayers.length;i++)for(var s=0,u=e(a.inputTensors[i],a.inboundLayers[i],a.nodeIndices[i]);s<u.length;s++){var c=u[s];-1===o.indexOf(c)&&o.push(c)}return o}(this.outputs[0]),new Po({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:Zr(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(function(e){return e.shape}),outputShapes:this.outputs[0].shape})}else{var n=e.apply(this.outputs[0]);if(Array.isArray(n))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.outputs=[n],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1},t.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 e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}},t.prototype.call=function(e,t){return null==this.model&&this.build(),this.model.call(e,t)},t.prototype.build=function(e){if(fa(e),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 zi({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.model.updatable=this.updatable,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},t.prototype.setWeights=function(e){null==this.model&&this.build(),this.model.setWeights(e)},Object.defineProperty(t.prototype,"updatable",{get:function(){return this._updatable},set:function(e){this.built&&(this.model.updatable=e),this._updatable=e},enumerable:!0,configurable:!0}),t.prototype.evaluate=function(e,t,n){if(void 0===n&&(n={}),!this.built)throw new Kr("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)},t.prototype.predict=function(e,t){return void 0===t&&(t={}),null==this.model&&this.build(),this.model.predict(e,t)},t.prototype.predictOnBatch=function(e){return null==this.model&&this.build(),this.model.predictOnBatch(e)},t.prototype.compile=function(e){this.build(),this.model.compile(e),this.optimizer=this.model.optimizer,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames},t.prototype.fit=function(e,t,n){return void 0===n&&(n={}),Xu(this,void 0,void 0,function(){return Ju(this,function(r){if(!this.built)throw new Kr("The model needs to be compiled before being used.");return[2,this.model.fit(e,t,n)]})})},t.fromConfig=function(e,t){var r=new e({});if(!(r instanceof n))throw new Xr("Sequential.fromConfig called on non-Sequential input: "+r);if(!(t instanceof Array))throw new Xr("Sequential.fromConfig called without an array of configs");if(null==t[0].className||"Merge"===t[0].className)throw new Xr("Legacy serialization format not supported yet.");for(var a=0,o=t;a<o.length;a++){var i=So(o[a]);r.add(i)}return r},t.prototype.getConfig=function(){for(var e=[],t=0,n=this.layers;t<n.length;t++){var r=n[t];e.push({className:r.getClassName(),config:r.getConfig()})}return e},t.className="Sequential",Ku([Object(qt.a)({heading:"Models",subheading:"Classes"})],t.prototype,"add",null),Ku([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[2]})],t.prototype,"evaluate",null),Ku([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[1]})],t.prototype,"predict",null),Ku([Object(qt.a)({heading:"Models",subheading:"Classes",configParamIndices:[2]})],t.prototype,"fit",null),n=Ku([Object(qt.a)({heading:"Models",subheading:"Classes"})],t);var n}(zi);i.SerializationMap.register(Yu);var Qu=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},Zu=function(){function e(){}return e.model=function(e){return new zi(e)},e.sequential=function(e){return new Yu(e)},e.loadModel=function(e){return function(e){return Xu(this,void 0,void 0,function(){var t;return Ju(this,function(n){if("string"==typeof e){if(0===(t=o.getLoadHandlers(e)).length)return[2,function(e){return Xu(this,void 0,void 0,function(){var t;return Ju(this,function(n){switch(n.label){case 0:return[4,fetch(e)];case 1:return[4,n.sent().json()];case 2:if(null==(t=n.sent()).modelTopology)throw new Xr('Missing field "modelTopology" from model JSON at path'+e);if(null==t.weightsManifest)throw new Xr('Missing field "weightsManifest" from model JSON at path'+e);return t.pathPrefix=e.substring(0,e.lastIndexOf("/")),[2,function(e,t){return Xu(this,void 0,void 0,function(){var t,n,r,a,i,s,u,c,l,f;return Ju(this,function(p){switch(p.label){case 0:return null!=(t=e.modelTopology).model_config&&(t=t.model_config),n=Eo(t),r=So(n,void 0),null==e.weightsManifest?[3,2]:[4,o.loadWeights(e.weightsManifest,e.pathPrefix,r.weights.map(function(e){return e.originalName}))];case 1:for(a=p.sent(),i={},s=0,u=r.weights;s<u.length;s++)c=u[s],i[c.originalName]=a[c.originalName];l=null,f=!0,r.loadWeights(i,l,f),p.label=2;case 2:return[2,r]}})})}(t)]}})})}(e)];if(t.length>1)throw new Xr("Found more than one ("+t.length+") load handlers for URL '"+e+"'");e=t[0]}return[2,function(e,t){return Xu(this,void 0,void 0,function(){var t,n,r,a;return Ju(this,function(i){switch(i.label){case 0:if(null==e.load)throw new Xr("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,e.load()];case 1:if(t=i.sent(),n=So(Eo(t.modelTopology),void 0),null!=t.weightData){if(null==t.weightSpecs)throw new Xr("Model artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");r=!1,a=!0,n.loadWeights(o.decodeWeights(t.weightData,t.weightSpecs),r,a)}return[2,n]}})})}(e)]})})}(e)},e.input=function(e){return jo(e)},Qu([Object(qt.a)({heading:"Models",subheading:"Creation",configParamIndices:[0]})],e,"model",null),Qu([Object(qt.a)({heading:"Models",subheading:"Creation",configParamIndices:[0]})],e,"sequential",null),Qu([Object(qt.a)({heading:"Models",subheading:"Loading",useDocsFrom:"loadModelInternal"})],e,"loadModel",null),Qu([Object(qt.a)({heading:"Models",subheading:"Inputs",useDocsFrom:"Input",configParamIndices:[0]})],e,"input",null),e}(),$u=function(){function e(){}return e.inputLayer=function(e){return new Mo(e)},e.elu=function(e){return new Ss(e)},e.leakyReLU=function(e){return new Os(e)},e.softmax=function(e){return new Es(e)},e.thresholdedReLU=function(e){return new Ns(e)},e.conv1d=function(e){return new Ws(e)},e.conv2d=function(e){return new Bs(e)},e.conv2dTranspose=function(e){return new Vs(e)},e.separableConv2d=function(e){return new Us(e)},e.cropping2D=function(e){return new Gs(e)},e.upSampling2d=function(e){return new qs(e)},e.depthwiseConv2d=function(e){return new Ks(e)},e.activation=function(e){return new Zs(e)},e.dense=function(e){return new Ys(e)},e.dropout=function(e){return new Js(e)},e.flatten=function(e){return new Qs(e)},e.repeatVector=function(e){return new $s(e)},e.reshape=function(e){return new eu(e)},e.embedding=function(e){return new nu(e)},e.add=function(e){return new ou(e)},e.average=function(e){return new su(e)},e.concatenate=function(e){return new lu(e)},e.maximum=function(e){return new uu(e)},e.minimum=function(e){return new cu(e)},e.multiply=function(e){return new iu(e)},e.batchNormalization=function(e){return new hu(e)},e.zeroPadding2d=function(e){return new mu(e)},e.averagePooling1d=function(e){return new wu(e)},e.avgPool1d=function(t){return e.averagePooling1d(t)},e.avgPooling1d=function(t){return e.averagePooling1d(t)},e.averagePooling2d=function(e){return new Ou(e)},e.avgPool2d=function(t){return e.averagePooling2d(t)},e.avgPooling2d=function(t){return e.averagePooling2d(t)},e.globalAveragePooling1d=function(e){return new Nu(e)},e.globalAveragePooling2d=function(e){return new Tu(e)},e.globalMaxPooling1d=function(e){return new Eu(e)},e.globalMaxPooling2d=function(e){return new Au(e)},e.maxPooling1d=function(e){return new bu(e)},e.maxPooling2d=function(e){return new ku(e)},e.gru=function(e){return new Lu(e)},e.gruCell=function(e){return new Du(e)},e.lstm=function(e){return new Fu(e)},e.lstmCell=function(e){return new zu(e)},e.simpleRNN=function(e){return new ju(e)},e.simpleRNNCell=function(e){return new Mu(e)},e.rnn=function(e){return new _u(e)},e.stackedRNNCells=function(e){return new Bu(e)},e.bidirectional=function(e){return new qu(e)},e.timeDistributed=function(e){return new Wu(e)},e.Layer=Ro,e.RNN=_u,e.RNNCell=Ru,e.input=Zu.input,Qu([Object(qt.a)({heading:"Layers",subheading:"Inputs",namespace:"layers",useDocsFrom:"InputLayer",configParamIndices:[0]})],e,"inputLayer",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Advanced Activation",namespace:"layers",useDocsFrom:"ELU",configParamIndices:[0]})],e,"elu",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Advanced Activation",namespace:"layers",useDocsFrom:"LeakyReLU",configParamIndices:[0]})],e,"leakyReLU",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Advanced Activation",namespace:"layers",useDocsFrom:"Softmax",configParamIndices:[0]})],e,"softmax",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Advanced Activation",namespace:"layers",useDocsFrom:"ThresholdedReLU",configParamIndices:[0]})],e,"thresholdedReLU",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"Conv1D",configParamIndices:[0]})],e,"conv1d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"Conv2D",configParamIndices:[0]})],e,"conv2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"Conv2DTranspose",configParamIndices:[0]})],e,"conv2dTranspose",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"SeparableConv2D",configParamIndices:[0]})],e,"separableConv2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"Cropping2D",configParamIndices:[0]})],e,"cropping2D",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"UpSampling2D",configParamIndices:[0]})],e,"upSampling2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Convolutional",namespace:"layers",useDocsFrom:"DepthwiseConv2D",configParamIndices:[0]})],e,"depthwiseConv2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"Activation",configParamIndices:[0]})],e,"activation",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"Dense",configParamIndices:[0]})],e,"dense",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"Dropout",configParamIndices:[0]})],e,"dropout",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"Flatten",configParamIndices:[0]})],e,"flatten",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"RepeatVector",configParamIndices:[0]})],e,"repeatVector",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"Reshape",configParamIndices:[0]})],e,"reshape",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Basic",namespace:"layers",useDocsFrom:"Embedding",configParamIndices:[0]})],e,"embedding",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Merge",namespace:"layers",useDocsFrom:"Add",configParamIndices:[0]})],e,"add",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Merge",namespace:"layers",useDocsFrom:"Average",configParamIndices:[0]})],e,"average",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Merge",namespace:"layers",useDocsFrom:"Concatenate",configParamIndices:[0]})],e,"concatenate",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Merge",namespace:"layers",useDocsFrom:"Maximum",configParamIndices:[0]})],e,"maximum",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Merge",namespace:"layers",useDocsFrom:"Minimum",configParamIndices:[0]})],e,"minimum",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Merge",namespace:"layers",useDocsFrom:"Multiply",configParamIndices:[0]})],e,"multiply",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Normalization",namespace:"layers",useDocsFrom:"BatchNormalization",configParamIndices:[0]})],e,"batchNormalization",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Padding",namespace:"layers",useDocsFrom:"ZeroPadding2D",configParamIndices:[0]})],e,"zeroPadding2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"AveragePooling1D",configParamIndices:[0]})],e,"averagePooling1d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"AveragePooling2D",configParamIndices:[0]})],e,"averagePooling2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"GlobalAveragePooling1D",configParamIndices:[0]})],e,"globalAveragePooling1d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"GlobalAveragePooling2D",configParamIndices:[0]})],e,"globalAveragePooling2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"GlobalMaxPooling1D",configParamIndices:[0]})],e,"globalMaxPooling1d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"GlobalMaxPooling2D",configParamIndices:[0]})],e,"globalMaxPooling2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"MaxPooling1D",configParamIndices:[0]})],e,"maxPooling1d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Pooling",namespace:"layers",useDocsFrom:"MaxPooling2D",configParamIndices:[0]})],e,"maxPooling2d",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"GRU",configParamIndices:[0]})],e,"gru",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"GRUCell",configParamIndices:[0]})],e,"gruCell",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"LSTM",configParamIndices:[0]})],e,"lstm",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"LSTMCell",configParamIndices:[0]})],e,"lstmCell",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"SimpleRNN",configParamIndices:[0]})],e,"simpleRNN",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"SimpleRNNCell",configParamIndices:[0]})],e,"simpleRNNCell",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"RNN",configParamIndices:[0]})],e,"rnn",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Recurrent",namespace:"layers",useDocsFrom:"RNN",configParamIndices:[0]})],e,"stackedRNNCells",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Wrapper",namespace:"layers",useDocsFrom:"Bidirectional",configParamIndices:[0]})],e,"bidirectional",null),Qu([Object(qt.a)({heading:"Layers",subheading:"Wrapper",namespace:"layers",useDocsFrom:"TimeDistributed",configParamIndices:[0]})],e,"timeDistributed",null),e}(),ec=function(){function e(){}return e.maxNorm=function(e){return new go(e)},e.unitNorm=function(e){return new yo(e)},e.nonNeg=function(){return new vo},e.minMaxNorm=function(e){return new bo(e)},Qu([Object(qt.a)({heading:"Constraints",namespace:"constraints",useDocsFrom:"MaxNorm",configParamIndices:[0]})],e,"maxNorm",null),Qu([Object(qt.a)({heading:"Constraints",namespace:"constraints",useDocsFrom:"UnitNorm",configParamIndices:[0]})],e,"unitNorm",null),Qu([Object(qt.a)({heading:"Constraints",namespace:"constraints",useDocsFrom:"NonNeg"})],e,"nonNeg",null),Qu([Object(qt.a)({heading:"Constraints",namespace:"constraints",useDocsFrom:"MinMaxNormConfig",configParamIndices:[0]})],e,"minMaxNorm",null),e}(),tc=function(){function e(){}return e.zeros=function(){return new Wi},e.ones=function(){return new Gi},e.constant=function(e){return new qi(e)},e.randomUniform=function(e){return new Hi(e)},e.randomNormal=function(e){return new Ki(e)},e.truncatedNormal=function(e){return new Xi(e)},e.identity=function(e){return new Ji(e)},e.varianceScaling=function(e){return new Yi(e)},e.glorotUniform=function(e){return new Qi(e)},e.glorotNormal=function(e){return new Zi(e)},e.heNormal=function(e){return new $i(e)},e.leCunNormal=function(e){return new es(e)},e.orthogonal=function(e){return new ts(e)},Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"Zeros"})],e,"zeros",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"Ones"})],e,"ones",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"Constant",configParamIndices:[0]})],e,"constant",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"RandomUniform",configParamIndices:[0]})],e,"randomUniform",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"RandomNormal",configParamIndices:[0]})],e,"randomNormal",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"TruncatedNormal",configParamIndices:[0]})],e,"truncatedNormal",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"Identity",configParamIndices:[0]})],e,"identity",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"VarianceScaling",configParamIndices:[0]})],e,"varianceScaling",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"GlorotUniform",configParamIndices:[0]})],e,"glorotUniform",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"GlorotNormal",configParamIndices:[0]})],e,"glorotNormal",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"HeNormal",configParamIndices:[0]})],e,"heNormal",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"LeCunNormal",configParamIndices:[0]})],e,"leCunNormal",null),Qu([Object(qt.a)({heading:"Initializers",namespace:"initializers",useDocsFrom:"Orthogonal",configParamIndices:[0]})],e,"orthogonal",null),e}(),nc=function(){function e(){}return e.binaryAccuracy=function(e,t){return ci(e,t)},e.binaryCrossentropy=function(e,t){return fi(e,t)},e.categoricalAccuracy=function(e,t){return li(e,t)},e.categoricalCrossentropy=function(e,t){return ni(e,t)},e.cosineProximity=function(e,t){return si(e,t)},e.prototype.meanAbsoluteError=function(e,t){return Jo(e,t)},e.prototype.meanAbsolutePercentageError=function(e,t){return Yo(e,t)},e.prototype.MAPE=function(e,t){return Yo(e,t)},e.prototype.mape=function(e,t){return Yo(e,t)},e.meanSquaredError=function(e,t){return Xo(e,t)},e.MSE=function(e,t){return Xo(e,t)},e.mse=function(e,t){return Xo(e,t)},Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"meanAbsoluteError"})],e.prototype,"meanAbsoluteError",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"meanAbsolutePercentageError"})],e.prototype,"meanAbsolutePercentageError",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"binaryAccuracy"})],e,"binaryAccuracy",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"binaryCrossentropy"})],e,"binaryCrossentropy",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"categoricalAccuracy"})],e,"categoricalAccuracy",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"categoricalCrossentropy"})],e,"categoricalCrossentropy",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"cosineProximity"})],e,"cosineProximity",null),Qu([Object(qt.a)({heading:"Metrics",namespace:"metrics",useDocsFrom:"meanSquaredError"})],e,"meanSquaredError",null),e}(),rc=function(){function e(){}return e.l1l2=function(e){return new As(e)},e.l1=function(e){return function(e){return new As({l1:null!=e?e.l1:null,l2:0})}(e)},e.l2=function(e){return function(e){return new As({l2:null!=e?e.l2:null,l1:0})}(e)},Qu([Object(qt.a)({heading:"Regularizers",namespace:"regularizers",useDocsFrom:"L1L2"})],e,"l1l2",null),Qu([Object(qt.a)({heading:"Regularizers",namespace:"regularizers",useDocsFrom:"L1L2"})],e,"l1",null),Qu([Object(qt.a)({heading:"Regularizers",namespace:"regularizers",useDocsFrom:"L1L2"})],e,"l2",null),e}(),ac=Zu.model,oc=Zu.sequential,ic=Zu.loadModel,sc=Zu.input,uc=$u,cc=ec,lc=tc,fc=nc,pc=rc,hc=n(167),dc=n(97);const mc=dc.Reader,gc=dc.util,yc=dc.roots.default||(dc.roots.default={}),vc=yc.tensorflow=(()=>{const e={};return e.Any=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.typeUrl="",e.prototype.value=gc.newBuffer([]),e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.Any;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.typeUrl=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&a)}}return r},e}(),e.DataType=function(){const e={},t=Object.create(e);return t[e[0]="DT_INVALID"]=0,t[e[1]="DT_FLOAT"]=1,t[e[2]="DT_DOUBLE"]=2,t[e[3]="DT_INT32"]=3,t[e[4]="DT_UINT8"]=4,t[e[5]="DT_INT16"]=5,t[e[6]="DT_INT8"]=6,t[e[7]="DT_STRING"]=7,t[e[8]="DT_COMPLEX64"]=8,t[e[9]="DT_INT64"]=9,t[e[10]="DT_BOOL"]=10,t[e[11]="DT_QINT8"]=11,t[e[12]="DT_QUINT8"]=12,t[e[13]="DT_QINT32"]=13,t[e[14]="DT_BFLOAT16"]=14,t[e[101]="DT_FLOAT_REF"]=101,t[e[102]="DT_DOUBLE_REF"]=102,t[e[103]="DT_INT32_REF"]=103,t[e[104]="DT_UINT8_REF"]=104,t[e[105]="DT_INT16_REF"]=105,t[e[106]="DT_INT8_REF"]=106,t[e[107]="DT_STRING_REF"]=107,t[e[108]="DT_COMPLEX64_REF"]=108,t[e[109]="DT_INT64_REF"]=109,t[e[110]="DT_BOOL_REF"]=110,t[e[111]="DT_QINT8_REF"]=111,t[e[112]="DT_QUINT8_REF"]=112,t[e[113]="DT_QINT32_REF"]=113,t[e[114]="DT_BFLOAT16_REF"]=114,t}(),e.TensorShape=function(){function e(e){if(this.dim=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.dim=gc.emptyArray,e.prototype.unknownRank=!1,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.TensorShape;e.pos<n;){var a=e.uint32();switch(a>>>3){case 2:r.dim&&r.dim.length||(r.dim=[]),r.dim.push(yc.tensorflow.TensorShape.Dim.decode(e,e.uint32()));break;case 3:r.unknownRank=e.bool();break;default:e.skipType(7&a)}}return r},e.Dim=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.size=gc.Long?gc.Long.fromBits(0,0,!1):0,e.prototype.name="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.TensorShape.Dim;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.size=e.int64();break;case 2:r.name=e.string();break;default:e.skipType(7&a)}}return r},e}(),e}(),e.Tensor=function(){function e(e){if(this.floatVal=[],this.doubleVal=[],this.intVal=[],this.stringVal=[],this.scomplexVal=[],this.int64Val=[],this.boolVal=[],this.uint32Val=[],this.uint64Val=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.dtype=0,e.prototype.tensorShape=null,e.prototype.versionNumber=0,e.prototype.tensorContent=gc.newBuffer([]),e.prototype.floatVal=gc.emptyArray,e.prototype.doubleVal=gc.emptyArray,e.prototype.intVal=gc.emptyArray,e.prototype.stringVal=gc.emptyArray,e.prototype.scomplexVal=gc.emptyArray,e.prototype.int64Val=gc.emptyArray,e.prototype.boolVal=gc.emptyArray,e.prototype.uint32Val=gc.emptyArray,e.prototype.uint64Val=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.Tensor;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.dtype=e.int32();break;case 2:r.tensorShape=yc.tensorflow.TensorShape.decode(e,e.uint32());break;case 3:r.versionNumber=e.int32();break;case 4:r.tensorContent=e.bytes();break;case 5:if(r.floatVal&&r.floatVal.length||(r.floatVal=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos<o;)r.floatVal.push(e.float());else r.floatVal.push(e.float());break;case 6:if(r.doubleVal&&r.doubleVal.length||(r.doubleVal=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.doubleVal.push(e.double());else r.doubleVal.push(e.double());break;case 7:if(r.intVal&&r.intVal.length||(r.intVal=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.intVal.push(e.int32());else r.intVal.push(e.int32());break;case 8:r.stringVal&&r.stringVal.length||(r.stringVal=[]),r.stringVal.push(e.bytes());break;case 9:if(r.scomplexVal&&r.scomplexVal.length||(r.scomplexVal=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.scomplexVal.push(e.float());else r.scomplexVal.push(e.float());break;case 10:if(r.int64Val&&r.int64Val.length||(r.int64Val=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.int64Val.push(e.int64());else r.int64Val.push(e.int64());break;case 11:if(r.boolVal&&r.boolVal.length||(r.boolVal=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.boolVal.push(e.bool());else r.boolVal.push(e.bool());break;case 16:if(r.uint32Val&&r.uint32Val.length||(r.uint32Val=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.uint32Val.push(e.uint32());else r.uint32Val.push(e.uint32());break;case 17:if(r.uint64Val&&r.uint64Val.length||(r.uint64Val=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.uint64Val.push(e.uint64());else r.uint64Val.push(e.uint64());break;default:e.skipType(7&a)}}return r},e}(),e.AttrValue=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}let t;return e.prototype.list=null,e.prototype.s=gc.newBuffer([]),e.prototype.i=gc.Long?gc.Long.fromBits(0,0,!1):0,e.prototype.f=0,e.prototype.b=!1,e.prototype.type=0,e.prototype.shape=null,e.prototype.tensor=null,e.prototype.placeholder="",e.prototype.func=null,Object.defineProperty(e.prototype,"value",{get:gc.oneOfGetter(t=["list","s","i","f","b","type","shape","tensor","placeholder","func"]),set:gc.oneOfSetter(t)}),e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.AttrValue;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.list=yc.tensorflow.AttrValue.ListValue.decode(e,e.uint32());break;case 2:r.s=e.bytes();break;case 3:r.i=e.int64();break;case 4:r.f=e.float();break;case 5:r.b=e.bool();break;case 6:r.type=e.int32();break;case 7:r.shape=yc.tensorflow.TensorShape.decode(e,e.uint32());break;case 8:r.tensor=yc.tensorflow.Tensor.decode(e,e.uint32());break;case 9:r.placeholder=e.string();break;case 10:r.func=yc.tensorflow.NameAttrList.decode(e,e.uint32());break;default:e.skipType(7&a)}}return r},e.ListValue=function(){function e(e){if(this.s=[],this.i=[],this.f=[],this.b=[],this.type=[],this.shape=[],this.tensor=[],this.func=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.s=gc.emptyArray,e.prototype.i=gc.emptyArray,e.prototype.f=gc.emptyArray,e.prototype.b=gc.emptyArray,e.prototype.type=gc.emptyArray,e.prototype.shape=gc.emptyArray,e.prototype.tensor=gc.emptyArray,e.prototype.func=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.AttrValue.ListValue;e.pos<n;){var a=e.uint32();switch(a>>>3){case 2:r.s&&r.s.length||(r.s=[]),r.s.push(e.bytes());break;case 3:if(r.i&&r.i.length||(r.i=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos<o;)r.i.push(e.int64());else r.i.push(e.int64());break;case 4:if(r.f&&r.f.length||(r.f=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.f.push(e.float());else r.f.push(e.float());break;case 5:if(r.b&&r.b.length||(r.b=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.b.push(e.bool());else r.b.push(e.bool());break;case 6:if(r.type&&r.type.length||(r.type=[]),2==(7&a))for(o=e.uint32()+e.pos;e.pos<o;)r.type.push(e.int32());else r.type.push(e.int32());break;case 7:r.shape&&r.shape.length||(r.shape=[]),r.shape.push(yc.tensorflow.TensorShape.decode(e,e.uint32()));break;case 8:r.tensor&&r.tensor.length||(r.tensor=[]),r.tensor.push(yc.tensorflow.Tensor.decode(e,e.uint32()));break;case 9:r.func&&r.func.length||(r.func=[]),r.func.push(yc.tensorflow.NameAttrList.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return r},e}(),e}(),e.NameAttrList=function(){function e(e){if(this.attr={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.attr=gc.emptyObject,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n,r=void 0===t?e.len:e.pos+t,a=new yc.tensorflow.NameAttrList;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:a.name=e.string();break;case 2:e.skip().pos++,a.attr===gc.emptyObject&&(a.attr={}),n=e.string(),e.pos++,a.attr[n]=yc.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return a},e}(),e.NodeDef=function(){function e(e){if(this.input=[],this.attr={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.op="",e.prototype.input=gc.emptyArray,e.prototype.device="",e.prototype.attr=gc.emptyObject,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n,r=void 0===t?e.len:e.pos+t,a=new yc.tensorflow.NodeDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:a.name=e.string();break;case 2:a.op=e.string();break;case 3:a.input&&a.input.length||(a.input=[]),a.input.push(e.string());break;case 4:a.device=e.string();break;case 5:e.skip().pos++,a.attr===gc.emptyObject&&(a.attr={}),n=e.string(),e.pos++,a.attr[n]=yc.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return a},e}(),e.VersionDef=function(){function e(e){if(this.badConsumers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.producer=0,e.prototype.minConsumer=0,e.prototype.badConsumers=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.VersionDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.producer=e.int32();break;case 2:r.minConsumer=e.int32();break;case 3:if(r.badConsumers&&r.badConsumers.length||(r.badConsumers=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos<o;)r.badConsumers.push(e.int32());else r.badConsumers.push(e.int32());break;default:e.skipType(7&a)}}return r},e}(),e.GraphDef=function(){function e(e){if(this.node=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.node=gc.emptyArray,e.prototype.versions=null,e.prototype.library=null,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.GraphDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.node&&r.node.length||(r.node=[]),r.node.push(yc.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:r.versions=yc.tensorflow.VersionDef.decode(e,e.uint32());break;case 2:r.library=yc.tensorflow.FunctionDefLibrary.decode(e,e.uint32());break;default:e.skipType(7&a)}}return r},e}(),e.CollectionDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}let t;return e.prototype.nodeList=null,e.prototype.bytesList=null,e.prototype.int64List=null,e.prototype.floatList=null,e.prototype.anyList=null,Object.defineProperty(e.prototype,"kind",{get:gc.oneOfGetter(t=["nodeList","bytesList","int64List","floatList","anyList"]),set:gc.oneOfSetter(t)}),e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.CollectionDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.nodeList=yc.tensorflow.CollectionDef.NodeList.decode(e,e.uint32());break;case 2:r.bytesList=yc.tensorflow.CollectionDef.BytesList.decode(e,e.uint32());break;case 3:r.int64List=yc.tensorflow.CollectionDef.Int64List.decode(e,e.uint32());break;case 4:r.floatList=yc.tensorflow.CollectionDef.FloatList.decode(e,e.uint32());break;case 5:r.anyList=yc.tensorflow.CollectionDef.AnyList.decode(e,e.uint32());break;default:e.skipType(7&a)}}return r},e.NodeList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.CollectionDef.NodeList;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(e.string());break;default:e.skipType(7&a)}}return r},e}(),e.BytesList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.CollectionDef.BytesList;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(e.bytes());break;default:e.skipType(7&a)}}return r},e}(),e.Int64List=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.CollectionDef.Int64List;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos<o;)r.value.push(e.int64());else r.value.push(e.int64());break;default:e.skipType(7&a)}}return r},e}(),e.FloatList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.CollectionDef.FloatList;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&a))for(var o=e.uint32()+e.pos;e.pos<o;)r.value.push(e.float());else r.value.push(e.float());break;default:e.skipType(7&a)}}return r},e}(),e.AnyList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.CollectionDef.AnyList;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(yc.tensorflow.Any.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return r},e}(),e}(),e.SaverDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.filenameTensorName="",e.prototype.saveTensorName="",e.prototype.restoreOpName="",e.prototype.maxToKeep=0,e.prototype.sharded=!1,e.prototype.keepCheckpointEveryNHours=0,e.prototype.version=0,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.SaverDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.filenameTensorName=e.string();break;case 2:r.saveTensorName=e.string();break;case 3:r.restoreOpName=e.string();break;case 4:r.maxToKeep=e.int32();break;case 5:r.sharded=e.bool();break;case 6:r.keepCheckpointEveryNHours=e.float();break;case 7:r.version=e.int32();break;default:e.skipType(7&a)}}return r},e.CheckpointFormatVersion=function(){const e={},t=Object.create(e);return t[e[0]="LEGACY"]=0,t[e[1]="V1"]=1,t[e[2]="V2"]=2,t}(),e}(),e.TensorInfo=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}let t;return e.prototype.name="",e.prototype.cooSparse=null,e.prototype.dtype=0,e.prototype.tensorShape=null,Object.defineProperty(e.prototype,"encoding",{get:gc.oneOfGetter(t=["name","cooSparse"]),set:gc.oneOfSetter(t)}),e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.TensorInfo;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.name=e.string();break;case 4:r.cooSparse=yc.tensorflow.TensorInfo.CooSparse.decode(e,e.uint32());break;case 2:r.dtype=e.int32();break;case 3:r.tensorShape=yc.tensorflow.TensorShape.decode(e,e.uint32());break;default:e.skipType(7&a)}}return r},e.CooSparse=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.valuesTensorName="",e.prototype.indicesTensorName="",e.prototype.denseShapeTensorName="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.TensorInfo.CooSparse;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.valuesTensorName=e.string();break;case 2:r.indicesTensorName=e.string();break;case 3:r.denseShapeTensorName=e.string();break;default:e.skipType(7&a)}}return r},e}(),e}(),e.SignatureDef=function(){function e(e){if(this.inputs={},this.outputs={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.inputs=gc.emptyObject,e.prototype.outputs=gc.emptyObject,e.prototype.methodName="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n,r=void 0===t?e.len:e.pos+t,a=new yc.tensorflow.SignatureDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:e.skip().pos++,a.inputs===gc.emptyObject&&(a.inputs={}),n=e.string(),e.pos++,a.inputs[n]=yc.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:e.skip().pos++,a.outputs===gc.emptyObject&&(a.outputs={}),n=e.string(),e.pos++,a.outputs[n]=yc.tensorflow.TensorInfo.decode(e,e.uint32());break;case 3:a.methodName=e.string();break;default:e.skipType(7&o)}}return a},e}(),e.AssetFileDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.tensorInfo=null,e.prototype.filename="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.AssetFileDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.tensorInfo=yc.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:r.filename=e.string();break;default:e.skipType(7&a)}}return r},e}(),e.OpDef=function(){function e(e){if(this.inputArg=[],this.outputArg=[],this.attr=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.inputArg=gc.emptyArray,e.prototype.outputArg=gc.emptyArray,e.prototype.attr=gc.emptyArray,e.prototype.deprecation=null,e.prototype.summary="",e.prototype.description="",e.prototype.isCommutative=!1,e.prototype.isAggregate=!1,e.prototype.isStateful=!1,e.prototype.allowsUninitializedInput=!1,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.OpDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.name=e.string();break;case 2:r.inputArg&&r.inputArg.length||(r.inputArg=[]),r.inputArg.push(yc.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 3:r.outputArg&&r.outputArg.length||(r.outputArg=[]),r.outputArg.push(yc.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 4:r.attr&&r.attr.length||(r.attr=[]),r.attr.push(yc.tensorflow.OpDef.AttrDef.decode(e,e.uint32()));break;case 8:r.deprecation=yc.tensorflow.OpDef.OpDeprecation.decode(e,e.uint32());break;case 5:r.summary=e.string();break;case 6:r.description=e.string();break;case 18:r.isCommutative=e.bool();break;case 16:r.isAggregate=e.bool();break;case 17:r.isStateful=e.bool();break;case 19:r.allowsUninitializedInput=e.bool();break;default:e.skipType(7&a)}}return r},e.ArgDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.description="",e.prototype.type=0,e.prototype.typeAttr="",e.prototype.numberAttr="",e.prototype.typeListAttr="",e.prototype.isRef=!1,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.OpDef.ArgDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.name=e.string();break;case 2:r.description=e.string();break;case 3:r.type=e.int32();break;case 4:r.typeAttr=e.string();break;case 5:r.numberAttr=e.string();break;case 6:r.typeListAttr=e.string();break;case 16:r.isRef=e.bool();break;default:e.skipType(7&a)}}return r},e}(),e.AttrDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.type="",e.prototype.defaultValue=null,e.prototype.description="",e.prototype.hasMinimum=!1,e.prototype.minimum=gc.Long?gc.Long.fromBits(0,0,!1):0,e.prototype.allowedValues=null,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.OpDef.AttrDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.name=e.string();break;case 2:r.type=e.string();break;case 3:r.defaultValue=yc.tensorflow.AttrValue.decode(e,e.uint32());break;case 4:r.description=e.string();break;case 5:r.hasMinimum=e.bool();break;case 6:r.minimum=e.int64();break;case 7:r.allowedValues=yc.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&a)}}return r},e}(),e.OpDeprecation=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.version=0,e.prototype.explanation="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.OpDef.OpDeprecation;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.version=e.int32();break;case 2:r.explanation=e.string();break;default:e.skipType(7&a)}}return r},e}(),e}(),e.OpList=function(){function e(e){if(this.op=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.op=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.OpList;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.op&&r.op.length||(r.op=[]),r.op.push(yc.tensorflow.OpDef.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return r},e}(),e.MetaGraphDef=function(){function e(e){if(this.collectionDef={},this.signatureDef={},this.assetFileDef=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.metaInfoDef=null,e.prototype.graphDef=null,e.prototype.saverDef=null,e.prototype.collectionDef=gc.emptyObject,e.prototype.signatureDef=gc.emptyObject,e.prototype.assetFileDef=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n,r=void 0===t?e.len:e.pos+t,a=new yc.tensorflow.MetaGraphDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:a.metaInfoDef=yc.tensorflow.MetaGraphDef.MetaInfoDef.decode(e,e.uint32());break;case 2:a.graphDef=yc.tensorflow.GraphDef.decode(e,e.uint32());break;case 3:a.saverDef=yc.tensorflow.SaverDef.decode(e,e.uint32());break;case 4:e.skip().pos++,a.collectionDef===gc.emptyObject&&(a.collectionDef={}),n=e.string(),e.pos++,a.collectionDef[n]=yc.tensorflow.CollectionDef.decode(e,e.uint32());break;case 5:e.skip().pos++,a.signatureDef===gc.emptyObject&&(a.signatureDef={}),n=e.string(),e.pos++,a.signatureDef[n]=yc.tensorflow.SignatureDef.decode(e,e.uint32());break;case 6:a.assetFileDef&&a.assetFileDef.length||(a.assetFileDef=[]),a.assetFileDef.push(yc.tensorflow.AssetFileDef.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return a},e.MetaInfoDef=function(){function e(e){if(this.tags=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.metaGraphVersion="",e.prototype.strippedOpList=null,e.prototype.anyInfo=null,e.prototype.tags=gc.emptyArray,e.prototype.tensorflowVersion="",e.prototype.tensorflowGitVersion="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.MetaGraphDef.MetaInfoDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.metaGraphVersion=e.string();break;case 2:r.strippedOpList=yc.tensorflow.OpList.decode(e,e.uint32());break;case 3:r.anyInfo=yc.tensorflow.Any.decode(e,e.uint32());break;case 4:r.tags&&r.tags.length||(r.tags=[]),r.tags.push(e.string());break;case 5:r.tensorflowVersion=e.string();break;case 6:r.tensorflowGitVersion=e.string();break;default:e.skipType(7&a)}}return r},e}(),e}(),e.SavedModel=function(){function e(e){if(this.metaGraphs=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.savedModelSchemaVersion=gc.Long?gc.Long.fromBits(0,0,!1):0,e.prototype.metaGraphs=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.SavedModel;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.savedModelSchemaVersion=e.int64();break;case 2:r.metaGraphs&&r.metaGraphs.length||(r.metaGraphs=[]),r.metaGraphs.push(yc.tensorflow.MetaGraphDef.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return r},e}(),e.FunctionDefLibrary=function(){function e(e){if(this.function=[],this.gradient=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.function=gc.emptyArray,e.prototype.gradient=gc.emptyArray,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.FunctionDefLibrary;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.function&&r.function.length||(r.function=[]),r.function.push(yc.tensorflow.FunctionDef.decode(e,e.uint32()));break;case 2:r.gradient&&r.gradient.length||(r.gradient=[]),r.gradient.push(yc.tensorflow.GradientDef.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return r},e}(),e.FunctionDef=function(){function e(e){if(this.attr={},this.nodeDef=[],this.ret={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.signature=null,e.prototype.attr=gc.emptyObject,e.prototype.nodeDef=gc.emptyArray,e.prototype.ret=gc.emptyObject,e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n,r=void 0===t?e.len:e.pos+t,a=new yc.tensorflow.FunctionDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:a.signature=yc.tensorflow.OpDef.decode(e,e.uint32());break;case 5:e.skip().pos++,a.attr===gc.emptyObject&&(a.attr={}),n=e.string(),e.pos++,a.attr[n]=yc.tensorflow.AttrValue.decode(e,e.uint32());break;case 3:a.nodeDef&&a.nodeDef.length||(a.nodeDef=[]),a.nodeDef.push(yc.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:e.skip().pos++,a.ret===gc.emptyObject&&(a.ret={}),n=e.string(),e.pos++,a.ret[n]=e.string();break;default:e.skipType(7&o)}}return a},e}(),e.GradientDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.functionName="",e.prototype.gradientFunc="",e.decode=function(e,t){e instanceof mc||(e=mc.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new yc.tensorflow.GradientDef;e.pos<n;){var a=e.uint32();switch(a>>>3){case 1:r.functionName=e.string();break;case 2:r.gradientFunc=e.string();break;default:e.skipType(7&a)}}return r},e}(),e})();function bc(e,t,n,r){var a=t.params[e];if(a&&void 0!==a.inputIndex){if("tensor"===a.type)return wc(t.inputNames[a.inputIndex],n,r);if("tensors"===a.type)return(0===a.inputIndex?0===a.inputParamLength?t.inputNames:t.inputNames.slice(a.inputIndex,-a.inputParamLength):t.inputNames.splice(a.inputIndex)).map(function(e){return wc(e,n,r)});var o=Array.prototype.slice.call(wc(t.inputNames.slice(a.inputIndex)[0],n,r).dataSync());return"number"===a.type?o[0]:o}return a&&a.value}function wc(e,t,n){var r=Oc(e),a=r[0],o=r[1],i=n.currentContextIds.find(function(e){return!!t[kc(a,e)]});return void 0!==i?t[kc(a,i)][o]:void 0}function xc(e,t){var n=Oc(e),r=n[0],a=n[1];return[kc(r,t&&t.currentContextId),a]}function kc(e,t){return t?e+"-"+t:e}function Oc(e){var t=e.lastIndexOf(":");return-1===t?[e,0]:[e.substring(0,t),Number(e.substring(t+1))]}var Sc=n(239),Nc=Object.assign({},Sc,{default:Sc}),Ec=n(238),Ic=Object.assign({},Ec,{default:Ec}),Tc=n(237),Ac=Object.assign({},Tc,{default:Tc}),Cc=n(236),Pc=Object.assign({},Cc,{default:Cc}),_c=n(235),Rc=Object.assign({},_c,{default:_c}),Mc=n(234),jc=Object.assign({},Mc,{default:Mc}),Dc=n(233),Lc=Object.assign({},Dc,{default:Dc}),zc=n(232),Fc=Object.assign({},zc,{default:zc}),Bc=n(231),Vc=Object.assign({},Bc,{default:Bc}),Uc=n(230),Wc=Object.assign({},Uc,{default:Uc}),Gc=n(229),qc=Object.assign({},Gc,{default:Gc}),Hc=n(228),Kc=Object.assign({},Hc,{default:Hc}),Xc=n(227),Jc=Object.assign({},Xc,{default:Xc}),Yc=["Switch","Merge","Enter","Exit","NextIteration"],Qc=function(){function e(){var e=[Nc,Ic,Ac,Pc,Rc,Fc,Lc,jc,Vc,Wc,qc,Kc,Jc],t=[].concat.apply([],e.map(function(e){return e.default?e.default:e}));this.opMappers=t.reduce(function(e,t){return e[t.tfOpName]=t,e},{})}return Object.defineProperty(e,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),e.prototype.isControlFlow=function(e){return Yc.some(function(t){return t===e.op})},e.prototype.transformGraph=function(e){var t=this,n=!1,r=[],a=e.node.reduce(function(e,a){return e[a.name]=t.mapNode(a),t.isControlFlow(a)&&(n=!0),"Placeholder"===a.op&&r.push(e[a.name]),e},{}),o=[],i=[];return Object.keys(a).forEach(function(e){var t=a[e];t.inputNames.forEach(function(e){var n=xc(e)[0];t.inputs.push(a[n]),a[n].children.push(t)}),0===t.inputs.length&&o.push(t)}),Object.keys(a).forEach(function(e){var t=a[e];0===t.children.length&&i.push(t)}),{nodes:a,inputs:o,outputs:i,placeholders:r,withControlFlow:n}},e.prototype.mapNode=function(e){var t=this,n=this.opMappers[e.op];if(void 0===n)throw new Error("Tensorflow Op is not supported: "+e.op);var r={name:e.name,op:n.dlOpName,category:n.category,inputNames:(e.input||[]).map(function(e){return e.startsWith("^")?e.substr(1):e}),inputs:[],children:[],params:{}};return n.params&&(r.params=n.params.reduce(function(n,r){var a=r.tfInputIndex,o=r.tfInputParamLength,i=r.type,s=void 0;if(void 0===a)switch(r.type){case"string":void 0===(s=t.getStringParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getStringParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"number":void 0===(s=t.getNumberParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getNumberParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"number[]":void 0===(s=t.getNumericArrayParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getNumericArrayParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"bool":void 0===(s=t.getBoolParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getBoolParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"shape":void 0===(s=t.getTensorShapeParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getTensorShapeParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"dtype":void 0===(s=t.getDtypeParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getDtypeParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+r.type+" for op: "+e.op)}return n[r.dlParamName]={value:s,inputIndex:a,type:i,inputParamLength:o},n},{})),r},e.prototype.getStringParam=function(e,t,n,r){void 0===r&&(r=!1);var a=e[t];if(void 0!==a){var o=String.fromCharCode.apply(null,a.s);return r?o:o.toLowerCase()}return n},e.prototype.getBoolParam=function(e,t,n){var r=e[t];return r?r.b:n},e.prototype.getNumberParam=function(e,t,n){var r=e[t],a=r?void 0!==r.f?r.f:r.i:n;return"number"==typeof a?a:a.toInt()},e.prototype.getDtypeParam=function(e,t,n){var r=e[t];if(r&&r.type)switch(r.type){case vc.DataType.DT_FLOAT:return"float32";case vc.DataType.DT_INT32:return"int32";case vc.DataType.DT_BOOL:return"bool";default:return n}return n},e.prototype.getTensorShapeParam=function(e,t,n){var r=e[t];return r&&r.shape?r.shape.dim.map(function(e){return e.size}):n},e.prototype.getNumericArrayParam=function(e,t,n){var r=e[t];return r?(r.list.f&&r.list.f.length?r.list.f:r.list.i).map(function(e){return"number"==typeof e?e:e.toInt()}):n},e}(),Zc=function(e,t,n){switch(e.op){case"add":return[f.d(bc("a",e,t,n),bc("b",e,t,n))];case"mod":return[f.eb(bc("a",e,t,n),bc("b",e,t,n))];case"mul":return[f.ib(bc("a",e,t,n),bc("b",e,t,n))];case"div":return[f.J(bc("a",e,t,n),bc("b",e,t,n))];case"sub":return[f.pc(bc("a",e,t,n),bc("b",e,t,n))];case"minimum":return[f.cb(bc("a",e,t,n),bc("b",e,t,n))];case"maximum":return[f.Ya(bc("a",e,t,n),bc("b",e,t,n))];case"pow":return[f.Ab(bc("a",e,t,n),bc("b",e,t,n))];case"squaredDifference":return[f.jc(bc("a",e,t,n),bc("b",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},$c=function(e,t,n){switch(e.op){case"abs":return[f.a(bc("x",e,t,n))];case"acos":return[f.b(bc("x",e,t,n))];case"acosh":return[f.c(bc("x",e,t,n))];case"asin":return[f.h(bc("x",e,t,n))];case"asinh":return[f.i(bc("x",e,t,n))];case"atan":return[f.j(bc("x",e,t,n))];case"atanh":return[f.l(bc("x",e,t,n))];case"ceil":return[f.u(bc("x",e,t,n))];case"cos":return[f.F(bc("x",e,t,n))];case"cosh":return[f.G(bc("x",e,t,n))];case"elu":return[f.M(bc("x",e,t,n))];case"erf":return[f.P(bc("x",e,t,n))];case"exp":return[f.Q(bc("x",e,t,n))];case"expm1":return[f.S(bc("x",e,t,n))];case"floor":return[f.V(bc("x",e,t,n))];case"log":return[f.La(bc("x",e,t,n))];case"log1p":return[f.Ma(bc("x",e,t,n))];case"neg":return[f.mb(bc("x",e,t,n))];case"reciprocal":return[f.Ib(bc("x",e,t,n))];case"relu":return[f.Jb(bc("x",e,t,n))];case"round":return[f.Qb(bc("x",e,t,n))];case"selu":return[f.Tb(bc("x",e,t,n))];case"sigmoid":return[f.Vb(bc("x",e,t,n))];case"sin":return[f.Xb(bc("x",e,t,n))];case"sign":return[f.Wb(bc("x",e,t,n))];case"sinh":return[f.Yb(bc("x",e,t,n))];case"softplus":return[f.fc(bc("x",e,t,n))];case"sqrt":return[f.hc(bc("x",e,t,n))];case"square":return[f.ic(bc("x",e,t,n))];case"tanh":return[f.tc(bc("x",e,t,n))];case"tan":return[f.sc(bc("x",e,t,n))];case"clipByValue":return[f.v(bc("x",e,t,n),bc("clipValueMin",e,t,n),bc("clipValueMax",e,t,n))];case"rsqrt":return[f.J(f.Sb(1,"float32"),f.hc(wc(e.inputNames[0],t,n)))];default:throw TypeError("Node type "+e.op+" is not implemented")}},el=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},tl=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},nl=function(e,t,n){switch(e.op){case"conv1d":var r=bc("stride",e,t,n),a=bc("pad",e,t,n),o=bc("dataFormat",e,t,n).toUpperCase(),i=bc("dilation",e,t,n);return[f.C(bc("x",e,t,n),bc("filter",e,t,n),r,a,o,i)];case"conv2d":r=bc("strides",e,t,n),a=bc("pad",e,t,n),o=bc("dataFormat",e,t,n).toUpperCase();var s=bc("dilations",e,t,n);return[f.D(bc("x",e,t,n),bc("filter",e,t,n),[r[1],r[2]],a,o,[s[0],s[1]])];case"conv2dTranspose":var u=bc("outputShape",e,t,n);return r=bc("strides",e,t,n),a=bc("pad",e,t,n),[f.E(bc("x",e,t,n),bc("filter",e,t,n),u,[r[1],r[2]],a)];case"depthwiseConv2d":return r=bc("strides",e,t,n),a=bc("pad",e,t,n),s=bc("dilations",e,t,n),o=bc("dataFormat",e,t,n).toUpperCase(),[f.I(bc("input",e,t,n),bc("filter",e,t,n),[r[1],r[2]],a,o,[s[0],s[1]])];case"avgPool":r=bc("strides",e,t,n),a=bc("pad",e,t,n);var c=bc("kernelSize",e,t,n);return[f.m(bc("x",e,t,n),[c[1],c[2]],[r[1],r[2]],a)];case"maxPool":return r=bc("strides",e,t,n),a=bc("pad",e,t,n),c=bc("kernelSize",e,t,n),[f.Xa(bc("x",e,t,n),[c[1],c[2]],[r[1],r[2]],a)];default:throw TypeError("Node type "+e.op+" is not implemented")}},rl=function(e,t,n){switch(e.op){case"fill":var r=bc("shape",e,t,n),a=bc("value",e,t,n);return[f.U(r,a)];case"linspace":var o=bc("start",e,t,n),i=bc("stop",e,t,n),s=bc("num",e,t,n);return[f.Ja(o,i,s)];case"oneHot":var u=bc("indices",e,t,n),c=bc("depth",e,t,n),l=bc("onValue",e,t,n),p=bc("offValue",e,t,n);return[f.qb(u,c,l,p)];case"ones":return[f.rb(bc("shape",e,t,n),bc("dtype",e,t,n))];case"onesLike":return[f.sb(bc("x",e,t,n))];case"randomUniform":return[f.Gb(bc("shape",e,t,n),bc("minval",e,t,n),bc("maxval",e,t,n),bc("dtype",e,t,n))];case"range":o=bc("start",e,t,n);var h=bc("stop",e,t,n),d=bc("step",e,t,n);return[f.Hb(o,h,d,bc("dtype",e,t,n))];case"truncatedNormal":r=bc("shape",e,t,n);var m=bc("mean",e,t,n),g=bc("stdDev",e,t,n),y=bc("seed",e,t,n);return[f.Cc(r,m,g,bc("dtype",e,t,n),y)];case"zeros":return[f.Hc(bc("shape",e,t,n),bc("dtype",e,t,n))];case"zerosLike":return[f.Ic(bc("x",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},al=function(e,t,n){switch(e.op){case"const":return t[e.name];case"placeholder":var r=bc("default",e,t,n);return[wc(e.name,t,n)||r];case"identity":case"stopGradient":case"fakeQuantWithMinMaxVars":return[bc("x",e,t,n)];case"snapshot":return[bc("x",e,t,n).clone()];case"shape":return[f.vc(bc("x",e,t,n).shape,"int32")];case"noop":return[];case"print":var a=bc("x",e,t,n),o=bc("data",e,t,n),i=bc("message",e,t,n),s=bc("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(i);for(var u=0;u<o.length;u++)console.log(Array.prototype.slice.call(o[0].dataSync()).slice(0,s));return[a];default:throw TypeError("Node type "+e.op+" is not implemented")}},ol=function(e,t,n){switch(e.op){case"resizeBilinear":var r=bc("images",e,t,n),a=bc("size",e,t,n),o=bc("alignCorners",e,t,n);return[f.Ca.resizeBilinear(r,[a[0],a[1]],o)];case"resizeNearestNeighbor":return r=bc("images",e,t,n),a=bc("size",e,t,n),o=bc("alignCorners",e,t,n),[f.Ca.resizeNearestNeighbor(r,[a[0],a[1]],o)];default:throw TypeError("Node type "+e.op+" is not implemented")}},il=function(e,t,n){switch(e.op){case"equal":return[f.N(bc("a",e,t,n),bc("b",e,t,n))];case"notEqual":return[f.ob(bc("a",e,t,n),bc("b",e,t,n))];case"greater":return[f.Y(bc("a",e,t,n),bc("b",e,t,n))];case"greaterEqual":return[f.Z(bc("a",e,t,n),bc("b",e,t,n))];case"less":return[f.Ea(bc("a",e,t,n),bc("b",e,t,n))];case"lessEqual":return[f.Fa(bc("a",e,t,n),bc("b",e,t,n))];case"logicalAnd":return[f.Pa(bc("a",e,t,n),bc("b",e,t,n))];case"logicalNot":return[f.Qa(bc("a",e,t,n))];case"logicalOr":return[f.Ra(bc("a",e,t,n),bc("b",e,t,n))];case"where":return[f.Gc(bc("condition",e,t,n),bc("a",e,t,n),bc("b",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},sl=function(e,t,n){switch(e.op){case"matMul":return[f.Ua(bc("a",e,t,n),bc("b",e,t,n),bc("transposeA",e,t,n),bc("transposeB",e,t,n))];case"transpose":return[f.Bc(bc("x",e,t,n),bc("perm",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},ul=function(e,t,n){switch(e.op){case"batchNormalization":return[f.o(bc("x",e,t,n),bc("mean",e,t,n),bc("variance",e,t,n),bc("epsilon",e,t,n),bc("scale",e,t,n),bc("offset",e,t,n))];case"localResponseNormalization":return[f.Ka(bc("x",e,t,n),bc("radius",e,t,n),bc("bias",e,t,n),bc("alpha",e,t,n),bc("beta",e,t,n))];case"softmax":return[f.ec(bc("x",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},cl=function(e,t,n){switch(e.op){case"max":var r=bc("axis",e,t,n),a=bc("keepDims",e,t,n);return[f.Wa(bc("x",e,t,n),r,a)];case"mean":return r=bc("axis",e,t,n),a=bc("keepDims",e,t,n),[f.ab(bc("x",e,t,n),r,a)];case"min":return r=bc("axis",e,t,n),a=bc("keepDims",e,t,n),[f.bb(bc("x",e,t,n),r,a)];case"sum":return r=bc("axis",e,t,n),a=bc("keepDims",e,t,n),[f.rc(bc("x",e,t,n),r,a)];case"argMax":return r=bc("axis",e,t,n),[f.f(bc("x",e,t,n),r)];case"argMin":return r=bc("axis",e,t,n),[f.g(bc("x",e,t,n),r)];default:throw TypeError("Node type "+e.op+" is not implemented")}},ll=function(e,t,n){switch(e.op){case"concat":var r=bc("axis",e,t,n),a=bc("tensors",e,t,n);return[f.x(a,r)];case"gather":r=bc("axis",e,t,n);var o=bc("x",e,t,n),i=bc("indices",e,t,n);return[f.X(o,i,r)];case"reverse":return r=bc("axis",e,t,n),o=bc("x",e,t,n),[f.Lb(o,r)];case"slice":var s=bc("begin",e,t,n),u=bc("size",e,t,n);return[f.Zb(bc("x",e,t,n),s,u)];case"stridedSlice":s=bc("begin",e,t,n);var c=bc("end",e,t,n),l=bc("strides",e,t,n),p=bc("beginMask",e,t,n),h=bc("endMask",e,t,n);return[f.oc(bc("x",e,t,n),s,c,l,p,h)];case"stack":return vr.f(function(){var r=bc("axis",e,t,n),a=bc("tensors",e,t,n),o=a[0].shape,i=a[0].squeeze().shape,s=a.map(function(e){var t=y.arraysEqual(e.shape,o);if(!t&&!y.arraysEqual(e.squeeze().shape,i))throw new Error("the input tensors shape does not match");return t?e:e.reshape(o)});return[f.mc(s,r)]});case"tile":var d=bc("reps",e,t,n);return[f.zc(bc("x",e,t,n),d)];case"split":r=bc("axis",e,t,n);var m=bc("numOrSizeSplits",e,t,n);return f.gc(bc("x",e,t,n),m,r);default:throw TypeError("Node type "+e.op+" is not implemented")}},fl=function(e,t,n){switch(e.op){case"cast":return[f.t(bc("x",e,t,n),bc("dtype",e,t,n))];case"expandDims":var r=e.params.axis.value;return[f.R(bc("x",e,t,n),r)];case"squeeze":return r=e.params.axis.value,[f.lc(bc("x",e,t,n),r)];case"reshape":return[f.Kb(bc("x",e,t,n),bc("shape",e,t,n))];case"pad":return[f.vb(bc("x",e,t,n),function(e,t){for(var n=[],r=0;r<e.length;r+=2)n.push(e.slice(r,r+2));return n}(bc("padding",e,t,n)),bc("constantValue",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}};function pl(e,t,n){switch(e.category){case"arithmetic":return Zc(e,t,n);case"basic_math":return $c(e,t,n);case"control":return function(e,t,n){return el(this,void 0,void 0,function(){var r,a,o,i,s,u,c;return tl(this,function(l){switch(l.label){case 0:switch(e.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]}return[3,8];case 1:return[2,[bc("pred",e,t,n)]];case 2:return r=bc("pred",e,t,n),a=bc("data",e,t,n),[4,r.data()];case 3:return[2,l.sent()[0]?[void 0,a]:[a,void 0]];case 4:return[2,(o=e.inputNames.find(function(e){return void 0!==wc(e,t,n)}))?[wc(o,t,n)]:void 0];case 5:return i=bc("frameName",e,t,n),s=bc("tensor",e,t,n),n.enterFrame(i),[2,[s]];case 6:return u=bc("tensor",e,t,n),n.exitFrame(),[2,[u]];case 7:return c=bc("tensor",e,t,n),n.nextIteration(),[2,[c]];case 8:throw TypeError("Node type "+e.op+" is not implemented")}})})}(e,t,n);case"convolution":return nl(e,t,n);case"creation":return rl(e,t,n);case"image":return ol(e,t,n);case"graph":return al(e,t,n);case"logical":return il(e,t,n);case"matrices":return sl(e,t,n);case"normalization":return ul(e,t,n);case"reduction":return cl(e,t,n);case"slice_join":return ll(e,t,n);case"transformation":return fl(e,t,n);default:throw TypeError("Node type "+e.op+" is not implemented")}}var hl=function(){function e(e){this.weightMap=e,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return e.prototype.newFrame=function(e,t){return{id:e,frameName:t,iterationId:0}},Object.defineProperty(e.prototype,"currentContext",{get:function(){return this.contexts},set:function(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentContextId",{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentContextIds",{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),e.prototype.generateCurrentContextIds=function(){for(var e=[],t=0;t<this.contexts.length-1;t++){var n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e},e.prototype.contextIdforContexts=function(e){return e?e.map(function(e){return 0===e.id&&0===e.iterationId?"":e.frameName+"-"+e.iterationId}).join("/"):""},e.prototype.enterFrame=function(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},e.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()},e.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 e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},e.prototype.getWeight=function(e){return this.weightMap[e]},e}(),dl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ml=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},gl=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},yl=function(){function e(e){this.graph=e,this.compiledOrder=[],this._weightMap={},this.placeholders=e.placeholders.map(function(e){return e.name}),this.outputs=e.outputs.map(function(e){return e.name}),this.compile()}return Object.defineProperty(e.prototype,"weightMap",{get:function(){return this._weightMap},set:function(e){var t=Object.keys(e).map(function(t){return e[t].map(function(e){return e.id})});this.weightIds=[].concat.apply([],t),this._weightMap=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNodes",{get:function(){return this.placeholders},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputNodes",{get:function(){return this.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isControlFlowModel",{get:function(){return this.graph.withControlFlow},enumerable:!0,configurable:!0}),e.prototype.compile=function(){if(!this.graph.withControlFlow)for(var e=this.graph.inputs.slice(),t={};e.length>0;){var n=e.pop();t[n.name]=!0,this.compiledOrder.push(n),n.children.forEach(function(n){!t[n.name]&&n.inputNames.every(function(e){var n=xc(e)[0];return t[n]})&&e.push(n)})}},e.prototype.execute=function(e,t){var n=this;return this.checkInput(e),Object(vr.f)(function(){var r=new hl(n._weightMap),a=n.compiledOrder.reduce(function(e,t){return e[t.name]=pl(t,e,r),e},dl({},n.weightMap,e));return n.findOutputs(a,r,t)})},e.prototype.executeAsync=function(e,t){return ml(this,void 0,void 0,function(){var n,r,a,o,i,s,u=this;return gl(this,function(c){switch(c.label){case 0:return n=new hl(this._weightMap),[4,this.executeWithControlFlow(e,n)];case 1:return r=c.sent(),a=this.findOutputs(r,n,t),o=Object.keys(a).map(function(e){return a[e].id}),i=Object.keys(e).map(function(t){return e[t].map(function(e){return e.id})}),s=[].concat.apply([],i),Object.keys(r).forEach(function(e){r[e].forEach(function(e){e&&-1===o.indexOf(e.id)&&-1===s.indexOf(e.id)&&-1===u.weightIds.indexOf(e.id)&&e.dispose()})}),[2,a]}})})},e.prototype.executeWithControlFlow=function(e,t){return ml(this,void 0,void 0,function(){var n,r,a,o,i,s,u,c;return gl(this,function(l){switch(l.label){case 0:n=this.graph.inputs.map(function(e){return{node:e,contexts:t.currentContext}}),r=dl({},this.weightMap,e),a={},l.label=1;case 1:return n.length>0?(o=n.pop(),t.currentContext=o.contexts,i=pl(o.node,r,t),s=xc(o.node.name,t)[0],u=r,c=s,[4,i]):[3,3];case 2:return u[c]=l.sent(),o.node.children.forEach(function(e){var o=xc(e.name,t)[0];a[o]||("merge"===e.op?e.inputNames.some(function(e){return!!wc(e,r,t)})&&(a[o]=!0,n.push({contexts:t.currentContext,node:e})):e.inputNames.every(function(e){return!!wc(e,r,t)})&&(a[o]=!0,n.push({contexts:t.currentContext,node:e})))}),[3,1];case 3:return[2,r]}})})},e.prototype.findOutputs=function(e,t,n){return!n||n instanceof Array||(n=[n]),(n||this.graph.outputs.map(function(e){return e.name})).reduce(function(n,r){return n[r]=wc(r,e,t),n},{})},e.prototype.dispose=function(){var e=this;Object.keys(this.weightMap).forEach(function(t){return e.weightMap[t].forEach(function(e){return e.dispose()})})},e.prototype.checkInput=function(e){var t=this,n=Object.keys(e),r=[],a=[];if(this.placeholders.forEach(function(e){-1===n.indexOf(e)&&r.push(e)}),n.forEach(function(e){-1===t.placeholders.indexOf(e)&&a.push(e)}),r.length>0)throw new Error("The dict provided in model.execute(dict) has the keys ["+n+"], but is missing the required keys: ["+r+"].");if(a.length>0)throw new Error("The dict provided in model.execute(dict) has unused keys: ["+a+"]. Please provide only the following keys: ["+this.placeholders+"].")},e}(),vl=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},bl=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},wl=function(){function e(e,t,n){this.modelUrl=e,this.weightManifestUrl=t,this.requestOption=n,this.version="n/a",this.pathPrefix=this.getPathPrefix()}return Object.defineProperty(e.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),e.prototype.getPathPrefix=function(){var e=hc.parse(this.weightManifestUrl),t=e.pathname.split("/");return t.splice(-1),e.pathname=t.join("/"),hc.format(e)+"/"},e.prototype.loadRemoteProtoFile=function(){return vl(this,void 0,void 0,function(){var e,t,n,r,a;return bl(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,fetch(this.modelUrl,this.requestOption)];case 1:return e=o.sent(),n=(t=vc.GraphDef).decode,r=Uint8Array.bind,[4,e.arrayBuffer()];case 2:return[2,n.apply(t,[new(r.apply(Uint8Array,[void 0,o.sent()]))])];case 3:throw a=o.sent(),new Error(this.modelUrl+" not found. "+a);case 4:return[2]}})})},e.prototype.loadWeightManifest=function(){return vl(this,void 0,void 0,function(){var e,t,n;return bl(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,fetch(this.weightManifestUrl,this.requestOption)];case 1:return e=r.sent(),t=this,[4,e.clone().json()];case 2:return t.weightManifest=r.sent(),[3,4];case 3:throw n=r.sent(),new Error(this.weightManifestUrl+" not found. "+n);case 4:return[2]}})})},e.prototype.load=function(){return vl(this,void 0,void 0,function(){var e,t,n,r;return bl(this,function(a){switch(a.label){case 0:return e=this.loadRemoteProtoFile(),t=this.loadWeightManifest(),[4,Promise.all([e,t])];case 1:return n=a.sent()[0],this.version=n.versions.producer+"."+n.versions.minConsumer,[4,o.loadWeights(this.weightManifest,this.pathPrefix,void 0,this.requestOption)];case 2:return r=a.sent(),this.executor=new yl(Qc.Instance.transformGraph(n)),this.executor.weightMap=this.convertTensorMapToTensorsMap(r),[2,!0]}})})},e.prototype.predict=function(e,t){return this.execute(e,this.outputNodes)},e.prototype.constructTensorMap=function(e){var t=e instanceof m.a?[e]:e;if(t.length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the frozen 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},{})},e.prototype.execute=function(e,t){if(t=t||this.outputNodes,(e instanceof m.a||Array.isArray(e))&&(e=this.constructTensorMap(e)),this.executor.isControlFlowModel)throw new Error("The model contains control flow ops, please use executeAsync method");var n=this.executor.execute(this.convertTensorMapToTensorsMap(e),t),r=Object.keys(n);return Array.isArray(t)&&t.length>1?t.map(function(e){return n[e]}):n[r[0]]},e.prototype.executeAsync=function(e,t){return vl(this,void 0,void 0,function(){var n,r;return bl(this,function(a){switch(a.label){case 0:if(!this.executor.isControlFlowModel)throw new Error("The model does not contain control flow ops, please use execute method for better performance.");return t=t||this.outputNodes,(e instanceof m.a||Array.isArray(e))&&(e=this.constructTensorMap(e)),[4,this.executor.executeAsync(this.convertTensorMapToTensorsMap(e),t)];case 1:return n=a.sent(),r=Object.keys(n),[2,Array.isArray(t)&&t.length>1?t.map(function(e){return n[e]}):n[r[0]]]}})})},e.prototype.convertTensorMapToTensorsMap=function(e){return Object.keys(e).reduce(function(t,n){return t[n]=[e[n]],t},{})},e.prototype.dispose=function(){this.executor.dispose()},e}();function xl(e,t,n){return vl(this,void 0,void 0,function(){var r;return bl(this,function(a){switch(a.label){case 0:return[4,(r=new wl(e,t,n)).load()];case 1:return a.sent(),[2,r]}})})}n.d(t,"version",function(){return kl}),n.d(t,"AdadeltaOptimizer",function(){return Or}),n.d(t,"AdagradOptimizer",function(){return Nr}),n.d(t,"AdamOptimizer",function(){return Ir}),n.d(t,"AdamaxOptimizer",function(){return Ar}),n.d(t,"MomentumOptimizer",function(){return Rr}),n.d(t,"Optimizer",function(){return xr}),n.d(t,"RMSPropOptimizer",function(){return jr}),n.d(t,"SGDOptimizer",function(){return Pr}),n.d(t,"Tensor",function(){return m.a}),n.d(t,"TensorBuffer",function(){return m.b}),n.d(t,"variable",function(){return m.d}),n.d(t,"Variable",function(){return m.c}),n.d(t,"Rank",function(){return g.a}),n.d(t,"Reduction",function(){return Dr.b}),n.d(t,"ENV",function(){return c.ENV}),n.d(t,"Environment",function(){return c.Environment}),n.d(t,"setBackend",function(){return Br}),n.d(t,"getBackend",function(){return Vr}),n.d(t,"disposeVariables",function(){return Ur}),n.d(t,"memory",function(){return Wr}),n.d(t,"version_core",function(){return"0.11.4"}),n.d(t,"doc",function(){return qt.a}),n.d(t,"nextFrame",function(){return Gr}),n.d(t,"environment",function(){return c}),n.d(t,"io",function(){return o}),n.d(t,"serialization",function(){return i}),n.d(t,"test_util",function(){return s}),n.d(t,"util",function(){return y}),n.d(t,"webgl",function(){return u}),n.d(t,"batchNormalization",function(){return f.o}),n.d(t,"batchNormalization2d",function(){return f.p}),n.d(t,"batchNormalization3d",function(){return f.q}),n.d(t,"batchNormalization4d",function(){return f.r}),n.d(t,"concat",function(){return f.x}),n.d(t,"concat1d",function(){return f.y}),n.d(t,"concat2d",function(){return f.z}),n.d(t,"concat3d",function(){return f.A}),n.d(t,"concat4d",function(){return f.B}),n.d(t,"conv1d",function(){return f.C}),n.d(t,"conv2d",function(){return f.D}),n.d(t,"conv2dTranspose",function(){return f.E}),n.d(t,"depthwiseConv2d",function(){return f.I}),n.d(t,"separableConv2d",function(){return f.Ub}),n.d(t,"matMul",function(){return f.Ua}),n.d(t,"matrixTimesVector",function(){return f.Va}),n.d(t,"outerProduct",function(){return f.ub}),n.d(t,"vectorTimesMatrix",function(){return f.Fc}),n.d(t,"dot",function(){return f.L}),n.d(t,"avgPool",function(){return f.m}),n.d(t,"maxPool",function(){return f.Xa}),n.d(t,"transpose",function(){return f.Bc}),n.d(t,"reverse",function(){return f.Lb}),n.d(t,"reverse1d",function(){return f.Mb}),n.d(t,"reverse2d",function(){return f.Nb}),n.d(t,"reverse3d",function(){return f.Ob}),n.d(t,"reverse4d",function(){return f.Pb}),n.d(t,"slice",function(){return f.Zb}),n.d(t,"slice1d",function(){return f.ac}),n.d(t,"slice2d",function(){return f.bc}),n.d(t,"slice3d",function(){return f.cc}),n.d(t,"slice4d",function(){return f.dc}),n.d(t,"stridedSlice",function(){return f.oc}),n.d(t,"argMax",function(){return f.f}),n.d(t,"argMin",function(){return f.g}),n.d(t,"logSumExp",function(){return f.Oa}),n.d(t,"max",function(){return f.Wa}),n.d(t,"mean",function(){return f.ab}),n.d(t,"min",function(){return f.bb}),n.d(t,"moments",function(){return f.gb}),n.d(t,"sum",function(){return f.rc}),n.d(t,"unsortedSegmentSum",function(){return f.Dc}),n.d(t,"equal",function(){return f.N}),n.d(t,"equalStrict",function(){return f.O}),n.d(t,"greater",function(){return f.Y}),n.d(t,"greaterStrict",function(){return f.Ba}),n.d(t,"greaterEqual",function(){return f.Z}),n.d(t,"greaterEqualStrict",function(){return f.Aa}),n.d(t,"less",function(){return f.Ea}),n.d(t,"lessStrict",function(){return f.Ha}),n.d(t,"lessEqual",function(){return f.Fa}),n.d(t,"lessEqualStrict",function(){return f.Ga}),n.d(t,"notEqual",function(){return f.ob}),n.d(t,"notEqualStrict",function(){return f.pb}),n.d(t,"logicalNot",function(){return f.Qa}),n.d(t,"logicalAnd",function(){return f.Pa}),n.d(t,"logicalOr",function(){return f.Ra}),n.d(t,"logicalXor",function(){return f.Sa}),n.d(t,"where",function(){return f.Gc}),n.d(t,"abs",function(){return f.a}),n.d(t,"acos",function(){return f.b}),n.d(t,"acosh",function(){return f.c}),n.d(t,"asin",function(){return f.h}),n.d(t,"asinh",function(){return f.i}),n.d(t,"atan",function(){return f.j}),n.d(t,"atanh",function(){return f.l}),n.d(t,"ceil",function(){return f.u}),n.d(t,"clipByValue",function(){return f.v}),n.d(t,"cos",function(){return f.F}),n.d(t,"cosh",function(){return f.G}),n.d(t,"elu",function(){return f.M}),n.d(t,"exp",function(){return f.Q}),n.d(t,"expm1",function(){return f.S}),n.d(t,"floor",function(){return f.V}),n.d(t,"sign",function(){return f.Wb}),n.d(t,"leakyRelu",function(){return f.Da}),n.d(t,"log",function(){return f.La}),n.d(t,"log1p",function(){return f.Ma}),n.d(t,"logSigmoid",function(){return f.Na}),n.d(t,"neg",function(){return f.mb}),n.d(t,"prelu",function(){return f.Cb}),n.d(t,"relu",function(){return f.Jb}),n.d(t,"reciprocal",function(){return f.Ib}),n.d(t,"round",function(){return f.Qb}),n.d(t,"selu",function(){return f.Tb}),n.d(t,"sigmoid",function(){return f.Vb}),n.d(t,"sin",function(){return f.Xb}),n.d(t,"sinh",function(){return f.Yb}),n.d(t,"softplus",function(){return f.fc}),n.d(t,"sqrt",function(){return f.hc}),n.d(t,"rsqrt",function(){return f.Rb}),n.d(t,"square",function(){return f.ic}),n.d(t,"step",function(){return f.nc}),n.d(t,"tan",function(){return f.sc}),n.d(t,"tanh",function(){return f.tc}),n.d(t,"erf",function(){return f.P}),n.d(t,"add",function(){return f.d}),n.d(t,"addStrict",function(){return f.e}),n.d(t,"atan2",function(){return f.k}),n.d(t,"div",function(){return f.J}),n.d(t,"divStrict",function(){return f.K}),n.d(t,"maximum",function(){return f.Ya}),n.d(t,"maximumStrict",function(){return f.Za}),n.d(t,"minimum",function(){return f.cb}),n.d(t,"minimumStrict",function(){return f.db}),n.d(t,"mod",function(){return f.eb}),n.d(t,"modStrict",function(){return f.fb}),n.d(t,"mul",function(){return f.ib}),n.d(t,"mulStrict",function(){return f.jb}),n.d(t,"pow",function(){return f.Ab}),n.d(t,"powStrict",function(){return f.Bb}),n.d(t,"sub",function(){return f.pc}),n.d(t,"subStrict",function(){return f.qc}),n.d(t,"squaredDifference",function(){return f.jc}),n.d(t,"squaredDifferenceStrict",function(){return f.kc}),n.d(t,"norm",function(){return f.nb}),n.d(t,"cast",function(){return f.t}),n.d(t,"clone",function(){return f.w}),n.d(t,"fromPixels",function(){return f.W}),n.d(t,"toPixels",function(){return f.Ac}),n.d(t,"ones",function(){return f.rb}),n.d(t,"onesLike",function(){return f.sb}),n.d(t,"zeros",function(){return f.Hc}),n.d(t,"zerosLike",function(){return f.Ic}),n.d(t,"eye",function(){return f.T}),n.d(t,"rand",function(){return f.Eb}),n.d(t,"randomNormal",function(){return f.Fb}),n.d(t,"truncatedNormal",function(){return f.Cc}),n.d(t,"randomUniform",function(){return f.Gb}),n.d(t,"multinomial",function(){return f.lb}),n.d(t,"reshape",function(){return f.Kb}),n.d(t,"squeeze",function(){return f.lc}),n.d(t,"tile",function(){return f.zc}),n.d(t,"gather",function(){return f.X}),n.d(t,"oneHot",function(){return f.qb}),n.d(t,"linspace",function(){return f.Ja}),n.d(t,"range",function(){return f.Hb}),n.d(t,"buffer",function(){return f.s}),n.d(t,"fill",function(){return f.U}),n.d(t,"tensor",function(){return f.uc}),n.d(t,"scalar",function(){return f.Sb}),n.d(t,"tensor1d",function(){return f.vc}),n.d(t,"tensor2d",function(){return f.wc}),n.d(t,"tensor3d",function(){return f.xc}),n.d(t,"tensor4d",function(){return f.yc}),n.d(t,"print",function(){return f.Db}),n.d(t,"expandDims",function(){return f.R}),n.d(t,"stack",function(){return f.mc}),n.d(t,"unstack",function(){return f.Ec}),n.d(t,"split",function(){return f.gc}),n.d(t,"cumsum",function(){return f.H}),n.d(t,"pad",function(){return f.vb}),n.d(t,"pad1d",function(){return f.wb}),n.d(t,"pad2d",function(){return f.xb}),n.d(t,"pad3d",function(){return f.yb}),n.d(t,"pad4d",function(){return f.zb}),n.d(t,"movingAverage",function(){return f.hb}),n.d(t,"basicLSTMCell",function(){return f.n}),n.d(t,"multiRNNCell",function(){return f.kb}),n.d(t,"softmax",function(){return f.ec}),n.d(t,"localResponseNormalization",function(){return f.Ka}),n.d(t,"linalg",function(){return f.Ia}),n.d(t,"operation",function(){return f.tb}),n.d(t,"losses",function(){return f.Ta}),n.d(t,"image",function(){return f.Ca}),n.d(t,"train",function(){return Fr}),n.d(t,"tidy",function(){return vr.f}),n.d(t,"keep",function(){return vr.e}),n.d(t,"dispose",function(){return vr.b}),n.d(t,"time",function(){return vr.g}),n.d(t,"grad",function(){return vr.c}),n.d(t,"valueAndGrad",function(){return vr.h}),n.d(t,"grads",function(){return vr.d}),n.d(t,"valueAndGrads",function(){return vr.i}),n.d(t,"variableGrads",function(){return vr.j}),n.d(t,"customGrad",function(){return vr.a}),n.d(t,"Callback",function(){return Vo}),n.d(t,"CallbackList",function(){return Uo}),n.d(t,"CustomCallback",function(){return Ho}),n.d(t,"Model",function(){return zi}),n.d(t,"RNN",function(){return _u}),n.d(t,"Sequential",function(){return Yu}),n.d(t,"SymbolicTensor",function(){return ja}),n.d(t,"version_layers",function(){return"0.6.4"}),n.d(t,"model",function(){return ac}),n.d(t,"sequential",function(){return oc}),n.d(t,"loadModel",function(){return ic}),n.d(t,"input",function(){return sc}),n.d(t,"layers",function(){return uc}),n.d(t,"constraints",function(){return cc}),n.d(t,"initializers",function(){return lc}),n.d(t,"metrics",function(){return fc}),n.d(t,"regularizers",function(){return pc}),n.d(t,"FrozenModel",function(){return wl}),n.d(t,"loadFrozenModel",function(){return xl}),n.d(t,"version_converter",function(){return"0.4.1"});var kl={"tfjs-core":"0.11.4","tfjs-layers":"0.6.4","tfjs-converter":"0.4.1",tfjs:"0.11.4"}},function(e,t,n){"use strict";function r(e,t){for(var n=e.length,r=[],a=0;a<n;a++){var o=n-1-a,i=e[o]||1;(t[t.length-1-a]||1)>1&&1===i&&r.unshift(o)}return r}function a(e,t){for(var n=[],r=0;r<t.length;r++){var a=e[e.length-r-1],o=t.length-r-1,i=t[o];(null==a||1===a&&i>1)&&n.unshift(o)}return n}function o(e){for(var t=0;t<e.length;t++)if(e[t]!==t)return!1;return!0}function i(e,t){for(var n=[],r="Operands could not be broadcast together with shapes "+e+" and "+t+".",a=Math.max(e.length,t.length),o=0;o<a;o++){var i=e[e.length-o-1]||1,s=t[t.length-o-1]||1;if(i>1&&s>1&&i!==s)throw Error(r);n.unshift(Math.max(i,s))}return n}n.d(t,"c",function(){return r}),n.d(t,"d",function(){return a}),n.d(t,"b",function(){return o}),n.d(t,"a",function(){return i})},function(e,t,n){var r=n(15);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(119)("wks"),a=n(75),o=n(13).Symbol,i="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=i&&o[e]||(i?o:a)("Symbol."+e))}).store=r},function(e,t,n){var r=n(45),a=Math.min;e.exports=function(e){return e>0?a(r(e),9007199254740991):0}},function(e,t,n){var r=n(12),a=n(225),o=n(47),i=Object.defineProperty;t.f=n(19)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),a)try{return i(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports=!n(14)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r,a,o,i,s;n.d(t,"a",function(){return a}),n.d(t,"c",function(){return c}),n.d(t,"b",function(){return l}),function(e){e.float32="float32",e.int32="int32",e.bool="bool"}(r||(r={})),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(a||(a={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32"}(o||(o={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool"}(i||(i={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32"}(s||(s={}));var u={float32:s,int32:o,bool:i};function c(e,t){return u[e][t]}function l(e){return c(e,"int32")}},function(e,t){var n=e.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(46);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(133)("wks"),a=n(104),o=n(25).Symbol,i="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=i&&o[e]||(i?o:a)("Symbol."+e))}).store=r},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(5),a=n(14),o=n(46),i=/"/g,s=function(e,t,n,r){var a=String(o(e)),s="<"+t;return""!==n&&(s+=" "+n+'="'+String(r).replace(i,""")+'"'),s+">"+a+"</"+t+">"};e.exports=function(e,t){var n={};n[e]=t(s),r(r.P+r.F*a(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",n)}},function(e,t,n){var r=n(13),a=n(28),o=n(29),i=n(75)("src"),s=Function.toString,u=(""+s).split("toString");n(48).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var c="function"==typeof n;c&&(o(n,"name")||a(n,"name",t)),e[t]!==n&&(c&&(o(n,i)||a(n,i,e[t]?""+e[t]:u.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:a(e,t,n):(delete e[t],a(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[i]||s.call(this)})},function(e,t,n){var r=n(18),a=n(76);e.exports=n(19)?function(e,t,n){return r.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){var r=n(29),a=n(22),o=n(164)("IE_PROTO"),i=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?i:null}},function(e,t,n){var r=n(94),a=n(76),o=n(33),i=n(47),s=n(29),u=n(225),c=Object.getOwnPropertyDescriptor;t.f=n(19)?c:function(e,t){if(e=o(e),t=i(t,!0),u)try{return c(e,t)}catch(e){}if(s(e,t))return a(!r.f.call(e,t),e[t])}},function(e,t,n){var r=n(95),a=n(46);e.exports=function(e){return r(a(e))}},function(e,t,n){"use strict";n.d(t,"a",function(){return f});var r=n(2),a=n(3),o=n(7),i=n(0),s=n(8),u=n(4),c=n(1),l=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},f=function(){function e(){}return e.logSumExp=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1),i.assertArgumentsAreTensors({x:e},"logSumExp");var r=s.g(t,e.shape),a=e.max(r,!0),o=e.sub(a).exp().sum(r).log(),u=a.reshape(o.shape).add(o);if(n){var c=s.c(u.shape,r);return u.reshape(c)}return u},e.sum=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1),i.assertArgumentsAreTensors({x:e},"sum"),"bool"===e.dtype&&(e=e.toInt());var r=s.g(t,e.shape);return Object(o.a)(function(e){var t=s.d(r,e.rank),o=r,i=e;null!=t&&(i=e.transpose(t),o=s.e(o.length,e.rank));var u=a.ENV.engine.runKernel(function(e){return e.sum(i,o)},{permutedX:i});if(n){var l=s.c(u.shape,r);u=u.reshape(l)}return{value:u,gradFunc:function(t){var n=e.shape.slice();return r.forEach(function(e){n[e]=1}),t.reshape(n).mul(c.rb(e.shape,"float32"))}}})(e)},e.mean=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1),i.assertArgumentsAreTensors({x:e},"mean");var r=s.g(t,e.shape),a=s.b(e.shape,r)[1],u=i.sizeFromShape(a);return Object(o.a)(function(e){var a=c.Sb(u);return{value:(a.dtype===e.dtype?e:e.cast(a.dtype)).div(a).sum(t,n),gradFunc:function(t){var n=e.shape.slice();return r.forEach(function(e){n[e]=1}),t.reshape(n).mul(c.rb(e.shape,"float32")).div(a)}}})(e)},e.min=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1),i.assertArgumentsAreTensors({x:e},"min");var r=s.g(t,e.shape),o=r,u=s.d(o,e.rank);null!=u&&(e=e.transpose(u),o=s.e(o.length,e.rank));var c=a.ENV.engine.runKernel(function(t){return t.min(e,o)},{x:e});if(n){var l=s.c(c.shape,r);return c.reshape(l)}return c},e.max=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1),i.assertArgumentsAreTensors({x:e},"max");var r=s.g(t,e.shape),o=r,u=s.d(o,e.rank);null!=u&&(e=e.transpose(u),o=s.e(o.length,e.rank));var c=a.ENV.engine.runKernel(function(t){return t.max(e,o)},{x:e});if(n){var l=s.c(c.shape,r);return c.reshape(l)}return c},e.argMin=function(e,t){void 0===t&&(t=0),i.assertArgumentsAreTensors({x:e},"argMin"),null==t&&(t=0);var n=s.g(t,e.shape),r=s.d(n,e.rank);return null!=r&&(e=e.transpose(r),n=s.e(n.length,e.rank)),a.ENV.engine.runKernel(function(t){return t.argMin(e,n[0])},{x:e})},e.argMax=function(e,t){void 0===t&&(t=0),i.assertArgumentsAreTensors({x:e},"argMax"),null==t&&(t=0);var n=s.g(t,e.shape),r=s.d(n,e.rank);return null!=r&&(e=e.transpose(r),n=s.e(n.length,e.rank)),a.ENV.engine.runKernel(function(t){return t.argMax(e,n[0])},{x:e})},e.moments=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1),i.assertArgumentsAreTensors({x:e},"moments");var r=s.g(t,e.shape),a=e.mean(r,n),o=a.shape;return n||(o=s.c(a.shape,r)),{mean:a,variance:e.toFloat().sub(a.reshape(o)).square().mean(r,n)}},e.unsortedSegmentSum=function(e,t,n,r){void 0===r&&(r=0),i.assertArgumentsAreTensors({x:e,segmentIds:t},"unsortedSegmentSum"),i.assert("int32"===t.dtype,"Segment Ids must be of dtype `int32`"),r=s.g(r,e.shape)[0];for(var a=[],o=t.shape[0],u=[],l=0;l<e.shape.length;l++)l===r?u.push(o):u.push(1);var f=c.Kb(t,u);for(l=0;l<n;l++){var p=c.Sb(l,"int32"),h=c.N(p,f).asType("float32").mul(e).sum(r);a.push(h)}return c.mc(a,r)},l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"logSumExp",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"sum",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"mean",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"min",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"max",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"argMin",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"argMax",null),l([Object(r.a)({heading:"Operations",subheading:"Normalization"}),u.a],e,"moments",null),l([Object(r.a)({heading:"Operations",subheading:"Reduction"}),u.a],e,"unsortedSegmentSum",null),e}()},function(e,t,n){var r=n(25),a=n(21),o=n(82),i=n(65),s=function(e,t,n){var u,c,l,f=e&s.F,p=e&s.G,h=e&s.S,d=e&s.P,m=e&s.B,g=e&s.W,y=p?a:a[t]||(a[t]={}),v=y.prototype,b=p?r:h?r[t]:(r[t]||{}).prototype;for(u in p&&(n=t),n)(c=!f&&b&&void 0!==b[u])&&u in y||(l=c?b[u]:n[u],y[u]=p&&"function"!=typeof b[u]?n[u]:m&&c?o(l,r):g&&b[u]==l?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(l):d&&"function"==typeof l?o(Function.call,l):l,d&&((y.virtual||(y.virtual={}))[u]=l,e&s.R&&v&&!v[u]&&i(v,u,l)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(23);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,a){return e.call(t,n,r,a)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";n.d(t,"b",function(){return r}),n.d(t,"a",function(){return c});var r,a=n(2),o=n(0),i=n(4),s=n(1),u=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i};!function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(r||(r={}));var c=function(){function e(){}return e.computeWeightedLoss=function(e,t,n){void 0===n&&(n=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({losses:e},"computeWeightedLoss"),null!=t&&o.assertArgumentsAreTensors({weights:t},"computeWeightedLoss");var a=null==t?e:e.mul(t);if(n===r.NONE)return a;if(n===r.SUM)return a.sum();if(n===r.MEAN)return null==t?a.mean():a.sum().div(t.sum());if(n===r.SUM_BY_NONZERO_WEIGHTS){if(null==t)return a.sum().div(s.Sb(e.size));var i=t.notEqual(s.Sb(0)).sum().toFloat();return a.sum().div(i)}throw Error("Unknown reduction: "+n)},e.absoluteDifference=function(t,n,a,i){void 0===i&&(i=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({labels:t,predictions:n},"absoluteDifference"),null!=a&&o.assertArgumentsAreTensors({weights:a},"absoluteDifference"),o.assertShapesMatch(t.shape,n.shape,"Error in absoluteDifference: ");var s=t.sub(n).abs();return e.computeWeightedLoss(s,a,i)},e.meanSquaredError=function(t,n,a,i){void 0===i&&(i=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({labels:t,predictions:n},"meanSquaredError"),null!=a&&o.assertArgumentsAreTensors({weights:a},"meanSquaredError"),o.assertShapesMatch(t.shape,n.shape,"Error in meanSquaredError: ");var s=t.squaredDifference(n);return e.computeWeightedLoss(s,a,i)},e.cosineDistance=function(t,n,a,i,u){void 0===u&&(u=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({labels:t,predictions:n},"cosineDistance"),null!=i&&o.assertArgumentsAreTensors({weights:i},"cosineDistance"),o.assertShapesMatch(t.shape,n.shape,"Error in cosineDistance: ");var c=s.Sb(1).sub(t.mul(n).sum(a,!0));return e.computeWeightedLoss(c,i,u)},e.hingeLoss=function(t,n,a,i){void 0===i&&(i=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({labels:t,predictions:n},"hingeLoss"),null!=a&&o.assertArgumentsAreTensors({weights:a},"hingeLoss"),o.assertShapesMatch(t.shape,n.shape,"Error in hingeLoss: ");var u=s.Sb(1);t=s.Sb(2).mul(t).sub(u);var c=u.sub(t.mul(n)).relu();return e.computeWeightedLoss(c,a,i)},e.logLoss=function(t,n,a,i,u){void 0===i&&(i=1e-7),void 0===u&&(u=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({labels:t,predictions:n},"logLoss"),null!=a&&o.assertArgumentsAreTensors({weights:a},"logLoss"),o.assertShapesMatch(t.shape,n.shape,"Error in logLoss: ");var c=s.Sb(1),l=s.Sb(i),f=t.mul(n.add(l).log()).neg().sub(c.sub(t).mul(c.sub(n).add(l).log()));return e.computeWeightedLoss(f,a,u)},e.huberLoss=function(t,n,a,i,u){void 0===i&&(i=1),void 0===u&&(u=r.SUM_BY_NONZERO_WEIGHTS),o.assertArgumentsAreTensors({labels:t,predictions:n},"huberLoss"),null!=a&&o.assertArgumentsAreTensors({weights:a},"huberLoss"),o.assertShapesMatch(t.shape,n.shape,"Error in huberLoss: ");var c=s.Sb(i),l=n.sub(t).abs(),f=s.cb(l,c),p=l.sub(f),h=s.Sb(.5).mul(f.square()).add(c.mul(p));return e.computeWeightedLoss(h,a,u)},u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"computeWeightedLoss",null),u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"absoluteDifference",null),u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"meanSquaredError",null),u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"cosineDistance",null),u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"hingeLoss",null),u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"logLoss",null),u([Object(a.a)({heading:"Training",subheading:"Losses",namespace:"losses"}),i.a],e,"huberLoss",null),e}()},function(e,t,n){"use strict";t.__esModule=!0;var r,a=(r=n(289))&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,a.default)(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var r=n(55);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(38),a=n(95),o=n(22),i=n(17),s=n(147);e.exports=function(e,t){var n=1==e,u=2==e,c=3==e,l=4==e,f=6==e,p=5==e||f,h=t||s;return function(t,s,d){for(var m,g,y=o(t),v=a(y),b=r(s,d,3),w=i(v.length),x=0,k=n?h(t,w):u?h(t,0):void 0;w>x;x++)if((p||x in v)&&(g=b(m=v[x],x,y),e))if(n)k[x]=g;else if(g)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:k.push(m)}else if(l)return!1;return f?-1:c||l?l:k}}},function(e,t,n){var r=n(5),a=n(48),o=n(14);e.exports=function(e,t){var n=(a.Object||{})[e]||Object[e],i={};i[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",i)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(15);e.exports=function(e,t){if(!r(e))return e;var n,a;if(t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;if("function"==typeof(n=e.valueOf)&&!r(a=n.call(e)))return a;if(!t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;throw TypeError("Can't convert object to primitive value")}},function(e,t){var n=e.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(42),a=n(191),o=n(138),i=Object.defineProperty;t.f=n(54)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),a)try{return i(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(204),a=n(5),o=n(119)("metadata"),i=o.store||(o.store=new(n(201))),s=function(e,t,n){var a=i.get(e);if(!a){if(!n)return;i.set(e,a=new r)}var o=a.get(t);if(!o){if(!n)return;a.set(t,o=new r)}return o};e.exports={store:i,map:s,has:function(e,t,n){var r=s(t,n,!1);return void 0!==r&&r.has(e)},get:function(e,t,n){var r=s(t,n,!1);return void 0===r?void 0:r.get(e)},set:function(e,t,n,r){s(n,r,!0).set(e,t)},keys:function(e,t){var n=s(e,t,!1),r=[];return n&&n.forEach(function(e,t){r.push(t)}),r},key:function(e){return void 0===e||"symbol"==typeof e?e:String(e)},exp:function(e){a(a.S,"Reflect",e)}}},function(e,t,n){"use strict";if(n(19)){var r=n(74),a=n(13),o=n(14),i=n(5),s=n(109),u=n(141),c=n(38),l=n(68),f=n(76),p=n(28),h=n(66),d=n(45),m=n(17),g=n(199),y=n(72),v=n(47),b=n(29),w=n(93),x=n(15),k=n(22),O=n(150),S=n(71),N=n(31),E=n(70).f,I=n(148),T=n(75),A=n(16),C=n(43),P=n(118),_=n(111),R=n(145),M=n(84),j=n(114),D=n(69),L=n(146),z=n(209),F=n(18),B=n(32),V=F.f,U=B.f,W=a.RangeError,G=a.TypeError,q=a.Uint8Array,H=Array.prototype,K=u.ArrayBuffer,X=u.DataView,J=C(0),Y=C(2),Q=C(3),Z=C(4),$=C(5),ee=C(6),te=P(!0),ne=P(!1),re=R.values,ae=R.keys,oe=R.entries,ie=H.lastIndexOf,se=H.reduce,ue=H.reduceRight,ce=H.join,le=H.sort,fe=H.slice,pe=H.toString,he=H.toLocaleString,de=A("iterator"),me=A("toStringTag"),ge=T("typed_constructor"),ye=T("def_constructor"),ve=s.CONSTR,be=s.TYPED,we=s.VIEW,xe=C(1,function(e,t){return Ee(_(e,e[ye]),t)}),ke=o(function(){return 1===new q(new Uint16Array([1]).buffer)[0]}),Oe=!!q&&!!q.prototype.set&&o(function(){new q(1).set({})}),Se=function(e,t){var n=d(e);if(n<0||n%t)throw W("Wrong offset!");return n},Ne=function(e){if(x(e)&&be in e)return e;throw G(e+" is not a typed array!")},Ee=function(e,t){if(!(x(e)&&ge in e))throw G("It is not a typed array constructor!");return new e(t)},Ie=function(e,t){return Te(_(e,e[ye]),t)},Te=function(e,t){for(var n=0,r=t.length,a=Ee(e,r);r>n;)a[n]=t[n++];return a},Ae=function(e,t,n){V(e,t,{get:function(){return this._d[n]}})},Ce=function(e){var t,n,r,a,o,i,s=k(e),u=arguments.length,l=u>1?arguments[1]:void 0,f=void 0!==l,p=I(s);if(void 0!=p&&!O(p)){for(i=p.call(s),r=[],t=0;!(o=i.next()).done;t++)r.push(o.value);s=r}for(f&&u>2&&(l=c(l,arguments[2],2)),t=0,n=m(s.length),a=Ee(this,n);n>t;t++)a[t]=f?l(s[t],t):s[t];return a},Pe=function(){for(var e=0,t=arguments.length,n=Ee(this,t);t>e;)n[e]=arguments[e++];return n},_e=!!q&&o(function(){he.call(new q(1))}),Re=function(){return he.apply(_e?fe.call(Ne(this)):Ne(this),arguments)},Me={copyWithin:function(e,t){return z.call(Ne(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return Z(Ne(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return L.apply(Ne(this),arguments)},filter:function(e){return Ie(this,Y(Ne(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return $(Ne(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return ee(Ne(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){J(Ne(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return ne(Ne(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return te(Ne(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return ce.apply(Ne(this),arguments)},lastIndexOf:function(e){return ie.apply(Ne(this),arguments)},map:function(e){return xe(Ne(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return se.apply(Ne(this),arguments)},reduceRight:function(e){return ue.apply(Ne(this),arguments)},reverse:function(){for(var e,t=Ne(this).length,n=Math.floor(t/2),r=0;r<n;)e=this[r],this[r++]=this[--t],this[t]=e;return this},some:function(e){return Q(Ne(this),e,arguments.length>1?arguments[1]:void 0)},sort:function(e){return le.call(Ne(this),e)},subarray:function(e,t){var n=Ne(this),r=n.length,a=y(e,r);return new(_(n,n[ye]))(n.buffer,n.byteOffset+a*n.BYTES_PER_ELEMENT,m((void 0===t?r:y(t,r))-a))}},je=function(e,t){return Ie(this,fe.call(Ne(this),e,t))},De=function(e){Ne(this);var t=Se(arguments[1],1),n=this.length,r=k(e),a=m(r.length),o=0;if(a+t>n)throw W("Wrong length!");for(;o<a;)this[t+o]=r[o++]},Le={entries:function(){return oe.call(Ne(this))},keys:function(){return ae.call(Ne(this))},values:function(){return re.call(Ne(this))}},ze=function(e,t){return x(e)&&e[be]&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},Fe=function(e,t){return ze(e,t=v(t,!0))?f(2,e[t]):U(e,t)},Be=function(e,t,n){return!(ze(e,t=v(t,!0))&&x(n)&&b(n,"value"))||b(n,"get")||b(n,"set")||n.configurable||b(n,"writable")&&!n.writable||b(n,"enumerable")&&!n.enumerable?V(e,t,n):(e[t]=n.value,e)};ve||(B.f=Fe,F.f=Be),i(i.S+i.F*!ve,"Object",{getOwnPropertyDescriptor:Fe,defineProperty:Be}),o(function(){pe.call({})})&&(pe=he=function(){return ce.call(this)});var Ve=h({},Me);h(Ve,Le),p(Ve,de,Le.values),h(Ve,{slice:je,set:De,constructor:function(){},toString:pe,toLocaleString:Re}),Ae(Ve,"buffer","b"),Ae(Ve,"byteOffset","o"),Ae(Ve,"byteLength","l"),Ae(Ve,"length","e"),V(Ve,me,{get:function(){return this[be]}}),e.exports=function(e,t,n,u){var c=e+((u=!!u)?"Clamped":"")+"Array",f="get"+e,h="set"+e,d=a[c],y=d||{},v=d&&N(d),b=!d||!s.ABV,k={},O=d&&d.prototype,I=function(e,n){V(e,n,{get:function(){return function(e,n){var r=e._d;return r.v[f](n*t+r.o,ke)}(this,n)},set:function(e){return function(e,n,r){var a=e._d;u&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),a.v[h](n*t+a.o,r,ke)}(this,n,e)},enumerable:!0})};b?(d=n(function(e,n,r,a){l(e,d,c,"_d");var o,i,s,u,f=0,h=0;if(x(n)){if(!(n instanceof K||"ArrayBuffer"==(u=w(n))||"SharedArrayBuffer"==u))return be in n?Te(d,n):Ce.call(d,n);o=n,h=Se(r,t);var y=n.byteLength;if(void 0===a){if(y%t)throw W("Wrong length!");if((i=y-h)<0)throw W("Wrong length!")}else if((i=m(a)*t)+h>y)throw W("Wrong length!");s=i/t}else s=g(n),o=new K(i=s*t);for(p(e,"_d",{b:o,o:h,l:i,e:s,v:new X(o)});f<s;)I(e,f++)}),O=d.prototype=S(Ve),p(O,"constructor",d)):o(function(){d(1)})&&o(function(){new d(-1)})&&j(function(e){new d,new d(null),new d(1.5),new d(e)},!0)||(d=n(function(e,n,r,a){var o;return l(e,d,c),x(n)?n instanceof K||"ArrayBuffer"==(o=w(n))||"SharedArrayBuffer"==o?void 0!==a?new y(n,Se(r,t),a):void 0!==r?new y(n,Se(r,t)):new y(n):be in n?Te(d,n):Ce.call(d,n):new y(g(n))}),J(v!==Function.prototype?E(y).concat(E(v)):E(y),function(e){e in d||p(d,e,y[e])}),d.prototype=O,r||(O.constructor=d));var T=O[de],A=!!T&&("values"==T.name||void 0==T.name),C=Le.values;p(d,ge,!0),p(O,be,c),p(O,we,!0),p(O,ye,d),(u?new d(1)[me]==c:me in O)||V(O,me,{get:function(){return c}}),k[c]=d,i(i.G+i.W+i.F*(d!=y),k),i(i.S,c,{BYTES_PER_ELEMENT:t}),i(i.S+i.F*o(function(){y.of.call(d,1)}),c,{from:Ce,of:Pe}),"BYTES_PER_ELEMENT"in O||p(O,"BYTES_PER_ELEMENT",t),i(i.P,c,Me),D(c),i(i.P+i.F*Oe,c,{set:De}),i(i.P+i.F*!A,c,Le),r||O.toString==pe||(O.toString=pe),i(i.P+i.F*o(function(){new d(1).slice()}),c,{slice:je}),i(i.P+i.F*(o(function(){return[1,2].toLocaleString()!=new d([1,2]).toLocaleString()})||!o(function(){O.toLocaleString.call([1,2])})),c,{toLocaleString:Re}),M[c]=A?T:C,r||A||p(O,de,C)}}else e.exports=function(){}},function(e,t,n){"use strict";n.d(t,"b",function(){return r}),n.d(t,"a",function(){return a});var r=1.7580993408473768,a=1.0507009873554805},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(285)),a=i(n(283)),o="function"==typeof a.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":typeof e};function i(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof a.default&&"symbol"===o(r.default)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":void 0===e?"undefined":o(e)}},function(e,t,n){e.exports=!n(81)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(16)("unscopables"),a=Array.prototype;void 0==a[r]&&n(28)(a,r,{}),e.exports=function(e){a[r][e]=!0}},function(e,t,n){var r=n(75)("meta"),a=n(15),o=n(29),i=n(18).f,s=0,u=Object.isExtensible||function(){return!0},c=!n(14)(function(){return u(Object.preventExtensions({}))}),l=function(e){i(e,r,{value:{i:"O"+ ++s,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[r].i},getWeak:function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[r].w},onFreeze:function(e){return c&&f.NEED&&u(e)&&!o(e,r)&&l(e),e}}},function(e,t,n){"use strict";n.d(t,"a",function(){return a}),n.d(t,"c",function(){return o}),n.d(t,"b",function(){return i});var r=n(0);function a(e,t,n){var a=e.length,o=t.length;r.assert(e.length===t.length,"Error in concat"+a+"D: rank of x1 ("+a+") and x2 ("+o+") must be the same."),r.assert(n>=0&&n<a,"Error in concat"+a+"D: axis must be between 0 and "+(a-1)+".");for(var i=0;i<a;i++)r.assert(i===n||e[i]===t[i],"Error in concat"+a+"D: Shape ("+e+") does not match ("+t+") along the non-concatenated axis "+i+".")}function o(e,t,n){r.assert(e.length===t.length,"x1 and x2 should have the same rank.");var a=e.slice();return a[n]+=t[n],a}function i(e,t){return{aBegin:[0,0],aSize:e,bBegin:[0,e[1]],bSize:t}}},function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(2),a=n(3),o=n(0),i=n(8),s=n(58),u=n(4),c=function(){function e(){}return e.concat1d=function(t){return e.concat(t,0)},e.concat2d=function(t,n){return e.concat(t,n)},e.concat3d=function(t,n){return e.concat(t,n)},e.concat4d=function(t,n){return e.concat(t,n)},e.concat=function(e,t){void 0===t&&(t=0),o.assert(e.length>=1,"Pass at least one tensor to concat"),o.assertArgumentsAreTensors({tensors:e},"concat");var n=e[0];if(1===e.length)return n;for(var r=Object(i.g)(t,n.shape),a=1;a<e.length;++a)n=l(n,e[a],r[0]);return n},function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);o>3&&i&&Object.defineProperty(t,n,i)}([Object(r.a)({heading:"Tensors",subheading:"Slicing and Joining"}),u.a],e,"concat",null),e}();function l(e,t,n){s.a(e.shape,t.shape,n);var r=s.c(e.shape,t.shape,n),i=e.as2D(-1,o.sizeFromShape(e.shape.slice(n))),u=t.as2D(-1,o.sizeFromShape(t.shape.slice(n))),c=s.b(i.shape,u.shape),l=c.aBegin,f=c.aSize,p=c.bBegin,h=c.bSize;return a.ENV.engine.runKernel(function(e){return e.concat(i,u)},{a:i,b:u},function(e){return{a:function(){return e.slice(l,f)},b:function(){return e.slice(p,h)}}}).reshape(r)}},function(e,t,n){"use strict";t.__esModule=!0;var r,a=(r=n(102))&&r.__esModule?r:{default:r};t.default=function(e){return function(){var t=e.apply(this,arguments);return new a.default(function(e,n){return function r(o,i){try{var s=t[o](i),u=s.value}catch(e){return void n(e)}if(!s.done)return a.default.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}("next")})}}},function(e,t,n){e.exports=n(307)},function(e,t,n){"use strict";(function(e){var r=t;function a(e,t,n){for(var r=Object.keys(t),a=0;a<r.length;++a)void 0!==e[r[a]]&&n||(e[r[a]]=t[r[a]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&a(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=n(321),r.base64=n(320),r.EventEmitter=n(319),r.float=n(318),r.inquire=n(317),r.utf8=n(316),r.pool=n(315),r.LongBits=n(314),r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isNode=Boolean(e.process&&e.process.versions&&e.process.versions.node),r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=e.dcodeIO&&e.dcodeIO.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=a,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}}).call(this,n(96))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(49),a=n(92);e.exports=n(54)?function(e,t,n){return r.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(27);e.exports=function(e,t,n){for(var a in t)r(e,a,t[a],n);return e}},function(e,t,n){var r=n(38),a=n(211),o=n(150),i=n(12),s=n(17),u=n(148),c={},l={};(t=e.exports=function(e,t,n,f,p){var h,d,m,g,y=p?function(){return e}:u(e),v=r(n,f,t?2:1),b=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(o(y)){for(h=s(e.length);h>b;b++)if((g=t?v(i(d=e[b])[0],d[1]):v(e[b]))===c||g===l)return g}else for(m=y.call(e);!(d=m.next()).done;)if((g=a(m,v,d.value,t))===c||g===l)return g}).BREAK=c,t.RETURN=l},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r=n(13),a=n(18),o=n(19),i=n(16)("species");e.exports=function(e){var t=r[e];o&&t&&!t[i]&&a.f(t,i,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(223),a=n(163).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,a)}},function(e,t,n){var r=n(12),a=n(222),o=n(163),i=n(164)("IE_PROTO"),s=function(){},u=function(){var e,t=n(166)("iframe"),r=o.length;for(t.style.display="none",n(162).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;r--;)delete u.prototype[o[r]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[i]=e):n=u(),void 0===t?n:a(n,t)}},function(e,t,n){var r=n(45),a=Math.max,o=Math.min;e.exports=function(e,t){return(e=r(e))<0?a(e+t,0):o(e,t)}},function(e,t,n){var r=n(223),a=n(163);e.exports=Object.keys||function(e){return r(e,a)}},function(e,t){e.exports=!1},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";n.d(t,"a",function(){return s});var r=n(2),a=n(3),o=n(0),i=function(e,t,n,r){var a,o=arguments.length,i=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,n,i):a(t,n))||i);return o>3&&i&&Object.defineProperty(t,n,i),i},s=function(){function e(){}return e.tidy=function(e,t,n){void 0===n&&(n=!1);var r=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");r=e}a.ENV.engine.startScope(r,n);var o=t();return o instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),a.ENV.engine.endScope(o,n),o},e.dispose=function(e){Object(o.extractTensorsFromAny)(e).forEach(function(e){return e.dispose()})},e.keep=function(e){return a.ENV.engine.keep(e)},e.time=function(e){return a.ENV.engine.time(e)},i([Object(r.a)({heading:"Performance",subheading:"Memory"})],e,"tidy",null),i([Object(r.a)({heading:"Performance",subheading:"Memory"})],e,"keep",null),i([Object(r.a)({heading:"Performance",subheading:"Timing"})],e,"time",null),e}()},function(e,t){e.exports={}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,n){var r=n(189),a=n(137);e.exports=function(e){return r(a(e))}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(105);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,a){return e.call(t,n,r,a)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(15);e.exports=function(e,t){if(!r(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},function(e,t){e.exports={}},function(e,t,n){var r=n(5),a=n(46),o=n(14),i=n(160),s="["+i+"]",u=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),l=function(e,t,n){var a={},s=o(function(){return!!i[e]()||" "!=" "[e]()}),u=a[e]=s?t(f):i[e];n&&(a[n]=u),r(r.P+r.F*s,"String",a)},f=l.trim=function(e,t){return e=String(a(e)),1&t&&(e=e.replace(u,"")),2&t&&(e=e.replace(c,"")),e};e.exports=l},function(e,t,n){var r=n(18).f,a=n(29),o=n(16)("toStringTag");e.exports=function(e,t,n){e&&!a(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){"use strict";n.d(t,"a",function(){return a}),n.d(t,"b",function(){return o});var r=n(0);function a(e,t,n){r.assert(e.rank===t.length,"Error in slice"+e.rank+"D: Length of begin "+t+" must match the rank of the array ("+e.rank+")."),r.assert(e.rank===n.length,"Error in slice"+e.rank+"D: Length of size "+n+" must match the rank of the array ("+e.rank+").");for(var a=0;a<e.rank;++a)r.assert(t[a]+n[a]<=e.shape[a],"Error in slice"+e.rank+"D: begin["+a+"] + size["+a+"] ("+(t[a]+n[a])+") would overflow input.shape["+a+"] ("+e.shape[a]+")")}function o(e,t,n,r,a,o){void 0===a&&(a=0),void 0===o&&(o=0);for(var u=[],c=[],l=0;l<e.length;l++)u[l]=i(a,t,r,e,l),c[l]=s(o,n,r,e,l);var f=new Array(e.length).fill(0);return f=f.map(function(e,t){for(var n=0,a=u[t];!(r[t]>0?a>=c[t]:a<=c[t]);a+=r[t])n+=1;return n}),[u,f]}function i(e,t,n,a,o){var i=t[o];e&1<<o&&(i=n[o]>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var s=a[o];return i<0&&(i+=s),r.clamp(0,i,s-1)}function s(e,t,n,a,o){var i=t[o];e&1<<o&&(i=n[o]>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var s=a[o];return i<0&&(i+=s),n[o]>0?r.clamp(0,i,s):r.clamp(-1,i,s-1)}},function(e,t,n){"use strict";var r=n(304)(!0);n(185)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(137);e.exports=function(e){return Object(r(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(190),a=n(132);e.exports=Object.keys||function(e){return r(e,a)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(37),a=n(16)("toStringTag"),o="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),a))?n:o?r(t):"Object"==(i=r(t))&&"function"==typeof t.callee?"Arguments":i}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(37);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";e.exports=n(322)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imgToTensor=t.cropImage=t.processVideo=t.array3DToImage=void 0;var r,a=(r=n(123))&&r.__esModule?r:{default:r},o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10)),i=function(e){var t=Math.min(e.shape[0],e.shape[1]),n=e.shape[0]/2-t/2,r=e.shape[1]/2-t/2;return e.slice([n,r,0],[t,t,3])};t.array3DToImage=function(e){var t=(0,a.default)(e.shape,2),n=t[0],r=t[1],o=e.dataSync(),i=document.createElement("canvas");i.width=n,i.height=r;for(var s=i.getContext("2d"),u=s.getImageData(0,0,i.width,i.height),c=0;c<n*r;c+=1){var l=4*c,f=3*c;u.data[l+0]=Math.floor(256*o[f+0]),u.data[l+1]=Math.floor(256*o[f+1]),u.data[l+2]=Math.floor(256*o[f+2]),u.data[l+3]=255}s.putImageData(u,0,0);var p=i.toDataURL(),h=document.createElement("img");return h.src=p,h.style.width=n,h.style.height=r,h},t.processVideo=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=e,a=document.createElement("video");return r.onplay=function(){var e=r.captureStream();a.srcObject=e,a.width=t,a.height=t,a.autoplay=!0,a.playsinline=!0,a.muted=!0,n()},a},t.cropImage=i,t.imgToTensor=function(e){return o.tidy(function(){var t=o.fromPixels(e);return i(t).expandDims(0).toFloat().div(o.scalar(127)).sub(o.scalar(1))})}},function(e,t,n){n(301);for(var r=n(25),a=n(65),o=n(78),i=n(24)("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[i]&&a(f,i,c),o[c]=o.Array}},function(e,t,n){var r=n(49).f,a=n(64),o=n(24)("toStringTag");e.exports=function(e,t,n){e&&!a(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t){e.exports=!0},function(e,t,n){e.exports={default:n(305),__esModule:!0}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";var r=n(5),a=n(23),o=n(38),i=n(67);e.exports=function(e){r(r.S,e,{from:function(e){var t,n,r,s,u=arguments[1];return a(this),(t=void 0!==u)&&a(u),void 0==e?new this:(n=[],t?(r=0,s=o(u,arguments[2],2),i(e,!1,function(e){n.push(s(e,r++))})):i(e,!1,n.push,n),new this(n))}})}},function(e,t,n){"use strict";var r=n(5);e.exports=function(e){r(r.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},function(e,t,n){"use strict";e.exports=n(74)||!n(14)(function(){var e=Math.random();__defineSetter__.call(null,e,function(){}),delete n(13)[e]})},function(e,t,n){for(var r,a=n(13),o=n(28),i=n(75),s=i("typed_array"),u=i("view"),c=!(!a.ArrayBuffer||!a.DataView),l=c,f=0,p="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f<9;)(r=a[p[f++]])?(o(r.prototype,s,!0),o(r.prototype,u,!0)):l=!1;e.exports={ABV:c,CONSTR:l,TYPED:s,VIEW:u}},function(e,t,n){"use strict";var r=n(13),a=n(5),o=n(27),i=n(66),s=n(57),u=n(67),c=n(68),l=n(15),f=n(14),p=n(114),h=n(86),d=n(159);e.exports=function(e,t,n,m,g,y){var v=r[e],b=v,w=g?"set":"add",x=b&&b.prototype,k={},O=function(e){var t=x[e];o(x,e,"delete"==e?function(e){return!(y&&!l(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(y&&!l(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return y&&!l(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof b&&(y||x.forEach&&!f(function(){(new b).entries().next()}))){var S=new b,N=S[w](y?{}:-0,1)!=S,E=f(function(){S.has(1)}),I=p(function(e){new b(e)}),T=!y&&f(function(){for(var e=new b,t=5;t--;)e[w](t,t);return!e.has(-0)});I||((b=t(function(t,n){c(t,b,e);var r=d(new v,t,b);return void 0!=n&&u(n,g,r[w],r),r})).prototype=x,x.constructor=b),(E||T)&&(O("delete"),O("has"),g&&O("get")),(T||N)&&O(w),y&&x.clear&&delete x.clear}else b=m.getConstructor(t,e,g,w),i(b.prototype,n),s.NEED=!0;return h(b,e),k[e]=b,a(a.G+a.W+a.F*(b!=v),k),y||m.setStrong(b,e,g),b}},function(e,t,n){var r=n(12),a=n(23),o=n(16)("species");e.exports=function(e,t){var n,i=r(e).constructor;return void 0===i||void 0==(n=r(i)[o])?t:a(n)}},function(e,t,n){"use strict";var r=n(28),a=n(27),o=n(14),i=n(46),s=n(16);e.exports=function(e,t,n){var u=s(e),c=n(i,u,""[e]),l=c[0],f=c[1];o(function(){var t={};return t[u]=function(){return 7},7!=""[e](t)})&&(a(String.prototype,e,l),r(RegExp.prototype,u,2==t?function(e,t){return f.call(e,this,t)}:function(e){return f.call(e,this)}))}},function(e,t,n){"use strict";var r=n(12);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(16)("iterator"),a=!1;try{var o=[7][r]();o.return=function(){a=!0},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!a)return!1;var n=!1;try{var o=[7],i=o[r]();i.next=function(){return{done:n=!0}},o[r]=function(){return i},e(o)}catch(e){}return n}},function(e,t,n){var r=n(15),a=n(37),o=n(16)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"==a(e))}},function(e,t,n){var r=n(37);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(33),a=n(17),o=n(72);e.exports=function(e){return function(t,n,i){var s,u=r(t),c=a(u.length),l=o(i,c);if(e&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var r=n(13),a=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t,n){var r=n(335),a=n(334),o=n(333),i=n(332),s=n(331),u=n(330),c=n(329);c.alea=r,c.xor128=a,c.xorwow=o,c.xorshift7=i,c.xor4096=s,c.tychei=u,e.exports=c},function(e,t,n){"use strict";n.d(t,"a",function(){return s});var r=n(0),a=20,o=3,i=7;function s(e,t){var n=e.dataSync(),r=function(e){var t=e.dataSync(),n=e.size,r=e.strides[e.strides.length-1],a=new Array(r).fill(0);if(e.rank>1)for(var o=0;o<n/r;o++)for(var i=o*r,s=0;s<r;s++)a[s]=Math.max(a[s],u(t[i+s],0).length);return a}(e),i=function e(t,n,r,i,s){void 0===s&&(s=!0);var c=n[0],l=n.length;if(0===l)return[t[0].toString()];if(1===l){if(c>a){var f=Array.from(t.subarray(0,o)),p=Array.from(t.subarray(c-o,c));return["["+f.map(function(e,t){return u(e,i[t])}).join(", ")+", ..., "+p.map(function(e,t){return u(e,i[c-o+t])}).join(", ")+"]"]}return["["+Array.from(t).map(function(e,t){return u(e,i[t])}).join(", ")+"]"]}var h=n.slice(1),d=r.slice(1),m=r[0],g=[];if(c>a){for(var y=0;y<o;y++){var v=(b=y*m)+m;g.push.apply(g,e(t.subarray(b,v),h,d,i,!1))}g.push("...");for(y=c-o;y<c;y++){v=(b=y*m)+m;g.push.apply(g,e(t.subarray(b,v),h,d,i,y===c-1))}}else for(y=0;y<c;y++){var b;v=(b=y*m)+m;g.push.apply(g,e(t.subarray(b,v),h,d,i,y===c-1))}var w=2===l?",":"";g[0]="["+g[0]+w;for(y=1;y<g.length-1;y++)g[y]=" "+g[y]+w;var x=",\n";for(y=2;y<l;y++)x+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(s?"":x),g}(n,e.shape,e.strides,r),s=["Tensor"];return t&&(s.push(" dtype: "+e.dtype),s.push(" rank: "+e.rank),s.push(" shape: ["+e.shape+"]"),s.push(" values:")),s.push(i.map(function(e){return" "+e}).join("\n")),s.join("\n")}function u(e,t){return r.rightPad(parseFloat(e.toFixed(i)).toString(),t)}},function(e,t,n){e.exports={default:n(264),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=o(n(271)),a=o(n(268));function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if(Array.isArray(e))return e;if((0,r.default)(Object(e)))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var s,u=(0,a.default)(e);!(r=(s=u.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(102)),a=s(n(53)),o=s(n(41)),i=s(n(40));function s(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(t,n){(0,o.default)(this,e),this.videoElt=null,this.size=n,this.videoReady=!1,t instanceof HTMLVideoElement?this.videoElt=t:null!==t&&"object"===(void 0===t?"undefined":(0,a.default)(t))&&t.elt instanceof HTMLVideoElement&&(this.videoElt=t.elt)}return(0,i.default)(e,[{key:"loadVideo",value:function(){var e=this;return new r.default(function(t){e.video=document.createElement("video");var n=e.videoElt.captureStream();e.video.srcObject=n,e.video.width=e.size,e.video.height=e.size,e.video.autoplay=!0,e.video.playsinline=!0,e.video.muted=!0;var r=e.video.play();void 0!==r&&r.then(function(){t()})})}}]),e}();t.default=u},function(e,t,n){var r=n(25),a=n(21),o=n(101),i=n(126),s=n(49).f;e.exports=function(e){var t=a.Symbol||(a.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:i.f(e)})}},function(e,t,n){t.f=n(24)},function(e,t,n){"use strict";var r=n(105);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){var r=n(129),a=n(24)("iterator"),o=n(78);e.exports=n(21).getIteratorMethod=function(e){if(void 0!=e)return e[a]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(90),a=n(24)("toStringTag"),o="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),a))?n:o?r(t):"Object"==(i=r(t))&&"function"==typeof t.callee?"Arguments":i}},function(e,t,n){var r=n(42),a=n(302),o=n(132),i=n(134)("IE_PROTO"),s=function(){},u=function(){var e,t=n(139)("iframe"),r=o.length;for(t.style.display="none",n(183).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;r--;)delete u.prototype[o[r]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[i]=e):n=u(),void 0===t?n:a(n,t)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(25),a=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t,n){var r=n(133)("keys"),a=n(104);e.exports=function(e){return r[e]||(r[e]=a(e))}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(135),a=Math.min;e.exports=function(e){return e>0?a(r(e),9007199254740991):0}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(55);e.exports=function(e,t){if(!r(e))return e;var n,a;if(t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;if("function"==typeof(n=e.valueOf)&&!r(a=n.call(e)))return a;if(!t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(55),a=n(25).document,o=r(a)&&r(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},function(e,t,n){var r=n(13).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){"use strict";var r=n(13),a=n(19),o=n(74),i=n(109),s=n(28),u=n(66),c=n(14),l=n(68),f=n(45),p=n(17),h=n(199),d=n(70).f,m=n(18).f,g=n(146),y=n(86),v="prototype",b="Wrong index!",w=r.ArrayBuffer,x=r.DataView,k=r.Math,O=r.RangeError,S=r.Infinity,N=w,E=k.abs,I=k.pow,T=k.floor,A=k.log,C=k.LN2,P=a?"_b":"buffer",_=a?"_l":"byteLength",R=a?"_o":"byteOffset";function M(e,t,n){var r,a,o,i=new Array(n),s=8*n-t-1,u=(1<<s)-1,c=u>>1,l=23===t?I(2,-24)-I(2,-77):0,f=0,p=e<0||0===e&&1/e<0?1:0;for((e=E(e))!=e||e===S?(a=e!=e?1:0,r=u):(r=T(A(e)/C),e*(o=I(2,-r))<1&&(r--,o*=2),(e+=r+c>=1?l/o:l*I(2,1-c))*o>=2&&(r++,o/=2),r+c>=u?(a=0,r=u):r+c>=1?(a=(e*o-1)*I(2,t),r+=c):(a=e*I(2,c-1)*I(2,t),r=0));t>=8;i[f++]=255&a,a/=256,t-=8);for(r=r<<t|a,s+=t;s>0;i[f++]=255&r,r/=256,s-=8);return i[--f]|=128*p,i}function j(e,t,n){var r,a=8*n-t-1,o=(1<<a)-1,i=o>>1,s=a-7,u=n-1,c=e[u--],l=127&c;for(c>>=7;s>0;l=256*l+e[u],u--,s-=8);for(r=l&(1<<-s)-1,l>>=-s,s+=t;s>0;r=256*r+e[u],u--,s-=8);if(0===l)l=1-i;else{if(l===o)return r?NaN:c?-S:S;r+=I(2,t),l-=i}return(c?-1:1)*r*I(2,l-t)}function D(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]}function L(e){return[255&e]}function z(e){return[255&e,e>>8&255]}function F(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function B(e){return M(e,52,8)}function V(e){return M(e,23,4)}function U(e,t,n){m(e[v],t,{get:function(){return this[n]}})}function W(e,t,n,r){var a=h(+n);if(a+t>e[_])throw O(b);var o=e[P]._b,i=a+e[R],s=o.slice(i,i+t);return r?s:s.reverse()}function G(e,t,n,r,a,o){var i=h(+n);if(i+t>e[_])throw O(b);for(var s=e[P]._b,u=i+e[R],c=r(+a),l=0;l<t;l++)s[u+l]=c[o?l:t-l-1]}if(i.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 q,H=(w=function(e){return l(this,w),new N(h(e))})[v]=N[v],K=d(N),X=0;K.length>X;)(q=K[X++])in w||s(w,q,N[q]);o||(H.constructor=w)}var J=new x(new w(2)),Y=x[v].setInt8;J.setInt8(0,2147483648),J.setInt8(1,2147483649),!J.getInt8(0)&&J.getInt8(1)||u(x[v],{setInt8:function(e,t){Y.call(this,e,t<<24>>24)},setUint8:function(e,t){Y.call(this,e,t<<24>>24)}},!0)}else w=function(e){l(this,w,"ArrayBuffer");var t=h(e);this._b=g.call(new Array(t),0),this[_]=t},x=function(e,t,n){l(this,x,"DataView"),l(e,w,"DataView");var r=e[_],a=f(t);if(a<0||a>r)throw O("Wrong offset!");if(a+(n=void 0===n?r-a:p(n))>r)throw O("Wrong length!");this[P]=e,this[R]=a,this[_]=n},a&&(U(w,"byteLength","_l"),U(x,"buffer","_b"),U(x,"byteLength","_l"),U(x,"byteOffset","_o")),u(x[v],{getInt8:function(e){return W(this,1,e)[0]<<24>>24},getUint8:function(e){return W(this,1,e)[0]},getInt16:function(e){var t=W(this,2,e,arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=W(this,2,e,arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return D(W(this,4,e,arguments[1]))},getUint32:function(e){return D(W(this,4,e,arguments[1]))>>>0},getFloat32:function(e){return j(W(this,4,e,arguments[1]),23,4)},getFloat64:function(e){return j(W(this,8,e,arguments[1]),52,8)},setInt8:function(e,t){G(this,1,e,L,t)},setUint8:function(e,t){G(this,1,e,L,t)},setInt16:function(e,t){G(this,2,e,z,t,arguments[2])},setUint16:function(e,t){G(this,2,e,z,t,arguments[2])},setInt32:function(e,t){G(this,4,e,F,t,arguments[2])},setUint32:function(e,t){G(this,4,e,F,t,arguments[2])},setFloat32:function(e,t){G(this,4,e,V,t,arguments[2])},setFloat64:function(e,t){G(this,8,e,B,t,arguments[2])}});y(w,"ArrayBuffer"),y(x,"DataView"),s(x[v],i.VIEW,!0),t.ArrayBuffer=w,t.DataView=x},function(e,t,n){"use strict";var r=n(23);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){var r=n(13),a=n(144).set,o=r.MutationObserver||r.WebKitMutationObserver,i=r.process,s=r.Promise,u="process"==n(37)(i);e.exports=function(){var e,t,n,c=function(){var r,a;for(u&&(r=i.domain)&&r.exit();e;){a=e.fn,e=e.next;try{a()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(u)n=function(){i.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve();n=function(){l.then(c)}}else n=function(){a.call(r,c)};else{var f=!0,p=document.createTextNode("");new o(c).observe(p,{characterData:!0}),n=function(){p.data=f=!f}}return function(r){var a={fn:r,next:void 0};t&&(t.next=a),e||(e=a,n()),t=a}}},function(e,t,n){var r,a,o,i=n(38),s=n(218),u=n(162),c=n(166),l=n(13),f=l.process,p=l.setImmediate,h=l.clearImmediate,d=l.MessageChannel,m=l.Dispatch,g=0,y={},v=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},b=function(e){v.call(e.data)};p&&h||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return y[++g]=function(){s("function"==typeof e?e:Function(e),t)},r(g),g},h=function(e){delete y[e]},"process"==n(37)(f)?r=function(e){f.nextTick(i(v,e,1))}:m&&m.now?r=function(e){m.now(i(v,e,1))}:d?(o=(a=new d).port2,a.port1.onmessage=b,r=i(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):r="onreadystatechange"in c("script")?function(e){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),v.call(e)}}:function(e){setTimeout(i(v,e,1),0)}),e.exports={set:p,clear:h}},function(e,t,n){"use strict";var r=n(56),a=n(208),o=n(84),i=n(33);e.exports=n(154)(Array,"Array",function(e,t){this._t=i(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,a(1)):a(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t,n){"use strict";var r=n(22),a=n(72),o=n(17);e.exports=function(e){for(var t=r(this),n=o(t.length),i=arguments.length,s=a(i>1?arguments[1]:void 0,n),u=i>2?arguments[2]:void 0,c=void 0===u?n:a(u,n);c>s;)t[s++]=e;return t}},function(e,t,n){var r=n(453);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(93),a=n(16)("iterator"),o=n(84);e.exports=n(48).getIteratorMethod=function(e){if(void 0!=e)return e[a]||e["@@iterator"]||o[r(e)]}},function(e,t,n){"use strict";var r=n(18),a=n(76);e.exports=function(e,t,n){t in e?r.f(e,t,a(0,n)):e[t]=n}},function(e,t,n){var r=n(84),a=n(16)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[a]===e)}},function(e,t,n){var r=n(16)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,!"/./"[e](t)}catch(e){}}return!0}},function(e,t,n){var r=n(115),a=n(46);e.exports=function(e,t,n){if(r(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(a(e))}},function(e,t,n){"use strict";var r=n(71),a=n(76),o=n(86),i={};n(28)(i,n(16)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(i,{next:a(1,n)}),o(e,t+" Iterator")}},function(e,t,n){"use strict";var r=n(74),a=n(5),o=n(27),i=n(28),s=n(29),u=n(84),c=n(153),l=n(86),f=n(31),p=n(16)("iterator"),h=!([].keys&&"next"in[].keys()),d=function(){return this};e.exports=function(e,t,n,m,g,y,v){c(n,t,m);var b,w,x,k=function(e){if(!h&&e in E)return E[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},O=t+" Iterator",S="values"==g,N=!1,E=e.prototype,I=E[p]||E["@@iterator"]||g&&E[g],T=!h&&I||k(g),A=g?S?k("entries"):T:void 0,C="Array"==t&&E.entries||I;if(C&&(x=f(C.call(new e)))!==Object.prototype&&x.next&&(l(x,O,!0),r||s(x,p)||i(x,p,d)),S&&I&&"values"!==I.name&&(N=!0,T=function(){return I.call(this)}),r&&!v||!h&&!N&&E[p]||i(E,p,T),u[t]=T,u[O]=d,g)if(b={values:S?T:k("values"),keys:y?T:k("keys"),entries:A},v)for(w in b)w in E||o(E,w,b[w]);else a(a.P+a.F*(h||N),t,b);return b}},function(e,t,n){var r=n(45),a=n(46);e.exports=function(e){return function(t,n){var o,i,s=String(a(t)),u=r(n),c=s.length;return u<0||u>=c?e?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(i=s.charCodeAt(u+1))<56320||i>57343?e?s.charAt(u):o:e?s.slice(u,u+2):i-56320+(o-55296<<10)+65536}}},function(e,t){var n=Math.expm1;e.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||-2e-17!=n(-2e-17)?function(e){return 0==(e=+e)?e:e>-1e-6&&e<1e-6?e+e*e/2:Math.exp(e)-1}:n},function(e,t){e.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:e<0?-1:1}},function(e,t,n){"use strict";var r=n(45),a=n(46);e.exports=function(e){var t=String(a(this)),n="",o=r(e);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(t+=t))1&o&&(n+=t);return n}},function(e,t,n){var r=n(15),a=n(161).set;e.exports=function(e,t,n){var o,i=t.constructor;return i!==n&&"function"==typeof i&&(o=i.prototype)!==n.prototype&&r(o)&&a&&a(e,o),e}},function(e,t){e.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(e,t,n){var r=n(15),a=n(12),o=function(e,t){if(a(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=n(38)(Function.call,n(32).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){var r=n(13).document;e.exports=r&&r.documentElement},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(119)("keys"),a=n(75);e.exports=function(e){return r[e]||(r[e]=a(e))}},function(e,t,n){var r=n(13),a=n(48),o=n(74),i=n(224),s=n(18).f;e.exports=function(e){var t=a.Symbol||(a.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:i.f(e)})}},function(e,t,n){var r=n(15),a=n(13).document,o=r(a)&&r(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},function(e,t,n){"use strict";var r=n(327),a=n(326);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return a.isString(e)&&(e=b(e)),e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var i=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=n(325);function b(e,t,n){if(e&&a.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!a.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),s=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(s);c[0]=c[0].replace(/\\/g,"/");var b=e=c.join(s);if(b=b.trim(),!n&&1===e.split("#").length){var w=u.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var x=i.exec(b);if(x){var k=(x=x[0]).toLowerCase();this.protocol=k,b=b.substr(x.length)}if(n||x||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var O="//"===b.substr(0,2);!O||x&&g[x]||(b=b.substr(2),this.slashes=!0)}if(!g[x]&&(O||x&&!y[x])){for(var S,N,E=-1,I=0;I<p.length;I++)-1!==(T=b.indexOf(p[I]))&&(-1===E||T<E)&&(E=T);for(-1!==(N=-1===E?b.lastIndexOf("@"):b.lastIndexOf("@",E))&&(S=b.slice(0,N),b=b.slice(N+1),this.auth=decodeURIComponent(S)),E=-1,I=0;I<f.length;I++){var T;-1!==(T=b.indexOf(f[I]))&&(-1===E||T<E)&&(E=T)}-1===E&&(E=b.length),this.host=b.slice(0,E),b=b.slice(E),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var C=this.hostname.split(/\./),P=(I=0,C.length);I<P;I++){var _=C[I];if(_&&!_.match(h)){for(var R="",M=0,j=_.length;M<j;M++)_.charCodeAt(M)>127?R+="x":R+=_[M];if(!R.match(h)){var D=C.slice(0,I),L=C.slice(I+1),z=_.match(d);z&&(D.push(z[1]),L.unshift(z[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+F,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[k])for(I=0,P=l.length;I<P;I++){var V=l[I];if(-1!==b.indexOf(V)){var U=encodeURIComponent(V);U===V&&(U=escape(V)),b=b.split(V).join(U)}}var W=b.indexOf("#");-1!==W&&(this.hash=b.substr(W),b=b.slice(0,W));var G=b.indexOf("?");if(-1!==G?(this.search=b.substr(G),this.query=b.substr(G+1),t&&(this.query=v.parse(this.query)),b=b.slice(0,G)):t&&(this.search="",this.query={}),b&&(this.pathname=b),y[k]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var q=this.search||"";this.path=F+q}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&a.isObject(this.query)&&Object.keys(this.query).length&&(i=v.stringify(this.query));var s=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||y[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),t+o+(n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(s=s.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(a.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),i=0;i<r.length;i++){var s=r[i];n[s]=this[s]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=e[l])}return y[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!y[e.protocol]){for(var f=Object.keys(e),p=0;p<f.length;p++){var h=f[p];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||g[e.protocol])n.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var m=n.pathname||"",v=n.search||"";n.path=m+v}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),x=w||b||n.host&&e.pathname,k=x,O=n.pathname&&n.pathname.split("/")||[],S=(d=e.pathname&&e.pathname.split("/")||[],n.protocol&&!y[n.protocol]);if(S&&(n.hostname="",n.port=null,n.host&&(""===O[0]?O[0]=n.host:O.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),x=x&&(""===d[0]||""===O[0])),w)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,O=d;else if(d.length)O||(O=[]),O.pop(),O=O.concat(d),n.search=e.search,n.query=e.query;else if(!a.isNullOrUndefined(e.search))return S&&(n.hostname=n.host=O.shift(),(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift())),n.search=e.search,n.query=e.query,a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!O.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var N=O.slice(-1)[0],E=(n.host||e.host||O.length>1)&&("."===N||".."===N)||""===N,I=0,T=O.length;T>=0;T--)"."===(N=O[T])?O.splice(T,1):".."===N?(O.splice(T,1),I++):I&&(O.splice(T,1),I--);if(!x&&!k)for(;I--;I)O.unshift("..");!x||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),E&&"/"!==O.join("/").substr(-1)&&O.push("");var A,C=""===O[0]||O[0]&&"/"===O[0].charAt(0);return S&&(n.hostname=n.host=C?"":O.length?O.shift():"",(A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=A.shift(),n.host=n.hostname=A.shift())),(x=x||n.host&&O.length)&&!C&&O.unshift(""),O.length?n.pathname=O.join("/"):(n.pathname=null,n.path=null),a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(122)),a=u(n(102)),o=u(n(41)),i=u(n(40)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t){(0,o.default)(this,e),this.urlPath=t,"/"!==this.urlPath.charAt(this.urlPath.length-1)&&(this.urlPath+="/")}return(0,i.default)(e,[{key:"loadManifest",value:function(){var e=this;return new a.default(function(t){var n=new XMLHttpRequest;n.open("GET",e.urlPath+"manifest.json"),n.onload=function(){e.checkpointManifest=JSON.parse(n.responseText),t()},n.onerror=function(t){throw new Error("manifest.json not found at "+e.urlPath+". "+t)},n.send()})}},{key:"getCheckpointManifest",value:function(){var e=this;return null==this.checkpointManifest?new a.default(function(t){e.loadManifest().then(function(){t(e.checkpointManifest)})}):new a.default(function(t){t(e.checkpointManifest)})}},{key:"getAllVariables",value:function(){var e=this;return null!=this.variables?new a.default(function(t){t(e.variables)}):new a.default(function(t){e.getCheckpointManifest().then(function(){for(var n=(0,r.default)(e.checkpointManifest),o=[],i=0;i<n.length;i+=1)o.push(e.getVariable(n[i]));a.default.all(o).then(function(r){e.variables={};for(var a=0;a<r.length;a+=1)e.variables[n[a]]=r[a];t(e.variables)})})})}},{key:"getVariable",value:function(e){var t=this;if(!(e in this.checkpointManifest))throw new Error("Cannot load non-existant variable "+e);var n=function(n){var r=new XMLHttpRequest;r.responseType="arraybuffer";var a=t.checkpointManifest[e].filename;r.open("GET",t.urlPath+a),r.onload=function(){if(404===r.status)throw new Error("Not found variable "+e);var a=new Float32Array(r.response),o=s.Tensor.make(t.checkpointManifest[e].shape,{values:a});n(o)},r.onerror=function(t){throw new Error("Could not fetch variable "+e+": "+t)},r.send()};return null==this.checkpointManifest?new a.default(function(e){t.loadManifest().then(function(){new a.default(n).then(e)})}):new a.default(n)}}]),e}();t.default=c},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(259)),a=i(n(255)),o=i(n(53));function i(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,o.default)(t)));e.prototype=(0,a.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.default?(0,r.default)(e,t):e.__proto__=t)}},function(e,t,n){"use strict";t.__esModule=!0;var r,a=(r=n(53))&&r.__esModule?r:{default:r};t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,a.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){e.exports={default:n(261),__esModule:!0}},function(e,t,n){var r=n(35),a=n(21),o=n(81);e.exports=function(e,t){var n=(a.Object||{})[e]||Object[e],i={};i[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",i)}},function(e,t,n){var r=n(103),a=n(92),o=n(80),i=n(138),s=n(64),u=n(191),c=Object.getOwnPropertyDescriptor;t.f=n(54)?c:function(e,t){if(e=o(e),t=i(t,!0),u)try{return c(e,t)}catch(e){}if(s(e,t))return a(!r.f.call(e,t),e[t])}},function(e,t,n){var r=n(190),a=n(132).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,a)}},function(e,t,n){var r=n(24)("iterator"),a=!1;try{var o=[7][r]();o.return=function(){a=!0},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!a)return!1;var n=!1;try{var o=[7],i=o[r]();i.next=function(){return{done:n=!0}},o[r]=function(){return i},e(o)}catch(e){}return n}},function(e,t,n){var r=n(42),a=n(55),o=n(127);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r,a,o,i=n(82),s=n(295),u=n(183),c=n(139),l=n(25),f=l.process,p=l.setImmediate,h=l.clearImmediate,d=l.MessageChannel,m=l.Dispatch,g=0,y={},v=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},b=function(e){v.call(e.data)};p&&h||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return y[++g]=function(){s("function"==typeof e?e:Function(e),t)},r(g),g},h=function(e){delete y[e]},"process"==n(90)(f)?r=function(e){f.nextTick(i(v,e,1))}:m&&m.now?r=function(e){m.now(i(v,e,1))}:d?(o=(a=new d).port2,a.port1.onmessage=b,r=i(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):r="onreadystatechange"in c("script")?function(e){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),v.call(e)}}:function(e){setTimeout(i(v,e,1),0)}),e.exports={set:p,clear:h}},function(e,t,n){var r=n(42),a=n(105),o=n(24)("species");e.exports=function(e,t){var n,i=r(e).constructor;return void 0===i||void 0==(n=r(i)[o])?t:a(n)}},function(e,t,n){var r=n(78),a=n(24)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[a]===e)}},function(e,t,n){var r=n(42);e.exports=function(e,t,n,a){try{return a?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){var r=n(64),a=n(89),o=n(134)("IE_PROTO"),i=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?i:null}},function(e,t,n){var r=n(25).document;e.exports=r&&r.documentElement},function(e,t,n){e.exports=n(65)},function(e,t,n){"use strict";var r=n(101),a=n(35),o=n(184),i=n(65),s=n(64),u=n(78),c=n(303),l=n(100),f=n(182),p=n(24)("iterator"),h=!([].keys&&"next"in[].keys()),d=function(){return this};e.exports=function(e,t,n,m,g,y,v){c(n,t,m);var b,w,x,k=function(e){if(!h&&e in E)return E[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},O=t+" Iterator",S="values"==g,N=!1,E=e.prototype,I=E[p]||E["@@iterator"]||g&&E[g],T=!h&&I||k(g),A=g?S?k("entries"):T:void 0,C="Array"==t&&E.entries||I;if(C&&(x=f(C.call(new e)))!==Object.prototype&&x.next&&(l(x,O,!0),r||s(x,p)||i(x,p,d)),S&&I&&"values"!==I.name&&(N=!0,T=function(){return I.call(this)}),r&&!v||!h&&!N&&E[p]||i(E,p,T),u[t]=T,u[O]=d,g)if(b={values:S?T:k("values"),keys:y?T:k("keys"),entries:A},v)for(w in b)w in E||o(E,w,b[w]);else a(a.P+a.F*(h||N),t,b);return b}},function(e,t){},function(e,t,n){"use strict";e.exports=u;var r,a=n(62),o=a.LongBits,i=a.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var c,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")};function f(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw s(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}u.create=a.Buffer?function(e){return(u.create=function(e){return a.Buffer.isBuffer(e)?new r(e):l(e)})(e)}:l,u.prototype._slice=a.Array.prototype.subarray||a.Array.prototype.slice,u.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return c}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return p(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|p(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=a.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=a.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw s(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},u.prototype.string=function(){var e=this.bytes();return i.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){r=e;var t=a.Long?"toLong":"toNumber";a.merge(u.prototype,{int64:function(){return f.call(this)[t](!1)},uint64:function(){return f.call(this)[t](!0)},sint64:function(){return f.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},function(e,t,n){"use strict";e.exports=l;var r,a=n(62),o=a.LongBits,i=a.base64,s=a.utf8;function u(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function c(){}function l(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function h(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function d(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}l.create=a.Buffer?function(){return(l.create=function(){return new r})()}:function(){return new l},l.alloc=function(e){return new a.Array(e)},a.Array!==Array&&(l.alloc=a.pool(l.alloc,a.Array.prototype.subarray)),l.prototype._push=function(e,t,n){return this.tail=this.tail.next=new u(e,t,n),this.len+=t,this},p.prototype=Object.create(u.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},l.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},l.prototype.int32=function(e){return e<0?this._push(h,10,o.fromNumber(e)):this.uint32(e)},l.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},l.prototype.uint64=function(e){var t=o.from(e);return this._push(h,t.length(),t)},l.prototype.int64=l.prototype.uint64,l.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(h,t.length(),t)},l.prototype.bool=function(e){return this._push(f,1,e?1:0)},l.prototype.fixed32=function(e){return this._push(d,4,e>>>0)},l.prototype.sfixed32=l.prototype.fixed32,l.prototype.fixed64=function(e){var t=o.from(e);return this._push(d,4,t.lo)._push(d,4,t.hi)},l.prototype.sfixed64=l.prototype.fixed64,l.prototype.float=function(e){return this._push(a.float.writeFloatLE,4,e)},l.prototype.double=function(e){return this._push(a.float.writeDoubleLE,8,e)};var m=a.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};l.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(a.isString(e)){var n=l.alloc(t=i.length(e));i.decode(e,n,0),e=n}return this.uint32(t)._push(m,t,e)},l.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t)._push(s.write,t,e):this._push(f,1,0)},l.prototype.fork=function(){return this.states=new function(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}(this),this.head=this.tail=new u(c,0,0),this.len=0,this},l.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(c,0,0),this.len=0),this},l.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},l.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},l._configure=function(e){r=e}},function(e,t,n){var r=n(90);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(64),a=n(80),o=n(337)(!1),i=n(134)("IE_PROTO");e.exports=function(e,t){var n,s=a(e),u=0,c=[];for(n in s)n!=i&&r(s,n)&&c.push(n);for(;t.length>u;)r(s,n=t[u++])&&(~o(c,n)||c.push(n));return c}},function(e,t,n){e.exports=!n(54)&&!n(81)(function(){return 7!=Object.defineProperty(n(139)("div"),"a",{get:function(){return 7}}).a})},function(e,t){e.exports=Math.scale||function(e,t,n,r,a){return 0===arguments.length||e!=e||t!=t||n!=n||r!=r||a!=a?NaN:e===1/0||e===-1/0?e:(e-t)*(a-r)/(n-t)+r}},function(e,t,n){var r=n(67);e.exports=function(e,t){var n=[];return r(e,!1,n.push,n,t),n}},function(e,t,n){var r=n(93),a=n(193);e.exports=function(e){return function(){if(r(this)!=e)throw TypeError(e+"#toJSON isn't generic");return a(this)}}},function(e,t,n){var r=n(73),a=n(33),o=n(94).f;e.exports=function(e){return function(t){for(var n,i=a(t),s=r(i),u=s.length,c=0,l=[];u>c;)o.call(i,n=s[c++])&&l.push(e?[n,i[n]]:i[n]);return l}}},function(e,t,n){var r=n(17),a=n(158),o=n(46);e.exports=function(e,t,n,i){var s=String(o(e)),u=s.length,c=void 0===n?" ":String(n),l=r(t);if(l<=u||""==c)return s;var f=l-u,p=a.call(c,Math.ceil(f/c.length));return p.length>f&&(p=p.slice(0,f)),i?p+s:s+p}},function(e,t,n){"use strict";var r=n(116),a=n(15),o=n(17),i=n(38),s=n(16)("isConcatSpreadable");e.exports=function e(t,n,u,c,l,f,p,h){for(var d,m,g=l,y=0,v=!!p&&i(p,h,3);y<c;){if(y in u){if(d=v?v(u[y],y,n):u[y],m=!1,a(d)&&(m=void 0!==(m=d[s])?!!m:r(d)),m&&f>0)g=e(t,n,d,o(d.length),g,f-1)-1;else{if(g>=9007199254740991)throw TypeError();t[g]=d}g++}y++}return g}},function(e,t,n){var r=n(70),a=n(117),o=n(12),i=n(13).Reflect;e.exports=i&&i.ownKeys||function(e){var t=r.f(o(e)),n=a.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(45),a=n(17);e.exports=function(e){if(void 0===e)return 0;var t=r(e),n=a(t);if(t!==n)throw RangeError("Wrong length!");return n}},function(e,t,n){"use strict";var r=n(66),a=n(57).getWeak,o=n(12),i=n(15),s=n(68),u=n(67),c=n(43),l=n(29),f=n(83),p=c(5),h=c(6),d=0,m=function(e){return e._l||(e._l=new g)},g=function(){this.a=[]},y=function(e,t){return p(e.a,function(e){return e[0]===t})};g.prototype={get:function(e){var t=y(this,e);if(t)return t[1]},has:function(e){return!!y(this,e)},set:function(e,t){var n=y(this,e);n?n[1]=t:this.a.push([e,t])},delete:function(e){var t=h(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,o){var c=e(function(e,r){s(e,c,t,"_i"),e._t=t,e._i=d++,e._l=void 0,void 0!=r&&u(r,n,e[o],e)});return r(c.prototype,{delete:function(e){if(!i(e))return!1;var n=a(e);return!0===n?m(f(this,t)).delete(e):n&&l(n,this._i)&&delete n[this._i]},has:function(e){if(!i(e))return!1;var n=a(e);return!0===n?m(f(this,t)).has(e):n&&l(n,this._i)}}),c},def:function(e,t,n){var r=a(o(t),!0);return!0===r?m(e).set(t,n):r[e._i]=n,e},ufstore:m}},function(e,t,n){"use strict";var r,a=n(43)(0),o=n(27),i=n(57),s=n(220),u=n(200),c=n(15),l=n(14),f=n(83),p=i.getWeak,h=Object.isExtensible,d=u.ufstore,m={},g=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},y={get:function(e){if(c(e)){var t=p(e);return!0===t?d(f(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return u.def(f(this,"WeakMap"),e,t)}},v=e.exports=n(110)("WeakMap",g,y,u,!0,!0);l(function(){return 7!=(new v).set((Object.freeze||Object)(m),7).get(m)})&&(s((r=u.getConstructor(g,"WeakMap")).prototype,y),i.NEED=!0,a(["delete","has","get","set"],function(e){var t=v.prototype,n=t[e];o(t,e,function(t,a){if(c(t)&&!h(t)){this._f||(this._f=new r);var o=this._f[e](t,a);return"set"==e?this:o}return n.call(this,t,a)})}))},function(e,t,n){"use strict";var r=n(203),a=n(83);e.exports=n(110)("Set",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(a(this,"Set"),e=0===e?0:e,e)}},r)},function(e,t,n){"use strict";var r=n(18).f,a=n(71),o=n(66),i=n(38),s=n(68),u=n(67),c=n(154),l=n(208),f=n(69),p=n(19),h=n(57).fastKey,d=n(83),m=p?"_s":"size",g=function(e,t){var n,r=h(t);if("F"!==r)return e._i[r];for(n=e._f;n;n=n.n)if(n.k==t)return n};e.exports={getConstructor:function(e,t,n,c){var l=e(function(e,r){s(e,l,t,"_i"),e._t=t,e._i=a(null),e._f=void 0,e._l=void 0,e[m]=0,void 0!=r&&u(r,n,e[c],e)});return o(l.prototype,{clear:function(){for(var e=d(this,t),n=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];e._f=e._l=void 0,e[m]=0},delete:function(e){var n=d(this,t),r=g(n,e);if(r){var a=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=a),a&&(a.p=o),n._f==r&&(n._f=a),n._l==r&&(n._l=o),n[m]--}return!!r},forEach:function(e){d(this,t);for(var n,r=i(e,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(e){return!!g(d(this,t),e)}}),p&&r(l.prototype,"size",{get:function(){return d(this,t)[m]}}),l},def:function(e,t,n){var r,a,o=g(e,t);return o?o.v=n:(e._l=o={i:a=h(t,!0),k:t,v:n,p:r=e._l,n:void 0,r:!1},e._f||(e._f=o),r&&(r.n=o),e[m]++,"F"!==a&&(e._i[a]=o)),e},getEntry:g,setStrong:function(e,t,n){c(e,t,function(e,n){this._t=d(e,t),this._k=n,this._l=void 0},function(){for(var e=this._k,t=this._l;t&&t.r;)t=t.p;return this._t&&(this._l=t=t?t.n:this._t._f)?l(0,"keys"==e?t.k:"values"==e?t.v:[t.k,t.v]):(this._t=void 0,l(1))},n?"entries":"values",!n,!0),f(t)}}},function(e,t,n){"use strict";var r=n(203),a=n(83);e.exports=n(110)("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=r.getEntry(a(this,"Map"),e);return t&&t.v},set:function(e,t){return r.def(a(this,"Map"),0===e?0:e,t)}},r,!0)},function(e,t,n){var r=n(12),a=n(15),o=n(142);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){n(19)&&"g"!=/./g.flags&&n(18).f(RegExp.prototype,"flags",{configurable:!0,get:n(113)})},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){"use strict";var r=n(22),a=n(72),o=n(17);e.exports=[].copyWithin||function(e,t){var n=r(this),i=o(n.length),s=a(e,i),u=a(t,i),c=arguments.length>2?arguments[2]:void 0,l=Math.min((void 0===c?i:a(c,i))-u,i-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(e,t,n){var r=n(23),a=n(22),o=n(95),i=n(17);e.exports=function(e,t,n,s,u){r(t);var c=a(e),l=o(c),f=i(c.length),p=u?f-1:0,h=u?-1:1;if(n<2)for(;;){if(p in l){s=l[p],p+=h;break}if(p+=h,u?p<0:f<=p)throw TypeError("Reduce of empty array with no initial value")}for(;u?p>=0:f>p;p+=h)p in l&&(s=t(s,l[p],p,c));return s}},function(e,t,n){var r=n(12);e.exports=function(e,t,n,a){try{return a?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){var r=n(157),a=Math.pow,o=a(2,-52),i=a(2,-23),s=a(2,127)*(2-i),u=a(2,-126);e.exports=Math.fround||function(e){var t,n,a=Math.abs(e),c=r(e);return a<u?c*(a/u/i+1/o-1/o)*u*i:(n=(t=(1+i/o)*a)-(t-a))>s||n!=n?c*(1/0):c*n}},function(e,t){e.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:Math.log(1+e)}},function(e,t,n){var r=n(15),a=Math.floor;e.exports=function(e){return!r(e)&&isFinite(e)&&a(e)===e}},function(e,t,n){var r=n(37);e.exports=function(e,t){if("number"!=typeof e&&"Number"!=r(e))throw TypeError(t);return+e}},function(e,t,n){var r=n(13).parseFloat,a=n(85).trim;e.exports=1/r(n(160)+"-0")!=-1/0?function(e){var t=a(String(e),3),n=r(t);return 0===n&&"-"==t.charAt(0)?-0:n}:r},function(e,t,n){var r=n(13).parseInt,a=n(85).trim,o=n(160),i=/^[-+]?0[xX]/;e.exports=8!==r(o+"08")||22!==r(o+"0x16")?function(e,t){var n=a(String(e),3);return r(n,t>>>0||(i.test(n)?16:10))}:r},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){"use strict";var r=n(23),a=n(15),o=n(218),i=[].slice,s={};e.exports=Function.bind||function(e){var t=r(this),n=i.call(arguments,1),u=function(){var r=n.concat(i.call(arguments));return this instanceof u?function(e,t,n){if(!(t in s)){for(var r=[],a=0;a<t;a++)r[a]="a["+a+"]";s[t]=Function("F,a","return new F("+r.join(",")+")")}return s[t](e,n)}(t,r.length,r):o(t,r,e)};return a(t.prototype)&&(u.prototype=t.prototype),u}},function(e,t,n){"use strict";var r=n(73),a=n(117),o=n(94),i=n(22),s=n(95),u=Object.assign;e.exports=!u||n(14)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=u({},e)[n]||Object.keys(u({},t)).join("")!=r})?function(e,t){for(var n=i(e),u=arguments.length,c=1,l=a.f,f=o.f;u>c;)for(var p,h=s(arguments[c++]),d=l?r(h).concat(l(h)):r(h),m=d.length,g=0;m>g;)f.call(h,p=d[g++])&&(n[p]=h[p]);return n}:u},function(e,t,n){var r=n(33),a=n(70).f,o={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return i&&"[object Window]"==o.call(e)?function(e){try{return a(e)}catch(e){return i.slice()}}(e):a(r(e))}},function(e,t,n){var r=n(18),a=n(12),o=n(73);e.exports=n(19)?Object.defineProperties:function(e,t){a(e);for(var n,i=o(t),s=i.length,u=0;s>u;)r.f(e,n=i[u++],t[n]);return e}},function(e,t,n){var r=n(29),a=n(33),o=n(118)(!1),i=n(164)("IE_PROTO");e.exports=function(e,t){var n,s=a(e),u=0,c=[];for(n in s)n!=i&&r(s,n)&&c.push(n);for(;t.length>u;)r(s,n=t[u++])&&(~o(c,n)||c.push(n));return c}},function(e,t,n){t.f=n(16)},function(e,t,n){e.exports=!n(19)&&!n(14)(function(){return 7!=Object.defineProperty(n(166)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r=n(3),a=n(7),o=n(1),i=n(0),s=function(){function e(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new u)}return e.prototype.profileKernel=function(e,t){var n,r=this,a=this.backendTimer.time(function(){n=t()}),o=n.dataSync();return i.checkForNaN(o,n.dtype,e),a.then(function(t){r.logger.logKernelProfile(e,n,o,t.kernelMs)}),n},e}(),u=function(){function e(){}return e.prototype.logKernelProfile=function(e,t,n,r){var a=i.rightPad(r+"ms",9),o=i.rightPad(e,25),s=t.rank,u=t.size,c=i.rightPad(t.shape.toString(),14);console.log("%c"+o+"\t%c"+a+"\t%c"+s+"D "+c+"\t%c"+u,"font-weight:bold","color:red","color:blue","color: orange")},e}(),c=n(6);n.d(t,"a",function(){return l});var l=function(){function e(e,t){this.backend=e,this.safeMode=t,this.registeredVariables={},this.refCounter=new WeakMap,this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numDataBuffers=0,this.gradientScopeCount=0,this.customGradientDepth=0,this.activeScope={keep:[],track:[]},this.scopeStack=[this.activeScope],this.profiler=new s(e)}return e.prototype.runKernel=function(e,t,n){var a,o=this,i=[],s=function(e){return i.push(e),e},u=this.activeScope.name;if(this.customGradientDepth++,a=r.ENV.get("DEBUG")?this.profiler.profileKernel(u,function(){return e(o.backend,s)}):e(this.backend,s),this.customGradientDepth--,this.shouldRecord()){var c={id:this.nextTapeNodeId++,name:u,inputs:t,output:a};null!=n&&(c.gradient=function(e){return n(e,i)}),this.activeTape.push(c)}return a},e.prototype.registerTensor=function(e){var t=this.refCounter.has(e.dataId)?this.refCounter.get(e.dataId):0;this.numTensors++,0===t&&(this.numDataBuffers++,this.numBytes+=i.sizeFromShape(e.shape)*i.bytesPerElement(e.dtype),this.backend.register(e.dataId,e.shape,e.dtype)),this.refCounter.set(e.dataId,t+1),e instanceof c.c||this.track(e)},e.prototype.registerVariable=function(e){if(null!=this.registeredVariables[e.name])throw new Error("Variable with name "+e.name+" was already registered");this.registeredVariables[e.name]=e},e.prototype.disposeTensor=function(e){if(this.refCounter.has(e.dataId)){this.numTensors--;var t=this.refCounter.get(e.dataId);t<=1?(this.refCounter.delete(e.dataId),this.backend.disposeData(e.dataId),this.numDataBuffers--,this.numBytes-=i.sizeFromShape(e.shape)*i.bytesPerElement(e.dtype)):this.refCounter.set(e.dataId,t-1)}},e.prototype.disposeVariables=function(){for(var e in this.registeredVariables){var t=this.registeredVariables[e];this.disposeTensor(t),delete this.registeredVariables[e]}},e.prototype.memory=function(){var e=this.backend.memory();return e.numTensors=this.numTensors,e.numDataBuffers=this.numDataBuffers,e.numBytes=this.numBytes,e},e.prototype.shouldRecord=function(){return null!=this.activeTape&&0===this.customGradientDepth},e.prototype.addTapeNode=function(e,t,n){var r={};e.forEach(function(e,t){r[t]=e});var a={id:this.nextTapeNodeId++,name:this.activeScope.name,inputs:r,output:t,gradient:function(e){var t={};return n(e).forEach(function(e,n){t[n]=function(){return e}}),t}};this.activeTape.push(a)},e.prototype.keep=function(e){if(1===this.scopeStack.length&&r.ENV.engine.safeMode)throw new Error("Safe mode is ON. Enclose all tensor operations inside tf.tidy(): tf.tidy(() => {...}) to avoid memory leaks.");return this.activeScope.keep.push(e),e},e.prototype.startScope=function(e,t){void 0===t&&(t=!1),t&&0===this.gradientScopeCount&&(this.activeTape=[]),t&&this.gradientScopeCount++;var n={keep:[],track:[]};e&&(n.name=e),this.scopeStack.push(n),this.activeScope=n},e.prototype.endScope=function(e,t){var n=this;void 0===t&&(t=!1),t&&(this.gradientScopeCount--,0===this.gradientScopeCount&&(this.activeTape=null));var r=this.activeScope.keep,a=i.extractTensorsFromContainer(e);r=r.concat(a);for(var o=0;o<this.activeScope.track.length;o++){var s=this.activeScope.track[o];i.isTensorInList(s,r)||(null!=this.activeTape?a.push(s):s.dispose())}this.scopeStack.pop(),this.activeScope=0===this.scopeStack.length?{keep:[],track:[]}:this.scopeStack[this.scopeStack.length-1],a.forEach(function(e){i.isTensorInList(e,n.activeScope.keep)||n.track(e)})},e.prototype.dispose=function(){},e.prototype.gradients=function(e,t,n,r){var s=this;return void 0===r&&(r=!1),i.assert(t.length>0,"gradients() received an empty list of xs."),Object(a.f)("gradients",function(){var a=e();i.assert(a instanceof c.a,"The result y returned by f() must be a tensor.");var u=function(e,t,n){for(var r={},a={},o=0;o<t.length;o++)r[t[o].id]=!0;for(o=0;o<e.length;o++){var i=(m=e[o]).inputs;for(var s in i){for(var u=i[s],c=!1,l=0;l<t.length;l++)if(r[u.id]){r[m.output.id]=!0,c=!0,a[m.id]=!0;break}if(c)break}}var f={};f[n.id]=!0;var p={};for(o=e.length-1;o>=0;o--){i=(m=e[o]).inputs;var h=[];for(h.push(m.output),l=0;l<h.length;l++)if(f[h[l].id]){for(var s in i)f[i[s].id]=!0,p[m.id]=!0;break}}var d=[];for(o=0;o<e.length;o++){var m;if(a[(m=e[o]).id]&&p[m.id]){var g={};for(var s in m.inputs){var y=m.inputs[s];r[y.id]&&(g[s]=y)}var v=Object.assign({},m);v.inputs=g,v.output=m.output,d.push(v)}}return d}(s.activeTape,t,a);if(!r&&0===u.length&&t.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.");var l={};return l[a.id]=null==n?o.rb(a.shape):n,function(e,t){for(var n=t.length-1;n>=0;n--){var r=t[n],a=e[r.output.id];if(null==r.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+r.name+".");var o=r.gradient(a);for(var s in r.inputs){if(!(s in o))throw new Error("Cannot backprop through input "+s+". Available gradients found: "+Object.keys(o)+".");var u=o[s](),c=r.inputs[s];if(!i.arraysEqual(u.shape,c.shape))throw new Error("Error in gradient for op "+r.name+". The gradient of input '"+s+"' has shape '"+u.shape+"', which does not match the shape of the input '"+c.shape+"'");if(null==e[c.id])e[c.id]=u;else{var l=e[c.id];e[c.id]=l.add(u),l.dispose()}}}}(l,u),{value:a,grads:t.map(function(e){return l[e.id]})}},!0)},e.prototype.customGrad=function(e){var t=this;return i.assert(i.isFunction(e),"The f passed in customGrad(f) must be a function."),function(){for(var n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i.assert(r.every(function(e){return e instanceof c.a}),"The args passed in customGrad(f)(x1, x2,...) must all be tensors"),t.customGradientDepth++;var s=Object(a.f)(e.name,function(){var t=e.apply(void 0,r),a=t.value,o=t.gradFunc;return i.assert(a instanceof c.a,"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),i.assert(i.isFunction(o),"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n=o,a},!0);return t.customGradientDepth--,t.shouldRecord()&&t.addTapeNode(r,s,function(e){var t=n(e),a=Array.isArray(t)?t:[t];return i.assert(a.length===r.length,"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(...)."),i.assert(a.every(function(e){return e instanceof c.a}),"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."),a}),s}},e.prototype.write=function(e,t){this.backend.write(e,t)},e.prototype.readSync=function(e){return this.backend.readSync(e)},e.prototype.read=function(e){return this.backend.read(e)},e.prototype.fromPixels=function(e,t){return this.backend.fromPixels(e,t)},e.prototype.time=function(e){return function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function(){var t,n;return function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,function(r){switch(r.label){case 0:return t=performance.now(),[4,this.backend.time(e)];case 1:return(n=r.sent()).wallMs=performance.now()-t,[2,n]}})})},e.prototype.track=function(e){if(1===this.scopeStack.length&&this.safeMode)throw new Error("Safe mode is ON. Enclose all tensor operations inside tf.tidy(): tf.tidy(() => {op();...}); to avoid memory leaks.");return this.activeScope.track.push(e),e},e}()},function(e){e.exports=[{tfOpName:"Cast",dlOpName:"cast",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"SrcT",dlParamName:"sdtype",type:"dtype",notSupported:!0},{tfParamName:"DstT",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",dlOpName:"expandDims",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,tfParamNameDeprecated:"dim",dlParamName:"axis",type:"number"}]},{tfOpName:"Pad",dlOpName:"pad",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"padding",type:"number[]"},{tfParamName:"constant_value",dlParamName:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",dlOpName:"pad",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"padding",type:"number[]"},{tfInputIndex:2,dlParamName:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",dlOpName:"reshape",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"shape",type:"number[]"}]},{tfOpName:"Squeeze",dlOpName:"squeeze",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"axis",tfParamNameDeprecated:"squeeze_dims",dlParamName:"axis",type:"number[]"}]}]},function(e){e.exports=[{tfOpName:"ConcatV2",dlOpName:"concat",category:"slice_join",params:[{tfInputIndex:0,tfInputParamLength:1,dlParamName:"tensors",type:"tensors"},{tfInputIndex:-1,dlParamName:"axis",type:"number"}]},{tfOpName:"Concat",dlOpName:"concat",category:"slice_join",params:[{tfInputIndex:1,tfInputParamLength:1,dlParamName:"tensors",type:"tensors"},{tfInputIndex:0,dlParamName:"axis",type:"number"}]},{tfOpName:"GatherV2",dlOpName:"gather",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"indices",type:"tensor"},{tfParamName:"axis",dlParamName:"axis",type:"number",defaultValue:0}]},{tfOpName:"Gather",dlOpName:"gather",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"indices",type:"tensor"},{tfParamName:"axis",dlParamName:"axis",type:"number",defaultValue:0},{tfParamName:"validate_indices",dlParamName:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",dlOpName:"reverse",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number"}]},{tfOpName:"ReverseV2",dlOpName:"reverse",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number"}]},{tfOpName:"Slice",dlOpName:"slice",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"begin",type:"number[]"},{tfInputIndex:2,dlParamName:"size",type:"number[]"}]},{tfOpName:"StridedSlice",dlOpName:"stridedSlice",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"begin",type:"number[]"},{tfInputIndex:2,dlParamName:"end",type:"number[]"},{tfInputIndex:3,dlParamName:"strides",type:"number[]"},{tfParamName:"begin_mask",dlParamName:"beginMask",type:"number",defaultValue:0},{tfParamName:"end_mask",dlParamName:"endMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",dlOpName:"stack",category:"slice_join",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"tensors",type:"tensors"},{tfParamName:"axis",dlParamName:"axis",type:"number",defaultValue:0}]},{tfOpName:"Tile",dlOpName:"tile",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"reps",type:"number[]"}]},{tfOpName:"Split",dlOpName:"split",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"axis",type:"number",defaultValue:0},{tfInputIndex:1,dlParamName:"x",type:"tensor"},{tfParamName:"num_split",dlParamName:"numOrSizeSplits",type:"number",defaultValue:1}]}]},function(e){e.exports=[{tfOpName:"Max",dlOpName:"max",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Mean",dlOpName:"mean",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Min",dlOpName:"min",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Sum",dlOpName:"sum",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",dlOpName:"argMax",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number"}]},{tfOpName:"ArgMin",dlOpName:"argMin",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number"}]}]},function(e){e.exports=[{tfOpName:"FusedBatchNorm",dlOpName:"batchNormalization",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"scale",type:"tensor"},{tfInputIndex:2,dlParamName:"offset",type:"tensor"},{tfInputIndex:3,dlParamName:"mean",type:"tensor"},{tfInputIndex:4,dlParamName:"variance",type:"tensor"},{tfParamName:"epsilon",dlParamName:"epsilon",type:"number",defaultValue:.001},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",dlOpName:"batchNormalization",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"scale",type:"tensor"},{tfInputIndex:2,dlParamName:"offset",type:"tensor"},{tfInputIndex:3,dlParamName:"mean",type:"tensor"},{tfInputIndex:4,dlParamName:"variance",type:"tensor"},{tfParamName:"epsilon",dlParamName:"epsilon",type:"number",defaultValue:.001},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",dlOpName:"localResponseNormalization",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"depth_radius",dlParamName:"radius",type:"number",defaultValue:5},{tfParamName:"bias",dlParamName:"bias",type:"number",defaultValue:1},{tfParamName:"alpha",dlParamName:"alpha",type:"number",defaultValue:1},{tfParamName:"beta",dlParamName:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",dlOpName:"softmax",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]}]},function(e){e.exports=[{tfOpName:"MatMul",dlOpName:"matMul",category:"matrices",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"transpose_a",dlParamName:"transposeA",type:"bool",defaultValue:!1},{tfParamName:"transpose_b",dlParamName:"transposeB",type:"bool",defaultValue:!1},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",dlOpName:"transpose",category:"matrices",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"perm",dlParamName:"perm",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}]},function(e){e.exports=[{tfOpName:"Equal",dlOpName:"equal",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",dlOpName:"notEqual",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",dlOpName:"greater",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",dlOpName:"greaterEqual",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",dlOpName:"less",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",dlOpName:"lessEqual",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",dlOpName:"logicalAnd",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",dlOpName:"logicalNot",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",dlOpName:"logicalOr",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",dlOpName:"where",category:"logical",params:[{tfInputIndex:0,dlParamName:"condition",type:"tensor"},{tfInputIndex:1,dlParamName:"a",type:"tensor"},{tfInputIndex:2,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}]},function(e){e.exports=[{tfOpName:"ResizeBilinear",dlOpName:"resizeBilinear",category:"image",params:[{tfInputIndex:0,dlParamName:"images",type:"tensor"},{tfInputIndex:1,dlParamName:"size",type:"number[]"},{tfParamName:"align_corners",dlParamName:"alignCorners",type:"bool"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",dlOpName:"resizeNearestNeighbor",category:"image",params:[{tfInputIndex:0,dlParamName:"images",type:"tensor"},{tfInputIndex:1,dlParamName:"size",type:"number[]"},{tfParamName:"align_corners",dlParamName:"alignCorners",type:"bool"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}]},function(e){e.exports=[{tfOpName:"PlaceholderWithDefault",dlOpName:"placeholder",category:"graph",params:[{tfInputIndex:0,dlParamName:"default",type:"tensor"}]},{tfOpName:"Placeholder",dlOpName:"placeholder",category:"graph"},{tfOpName:"Const",dlOpName:"const",category:"graph"},{tfOpName:"Identity",dlOpName:"identity",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Snapshot",dlOpName:"snapshot",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Shape",dlOpName:"shape",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Print",dlOpName:"print",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,tfInputParamLength:1,dlParamName:"data",type:"tensors"},{tfParamName:"message",dlParamName:"message",type:"string"},{tfParamName:"first_n",dlParamName:"firstN",type:"number",notSupprted:!0},{tfParamName:"summarize",dlParamName:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",dlOpName:"noop",category:"graph",params:[]},{tfOpName:"StopGradient",dlOpName:"stopGradient",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",dlOpName:"fakeQuantWithMinMaxVars",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"min",dlParamName:"min",type:"number"},{tfParamName:"max",dlParamName:"max",type:"number"}]}]},function(e){e.exports=[{tfOpName:"Fill",dlOpName:"fill",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfInputIndex:1,dlParamName:"value",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LinSpace",dlOpName:"linspace",category:"creation",params:[{tfInputIndex:0,dlParamName:"start",type:"number"},{tfInputIndex:1,dlParamName:"stop",type:"number"},{tfInputIndex:2,dlParamName:"num",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",dlOpName:"oneHot",category:"creation",params:[{tfInputIndex:0,dlParamName:"indices",type:"tensor"},{tfInputIndex:1,dlParamName:"depth",type:"number"},{tfInputIndex:2,dlParamName:"onValue",type:"number",defaultValue:1},{tfInputIndex:3,dlParamName:"offValue",type:"number",defaultValue:0},{tfParamName:"axis",dlParamName:"axis",type:"number",notSupported:!0},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",dlOpName:"ones",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",dlOpName:"onesLike",category:"creation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",dlOpName:"randomUniform",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"minval",dlParamName:"minval",type:"number",defaultValue:0},{tfParamName:"maxval",dlParamName:"maxval",type:"number",defaultValue:1},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"seed",dlParamName:"seed",type:"number",defaultValue:0},{tfParamName:"seed2",dlParamName:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfParamName:"T",dlParamName:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",dlOpName:"range",category:"creation",params:[{tfInputIndex:0,dlParamName:"start",type:"number"},{tfInputIndex:1,dlParamName:"stop",type:"number"},{tfInputIndex:2,dlParamName:"step",type:"number",defaultValue:0},{tfParamName:"Tidx",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"truncatedNormal",dlOpName:"truncatedNormal",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"means",dlParamName:"mean",type:"number",defaultValue:0},{tfParamName:"stddev",dlParamName:"stdDev",type:"number",defaultValue:1},{tfParamName:"seed",dlParamName:"seed",type:"number"},{tfParamName:"seed2",dlParamName:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"T",dlParamName:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",dlOpName:"zeros",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",dlOpName:"zerosLike",category:"creation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]}]},function(e){e.exports=[{tfOpName:"AvgPool",dlOpName:"avgPool",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0},{tfParamName:"ksize",dlParamName:"kernelSize",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",dlOpName:"maxPool",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0},{tfParamName:"ksize",dlParamName:"kernelSize",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",dlOpName:"conv1d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"stride",dlParamName:"stride",type:"number"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NWC"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{tfParamName:"dilation",dlParamName:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",dlOpName:"conv2d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"useCudnnOnGpu",dlParamName:"useCudnnOnGpu",type:"bool"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NHWC"},{tfParamName:"dilations",dlParamName:"dilations",type:"number[]"}]},{tfOpName:"Conv2DBackpropInput",dlOpName:"conv2dTranspose",category:"convolution",params:[{tfInputIndex:2,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfInputIndex:0,dlParamName:"outputShape",type:"number[]"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",dlOpName:"depthwiseConv2d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"input",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NHWC"},{tfParamName:"dilations",dlParamName:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",dlOpName:"depthwiseConv2d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"input",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NHWC"},{tfParamName:"dilations",dlParamName:"dilations",type:"number[]"}]}]},function(e){e.exports=[{tfOpName:"LoopCond",dlOpName:"loopCond",category:"control",params:[{tfInputIndex:0,dlParamName:"pred",type:"tensor"}]},{tfOpName:"Switch",dlOpName:"switch",category:"control",params:[{tfInputIndex:0,dlParamName:"data",type:"tensor"},{tfInputIndex:1,dlParamName:"pred",type:"tensor"}]},{tfOpName:"Merge",dlOpName:"merge",category:"control",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"tensors",type:"tensors"}]},{tfOpName:"Enter",dlOpName:"enter",category:"control",params:[{tfInputIndex:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{tfParamName:"frame_name",dlParamName:"frameName",type:"string"},{tfParamName:"is_constant",dlParamName:"isConstant",type:"bool"}]},{tfOpName:"Exit",dlOpName:"exit",category:"control",params:[{tfInputIndex:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",dlOpName:"nextIteration",category:"control",params:[{tfInputIndex:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}]},function(e){e.exports=[{tfOpName:"Abs",dlOpName:"abs",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",dlOpName:"acos",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",dlOpName:"asin",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"atan",dlOpName:"atan",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",dlOpName:"ceil",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",dlOpName:"clipByValue",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"clip_value_min",dlParamName:"clipValueMin",type:"number"},{tfParamName:"clip_value_max",dlParamName:"clipValueMax",type:"number"}]},{tfOpName:"Cos",dlOpName:"cos",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",dlOpName:"cosh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",dlOpName:"elu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",dlOpName:"exp",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",dlOpName:"floor",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",dlOpName:"log",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",dlOpName:"neg",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",dlOpName:"relu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",dlOpName:"clipByValue",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{dlParamName:"clipValueMin",type:"number",defaultValue:0},{dlParamName:"clipValueMax",type:"number",defaultValue:6}]},{tfOpName:"Selu",dlOpName:"selu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",dlOpName:"sigmoid",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",dlOpName:"sin",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",dlOpName:"sinh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",dlOpName:"sqrt",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",dlOpName:"rsqrt",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",dlOpName:"square",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",dlOpName:"tan",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",dlOpName:"tanh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",dlOpName:"sign",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",dlOpName:"round",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",dlOpName:"expm1",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",dlOpName:"log1p",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",dlOpName:"reciprocal",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",dlOpName:"reciprocal",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",dlOpName:"softplus",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",dlOpName:"asinh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",dlOpName:"acosh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",dlOpName:"atanh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",dlOpName:"erf",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}]},function(e){e.exports=[{tfOpName:"Add",dlOpName:"add",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BiasAdd",dlOpName:"add",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sub",dlOpName:"sub",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",dlOpName:"div",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",dlOpName:"div",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",dlOpName:"mul",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",dlOpName:"maximum",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"}]},{tfOpName:"Minimum",dlOpName:"minimum",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"}]},{tfOpName:"Pow",dlOpName:"pow",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",dlOpName:"squaredDifference",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",dlOpName:"mod",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}]},function(e,t,n){"use strict";function r(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(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(e)||/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(e.substr(0,4))}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";n.r(t);var r=n(10),a={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"};n.d(t,"load",function(){return c}),n.d(t,"MobileNet",function(){return l});var o=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},i=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s="https://storage.googleapis.com/tfjs-models/tfjs/",u=224;function c(e,t){return void 0===e&&(e=1),void 0===t&&(t=1),o(this,void 0,void 0,function(){var n;return i(this,function(a){switch(a.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.");if(1!==e)throw new Error("Currently only MobileNet V1 is supported. Got version "+e+".");if(-1===[.25,.5,.75,1].indexOf(t))throw new Error("MobileNet constructed with invalid alpha "+t+". Valid multipliers are 0.25, 0.50, 0.75, and 1.0.");return[4,(n=new l(e,t)).load()];case 1:return a.sent(),[2,n]}})})}var l=function(){function e(e,t){this.intermediateModels={};var n={.25:"0.25",.5:"0.50",.75:"0.75",1:"1.0"}[t];this.path=s+"mobilenet_v"+e+"_"+n+"_"+u+"/model.json",this.normalizationOffset=r.scalar(127.5)}return e.prototype.load=function(){return o(this,void 0,void 0,function(){var e,t;return i(this,function(n){switch(n.label){case 0:return e=this,[4,r.loadModel(this.path)];case 1:return e.model=n.sent(),this.endpoints=this.model.layers.map(function(e){return e.name}),[4,(t=this.model.predict(r.zeros([1,u,u,3]))).data()];case 2:return n.sent(),t.dispose(),[2]}})})},e.prototype.infer=function(e,t){var n=this;if(null!=t&&-1===this.endpoints.indexOf(t))throw new Error("Unknown endpoint "+t+". Available endpoints: "+this.endpoints+".");return r.tidy(function(){e instanceof r.Tensor||(e=r.fromPixels(e));var a=e.toFloat().sub(n.normalizationOffset).div(n.normalizationOffset),o=a;e.shape[0]===u&&e.shape[1]===u||(o=r.image.resizeBilinear(a,[u,u],!0));var i,s=o.reshape([1,u,u,3]);if(null==t)i=n.model;else{if(null==n.intermediateModels[t]){var c=n.model.layers.find(function(e){return e.name===t});n.intermediateModels[t]=r.model({inputs:n.model.inputs,outputs:c.output})}i=n.intermediateModels[t]}return i.predict(s)})},e.prototype.classify=function(e,t){return void 0===t&&(t=3),o(this,void 0,void 0,function(){var n,r;return i(this,function(s){switch(s.label){case 0:return[4,function(e,t){return o(this,void 0,void 0,function(){var n,r,o,s,u,c;return i(this,function(i){switch(i.label){case 0:return[4,e.data()];case 1:for(n=i.sent(),r=[],c=0;c<n.length;c++)r.push({value:n[c],index:c});for(r.sort(function(e,t){return t.value-e.value}),o=new Float32Array(t),s=new Int32Array(t),c=0;c<t;c++)o[c]=r[c].value,s[c]=r[c].index;for(u=[],c=0;c<s.length;c++)u.push({className:a[s[c]],probability:o[c]});return[2,u]}})})}(n=this.infer(e),t)];case 1:return r=s.sent(),n.dispose(),[2,r]}})})},e}()},function(e,t,n){"use strict";n.r(t);var r=n(10),a=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],o=a.length,i=a.reduce(function(e,t,n){return e[t]=n,e},{}),s=[["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"]],u=[["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(e){var t=e[0],n=e[1];return[i[t],i[n]]}),c=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},l=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function f(e,t){return u.reduce(function(n,r){var a=r[0],o=r[1];return function(e,t,n){return e<n||t<n}(e[a].score,e[o].score,t)?n:(n.push([e[a],e[o]]),n)},[])}var p=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;function d(e){return e.reduce(function(e,t){var n=e.maxX,r=e.maxY,a=e.minX,o=e.minY,i=t.position,s=i.x,u=i.y;return{maxX:Math.max(n,s),maxY:Math.max(r,u),minX:Math.min(a,s),minY:Math.min(o,u)}},{maxX:p,maxY:p,minX:h,minY:h})}function m(e){var t=d(e),n=t.minX,r=t.minY,a=t.maxX,o=t.maxY;return[{x:n,y:r},{x:a,y:r},{x:a,y:o},{x:n,y:o}]}function g(e,t){return void 0===t&&(t="float32"),c(this,void 0,void 0,function(){var n;return l(this,function(a){switch(a.label){case 0:return[4,e.data()];case 1:return n=a.sent(),[2,new r.TensorBuffer(e.shape,t,n)]}})})}function y(e,t,n){return{score:e.score,keypoints:e.keypoints.map(function(e){var r=e.score,a=e.part,o=e.position;return{score:r,part:a,position:{x:o.x*t,y:o.y*n}}})}}function v(e,t,n){var r=t*e-1;return r-r%n+1}function b(e){return Math.floor(e/2)}var w=function(){function e(e,t){this.priorityQueue=new Array(e),this.numberOfElements=-1,this.getElementValue=t}return e.prototype.enqueue=function(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)},e.prototype.dequeue=function(){var e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e},e.prototype.empty=function(){return-1===this.numberOfElements},e.prototype.size=function(){return this.numberOfElements+1},e.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},e.prototype.max=function(){return this.priorityQueue[0]},e.prototype.swim=function(e){for(;e>0&&this.less(b(e),e);)this.exchange(e,b(e)),e=b(e)},e.prototype.sink=function(e){for(;2*e<=this.numberOfElements;){var t=2*e;if(t<this.numberOfElements&&this.less(t,t+1)&&t++,!this.less(e,t))break;this.exchange(e,t),e=t}},e.prototype.getValueAt=function(e){return this.getElementValue(this.priorityQueue[e])},e.prototype.less=function(e,t){return this.getValueAt(e)<this.getValueAt(t)},e.prototype.exchange=function(e,t){var n=this.priorityQueue[e];this.priorityQueue[e]=this.priorityQueue[t],this.priorityQueue[t]=n},e}();function x(e,t,n,r,a,o){for(var i=o.shape,s=i[0],u=i[1],c=!0,l=Math.max(n-a,0),f=Math.min(n+a+1,s),p=l;p<f;++p){for(var h=Math.max(r-a,0),d=Math.min(r+a+1,u),m=h;m<d;++m)if(o.get(p,m,e)>t){c=!1;break}if(!c)break}return c}function k(e,t,n,r){return{y:r.get(e,t,n),x:r.get(e,t,n+o)}}function O(e,t,n){var r=k(e.heatmapY,e.heatmapX,e.id,n),a=r.y,o=r.x;return{x:e.heatmapX*t+o,y:e.heatmapY*t+a}}function S(e,t,n){return e<t?t:e>n?n:e}function N(e,t){return{x:e.x+t.x,y:e.y+t.y}}var E=s.map(function(e){var t=e[0],n=e[1];return[i[t],i[n]]}),I=E.map(function(e){return e[1]}),T=E.map(function(e){return e[0]});function A(e,t,n,r){return{y:S(Math.round(e.y/t),0,n-1),x:S(Math.round(e.x/t),0,r-1)}}function C(e,t,n,r,o,i,s){var u=r.shape,c=u[0],l=u[1],f=function(e,t,n){var r=n.shape[2]/2;return{y:n.get(t.y,t.x,e),x:n.get(t.y,t.x,r+e)}}(e,A(t.position,i,c,l),s),p=A(N(t.position,f),i,c,l),h=k(p.y,p.x,n,o),d=r.get(p.y,p.x,n);return{position:N({x:p.x*i,y:p.y*i},{x:h.x,y:h.y}),part:a[n],score:d}}function P(e,t,n,r,o,i){var s=t.shape[2],u=I.length,c=new Array(s),l=e.part,f=e.score,p=O(l,r,n);c[l.id]={score:f,part:a[l.id],position:p};for(var h=u-1;h>=0;--h){var d=I[h],m=T[h];c[d]&&!c[m]&&(c[m]=C(h,c[d],m,t,n,r,i))}for(h=0;h<u;++h)d=T[h],m=I[h],c[d]&&!c[m]&&(c[m]=C(h,c[d],m,t,n,r,o));return c}var _=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},R=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function M(e,t,n,r){var a=n.x,o=n.y;return e.some(function(e){var n,i,s,u,c,l,f=e.keypoints[r].position;return n=o,i=a,s=f.y,u=f.x,(c=s-n)*c+(l=u-i)*l<=t})}function j(e,t,n){return n.reduce(function(n,r,a){var o=r.position,i=r.score;return M(e,t,o,a)||(n+=i),n},0)/n.length}var D=1;function L(e,t,n,r,a,o,i,s){return void 0===i&&(i=.5),void 0===s&&(s=20),_(this,void 0,void 0,function(){var u,f,p,h,d,m,y,v,b,k,S,N;return R(this,function(E){switch(E.label){case 0:return u=[],[4,function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,Promise.all(e.map(function(e){return g(e,"float32")}))]})})}([e,t,n,r])];case 1:for(f=E.sent(),p=f[0],h=f[1],d=f[2],m=f[3],y=function(e,t,n){for(var r=n.shape,a=r[0],o=r[1],i=r[2],s=new w(a*o*i,function(e){return e.score}),u=0;u<a;++u)for(var c=0;c<o;++c)for(var l=0;l<i;++l){var f=n.get(u,c,l);f<e||x(l,f,u,c,t,n)&&s.enqueue({score:f,part:{heatmapY:u,heatmapX:c,id:l}})}return s}(i,D,p),v=s*s;u.length<o&&!y.empty();)b=y.dequeue(),k=O(b.part,a,h),M(u,v,k,b.part.id)||(S=P(b,p,h,a,d,m),N=j(u,v,S),u.push({keypoints:S,score:N}));return[2,u]}})})}var z=function(){function e(e){this.urlPath=e,"/"!==this.urlPath.charAt(this.urlPath.length-1)&&(this.urlPath+="/")}return e.prototype.loadManifest=function(){var e=this;return new Promise(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 new Error("manifest.json not found at "+e.urlPath+". "+t)},r.send()})},e.prototype.getCheckpointManifest=function(){var e=this;return null==this.checkpointManifest?new Promise(function(t,n){e.loadManifest().then(function(){t(e.checkpointManifest)})}):new Promise(function(t,n){t(e.checkpointManifest)})},e.prototype.getAllVariables=function(){var e=this;return null!=this.variables?new Promise(function(t,n){t(e.variables)}):new Promise(function(t,n){e.getCheckpointManifest().then(function(n){for(var r=Object.keys(e.checkpointManifest),a=[],o=0;o<r.length;o++)a.push(e.getVariable(r[o]));Promise.all(a).then(function(n){e.variables={};for(var a=0;a<n.length;a++)e.variables[r[a]]=n[a];t(e.variables)})})})},e.prototype.getVariable=function(e){var t=this;if(!(e in this.checkpointManifest))throw new Error("Cannot load non-existant variable "+e);var n=function(n,a){var o=new XMLHttpRequest;o.responseType="arraybuffer";var i=t.checkpointManifest[e].filename;o.open("GET",t.urlPath+i),o.onload=function(){if(404===o.status)throw new Error("Not found variable "+e);var a=new Float32Array(o.response),i=r.Tensor.make(t.checkpointManifest[e].shape,{values:a});n(i)},o.onerror=function(t){throw new Error("Could not fetch variable "+e+": "+t)},o.send()};return null==this.checkpointManifest?new Promise(function(e,r){t.loadManifest().then(function(){new Promise(n).then(e)})}):new Promise(n)},e}(),F=[8,16,32];function B(e){r.util.assert("number"==typeof e,"outputStride is not a number"),r.util.assert(F.indexOf(e)>=0,"outputStride of "+e+" is invalid. It must be either 8, 16, or 32")}function V(e){r.util.assert("number"==typeof e,"imageScaleFactor is not a number"),r.util.assert(e>=.2&&e<=1,"imageScaleFactor must be between 0.2 and 1.0")}var U={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:[["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]]},W=function(){function e(e,t){this.PREPROCESS_DIVISOR=r.scalar(127.5),this.ONE=r.scalar(1),this.variables=e,this.convolutionDefinitions=t}return e.prototype.predict=function(e,t){var n=this,a=r.cast(e,"float32").div(this.PREPROCESS_DIVISOR).sub(this.ONE);return function(e,t){var n=1,r=1;return e.map(function(e,a){var o,i,s=e[0],u=e[1];return n===t?(o=1,i=r,r*=u):(o=u,i=1,n*=u),{blockId:a,convType:s,stride:o,rate:i,outputStride:n}})}(this.convolutionDefinitions,t).reduce(function(e,t){var r=t.blockId,a=t.stride,o=t.convType,i=t.rate;if("conv2d"===o)return n.conv(e,a,r);if("separableConv"===o)return n.separableConv(e,a,r,i);throw Error("Unknown conv type of "+o)},a)},e.prototype.convToOutput=function(e,t){return e.conv2d(this.weights(t),1,"same").add(this.biases(t))},e.prototype.conv=function(e,t,n){return e.conv2d(this.weights("Conv2d_"+String(n)),t,"same").add(this.biases("Conv2d_"+String(n))).clipByValue(0,6)},e.prototype.separableConv=function(e,t,n,r){void 0===r&&(r=1);var a="Conv2d_"+String(n)+"_depthwise",o="Conv2d_"+String(n)+"_pointwise";return e.depthwiseConv2D(this.depthwiseWeights(a),t,"same","NHWC",r).add(this.biases(a)).clipByValue(0,6).conv2d(this.weights(o),[1,1],"same").add(this.biases(o)).clipByValue(0,6)},e.prototype.weights=function(e){return this.variables["MobilenetV1/"+e+"/weights"]},e.prototype.biases=function(e){return this.variables["MobilenetV1/"+e+"/biases"]},e.prototype.depthwiseWeights=function(e){return this.variables["MobilenetV1/"+e+"/depthwise_weights"]},e.prototype.dispose=function(){for(var e in this.variables)this.variables[e].dispose()},e}(),G="https://storage.googleapis.com/tfjs-models/weights/posenet/",q={1.01:{url:G+"mobilenet_v1_101/",architecture:U[100]},1:{url:G+"mobilenet_v1_100/",architecture:U[100]},.75:{url:G+"mobilenet_v1_075/",architecture:U[75]},.5:{url:G+"mobilenet_v1_050/",architecture:U[50]}};function H(e){var t=e.shape,n=t[0],a=t[1],o=t[2];return r.tidy(function(){var t,i,s=e.reshape([n*a,o]).argMax(0),u=s.div(r.scalar(a,"int32")).expandDims(1),c=(t=s,i=a,r.tidy(function(){var e=t.div(r.scalar(i,"int32"));return t.sub(e.mul(r.scalar(i,"int32")))})).expandDims(1);return r.concat([u,c],1)})}function K(e,t,n,r){return{y:r.get(e,t,n),x:r.get(e,t,n+o)}}function X(e,t,n){return r.tidy(function(){var a=function(e,t){for(var n=[],a=0;a<o;a++){var i=K(e.get(a,0).valueOf(),e.get(a,1).valueOf(),a,t),s=i.x,u=i.y;n.push(u),n.push(s)}return r.tensor2d(n,[o,2])}(e,n);return e.toTensor().mul(r.scalar(t,"int32")).toFloat().add(a)})}var J=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},Y=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function Q(e,t,n){return J(this,void 0,void 0,function(){var r,o,i,s,u,c,l,f,p,h;return Y(this,function(d){switch(d.label){case 0:return r=0,o=H(e),[4,Promise.all([g(e),g(t),g(o,"int32")])];case 1:return i=d.sent(),s=i[0],u=i[1],c=i[2],[4,g(l=X(c,n,u))];case 2:return f=d.sent(),p=Array.from(function(e,t){for(var n=t.shape[0],r=new Float32Array(n),a=0;a<n;a++){var o=t.get(a,0),i=t.get(a,1);r[a]=e.get(o,i,a)}return r}(s,c)),h=p.map(function(e,t){return r+=e,{position:{y:f.get(t,0),x:f.get(t,1)},part:a[t],score:e}}),o.dispose(),l.dispose(),[2,{keypoints:h,score:r/h.length}]}})})}var Z=function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):new n(function(t){t(e.value)}).then(i,s)}u((r=r.apply(e,t||[])).next())})},$=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;i;)try{if(n=1,r&&(a=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[0,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function ee(e,t,n,a){var o=r.fromPixels(e);return a?o.reverse(1).resizeBilinear([t,n]):o.resizeBilinear([t,n])}var te=function(){function e(e){this.mobileNet=e}return e.prototype.predictForSinglePose=function(e,t){var n=this;return void 0===t&&(t=16),B(t),r.tidy(function(){var r=n.mobileNet.predict(e,t),a=n.mobileNet.convToOutput(r,"heatmap_2"),o=n.mobileNet.convToOutput(r,"offset_2");return{heatmapScores:a.sigmoid(),offsets:o}})},e.prototype.predictForMultiPose=function(e,t){var n=this;return void 0===t&&(t=16),r.tidy(function(){var r=n.mobileNet.predict(e,t),a=n.mobileNet.convToOutput(r,"heatmap_2"),o=n.mobileNet.convToOutput(r,"offset_2"),i=n.mobileNet.convToOutput(r,"displacement_fwd_2"),s=n.mobileNet.convToOutput(r,"displacement_bwd_2");return{heatmapScores:a.sigmoid(),offsets:o,displacementFwd:i,displacementBwd:s}})},e.prototype.estimateSinglePose=function(e,t,n,a){return void 0===t&&(t=.5),void 0===n&&(n=!1),void 0===a&&(a=16),Z(this,void 0,void 0,function(){var o,i,s,u,c,l,f,p,h=this;return $(this,function(d){switch(d.label){case 0:return B(a),V(t),o=v(t,e.height,a),i=v(t,e.width,a),s=r.tidy(function(){var t=ee(e,o,i,n);return h.predictForSinglePose(t,a)}),u=s.heatmapScores,c=s.offsets,[4,Q(u,c,a)];case 1:return l=d.sent(),u.dispose(),c.dispose(),f=e.height/o,p=e.width/i,[2,y(l,f,p)]}})})},e.prototype.estimateMultiplePoses=function(e,t,n,a,o,i,s){return void 0===t&&(t=.5),void 0===n&&(n=!1),void 0===a&&(a=16),void 0===o&&(o=5),void 0===i&&(i=.5),void 0===s&&(s=20),Z(this,void 0,void 0,function(){var u,c,l,f,p,h,d,m,g,b,w=this;return $(this,function(x){switch(x.label){case 0:return B(a),V(t),u=v(t,e.height,a),c=v(t,e.width,a),l=r.tidy(function(){var t=ee(e,u,c,n);return w.predictForMultiPose(t,a)}),f=l.heatmapScores,p=l.offsets,h=l.displacementFwd,d=l.displacementBwd,[4,L(f,p,h,d,a,o,i,s)];case 1:return m=x.sent(),f.dispose(),p.dispose(),h.dispose(),d.dispose(),g=e.height/u,b=e.width/c,[2,function(e,t,n){return 1===n&&1===t?m:m.map(function(e){return y(e,n,t)})}(0,g,b)]}})})},e.prototype.dispose=function(){this.mobileNet.dispose()},e}();function ne(e){return void 0===e&&(e=1.01),Z(this,void 0,void 0,function(){var t,n,a,o;return $(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 t=Object.keys(q),r.util.assert("number"==typeof e,"got multiplier type of "+typeof e+" when it should be a number."),r.util.assert(t.indexOf(e.toString())>=0,"invalid multiplier value of "+e+". No checkpoint exists for that multiplier. Must be one of "+t.join(",")+"."),n=q[e],[4,new z(n.url).getAllVariables()];case 1:return a=i.sent(),o=new W(a,n.architecture),[2,new te(o)]}})})}n.d(t,"checkpoints",function(){return q}),n.d(t,"partIds",function(){return i}),n.d(t,"partNames",function(){return a}),n.d(t,"poseChain",function(){return s}),n.d(t,"getAdjacentKeyPoints",function(){return f}),n.d(t,"getBoundingBox",function(){return d}),n.d(t,"getBoundingBoxPoints",function(){return m}),n.d(t,"decodeMultiplePoses",function(){return L}),n.d(t,"decodeSinglePose",function(){return Q}),n.d(t,"load",function(){return ne}),n.d(t,"PoseNet",function(){return te})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t=Math.random(),n=0,r=void 0,a=0;a<e.length;a+=1)if(t<(n+=e[a])){r=a;break}return r}},function(e,t,n){"use strict";var r=n(49),a=n(92);e.exports=function(e,t,n){t in e?r.f(e,t,a(0,n)):e[t]=n}},function(e,t,n){"use strict";var r=n(82),a=n(35),o=n(89),i=n(181),s=n(180),u=n(136),c=n(244),l=n(128);a(a.S+a.F*!n(175)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,a,f,p=o(e),h="function"==typeof this?this:Array,d=arguments.length,m=d>1?arguments[1]:void 0,g=void 0!==m,y=0,v=l(p);if(g&&(m=r(m,d>2?arguments[2]:void 0,2)),void 0==v||h==Array&&s(v))for(n=new h(t=u(p.length));t>y;y++)c(n,y,g?m(p[y],y):p[y]);else for(f=v.call(p),n=new h;!(a=f.next()).done;y++)c(n,y,g?i(f,m,[a.value,y],!0):a.value);return n.length=y,n}})},function(e,t,n){n(88),n(245),e.exports=n(21).Array.from},function(e,t,n){e.exports={default:n(246),__esModule:!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p(n(247)),a=p(n(61)),o=p(n(122)),i=p(n(60)),s=p(n(41)),u=p(n(40)),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10)),l=p(n(243)),f=p(n(168));function p(e){return e&&e.__esModule?e:{default:e}}var h=/cell_[0-9]|lstm_[0-9]/gi,d=/weights|weight|kernel|kernels|w/gi,m=/softmax/gi,g=function(){function e(t,n){(0,s.default)(this,e),this.ready=!1,this.model={},this.cellsAmount=0,this.vocab={},this.vocabSize=0,this.defaults={seed:"a",length:20,temperature:.5},this.loadCheckpoints(t,n)}return(0,u.default)(e,[{key:"loadCheckpoints",value:function(e,t){var n,r=this;new f.default(e).getAllVariables().then((n=(0,i.default)(a.default.mark(function n(i){return a.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:(0,o.default)(i).forEach(function(e){e.match(h)?e.match(d)?(r.model["Kernel_"+e.match(/[0-9]/)[0]]=i[e],r.cellsAmount+=1):r.model["Bias_"+e.match(/[0-9]/)[0]]=i[e]:e.match(m)?e.match(d)?r.model.fullyConnectedWeights=i[e]:r.model.fullyConnectedBiases=i[e]:r.model[e]=i[e]}),r.loadVocab(e,t);case 2:case"end":return n.stop()}},n,r)})),function(e){return n.apply(this,arguments)}))}},{key:"loadVocab",value:function(e,t){var n=this;fetch(e+"/vocab.json").then(function(e){return e.json()}).then(function(e){n.vocab=e,n.vocabSize=(0,o.default)(e).length,n.ready=!0,t()}).catch(function(e){console.error("There has been a problem loading the vocab: "+e.message)})}},{key:"generate",value:function(){var e=(0,i.default)(a.default.mark(function e(t,n){var i,s,u,f,p,h,d,m,g,y,v,b,w,x,k,O,S,N,E,I,T,A,C,P,_,R,M,j=this;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.seed||this.defaults.seed,s=+t.length||this.defaults.length,u=+t.temperature||this.defaults.temperature,f=[],!this.ready){e.next=41;break}for(p=c.tensor(1),h=[],d=[],m=[],g=function(e){return function(t,n,r){return c.basicLSTMCell(p,j.model["Kernel_"+e],j.model["Bias_"+e],t,n,r)}},y=0;y<this.cellsAmount;y+=1)d.push(c.zeros([1,this.model["Bias_"+y].shape[0]/4])),m.push(c.zeros([1,this.model["Bias_"+y].shape[0]/4])),h.push(g(y));v=(0,r.default)(i),b=[],v.forEach(function(e,t){t<100&&b.push(j.vocab[e])}),x=b[w=0],k=0;case 17:if(!(k<v.length+s)){e.next=38;break}return(O=c.buffer([1,this.vocabSize])).set(1,0,x),S=O.toTensor(),N=void 0,this.model.embedding?(E=c.matMul(S,this.model.embedding),N=c.multiRNNCell(h,E,d,m)):N=c.multiRNNCell(h,S,d,m),d=N[0],m=N[1],I=m[1],T=c.matMul(I,this.model.fullyConnectedWeights),A=c.add(T,this.model.fullyConnectedBiases),C=c.div(A,c.tensor(u)),P=c.exp(C),e.next=32,c.div(P,c.sum(P)).data();case 32:_=e.sent,R=(0,l.default)(_),v.length>w?(x=b[w],w+=1):(x=R,f.push(R));case 35:k+=1,e.next=17;break;case 38:M="",f.forEach(function(e){var t=(0,o.default)(j.vocab).find(function(t){return j.vocab[t]===e});t&&(M+=t)}),n({generated:M});case 41:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()}]),e}();t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"./",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};return new g(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=g(n(53)),a=g(n(123)),o=g(n(61)),i=g(n(60)),s=g(n(171)),u=g(n(41)),c=g(n(40)),l=g(n(170)),f=g(n(169)),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10)),h=g(n(124)),d=g(n(168)),m=n(98);function g(e){return e&&e.__esModule?e:{default:e}}var y=200,v=function(e){function t(e,n,r){(0,u.default)(this,t);var a=(0,l.default)(this,(t.__proto__||(0,s.default)(t)).call(this,n,y));return a.ready=!1,a.variableDictionary={},a.timesScalar=p.scalar(150),a.plusScalar=p.scalar(127.5),a.epsilonScalar=p.scalar(.001),a.video=null,a.videoElt?a.loadVideo().then(function(){a.videoReady=!0,a.loadCheckpoints(e).then(function(){a.ready=!0,r&&r()})}):a.loadCheckpoints(e).then(function(){a.ready=!0,r&&r()}),a}return(0,f.default)(t,e),(0,c.default)(t,[{key:"loadCheckpoints",value:function(){var e=(0,i.default)(o.default.mark(function e(t){var n;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new d.default(t),e.next=3,n.getAllVariables();case 3:this.variables=e.sent;case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"instanceNorm",value:function(e,n){var r=(0,a.default)(e.shape,3),o=r[0],i=r[1],s=r[2],u=p.moments(e,[0,1]),c=u.mean,l=u.variance,f=this.variables[t.getVariableName(n)],h=this.variables[t.getVariableName(n+1)],d=this.epsilonScalar,m=p.div(p.sub(e.asType("float32"),c),p.sqrt(p.add(l,d)));return p.add(p.mul(h,m),f).as3D(o,i,s)}},{key:"convLayer",value:function(e,n,r,a){var o=p.conv2d(e,this.variables[t.getVariableName(a)],[n,n],"same"),i=this.instanceNorm(o,a+1);return r?p.relu(i):i}},{key:"residualBlock",value:function(e,t){var n=this.convLayer(e,1,!0,t),r=this.convLayer(n,1,!1,t+3);return p.add(r,e)}},{key:"convTransposeLayer",value:function(e,n,r,o){var i=(0,a.default)(e.shape,2),s=[i[0]*r,i[1]*r,n],u=p.conv2dTranspose(e,this.variables[t.getVariableName(o)],s,[r,r],"same"),c=this.instanceNorm(u,o+1);return p.relu(c)}},{key:"transfer",value:function(){var e=(0,i.default)(o.default.mark(function e(t){var n,a,i,s,u=this,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=void 0,a=c,t instanceof HTMLVideoElement||t instanceof HTMLImageElement?n=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&(t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLImageElement)?n=t.elt:"function"==typeof t&&(n=this.video,a=t),i=p.fromPixels(n),s=p.tidy(function(){var e=u.convLayer(i,1,!0,0),t=u.convLayer(e,2,!0,3),n=u.convLayer(t,2,!0,6),r=u.residualBlock(n,9),a=u.residualBlock(r,15),o=u.residualBlock(a,21),s=u.residualBlock(o,27),c=u.residualBlock(s,33),l=u.convTransposeLayer(c,64,2,39),f=u.convTransposeLayer(l,32,2,42),h=u.convLayer(f,1,!1,45),d=p.tanh(h),m=p.mul(u.timesScalar,d),g=p.add(u.plusScalar,m),y=p.clipByValue(g,0,255);return p.div(y,p.scalar(255))}),e.next=7,p.nextFrame();case 7:a((0,m.array3DToImage)(s));case 8:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}],[{key:"getVariableName",value:function(e){return 0===e?"Variable":"Variable_"+e}}]),t}(h.default);t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};return"function"==typeof t&&(n=t),new v(e,t,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(53)),a=c(n(41)),o=c(n(40)),i=u(n(10)),s=u(n(242));function u(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function c(e){return e&&e.__esModule?e:{default:e}}var l={imageScaleFactor:.3,outputStride:16,flipHorizontal:!1,minConfidence:.5,maxPoseDetections:5,scoreThreshold:.5,nmsRadius:20,detectionType:"multiple",multiplier:.75},f=function(){function e(t,n,r,o){var i=this;(0,a.default)(this,e),this.video=t,this.detectionType=r||l.detectionType,this.imageScaleFactor=n.imageScaleFactor||l.imageScaleFactor,this.outputStride=n.outputStride||l.outputStride,this.flipHorizontal=n.flipHorizontal||l.flipHorizontal,this.minConfidence=n.minConfidence||l.minConfidence,this.multiplier=n.multiplier||l.multiplier,s.load(this.multiplier).then(function(e){i.net=e,i.video&&(i.video.onplay=function(){"single"===i.detectionType?i.singlePose(o):"multiple"===i.detectionType&&i.multiPose(o)})()}).catch(function(e){console.error("Error loading the model: "+e)})}return(0,o.default)(e,[{key:"skeleton",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.minConfidence;return s.getAdjacentKeyPoints(e,t)}},{key:"singlePose",value:function(e){var t=this,n=void 0,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};e instanceof HTMLImageElement||e instanceof HTMLVideoElement?n=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement)?n=e.elt:"function"==typeof e&&this.video&&(n=this.video,a=e),this.net.estimateSinglePose(n,this.imageScaleFactor,this.flipHorizontal,this.outputStride).then(function(e){a([{pose:e,skeleton:t.skeleton(e.keypoints)}]),i.nextFrame().then(function(){t.singlePose(a)})})}},{key:"multiPose",value:function(e){var t=this,n=void 0,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};e instanceof HTMLImageElement||e instanceof HTMLVideoElement?n=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement)?n=e.elt:"function"==typeof e&&this.video&&(n=this.video,a=e),this.net.estimateMultiplePoses(n,this.imageScaleFactor,this.flipHorizontal,this.outputStride).then(function(e){var n=e.map(function(e){return{pose:e,skeleton:t.skeleton(e.keypoints)}});a(n),i.nextFrame().then(function(){t.multiPose(a)})})}}]),e}();t.default=function(e,t){var n=void 0,a={},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=null;return e instanceof HTMLVideoElement?n=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&e.elt instanceof HTMLVideoElement?n=e.elt:"object"===(void 0===e?"undefined":(0,r.default)(e))?a=e:"function"==typeof e&&(o=e),"object"===(void 0===t?"undefined":(0,r.default)(t))?a=t:"function"==typeof t?o=t:"string"==typeof t&&(i=t),new f(n,a,i,o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nonMaxSuppression=t.boxesToCorners=t.filterBoxes=t.boxIOU=t.boxUnion=t.boxIntersection=t.ANCHORS=void 0;var r,a=s(n(61)),o=s(n(60));t.filterBoxes=(r=(0,o.default)(a.default.mark(function e(t,n,r,o){var s,u,c,l,f,p,h,d;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=i.mul(n,r),u=i.argMax(s,-1),c=i.max(s,-1),l=i.greaterEqual(c,i.scalar(o)),e.next=6,l.data();case 6:for(f=e.sent,p=[],h=0;h<f.length;h+=1)f[h]&&p.push(h);if(0!==p.length){e.next=11;break}return e.abrupt("return",[null,null,null]);case 11:return d=i.tensor1d(p,"int32"),e.abrupt("return",[i.gather(t.reshape([f.length,4]),d),i.gather(c.flatten(),d),i.gather(u.flatten(),d)]);case 13:case"end":return e.stop()}},e,this)})),function(e,t,n,a){return r.apply(this,arguments)}),t.head=function(e,t,n){var r=t.shape[0],a=i.reshape(t,[1,1,r,2]),o=e.shape.slice(1,3),s=o[0],u=o[1],c=i.range(0,o[0]),l=i.range(0,o[1]);c=i.tile(c,[o[1]]),l=i.tile(i.expandDims(l,0),[o[0],1]),l=i.transpose(l).flatten();var f=i.transpose(i.stack([c,l]));f=i.reshape(f,[o[0],o[1],1,2]),f=i.cast(f,e.dtype),e=i.reshape(e,[o[0],o[1],r,n+5]),o=i.cast(i.reshape(i.tensor1d(o),[1,1,1,2]),e.dtype);var p=i.sigmoid(e.slice([0,0,0,0],[s,u,r,2])),h=i.exp(e.slice([0,0,0,2],[s,u,r,2])),d=i.sigmoid(e.slice([0,0,0,4],[s,u,r,1])),m=i.softmax(e.slice([0,0,0,5],[s,u,r,n]));return[p=i.div(i.add(p,f),o),h=i.div(i.mul(h,a),o),d,m]};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10));function s(e){return e&&e.__esModule?e:{default:e}}t.ANCHORS=i.tensor2d([[.57273,.677385],[1.87446,2.06253],[3.33843,5.47434],[7.88282,3.52778],[9.77052,9.16828]]);var u=t.boxIntersection=function(e,t){var n=Math.min(e[3],t[3])-Math.max(e[1],t[1]),r=Math.min(e[2],t[2])-Math.max(e[0],t[0]);return n<0||r<0?0:n*r},c=t.boxUnion=function(e,t){var n=u(e,t);return(e[3]-e[1])*(e[2]-e[0])+(t[3]-t[1])*(t[2]-t[0])-n},l=t.boxIOU=function(e,t){return u(e,t)/c(e,t)};t.boxesToCorners=function(e,t){var n=i.tensor1d([2]),r=i.sub(e,i.div(t,n)),a=i.add(e,i.div(t,n)),o=[r.shape[0],r.shape[1],r.shape[2],1];return i.concat([r.slice([0,0,0,1],o),r.slice([0,0,0,0],o),a.slice([0,0,0,1],o),a.slice([0,0,0,0],o)],3)},t.nonMaxSuppression=function(e,t,n){for(var r=[],a=0;a<t.length;a+=1)r.push([t[a],[e[4*a],e[4*a+1],e[4*a+2],e[4*a+3]],a]);var o=[];return r.sort(function(e,t){return t[0]-e[0]}).forEach(function(e){for(var t=!0,r=0;r<o.length;r+=1)if(l(e[1],o[r][1])>n){t=!1;break}t&&o.push(e)}),[o.map(function(e){return e[2]}),o.map(function(e){return e[1]}),o.map(function(e){return e[0]})]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.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(e,t,n){var r=n(35);r(r.S,"Object",{create:n(130)})},function(e,t,n){n(253);var r=n(21).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){e.exports={default:n(254),__esModule:!0}},function(e,t,n){var r=n(55),a=n(42),o=function(e,t){if(a(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=n(82)(Function.call,n(173).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){var r=n(35);r(r.S,"Object",{setPrototypeOf:n(256).set})},function(e,t,n){n(257),e.exports=n(21).Object.setPrototypeOf},function(e,t,n){e.exports={default:n(258),__esModule:!0}},function(e,t,n){var r=n(89),a=n(182);n(172)("getPrototypeOf",function(){return function(e){return a(r(e))}})},function(e,t,n){n(260),e.exports=n(21).Object.getPrototypeOf},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=v(n(102)),a=v(n(123)),o=v(n(53)),i=v(n(61)),s=v(n(60)),u=v(n(171)),c=v(n(41)),l=v(n(40)),f=v(n(170)),p=v(n(169)),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10)),d=v(n(124)),m=n(98),g=v(n(252)),y=n(251);function v(e){return e&&e.__esModule?e:{default:e}}var b={filterBoxesThreshold:.01,IOUThreshold:.4,classProbThreshold:.4},w=416,x=function(e){function t(e,n,r){(0,c.default)(this,t);var a=(0,f.default)(this,(t.__proto__||(0,u.default)(t)).call(this,e,w));return a.filterBoxesThreshold=n.filterBoxesThreshold||b.filterBoxesThreshold,a.IOUThreshold=n.IOUThreshold||b.IOUThreshold,a.classProbThreshold=n.classProbThreshold||b.classProbThreshold,a.modelReady=!1,a.isPredicting=!1,a.loadModel(r),a}return(0,p.default)(t,e),(0,l.default)(t,[{key:"loadModel",value:function(){var e=(0,s.default)(i.default.mark(function e(t){var n=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.loadVideo().then((0,s.default)(i.default.mark(function e(){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h.loadModel("https://raw.githubusercontent.com/ml5js/ml5-library/master/src/YOLO/model.json");case 2:n.model=e.sent,n.modelReady=!0,t();case 5:case"end":return e.stop()}},e,n)}))));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"detect",value:function(){var e=(0,s.default)(i.default.mark(function e(t){var n,s,u,c,l,f,p,d,v,b,x,k,O,S,N,E,I,T,A,C,P,_,R,M,j,D,L,z,F=this,B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.modelReady||!this.video||this.predicting){e.next=37;break}return n=void 0,s=B,this.isPredicting=!0,t instanceof HTMLImageElement||t instanceof HTMLVideoElement?n=t:"object"===(void 0===t?"undefined":(0,o.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement)?n=t.elt:"function"==typeof t&&(n=this.video,s=t),u=(0,m.imgToTensor)(n),c=h.tidy(function(){var e=F.model.predict(u),t=(0,y.head)(e,y.ANCHORS,80),n=(0,a.default)(t,4),r=n[0],o=n[1],i=n[2],s=n[3];return[(0,y.boxesToCorners)(r,o),i,s]}),l=(0,a.default)(c,3),f=l[0],p=l[1],d=l[2],e.next=9,(0,y.filterBoxes)(f,p,d,this.filterBoxesThreshold);case 9:if(v=e.sent,b=(0,a.default)(v,3),x=b[0],k=b[1],O=b[2],null!=x){e.next=16;break}return e.abrupt("return",[]);case 16:return S=h.scalar(w),N=h.scalar(w),E=h.stack([N,S,N,S]).reshape([1,4]),I=h.mul(x,E),e.next=22,r.default.all([I.data(),k.data()]);case 22:return T=e.sent,A=(0,a.default)(T,2),C=A[0],P=A[1],_=(0,y.nonMaxSuppression)(C,P,this.IOUThreshold),R=(0,a.default)(_,3),M=R[0],j=R[1],D=R[2],e.next=29,O.gather(h.tensor1d(M,"int32")).data();case 29:return L=e.sent,z=[],L.forEach(function(e,t){var n=D[t];if(!(n<F.classProbThreshold)){var r=g.default[e],o=(0,a.default)(j[t],4),i=o[0],s=o[1],u=o[2],c=o[3];i=Math.max(0,i),s=Math.max(0,s),u=Math.min(w,u)-i,c=Math.min(w,c)-s;var l={className:r,classProb:n,x:s/w,y:i/w,w:c/w,h:u/w};z.push(l)}}),e.next=34,h.nextFrame();case 34:return this.isPredicting=!1,s&&s(z),e.abrupt("return",z);case 37:return console.warn("Model has not finished loading"),e.abrupt("return",!1);case 39:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),t}(d.default);t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r={},a=e;return"object"===(void 0===e?"undefined":(0,o.default)(e))?r=e:"function"==typeof e&&(n=e),"object"===(void 0===t?"undefined":(0,o.default)(t))?r=t:"function"==typeof t&&(n=t),new x(a,r,n)}},function(e,t,n){var r=n(89),a=n(91);n(172)("keys",function(){return function(e){return a(r(e))}})},function(e,t,n){n(263),e.exports=n(21).Object.keys},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(122)),a=s(n(41)),o=s(n(40)),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10));function s(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(t,n){(0,a.default)(this,e),this.ready=!1,this.model={},this.modelSize=0,this.loadModel(t,n)}return(0,o.default)(e,[{key:"loadModel",value:function(e,t){var n=this;fetch(e).then(function(e){return e.json()}).then(function(e){(0,r.default)(e.vectors).forEach(function(t){n.model[t]=i.tensor1d(e.vectors[t])}),n.modelSize=(0,r.default)(e).length,n.ready=!0,t&&t()}).catch(function(e){console.error("There has been a problem loading the vocab: "+e.message)})}},{key:"add",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=e.addOrSubtract(this.model,t,"ADD");return e.nearest(this.model,r,t.length,t.length+n)}},{key:"subtract",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=e.addOrSubtract(this.model,t,"SUBTRACT");return e.nearest(this.model,r,t.length,t.length+n)}},{key:"average",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=e.addOrSubtract(this.model,t,"ADD"),a=i.div(r,i.tensor(t.length));return e.nearest(this.model,a,t.length,t.length+n)}},{key:"nearest",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=this.model[t];return r?e.nearest(this.model,r,1,n+1):null}},{key:"getRandomWord",value:function(){var e=(0,r.default)(this.model);return e[Math.floor(Math.random()*e.length)]}}],[{key:"addOrSubtract",value:function(e,t,n){var r=[],a=[];if(t.length<2)throw new Error("Invalid input, must be passed more than 1 value");if(t.forEach(function(t){var n=e[t];n?r.push(n):a.push(t)}),a.length>0)throw new Error("Invalid input, vector not found for: "+a.toString());var o=r[0];if("ADD"===n)for(var s=1;s<r.length;s+=1)o=i.add(o,r[s]);else for(var u=1;u<r.length;u+=1)o=i.sub(o,r[u]);return o}},{key:"nearest",value:function(e,t,n,a){var o=[];return(0,r.default)(e).forEach(function(n){var r=i.util.distSquared(t.dataSync(),e[n].dataSync());o.push({vector:n,distance:r})}),o.sort(function(e,t){return e.distance-t.distance}),o.slice(n,a)}}]),e}();t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};return new u(e,t)}},function(e,t,n){var r=n(42),a=n(128);e.exports=n(21).getIterator=function(e){var t=a(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){n(99),n(88),e.exports=n(266)},function(e,t,n){e.exports={default:n(267),__esModule:!0}},function(e,t,n){var r=n(129),a=n(24)("iterator"),o=n(78);e.exports=n(21).isIterable=function(e){var t=Object(e);return void 0!==t[a]||"@@iterator"in t||o.hasOwnProperty(r(t))}},function(e,t,n){n(99),n(88),e.exports=n(269)},function(e,t,n){e.exports={default:n(270),__esModule:!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IMAGENET_CLASSES={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"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p(n(53)),a=p(n(61)),o=p(n(60)),i=p(n(41)),s=p(n(40)),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10)),c=p(n(124)),l=n(272),f=n(98);function p(e){return e&&e.__esModule?e:{default:e}}var h={version:1,alpha:1,topk:3,learningRate:1e-4,hiddenUnits:100,epochs:20,numClasses:2,batchSize:.4},d=function(){function e(t,n){var r=this;(0,i.default)(this,e),this.mobilenet=null,this.modelPath="https://storage.googleapis.com/tfjs-models/tfjs/mobilenet_v1_0.25_224/model.json",this.topKPredictions=10,this.modelLoaded=!1,this.hasAnyTrainedClass=!1,this.customModel=null,this.epochs=t.epochs||h.epochs,this.hiddenUnits=t.hiddenUnits||h.hiddenUnits,this.numClasses=t.numClasses||h.numClasses,this.learningRate=t.learningRate||h.learningRate,this.batchSize=t.batchSize||h.batchSize,this.isPredicting=!1,this.mapStringToIndex=[],this.usageType=null,this.loadModel().then(function(e){r.modelLoaded=!0,r.mobilenetFeatures=e,n()})}return(0,s.default)(e,[{key:"loadModel",value:function(){var e=(0,o.default)(a.default.mark(function e(){var t,n=this;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.loadModel(this.modelPath);case 2:return this.mobilenet=e.sent,t=this.mobilenet.getLayer("conv_pw_13_relu"),this.video&&u.tidy(function(){return n.mobilenet.predict((0,f.imgToTensor)(n.video))}),e.abrupt("return",u.model({inputs:this.mobilenet.inputs,outputs:t.output}));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"classification",value:function(e,t){return this.usageType="classifier",this.loadVideo(e,t)}},{key:"regression",value:function(e,t){return this.usageType="regressor",this.loadVideo(e,t)}},{key:"loadVideo",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},i=null;if(e instanceof HTMLVideoElement?i=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&e.elt instanceof HTMLVideoElement&&(i=e.elt),i){var s=new c.default(i,224);s.loadVideo().then((0,o.default)(a.default.mark(function e(){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.video=s.video,n();case 2:case"end":return e.stop()}},e,t)})))}return this}},{key:"addImage",value:function(e,t){var n=this,a=void 0,o=void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};e instanceof HTMLImageElement||e instanceof HTMLVideoElement?a=e:"object"===(void 0===e?"undefined":(0,r.default)(e))&&(e.elt instanceof HTMLImageElement||e.elt instanceof HTMLVideoElement)?a=e:"string"!=typeof e&&"number"!=typeof e||(a=this.video,o=e),"string"==typeof t||"number"==typeof t?o=t:"function"==typeof t&&(i=t),"string"==typeof o&&(o=this.mapStringToIndex.includes(o)?this.mapStringToIndex.indexOf(o):this.mapStringToIndex.push(o)-1),this.modelLoaded?(u.tidy(function(){var e=(0,f.imgToTensor)(a),t=n.mobilenetFeatures.predict(e),r=void 0;if("classifier"===n.usageType?r=u.tidy(function(){return u.oneHot(u.tensor1d([o],"int32"),n.numClasses)}):"regressor"===n.usageType&&(r=u.tidy(function(){return u.tensor2d([[o]])})),null==n.xs)n.xs=u.keep(t),n.ys=u.keep(r),n.hasAnyTrainedClass=!0;else{var i=n.xs;n.xs=u.keep(i.concat(t,0));var s=n.ys;n.ys=u.keep(s.concat(r,0)),i.dispose(),s.dispose(),r.dispose()}}),i&&i()):console.warn("The model is not loaded yet.")}},{key:"train",value:function(){var e=(0,o.default)(a.default.mark(function e(t){var n,r,i=this;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasAnyTrainedClass){e.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=u.sequential({layers:[u.layers.flatten({inputShape:[7,7,256]}),u.layers.dense({units:this.hiddenUnits,activation:"relu",kernelInitializer:"varianceScaling",useBias:!0}),u.layers.dense({units:this.numClasses,kernelInitializer:"varianceScaling",useBias:!1,activation:"softmax"})]})):"regressor"===this.usageType&&(this.loss="meanSquaredError",this.customModel=u.sequential({layers:[u.layers.flatten({inputShape:[7,7,256]}),u.layers.dense({units:this.hiddenUnits,activation:"relu",kernelInitializer:"varianceScaling",useBias:!0}),u.layers.dense({units:1,useBias:!1,kernelInitializer:"Zeros",activation:"linear"})]})),n=u.train.adam(this.learningRate),this.customModel.compile({optimizer:n,loss:this.loss}),(r=Math.floor(this.xs.shape[0]*this.batchSize))>0){e.next=9;break}throw new Error("Batch size is 0 or NaN. Please choose a non-zero fraction.");case 9:this.customModel.fit(this.xs,this.ys,{batchSize:r,epochs:this.epochs,callbacks:{onBatchEnd:function(){var e=(0,o.default)(a.default.mark(function e(n,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t(r.loss.toFixed(5)),e.next=3,u.nextFrame();case 3:case"end":return e.stop()}},e,i)}));return function(t,n){return e.apply(this,arguments)}}(),onTrainEnd:function(){return t(null)}}});case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"classify",value:function(){var e=(0,o.default)(a.default.mark(function e(t){var n,o,i,s,c=this,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("classifier"!==this.usageType){e.next=15;break}return n=void 0,o=void 0,t instanceof HTMLImageElement||t instanceof HTMLVideoElement?n=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement)?n=t.elt:"function"==typeof t&&(n=this.video,o=t),"function"==typeof l&&(o=l),this.isPredicting=!0,i=u.tidy(function(){var e=(0,f.imgToTensor)(n),t=c.mobilenetFeatures.predict(e);return c.customModel.predict(t).as1D().argMax()}),e.next=9,i.data();case 9:return s=e.sent[0],e.next=12,u.nextFrame();case 12:o&&(this.mapStringToIndex.length>0&&(s=this.mapStringToIndex[s]),o(s)),e.next=16;break;case 15:console.warn("Mobilenet Feature Extraction has not been set to be a classifier.");case 16:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"predict",value:function(){var e=(0,o.default)(a.default.mark(function e(t){var n,o,i,s,c=this,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("regressor"!==this.usageType){e.next=16;break}return n=void 0,o=void 0,t instanceof HTMLImageElement||t instanceof HTMLVideoElement?n=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement)?n=t.elt:"function"==typeof t&&(n=this.video,o=t),"function"==typeof l&&(o=l),this.isPredicting=!0,i=u.tidy(function(){var e=(0,f.imgToTensor)(n),t=c.mobilenetFeatures.predict(e);return c.customModel.predict(t).as1D()}),e.next=9,i.data();case 9:return s=e.sent,i.dispose(),e.next=13,u.nextFrame();case 13:o&&o(s[0]),e.next=17;break;case 16:console.warn("Mobilenet Feature Extraction has not been set to be a regressor.");case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}],[{key:"getTopKClasses",value:function(){var e=(0,o.default)(a.default.mark(function e(t,n,r){var o,i,s,c,f,p,h,d;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.data();case 2:for(o=e.sent,i=[],s=0;s<o.length;s+=1)i.push({value:o[s],index:s});for(i.sort(function(e,t){return t.value-e.value}),c=new Float32Array(n),f=new Int32Array(n),p=0;p<n;p+=1)c[p]=i[p].value,f[p]=i[p].index;for(h=[],d=0;d<f.length;d+=1)h.push({className:l.IMAGENET_CLASSES[f[d]],probability:c[d]});return e.next=13,u.nextFrame();case 13:return r&&r(h),e.abrupt("return",h);case 15:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()}]),e}();t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,a=(r=n(273))&&r.__esModule?r:{default:r};t.default=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if("string"!=typeof e)throw new Error('Please specify a model to use. E.g: "MobileNet"');n=e.toLowerCase();var o={},i=r;if("object"===t?o=t:"function"==typeof t&&(i=t),"mobilenet"===n)return new a.default(o,i);throw new Error(n+" is not a valid model.")}},function(e,t,n){n(125)("observable")},function(e,t,n){n(125)("asyncIterator")},function(e,t,n){var r=n(80),a=n(174).f,o={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return i&&"[object Window]"==o.call(e)?function(e){try{return a(e)}catch(e){return i.slice()}}(e):a(r(e))}},function(e,t,n){var r=n(90);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(91),a=n(131),o=n(103);e.exports=function(e){var t=r(e),n=a.f;if(n)for(var i,s=n(e),u=o.f,c=0;s.length>c;)u.call(e,i=s[c++])&&t.push(i);return t}},function(e,t,n){var r=n(104)("meta"),a=n(55),o=n(64),i=n(49).f,s=0,u=Object.isExtensible||function(){return!0},c=!n(81)(function(){return u(Object.preventExtensions({}))}),l=function(e){i(e,r,{value:{i:"O"+ ++s,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[r].i},getWeak:function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[r].w},onFreeze:function(e){return c&&f.NEED&&u(e)&&!o(e,r)&&l(e),e}}},function(e,t,n){"use strict";var r=n(25),a=n(64),o=n(54),i=n(35),s=n(184),u=n(280).KEY,c=n(81),l=n(133),f=n(100),p=n(104),h=n(24),d=n(126),m=n(125),g=n(279),y=n(278),v=n(42),b=n(55),w=n(80),x=n(138),k=n(92),O=n(130),S=n(277),N=n(173),E=n(49),I=n(91),T=N.f,A=E.f,C=S.f,P=r.Symbol,_=r.JSON,R=_&&_.stringify,M=h("_hidden"),j=h("toPrimitive"),D={}.propertyIsEnumerable,L=l("symbol-registry"),z=l("symbols"),F=l("op-symbols"),B=Object.prototype,V="function"==typeof P,U=r.QObject,W=!U||!U.prototype||!U.prototype.findChild,G=o&&c(function(){return 7!=O(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=T(B,t);r&&delete B[t],A(e,t,n),r&&e!==B&&A(B,t,r)}:A,q=function(e){var t=z[e]=O(P.prototype);return t._k=e,t},H=V&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},K=function(e,t,n){return e===B&&K(F,t,n),v(e),t=x(t,!0),v(n),a(z,t)?(n.enumerable?(a(e,M)&&e[M][t]&&(e[M][t]=!1),n=O(n,{enumerable:k(0,!1)})):(a(e,M)||A(e,M,k(1,{})),e[M][t]=!0),G(e,t,n)):A(e,t,n)},X=function(e,t){v(e);for(var n,r=g(t=w(t)),a=0,o=r.length;o>a;)K(e,n=r[a++],t[n]);return e},J=function(e){var t=D.call(this,e=x(e,!0));return!(this===B&&a(z,e)&&!a(F,e))&&(!(t||!a(this,e)||!a(z,e)||a(this,M)&&this[M][e])||t)},Y=function(e,t){if(e=w(e),t=x(t,!0),e!==B||!a(z,t)||a(F,t)){var n=T(e,t);return!n||!a(z,t)||a(e,M)&&e[M][t]||(n.enumerable=!0),n}},Q=function(e){for(var t,n=C(w(e)),r=[],o=0;n.length>o;)a(z,t=n[o++])||t==M||t==u||r.push(t);return r},Z=function(e){for(var t,n=e===B,r=C(n?F:w(e)),o=[],i=0;r.length>i;)!a(z,t=r[i++])||n&&!a(B,t)||o.push(z[t]);return o};V||(s((P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(n){this===B&&t.call(F,n),a(this,M)&&a(this[M],e)&&(this[M][e]=!1),G(this,e,k(1,n))};return o&&W&&G(B,e,{configurable:!0,set:t}),q(e)}).prototype,"toString",function(){return this._k}),N.f=Y,E.f=K,n(174).f=S.f=Q,n(103).f=J,n(131).f=Z,o&&!n(101)&&s(B,"propertyIsEnumerable",J,!0),d.f=function(e){return q(h(e))}),i(i.G+i.W+i.F*!V,{Symbol:P});for(var $="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;$.length>ee;)h($[ee++]);for(var te=I(h.store),ne=0;te.length>ne;)m(te[ne++]);i(i.S+i.F*!V,"Symbol",{for:function(e){return a(L,e+="")?L[e]:L[e]=P(e)},keyFor:function(e){if(!H(e))throw TypeError(e+" is not a symbol!");for(var t in L)if(L[t]===e)return t},useSetter:function(){W=!0},useSimple:function(){W=!1}}),i(i.S+i.F*!V,"Object",{create:function(e,t){return void 0===t?O(e):X(O(e),t)},defineProperty:K,defineProperties:X,getOwnPropertyDescriptor:Y,getOwnPropertyNames:Q,getOwnPropertySymbols:Z}),_&&i(i.S+i.F*(!V||c(function(){var e=P();return"[null]"!=R([e])||"{}"!=R({a:e})||"{}"!=R(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],a=1;arguments.length>a;)r.push(arguments[a++]);if(n=t=r[1],(b(t)||void 0!==e)&&!H(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!H(t))return t}),r[1]=t,R.apply(_,r)}}),P.prototype[j]||n(65)(P.prototype,j,P.prototype.valueOf),f(P,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(e,t,n){n(281),n(186),n(276),n(275),e.exports=n(21).Symbol},function(e,t,n){e.exports={default:n(282),__esModule:!0}},function(e,t,n){n(88),n(99),e.exports=n(126).f("iterator")},function(e,t,n){e.exports={default:n(284),__esModule:!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(53)),a=f(n(61)),o=f(n(60)),i=f(n(41)),s=f(n(40)),u=l(n(10)),c=l(n(241));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function f(e){return e&&e.__esModule?e:{default:e}}var p={mobilenet:{version:1,alpha:1,topk:3}},h=function(){function e(t,n,r,a){(0,i.default)(this,e),this.modelName=t,this.video=n,this.version=r.version||p[this.modelName].version,this.alpha=r.alpha||p[this.modelName].alpha,this.topk=r.topk||p[this.modelName].topk,this.modelLoaded=!1,this.model=null,"mobilenet"===this.modelName?this.modelToUse=c:this.modelToUse=null,this.modelLoaded=this.loadModel(a)}return(0,s.default)(e,[{key:"loadModel",value:function(){var e=(0,o.default)(a.default.mark(function e(t){var n=this;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.modelToUse.load(this.version,this.alpha).then(function(e){n.model=e,t&&t()}));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"predict",value:function(){var e=(0,o.default)(a.default.mark(function e(t){var n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=void 0,o=this.topk,i=void 0,"function"==typeof t?(n=this.video,i=t):"number"==typeof t?(n=this.video,o=t):t instanceof HTMLImageElement?n=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.elt instanceof HTMLImageElement&&(n=t.elt),"number"==typeof s?o=t:"function"==typeof s&&(i=s),"function"==typeof c&&(i=c),e.next=8,this.modelLoaded;case 8:return e.next=10,u.nextFrame();case 10:return this.videoElt&&!this.addedListener&&(this.video.addEventListener("onloadstart",function(){return this.model.classify(n,o).then(function(e){i&&i(e)})}),this.addedListener=!0),e.abrupt("return",this.model.classify(n,o).then(function(e){i&&i(e)}));case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}();t.default=function(e,t,n){var a,o=void 0,i={},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if("string"!=typeof e)throw new Error('Please specify a model to use. E.g: "MobileNet"');return a=e.toLowerCase(),t instanceof HTMLVideoElement?o=t:"object"===(void 0===t?"undefined":(0,r.default)(t))&&t.elt instanceof HTMLVideoElement?o=t.elt:"object"===t?i=t:"function"===t&&(s=t),"object"===(void 0===n?"undefined":(0,r.default)(n))?i=n:"function"==typeof n&&(s=n),new h(a,o,i,s)}},function(e,t,n){var r=n(35);r(r.S+r.F*!n(54),"Object",{defineProperty:n(49).f})},function(e,t,n){n(287);var r=n(21).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){e.exports={default:n(288),__esModule:!0}},function(e,t,n){"use strict";var r=n(35),a=n(127),o=n(177);r(r.S,"Promise",{try:function(e){var t=a.f(this),n=o(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){"use strict";var r=n(35),a=n(21),o=n(25),i=n(179),s=n(176);r(r.P+r.R,"Promise",{finally:function(e){var t=i(this,a.Promise||o.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then(function(){return n})}:e,n?function(n){return s(t,e()).then(function(){throw n})}:e)}})},function(e,t,n){"use strict";var r=n(25),a=n(21),o=n(49),i=n(54),s=n(24)("species");e.exports=function(e){var t="function"==typeof a[e]?a[e]:r[e];i&&t&&!t[s]&&o.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(65);e.exports=function(e,t,n){for(var a in t)n&&e[a]?e[a]=t[a]:r(e,a,t[a]);return e}},function(e,t,n){var r=n(25),a=n(178).set,o=r.MutationObserver||r.WebKitMutationObserver,i=r.process,s=r.Promise,u="process"==n(90)(i);e.exports=function(){var e,t,n,c=function(){var r,a;for(u&&(r=i.domain)&&r.exit();e;){a=e.fn,e=e.next;try{a()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(u)n=function(){i.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve();n=function(){l.then(c)}}else n=function(){a.call(r,c)};else{var f=!0,p=document.createTextNode("");new o(c).observe(p,{characterData:!0}),n=function(){p.data=f=!f}}return function(r){var a={fn:r,next:void 0};t&&(t.next=a),e||(e=a,n()),t=a}}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(82),a=n(181),o=n(180),i=n(42),s=n(136),u=n(128),c={},l={};(t=e.exports=function(e,t,n,f,p){var h,d,m,g,y=p?function(){return e}:u(e),v=r(n,f,t?2:1),b=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(o(y)){for(h=s(e.length);h>b;b++)if((g=t?v(i(d=e[b])[0],d[1]):v(e[b]))===c||g===l)return g}else for(m=y.call(e);!(d=m.next()).done;)if((g=a(m,v,d.value,t))===c||g===l)return g}).BREAK=c,t.RETURN=l},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r,a,o,i,s=n(101),u=n(25),c=n(82),l=n(129),f=n(35),p=n(55),h=n(105),d=n(297),m=n(296),g=n(179),y=n(178).set,v=n(294)(),b=n(127),w=n(177),x=n(176),k=u.TypeError,O=u.process,S=u.Promise,N="process"==l(O),E=function(){},I=a=b.f,T=!!function(){try{var e=S.resolve(1),t=(e.constructor={})[n(24)("species")]=function(e){e(E,E)};return(N||"function"==typeof PromiseRejectionEvent)&&e.then(E)instanceof t}catch(e){}}(),A=function(e){var t;return!(!p(e)||"function"!=typeof(t=e.then))&&t},C=function(e,t){if(!e._n){e._n=!0;var n=e._c;v(function(){for(var r=e._v,a=1==e._s,o=0,i=function(t){var n,o,i=a?t.ok:t.fail,s=t.resolve,u=t.reject,c=t.domain;try{i?(a||(2==e._h&&R(e),e._h=1),!0===i?n=r:(c&&c.enter(),n=i(r),c&&c.exit()),n===t.promise?u(k("Promise-chain cycle")):(o=A(n))?o.call(n,s,u):s(n)):u(r)}catch(e){u(e)}};n.length>o;)i(n[o++]);e._c=[],e._n=!1,t&&!e._h&&P(e)})}},P=function(e){y.call(u,function(){var t,n,r,a=e._v,o=_(e);if(o&&(t=w(function(){N?O.emit("unhandledRejection",a,e):(n=u.onunhandledrejection)?n({promise:e,reason:a}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",a)}),e._h=N||_(e)?2:1),e._a=void 0,o&&t.e)throw t.v})},_=function(e){return 1!==e._h&&0===(e._a||e._c).length},R=function(e){y.call(u,function(){var t;N?O.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},M=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),C(t,!0))},j=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw k("Promise can't be resolved itself");(t=A(e))?v(function(){var r={_w:n,_d:!1};try{t.call(e,c(j,r,1),c(M,r,1))}catch(e){M.call(r,e)}}):(n._v=e,n._s=1,C(n,!1))}catch(e){M.call({_w:n,_d:!1},e)}}};T||(S=function(e){d(this,S,"Promise","_h"),h(e),r.call(this);try{e(c(j,this,1),c(M,this,1))}catch(e){M.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(293)(S.prototype,{then:function(e,t){var n=I(g(this,S));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=N?O.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&C(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new r;this.promise=e,this.resolve=c(j,e,1),this.reject=c(M,e,1)},b.f=I=function(e){return e===S||e===i?new o(e):a(e)}),f(f.G+f.W+f.F*!T,{Promise:S}),n(100)(S,"Promise"),n(292)("Promise"),i=n(21).Promise,f(f.S+f.F*!T,"Promise",{reject:function(e){var t=I(this);return(0,t.reject)(e),t.promise}}),f(f.S+f.F*(s||!T),"Promise",{resolve:function(e){return x(s&&this===i?S:this,e)}}),f(f.S+f.F*!(T&&n(175)(function(e){S.all(e).catch(E)})),"Promise",{all:function(e){var t=this,n=I(t),r=n.resolve,a=n.reject,o=w(function(){var n=[],o=0,i=1;m(e,!1,function(e){var s=o++,u=!1;n.push(void 0),i++,t.resolve(e).then(function(e){u||(u=!0,n[s]=e,--i||r(n))},a)}),--i||r(n)});return o.e&&a(o.v),n.promise},race:function(e){var t=this,n=I(t),r=n.reject,a=w(function(){m(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return a.e&&r(a.v),n.promise}})},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports=function(){}},function(e,t,n){"use strict";var r=n(300),a=n(299),o=n(78),i=n(80);e.exports=n(185)(Array,"Array",function(e,t){this._t=i(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,a(1)):a(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t,n){var r=n(49),a=n(42),o=n(91);e.exports=n(54)?Object.defineProperties:function(e,t){a(e);for(var n,i=o(t),s=i.length,u=0;s>u;)r.f(e,n=i[u++],t[n]);return e}},function(e,t,n){"use strict";var r=n(130),a=n(92),o=n(100),i={};n(65)(i,n(24)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(i,{next:a(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(135),a=n(137);e.exports=function(e){return function(t,n){var o,i,s=String(a(t)),u=r(n),c=s.length;return u<0||u>=c?e?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(i=s.charCodeAt(u+1))<56320||i>57343?e?s.charAt(u):o:e?s.slice(u,u+2):i-56320+(o-55296<<10)+65536}}},function(e,t,n){n(186),n(88),n(99),n(298),n(291),n(290),e.exports=n(21).Promise},function(e,t){!function(t){"use strict";var n,r=Object.prototype,a=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"==typeof e,l=t.regeneratorRuntime;if(l)c&&(e.exports=l);else{(l=t.regeneratorRuntime=c?e.exports:{}).wrap=w;var f="suspendedStart",p="suspendedYield",h="executing",d="completed",m={},g={};g[i]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(P([])));v&&v!==r&&a.call(v,i)&&(g=v);var b=S.prototype=k.prototype=Object.create(g);O.prototype=b.constructor=S,S.constructor=O,S[u]=O.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===O||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(b),e},l.awrap=function(e){return{__await:e}},N(E.prototype),E.prototype[s]=function(){return this},l.AsyncIterator=E,l.async=function(e,t,n,r){var a=new E(w(e,t,n,r));return l.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},N(b),b[u]="Generator",b[i]=function(){return this},b.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=P,C.prototype={constructor:C,reset:function(e){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(A),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,a){return s.type="throw",s.arg=e,t.next=r,a&&(t.method="next",t.arg=n),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;A(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function w(e,t,n,r){var a=t&&t.prototype instanceof k?t:k,o=Object.create(a.prototype),i=new C(r||[]);return o._invoke=function(e,t,n){var r=f;return function(a,o){if(r===h)throw new Error("Generator is already running");if(r===d){if("throw"===a)throw o;return _()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=I(i,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=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=x(e,t,n);if("normal"===u.type){if(r=n.done?d:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=d,n.method="throw",n.arg=u.arg)}}}(e,n,i),o}function x(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function k(){}function O(){}function S(){}function N(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function E(e){var t;this._invoke=function(n,r){function o(){return new Promise(function(t,o){!function t(n,r,o,i){var s=x(e[n],e,r);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&a.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,i)},function(e){t("throw",e,o,i)}):Promise.resolve(c).then(function(e){u.value=e,o(u)},i)}i(s.arg)}(n,r,t,o)})}return t=t?t.then(o,o):o()}}function I(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,I(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var a=x(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,m;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,m):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function P(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(a.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return o.next=o}}return{next:_}}function _(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},function(e,t,n){var r=function(){return this}()||Function("return this")(),a=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=a&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(306),a)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(61)),a=u(n(60)),o=u(n(41)),i=u(n(40)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(10));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t,n,r){(0,o.default)(this,e),this.modelName=t,this.audioContext=n,this.stream=r,this.loadModel()}return(0,i.default)(e,[{key:"loadModel",value:function(){var e=(0,a.default)(r.default.mark(function e(){return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.loadModel("model/model.json");case 2:this.model=e.sent,this.initAudio();case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"initAudio",value:function(){if(!this.audioContext)throw new Error("Could not access microphone - getUserMedia not available");try{this.processStream(this.stream)}catch(e){throw new Error("Error: Could not access microphone - "+e)}}},{key:"processStream",value:function(e){for(var t=this.audioContext.createMediaStreamSource(e),n=this.audioContext.sampleRate/16e3*1024,r=4;r<n;)r*=2;var a=this.audioContext.createScriptProcessor(r,1,1);a.onaudioprocess=this.processMicrophoneBuffer.bind(this);var o=this.audioContext.createGain();o.gain.setValueAtTime(0,this.audioContext.currentTime),t.connect(a),a.connect(o),o.connect(this.audioContext.destination),"running"!==this.audioContext.state&&console.warn("User gesture needed to start AudioContext, please click")}},{key:"processMicrophoneBuffer",value:function(t){var n=this;this.results={};var r=s.add(s.linspace(0,7180,360),s.tensor(1997.379408437619));e.resample(t.inputBuffer,function(e){s.tidy(function(){n.running=!0;var t=s.tensor(e.slice(0,1024)),a=s.sub(t,s.mean(t)),o=s.tensor(s.norm(a).dataSync()/Math.sqrt(1024)),i=s.div(a,o).reshape([1,1024]),u=n.model.predict([i]).reshape([360]),c=u.max().dataSync()[0],l=u.argMax().dataSync()[0];n.results.confidence=c.toFixed(3);var f=Math.max(0,l-4),p=Math.min(360,l+5),h=u.slice([f],[p-f]),d=r.slice([f],[p-f]),m=s.mul(h,d).dataSync().reduce(function(e,t){return e+t},0)/h.dataSync().reduce(function(e,t){return e+t},0),g=10*Math.pow(m/1200,2),y=c>.5?g.toFixed(3)+" + Hz":"no voice";n.results.result=y})})}},{key:"getResults",value:function(){return this.results}}],[{key:"resample",value:function(e,t){for(var n=e.sampleRate%16e3!=0,r=e.sampleRate/16e3,a=e.getChannelData(0),o=new Float32Array(1024),i=0;i<1024;i+=1)if(n){var s=Math.floor(i*r),u=s+1,c=i*r-s;o[i]=(1-c)*a[s]+c*a[u]}else o[i]=a[i*r];t(o)}}]),e}();t.default=function(e,t,n){var r;if("string"!=typeof e)throw new Error('Please specify a model to use. E.g: "Crepe"');if("crepe"===(r=e.toLowerCase()))return new c(r,t,n);throw new Error(r+" is not a valid model to use in pitchDetection()")}},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";e.exports=a;var r=n(62);function a(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(a.prototype=Object.create(r.EventEmitter.prototype)).constructor=a,a.prototype.rpcCall=function e(t,n,a,o,i){if(!o)throw TypeError("request must be specified");var s=this;if(!i)return r.asPromise(e,s,t,n,a,o);if(s.rpcImpl)try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,n){if(e)return s.emit("error",e,t),i(e);if(null!==n){if(!(n instanceof a))try{n=a[s.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return s.emit("error",e,t),i(e)}return s.emit("data",n,t),i(null,n)}s.end(!0)})}catch(e){return s.emit("error",e,t),void setTimeout(function(){i(e)},0)}else setTimeout(function(){i(Error("already ended"))},0)},a.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(e,t,n){"use strict";t.Service=n(310)},function(e,t,n){"use strict";e.exports=o;var r=n(187);(o.prototype=Object.create(r.prototype)).constructor=o;var a=n(62);function o(e){r.call(this,e)}a.Buffer&&(o.prototype._slice=a.Buffer.prototype.slice),o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},function(e,t,n){"use strict";e.exports=i;var r=n(188);(i.prototype=Object.create(r.prototype)).constructor=i;var a=n(62),o=a.Buffer;function i(){r.call(this)}i.alloc=function(e){return(i.alloc=a._Buffer_allocUnsafe)(e)};var s=o&&o.prototype instanceof Uint8Array&&"set"===o.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]};function u(e,t,n){e.length<40?a.utf8.write(e,t,n):t.utf8Write(e,n)}i.prototype.bytes=function(e){a.isString(e)&&(e=a._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s,t,e),this},i.prototype.string=function(e){var t=o.byteLength(e);return this.uint32(t),t&&this._push(u,t,e),this}},function(e,t,n){"use strict";e.exports=a;var r=n(62);function a(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=a.zero=new a(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var i=a.zeroHash="\0\0\0\0\0\0\0\0";a.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new a(n,r)},a.from=function(e){if("number"==typeof e)return a.fromNumber(e);if(r.isString(e)){if(!r.Long)return a.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new a(e.low>>>0,e.high>>>0):o},a.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},a.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;a.fromHash=function(e){return e===i?o:new a((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},a.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},a.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},a.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},a.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r=n||8192,a=r>>>1,o=null,i=r;return function(n){if(n<1||n>a)return e(n);i+n>r&&(o=e(r),i=0);var s=t.call(o,i,i+=n);return 7&i&&(i=1+(7|i)),s}}},function(e,t,n){"use strict";var r=t;r.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},r.read=function(e,t,n){if(n-t<1)return"";for(var r,a=null,o=[],i=0;t<n;)(r=e[t++])<128?o[i++]=r:r>191&&r<224?o[i++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[i++]=55296+(r>>10),o[i++]=56320+(1023&r)):o[i++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],i>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,o)),i=0);return a?(i&&a.push(String.fromCharCode.apply(String,o.slice(0,i))),a.join("")):String.fromCharCode.apply(String,o.slice(0,i))},r.write=function(e,t,n){for(var r,a,o=n,i=0;i<e.length;++i)(r=e.charCodeAt(i))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(a=e.charCodeAt(i+1)))?(r=65536+((1023&r)<<10)+(1023&a),++i,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},function(module,exports,__webpack_require__){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},function(e,t,n){"use strict";function r(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function a(e,r,a){t[0]=e,r[a]=n[0],r[a+1]=n[1],r[a+2]=n[2],r[a+3]=n[3]}function o(e,r,a){t[0]=e,r[a]=n[3],r[a+1]=n[2],r[a+2]=n[1],r[a+3]=n[0]}function i(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function s(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?a:o,e.writeFloatBE=r?o:a,e.readFloatLE=r?i:s,e.readFloatBE=r?s:i}():function(){function t(e,t,n,r){var a=t<0?1:0;if(a&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>3.4028234663852886e38)e((a<<31|2139095040)>>>0,n,r);else if(t<1.1754943508222875e-38)e((a<<31|Math.round(t/1.401298464324817e-45))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((a<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function n(e,t,n){var r=e(t,n),a=2*(r>>31)+1,o=r>>>23&255,i=8388607&r;return 255===o?i?NaN:a*(1/0):0===o?1.401298464324817e-45*a*i:a*Math.pow(2,o-150)*(i+8388608)}e.writeFloatLE=t.bind(null,a),e.writeFloatBE=t.bind(null,o),e.readFloatLE=n.bind(null,i),e.readFloatBE=n.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function a(e,r,a){t[0]=e,r[a]=n[0],r[a+1]=n[1],r[a+2]=n[2],r[a+3]=n[3],r[a+4]=n[4],r[a+5]=n[5],r[a+6]=n[6],r[a+7]=n[7]}function o(e,r,a){t[0]=e,r[a]=n[7],r[a+1]=n[6],r[a+2]=n[5],r[a+3]=n[4],r[a+4]=n[3],r[a+5]=n[2],r[a+6]=n[1],r[a+7]=n[0]}function i(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function s(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?a:o,e.writeDoubleBE=r?o:a,e.readDoubleLE=r?i:s,e.readDoubleBE=r?s:i}():function(){function t(e,t,n,r,a,o){var i=r<0?1:0;if(i&&(r=-r),0===r)e(0,a,o+t),e(1/r>0?0:2147483648,a,o+n);else if(isNaN(r))e(0,a,o+t),e(2146959360,a,o+n);else if(r>1.7976931348623157e308)e(0,a,o+t),e((i<<31|2146435072)>>>0,a,o+n);else{var s;if(r<2.2250738585072014e-308)e((s=r/5e-324)>>>0,a,o+t),e((i<<31|s/4294967296)>>>0,a,o+n);else{var u=Math.floor(Math.log(r)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(s=r*Math.pow(2,-u))>>>0,a,o+t),e((i<<31|u+1023<<20|1048576*s&1048575)>>>0,a,o+n)}}}function n(e,t,n,r,a){var o=e(r,a+t),i=e(r,a+n),s=2*(i>>31)+1,u=i>>>20&2047,c=4294967296*(1048575&i)+o;return 2047===u?c?NaN:s*(1/0):0===u?5e-324*s*c:s*Math.pow(2,u-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,a,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=n.bind(null,i,0,4),e.readDoubleBE=n.bind(null,s,4,0)}(),e}function a(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function o(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=r(r)},function(e,t,n){"use strict";function r(){this._listeners={}}e.exports=r,r.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},r.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},r.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},function(e,t,n){"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var a=new Array(64),o=new Array(123),i=0;i<64;)o[a[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;r.encode=function(e,t,n){for(var r,o=null,i=[],s=0,u=0;t<n;){var c=e[t++];switch(u){case 0:i[s++]=a[c>>2],r=(3&c)<<4,u=1;break;case 1:i[s++]=a[r|c>>4],r=(15&c)<<2,u=2;break;case 2:i[s++]=a[r|c>>6],i[s++]=a[63&c],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0)}return u&&(i[s++]=a[r],i[s++]=61,1===u&&(i[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},r.decode=function(e,t,n){for(var r,a=n,i=0,s=0;s<e.length;){var u=e.charCodeAt(s++);if(61===u&&i>1)break;if(void 0===(u=o[u]))throw Error("invalid encoding");switch(i){case 0:r=u,i=1;break;case 1:t[n++]=r<<2|(48&u)>>4,r=u,i=2;break;case 2:t[n++]=(15&r)<<4|(60&u)>>2,r=u,i=3;break;case 3:t[n++]=(3&r)<<6|u,i=0}}if(1===i)throw Error("invalid encoding");return n-a},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){for(var n=new Array(arguments.length-1),r=0,a=2,o=!0;a<arguments.length;)n[r++]=arguments[a++];return new Promise(function(a,i){n[r]=function(e){if(o)if(o=!1,e)i(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];a.apply(null,t)}};try{e.apply(t||null,n)}catch(e){o&&(o=!1,i(e))}})}},function(e,t,n){"use strict";var r=t;function a(){r.Reader._configure(r.BufferReader),r.util._configure()}r.build="minimal",r.Writer=n(188),r.BufferWriter=n(313),r.Reader=n(187),r.BufferReader=n(312),r.util=n(62),r.rpc=n(311),r.roots=n(309),r.configure=a,r.Writer._configure(r.BufferWriter),a()},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(i(e),function(i){var s=encodeURIComponent(r(i))+n;return a(e[i])?o(e[i],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[i]))}).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var s=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,p,h,d,m=e[l].replace(s,"%20"),g=m.indexOf(n);g>=0?(f=m.substr(0,g),p=m.substr(g+1)):(f=m,p=""),h=decodeURIComponent(f),d=decodeURIComponent(p),r(i,h)?a(i[h])?i[h].push(d):i[h]=[i[h],d]:i[h]=d}return i};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";t.decode=t.parse=n(324),t.encode=t.stringify=n(323)},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){(function(e,r){var a;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){"object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType;var i="object"==typeof r&&r;i.global!==i&&i.window!==i&&i.self;var s,u=2147483647,c=36,l=1,f=26,p=38,h=700,d=72,m=128,g="-",y=/^xn--/,v=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=c-l,k=Math.floor,O=String.fromCharCode;function S(e){throw new RangeError(w[e])}function N(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function E(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+N((e=e.replace(b,".")).split("."),t).join(".")}function I(e){for(var t,n,r=[],a=0,o=e.length;a<o;)(t=e.charCodeAt(a++))>=55296&&t<=56319&&a<o?56320==(64512&(n=e.charCodeAt(a++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),a--):r.push(t);return r}function T(e){return N(e,function(e){var t="";return e>65535&&(t+=O((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+O(e)}).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,n){var r=0;for(e=n?k(e/h):e>>1,e+=k(e/t);e>x*f>>1;r+=c)e=k(e/x);return k(r+(x+1)*e/(e+p))}function P(e){var t,n,r,a,o,i,s,p,h,y,v,b=[],w=e.length,x=0,O=m,N=d;for((n=e.lastIndexOf(g))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&S("not-basic"),b.push(e.charCodeAt(r));for(a=n>0?n+1:0;a<w;){for(o=x,i=1,s=c;a>=w&&S("invalid-input"),((p=(v=e.charCodeAt(a++))-48<10?v-22:v-65<26?v-65:v-97<26?v-97:c)>=c||p>k((u-x)/i))&&S("overflow"),x+=p*i,!(p<(h=s<=N?l:s>=N+f?f:s-N));s+=c)i>k(u/(y=c-h))&&S("overflow"),i*=y;N=C(x-o,t=b.length+1,0==o),k(x/t)>u-O&&S("overflow"),O+=k(x/t),x%=t,b.splice(x++,0,O)}return T(b)}function _(e){var t,n,r,a,o,i,s,p,h,y,v,b,w,x,N,E=[];for(b=(e=I(e)).length,t=m,n=0,o=d,i=0;i<b;++i)(v=e[i])<128&&E.push(O(v));for(r=a=E.length,a&&E.push(g);r<b;){for(s=u,i=0;i<b;++i)(v=e[i])>=t&&v<s&&(s=v);for(s-t>k((u-n)/(w=r+1))&&S("overflow"),n+=(s-t)*w,t=s,i=0;i<b;++i)if((v=e[i])<t&&++n>u&&S("overflow"),v==t){for(p=n,h=c;!(p<(y=h<=o?l:h>=o+f?f:h-o));h+=c)N=p-y,x=c-y,E.push(O(A(y+N%x,0))),p=k(N/x);E.push(O(A(p,0))),o=C(n,w,r==a),n=0,++r}++n,++t}return E.join("")}s={version:"1.4.1",ucs2:{decode:I,encode:T},decode:P,encode:_,toASCII:function(e){return E(e,function(e){return v.test(e)?"xn--"+_(e):e})},toUnicode:function(e){return E(e,function(e){return y.test(e)?P(e.slice(4).toLowerCase()):e})}},void 0===(a=function(){return s}.call(t,n,t,e))||(e.exports=a)}()}).call(this,n(63)(e),n(96))},function(e,t){},function(e,t,n){var r;!function(a,o){var i,s=this,u=256,c=6,l="random",f=o.pow(u,c),p=o.pow(2,52),h=2*p,d=u-1;function m(e,t,n){var r=[],m=y(function e(t,n){var r,a=[],o=typeof t;if(n&&"object"==o)for(r in t)try{a.push(e(t[r],n-1))}catch(e){}return a.length?a:"string"==o?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,v(a)]:null==e?function(){try{var e;return i&&(e=i.randomBytes)?e=e(u):(e=new Uint8Array(u),(s.crypto||s.msCrypto).getRandomValues(e)),v(e)}catch(e){var t=s.navigator,n=t&&t.plugins;return[+new Date,s,n,s.screen,v(a)]}}():e,3),r),b=new function(e){var t,n=e.length,r=this,a=0,o=r.i=r.j=0,i=r.S=[];for(n||(e=[n++]);a<u;)i[a]=a++;for(a=0;a<u;a++)i[a]=i[o=d&o+e[a%n]+(t=i[a])],i[o]=t;(r.g=function(e){for(var t,n=0,a=r.i,o=r.j,i=r.S;e--;)t=i[a=d&a+1],n=n*u+i[d&(i[a]=i[o=d&o+t])+(i[o]=t)];return r.i=a,r.j=o,n})(u)}(r),w=function(){for(var e=b.g(c),t=f,n=0;e<p;)e=(e+n)*u,t*=u,n=b.g(1);for(;e>=h;)e/=2,t/=2,n>>>=1;return(e+n)/t};return w.int32=function(){return 0|b.g(4)},w.quick=function(){return b.g(4)/4294967296},w.double=w,y(v(b.S),a),(t.pass||n||function(e,t,n,r){return r&&(r.S&&g(r,b),e.state=function(){return g(b,{})}),n?(o[l]=e,t):e})(w,m,"global"in t?t.global:this==o,t.state)}function g(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function y(e,t){for(var n,r=e+"",a=0;a<r.length;)t[d&a]=d&(n^=19*t[d&a])+r.charCodeAt(a++);return v(t)}function v(e){return String.fromCharCode.apply(0,e)}if(o["seed"+l]=m,y(o.random(),a),"object"==typeof e&&e.exports){e.exports=m;try{i=n(328)}catch(e){}}else void 0===(r=function(){return m}.call(t,n,t,e))||(e.exports=r)}([],Math)},function(e,t,n){(function(e){var r;!function(e,a,o){function i(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function s(e,t){var n=new function(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r<n.length+20;r++)t.b^=0|n.charCodeAt(r),t.next()}(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=s:n(30)&&n(79)?void 0===(r=function(){return s}.call(t,n,t,a))||(a.exports=r):this.tychei=s}(0,"object"==typeof e&&e,n(30))}).call(this,n(63)(e))},function(e,t,n){(function(e){var r;!function(e,a,o){function i(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var n=new function(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,o=t.i;return t.w=r=r+1640531527|0,n=a[o+34&127],e=a[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[o]=n^e,t.i=o,n+(r^r>>>16)|0},function(e,t){var n,r,a,o,i,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),a=0,o=-32;o<u;++o)t&&(r^=t.charCodeAt((o+32)%t.length)),0===o&&(i=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,o>=0&&(i=i+1640531527|0,a=0==(n=s[127&o]^=r+i)?a+1:0);for(a>=128&&(s[127&(t&&t.length||0)]=-1),a=127,o=512;o>0;--o)r=s[a+34&127],n=s[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[a]=r^n;e.w=i,e.X=s,e.i=a}(t,e)}(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&(r.X&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=s:n(30)&&n(79)?void 0===(r=function(){return s}.call(t,n,t,a))||(a.exports=r):this.xor4096=s}(0,"object"==typeof e&&e,n(30))}).call(this,n(63)(e))},function(e,t,n){(function(e){var r;!function(e,a,o){function i(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var n=new function(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n<t.length;++n)r[7&n]=r[7&n]<<15^t.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],e.x=r,e.i=0,n=256;n>0;--n)e.next()}(t,e)}(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&(r.x&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=s:n(30)&&n(79)?void 0===(r=function(){return s}.call(t,n,t,a))||(a.exports=r):this.xorshift7=s}(0,"object"==typeof e&&e,n(30))}).call(this,n(63)(e))},function(e,t,n){(function(e){var r;!function(e,a,o){function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var n=new function(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=s:n(30)&&n(79)?void 0===(r=function(){return s}.call(t,n,t,a))||(a.exports=r):this.xorwow=s}(0,"object"==typeof e&&e,n(30))}).call(this,n(63)(e))},function(e,t,n){(function(e){var r;!function(e,a,o){function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function s(e,t){var n=new function(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),t.next()}(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=s:n(30)&&n(79)?void 0===(r=function(){return s}.call(t,n,t,a))||(a.exports=r):this.xor128=s}(0,"object"==typeof e&&e,n(30))}).call(this,n(63)(e))},function(e,t,n){(function(e){var r;!function(e,a,o){function i(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var n=new function(e){var t,n=this,r=(t=4022871197,function(e){e=e.toString();for(var n=0;n<e.length;n++){var r=.02519603282416938*(t+=e.charCodeAt(n));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}(e),r=t&&t.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+1.1102230246251565e-16*(2097152*a()|0)},a.quick=a,r&&("object"==typeof r&&i(r,n),a.state=function(){return i(n,{})}),a}a&&a.exports?a.exports=s:n(30)&&n(79)?void 0===(r=function(){return s}.call(t,n,t,a))||(a.exports=r):this.alea=s}(0,"object"==typeof e&&e,n(30))}).call(this,n(63)(e))},function(e,t,n){var r=n(135),a=Math.max,o=Math.min;e.exports=function(e,t){return(e=r(e))<0?a(e+t,0):o(e,t)}},function(e,t,n){var r=n(80),a=n(136),o=n(336);e.exports=function(e){return function(t,n,i){var s,u=r(t),c=a(u.length),l=o(i,c);if(e&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){"use strict";var r=n(91),a=n(131),o=n(103),i=n(89),s=n(189),u=Object.assign;e.exports=!u||n(81)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=u({},e)[n]||Object.keys(u({},t)).join("")!=r})?function(e,t){for(var n=i(e),u=arguments.length,c=1,l=a.f,f=o.f;u>c;)for(var p,h=s(arguments[c++]),d=l?r(h).concat(l(h)):r(h),m=d.length,g=0;m>g;)f.call(h,p=d[g++])&&(n[p]=h[p]);return n}:u},function(e,t,n){var r=n(35);r(r.S+r.F,"Object",{assign:n(338)})},function(e,t,n){n(339),e.exports=n(21).Object.assign},function(e,t,n){e.exports={default:n(340),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r,a=(r=n(341))&&r.__esModule?r:{default:r};t.default=a.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";var r=m(n(342)),a=d(n(10)),o=m(n(308)),i=m(n(286)),s=m(n(274)),u=m(n(265)),c=m(n(262)),l=m(n(250)),f=d(n(98)),p=m(n(249)),h=m(n(248));function d(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function m(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,r.default)({imageClassifier:i.default,featureExtractor:s.default,pitchDetection:o.default,YOLO:c.default,word2vec:u.default,styleTransfer:p.default,poseNet:l.default,LSTMGenerator:h.default},f,{tf:a})},function(e,t){e.exports=function(e,t){var n=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,n)}}},function(e,t,n){var r=n(5),a=n(344)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(e){return a(e)}})},function(e,t,n){n(345),e.exports=n(48).RegExp.escape},function(e,t,n){(function(t){!function(t){"use strict";var n,r=Object.prototype,a=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"==typeof e,l=t.regeneratorRuntime;if(l)c&&(e.exports=l);else{(l=t.regeneratorRuntime=c?e.exports:{}).wrap=w;var f="suspendedStart",p="suspendedYield",h="executing",d="completed",m={},g={};g[i]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(P([])));v&&v!==r&&a.call(v,i)&&(g=v);var b=S.prototype=k.prototype=Object.create(g);O.prototype=b.constructor=S,S.constructor=O,S[u]=O.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===O||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(b),e},l.awrap=function(e){return{__await:e}},N(E.prototype),E.prototype[s]=function(){return this},l.AsyncIterator=E,l.async=function(e,t,n,r){var a=new E(w(e,t,n,r));return l.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},N(b),b[u]="Generator",b[i]=function(){return this},b.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=P,C.prototype={constructor:C,reset:function(e){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(A),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,a){return s.type="throw",s.arg=e,t.next=r,a&&(t.method="next",t.arg=n),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;A(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function w(e,t,n,r){var a=t&&t.prototype instanceof k?t:k,o=Object.create(a.prototype),i=new C(r||[]);return o._invoke=function(e,t,n){var r=f;return function(a,o){if(r===h)throw new Error("Generator is already running");if(r===d){if("throw"===a)throw o;return _()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=I(i,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=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var u=x(e,t,n);if("normal"===u.type){if(r=n.done?d:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=d,n.method="throw",n.arg=u.arg)}}}(e,n,i),o}function x(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function k(){}function O(){}function S(){}function N(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function E(e){function n(t,r,o,i){var s=x(e[t],e,r);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&a.call(c,"__await")?Promise.resolve(c.__await).then(function(e){n("next",e,o,i)},function(e){n("throw",e,o,i)}):Promise.resolve(c).then(function(e){u.value=e,o(u)},i)}i(s.arg)}var r;"object"==typeof t.process&&t.process.domain&&(n=t.process.domain.bind(n)),this._invoke=function(e,t){function a(){return new Promise(function(r,a){n(e,t,r,a)})}return r=r?r.then(a,a):a()}}function I(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,I(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var a=x(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,m;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,m):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function P(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(a.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return o.next=o}}return{next:_}}function _(){return{value:n,done:!0}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,n(96))},function(e,t,n){for(var r=n(145),a=n(73),o=n(27),i=n(13),s=n(28),u=n(84),c=n(16),l=c("iterator"),f=c("toStringTag"),p=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},d=a(h),m=0;m<d.length;m++){var g,y=d[m],v=h[y],b=i[y],w=b&&b.prototype;if(w&&(w[l]||s(w,l,p),w[f]||s(w,f,y),u[y]=p,v))for(g in r)w[g]||o(w,g,r[g],!0)}},function(e,t,n){var r=n(5),a=n(144);r(r.G+r.B,{setImmediate:a.set,clearImmediate:a.clear})},function(e,t,n){var r=n(13),a=n(5),o=n(140),i=[].slice,s=/MSIE .\./.test(o),u=function(e){return function(t,n){var r=arguments.length>2,a=!!r&&i.call(arguments,2);return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,a)}:t,n)}};a(a.G+a.B+a.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},function(e,t,n){"use strict";var r=n(5),a=n(13),o=n(48),i=n(143)(),s=n(16)("observable"),u=n(23),c=n(12),l=n(68),f=n(66),p=n(28),h=n(67),d=h.RETURN,m=function(e){return null==e?void 0:u(e)},g=function(e){var t=e._c;t&&(e._c=void 0,t())},y=function(e){return void 0===e._o},v=function(e){y(e)||(e._o=void 0,g(e))},b=function(e,t){c(e),this._c=void 0,this._o=e,e=new w(this);try{var n=t(e),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:u(n),this._c=n)}catch(t){return void e.error(t)}y(this)&&g(this)};b.prototype=f({},{unsubscribe:function(){v(this)}});var w=function(e){this._s=e};w.prototype=f({},{next:function(e){var t=this._s;if(!y(t)){var n=t._o;try{var r=m(n.next);if(r)return r.call(n,e)}catch(e){try{v(t)}finally{throw e}}}},error:function(e){var t=this._s;if(y(t))throw e;var n=t._o;t._o=void 0;try{var r=m(n.error);if(!r)throw e;e=r.call(n,e)}catch(e){try{g(t)}finally{throw e}}return g(t),e},complete:function(e){var t=this._s;if(!y(t)){var n=t._o;t._o=void 0;try{var r=m(n.complete);e=r?r.call(n,e):void 0}catch(e){try{g(t)}finally{throw e}}return g(t),e}}});var x=function(e){l(this,x,"Observable","_f")._f=u(e)};f(x.prototype,{subscribe:function(e){return new b(e,this._f)},forEach:function(e){var t=this;return new(o.Promise||a.Promise)(function(n,r){u(e);var a=t.subscribe({next:function(t){try{return e(t)}catch(e){r(e),a.unsubscribe()}},error:r,complete:n})})}}),f(x,{from:function(e){var t="function"==typeof this?this:x,n=m(c(e)[s]);if(n){var r=c(n.call(e));return r.constructor===t?r:new t(function(e){return r.subscribe(e)})}return new t(function(t){var n=!1;return i(function(){if(!n){try{if(h(e,!1,function(e){if(t.next(e),n)return d})===d)return}catch(e){if(n)throw e;return void t.error(e)}t.complete()}}),function(){n=!0}})},of:function(){for(var e=0,t=arguments.length,n=new Array(t);e<t;)n[e]=arguments[e++];return new("function"==typeof this?this:x)(function(e){var t=!1;return i(function(){if(!t){for(var r=0;r<n.length;++r)if(e.next(n[r]),t)return;e.complete()}}),function(){t=!0}})}}),p(x.prototype,s,function(){return this}),r(r.G,{Observable:x}),n(69)("Observable")},function(e,t,n){var r=n(5),a=n(143)(),o=n(13).process,i="process"==n(37)(o);r(r.G,{asap:function(e){var t=i&&o.domain;a(t?t.bind(e):e)}})},function(e,t,n){var r=n(50),a=n(12),o=n(23),i=r.key,s=r.set;r.exp({metadata:function(e,t){return function(n,r){s(e,t,(void 0!==r?a:o)(n),i(r))}}})},function(e,t,n){var r=n(50),a=n(12),o=r.has,i=r.key;r.exp({hasOwnMetadata:function(e,t){return o(e,a(t),arguments.length<3?void 0:i(arguments[2]))}})},function(e,t,n){var r=n(50),a=n(12),o=n(31),i=r.has,s=r.key,u=function(e,t,n){if(i(e,t,n))return!0;var r=o(t);return null!==r&&u(e,r,n)};r.exp({hasMetadata:function(e,t){return u(e,a(t),arguments.length<3?void 0:s(arguments[2]))}})},function(e,t,n){var r=n(50),a=n(12),o=r.keys,i=r.key;r.exp({getOwnMetadataKeys:function(e){return o(a(e),arguments.length<2?void 0:i(arguments[1]))}})},function(e,t,n){var r=n(50),a=n(12),o=r.get,i=r.key;r.exp({getOwnMetadata:function(e,t){return o(e,a(t),arguments.length<3?void 0:i(arguments[2]))}})},function(e,t,n){var r=n(202),a=n(193),o=n(50),i=n(12),s=n(31),u=o.keys,c=o.key,l=function(e,t){var n=u(e,t),o=s(e);if(null===o)return n;var i=l(o,t);return i.length?n.length?a(new r(n.concat(i))):i:n};o.exp({getMetadataKeys:function(e){return l(i(e),arguments.length<2?void 0:c(arguments[1]))}})},function(e,t,n){var r=n(50),a=n(12),o=n(31),i=r.has,s=r.get,u=r.key,c=function(e,t,n){if(i(e,t,n))return s(e,t,n);var r=o(t);return null!==r?c(e,r,n):void 0};r.exp({getMetadata:function(e,t){return c(e,a(t),arguments.length<3?void 0:u(arguments[2]))}})},function(e,t,n){var r=n(50),a=n(12),o=r.key,i=r.map,s=r.store;r.exp({deleteMetadata:function(e,t){var n=arguments.length<3?void 0:o(arguments[2]),r=i(a(t),n,!1);if(void 0===r||!r.delete(e))return!1;if(r.size)return!0;var u=s.get(t);return u.delete(n),!!u.size||s.delete(t)}})},function(e,t,n){var r=n(50),a=n(12),o=r.key,i=r.set;r.exp({defineMetadata:function(e,t,n,r){i(e,t,a(n),o(r))}})},function(e,t,n){"use strict";var r=n(5),a=n(142),o=n(206);r(r.S,"Promise",{try:function(e){var t=a.f(this),n=o(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){"use strict";var r=n(5),a=n(48),o=n(13),i=n(111),s=n(205);r(r.P+r.R,"Promise",{finally:function(e){var t=i(this,a.Promise||o.Promise),n="function"==typeof e;return this.then(n?function(n){return s(t,e()).then(function(){return n})}:e,n?function(n){return s(t,e()).then(function(){throw n})}:e)}})},function(e,t,n){var r=n(5);r(r.S,"Math",{signbit:function(e){return(e=+e)!=e?e:0==e?1/e==1/0:e>0}})},function(e,t,n){var r=n(5);r(r.S,"Math",{umulh:function(e,t){var n=+e,r=+t,a=65535&n,o=65535&r,i=n>>>16,s=r>>>16,u=(i*o>>>0)+(a*o>>>16);return i*s+(u>>>16)+((a*s>>>0)+(65535&u)>>>16)}})},function(e,t,n){var r=n(5);r(r.S,"Math",{scale:n(192)})},function(e,t,n){var r=n(5),a=Math.PI/180;r(r.S,"Math",{radians:function(e){return e*a}})},function(e,t,n){var r=n(5);r(r.S,"Math",{RAD_PER_DEG:180/Math.PI})},function(e,t,n){var r=n(5);r(r.S,"Math",{imulh:function(e,t){var n=+e,r=+t,a=65535&n,o=65535&r,i=n>>16,s=r>>16,u=(i*o>>>0)+(a*o>>>16);return i*s+(u>>16)+((a*s>>>0)+(65535&u)>>16)}})},function(e,t,n){var r=n(5);r(r.S,"Math",{isubh:function(e,t,n,r){var a=e>>>0,o=n>>>0;return(t>>>0)-(r>>>0)-((~a&o|~(a^o)&a-o>>>0)>>>31)|0}})},function(e,t,n){var r=n(5);r(r.S,"Math",{iaddh:function(e,t,n,r){var a=e>>>0,o=n>>>0;return(t>>>0)+(r>>>0)+((a&o|(a|o)&~(a+o>>>0))>>>31)|0}})},function(e,t,n){var r=n(5),a=n(192),o=n(212);r(r.S,"Math",{fscale:function(e,t,n,r,i){return o(a(e,t,n,r,i))}})},function(e,t,n){var r=n(5),a=180/Math.PI;r(r.S,"Math",{degrees:function(e){return e*a}})},function(e,t,n){var r=n(5);r(r.S,"Math",{DEG_PER_RAD:Math.PI/180})},function(e,t,n){var r=n(5);r(r.S,"Math",{clamp:function(e,t,n){return Math.min(n,Math.max(t,e))}})},function(e,t,n){var r=n(5),a=n(37);r(r.S,"Error",{isError:function(e){return"Error"===a(e)}})},function(e,t,n){var r=n(5);r(r.S,"System",{global:n(13)})},function(e,t,n){var r=n(5);r(r.G,{global:n(13)})},function(e,t,n){n(106)("WeakSet")},function(e,t,n){n(106)("WeakMap")},function(e,t,n){n(106)("Set")},function(e,t,n){n(106)("Map")},function(e,t,n){n(107)("WeakSet")},function(e,t,n){n(107)("WeakMap")},function(e,t,n){n(107)("Set")},function(e,t,n){n(107)("Map")},function(e,t,n){var r=n(5);r(r.P+r.R,"Set",{toJSON:n(194)("Set")})},function(e,t,n){var r=n(5);r(r.P+r.R,"Map",{toJSON:n(194)("Map")})},function(e,t,n){"use strict";var r=n(5),a=n(22),o=n(47),i=n(31),s=n(32).f;n(19)&&r(r.P+n(108),"Object",{__lookupSetter__:function(e){var t,n=a(this),r=o(e,!0);do{if(t=s(n,r))return t.set}while(n=i(n))}})},function(e,t,n){"use strict";var r=n(5),a=n(22),o=n(47),i=n(31),s=n(32).f;n(19)&&r(r.P+n(108),"Object",{__lookupGetter__:function(e){var t,n=a(this),r=o(e,!0);do{if(t=s(n,r))return t.get}while(n=i(n))}})},function(e,t,n){"use strict";var r=n(5),a=n(22),o=n(23),i=n(18);n(19)&&r(r.P+n(108),"Object",{__defineSetter__:function(e,t){i.f(a(this),e,{set:o(t),enumerable:!0,configurable:!0})}})},function(e,t,n){"use strict";var r=n(5),a=n(22),o=n(23),i=n(18);n(19)&&r(r.P+n(108),"Object",{__defineGetter__:function(e,t){i.f(a(this),e,{get:o(t),enumerable:!0,configurable:!0})}})},function(e,t,n){var r=n(5),a=n(195)(!0);r(r.S,"Object",{entries:function(e){return a(e)}})},function(e,t,n){var r=n(5),a=n(195)(!1);r(r.S,"Object",{values:function(e){return a(e)}})},function(e,t,n){var r=n(5),a=n(198),o=n(33),i=n(32),s=n(149);r(r.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n,r=o(e),u=i.f,c=a(r),l={},f=0;c.length>f;)void 0!==(n=u(r,t=c[f++]))&&s(l,t,n);return l}})},function(e,t,n){n(165)("observable")},function(e,t,n){n(165)("asyncIterator")},function(e,t,n){"use strict";var r=n(5),a=n(46),o=n(17),i=n(115),s=n(113),u=RegExp.prototype,c=function(e,t){this._r=e,this._s=t};n(153)(c,"RegExp String",function(){var e=this._r.exec(this._s);return{value:e,done:null===e}}),r(r.P,"String",{matchAll:function(e){if(a(this),!i(e))throw TypeError(e+" is not a regexp!");var t=String(this),n="flags"in u?String(e.flags):s.call(e),r=new RegExp(e.source,~n.indexOf("g")?n:"g"+n);return r.lastIndex=o(e.lastIndex),new c(r,t)}})},function(e,t,n){"use strict";n(85)("trimRight",function(e){return function(){return e(this,2)}},"trimEnd")},function(e,t,n){"use strict";n(85)("trimLeft",function(e){return function(){return e(this,1)}},"trimStart")},function(e,t,n){"use strict";var r=n(5),a=n(196),o=n(140);r(r.P+r.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(o),"String",{padEnd:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0,!1)}})},function(e,t,n){"use strict";var r=n(5),a=n(196),o=n(140);r(r.P+r.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(o),"String",{padStart:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},function(e,t,n){"use strict";var r=n(5),a=n(155)(!0);r(r.P,"String",{at:function(e){return a(this,e)}})},function(e,t,n){"use strict";var r=n(5),a=n(197),o=n(22),i=n(17),s=n(45),u=n(147);r(r.P,"Array",{flatten:function(){var e=arguments[0],t=o(this),n=i(t.length),r=u(t,0);return a(r,t,t,n,0,void 0===e?1:s(e)),r}}),n(56)("flatten")},function(e,t,n){"use strict";var r=n(5),a=n(197),o=n(22),i=n(17),s=n(23),u=n(147);r(r.P,"Array",{flatMap:function(e){var t,n,r=o(this);return s(e),t=i(r.length),n=u(r,0),a(n,r,r,t,0,1,e,arguments[1]),n}}),n(56)("flatMap")},function(e,t,n){"use strict";var r=n(5),a=n(118)(!0);r(r.P,"Array",{includes:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),n(56)("includes")},function(e,t,n){var r=n(5),a=n(161);a&&r(r.S,"Reflect",{setPrototypeOf:function(e,t){a.check(e,t);try{return a.set(e,t),!0}catch(e){return!1}}})},function(e,t,n){var r=n(18),a=n(32),o=n(31),i=n(29),s=n(5),u=n(76),c=n(12),l=n(15);s(s.S,"Reflect",{set:function e(t,n,s){var f,p,h=arguments.length<4?t:arguments[3],d=a.f(c(t),n);if(!d){if(l(p=o(t)))return e(p,n,s,h);d=u(0)}return i(d,"value")?!(!1===d.writable||!l(h)||((f=a.f(h,n)||u(0)).value=s,r.f(h,n,f),0)):void 0!==d.set&&(d.set.call(h,s),!0)}})},function(e,t,n){var r=n(5),a=n(12),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(e){a(e);try{return o&&o(e),!0}catch(e){return!1}}})},function(e,t,n){var r=n(5);r(r.S,"Reflect",{ownKeys:n(198)})},function(e,t,n){var r=n(5),a=n(12),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(e){return a(e),!o||o(e)}})},function(e,t,n){var r=n(5);r(r.S,"Reflect",{has:function(e,t){return t in e}})},function(e,t,n){var r=n(5),a=n(31),o=n(12);r(r.S,"Reflect",{getPrototypeOf:function(e){return a(o(e))}})},function(e,t,n){var r=n(32),a=n(5),o=n(12);a(a.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return r.f(o(e),t)}})},function(e,t,n){var r=n(32),a=n(31),o=n(29),i=n(5),s=n(15),u=n(12);i(i.S,"Reflect",{get:function e(t,n){var i,c,l=arguments.length<3?t:arguments[2];return u(t)===l?t[n]:(i=r.f(t,n))?o(i,"value")?i.value:void 0!==i.get?i.get.call(l):void 0:s(c=a(t))?e(c,n,l):void 0}})},function(e,t,n){"use strict";var r=n(5),a=n(12),o=function(e){this._t=a(e),this._i=0;var t,n=this._k=[];for(t in e)n.push(t)};n(153)(o,"Object",function(){var e,t=this._k;do{if(this._i>=t.length)return{value:void 0,done:!0}}while(!((e=t[this._i++])in this._t));return{value:e,done:!1}}),r(r.S,"Reflect",{enumerate:function(e){return new o(e)}})},function(e,t,n){var r=n(5),a=n(32).f,o=n(12);r(r.S,"Reflect",{deleteProperty:function(e,t){var n=a(o(e),t);return!(n&&!n.configurable)&&delete e[t]}})},function(e,t,n){var r=n(18),a=n(5),o=n(12),i=n(47);a(a.S+a.F*n(14)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(e,t,n){o(e),t=i(t,!0),o(n);try{return r.f(e,t,n),!0}catch(e){return!1}}})},function(e,t,n){var r=n(5),a=n(71),o=n(23),i=n(12),s=n(15),u=n(14),c=n(219),l=(n(13).Reflect||{}).construct,f=u(function(){function e(){}return!(l(function(){},[],e)instanceof e)}),p=!u(function(){l(function(){})});r(r.S+r.F*(f||p),"Reflect",{construct:function(e,t){o(e),i(t);var n=arguments.length<3?e:o(arguments[2]);if(p&&!f)return l(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return r.push.apply(r,t),new(c.apply(e,r))}var u=n.prototype,h=a(s(u)?u:Object.prototype),d=Function.apply.call(e,h,t);return s(d)?d:h}})},function(e,t,n){var r=n(5),a=n(23),o=n(12),i=(n(13).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(14)(function(){i(function(){})}),"Reflect",{apply:function(e,t,n){var r=a(e),u=o(n);return i?i(r,t,u):s.call(r,t,u)}})},function(e,t,n){n(51)("Float64",8,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Float32",4,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Uint32",4,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Int32",4,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Uint16",2,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Int16",2,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Uint8",1,function(e){return function(t,n,r){return e(this,t,n,r)}},!0)},function(e,t,n){n(51)("Uint8",1,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){n(51)("Int8",1,function(e){return function(t,n,r){return e(this,t,n,r)}})},function(e,t,n){var r=n(5);r(r.G+r.W+r.F*!n(109).ABV,{DataView:n(141).DataView})},function(e,t,n){"use strict";var r=n(5),a=n(109),o=n(141),i=n(12),s=n(72),u=n(17),c=n(15),l=n(13).ArrayBuffer,f=n(111),p=o.ArrayBuffer,h=o.DataView,d=a.ABV&&l.isView,m=p.prototype.slice,g=a.VIEW;r(r.G+r.W+r.F*(l!==p),{ArrayBuffer:p}),r(r.S+r.F*!a.CONSTR,"ArrayBuffer",{isView:function(e){return d&&d(e)||c(e)&&g in e}}),r(r.P+r.U+r.F*n(14)(function(){return!new p(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(e,t){if(void 0!==m&&void 0===t)return m.call(i(this),e);for(var n=i(this).byteLength,r=s(e,n),a=s(void 0===t?n:t,n),o=new(f(this,p))(u(a-r)),c=new h(this),l=new h(o),d=0;r<a;)l.setUint8(d++,c.getUint8(r++));return o}}),n(69)("ArrayBuffer")},function(e,t,n){"use strict";var r=n(200),a=n(83);n(110)("WeakSet",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(a(this,"WeakSet"),e,!0)}},r,!1,!0)},function(e,t,n){"use strict";var r,a,o,i,s=n(74),u=n(13),c=n(38),l=n(93),f=n(5),p=n(15),h=n(23),d=n(68),m=n(67),g=n(111),y=n(144).set,v=n(143)(),b=n(142),w=n(206),x=n(205),k=u.TypeError,O=u.process,S=u.Promise,N="process"==l(O),E=function(){},I=a=b.f,T=!!function(){try{var e=S.resolve(1),t=(e.constructor={})[n(16)("species")]=function(e){e(E,E)};return(N||"function"==typeof PromiseRejectionEvent)&&e.then(E)instanceof t}catch(e){}}(),A=function(e){var t;return!(!p(e)||"function"!=typeof(t=e.then))&&t},C=function(e,t){if(!e._n){e._n=!0;var n=e._c;v(function(){for(var r=e._v,a=1==e._s,o=0,i=function(t){var n,o,i=a?t.ok:t.fail,s=t.resolve,u=t.reject,c=t.domain;try{i?(a||(2==e._h&&R(e),e._h=1),!0===i?n=r:(c&&c.enter(),n=i(r),c&&c.exit()),n===t.promise?u(k("Promise-chain cycle")):(o=A(n))?o.call(n,s,u):s(n)):u(r)}catch(e){u(e)}};n.length>o;)i(n[o++]);e._c=[],e._n=!1,t&&!e._h&&P(e)})}},P=function(e){y.call(u,function(){var t,n,r,a=e._v,o=_(e);if(o&&(t=w(function(){N?O.emit("unhandledRejection",a,e):(n=u.onunhandledrejection)?n({promise:e,reason:a}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",a)}),e._h=N||_(e)?2:1),e._a=void 0,o&&t.e)throw t.v})},_=function(e){return 1!==e._h&&0===(e._a||e._c).length},R=function(e){y.call(u,function(){var t;N?O.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},M=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),C(t,!0))},j=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw k("Promise can't be resolved itself");(t=A(e))?v(function(){var r={_w:n,_d:!1};try{t.call(e,c(j,r,1),c(M,r,1))}catch(e){M.call(r,e)}}):(n._v=e,n._s=1,C(n,!1))}catch(e){M.call({_w:n,_d:!1},e)}}};T||(S=function(e){d(this,S,"Promise","_h"),h(e),r.call(this);try{e(c(j,this,1),c(M,this,1))}catch(e){M.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(66)(S.prototype,{then:function(e,t){var n=I(g(this,S));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=N?O.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&C(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new r;this.promise=e,this.resolve=c(j,e,1),this.reject=c(M,e,1)},b.f=I=function(e){return e===S||e===i?new o(e):a(e)}),f(f.G+f.W+f.F*!T,{Promise:S}),n(86)(S,"Promise"),n(69)("Promise"),i=n(48).Promise,f(f.S+f.F*!T,"Promise",{reject:function(e){var t=I(this);return(0,t.reject)(e),t.promise}}),f(f.S+f.F*(s||!T),"Promise",{resolve:function(e){return x(s&&this===i?S:this,e)}}),f(f.S+f.F*!(T&&n(114)(function(e){S.all(e).catch(E)})),"Promise",{all:function(e){var t=this,n=I(t),r=n.resolve,a=n.reject,o=w(function(){var n=[],o=0,i=1;m(e,!1,function(e){var s=o++,u=!1;n.push(void 0),i++,t.resolve(e).then(function(e){u||(u=!0,n[s]=e,--i||r(n))},a)}),--i||r(n)});return o.e&&a(o.v),n.promise},race:function(e){var t=this,n=I(t),r=n.reject,a=w(function(){m(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return a.e&&r(a.v),n.promise}})},function(e,t,n){n(112)("split",2,function(e,t,r){"use strict";var a=n(115),o=r,i=[].push;if("c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length){var s=void 0===/()??/.exec("")[1];r=function(e,t){var n=String(this);if(void 0===e&&0===t)return[];if(!a(e))return o.call(n,e,t);var r,u,c,l,f,p=[],h=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,m=void 0===t?4294967295:t>>>0,g=new RegExp(e.source,h+"g");for(s||(r=new RegExp("^"+g.source+"$(?!\\s)",h));(u=g.exec(n))&&!((c=u.index+u[0].length)>d&&(p.push(n.slice(d,u.index)),!s&&u.length>1&&u[0].replace(r,function(){for(f=1;f<arguments.length-2;f++)void 0===arguments[f]&&(u[f]=void 0)}),u.length>1&&u.index<n.length&&i.apply(p,u.slice(1)),l=u[0].length,d=c,p.length>=m));)g.lastIndex===u.index&&g.lastIndex++;return d===n.length?!l&&g.test("")||p.push(""):p.push(n.slice(d)),p.length>m?p.slice(0,m):p}}else"0".split(void 0,0).length&&(r=function(e,t){return void 0===e&&0===t?[]:o.call(this,e,t)});return[function(n,a){var o=e(this),i=void 0==n?void 0:n[t];return void 0!==i?i.call(n,o,a):r.call(String(o),n,a)},r]})},function(e,t,n){n(112)("search",1,function(e,t,n){return[function(n){"use strict";var r=e(this),a=void 0==n?void 0:n[t];return void 0!==a?a.call(n,r):new RegExp(n)[t](String(r))},n]})},function(e,t,n){n(112)("replace",2,function(e,t,n){return[function(r,a){"use strict";var o=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,o,a):n.call(String(o),r,a)},n]})},function(e,t,n){n(112)("match",1,function(e,t,n){return[function(n){"use strict";var r=e(this),a=void 0==n?void 0:n[t];return void 0!==a?a.call(n,r):new RegExp(n)[t](String(r))},n]})},function(e,t,n){"use strict";n(207);var r=n(12),a=n(113),o=n(19),i=/./.toString,s=function(e){n(27)(RegExp.prototype,"toString",e,!0)};n(14)(function(){return"/a/b"!=i.call({source:"a",flags:"b"})})?s(function(){var e=r(this);return"/".concat(e.source,"/","flags"in e?e.flags:!o&&e instanceof RegExp?a.call(e):void 0)}):"toString"!=i.name&&s(function(){return i.call(this)})},function(e,t,n){var r=n(13),a=n(159),o=n(18).f,i=n(70).f,s=n(115),u=n(113),c=r.RegExp,l=c,f=c.prototype,p=/a/g,h=/a/g,d=new c(p)!==p;if(n(19)&&(!d||n(14)(function(){return h[n(16)("match")]=!1,c(p)!=p||c(h)==h||"/a/i"!=c(p,"i")}))){c=function(e,t){var n=this instanceof c,r=s(e),o=void 0===t;return!n&&r&&e.constructor===c&&o?e:a(d?new l(r&&!o?e.source:e,t):l((r=e instanceof c)?e.source:e,r&&o?u.call(e):t),n?this:f,c)};for(var m=function(e){e in c||o(c,e,{configurable:!0,get:function(){return l[e]},set:function(t){l[e]=t}})},g=i(l),y=0;g.length>y;)m(g[y++]);f.constructor=c,c.prototype=f,n(27)(r,"RegExp",c)}n(69)("RegExp")},function(e,t,n){n(69)("Array")},function(e,t,n){"use strict";var r=n(5),a=n(43)(6),o="findIndex",i=!0;o in[]&&Array(1)[o](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),n(56)(o)},function(e,t,n){"use strict";var r=n(5),a=n(43)(5),o=!0;"find"in[]&&Array(1).find(function(){o=!1}),r(r.P+r.F*o,"Array",{find:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),n(56)("find")},function(e,t,n){var r=n(5);r(r.P,"Array",{fill:n(146)}),n(56)("fill")},function(e,t,n){var r=n(5);r(r.P,"Array",{copyWithin:n(209)}),n(56)("copyWithin")},function(e,t,n){"use strict";var r=n(5),a=n(33),o=n(45),i=n(17),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(36)(s)),"Array",{lastIndexOf:function(e){if(u)return s.apply(this,arguments)||0;var t=a(this),n=i(t.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 t&&t[r]===e)return r||0;return-1}})},function(e,t,n){"use strict";var r=n(5),a=n(118)(!1),o=[].indexOf,i=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(i||!n(36)(o)),"Array",{indexOf:function(e){return i?o.apply(this,arguments)||0:a(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(5),a=n(210);r(r.P+r.F*!n(36)([].reduceRight,!0),"Array",{reduceRight:function(e){return a(this,e,arguments.length,arguments[1],!0)}})},function(e,t,n){"use strict";var r=n(5),a=n(210);r(r.P+r.F*!n(36)([].reduce,!0),"Array",{reduce:function(e){return a(this,e,arguments.length,arguments[1],!1)}})},function(e,t,n){"use strict";var r=n(5),a=n(43)(4);r(r.P+r.F*!n(36)([].every,!0),"Array",{every:function(e){return a(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(5),a=n(43)(3);r(r.P+r.F*!n(36)([].some,!0),"Array",{some:function(e){return a(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(5),a=n(43)(2);r(r.P+r.F*!n(36)([].filter,!0),"Array",{filter:function(e){return a(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(5),a=n(43)(1);r(r.P+r.F*!n(36)([].map,!0),"Array",{map:function(e){return a(this,e,arguments[1])}})},function(e,t,n){var r=n(15),a=n(116),o=n(16)("species");e.exports=function(e){var t;return a(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!a(t.prototype)||(t=void 0),r(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){"use strict";var r=n(5),a=n(43)(0),o=n(36)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(e){return a(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(5),a=n(23),o=n(22),i=n(14),s=[].sort,u=[1,2,3];r(r.P+r.F*(i(function(){u.sort(void 0)})||!i(function(){u.sort(null)})||!n(36)(s)),"Array",{sort:function(e){return void 0===e?s.call(o(this)):s.call(o(this),a(e))}})},function(e,t,n){"use strict";var r=n(5),a=n(162),o=n(37),i=n(72),s=n(17),u=[].slice;r(r.P+r.F*n(14)(function(){a&&u.call(a)}),"Array",{slice:function(e,t){var n=s(this.length),r=o(this);if(t=void 0===t?n:t,"Array"==r)return u.call(this,e,t);for(var a=i(e,n),c=i(t,n),l=s(c-a),f=new Array(l),p=0;p<l;p++)f[p]="String"==r?this.charAt(a+p):this[a+p];return f}})},function(e,t,n){"use strict";var r=n(5),a=n(33),o=[].join;r(r.P+r.F*(n(95)!=Object||!n(36)(o)),"Array",{join:function(e){return o.call(a(this),void 0===e?",":e)}})},function(e,t,n){"use strict";var r=n(5),a=n(149);r(r.S+r.F*n(14)(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)a(n,e,arguments[e++]);return n.length=t,n}})},function(e,t,n){"use strict";var r=n(38),a=n(5),o=n(22),i=n(211),s=n(150),u=n(17),c=n(149),l=n(148);a(a.S+a.F*!n(114)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,a,f,p=o(e),h="function"==typeof this?this:Array,d=arguments.length,m=d>1?arguments[1]:void 0,g=void 0!==m,y=0,v=l(p);if(g&&(m=r(m,d>2?arguments[2]:void 0,2)),void 0==v||h==Array&&s(v))for(n=new h(t=u(p.length));t>y;y++)c(n,y,g?m(p[y],y):p[y]);else for(f=v.call(p),n=new h;!(a=f.next()).done;y++)c(n,y,g?i(f,m,[a.value,y],!0):a.value);return n.length=y,n}})},function(e,t,n){var r=n(5);r(r.S,"Array",{isArray:n(116)})},function(e,t,n){"use strict";var r=n(12),a=n(47);e.exports=function(e){if("string"!==e&&"number"!==e&&"default"!==e)throw TypeError("Incorrect hint");return a(r(this),"number"!=e)}},function(e,t,n){var r=n(16)("toPrimitive"),a=Date.prototype;r in a||n(28)(a,r,n(461))},function(e,t,n){var r=Date.prototype,a=r.toString,o=r.getTime;new Date(NaN)+""!="Invalid Date"&&n(27)(r,"toString",function(){var e=o.call(this);return e==e?a.call(this):"Invalid Date"})},function(e,t,n){"use strict";var r=n(14),a=Date.prototype.getTime,o=Date.prototype.toISOString,i=function(e){return e>9?e:"0"+e};e.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(a.call(this)))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),r=t<0?"-":t>9999?"+":"";return r+("00000"+Math.abs(t)).slice(r?-6:-4)+"-"+i(e.getUTCMonth()+1)+"-"+i(e.getUTCDate())+"T"+i(e.getUTCHours())+":"+i(e.getUTCMinutes())+":"+i(e.getUTCSeconds())+"."+(n>99?n:"0"+i(n))+"Z"}:o},function(e,t,n){var r=n(5),a=n(464);r(r.P+r.F*(Date.prototype.toISOString!==a),"Date",{toISOString:a})},function(e,t,n){"use strict";var r=n(5),a=n(22),o=n(47);r(r.P+r.F*n(14)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(e){var t=a(this),n=o(t);return"number"!=typeof n||isFinite(n)?t.toISOString():null}})},function(e,t,n){var r=n(5);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(e,t,n){"use strict";n(26)("sup",function(e){return function(){return e(this,"sup","","")}})},function(e,t,n){"use strict";n(26)("sub",function(e){return function(){return e(this,"sub","","")}})},function(e,t,n){"use strict";n(26)("strike",function(e){return function(){return e(this,"strike","","")}})},function(e,t,n){"use strict";n(26)("small",function(e){return function(){return e(this,"small","","")}})},function(e,t,n){"use strict";n(26)("link",function(e){return function(t){return e(this,"a","href",t)}})},function(e,t,n){"use strict";n(26)("italics",function(e){return function(){return e(this,"i","","")}})},function(e,t,n){"use strict";n(26)("fontsize",function(e){return function(t){return e(this,"font","size",t)}})},function(e,t,n){"use strict";n(26)("fontcolor",function(e){return function(t){return e(this,"font","color",t)}})},function(e,t,n){"use strict";n(26)("fixed",function(e){return function(){return e(this,"tt","","")}})},function(e,t,n){"use strict";n(26)("bold",function(e){return function(){return e(this,"b","","")}})},function(e,t,n){"use strict";n(26)("blink",function(e){return function(){return e(this,"blink","","")}})},function(e,t,n){"use strict";n(26)("big",function(e){return function(){return e(this,"big","","")}})},function(e,t,n){"use strict";n(26)("anchor",function(e){return function(t){return e(this,"a","name",t)}})},function(e,t,n){"use strict";var r=n(5),a=n(17),o=n(152),i="".startsWith;r(r.P+r.F*n(151)("startsWith"),"String",{startsWith:function(e){var t=o(this,e,"startsWith"),n=a(Math.min(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return i?i.call(t,r,n):t.slice(n,n+r.length)===r}})},function(e,t,n){var r=n(5);r(r.P,"String",{repeat:n(158)})},function(e,t,n){"use strict";var r=n(5),a=n(152);r(r.P+r.F*n(151)("includes"),"String",{includes:function(e){return!!~a(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(5),a=n(17),o=n(152),i="".endsWith;r(r.P+r.F*n(151)("endsWith"),"String",{endsWith:function(e){var t=o(this,e,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=a(t.length),s=void 0===n?r:Math.min(a(n),r),u=String(e);return i?i.call(t,u,s):t.slice(s-u.length,s)===u}})},function(e,t,n){"use strict";var r=n(5),a=n(155)(!1);r(r.P,"String",{codePointAt:function(e){return a(this,e)}})},function(e,t,n){"use strict";var r=n(155)(!0);n(154)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";n(85)("trim",function(e){return function(){return e(this,3)}})},function(e,t,n){var r=n(5),a=n(33),o=n(17);r(r.S,"String",{raw:function(e){for(var t=a(e.raw),n=o(t.length),r=arguments.length,i=[],s=0;n>s;)i.push(String(t[s++])),s<r&&i.push(String(arguments[s]));return i.join("")}})},function(e,t,n){var r=n(5),a=n(72),o=String.fromCharCode,i=String.fromCodePoint;r(r.S+r.F*(!!i&&1!=i.length),"String",{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,i=0;r>i;){if(t=+arguments[i++],a(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?o(t):o(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){var r=n(5);r(r.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},function(e,t,n){var r=n(5),a=n(156),o=Math.exp;r(r.S,"Math",{tanh:function(e){var t=a(e=+e),n=a(-e);return t==1/0?1:n==1/0?-1:(t-n)/(o(e)+o(-e))}})},function(e,t,n){var r=n(5),a=n(156),o=Math.exp;r(r.S+r.F*n(14)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(a(e)-a(-e))/2:(o(e-1)-o(-e-1))*(Math.E/2)}})},function(e,t,n){var r=n(5);r(r.S,"Math",{sign:n(157)})},function(e,t,n){var r=n(5);r(r.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},function(e,t,n){var r=n(5);r(r.S,"Math",{log1p:n(213)})},function(e,t,n){var r=n(5);r(r.S,"Math",{log10:function(e){return Math.log(e)*Math.LOG10E}})},function(e,t,n){var r=n(5),a=Math.imul;r(r.S+r.F*n(14)(function(){return-5!=a(4294967295,5)||2!=a.length}),"Math",{imul:function(e,t){var n=+e,r=+t,a=65535&n,o=65535&r;return 0|a*o+((65535&n>>>16)*o+a*(65535&r>>>16)<<16>>>0)}})},function(e,t,n){var r=n(5),a=Math.abs;r(r.S,"Math",{hypot:function(e,t){for(var n,r,o=0,i=0,s=arguments.length,u=0;i<s;)u<(n=a(arguments[i++]))?(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(e,t,n){var r=n(5);r(r.S,"Math",{fround:n(212)})},function(e,t,n){var r=n(5),a=n(156);r(r.S+r.F*(a!=Math.expm1),"Math",{expm1:a})},function(e,t,n){var r=n(5),a=Math.exp;r(r.S,"Math",{cosh:function(e){return(a(e=+e)+a(-e))/2}})},function(e,t,n){var r=n(5);r(r.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},function(e,t,n){var r=n(5),a=n(157);r(r.S,"Math",{cbrt:function(e){return a(e=+e)*Math.pow(Math.abs(e),1/3)}})},function(e,t,n){var r=n(5),a=Math.atanh;r(r.S+r.F*!(a&&1/a(-0)<0),"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},function(e,t,n){var r=n(5),a=Math.asinh;r(r.S+r.F*!(a&&1/a(0)>0),"Math",{asinh:function e(t){return isFinite(t=+t)&&0!=t?t<0?-e(-t):Math.log(t+Math.sqrt(t*t+1)):t}})},function(e,t,n){var r=n(5),a=n(213),o=Math.sqrt,i=Math.acosh;r(r.S+r.F*!(i&&710==Math.floor(i(Number.MAX_VALUE))&&i(1/0)==1/0),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:a(e-1+o(e-1)*o(e+1))}})},function(e,t,n){var r=n(5),a=n(217);r(r.S+r.F*(Number.parseInt!=a),"Number",{parseInt:a})},function(e,t,n){var r=n(5),a=n(216);r(r.S+r.F*(Number.parseFloat!=a),"Number",{parseFloat:a})},function(e,t,n){var r=n(5);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(e,t,n){var r=n(5);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(e,t,n){var r=n(5),a=n(214),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(e){return a(e)&&o(e)<=9007199254740991}})},function(e,t,n){var r=n(5);r(r.S,"Number",{isNaN:function(e){return e!=e}})},function(e,t,n){var r=n(5);r(r.S,"Number",{isInteger:n(214)})},function(e,t,n){var r=n(5),a=n(13).isFinite;r(r.S,"Number",{isFinite:function(e){return"number"==typeof e&&a(e)}})},function(e,t,n){var r=n(5);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(e,t,n){"use strict";var r=n(5),a=n(14),o=n(215),i=1..toPrecision;r(r.P+r.F*(a(function(){return"1"!==i.call(1,void 0)})||!a(function(){i.call({})})),"Number",{toPrecision:function(e){var t=o(this,"Number#toPrecision: incorrect invocation!");return void 0===e?i.call(t):i.call(t,e)}})},function(e,t,n){"use strict";var r=n(5),a=n(45),o=n(215),i=n(158),s=1..toFixed,u=Math.floor,c=[0,0,0,0,0,0],l="Number.toFixed: incorrect invocation!",f=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*c[n],c[n]=r%1e7,r=u(r/1e7)},p=function(e){for(var t=6,n=0;--t>=0;)n+=c[t],c[t]=u(n/e),n=n%e*1e7},h=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==c[e]){var n=String(c[e]);t=""===t?n:t+i.call("0",7-n.length)+n}return t},d=function(e,t,n){return 0===t?n:t%2==1?d(e,t-1,n*e):d(e*e,t/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(14)(function(){s.call({})})),"Number",{toFixed:function(e){var t,n,r,s,u=o(this,l),c=a(e),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=(t=function(e){for(var t=0,n=u*d(2,69,1);n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}()-69)<0?u*d(2,-t,1):u/d(2,t,1),n*=4503599627370496,(t=52-t)>0){for(f(0,n),r=c;r>=7;)f(1e7,0),r-=7;for(f(d(10,r,1),0),r=t-1;r>=23;)p(1<<23),r-=23;p(1<<r),f(1,1),p(2),g=h()}else f(0,n),f(1<<-t,0),g=h()+i.call("0",c);return c>0?m+((s=g.length)<=c?"0."+i.call("0",c-s)+g:g.slice(0,s-c)+"."+g.slice(s-c)):m+g}})},function(e,t,n){"use strict";var r=n(13),a=n(29),o=n(37),i=n(159),s=n(47),u=n(14),c=n(70).f,l=n(32).f,f=n(18).f,p=n(85).trim,h=r.Number,d=h,m=h.prototype,g="Number"==o(n(71)(m)),y="trim"in String.prototype,v=function(e){var t=s(e,!1);if("string"==typeof t&&t.length>2){var n,r,a,o=(t=y?t.trim():p(t,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=t.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(t.charCodeAt(1)){case 66:case 98:r=2,a=49;break;case 79:case 111:r=8,a=55;break;default:return+t}for(var i,u=t.slice(2),c=0,l=u.length;c<l;c++)if((i=u.charCodeAt(c))<48||i>a)return NaN;return parseInt(u,r)}}return+t};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof h&&(g?u(function(){m.valueOf.call(n)}):"Number"!=o(n))?i(new d(v(t)),n,h):v(t)};for(var b,w=n(19)?c(d):"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++)a(d,b=w[x])&&!a(h,b)&&f(h,b,l(d,b));h.prototype=m,m.constructor=h,n(27)(r,"Number",h)}},function(e,t,n){var r=n(5),a=n(216);r(r.G+r.F*(parseFloat!=a),{parseFloat:a})},function(e,t,n){var r=n(5),a=n(217);r(r.G+r.F*(parseInt!=a),{parseInt:a})},function(e,t,n){"use strict";var r=n(15),a=n(31),o=n(16)("hasInstance"),i=Function.prototype;o in i||n(18).f(i,o,{value:function(e){if("function"!=typeof this||!r(e))return!1;if(!r(this.prototype))return e instanceof this;for(;e=a(e);)if(this.prototype===e)return!0;return!1}})},function(e,t,n){var r=n(18).f,a=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in a||n(19)&&r(a,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(e){return""}}})},function(e,t,n){var r=n(5);r(r.P,"Function",{bind:n(219)})},function(e,t,n){"use strict";var r=n(93),a={};a[n(16)("toStringTag")]="z",a+""!="[object z]"&&n(27)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(e,t,n){var r=n(5);r(r.S,"Object",{setPrototypeOf:n(161).set})},function(e,t){e.exports=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}},function(e,t,n){var r=n(5);r(r.S,"Object",{is:n(526)})},function(e,t,n){var r=n(5);r(r.S+r.F,"Object",{assign:n(220)})},function(e,t,n){var r=n(15);n(44)("isExtensible",function(e){return function(t){return!!r(t)&&(!e||e(t))}})},function(e,t,n){var r=n(15);n(44)("isSealed",function(e){return function(t){return!r(t)||!!e&&e(t)}})},function(e,t,n){var r=n(15);n(44)("isFrozen",function(e){return function(t){return!r(t)||!!e&&e(t)}})},function(e,t,n){var r=n(15),a=n(57).onFreeze;n(44)("preventExtensions",function(e){return function(t){return e&&r(t)?e(a(t)):t}})},function(e,t,n){var r=n(15),a=n(57).onFreeze;n(44)("seal",function(e){return function(t){return e&&r(t)?e(a(t)):t}})},function(e,t,n){var r=n(15),a=n(57).onFreeze;n(44)("freeze",function(e){return function(t){return e&&r(t)?e(a(t)):t}})},function(e,t,n){n(44)("getOwnPropertyNames",function(){return n(221).f})},function(e,t,n){var r=n(22),a=n(73);n(44)("keys",function(){return function(e){return a(r(e))}})},function(e,t,n){var r=n(22),a=n(31);n(44)("getPrototypeOf",function(){return function(e){return a(r(e))}})},function(e,t,n){var r=n(33),a=n(32).f;n(44)("getOwnPropertyDescriptor",function(){return function(e,t){return a(r(e),t)}})},function(e,t,n){var r=n(5);r(r.S+r.F*!n(19),"Object",{defineProperties:n(222)})},function(e,t,n){var r=n(5);r(r.S+r.F*!n(19),"Object",{defineProperty:n(18).f})},function(e,t,n){var r=n(5);r(r.S,"Object",{create:n(71)})},function(e,t,n){var r=n(73),a=n(117),o=n(94);e.exports=function(e){var t=r(e),n=a.f;if(n)for(var i,s=n(e),u=o.f,c=0;s.length>c;)u.call(e,i=s[c++])&&t.push(i);return t}},function(e,t,n){"use strict";var r=n(13),a=n(29),o=n(19),i=n(5),s=n(27),u=n(57).KEY,c=n(14),l=n(119),f=n(86),p=n(75),h=n(16),d=n(224),m=n(165),g=n(542),y=n(116),v=n(12),b=n(15),w=n(33),x=n(47),k=n(76),O=n(71),S=n(221),N=n(32),E=n(18),I=n(73),T=N.f,A=E.f,C=S.f,P=r.Symbol,_=r.JSON,R=_&&_.stringify,M=h("_hidden"),j=h("toPrimitive"),D={}.propertyIsEnumerable,L=l("symbol-registry"),z=l("symbols"),F=l("op-symbols"),B=Object.prototype,V="function"==typeof P,U=r.QObject,W=!U||!U.prototype||!U.prototype.findChild,G=o&&c(function(){return 7!=O(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=T(B,t);r&&delete B[t],A(e,t,n),r&&e!==B&&A(B,t,r)}:A,q=function(e){var t=z[e]=O(P.prototype);return t._k=e,t},H=V&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},K=function(e,t,n){return e===B&&K(F,t,n),v(e),t=x(t,!0),v(n),a(z,t)?(n.enumerable?(a(e,M)&&e[M][t]&&(e[M][t]=!1),n=O(n,{enumerable:k(0,!1)})):(a(e,M)||A(e,M,k(1,{})),e[M][t]=!0),G(e,t,n)):A(e,t,n)},X=function(e,t){v(e);for(var n,r=g(t=w(t)),a=0,o=r.length;o>a;)K(e,n=r[a++],t[n]);return e},J=function(e){var t=D.call(this,e=x(e,!0));return!(this===B&&a(z,e)&&!a(F,e))&&(!(t||!a(this,e)||!a(z,e)||a(this,M)&&this[M][e])||t)},Y=function(e,t){if(e=w(e),t=x(t,!0),e!==B||!a(z,t)||a(F,t)){var n=T(e,t);return!n||!a(z,t)||a(e,M)&&e[M][t]||(n.enumerable=!0),n}},Q=function(e){for(var t,n=C(w(e)),r=[],o=0;n.length>o;)a(z,t=n[o++])||t==M||t==u||r.push(t);return r},Z=function(e){for(var t,n=e===B,r=C(n?F:w(e)),o=[],i=0;r.length>i;)!a(z,t=r[i++])||n&&!a(B,t)||o.push(z[t]);return o};V||(s((P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(n){this===B&&t.call(F,n),a(this,M)&&a(this[M],e)&&(this[M][e]=!1),G(this,e,k(1,n))};return o&&W&&G(B,e,{configurable:!0,set:t}),q(e)}).prototype,"toString",function(){return this._k}),N.f=Y,E.f=K,n(70).f=S.f=Q,n(94).f=J,n(117).f=Z,o&&!n(74)&&s(B,"propertyIsEnumerable",J,!0),d.f=function(e){return q(h(e))}),i(i.G+i.W+i.F*!V,{Symbol:P});for(var $="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;$.length>ee;)h($[ee++]);for(var te=I(h.store),ne=0;te.length>ne;)m(te[ne++]);i(i.S+i.F*!V,"Symbol",{for:function(e){return a(L,e+="")?L[e]:L[e]=P(e)},keyFor:function(e){if(!H(e))throw TypeError(e+" is not a symbol!");for(var t in L)if(L[t]===e)return t},useSetter:function(){W=!0},useSimple:function(){W=!1}}),i(i.S+i.F*!V,"Object",{create:function(e,t){return void 0===t?O(e):X(O(e),t)},defineProperty:K,defineProperties:X,getOwnPropertyDescriptor:Y,getOwnPropertyNames:Q,getOwnPropertySymbols:Z}),_&&i(i.S+i.F*(!V||c(function(){var e=P();return"[null]"!=R([e])||"{}"!=R({a:e})||"{}"!=R(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],a=1;arguments.length>a;)r.push(arguments[a++]);if(n=t=r[1],(b(t)||void 0!==e)&&!H(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!H(t))return t}),r[1]=t,R.apply(_,r)}}),P.prototype[j]||n(28)(P.prototype,j,P.prototype.valueOf),f(P,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(e,t,n){n(543),n(541),n(540),n(539),n(538),n(537),n(536),n(535),n(534),n(533),n(532),n(531),n(530),n(529),n(528),n(527),n(525),n(524),n(523),n(522),n(521),n(520),n(519),n(518),n(517),n(516),n(515),n(514),n(513),n(512),n(511),n(510),n(509),n(508),n(507),n(506),n(505),n(504),n(503),n(502),n(501),n(500),n(499),n(498),n(497),n(496),n(495),n(494),n(493),n(492),n(491),n(490),n(489),n(488),n(487),n(486),n(485),n(484),n(483),n(482),n(481),n(480),n(479),n(478),n(477),n(476),n(475),n(474),n(473),n(472),n(471),n(470),n(469),n(468),n(467),n(466),n(465),n(463),n(462),n(460),n(459),n(458),n(457),n(456),n(455),n(454),n(452),n(451),n(450),n(449),n(448),n(447),n(446),n(445),n(444),n(443),n(442),n(441),n(440),n(145),n(439),n(438),n(207),n(437),n(436),n(435),n(434),n(433),n(204),n(202),n(201),n(432),n(431),n(430),n(429),n(428),n(427),n(426),n(425),n(424),n(423),n(422),n(421),n(420),n(419),n(418),n(417),n(416),n(415),n(414),n(413),n(412),n(411),n(410),n(409),n(408),n(407),n(406),n(405),n(404),n(403),n(402),n(401),n(400),n(399),n(398),n(397),n(396),n(395),n(394),n(393),n(392),n(391),n(390),n(389),n(388),n(387),n(386),n(385),n(384),n(383),n(382),n(381),n(380),n(379),n(378),n(377),n(376),n(375),n(374),n(373),n(372),n(371),n(370),n(369),n(368),n(367),n(366),n(365),n(364),n(363),n(362),n(361),n(360),n(359),n(358),n(357),n(356),n(355),n(354),n(353),n(352),n(351),n(350),n(349),n(348),e.exports=n(48)},function(e,t,n){"use strict";(function(e){if(n(544),n(347),n(346),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");e._babelPolyfill=!0;var t="defineProperty";function r(e,n,r){e[n]||Object[t](e,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(e){[][e]&&r(Array,e,Function.call.bind([][e]))})}).call(this,n(96))},function(e,t,n){n(545),e.exports=n(343)}])}); | |
//# sourceMappingURL=ml5.min.js.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var featureExtractor; | |
var classifier; | |
var video; | |
var loss; | |
var dogImages = 0; | |
var catImages = 0; | |
function setup() { | |
noCanvas(); | |
// video要素の生成 | |
video = createCapture(VIDEO); | |
video.size(320, 240); | |
// 生成したvideo要素をvideoContainer要素に追加 | |
video.parent('videoContainer'); | |
// 既にMobileNetで学習させた特徴を展開 | |
featureExtractor = ml5.featureExtractor('MobileNet', modelReady); | |
// ビデオを入力にして、既に展開させた特徴抽出でクラス分類機を生成する | |
classifier = featureExtractor.classification(video); | |
// ボタンのUIを生成 | |
createButtons(); | |
} | |
// モデルが読み込まれたら、呼びだされる関数 | |
function modelReady() { | |
select('#modelStatus').html('Base Model (MobileNet) loaded!'); | |
} | |
// カメラの現在のフレームの画像をクラス分類機に追加する | |
function addImage(label) { | |
classifier.addImage(label); | |
} | |
// 現在のフレームの画像を分類する | |
function classify() { | |
classifier.classify(gotResults); | |
} | |
// ボタンのUIを生成する関数 | |
function createButtons() { | |
// Catボタンが押されたら、現在のフレームの画像に"cat"のラベルをつけて追加する | |
buttonA = select('#catButton'); | |
buttonA.mousePressed(function () { | |
addImage('cat'); | |
select('#amountOfCatImages').html(catImages++); | |
}); | |
// Dogボタンが押されたら、現在のフレームの画像に"dog"のラベルをつけて追加する | |
buttonB = select('#dogButton'); | |
buttonB.mousePressed(function () { | |
addImage('dog'); | |
select('#amountOfDogImages').html(dogImages++); | |
}); | |
// 学習ボタン | |
train = select('#train'); | |
train.mousePressed(function () { | |
classifier.train(function (lossValue) { | |
if (lossValue) { | |
loss = lossValue; | |
select('#loss').html('Loss: ' + loss); | |
} else { | |
select('#loss').html('Done Training! Final Loss: ' + loss); | |
} | |
}); | |
}); | |
// 類推ボタン | |
buttonPredict = select('#buttonPredict'); | |
buttonPredict.mousePressed(classify); | |
} | |
// 結果の表示 | |
function gotResults(result) { | |
select('#result').html(result); | |
classify(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment