!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.KerasJS=e():t.KerasJS=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=652)}([function(t,e,n){var r=n(5),o=n(32),i=n(15),a=n(16),s=n(33),u="prototype",l=function(t,e,n){var c,f,p,h,d=t&l.F,v=t&l.G,m=t&l.S,_=t&l.P,g=t&l.B,y=v?r:m?r[e]||(r[e]={}):(r[e]||{})[u],b=v?o:o[e]||(o[e]={}),w=b[u]||(b[u]={});v&&(n=e);for(c in n)f=!d&&y&&void 0!==y[c],p=(f?y:n)[c],h=g&&f?s(p,r):_&&"function"==typeof p?s(Function.call,p):p,y&&a(y,c,p,t&l.U),b[c]!=p&&i(b,c,h),_&&w[c]!=p&&(w[c]=p)};r.core=o,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,t.exports=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.layerClass="Layer",this.name=e.name,this.params=[],this.weights={},this.gpu=e.gpu,this.pipeline=e.pipeline,this._useWeblas=!1,this._pipelineEnabled=!1}return a(t,[{key:"setWeights",value:function(t){var e=this;this.params.forEach(function(n,r){e.weights[n]=t[r]})}},{key:"toggleGpu",value:function(t){var e="undefined"==typeof t?!this._useWeblas:t;e&&weblas?this._useWeblas=!0:this._useWeblas=!1}},{key:"call",value:function(t){return t}},{key:"transferFromPipeline",value:function(t){if(!t.weblasTensor)throw new Error("Variable passed in does not contain weblas tensor.");if(!t._fromPipeline)throw new Error("Variable passed in does not contain _fromPipeline.");if(!t._actualShape)throw new Error("Variable passed in does not contain _actualShape.");var e=t.weblasTensor.shape[1],n=t._actualShape.slice(0,-1).reduce(function(t,e){return t*e},1),r=new u.default([],t.weblasTensor.shape);r.tensor.data=t.weblasTensor.transfer();for(var i=new u.default([],t._actualShape),a=new u.default([],[n]),s=new u.default([],t._actualShape.slice(0,-1)),l=0;l2&&void 0!==arguments[2]?arguments[2]:{};o(this,t),this._type=r.type||Float32Array,e&&e.length&&(e instanceof this._type||e instanceof Array)?(f(e,n),this.tensor=(0,u.default)(e,n),this.tensor=(0,u.default)(new this._type(e),n)):!e.length&&n.length?this.tensor=(0,u.default)(new this._type(n.reduce(function(t,e){return t*e},1)),n):this.tensor=(0,u.default)(new this._type([]),[])}return a(t,[{key:"replaceTensorData",value:function(t){if(t&&t.length&&t instanceof this._type)this.tensor.data=t;else{if(!(t&&t.length&&t instanceof Array))throw new Error("[Tensor] invalid input for replaceTensorData method.");this.tensor.data=new this._type(t)}}},{key:"createWeblasTensor",value:function(){if(this.weblasTensor&&this.weblasTensor.delete(),1===this.tensor.shape.length){var t=this.tensor.shape[0];if(t>c.MAX_TEXTURE_SIZE)this._gpuMaxSizeExceeded=!0;else{var e=[1,t];this.weblasTensor=new weblas.pipeline.Tensor(e,this.tensor.data)}}else{if(2!==this.tensor.shape.length)throw new Error("[Tensor] can only create weblas Tensor for 1-D or 2-D only");if(this.tensor.shape.some(function(t){return t>c.MAX_TEXTURE_SIZE}))this._gpuMaxSizeExceeded=!0;else{var n=this.tensor.shape;this.weblasTensor=new weblas.pipeline.Tensor(n,this.tensor.data)}}}},{key:"deleteWeblasTensor",value:function(){this.weblasTensor&&(this.weblasTensor.delete(),delete this.weblasTensor)}},{key:"copyFromWeblasTensor",value:function(t){var e=weblas.gpu.gl,r=e.context,o=e.createProgram(n(646));this.weblasTensor=new weblas.pipeline.Tensor(t.shape,null),e.selectProgram(o),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.texture);var a=r.getUniformLocation(o,"source");r.uniform1i(a,0);var s=i(this.weblasTensor.shape,2),u=s[0],l=s[1],c=e.getPad(l);e.bindOutputTexture(u,(l+c)/4,this.weblasTensor.texture),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),e.unbindInputTexture(r.TEXTURE0)}}]),t}();e.default=p},function(t,e,n){"use strict";function r(t){if(!t)return s;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in u){var n=u[t];e[t]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+n+"c"},funcName:t}),e[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+n+"=b"},rvalue:!0,funcName:t+"eq"}),e[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+n+"s"},funcName:t+"s"}),e[t+"seq"]=i({args:["array","scalar"],body:{args:["a","s"],body:"a"+n+"=s"},rvalue:!0,funcName:t+"seq"})}}();var l={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in l){var n=l[t];e[t]=i({args:["array","array"],body:{args:["a","b"],body:"a="+n+"b"},funcName:t}),e[t+"eq"]=i({args:["array"],body:{args:["a"],body:"a="+n+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var n=c[t];e[t]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+n+"c"},funcName:t}),e[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+n+"s"},funcName:t+"s"}),e[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+n+"b"},rvalue:!0,count:2,funcName:t+"eq"}),e[t+"seq"]=i({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+n+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var f=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),e.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),e.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.random=i({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),e.assign=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),e.assigns=i({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),e.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},function(t,e,n){var r=n(7);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(79)("wks"),o=n(48),i=n(5).Symbol,a="function"==typeof i,s=t.exports=function(t){return r[t]||(r[t]=a&&i[t]||(a?i:o)("Symbol."+t))};s.store=r},function(t,e,n){t.exports=!n(6)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(4),o=n(153),i=n(29),a=Object.defineProperty;e.f=n(9)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(38),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(24);t.exports=function(t){return Object(r(t))}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(10),o=n(37);t.exports=n(9)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(5),o=n(15),i=n(13),a=n(48)("src"),s="toString",u=Function[s],l=(""+u).split(s);n(32).inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,n,s){var u="function"==typeof n;u&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(u&&(i(n,a)||o(n,a,t[e]?""+t[e]:l.join(String(e)))),t===r?t[e]=n:s?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,s,function(){return"function"==typeof this&&this[a]||u.call(this)})},function(t,e,n){var r=n(0),o=n(6),i=n(24),a=/"/g,s=function(t,e,n,r){var o=String(i(t)),s="<"+e;return""!==n&&(s+=" "+n+'="'+String(r).replace(a,""")+'"'),s+">"+o+""};t.exports=function(t,e){var n={};n[t]=e(s),r(r.P+r.F*o(function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}),"String",n)}},function(t,e,n){var r=n(61),o=n(24);t.exports=function(t){return r(o(t))}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(1===t.tensor.shape.length){var e=h.default.sup(t.tensor);h.default.subseq(t.tensor,e),h.default.expeq(t.tensor);var n=h.default.sum(t.tensor);h.default.divseq(t.tensor,n)}else{if(2!==t.tensor.shape.length)throw new Error("[activations.softmax] tensor shape "+t.tensor.shape+" not supported.");for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{},n=e.alpha,r=void 0===n?0:n,o=e.maxValue,i=void 0===o?null:o,a=void 0;return 0!==r&&(a=new _.default([],t.tensor.shape),h.default.mins(a.tensor,t.tensor,0),h.default.mulseq(a.tensor,r)),h.default.maxseq(t.tensor,0),i&&h.default.minseq(t.tensor,i),a&&h.default.addeq(t.tensor,a.tensor),this}function u(t){return b(t.tensor),this}function l(t){return w(t.tensor),this}function c(t){return x(t.tensor),this}function f(t){return this}Object.defineProperty(e,"__esModule",{value:!0}),e.softmax=o,e.softplus=i,e.softsign=a,e.relu=s,e.tanh=u,e.sigmoid=l,e.hardSigmoid=c,e.linear=f;var p=n(3),h=r(p),d=n(26),v=r(d),m=n(2),_=r(m),g=(0,v.default)({args:["array"],body:function(t){t=Math.log(Math.exp(t)+1)}}),y=(0,v.default)({args:["array"],body:function(t){t/=1+Math.abs(t)}}),b=(0,v.default)({args:["array"],body:function(t){t=Math.tanh(t)}}),w=(0,v.default)({args:["array"],body:function(t){t=1/(1+Math.exp(-t))}}),x=(0,v.default)({args:["array"],body:function(t){t=.2*t+.5,t<=0?t=0:t>=1&&(t=1)}})},function(t,e,n){"use strict";function r(t){return"[object Array]"===E.call(t)}function o(t){return"[object ArrayBuffer]"===E.call(t)}function i(t){return"undefined"!=typeof FormData&&t instanceof FormData}function a(t){var e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function s(t){return"string"==typeof t}function u(t){return"number"==typeof t}function l(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function f(t){return"[object Date]"===E.call(t)}function p(t){return"[object File]"===E.call(t)}function h(t){return"[object Blob]"===E.call(t)}function d(t){return"[object Function]"===E.call(t)}function v(t){return c(t)&&d(t.pipe)}function m(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function _(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function y(t,e){if(null!==t&&"undefined"!=typeof t)if("object"==typeof t||r(t)||(t=[t]),r(t))for(var n=0,o=t.length;nw;w++)if((p||w in g)&&(v=g[w],m=y(v,w,_),t))if(n)x[w]=m;else if(m)switch(t){case 3:return!0;case 5:return v;case 6:return w;case 2:x.push(v)}else if(c)return!1;return f?-1:l||c?c:x}}},function(t,e,n){var r=n(0),o=n(32),i=n(6);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(t,e,n){var r=n(7);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(182),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){var n=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(14);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(169),o=n(0),i=n(79)("metadata"),a=i.store||(i.store=new(n(172))),s=function(t,e,n){var o=a.get(t);if(!o){if(!n)return;a.set(t,o=new r)}var i=o.get(e);if(!i){if(!n)return;o.set(e,i=new r)}return i},u=function(t,e,n){var r=s(e,n,!1);return void 0!==r&&r.has(t)},l=function(t,e,n){var r=s(e,n,!1);return void 0===r?void 0:r.get(t)},c=function(t,e,n,r){s(n,r,!0).set(t,e)},f=function(t,e){var n=s(t,e,!1),r=[];return n&&n.forEach(function(t,e){r.push(e)}),r},p=function(t){return void 0===t||"symbol"==typeof t?t:String(t)},h=function(t){o(o.S,"Reflect",t)};t.exports={store:a,map:s,has:u,get:l,set:c,keys:f,key:p,exp:h}},function(t,e,n){"use strict";if(n(9)){var r=n(41),o=n(5),i=n(6),a=n(0),s=n(80),u=n(118),l=n(33),c=n(40),f=n(37),p=n(15),h=n(45),d=n(38),v=n(11),m=n(47),_=n(29),g=n(13),y=n(166),b=n(60),w=n(7),x=n(12),E=n(103),T=n(42),O=n(22),S=n(43).f,P=n(120),M=n(48),j=n(8),A=n(27),C=n(70),R=n(112),k=n(121),I=n(54),N=n(76),U=n(46),F=n(96),L=n(146),D=n(10),B=n(21),V=D.f,X=B.f,W=o.RangeError,z=o.TypeError,G=o.Uint8Array,q="ArrayBuffer",H="Shared"+q,Y="BYTES_PER_ELEMENT",K="prototype",$=Array[K],Z=u.ArrayBuffer,Q=u.DataView,J=A(0),tt=A(2),et=A(3),nt=A(4),rt=A(5),ot=A(6),it=C(!0),at=C(!1),st=k.values,ut=k.keys,lt=k.entries,ct=$.lastIndexOf,ft=$.reduce,pt=$.reduceRight,ht=$.join,dt=$.sort,vt=$.slice,mt=$.toString,_t=$.toLocaleString,gt=j("iterator"),yt=j("toStringTag"),bt=M("typed_constructor"),wt=M("def_constructor"),xt=s.CONSTR,Et=s.TYPED,Tt=s.VIEW,Ot="Wrong length!",St=A(1,function(t,e){return Rt(R(t,t[wt]),e)}),Pt=i(function(){return 1===new G(new Uint16Array([1]).buffer)[0]}),Mt=!!G&&!!G[K].set&&i(function(){new G(1).set({})}),jt=function(t,e){if(void 0===t)throw z(Ot);var n=+t,r=v(t);if(e&&!y(n,r))throw W(Ot);return r},At=function(t,e){var n=d(t);if(n<0||n%e)throw W("Wrong offset!");return n},Ct=function(t){if(w(t)&&Et in t)return t;throw z(t+" is not a typed array!")},Rt=function(t,e){if(!(w(t)&&bt in t))throw z("It is not a typed array constructor!");return new t(e)},kt=function(t,e){return It(R(t,t[wt]),e)},It=function(t,e){for(var n=0,r=e.length,o=Rt(t,r);r>n;)o[n]=e[n++];return o},Nt=function(t,e,n){V(t,e,{get:function(){return this._d[n]}})},Ut=function(t){var e,n,r,o,i,a,s=x(t),u=arguments.length,c=u>1?arguments[1]:void 0,f=void 0!==c,p=P(s);if(void 0!=p&&!E(p)){for(a=p.call(s),r=[],e=0;!(i=a.next()).done;e++)r.push(i.value);s=r}for(f&&u>2&&(c=l(c,arguments[2],2)),e=0,n=v(s.length),o=Rt(this,n);n>e;e++)o[e]=f?c(s[e],e):s[e];return o},Ft=function(){for(var t=0,e=arguments.length,n=Rt(this,e);e>t;)n[t]=arguments[t++];return n},Lt=!!G&&i(function(){_t.call(new G(1))}),Dt=function(){return _t.apply(Lt?vt.call(Ct(this)):Ct(this),arguments)},Bt={copyWithin:function(t,e){return L.call(Ct(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return nt(Ct(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return F.apply(Ct(this),arguments)},filter:function(t){return kt(this,tt(Ct(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return rt(Ct(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return ot(Ct(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){J(Ct(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return at(Ct(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return it(Ct(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ht.apply(Ct(this),arguments)},lastIndexOf:function(t){return ct.apply(Ct(this),arguments)},map:function(t){return St(Ct(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ft.apply(Ct(this),arguments)},reduceRight:function(t){return pt.apply(Ct(this),arguments)},reverse:function(){for(var t,e=this,n=Ct(e).length,r=Math.floor(n/2),o=0;o1?arguments[1]:void 0)},sort:function(t){return dt.call(Ct(this),t)},subarray:function(t,e){var n=Ct(this),r=n.length,o=m(t,r);return new(R(n,n[wt]))(n.buffer,n.byteOffset+o*n.BYTES_PER_ELEMENT,v((void 0===e?r:m(e,r))-o))}},Vt=function(t,e){return kt(this,vt.call(Ct(this),t,e))},Xt=function(t){Ct(this);var e=At(arguments[1],1),n=this.length,r=x(t),o=v(r.length),i=0;if(o+e>n)throw W(Ot);for(;i255?255:255&r),o.v[d](n*e+o.o,r,Pt)},j=function(t,e){V(t,e,{get:function(){return P(this,e)},set:function(t){return M(this,e,t)},enumerable:!0})};y?(m=n(function(t,n,r,o){c(t,m,l,"_d");var i,a,s,u,f=0,h=0;if(w(n)){if(!(n instanceof Z||(u=b(n))==q||u==H))return Et in n?It(m,n):Ut.call(m,n);i=n,h=At(r,e);var d=n.byteLength;if(void 0===o){if(d%e)throw W(Ot);if(a=d-h,a<0)throw W(Ot)}else if(a=v(o)*e,a+h>d)throw W(Ot);s=a/e}else s=jt(n,!0),a=s*e,i=new Z(a);for(p(t,"_d",{b:i,o:h,l:a,e:s,v:new Q(i)});f0?r:n)(t)}},function(t,e){var n;n=function(){return this; }();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e){t.exports=!1},function(t,e,n){var r=n(4),o=n(159),i=n(99),a=n(111)("IE_PROTO"),s=function(){},u="prototype",l=function(){var t,e=n(98)("iframe"),r=i.length,o="<",a=">";for(e.style.display="none",n(101).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(o+"script"+a+"document.F=Object"+o+"/script"+a),t.close(),l=t.F;r--;)delete l[u][i[r]];return l()};t.exports=Object.create||function(t,e){var n;return null!==t?(s[u]=r(t),n=new s,s[u]=null,n[a]=t):n=l(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(161),o=n(99).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,e,n){var r=n(161),o=n(99);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(16);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){"use strict";var r=n(5),o=n(10),i=n(9),a=n(8)("species");t.exports=function(t){var e=r[t];i&&e&&!e[a]&&o.f(e,a,{configurable:!0,get:function(){return this}})}},function(t,e,n){var r=n(38),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){function r(t,e){var n=i(t,e);return o(n)?n:void 0}var o=n(506),i=n(544);t.exports=r},function(t,e,n){function r(t){return a(t)?o(t):i(t)}var o=n(491),i=n(508),a=n(89);t.exports=r},function(t,e,n){"use strict";function r(t,e){switch(t){case"Activation":return["linear","relu"].indexOf(e.activation)>-1;case"Convolution2D":return["linear","relu"].indexOf(e.activation)>-1;case"BatchNormalization":return 0===e.mode;case"MaxPooling2D":case"AveragePooling2D":return!0;case"Merge":return["concat","sum","mul","ave","max"].indexOf(e.mode)>-1;default:return!1}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,n){var r=n(8)("unscopables"),o=Array.prototype;void 0==o[r]&&n(15)(o,r,{}),t.exports=function(t){o[r][t]=!0}},function(t,e,n){var r=n(33),o=n(155),i=n(103),a=n(4),s=n(11),u=n(120),l={},c={},e=t.exports=function(t,e,n,f,p){var h,d,v,m,_=p?function(){return t}:u(t),g=r(n,f,e?2:1),y=0;if("function"!=typeof _)throw TypeError(t+" is not iterable!");if(i(_)){for(h=s(t.length);h>y;y++)if(m=e?g(a(d=t[y])[0],d[1]):g(t[y]),m===l||m===c)return m}else for(v=_.call(t);!(d=v.next()).done;)if(m=o(v,g,d.value,e),m===l||m===c)return m};e.BREAK=l,e.RETURN=c},function(t,e){t.exports={}},function(t,e,n){var r=n(10).f,o=n(13),i=n(8)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(0),o=n(24),i=n(6),a=n(116),s="["+a+"]",u="​…",l=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),f=function(t,e,n){var o={},s=i(function(){return!!a[t]()||u[t]()!=u}),l=o[t]=s?e(p):a[t];n&&(o[n]=l),r(r.P+r.F*s,"String",o)},p=f.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(l,"")),2&e&&(t=t.replace(c,"")),t};t.exports=f},function(t,e){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){"use strict";t.exports.gemv=n(620),t.exports.gbmv=n(619),t.exports.symv=n(626),t.exports.sbmv=n(622),t.exports.spmv=n(623),t.exports.trmv=n(632),t.exports.tbmv=n(629),t.exports.trsv=n(633),t.exports.tbsv=n(630),t.exports.tpsv=n(631),t.exports.ger=n(621),t.exports.syr=n(627),t.exports.spr=n(624),t.exports.syr2=n(628),t.exports.spr2=n(625),t.exports.trmv_lower=function(e,n){return console.warn("trmv_lower is deprecated. Please use the 'isLower' flag with trmv."),t.exports.trmv(e,n,!0)},t.exports.trsv_lower=function(e,n){return console.warn("trsv_lower is deprecated. Please use the 'isLower' flag with trsv."),t.exports.trsv(e,n,!0)}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Convolution2D";var r=t.nbFilter,o=void 0===r?1:r,s=t.nbRow,u=void 0===s?3:s,l=t.nbCol,c=void 0===l?3:l,f=t.activation,h=void 0===f?"linear":f,d=t.borderMode,v=void 0===d?"valid":d,m=t.subsample,_=void 0===m?[1,1]:m,g=t.dimOrdering,y=void 0===g?"tf":g,b=t.bias,w=void 0===b||b;if(n.kernelShape=[o,u,c],n.activation=h,n.activationFunc=p[h],"valid"!==v&&"same"!==v)throw new Error(n.name+" [Convolution2D layer] Invalid borderMode.");if(n.borderMode=v,n.subsample=_,"tf"!==y&&"th"!==y)throw new Error(n.name+" [Convolution2D layer] Only tf and th dim ordering are allowed.");if(n.dimOrdering=y,n.bias=w,n.params=n.bias?["W","b"]:["W"],n.gpu&&weblas&&(n._useWeblas=!0,n.pipeline)){var E=(0,x.default)(n.layerClass,t);E?(n._pipelineEnabled=!0,n.webglConv2D=new T.default):n._pipelineEnabled=!1}return n}return s(e,t),l(e,[{key:"setWeights",value:function(t){"th"===this.dimOrdering&&(t[0].tensor=t[0].tensor.transpose(2,3,1,0)),c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setWeights",this).call(this,t),this._w2row(),this._useWeblas&&(this._wRowsMat.createWeblasTensor(),this._wRowsMat._gpuMaxSizeExceeded||(this._wRowsMat.weblasTensor=this._wRowsMat.weblasTensor.transpose()),this.bias?this.weights.b.createWeblasTensor():(this._zerosVec=new d.default([],[this.weights.W.tensor.shape[3]]),this._zerosVec.createWeblasTensor()))}},{key:"_calcOutputShape",value:function(t){var e=t[0],n=t[1],r=u(this.kernelShape,3),o=r[0],i=r[1],a=r[2],s="same"===this.borderMode?Math.floor((e+this.subsample[0]-1)/this.subsample[0]):Math.floor((e-i+this.subsample[0])/this.subsample[0]),l="same"===this.borderMode?Math.floor((n+this.subsample[1]-1)/this.subsample[1]):Math.floor((n-a+this.subsample[1])/this.subsample[1]),c=o,f="same"===this.borderMode?Math.max(0,Math.floor((s-1)*this.subsample[0]+i-e)):0,p="same"===this.borderMode?Math.max(0,Math.floor((l-1)*this.subsample[1]+a-n)):0,h=Math.floor(f/2),d=f-h,v=Math.floor(p/2),m=p-v;this.outputShape=[s,l,c],this.inputPadding=[h,d,v,m]}},{key:"_padInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("same"===this.borderMode){var n=u(t.tensor.shape,3),r=n[0],o=n[1],i=n[2],a=u(this.inputPadding,4),s=a[0],l=a[1],c=a[2],f=a[3],p=r+s+l,h=o+c+f,v=new d.default([],[p,h,i]);0!==e&&g.default.assigns(v.tensor,e),g.default.assign(v.tensor.hi(r+s,o+c,i).lo(s,c,0),t.tensor),t.tensor=v.tensor}return t}},{key:"_im2col",value:function(t){var e=u(t.tensor.shape,3),n=e[0],r=e[1],o=e[2],i=this.kernelShape[1],a=this.kernelShape[2],s=this.outputShape[0],l=this.outputShape[1],c=s*l,f=i*a*o;if(this._imColsMat||(this._imColsMat=new d.default([],[c,f])),1===i&&1===a&&1===this.subsample[0]&&1===this.subsample[1])return this._imColsMat.replaceTensorData(t.tensor.data),this._useWeblas&&this._imColsMat.createWeblasTensor(),this._imColsMat;for(var p=new d.default([],[i,a,o]),h=0,v=0,m=n-i;v<=m;v+=this.subsample[0])for(var _=0,y=r-a;_<=y;_+=this.subsample[1])g.default.assign(p.tensor,t.tensor.hi(v+i,_+a,o).lo(v,_,0)),this._imColsMat.tensor.data.set(p.tensor.data,h),h+=f;return this._useWeblas&&this._imColsMat.createWeblasTensor(),this._imColsMat}},{key:"_w2row",value:function(){var t=this.weights.W.tensor.shape[2],e=u(this.kernelShape,3),n=e[0],r=e[1],o=e[2],i=r*o*t;this._wRowsMat=new d.default([],[i,n]);for(var a=new d.default([],[r,o,t]),s=new d.default([],[i]),l=0;lc;)if(s=u[c++],s!=s)return!0}else for(;l>c;c++)if((t||c in u)&&u[c]===n)return t||c||0;return!t&&-1}}},function(t,e,n){"use strict";var r=n(5),o=n(0),i=n(16),a=n(45),s=n(36),u=n(53),l=n(40),c=n(7),f=n(6),p=n(76),h=n(55),d=n(102);t.exports=function(t,e,n,v,m,_){var g=r[t],y=g,b=m?"set":"add",w=y&&y.prototype,x={},E=function(t){var e=w[t];i(w,t,"delete"==t?function(t){return!(_&&!c(t))&&e.call(this,0===t?0:t)}:"has"==t?function(t){return!(_&&!c(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return _&&!c(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof y&&(_||w.forEach&&!f(function(){(new y).entries().next()}))){var T=new y,O=T[b](_?{}:-0,1)!=T,S=f(function(){T.has(1)}),P=p(function(t){new y(t)}),M=!_&&f(function(){for(var t=new y,e=5;e--;)t[b](e,e);return!t.has(-0)});P||(y=e(function(e,n){l(e,y,t);var r=d(new g,e,y);return void 0!=n&&u(n,m,r[b],r),r}),y.prototype=w,w.constructor=y),(S||M)&&(E("delete"),E("has"),m&&E("get")),(M||O)&&E(b),_&&w.clear&&delete w.clear}else y=v.getConstructor(e,t,m,b),a(y.prototype,n),s.NEED=!0;return h(y,t),x[t]=y,o(o.G+o.W+o.F*(y!=g),x),_||v.setStrong(y,t,m),y}},function(t,e,n){"use strict";var r=n(15),o=n(16),i=n(6),a=n(24),s=n(8);t.exports=function(t,e,n){var u=s(t),l=n(a,u,""[t]),c=l[0],f=l[1];i(function(){var e={};return e[u]=function(){return 7},7!=""[t](e)})&&(o(String.prototype,t,c),r(RegExp.prototype,u,2==e?function(t,e){return f.call(t,this,e)}:function(t){return f.call(t,this)}))}},function(t,e,n){"use strict";var r=n(4);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){var r=n(7),o=n(23),i=n(8)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},function(t,e,n){var r=n(8)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},t(i)}catch(t){}return n}},function(t,e,n){t.exports=n(41)||!n(6)(function(){var t=Math.random();__defineSetter__.call(null,t,function(){}),delete n(5)[t]})},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(5),o="__core-js_shared__",i=r[o]||(r[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e,n){for(var r,o=n(5),i=n(15),a=n(48),s=a("typed_array"),u=a("view"),l=!(!o.ArrayBuffer||!o.DataView),c=l,f=0,p=9,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f-1&&t%1==0&&tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+n+"_set("+l.join(",")+",v){"),r?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+n+"_get("+l.join(",")+"){"),r?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+n+"_index(",l.join(),"){return "+c+"}"),i.push("proto.hi=function "+n+"_hi("+l.join(",")+"){return new "+n+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),v=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});i.push("proto.lo=function "+n+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+v.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");i.push("return new "+n+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),i.push("proto.step=function "+n+"_step("+l.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",i.join("\n"));return a(f[t],o)}function a(t){if(l(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,n,r){if(void 0===t){var o=f.array[0];return o([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===n){n=new Array(s);for(var u=s-1,l=1;u>=0;--u)n[u]=l,l*=e[u]}if(void 0===r){r=0;for(var u=0;u1)for(var n=1;n=200&&t<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(t){l.headers[t]={}}),i.forEach(["post","put","patch"],function(t){l.headers[t]=i.merge(u)}),t.exports=l}).call(e,n(93))},function(t,e,n){"use strict";var r=n(12),o=n(47),i=n(11);t.exports=function(t){for(var e=r(this),n=i(e.length),a=arguments.length,s=o(a>1?arguments[1]:void 0,n),u=a>2?arguments[2]:void 0,l=void 0===u?n:o(u,n);l>s;)e[s++]=t;return e}},function(t,e,n){"use strict";var r=n(10),o=n(37);t.exports=function(t,e,n){e in t?r.f(t,e,o(0,n)):t[e]=n}},function(t,e,n){var r=n(7),o=n(5).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(8)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},function(t,e,n){t.exports=n(5).document&&document.documentElement},function(t,e,n){var r=n(7),o=n(110).set;t.exports=function(t,e,n){var i,a=e.constructor;return a!==n&&"function"==typeof a&&(i=a.prototype)!==n.prototype&&r(i)&&o&&o(t,i),t}},function(t,e,n){var r=n(54),o=n(8)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,e,n){var r=n(23);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){"use strict";var r=n(42),o=n(37),i=n(55),a={};n(15)(a,n(8)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(a,{next:o(1,n)}),i(t,e+" Iterator")}},function(t,e,n){"use strict";var r=n(41),o=n(0),i=n(16),a=n(15),s=n(13),u=n(54),l=n(105),c=n(55),f=n(22),p=n(8)("iterator"),h=!([].keys&&"next"in[].keys()),d="@@iterator",v="keys",m="values",_=function(){return this};t.exports=function(t,e,n,g,y,b,w){l(n,e,g);var x,E,T,O=function(t){if(!h&&t in j)return j[t];switch(t){case v:return function(){return new n(this,t)};case m:return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",P=y==m,M=!1,j=t.prototype,A=j[p]||j[d]||y&&j[y],C=A||O(y),R=y?P?O("entries"):C:void 0,k="Array"==e?j.entries||A:A;if(k&&(T=f(k.call(new t)),T!==Object.prototype&&(c(T,S,!0),r||s(T,p)||a(T,p,_))),P&&A&&A.name!==m&&(M=!0,C=function(){return A.call(this)}),r&&!w||!h&&!M&&j[p]||a(j,p,C),u[e]=C,u[S]=_,y)if(x={values:P?C:O(m),keys:b?C:O(v),entries:R},w)for(E in x)E in j||i(j,E,x[E]);else o(o.P+o.F*(h||M),e,x); return x}},function(t,e){var n=Math.expm1;t.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||n(-2e-17)!=-2e-17?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:n},function(t,e){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,e,n){var r=n(5),o=n(117).set,i=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(23)(a);t.exports=function(){var t,e,n,l=function(){var r,o;for(u&&(r=a.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(l)};else if(i){var c=!0,f=document.createTextNode("");new i(l).observe(f,{characterData:!0}),n=function(){f.data=c=!c}}else if(s&&s.resolve){var p=s.resolve();n=function(){p.then(l)}}else n=function(){o.call(r,l)};return function(r){var o={fn:r,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},function(t,e,n){var r=n(7),o=n(4),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{r=n(33)(Function.call,n(21).f(Object.prototype,"__proto__").set,2),r(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:i}},function(t,e,n){var r=n(79)("keys"),o=n(48);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(4),o=n(14),i=n(8)("species");t.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||void 0==(n=r(a)[i])?e:o(n)}},function(t,e,n){var r=n(38),o=n(24);t.exports=function(t){return function(e,n){var i,a,s=String(o(e)),u=r(n),l=s.length;return u<0||u>=l?t?"":void 0:(i=s.charCodeAt(u),i<55296||i>56319||u+1===l||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):i:t?s.slice(u,u+2):(i-55296<<10)+(a-56320)+65536)}}},function(t,e,n){var r=n(75),o=n(24);t.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(o(t))}},function(t,e,n){"use strict";var r=n(38),o=n(24);t.exports=function(t){var e=String(o(this)),n="",i=r(t);if(i<0||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(e+=e))1&i&&(n+=e);return n}},function(t,e){t.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},function(t,e,n){var r,o,i,a=n(33),s=n(74),u=n(101),l=n(98),c=n(5),f=c.process,p=c.setImmediate,h=c.clearImmediate,d=c.MessageChannel,v=0,m={},_="onreadystatechange",g=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},y=function(t){g.call(t.data)};p&&h||(p=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return m[++v]=function(){s("function"==typeof t?t:Function(t),e)},r(v),v},h=function(t){delete m[t]},"process"==n(23)(f)?r=function(t){f.nextTick(a(g,t,1))}:d?(o=new d,i=o.port2,o.port1.onmessage=y,r=a(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(r=function(t){c.postMessage(t+"","*")},c.addEventListener("message",y,!1)):r=_ in l("script")?function(t){u.appendChild(l("script"))[_]=function(){u.removeChild(this),g.call(t)}}:function(t){setTimeout(a(g,t,1),0)}),t.exports={set:p,clear:h}},function(t,e,n){"use strict";var r=n(5),o=n(9),i=n(41),a=n(80),s=n(15),u=n(45),l=n(6),c=n(40),f=n(38),p=n(11),h=n(43).f,d=n(10).f,v=n(96),m=n(55),_="ArrayBuffer",g="DataView",y="prototype",b="Wrong length!",w="Wrong index!",x=r[_],E=r[g],T=r.Math,O=r.RangeError,S=r.Infinity,P=x,M=T.abs,j=T.pow,A=T.floor,C=T.log,R=T.LN2,k="buffer",I="byteLength",N="byteOffset",U=o?"_b":k,F=o?"_l":I,L=o?"_o":N,D=function(t,e,n){var r,o,i,a=Array(n),s=8*n-e-1,u=(1<>1,c=23===e?j(2,-24)-j(2,-77):0,f=0,p=t<0||0===t&&1/t<0?1:0;for(t=M(t),t!=t||t===S?(o=t!=t?1:0,r=u):(r=A(C(t)/R),t*(i=j(2,-r))<1&&(r--,i*=2),t+=r+l>=1?c/i:c*j(2,1-l),t*i>=2&&(r++,i/=2),r+l>=u?(o=0,r=u):r+l>=1?(o=(t*i-1)*j(2,e),r+=l):(o=t*j(2,l-1)*j(2,e),r=0));e>=8;a[f++]=255&o,o/=256,e-=8);for(r=r<0;a[f++]=255&r,r/=256,s-=8);return a[--f]|=128*p,a},B=function(t,e,n){var r,o=8*n-e-1,i=(1<>1,s=o-7,u=n-1,l=t[u--],c=127&l;for(l>>=7;s>0;c=256*c+t[u],u--,s-=8);for(r=c&(1<<-s)-1,c>>=-s,s+=e;s>0;r=256*r+t[u],u--,s-=8);if(0===c)c=1-a;else{if(c===i)return r?NaN:l?-S:S;r+=j(2,e),c-=a}return(l?-1:1)*r*j(2,c-e)},V=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},X=function(t){return[255&t]},W=function(t){return[255&t,t>>8&255]},z=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},G=function(t){return D(t,52,8)},q=function(t){return D(t,23,4)},H=function(t,e,n){d(t[y],e,{get:function(){return this[n]}})},Y=function(t,e,n,r){var o=+n,i=f(o);if(o!=i||i<0||i+e>t[F])throw O(w);var a=t[U]._b,s=i+t[L],u=a.slice(s,s+e);return r?u:u.reverse()},K=function(t,e,n,r,o,i){var a=+n,s=f(a);if(a!=s||s<0||s+e>t[F])throw O(w);for(var u=t[U]._b,l=s+t[L],c=r(+o),p=0;ptt;)(Z=J[tt++])in x||s(x,Z,P[Z]);i||(Q.constructor=x)}var et=new E(new x(2)),nt=E[y].setInt8;et.setInt8(0,2147483648),et.setInt8(1,2147483649),!et.getInt8(0)&&et.getInt8(1)||u(E[y],{setInt8:function(t,e){nt.call(this,t,e<<24>>24)},setUint8:function(t,e){nt.call(this,t,e<<24>>24)}},!0)}else x=function(t){var e=$(this,t);this._b=v.call(Array(e),0),this[F]=e},E=function(t,e,n){c(this,E,g),c(t,x,g);var r=t[F],o=f(e);if(o<0||o>r)throw O("Wrong offset!");if(n=void 0===n?r-o:p(n),o+n>r)throw O(b);this[U]=t,this[L]=o,this[F]=n},o&&(H(x,I,"_l"),H(E,k,"_b"),H(E,I,"_l"),H(E,N,"_o")),u(E[y],{getInt8:function(t){return Y(this,1,t)[0]<<24>>24},getUint8:function(t){return Y(this,1,t)[0]},getInt16:function(t){var e=Y(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=Y(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return V(Y(this,4,t,arguments[1]))},getUint32:function(t){return V(Y(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return B(Y(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return B(Y(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){K(this,1,t,X,e)},setUint8:function(t,e){K(this,1,t,X,e)},setInt16:function(t,e){K(this,2,t,W,e,arguments[2])},setUint16:function(t,e){K(this,2,t,W,e,arguments[2])},setInt32:function(t,e){K(this,4,t,z,e,arguments[2])},setUint32:function(t,e){K(this,4,t,z,e,arguments[2])},setFloat32:function(t,e){K(this,4,t,q,e,arguments[2])},setFloat64:function(t,e){K(this,8,t,G,e,arguments[2])}});m(x,_),m(E,g),s(E[y],a.VIEW,!0),e[_]=x,e[g]=E},function(t,e,n){var r=n(5),o=n(32),i=n(41),a=n(168),s=n(10).f;t.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},function(t,e,n){var r=n(60),o=n(8)("iterator"),i=n(54);t.exports=n(32).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[r(t)]}},function(t,e,n){"use strict";var r=n(52),o=n(156),i=n(54),a=n(18);t.exports=n(106)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):"keys"==e?o(0,n):"values"==e?o(0,t[n]):o(0,[n,t[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,e,n){var r=n(49),o=n(30),i=r(o,"Map");t.exports=i},function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=r}var r=9007199254740991;t.exports=n},function(t,e,n){function r(t){return t&&t.length?o(t,i):0}var o=n(520),i=n(128);t.exports=r},function(t,e,n){"use strict";function r(t,e){var n,r;if(void 0!==e&&(!Number.isFinite(e)||e%1!==e))throw new Error("axis of dimension to unsqueeze must be an integer");return e=void 0===e?t.shape.length:e,n=t.shape.slice(0),r=t.stride.slice(0),n.splice(e||0,0,1),r.splice(e||0,0,(r[e]||1)*(n[e+1]||1)),o(t.data,n,r,t.offset)}var o=n(92);t.exports=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.InputLayer=void 0;var o=n(235);Object.keys(o).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var i=n(263);Object.keys(i).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return i[t]}})});var a=n(250);Object.keys(a).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var s=n(281);Object.keys(s).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})});var u=n(270);Object.keys(u).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return u[t]}})});var l=n(265);Object.keys(l).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return l[t]}})});var c=n(268);Object.keys(c).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var f=n(144);Object.keys(f).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return f[t]}})});var p=n(287);Object.keys(p).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return p[t]}})});var h=n(228),d=r(h);e.InputLayer=d.default},function(t,e,n){"use strict";var r=n(20),o=n(212),i=n(215),a=n(221),s=n(219),u=n(138),l="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(214);t.exports=function(t){return new Promise(function(e,c){var f=t.data,p=t.headers;r.isFormData(f)&&delete p["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",v=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||s(t.url)||(h=new window.XDomainRequest,d="onload",v=!0,h.onprogress=function(){},h.ontimeout=function(){}),t.auth){var m=t.auth.username||"",_=t.auth.password||"";p.Authorization="Basic "+l(m+":"+_)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h[d]=function(){if(h&&(4===h.readyState||v)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?a(h.getAllResponseHeaders()):null,r=t.responseType&&"text"!==t.responseType?h.response:h.responseText,i={data:r,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:n,config:t,request:h};o(e,c,i),h=null}},h.onerror=function(){c(u("Network Error",t)),h=null},h.ontimeout=function(){c(u("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED")),h=null},r.isStandardBrowserEnv()){var g=n(217),y=(t.withCredentials||s(t.url))&&t.xsrfCookieName?g.read(t.xsrfCookieName):void 0;y&&(p[t.xsrfHeaderName]=y)}if("setRequestHeader"in h&&r.forEach(p,function(t,e){"undefined"==typeof f&&"content-type"===e.toLowerCase()?delete p[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(t){if("json"!==h.responseType)throw t}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),c(t),h=null)}),void 0===f&&(f=null),h.send(f)})}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";var r=n(211);t.exports=function(t,e,n,o){var i=new Error(t);return r(i,e,n,o)}},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="_Pooling1D";var r=t.poolLength,a=void 0===r?2:r,s=t.stride,u=void 0===s?null:s,l=t.borderMode,c=void 0===l?"valid":l;return n.poolLength=a,n.stride=null===u?a:u,n.borderMode=c,n.poolingFunc="max",n}return a(e,t),s(e,[{key:"call",value:function(t){if("max"!==this.poolingFunc&&"average"!==this.poolingFunc)throw new Error("[pooling._Pooling1D] pooling function must be max or average.");for(var e="valid"===this.borderMode?Math.floor((t.tensor.shape[0]-this.poolLength+this.stride)/this.stride):Math.floor((t.tensor.shape[0]+this.stride-1)/this.stride),n=new f.default([],[e,t.tensor.shape[1]]),r=new f.default([],[t.tensor.shape[1]]),o="valid"===this.borderMode?0:Math.min(0,Math.ceil((t.tensor.shape[0]-(e-1)*this.stride-this.poolLength)/2)),i=0;it.tensor.shape[0]-1);l++)"max"===this.poolingFunc?h.default.maxeq(r.tensor,t.tensor.pick(a+l,null)):"average"===this.poolingFunc&&h.default.addeq(r.tensor,t.tensor.pick(a+l,null)),u+=1;"average"===this.poolingFunc&&h.default.divseq(r.tensor,u),h.default.assign(n.tensor.pick(i,null),r.tensor),o+=this.stride}return t.tensor=n.tensor,t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="_Pooling2D";var r=t.poolSize,a=void 0===r?[2,2]:r,s=t.strides,u=void 0===s?null:s,l=t.borderMode,c=void 0===l?"valid":l,f=t.dimOrdering,p=void 0===f?"tf":f;return n.poolSize=a,n.strides=null===u?a:u,n.borderMode=c,n.dimOrdering=p,n.poolingFunc="max",n}return a(e,t),u(e,[{key:"_calcOutputShape",value:function(t){var e=s(t,3),n=e[0],r=e[1],o=e[2],i=s(this.poolSize,2),a=i[0],u=i[1],l="same"===this.borderMode?Math.floor((n+this.strides[0]-1)/this.strides[0]):Math.floor((n-a+this.strides[0])/this.strides[0]),c="same"===this.borderMode?Math.floor((r+this.strides[1]-1)/this.strides[1]):Math.floor((r-u+this.strides[1])/this.strides[1]),f="same"===this.borderMode?Math.max(0,Math.floor((l-1)*this.strides[0]+a-n)):0,p="same"===this.borderMode?Math.max(0,Math.floor((c-1)*this.strides[1]+u-r)):0,h=Math.floor(f/2),d=f-h,v=Math.floor(p/2),m=p-v;this.outputShape=[l,c,o],this.inputPadding=[h,d,v,m]}},{key:"_padInput",value:function(t){if("same"===this.borderMode){var e=s(t.tensor.shape,3),n=e[0],r=e[1],o=e[2],i=s(this.inputPadding,4),a=i[0],u=i[1],l=i[2],c=i[3],f=n+a+u,h=r+l+c,v=new p.default([],[f,h,o]);"max"===this.poolingFunc&&d.default.assigns(v.tensor,Number.NEGATIVE_INFINITY),d.default.assign(v.tensor.hi(n+a,r+l,o).lo(a,l,0),t.tensor),t.tensor=v.tensor}return t}},{key:"_poolIndexMapping",value:function(t){if(!this._poolIndicesPerChannel){for(var e=t[0],n=t[1],r=new p.default([],[e,n]),o=0,i=0;in-v&&(b=g+a-(n-v));for(var w=0,x=0;w<=r-u;w+=this.strides[1],x++){var E=0;wr-_&&(E=w+u-(r-_)),d.default.assign(c.tensor,t.tensor.hi(g+a,w+u,o).lo(g,w,0));for(var T=0;T0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="_Pooling3D";var r=t.poolSize,a=void 0===r?[2,2,2]:r,s=t.strides,u=void 0===s?null:s,l=t.borderMode,c=void 0===l?"valid":l,f=t.dimOrdering,p=void 0===f?"tf":f;return n.poolSize=a,n.strides=null===u?a:u,n.borderMode=c,n.dimOrdering=p,n.poolingFunc="max",n}return a(e,t),u(e,[{key:"_calcOutputShape",value:function(t){var e=s(t.tensor.shape,4),n=e[0],r=e[1],o=e[2],i=e[3],a=s(this.poolSize,3),u=a[0],l=a[1],c=a[2],f="same"===this.borderMode?Math.floor((n+this.strides[0]-1)/this.strides[0]):Math.floor((n-u+this.strides[0])/this.strides[0]),p="same"===this.borderMode?Math.floor((r+this.strides[1]-1)/this.strides[1]):Math.floor((r-l+this.strides[1])/this.strides[1]),h="same"===this.borderMode?Math.floor((o+this.strides[2]-1)/this.strides[2]):Math.floor((o-c+this.strides[2])/this.strides[2]),d="same"===this.borderMode?Math.max(0,Math.floor((f-1)*this.strides[0]+u-n)):0,v="same"===this.borderMode?Math.max(0,Math.floor((p-1)*this.strides[1]+l-r)):0,m="same"===this.borderMode?Math.max(0,Math.floor((h-1)*this.strides[2]+c-o)):0,_=Math.floor(d/2),g=d-_,y=Math.floor(v/2),b=v-y,w=Math.floor(m/2),x=m-w;this.outputShape=[f,p,h,i],this.inputPadding=[_,g,y,b,w,x]}},{key:"_padInput",value:function(t){if("same"===this.borderMode){var e=s(t.tensor.shape,4),n=e[0],r=e[1],o=e[2],i=e[3],a=s(this.inputPadding,6),u=a[0],l=a[1],c=a[2],f=a[3],h=a[4],v=a[5],m=n+u+l,_=r+c+f,g=o+h+v,y=new p.default([],[m,_,g,i]);"max"===this.poolingFunc&&d.default.assigns(y.tensor,Number.NEGATIVE_INFINITY),d.default.assign(y.tensor.hi(n+u,r+c,o+h,i).lo(u,c,h,0),t.tensor),t.tensor=y.tensor}return t}},{key:"call",value:function(t){if("max"!==this.poolingFunc&&"average"!==this.poolingFunc)throw new Error("[pooling._Pooling3D] pooling function must be max or average.");"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,3,0)),this._calcOutputShape(t),this._padInput(t);for(var e=s(t.tensor.shape,4),n=e[0],r=e[1],o=e[2],i=e[3],a=s(this.poolSize,3),u=a[0],l=a[1],c=a[2],f=new p.default([],this.outputShape),h=new p.default([],[u,l,c,i]),v=s(this.inputPadding,6),m=v[0],_=v[1],g=v[2],y=v[3],b=v[4],w=v[5],x=0,E=0;x<=n-u;x+=this.strides[0],E++){var T=0;xn-_&&(T=x+u-(n-_));for(var O=0,S=0;O<=r-l;O+=this.strides[1],S++){var P=0;Or-y&&(P=O+l-(r-y));for(var M=0,j=0;M<=o-c;M+=this.strides[2],j++){var A=0;Mo-w&&(A=M+c-(o-w)),d.default.assign(h.tensor,t.tensor.hi(x+u,O+l,M+c,i).lo(x,O,M,0));for(var C=0;C2?arguments[2]:void 0,c=Math.min((void 0===l?a:o(l,a))-u,a-s),f=1;for(u0;)u in n?n[s]=n[u]:delete n[s],s+=f,u+=f;return n}},function(t,e,n){var r=n(53);t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},function(t,e,n){var r=n(14),o=n(12),i=n(61),a=n(11);t.exports=function(t,e,n,s,u){r(e);var l=o(t),c=i(l),f=a(l.length),p=u?f-1:0,h=u?-1:1;if(n<2)for(;;){if(p in c){s=c[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 c&&(s=e(s,c[p],p,l));return s}},function(t,e,n){"use strict";var r=n(14),o=n(7),i=n(74),a=[].slice,s={},u=function(t,e,n){if(!(e in s)){for(var r=[],o=0;o1?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!m(this,t)}}),h&&r(f.prototype,"size",{get:function(){return u(this[v])}}),f},def:function(t,e,n){var r,o,i=m(t,e);return i?i.v=n:(t._l=i={i:o=d(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[v]++,"F"!==o&&(t._i[o]=i)),t},getEntry:m,setStrong:function(t,e,n){c(t,e,function(t,e){this._t=t,this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?"keys"==e?f(0,n.k):"values"==e?f(0,n.v):f(0,[n.k,n.v]):(t._t=void 0,f(1))},n?"entries":"values",!n,!0),p(e)}}},function(t,e,n){var r=n(60),o=n(147);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return o(this)}}},function(t,e,n){"use strict";var r=n(45),o=n(36).getWeak,i=n(4),a=n(7),s=n(40),u=n(53),l=n(27),c=n(13),f=l(5),p=l(6),h=0,d=function(t){return t._l||(t._l=new v)},v=function(){this.a=[]},m=function(t,e){return f(t.a,function(t){return t[0]===e})};v.prototype={get:function(t){var e=m(this,t);if(e)return e[1]},has:function(t){return!!m(this,t)},set:function(t,e){var n=m(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=p(this.a,function(e){return e[0]===t});return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,i){var l=t(function(t,r){s(t,l,e,"_i"),t._i=h++,t._l=void 0,void 0!=r&&u(r,n,t[i],t)});return r(l.prototype,{delete:function(t){if(!a(t))return!1; var e=o(t);return e===!0?d(this).delete(t):e&&c(e,this._i)&&delete e[this._i]},has:function(t){if(!a(t))return!1;var e=o(t);return e===!0?d(this).has(t):e&&c(e,this._i)}}),l},def:function(t,e,n){var r=o(i(e),!0);return r===!0?d(t).set(e,n):r[t._i]=n,t},ufstore:d}},function(t,e,n){t.exports=!n(9)&&!n(6)(function(){return 7!=Object.defineProperty(n(98)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(7),o=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&o(t)===t}},function(t,e,n){var r=n(4);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,e,n){"use strict";var r=n(44),o=n(78),i=n(62),a=n(12),s=n(61),u=Object.assign;t.exports=!u||n(6)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=r})?function(t,e){for(var n=a(t),u=arguments.length,l=1,c=o.f,f=i.f;u>l;)for(var p,h=s(arguments[l++]),d=c?r(h).concat(c(h)):r(h),v=d.length,m=0;v>m;)f.call(h,p=d[m++])&&(n[p]=h[p]);return n}:u},function(t,e,n){var r=n(10),o=n(4),i=n(44);t.exports=n(9)?Object.defineProperties:function(t,e){o(t);for(var n,a=i(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},function(t,e,n){var r=n(18),o=n(43).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(t){try{return o(t)}catch(t){return a.slice()}};t.exports.f=function(t){return a&&"[object Window]"==i.call(t)?s(t):o(r(t))}},function(t,e,n){var r=n(13),o=n(18),i=n(70)(!1),a=n(111)("IE_PROTO");t.exports=function(t,e){var n,s=o(t),u=0,l=[];for(n in s)n!=a&&r(s,n)&&l.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~i(l,n)||l.push(n));return l}},function(t,e,n){var r=n(44),o=n(18),i=n(62).f;t.exports=function(t){return function(e){for(var n,a=o(e),s=r(a),u=s.length,l=0,c=[];u>l;)i.call(a,n=s[l++])&&c.push(t?[n,a[n]]:a[n]);return c}}},function(t,e,n){var r=n(43),o=n(78),i=n(4),a=n(5).Reflect;t.exports=a&&a.ownKeys||function(t){var e=r.f(i(t)),n=o.f;return n?e.concat(n(t)):e}},function(t,e,n){var r=n(5).parseFloat,o=n(56).trim;t.exports=1/r(n(116)+"-0")!==-(1/0)?function(t){var e=o(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},function(t,e,n){var r=n(5).parseInt,o=n(56).trim,i=n(116),a=/^[\-+]?0[xX]/;t.exports=8!==r(i+"08")||22!==r(i+"0x16")?function(t,e){var n=o(String(t),3);return r(n,e>>>0||(a.test(n)?16:10))}:r},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t===1/e:t!=t&&e!=e}},function(t,e,n){var r=n(11),o=n(115),i=n(24);t.exports=function(t,e,n,a){var s=String(i(t)),u=s.length,l=void 0===n?" ":String(n),c=r(e);if(c<=u||""==l)return s;var f=c-u,p=o.call(l,Math.ceil(f/l.length));return p.length>f&&(p=p.slice(0,f)),a?p+s:s+p}},function(t,e,n){e.f=n(8)},function(t,e,n){"use strict";var r=n(150);t.exports=n(71)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(this,t);return e&&e.v},set:function(t,e){return r.def(this,0===t?0:t,e)}},r,!0)},function(t,e,n){n(9)&&"g"!=/./g.flags&&n(10).f(RegExp.prototype,"flags",{configurable:!0,get:n(73)})},function(t,e,n){"use strict";var r=n(150);t.exports=n(71)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(this,t=0===t?0:t,t)}},r)},function(t,e,n){"use strict";var r,o=n(27)(0),i=n(16),a=n(36),s=n(158),u=n(152),l=n(7),c=a.getWeak,f=Object.isExtensible,p=u.ufstore,h={},d=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},v={get:function(t){if(l(t)){var e=c(t);return e===!0?p(this).get(t):e?e[this._i]:void 0}},set:function(t,e){return u.def(this,t,e)}},m=t.exports=n(71)("WeakMap",d,v,u,!0,!0);7!=(new m).set((Object.freeze||Object)(h),7).get(h)&&(r=u.getConstructor(d),s(r.prototype,v),a.NEED=!0,o(["delete","has","get","set"],function(t){var e=m.prototype,n=e[t];i(e,t,function(e,o){if(l(e)&&!f(e)){this._f||(this._f=new r);var i=this._f[t](e,o);return"set"==t?this:i}return n.call(this,e,o)})}))},function(t,e,n){"use strict";function r(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function o(t){var e=new r;e.pre=t.pre,e.body=t.body,e.post=t.post;var n=t.args.slice(0);e.argTypes=n;for(var o=0;o0)throw new Error("cwise: pre() block may not reference array args");if(o0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(o),e.shimArgs.push("scalar"+o);else if("index"===a){if(e.indexArgs.push(o),o0)throw new Error("cwise: pre() block may not reference array index");if(o0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(o),on.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,i(e)}var i=n(475);t.exports=o},function(t,e,n){"use strict";function r(t,e,n){var o=0|t[n];if(o<=0)return[];var i,a=new Array(o);if(n===t.length-1)for(i=0;i0)return o(0|t,e);break;case"object":if("number"==typeof t.length)return r(t,e,0)}return[]}t.exports=i},function(t,e,n){function r(t){var e=this.__data__=new o(t);this.size=e.size}var o=n(81),i=n(578),a=n(579),s=n(580),u=n(581),l=n(582);r.prototype.clear=i,r.prototype.delete=a,r.prototype.get=s,r.prototype.has=u,r.prototype.set=l,t.exports=r},function(t,e){function n(t,e){for(var n=-1,r=e.length,o=t.length;++n0&&n(c)?e>1?r(c,e-1,n,a,s):o(s,c):a||(s[s.length]=c)}return s}var o=n(176),i=n(552);t.exports=r},function(t,e,n){function r(t,e){return t&&o(t,e,i)}var o=n(500),i=n(50);t.exports=r},function(t,e,n){var r=n(49),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e,n){function r(t,e,n,r,l,c){var f=n&s,p=t.length,h=e.length;if(p!=h&&!(f&&h>p))return!1;var d=c.get(t);if(d&&c.get(e))return d==e;var v=-1,m=!0,_=n&u?new o:void 0;for(c.set(t,e),c.set(e,t);++v=0;--o)r[o]=n,n*=t[o];return l(f.malloc(n,e),t,r,0)}function i(t){"generic"!==t.dtype&&"array"!==t.dtype&&f.free(t.data)}function a(t,e){e||(e="double");for(var n=1,r=new Array(t.length),o=t.length-1;o>=0;--o)r[o]=n,n*=t[o];for(var i=f.malloc(n,e),o=0;o=0;--o)r[o]=n,n*=t[o];for(var i=f.malloc(n,e),o=0;o=0;--n)i[n]=o,o*=t[n];var a=f.malloc(o,e);for(n=0;n=0;n--)u+=i[n],s=Math.min(s,t[n]);for(n=0,r=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var n=e.filepaths,r=void 0===n?{}:n,o=e.headers,a=void 0===o?{}:o,s=e.filesystem,u=void 0!==s&&s,l=e.gpu,c=void 0!==l&&l,f=e.pipeline,p=void 0!==f&&f,h=e.layerCallPauses,d=void 0!==h&&h;if(!r.model||!r.weights||!r.metadata)throw new Error("File paths must be declared for model, weights, and metadata.");this.filepaths=r,this.filetypes={model:"json",weights:"arraybuffer",metadata:"json"},this.headers=a,this.filesystem="undefined"==typeof window&&u,this.gpu="undefined"!=typeof window&&c,this.pipeline=!!this.gpu&&p,this.layerCallPauses=d,this.data={model:{},weights:null,metadata:[]},this.dataRequestProgress={model:0,weights:0,metadata:0},this.modelLayersMap=new Map,this.layersWithResults=[],this.modelDAG={},this.inputTensors={},this._ready=this._initialize(),this.isRunning=!1}return u(t,[{key:"ready",value:function(){return this._ready}},{key:"_interrupt",value:function(){R.cancel()}},{key:"_initialize",value:function(){var t=this,e=["model","weights","metadata"];return s.default.all(e.map(function(e){return t.filesystem?t._dataRequestFS(e):t._dataRequestHTTP(e,t.headers)})).then(function(){return t._createLayers(),s.default.resolve()}).catch(function(e){console.log(e),t._interrupt()})}},{key:"_dataRequestFS",value:function(t){var e=this,r=s.default.promisify(n(637).readFile),o=this.filetypes[t],i="json"===o?"utf8":void 0;return r(this.filepaths[t],i).then(function(n){if("json"===o)e.data[t]=JSON.parse(n);else{if("arraybuffer"!==o)throw new Error("Invalid file type: "+o);e.data[t]=n.buffer}e.dataRequestProgress[t]=100}).catch(function(t){throw t})}},{key:"_dataRequestHTTP",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c.default.get(this.filepaths[t],{responseType:this.filetypes[t],headers:n,onDownloadProgress:function(n){if(n.lengthComputable){var r=Math.round(100*n.loaded/n.total);e.dataRequestProgress[t]=r}},cancelToken:R.token}).then(function(n){e.data[t]=n.data,e.dataRequestProgress[t]=100}).catch(function(t){if(!c.default.isCancel(t))throw t;console.log("Data request canceled",t.message)})}},{key:"getLoadingProgress",value:function(){var t=(0,w.default)(this.dataRequestProgress);return Math.round((0,E.default)(t)/t.length)}},{key:"toggleGpu",value:function(t){"undefined"==typeof t?this.gpu=!this.gpu:this.gpu=t;var e=!0,n=!1,r=void 0;try{for(var o,i=this.modelLayersMap.values()[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;a.toggleGpu(this.gpu)}}catch(t){n=!0,r=t}finally{try{!e&&i.return&&i.return()}finally{if(n)throw r}}}},{key:"_createLayers",value:function(){var t=this,e=this.data.model.class_name,n=[];"Sequential"===e?n=this.data.model.config:"Model"===e&&(n=this.data.model.config.layers),n.forEach(function(r,o){var i=r.class_name,a=r.config;if(!(i in j))throw new Error("Layer "+i+" specified in model configuration is not implemented!");if("Sequential"===e&&0===o){var s="input",u=a.batch_input_shape.slice(1),l=new j.InputLayer({name:s,shape:u});t.modelLayersMap.set(s,l),t.modelDAG[s]={layerClass:"InputLayer",name:s,inbound:[],outbound:[]},t.inputTensors[s]=new C.default([],u)}else if("Model"===e&&"InputLayer"===i){var c=a.batch_input_shape.slice(1);t.inputTensors[a.name]=new C.default([],c)}var f=void 0;if("Bidirectional"===i||"TimeDistributed"===i){var p=(0,h.default)(a,function(t,e){return(0,v.default)(e)}),d=a.layer.config,m=a.layer.class_name,g=(0,h.default)(d,function(t,e){return(0,v.default)(e)});"activation"in g&&(g.activation=(0,v.default)(g.activation)),"innerActivation"in g&&(g.innerActivation=(0,v.default)(g.innerActivation)),g.gpu=t.gpu,f=new j[i](Object.assign(p,{layer:new j[m](g)}))}else{var y=(0,h.default)(a,function(t,e){return(0,v.default)(e)});"activation"in y&&(y.activation=(0,v.default)(y.activation)),"innerActivation"in y&&(y.innerActivation=(0,v.default)(y.innerActivation)),y.gpu=t.gpu,y.pipeline=t.pipeline,f=new j[i](y)}var b=[];if("Bidirectional"===i){var w=a.layer.config.name,x=w.replace(/forward/,"backward"),E=f.forwardLayer.params.map(function(t){return w+"_"+t}),T=f.backwardLayer.params.map(function(t){return x+"_"+t});b=E.concat(T)}else b="TimeDistributed"===i?f.layer.params.map(function(t){return a.layer.config.name+"_"+t}):f.params.map(function(t){return a.name+"_"+t});if(b&&b.length){var O=b.map(function(e){var n=(0,_.default)(t.data.metadata,function(t){var n=new RegExp("^"+e);return t.layer_name===a.name&&n.test(t.weight_name)});if(!n)throw new Error("[Model] error loading weights.");var r=n.offset,o=n.length,i=n.shape;return new C.default(new Float32Array(t.data.weights,r,o),i)});f.setWeights(O)}if(t.modelLayersMap.set(a.name,f),t.modelDAG[a.name]={layerClass:i,name:a.name,inbound:[],outbound:[]},"Sequential"===e)if(0===o){var S="input";t.modelDAG[S].outbound.push(a.name),t.modelDAG[a.name].inbound.push(S)}else{var P=n[o-1].config;t.modelDAG[a.name].inbound.push(P.name),t.modelDAG[P.name].outbound.push(a.name)}else"Model"===e&&r.inbound_nodes&&r.inbound_nodes.length&&r.inbound_nodes[0].forEach(function(e){var n=e[0];t.modelDAG[a.name].inbound.push(n),t.modelDAG[n].outbound.push(a.name)})})}},{key:"_mergeLayerCall",value:function(t,e,n){var r=e.map(function(t){return t.result}),o=r.every(function(t){return t._fromPipeline});return o&&t._pipelineEnabled?n&&(r=r.map(function(t){var e=new C.default([],t.tensor.shape);return e.copyFromWeblasTensor(t.weblasTensor),e._fromPipeline=!0,e._actualShape=t._actualShape.slice(),e})):r=r.map(function(t,r){return t._fromPipeline?e[r].transferFromPipeline(t):n?new C.default(t.tensor.data,t.tensor.shape):t}),t.call(r)}},{key:"_regularLayerCall",value:function(t,e,n){var r=e.result;if(r._fromPipeline&&t._pipelineEnabled){if(n){var o=new C.default([],r.tensor.shape);o.copyFromWeblasTensor(r.weblasTensor),o._fromPipeline=!0,o._actualShape=r._actualShape.slice(),r=o}}else r._fromPipeline?r=e.transferFromPipeline(r):n&&(r=new C.default(r.tensor.data,r.tensor.shape));return t.call(r)}},{key:"_traverseDAG",value:function(){function t(t){return e.apply(this,arguments)}var e=(0,a.coroutine)(regeneratorRuntime.mark(function t(e){var n,r,o,i,a,u,l,c,f,p=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==e.length){t.next=4;break}return t.abrupt("return",!0);case 4:if(1!==e.length){t.next=27;break}if(n=e[0],r=this.modelDAG[n],o=r.layerClass,i=r.inbound,a=r.outbound,"InputLayer"===o){t.next=23;break}if(u=this.modelLayersMap.get(n),!u.visited){t.next=11;break}return t.abrupt("return",!1);case 11:if(l=i.map(function(t){return p.modelLayersMap.get(t)}),(0,P.default)(l.map(function(t){return t.hasResult}))){t.next=14;break}return t.abrupt("return",!1);case 14:if(c=i.map(function(t){return p.modelDAG[t].outbound}).reduce(function(t,e){return t+e.length},0),f=c>=1,u.result="Merge"===o?this._mergeLayerCall(u,l,f):this._regularLayerCall(u,l[0],f),u.hasResult=!0,u.visited=!0,this.layersWithResults.push(u.name),!this.layerCallPauses){t.next=23;break}return t.next=23,s.default.delay(0);case 23:return t.next=25,this._traverseDAG(a);case 25:t.next=29;break;case 27:return t.next=29,s.default.all(e.map(function(t){return p._traverseDAG([t])}));case 29:case"end":return t.stop()}},t,this)}));return t}()},{key:"predict",value:function(){function t(t){return e.apply(this,arguments)}var e=(0,a.coroutine)(regeneratorRuntime.mark(function t(e){var n,r,o,i,a,s,u,l,c,f,p,h,d,v,m=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.isRunning=!0,n=(0,y.default)(this.inputTensors).sort(),(0,O.default)((0,y.default)(e).sort(),n)){t.next=5;break}throw this.isRunning=!1,new Error("predict() must take an object where the keys are the named inputs of the model: "+n+".");case 5:if((0,P.default)(n,function(t){return e[t]instanceof Float32Array})){t.next=8;break}throw this.isRunning=!1,new Error("predict() must take an object where the values are the flattened data as Float32Array.");case 8:for(this.layersWithResults=[],r=!0,o=!1,i=void 0,t.prev=12,a=this.modelLayersMap.values()[Symbol.iterator]();!(r=(s=a.next()).done);r=!0)u=s.value,u.hasResult=!1,u.visited=!1;t.next=20;break;case 16:t.prev=16,t.t0=t.catch(12),o=!0,i=t.t0;case 20:t.prev=20,t.prev=21,!r&&a.return&&a.return();case 23:if(t.prev=23,!o){t.next=26;break}throw i;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return n.forEach(function(t){var n=m.modelLayersMap.get(t);m.inputTensors[t].replaceTensorData(e[t]),n.result=n.call(m.inputTensors[t]),n.hasResult=!0,n.visited=!0}),t.next=31,this._traverseDAG(n);case 31:if(l=this.data.model.class_name,"Sequential"!==l){t.next=40;break}return c=(0,_.default)((0,w.default)(this.modelDAG),function(t){return!t.outbound.length}),f=this.modelLayersMap.get(c.name),p=f.result,h={output:p.tensor.data},this.isRunning=!1,t.abrupt("return",h);case 40:if("Model"!==l){t.next=46;break}return d=(0,w.default)(this.modelDAG).filter(function(t){return!t.outbound.length}),v={},d.forEach(function(t){var e=m.modelLayersMap.get(t.name),n=e.result;v[t.name]=n.tensor.data}),this.isRunning=!1,t.abrupt("return",v);case 46:case"end":return t.stop()}},t,this,[[12,16,20,28],[21,,23,27]])}));return t}()}]),t}();e.default=k},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-4,r=(0,u.default)((0,a.default)(t)),o=e;if(r.length!==o.length)return!1;for(var i=0;io[i]+n)return!1}return!0}Object.defineProperty(e,"__esModule",{value:!0}),e.approxEquals=o;var i=n(199),a=r(i),s=n(190),u=r(s),l=n(596),c=r(l)},function(t,e,n){"use strict";(function(t){function e(t,e,n){t[e]||Object[r](t,e,{writable:!0,configurable:!0,value:n})}if(n(473),n(647),n(293),t._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");t._babelPolyfill=!0;var r="defineProperty";e(String.prototype,"padLeft","".padStart),e(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(t){[][t]&&e(Array,t,Function.call.bind([][t]))})}).call(e,n(39))},function(t,e,n){var r,r;!function(e){t.exports=e()}(function(){return function t(e,n,o){function i(s,u){if(!n[s]){if(!e[s]){var l="function"==typeof r&&r;if(!u&&l)return r(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return i(n?n:t)},f,f.exports,t,e,n,o)}return n[s].exports}for(var a="function"==typeof r&&r,s=0;so;o++)for(var i=0;e>i;i++)r[i*t+o]=n[o*e+i];return r}var m=new a(t),_=new s(t),g=new u(t),y=new l(t),b=new c(t);return{saxpy:n,sscal:o,sgemm:e,sstd:f,sdwns:p,sclmp:h,pipeline:i,gpu:{gl:t,sgemm:i.sgemmcalculator.calculate.bind(i.sgemmcalculator),sscal:i.sscalcalculator.calculate.bind(i.sscalcalculator),sclmp:i.sclmpcalculator.calculate.bind(i.sclmpcalculator),sdwns:i.sdwnscalculator.calculate.bind(i.sdwnscalculator),encode:t.encode.bind(t)},util:{fromArray:d,transpose:v}}}var o=t("./lib/globals"),i=t("./lib/pipeline"),a=t("./lib/sgemmcalculator"),s=t("./lib/saxpycalculator"),u=t("./lib/sscalcalculator"),l=t("./lib/sdwnscalculator"),c=t("./lib/sclmpcalculator");o.gl?e.exports=r(o.gl):e.exports=null},{"./lib/globals":2,"./lib/pipeline":3,"./lib/saxpycalculator":4,"./lib/sclmpcalculator":5,"./lib/sdwnscalculator":6,"./lib/sgemmcalculator":7,"./lib/sscalcalculator":9}],2:[function(t,e,n){var r,o=t("./webgl");try{r=new o}catch(t){r=null,console.log("No support for WebGL!")}e.exports={gl:r}},{"./webgl":11}],3:[function(t,e,n){function r(t){function e(t,e,n){var r=n.shape[0],o=n.shape[1],i=new f([r,o],null);return v.calculate(r,o,t,e,n.texture,i.texture),i}function n(t,e,n,r,o){if(n.shape[1]!==e.shape[1])throw new Error("Second dimension must be of same size for input Tensors (second Tensor is transposed).");var i,a=e.shape[0],s=n.shape[0],u=e.shape[1];i=o?o.texture:null;var l=new f([a,s],null);return h.calculate(a,s,u,t,e.texture,n.texture,r,i,l.texture),l}function r(t,e,n,r){if(r.shape[1]%t!==0)throw new Error("Second dimension of tensor must be a multiple of channels");var o=r.shape[0],i=r.shape[1]/t,a=Math.floor((o-e)/n)+1,s=Math.floor((i-e)/n)+1,u=new f([a,s*t],null);return m.calculate(o,i,t,e,n,r.texture,u.texture),u}function o(t,e,n){t=null!=t?t:Number.MIN_VALUE,e=null!=e?e:Number.MAX_VALUE;var r=n.shape[0],o=n.shape[1],i=new f([r,o],null);return _.calculate(r,o,t,e,n.texture,i.texture),i}function p(t,e,n,r,o){if(o.shape[1]%t!==0)throw new Error("Second dimension of tensor must be a multiple of channels");var i,a,s=o.shape[0],u=o.shape[1]/t;r?(i=Math.ceil((u+2*r-e)/n)+1,a=Math.ceil((s+2*r-e)/n)+1):(r=0,i=Math.ceil((u-e)/n)+1,a=Math.ceil((s-e)/n)+1);var l=e*e*t,c=a*i,p=l,h=new f([c,p],null);return g.calculate(s,u,t,c,p,i,e,n,r,o.texture,h.texture),h}var h=new i(t,!1),d=new a(t,!1),v=new s(t,!1),m=new u(t,!1),_=new l(t,!1),g=new c(t,!1);return{Tensor:f,sscal:e,sgemm:n,sdwns:r,sclmp:o,slokn:p,sgemmcalculator:h,saxpycalculator:d,sscalcalculator:v,sdwnscalculator:m,sclmpcalculator:_,slokncalculator:g}}var o=t("./globals"),i=t("./sgemmcalculator"),a=t("./saxpycalculator"),s=t("./sscalcalculator"),u=t("./sdwnscalculator"),l=t("./sclmpcalculator"),c=t("./slokncalculator"),f=t("./tensor");o.gl?e.exports=r(o.gl):e.exports=null},{"./globals":2,"./saxpycalculator":4,"./sclmpcalculator":5,"./sdwnscalculator":6,"./sgemmcalculator":7,"./slokncalculator":8,"./sscalcalculator":9,"./tensor":10}],4:[function(t,e,n){function r(t,e){this.webgl=t,this.standalone=e||!0;var n="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D X;\t\t// texture with data from padded A\nuniform sampler2D Y;\t\t// texture with data from padded transpose of B\nuniform int N;\nuniform float a; \t\t// coefficient to multiplication\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n \tfloat row = outTex.y;\n\tfloat col = outTex.x;\n\n\t// direct usage of col requires output be padded exactly like input\n\tvec4 x = texture2D( X, vec2(col, row));\n\tvec4 y = texture2D( Y, vec2(col, row));\n\tvec4 sum_v = (a * x) + y;\n\tint channel = int(mod(col * float(N), 4.0 ));\n\tfloat sum = select_index_1604150559(sum_v, channel);\n\n\tif (sum == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n \t// output vec4 with bytes for an IEEE754 32-bit floating point number\n\tgl_FragColor = encode_float_1540259130(sum);\n}\n"; this.standalone?this.program=this.webgl.createProgram(n):this.program=this.webgl.createProgram(p)}t("./webgl");e.exports=r,r.TEXTURE_UNIFORM_NAME_0="X",r.TEXTURE_UNIFORM_NAME_1="Y",r.LENGTH_UNIFORM_NAME="N",r.COEFFICIENT_UNIFORM_NAME="a",r.prototype.calculate=function(t,e,n,o,i){var a=this.webgl.context;this.webgl.selectProgram(this.program),this.bindInputTexture(n,a.TEXTURE0,r.TEXTURE_UNIFORM_NAME_0),this.bindInputTexture(o,a.TEXTURE1,r.TEXTURE_UNIFORM_NAME_1);var s=this.webgl.getPad(t);this.bindUniforms(t+s,e),this.webgl.bindOutputTexture(1,t+s,i),a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(a.TEXTURE0),this.webgl.unbindInputTexture(a.TEXTURE1)},r.prototype.bindInputTexture=function(t,e,n){var r=this.webgl.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.bindUniforms=function(t,e){var n=this.webgl.context,o=n.getUniformLocation(this.program,r.LENGTH_UNIFORM_NAME),i=n.getUniformLocation(this.program,r.COEFFICIENT_UNIFORM_NAME);n.uniform1i(o,t),n.uniform1f(i,e)}},{"./webgl":11}],5:[function(t,e,n){function r(t,e){this.webgl=t,this.standalone=null==e||e;var n="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D X;\t\t// texture with data from padded A\nuniform int N;\t\t// number of columns\nuniform int pad;\t\t// additional columns to nearest multiple of four\nuniform float a; \t\t// lower bound\nuniform float b; \t\t// upper bound\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1604150559(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1540259130(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row = outTex.y;\n\tfloat col = outTex.x;\n\n\t// return 0.0 if in padded region of output texture\n\tif(col * float(N + pad) > float(N) ) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n\t// direct usage of col requires output be padded exactly like input\n\tvec4 x = texture2D( X, vec2(col, row));\n\tvec4 val = clamp(x, a, b);\n\n\t// select and output channel (standalone version only)\n\tint channel = int(mod(col * float(N + pad), 4.0));\n\tfloat sum = select_index_1540259130(val, channel);\n\n\tif (sum == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n\t// output vec4 with bytes for an IEEE754 32-bit floating point number\n\tgl_FragColor = encode_float_1604150559(sum);\n}\n",r="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D X;\t\t// texture with data from padded A\nuniform int N;\t\t// number of columns\nuniform int pad;\t\t// additional columns to nearest multiple of four\nuniform float a; \t\t// lower bound\nuniform float b; \t\t// upper bound\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n\tv.a = 0.0;\n\tif(pad == 2){\n\t\tv.b = 0.0;\n\t} else if(pad == 3){\n\t\tv.b = 0.0;\n\t\tv.g = 0.0;\n\t}\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tfloat col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n\n\t// direct usage of col requires output be padded exactly like input\n\tvec4 x = texture2D( X, vec2(col_t, row_t));\n\tvec4 val_v = clamp(x, a, b);\n\n\t// is last element in pixel past row length?\n\tif(pad > 0 && (col + 4.0) > float(N) ) {\n\t\t// fix elements in padded region\n\t\tfix_pad_1540259130(val_v, pad);\n\t}\n\n\tgl_FragColor = val_v;\n}\n";this.standalone?this.program=this.webgl.createProgram(n):this.program=this.webgl.createProgram(r)}t("./webgl");e.exports=r,r.TEXTURE_UNIFORM_NAME_0="X",r.LENGTH_UNIFORM_NAME="N",r.LOWER_UNIFORM_NAME="a",r.UPPER_UNIFORM_NAME="b",r.prototype.calculate=function(t,e,n,o,i,a){n=null!=n?n:Number.MIN_VALUE,o=null!=o?o:Number.MAX_VALUE;var s=this.webgl.context;this.webgl.selectProgram(this.program),this.bindInputTexture(i,s.TEXTURE0,r.TEXTURE_UNIFORM_NAME_0);var u=this.webgl.getPad(e);this.bindUniforms(e,u,n,o),this.standalone?this.webgl.bindOutputTexture(t,e+u,a):this.webgl.bindOutputTexture(t,(e+u)/4,a),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(s.TEXTURE0)},r.prototype.bindInputTexture=function(t,e,n){var r=this.webgl.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.bindUniforms=function(t,e,n,o){var i=this.webgl.context,a=i.getUniformLocation(this.program,r.LENGTH_UNIFORM_NAME),s=i.getUniformLocation(this.program,r.UPPER_UNIFORM_NAME),u=i.getUniformLocation(this.program,r.LOWER_UNIFORM_NAME),l=i.getUniformLocation(this.program,"pad");i.uniform1i(a,t),i.uniform1i(l,e),i.uniform1f(u,n),i.uniform1f(s,o)}},{"./webgl":11}],6:[function(t,e,n){function r(t,e){this.webgl=t,this.standalone=null==e||e;var n="// TODO: unroll loop for stride == factor and small values (2, 3)\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex; // texture coords of row/column to calculate\nuniform sampler2D X; // texture with data from padded A\nuniform int factor; // width of image patch\nuniform float stride; // width between image patches\nuniform float C; // number of channels\nuniform float M;\nuniform float N;\nuniform float N_out;\nuniform float M_out;\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate and translate to output pixel space.\n\tfloat row = floor(outTex.y * M_out); // row on output texture (matrix space)\n\tfloat col = floor(outTex.x * N_out); // column on output texture (matrix space)\n\tfloat vcol = floor(col / C); // virtual column on output texture (matrix space)\n\tfloat vchannel = floor(mod(col, C)); // virtual channel on output texture\n\n\tconst float min = -1.0e+08;\n\tvec4 currentMax = vec4(min, min, min, min);\n\n\tfloat deltaY = 1.0/M;\n\tfloat deltaX = 1.0/N;\n\tfloat y = ((row * stride) + 0.5)*deltaY; // texture position of input row\n\tfloat x;\n\tfloat z = vchannel * deltaX;\n\tfor (int i = 0; i < 100; i += 1) {\n\t\tif (i >= factor) {\n\t\t\tbreak;\n\t\t}\n\t\tx = ((vcol * stride * C) + 0.5) * deltaX; // texture position of input column\n\n\t\tfor (int j = 0; j < 100; j += 1) {\n\t\t\tif (j >= factor) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tvec2 coords = vec2(x + z, y);\n\t\t\tvec4 x_v = texture2D(X, coords);\n\t\t\tcurrentMax = max(currentMax, x_v);\n\n\t\t\tx += (deltaX * C);\n\t\t}\n\t\ty += deltaY;\n\t}\n\tint chan = int(mod(outTex.x * N_out, 4.0 ));\n\tfloat val = select_index_1604150559(currentMax, int(chan));\n\tif (val == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n\tgl_FragColor = encode_float_1540259130(val);\n}\n";p="// TODO: unroll loop for stride == factor and small values (2, 3)\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex; // texture coords of row/column to calculate\nuniform sampler2D X; // texture with data from padded A\nuniform int factor; // width of image patch\nuniform float stride; // width between image patches\nuniform float C; // number of channels\nuniform float M;\nuniform float N;\nuniform float N_out;\nuniform float M_out;\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate and translate to output pixel space.\n\tfloat row = floor(outTex.y * M_out); // row on output texture (pixel space)\n\tfloat col = floor(outTex.x * N_out); // column on output texture (matrix space)\n\tfloat vcol = floor(col / C); // virtual column on output texture (matrix space)\n\tfloat vchannel = floor(mod(col, C)); // virtual channel on output texture\n\n\tconst float min = -1.0e+08;\n\tvec4 currentMax = vec4(min, min, min, min);\n\n\tfloat deltaY = 1.0/M;\n\tfloat deltaX = 1.0/N;\n\tfloat y = ((row * stride) + 0.5)*deltaY; // texture position of input row\n\tfloat x;\n\tfloat z = vchannel * deltaX;\n\tfor (int i = 0; i < 100; i += 1) {\n\t\tif (i >= factor) {\n\t\t\tbreak;\n\t\t}\n\t\tx = ((vcol * stride * C) + 0.5) * deltaX; // texture position of input column\n\n\t\tfor (int j = 0; j < 100; j += 1) {\n\t\t\tif (j >= factor) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tvec2 coords = vec2(x + z, y);\n\t\t\tvec4 x_v = texture2D(X, coords);\n\t\t\tcurrentMax = max(currentMax, x_v);\n\n\t\t\tx += (deltaX * C);\n\t\t}\n\t\ty += deltaY;\n\t}\n\n\tgl_FragColor = currentMax;\n}\n",this.standalone?this.program=this.webgl.createProgram(n):this.program=this.webgl.createProgram(p)}var o=t("./webgl");e.exports=r,r.TEXTURE_UNIFORM_NAME_0="X",r.INPUT_ROW_COUNT_UNIFORM_NAME="M",r.INPUT_COLUMN_COUNT_UNIFORM_NAME="N",r.OUTPUT_ROW_COUNT_UNIFORM_NAME="M_out",r.OUTPUT_COLUMN_COUNT_UNIFORM_NAME="N_out",r.FACTOR_UNIFORM_NAME="factor",r.STRIDE_UNIFORM_NAME="stride",r.CHANNEL_COUNT_UNIFORM_NAME="C",r.prototype.calculate=function(t,e,n,i,a,s,u){if(n%o.COMPONENTS_PER_TEXEL!=0)throw new Error("Channel count must be a multiple of "+o.COMPONENTS_PER_TEXEL);var l=this.webgl.context,c=(Math.floor((e-i)/a)+1)*n,f=Math.floor((t-i)/a)+1;this.webgl.selectProgram(this.program),this.bindInputTexture(s,l.TEXTURE0,r.TEXTURE_UNIFORM_NAME_0),this.bindUniforms(t,e*n,f,c,i,a,n),this.standalone?this.webgl.bindOutputTexture(f,c,u):this.webgl.bindOutputTexture(f,c/o.COMPONENTS_PER_TEXEL,u),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(l.TEXTURE0)},r.prototype.bindInputTexture=function(t,e,n){var r=this.webgl.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.bindUniforms=function(t,e,n,o,i,a,s){var u=this.webgl.context,l=u.getUniformLocation(this.program,r.INPUT_ROW_COUNT_UNIFORM_NAME),c=u.getUniformLocation(this.program,r.INPUT_COLUMN_COUNT_UNIFORM_NAME),f=u.getUniformLocation(this.program,r.OUTPUT_ROW_COUNT_UNIFORM_NAME),p=u.getUniformLocation(this.program,r.OUTPUT_COLUMN_COUNT_UNIFORM_NAME),h=u.getUniformLocation(this.program,r.FACTOR_UNIFORM_NAME),d=u.getUniformLocation(this.program,r.STRIDE_UNIFORM_NAME),v=u.getUniformLocation(this.program,r.CHANNEL_COUNT_UNIFORM_NAME);u.uniform1f(l,t),u.uniform1f(c,e),u.uniform1f(f,n),u.uniform1f(p,o),u.uniform1i(h,i),u.uniform1f(d,a),u.uniform1f(v,s)}},{"./webgl":11}],7:[function(t,e,n){function r(t,e){this.webgl=t,this.standalone=null==e||e;var n="// fragment shader that calculates the matrix product and renders each\n// element to the bytes representing a 32-bit IEEE754 floating point in\n// the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform sampler2D B_t;\t\t// texture with data from padded transpose of B\nuniform int K;\t\t// number of elements in shared dimension\nuniform int N;\t\t// number of columns in output\nuniform int pad;\t\t//\nuniform float alpha; \t// coefficient to multiplication\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n\tfloat delta_t = 1./float(K);// space (on texture) between elements\n\tfloat sum = 0.;\t\t\t// sum for this row/column pair\n\tfloat z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n\tfor (int l=0 ; l<4096 ; ++l) {\n\t\tif(l >= K / 4) break; // stop when we finish the row/column\n\t\t// l is in pixel space, so we divide by four\n\n\t\t// retrieve next four elements from each texture\n\t\tvec4 a_ik = texture2D( A, vec2(z, y));\n\t\tvec4 b_kj = texture2D(B_t, vec2(z, x));\n\n\t// use `dot` to process four elements at a time\n\t\tsum += dot(a_ik, b_kj);\n\t\tz += (4.0 * delta_t); // (z + 0.5)*delta\n\t}\n\treturn sum;\n}\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1604150559(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\n\t// sum row x col for the passed pixel\n\tfloat sum = alpha * dot_rowcol_1540259130(row_t, col_t * float(N + pad)/float(N), A, B_t, K);\n\n\tif (sum == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n\t// output vec4 with bytes for an IEEE754 32-bit floating point number\n\tgl_FragColor = encode_float_1604150559(sum);\n}\n",r="// fragment shader that calculates the matrix product (with additive 'C' term)\n// and renders each element to the bytes representing a 32-bit IEEE754 floating\n// point in the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform sampler2D B_t;\t\t// texture with data from padded transpose of B\nuniform sampler2D C;\t\t// texture with data from C\nuniform int K;\t\t// number of elements in shared dimension\nuniform int N;\t\t// number of columns in output\nuniform int pad;\t\t//\nuniform float alpha; \t// coefficient to multiplication\nuniform float beta; \t// coefficient to additive term\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n\tfloat delta_t = 1./float(K);// space (on texture) between elements\n\tfloat sum = 0.;\t\t\t// sum for this row/column pair\n\tfloat z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n\tfor (int l=0 ; l<4096 ; ++l) {\n\t\tif(l >= K / 4) break; // stop when we finish the row/column\n\t\t// l is in pixel space, so we divide by four\n\n\t\t// retrieve next four elements from each texture\n\t\tvec4 a_ik = texture2D( A, vec2(z, y));\n\t\tvec4 b_kj = texture2D(B_t, vec2(z, x));\n\n\t// use `dot` to process four elements at a time\n\t\tsum += dot(a_ik, b_kj);\n\t\tz += (4.0 * delta_t); // (z + 0.5)*delta\n\t}\n\treturn sum;\n}\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1117569599(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tvec4 c_vec = texture2D(C, vec2(col_t, 0.5));\n\n\t// should be -0.5, but that subtly breaks at zero\n\tfloat col = col_t * float(N + pad); // index of first element in pixel (matrix space)\n\tint channel = int(mod(col, 4.0 ));\n\tfloat c = select_index_1604150559(c_vec, channel);\n\n\t// sum row x col for the passed pixel\n\tfloat sum = alpha * dot_rowcol_1540259130(row_t, col_t * float(N + pad)/float(N), A, B_t, K);\n\tsum += beta * c;\n\n\tif (sum == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n\t// output vec4 with bytes for an IEEE754 32-bit floating point number\n\tgl_FragColor = encode_float_1117569599(sum);\n}\n",o="// fragment shader that calculates the matrix product and writes each\n// element to a pixel component in a floating point texture.\n// the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform sampler2D B_t;\t\t// texture with data from padded transpose of B\nuniform int K;\t\t// number of elements in shared dimension\nuniform int N;\t\t// number of columns in output\nuniform int pad;\t\t//\nuniform float alpha; \t// coefficient to multiplication\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n\tfloat delta_t = 1./float(K);// space (on texture) between elements\n\tfloat sum = 0.;\t\t\t// sum for this row/column pair\n\tfloat z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n\tfor (int l=0 ; l<4096 ; ++l) {\n\t\tif(l >= K / 4) break; // stop when we finish the row/column\n\t\t// l is in pixel space, so we divide by four\n\n\t\t// retrieve next four elements from each texture\n\t\tvec4 a_ik = texture2D( A, vec2(z, y));\n\t\tvec4 b_kj = texture2D(B_t, vec2(z, x));\n\n\t// use `dot` to process four elements at a time\n\t\tsum += dot(a_ik, b_kj);\n\t\tz += (4.0 * delta_t); // (z + 0.5)*delta\n\t}\n\treturn sum;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\n\tvec4 sum_v = vec4(0.0, 0.0, 0.0, 0.0);\n\tfloat col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n\tsum_v.r = alpha * dot_rowcol_1540259130(row_t, (col + 0.5)/float(N), A, B_t, K);\n\t// is last element in pixel past row length?\n\tif(pad > 0 && (col + 4.0) > float(N) ) {\n\t\t// compute elements in padded region\n\t\tif(pad < 3){\n\t\t\tsum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n\t\t}\n\t\tif(pad < 2){\n\t\t\tsum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n\t\t}\n\t} else {\n\t\tsum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n\t\tsum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n\t\tsum_v.a = alpha * dot_rowcol_1540259130(row_t, (col + 3.5)/float(N), A, B_t, K);\n\t}\n\n\tgl_FragColor = sum_v;\n}\n",i="// fragment shader that calculates the matrix product and writes each\n// element to a pixel component in a floating point texture.\n// the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform sampler2D B_t;\t\t// texture with data from padded transpose of B\nuniform sampler2D C;\t\t// texture with data from C\nuniform int K;\t\t// number of elements in shared dimension\nuniform int N;\t\t// number of columns in output\nuniform int pad;\t\t//\nuniform float alpha; \t// coefficient to multiplication\nuniform float beta; \t// coefficient to addition\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n\tfloat delta_t = 1./float(K);// space (on texture) between elements\n\tfloat sum = 0.;\t\t\t// sum for this row/column pair\n\tfloat z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n\tfor (int l=0 ; l<4096 ; ++l) {\n\t\tif(l >= K / 4) break; // stop when we finish the row/column\n\t\t// l is in pixel space, so we divide by four\n\n\t\t// retrieve next four elements from each texture\n\t\tvec4 a_ik = texture2D( A, vec2(z, y));\n\t\tvec4 b_kj = texture2D(B_t, vec2(z, x));\n\n\t// use `dot` to process four elements at a time\n\t\tsum += dot(a_ik, b_kj);\n\t\tz += (4.0 * delta_t); // (z + 0.5)*delta\n\t}\n\treturn sum;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tvec4 c_v = texture2D(C, vec2(col_t, 0.5));\n\n\tvec4 sum_v = vec4(0.0, 0.0, 0.0, 0.0);\n\tfloat col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n\tsum_v.r = alpha * dot_rowcol_1540259130(row_t, (col + 0.5)/float(N), A, B_t, K);\n\t// in the padding region?\n\tif(pad > 0 && (col + 4.0) > float(N) ) {\n\t\t// pad\n\t\tif(pad < 3){\n\t\t\tsum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n\t\t}\n\t\tif(pad < 2){\n\t\t\tsum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n\t\t}\n\t} else {\n\t\tsum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n\t\tsum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n\t\tsum_v.a = alpha * dot_rowcol_1540259130(row_t, (col + 3.5)/float(N), A, B_t, K);\n\t}\n\n\tgl_FragColor = sum_v + beta*c_v;\n}\n";this.standalone?(this.program_=this.webgl.createProgram(n),this.program_c=this.webgl.createProgram(r)):(this.program_=this.webgl.createProgram(o),this.program_c=this.webgl.createProgram(i))}t("./webgl");e.exports=r,r.TEXTURE_UNIFORM_NAME_0="A",r.TEXTURE_UNIFORM_NAME_1="B_t",r.TEXTURE_UNIFORM_NAME_2="C",r.SHARED_LENGTH_UNIFORM_NAME="K",r.COLUMN_COUNT_UNIFORM_NAME="N",r.PAD_UNIFORM_NAME="pad",r.ALPHA_UNIFORM_NAME="alpha",r.BETA_UNIFORM_NAME="beta",r.prototype.calculate=function(t,e,n,o,i,a,s,u,l){var c=this.webgl.context;null!=u?this.program=this.program_c:(s=null,this.program=this.program_),this.webgl.selectProgram(this.program),this.bindInputTexture(i,c.TEXTURE0,r.TEXTURE_UNIFORM_NAME_0),this.bindInputTexture(a,c.TEXTURE1,r.TEXTURE_UNIFORM_NAME_1),null!=u&&this.bindInputTexture(u,c.TEXTURE2,r.TEXTURE_UNIFORM_NAME_2);var f=this.webgl.getPad(n),p=this.webgl.getPad(e);this.bindUniforms(e,n+f,p,o,s),this.standalone?this.webgl.bindOutputTexture(t,e+p,l):this.webgl.bindOutputTexture(t,(e+p)/4,l),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(c.TEXTURE0),this.webgl.unbindInputTexture(c.TEXTURE1),this.webgl.unbindInputTexture(c.TEXTURE2)},r.prototype.bindInputTexture=function(t,e,n){var r=this.webgl.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.bindUniforms=function(t,e,n,o,i){var a=this.webgl.context,s=a.getUniformLocation(this.program,r.SHARED_LENGTH_UNIFORM_NAME),u=a.getUniformLocation(this.program,r.ALPHA_UNIFORM_NAME),l=a.getUniformLocation(this.program,r.BETA_UNIFORM_NAME),c=a.getUniformLocation(this.program,r.COLUMN_COUNT_UNIFORM_NAME),f=f=a.getUniformLocation(this.program,r.PAD_UNIFORM_NAME);a.uniform1f(l,i),a.uniform1i(c,t),a.uniform1i(f,n),a.uniform1i(s,e),a.uniform1f(u,o)}},{"./webgl":11}],8:[function(t,e,n){function r(t,e){this.webgl=t,this.standalone=null==e||e;var n="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex; // texture coords of row/column to calculate\nuniform sampler2D X; // texture with data from padded A\nuniform float factor; // width of image patch\nuniform float stride; // width between image patches\nuniform float margin;\nuniform float N_p; // patches across\nuniform float M;\nuniform float N;\nuniform float pad;\nuniform float M_in;\nuniform float N_in;\nuniform float C; // number of channels in input\nuniform float pad_in;\n\n// select an element from a vector based on index\nfloat select_index_1540259130(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\n// translate a linear index into x, y coordinates for a matrix\nvec2 linear_index_coords_1604150559(float linear_index, float row_length){\n\tvec2 coords;\n\n\tcoords.x = floor(mod(linear_index + 0.5, row_length)); // column\n\tcoords.y = floor((linear_index + 0.5) / row_length); // row\n\n\treturn coords;\n}\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1117569599(inout vec4 v, int pad){\n\tv.a = 0.0;\n\tif(pad == 2){\n\t\tv.b = 0.0;\n\t} else if(pad == 3){\n\t\tv.b = 0.0;\n\t\tv.g = 0.0;\n\t}\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\n\t// row corresponds to patch\n\tfloat row = floor(row_t * M) + 0.5;\n\t// column corresponds to placement in patch\n\tfloat col_0 = floor(col_t * (N + pad) - 1.5); // index of first element in output pixel (matrix space)\n\n\t// N_p = patches across\n\tfloat col_patch = floor(mod(row, N_p)); // column index in grid of patches\n\tfloat row_patch = floor(row / N_p); // row index in grid of patches\n\tfloat col_in_0 = (col_patch * stride - margin) * C; // input column index of left element in patch\n\tfloat row_in_0 = row_patch * stride - margin; // input row index of top element in patch\n\n\tvec4 pixel_in;\n\tvec4 result = vec4(0.0, 0.0, 0.0, 0.0);\n\tvec2 coords = linear_index_coords_1604150559(col_0, factor * C); // coords inside patch\n\tvec2 ncoords;\n\tint channel_in = int(mod(col_in_0 + coords.x, 4.0));\n\tvec2 scale_in = vec2(1.0/(N_in + pad_in), 1.0/M_in); // scale from matrix to input texture coords\n\tvec2 offset_in = vec2(col_in_0 + 2.0 - float(channel_in), row_in_0 + 0.5); // offset into patch (and pixel)\n\n\tconst vec2 pixel_scale = vec2(1.0/4.0, 1.0); // scale from matrix to pixel coords\n\n\tpixel_in = texture2D(X, (coords + offset_in) * scale_in);\n\n\t// go through channels for current output pixel\n\tfor(int channel = 0; channel < 4; channel++){\n\n\t\t// are we on a new input pixel?\n\t\tncoords = linear_index_coords_1604150559(col_0 + float(channel), factor * C);\n\n\t\t// are we in the margin or outside the input texture?\n\t\tif((col_in_0 + ncoords.x + 0.5 < 0.0) || (row_in_0 + ncoords.y + 0.5 < 0.0) ||\n\t\t (col_in_0 + ncoords.x + 0.5) > (N_in) || row_in_0 + ncoords.y + 0.5 > M_in){\n\t\t\t// yes, create a virtual pixel\n\t\t\tpixel_in = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t} else if(floor(ncoords * pixel_scale) != floor(coords * pixel_scale)){\n\t\t\t// no, get the get the next real pixel\n\t\t\tcoords = ncoords;\n\t\t\toffset_in.x += float(channel_in);\n\t\t\tchannel_in = 0;\n\t\t\tpixel_in = texture2D(X, (coords + offset_in) * scale_in);\n\t\t}\n\n\t\tif(channel == 0){\n\t\t\tresult.r = select_index_1540259130(pixel_in, channel_in);\n\t\t} else if(channel == 1){\n\t\t\tresult.g = select_index_1540259130(pixel_in, channel_in);\n\t\t} else if(channel == 2){\n\t\t\tresult.b = select_index_1540259130(pixel_in, channel_in);\n\t\t} else {\n\t\t\tresult.a = select_index_1540259130(pixel_in, channel_in);\n\t\t}\n\n\t\tchannel_in++;\n\t\toffset_in.x -= 1.0;\n\t}\n\n\t// fix padded region\n\tif(pad > 0.0 && col_0 + 4.0 > N ) {\n\t\tfix_pad_1117569599(result, int(pad));\n\t}\n\n\t//gl_FragColor = vec4(row_in_0, col_in_0, channel_in, N_p);\n\tgl_FragColor = result;\n}\n"; this.standalone?this.program=this.webgl.createProgram(s):this.program=this.webgl.createProgram(n)}t("./webgl");e.exports=r,r.TEXTURE_UNIFORM_NAME_0="X",r.STRIDE_UNIFORM_NAME="stride",r.KERNEL_WIDTH_UNIFORM_NAME="factor",r.prototype.calculate=function(t,e,n,o,i,a,s,u,l,c,f){var p=this.webgl.context,h=this.webgl.getPad(e*n),d=this.webgl.getPad(i);this.webgl.selectProgram(this.program),this.bindInputTexture(c,p.TEXTURE0,r.TEXTURE_UNIFORM_NAME_0),this.bindUniforms(o,i,d,t,e*n,n,h,a,s,u,l),this.standalone?this.webgl.bindOutputTexture(o,i+d,f):this.webgl.bindOutputTexture(o,(i+d)/4,f),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(p.TEXTURE0)},r.prototype.bindInputTexture=function(t,e,n){var r=this.webgl.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.bindUniforms=function(t,e,n,o,i,a,s,u,l,c,f){var p=this.webgl.context,h=p.getUniformLocation(this.program,"M"),d=p.getUniformLocation(this.program,"N"),v=p.getUniformLocation(this.program,"C"),m=p.getUniformLocation(this.program,"M_in"),_=p.getUniformLocation(this.program,"N_in"),g=p.getUniformLocation(this.program,r.STRIDE_UNIFORM_NAME),y=p.getUniformLocation(this.program,r.KERNEL_WIDTH_UNIFORM_NAME),b=p.getUniformLocation(this.program,"pad"),w=p.getUniformLocation(this.program,"pad_in"),x=p.getUniformLocation(this.program,"N_p");margin_gl=p.getUniformLocation(this.program,"margin"),p.uniform1f(h,t),p.uniform1f(d,e),p.uniform1f(b,n),p.uniform1f(m,o),p.uniform1f(_,i),p.uniform1f(v,a),p.uniform1f(w,s),p.uniform1f(x,u),p.uniform1f(y,l),p.uniform1f(g,c),p.uniform1f(margin_gl,f)}},{"./webgl":11}],9:[function(t,e,n){function r(t,e){this.webgl=t,this.standalone=null==e||e;var n="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D X;\t\t// texture with data from padded X\nuniform int N;\t\t// number of columns\nuniform int pad;\t\t// additional columns to nearest multiple of four\nuniform float b; \t\t// additive term\nuniform float a; \t\t// multiplicative term\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n \tfloat row = outTex.y;\n\tfloat col = outTex.x;\n\n\t// direct usage of col requires output be padded exactly like input\n\tvec4 x = texture2D( X, vec2(col, row));\n\tvec4 sum_v = (a * x) + b;\n\tint channel = int(mod(col * float(N + pad), 4.0 ));\n\tfloat sum = select_index_1604150559(sum_v, channel);\n\n\tif (sum == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n \t// output vec4 with bytes for an IEEE754 32-bit floating point number\n\tgl_FragColor = encode_float_1540259130(sum);\n}\n",r="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D X;\t\t// texture with data from padded X\nuniform int N;\t\t// number of columns\nuniform int pad;\t\t// additional columns to nearest multiple of four\nuniform float b; \t\t// additive term\nuniform float a; \t\t// multiplicative term\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n\tv.a = 0.0;\n\tif(pad == 2){\n\t\tv.b = 0.0;\n\t} else if(pad == 3){\n\t\tv.b = 0.0;\n\t\tv.g = 0.0;\n\t}\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tfloat col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n\n\t// direct usage of col requires output be padded exactly like input\n\tvec4 x = texture2D( X, vec2(col_t, row_t));\n\tvec4 sum_v = (a * x) + b;\n\n\t// fix padded region\n\tif(pad > 0 && col + 4.0 > float(N) ) {\n\t\tfix_pad_1540259130(sum_v, pad);\n\t}\n\n\tgl_FragColor = sum_v;\n}\n";this.standalone?this.program=this.webgl.createProgram(n):this.program=this.webgl.createProgram(r)}t("./webgl");e.exports=r,r.TEXTURE_UNIFORM_NAME_0="X",r.LENGTH_UNIFORM_NAME="N",r.ADD_UNIFORM_NAME="b",r.MUL_UNIFORM_NAME="a",r.prototype.calculate=function(t,e,n,o,i,a){var s=this.webgl.context,u=this.webgl.getPad(e);this.webgl.selectProgram(this.program),this.bindInputTexture(i,s.TEXTURE0,r.TEXTURE_UNIFORM_NAME_0),this.bindUniforms(e,u,n,o),this.standalone?this.webgl.bindOutputTexture(t,e+u,a):this.webgl.bindOutputTexture(t,(e+u)/4,a),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(s.TEXTURE0)},r.prototype.bindInputTexture=function(t,e,n){var r=this.webgl.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.bindUniforms=function(t,e,n,o){var i=this.webgl.context,a=i.getUniformLocation(this.program,r.LENGTH_UNIFORM_NAME),s=i.getUniformLocation(this.program,r.ADD_UNIFORM_NAME),u=i.getUniformLocation(this.program,r.MUL_UNIFORM_NAME),l=i.getUniformLocation(this.program,"pad");i.uniform1i(a,t),i.uniform1i(l,e),i.uniform1f(u,n),i.uniform1f(s,o)}},{"./webgl":11}],10:[function(t,e,n){function r(t,e){if(2!=t.length)throw new Error("Only Tensor of order two (matrix) is supported right now.");var n=t[0],r=t[1];this.texture=i.createDataTexture(n,r,e),this.shape=[n,r],this[Symbol.toStringTag]="Tensor"}var o=t("./globals"),i=o.gl;e.exports=r,r.prototype.delete=function(){i.context.deleteTexture(this.texture),this.texture=null,this.shape=null},r.prototype.transfer=function(t){var e,n,r=this.shape[0],o=this.shape[1];return e=i.createOutputTexture(r,o),i.encode(r,o,this.texture,e),n=new Float32Array(i.readData(r,o)),i.context.deleteTexture(e),t||this.delete(),n},r.prototype.reshape=function(t,e){var n=this.shape[0],o=this.shape[1],a=t[0],s=t[1],u=new r(t,null);return i.reshape(n,o,a,s,this.texture,u.texture),e||this.delete(),u},r.prototype.transpose=function(t){var e=this.shape[0],n=this.shape[1],o=new r([n,e],null);return i.transpose(e,n,this.texture,o.texture),t||this.delete(),o},r.prototype.split=function(t,e){var n=this.shape[0],o=this.shape[1];if(o%2!==0)throw new Error("row count must be multiple of two.");var a=new r([n,o/2],null),s=new r([n,o/2],null);return i.submatrix(o,n,o/2,t,0,this.texture,a.texture),i.submatrix(o,n,o/2,t,1,this.texture,s.texture),e||this.delete(),[a,s]},r.combine=function(t,e,n,o){var a=t.shape[0],s=t.shape[1];if(t.shape[1]!==e.shape[1]||t.shape[0]!==e.shape[0])throw new Error("row and column counts must be equal.");if(n%4!==0)throw new Error("stride must be a multiple of four");var u=new r([a,2*s],null);return i.combine(a,s,n,t.texture,e.texture,u.texture),o||(t.delete(),e.delete()),u}},{"./globals":2}],11:[function(t,e,n){function r(t){var e,n;if(t=t||{},"undefined"==typeof t.canvas?this.canvas=document.createElement("canvas"):this.canvas=t.canvas,e={premultipliedAlpha:!1,preserveDrawingBuffer:!1},this.context=this.canvas.getContext("experimental-webgl",e),null==this.context)throw new Error("No support for Webgl.");try{n=this.context.getExtension("OES_texture_float")}catch(t){}null==n?(console.log("No support for OES_texture_float extension!"),this.hasFloat=!1):this.hasFloat=!0;var r=this.context.getShaderPrecisionFormat(this.context.FRAGMENT_SHADER,this.context.HIGH_FLOAT);this.hasHighPrecision=0!=r.precision,this.hasHighPrecision&&(this.highp=r);var o="// vertex shader for a single quad\n// work is performed in the operation specific texture shader\n\nprecision highp float;\n#define GLSLIFY 1\n\nattribute vec3 pos;\nattribute vec2 tex;\nvarying vec2 outTex;\nvoid main(void)\n{\n\t// just pass the position and texture coords\n\tgl_Position = vec4(pos, 1.0);\n\toutTex = tex;\n}\n";this.vertexShader=this.context.createShader(this.context.VERTEX_SHADER),this.context.shaderSource(this.vertexShader,o),this.context.compileShader(this.vertexShader);var i="\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform int N;\t\t// number of columns in output\nuniform int pad;\t\t//\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n\t// TODO: correctly handle denormal numbers\n\t// http://www.2ality.com/2012/04/number-encoding.html\n\tfloat a = abs(val); // encode absolute value + sign\n\tfloat exp = floor(log2(a)); // number of powers of 2\n\tfloat mant = pow(2.,log2(a)-exp) * pow(2.,23.); // multiply to fill 24 bits (implied leading 1)\n\tfloat mant1 = floor(mant / 256. / 256.); // first 8 bits of mantissa\n\tfloat mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n\tfloat mant3 = mod(mant,256.); // third 8 bits\n\n\thighp float sign = 128.-128.*(a/val);\t\t\t// sign bit is 256 or 0\n\thighp float e = (sign+exp+127.)/510.;\t\t// exponent and sign\n\thighp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n\thighp float m2 = (mant2)/255.;\t\t\t\t// middle part\n\thighp float m3 = (mant3+.5)/255.;\t\t\t// scale to 0 - 255\n\n\treturn vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\n\tvec4 val_v = texture2D(A, vec2(col_t * float(N)/float(N + pad), row_t));\n\tint channel = int(mod(col_t * float(N), 4.0 ));\n\tfloat val = select_index_1604150559(val_v, channel);\n\n\tif (val == 0.) {\n\t\tgl_FragColor = vec4(0.,0.,0.,0.);\n\t\treturn;\n\t}\n\n \t// output vec4 with bytes for an IEEE754 32-bit floating point number\n\tgl_FragColor = encode_float_1540259130(val);\n}\n",a="\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform int M;\t\t// number of rows in output\nuniform int N;\t\t// number of columns in output\nuniform int mpad;\t\t//\nuniform int npad;\t\t//\n\n// select an element from a vector based on index\nfloat select_index_1540259130(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tfloat col = (col_t * float(N + npad) - 2.0); // index of first element in pixel (matrix space)\n\n\t// get rows in the input, each containing one element in the output\n\tvec4 row_1 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 0.5)/float(N)));\n\tvec4 row_2 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 1.5)/float(N)));\n\tvec4 row_3 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 2.5)/float(N)));\n\tvec4 row_4 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 3.5)/float(N)));\n\n\t// package into output vector\n\tint channel = int(mod(row_t * float(M), 4.0 ));\n\n\tvec4 col_v = vec4(0.0, 0.0, 0.0, 0.0); // vec4 representing four elements in a column in the input\n\n\t// extract relevent element from each input row\n\tcol_v.r = select_index_1540259130(row_1, channel);\n\tif(npad > 0 && (col + 4.0) > float(N) ) {\n\t\t// compute elements in padded region\n\t\tif(npad < 3){\n\t\t\tcol_v.g = select_index_1540259130(row_2, channel);\n\t\t}\n\t\tif(npad < 2){\n\t\t\tcol_v.b = select_index_1540259130(row_3, channel);\n\t\t}\n\t} else {\n\t\tcol_v.g = select_index_1540259130(row_2, channel);\n\t\tcol_v.b = select_index_1540259130(row_3, channel);\n\t\tcol_v.a = select_index_1540259130(row_4, channel);\n\t}\n\n\tgl_FragColor = col_v;\n}\n",s="\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform float M;\t\t// number of rows in output\nuniform float N;\t\t// number of columns in output\nuniform float pad;\t\t// column padding in output\nuniform float M_in;\t\t// number of rows in input\nuniform float N_in;\t\t// number of columns in input\nuniform float pad_in;\t// column padding in input\n\n/* number of input pixels\n origin index (channel) for each\n termination index (channel) for each\n destination origin index (channel) for each\n */\n// select an element from a vector based on index\nfloat select_index_1540259130(vec4 v, int index){\n\tfloat val;\n\tif (index == 0) {\n\t\tval = v.r;\n\t} else if(index == 1) {\n\t\tval = v.g;\n\t} else if(index == 2) {\n\t\tval = v.b;\n\t} else if(index == 3){\n\t\tval = v.a;\n\t} else {\n\t\t// should never be here\n\t\tval = 0.0;\n\t}\n\n\treturn val;\n}\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1604150559(inout vec4 v, int pad){\n\tv.a = 0.0;\n\tif(pad == 2){\n\t\tv.b = 0.0;\n\t} else if(pad == 3){\n\t\tv.b = 0.0;\n\t\tv.g = 0.0;\n\t}\n}\n\n// translate a linear index into x, y coordinates for a matrix\nvec2 linear_index_coords_1117569599(float linear_index, float row_length){\n\tvec2 coords;\n\n\tcoords.x = floor(mod(linear_index + 0.5, row_length)); // column\n\tcoords.y = floor((linear_index + 0.5) / row_length); // row\n\n\treturn coords;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\n\tfloat row = floor(row_t * M);\n\tfloat col_0 = (col_t * (N + pad) - 2.0); // index of first element in pixel (matrix space)\n\t//float col_0 = floor(col_t * (N + pad)/4.0)*4.0; // index of first element in pixel (matrix space)\n\tfloat lin_index_0 = row * N + col_0; // linearized index of first element in pixel in output\n\n\tvec4 pixel_in = vec4(0.0, 0.0, 0.0, 0.0);\n\tvec4 result = vec4(0.0, 0.0, 0.0, 0.0);\n\tvec2 coords = linear_index_coords_1117569599(lin_index_0, N_in);\n\tvec2 ncoords;\n\tint channel_in = int(mod(coords.x, 4.0));\n\n\tvec2 scale_in = vec2(1.0/(N_in + pad_in), 1.0/M_in); // scale from matrix to input texture coords\n\tvec2 offset_in = vec2(0.5, 0.5); // move away from edge of pixel\n\tconst vec2 pixel_scale = vec2(1.0/4.0, 1.0); // scale from matrix to pixel coords\n\n\tpixel_in = texture2D(A, (coords + offset_in) * scale_in);\n\n\t// go through channels for current output pixel\n\tfor(int channel = 0; channel < 4; channel++){\n\n\t\t// are we on a new input pixel?\n\t\tncoords = linear_index_coords_1117569599(lin_index_0 + float(channel), N_in);\n\t\tif(floor(ncoords * pixel_scale) != floor(coords * pixel_scale)){\n\t\t\tcoords = ncoords;\n\t\t\tpixel_in = texture2D(A, (coords + offset_in) * scale_in);\n\t\t\tchannel_in = 0;\n\t\t}\n\n\t\tif(channel == 0){\n\t\t\tresult.r = select_index_1540259130(pixel_in, channel_in);\n\t\t} else if(channel == 1){\n\t\t\tresult.g = select_index_1540259130(pixel_in, channel_in);\n\t\t} else if(channel == 2){\n\t\t\tresult.b = select_index_1540259130(pixel_in, channel_in);\n\t\t} else {\n\t\t\tresult.a = select_index_1540259130(pixel_in, channel_in);\n\t\t}\n\n\t\tchannel_in++;\n\t}\n\n\t// are we in the padded (output) region?\n\tif(pad > 0.0 && col_0 + 3.5 > N ) {\n\t\tfix_pad_1604150559(result, int(pad));\n\t}\n\n\tgl_FragColor = result;\n}\n",u="\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform float M;\t\t// number of rows in output\nuniform float N;\t\t// number of columns in output\nuniform float M_in;\t\t// number of rows in input\nuniform float N_in;\t\t// number of columns in input\n\n// translate a linear index into x, y coordinates for a matrix\nvec2 linear_index_coords_1540259130(float linear_index, float row_length){\n\tvec2 coords;\n\n\tcoords.x = floor(mod(linear_index + 0.5, row_length)); // column\n\tcoords.y = floor((linear_index + 0.5) / row_length); // row\n\n\treturn coords;\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\n\tfloat row = floor(row_t * M);\n\tfloat col_0 = floor(col_t * N - 1.5); // index of first element in pixel (matrix space)\n\tfloat lin_index_0 = row * N + col_0; // linearized index of first element in pixel in output\n\n\tvec4 result;\n\tvec2 coords = linear_index_coords_1540259130(lin_index_0, N_in);\n\n\tvec2 scale_in = vec2(1.0/N_in, 1.0/M_in); // scale from matrix to input texture coords\n\tvec2 offset_in = vec2(0.5, 0.5); // move away from edge of pixel\n\n\tresult = texture2D(A, (coords + offset_in) * scale_in);\n\n\tgl_FragColor = result;\n}\n",l="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D X;\t\t// texture with data from padded X\nuniform float N;\t\t// number of columns\nuniform float pad;\t\t// additional columns to nearest multiple of four\nuniform float N_in;\t\t// number of columns (input)\nuniform float pad_in;\t// additional columns to nearest multiple of four (input)\nuniform float stride;\nuniform float offset; // zero or one\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n\tv.a = 0.0;\n\tif(pad == 2){\n\t\tv.b = 0.0;\n\t} else if(pad == 3){\n\t\tv.b = 0.0;\n\t\tv.g = 0.0;\n\t}\n}\n\n/* join parts of two pixels into one, selecting four continguous elements\n starting at channel.\n*/\nvoid join_pixels_1604150559(inout vec4 x, vec4 x0, vec4 x1, float channel){\n\tif(channel == 1.0){\n\t\tx.rgb = x0.gba;\n\t\tx.a = x1.r;\n\t} else if(channel == 2.0){\n\t\tx.rg = x0.ba;\n\t\tx.ba = x1.rg;\n\t} else if(channel == 3.0){\n\t\tx.r = x0.a;\n\t\tx.gba = x1.rgb;\n\t}\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tfloat col = floor(col_t * (N + pad) - 1.5); // index of first element in pixel (output matrix space)\n\n\tfloat stripe = floor(col / stride);\n\tfloat sub_col = floor(mod(col, stride));\n\n\tfloat col_in = (offset + (2.0 * stripe)) * stride + sub_col;\n\n\tvec4 x;\n\tfloat channel = mod(col_in, 4.0); // channel in the input of first element in output\n\n\t// are we at the beggining of an input pixel?\n\tif(channel == 0.0){\n\t\t// yes, select the whole thing\n\t\tx = texture2D( X, vec2((col_in + 2.0 - channel) / (N_in + pad_in) , row_t));\n\t} else {\n\t\t// no, select parts from two pixels\n\t\tvec4 x0, x1;\n\t\tx0 = texture2D( X, vec2((col_in + 2.0 - channel) / (N_in + pad_in) , row_t));\n\t\tx1 = texture2D( X, vec2((col_in + 6.0 - channel) / (N_in + pad_in) , row_t));\n\n\t\tjoin_pixels_1604150559(x, x0, x1, channel);\n\n\t}\n\n\t// fix padded region\n\tif(pad > 0.0 && col + 4.0 > N ) {\n\t\tfix_pad_1540259130(x, int(pad));\n\t}\n\n\tgl_FragColor = x;\n}\n",c="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\t// texture coords of row/column to calculate\nuniform sampler2D A;\t\t// texture with data from padded A\nuniform sampler2D B;\t\t// texture with data from padded B\nuniform float N_in;\t\t// number of columns\nuniform float pad_in;\t// additional columns to nearest multiple of four\nuniform float stride;\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n\tv.a = 0.0;\n\tif(pad == 2){\n\t\tv.b = 0.0;\n\t} else if(pad == 3){\n\t\tv.b = 0.0;\n\t\tv.g = 0.0;\n\t}\n}\n\nvoid main(void) {\n\n\t// get the implied row and column from .y and .x of passed (output)\n\t// texture coordinate. These map directly to input texture space when\n\t// the relevant dimensions are the same.\n\tfloat row_t = outTex.y;\n\tfloat col_t = outTex.x;\n\tfloat N = N_in * 2.0;\n\tfloat pad = mod(N, 4.0);\n\tfloat col = floor(col_t * (N + pad) - 1.5); // index of first element in pixel (output matrix space)\n\n\tfloat stripe = floor(col / stride);\n\tfloat sub_col = floor(mod(col, stride));\n\n\tfloat tex_select = mod(stripe, 2.0);\n\tfloat col_in = floor(stripe / 2.0) * stride + sub_col;\n\n\tvec4 x;\n\tfloat channel = mod(col_in, 4.0); // channel in the input of first element in output\n\n\t// which input texture are we getting this pixel from?\n\tif(tex_select == 0.0){\n\t\tx = texture2D( A, vec2((col_in + 2.0) / (N_in + pad_in) , row_t));\n\t} else {\n\t\tx = texture2D( B, vec2((col_in + 2.0) / (N_in + pad_in) , row_t));\n\t}\n\n\t// fix padded region\n\tif(pad > 0.0 && col + 4.0 > N ) {\n\t\tfix_pad_1540259130(x, int(pad));\n\t}\n\n\tgl_FragColor = x;\n}\n";this.encode_program=this.createProgram(i),this.transpose_program=this.createProgram(a),this.reshape_program=this.createProgram(s),this.reshape_simple_program=this.createProgram(u),this.submatrix_program=this.createProgram(l),this.combine_program=this.createProgram(c)}e.exports=r,r.COMPONENTS_PER_TEXEL=4,r.POSITION_UNIFORM_NAME="pos",r.TEXTURE_UNIFORM_NAME="tex",r.prototype.encode=function(t,e,n,r){this.program=this.encode_program,this.selectProgram(this.program);var o=this.getPad(e),i=this.context.getUniformLocation(this.program,"N"),a=this.context.getUniformLocation(this.program,"pad");this.context.uniform1i(i,e),this.context.uniform1i(a,o),this.bindInputTexture(n,this.context.TEXTURE0,"A"),this.bindOutputTexture(t,e,r),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},r.prototype.transpose=function(t,e,n,r){this.program=this.transpose_program,this.selectProgram(this.program);var o=this.getPad(e),i=this.getPad(t),a=this.context.getUniformLocation(this.program,"N"),s=this.context.getUniformLocation(this.program,"npad"),u=this.context.getUniformLocation(this.program,"M"),l=this.context.getUniformLocation(this.program,"mpad");this.context.uniform1i(a,t),this.context.uniform1i(s,i),this.context.uniform1i(u,e),this.context.uniform1i(l,o),this.bindInputTexture(n,this.context.TEXTURE0,"A"),this.bindOutputTexture(e,(t+i)/4,r),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},r.prototype.reshape=function(t,e,n,r,o,i){var a=this.getPad(e),s=this.getPad(r);0==a&&0==s?this.program=this.reshape_simple_program:(this.program=this.reshape_program,console.log("# WARNING: using slow reshape shader.")),this.selectProgram(this.program);var u=this.context.getUniformLocation(this.program,"M"),l=this.context.getUniformLocation(this.program,"N"),c=this.context.getUniformLocation(this.program,"pad"),f=this.context.getUniformLocation(this.program,"M_in"),p=this.context.getUniformLocation(this.program,"N_in"),h=this.context.getUniformLocation(this.program,"pad_in");this.context.uniform1f(u,n),this.context.uniform1f(l,r),this.context.uniform1f(c,s),this.context.uniform1f(f,t),this.context.uniform1f(p,e),this.context.uniform1f(h,a),this.bindInputTexture(o,this.context.TEXTURE0,"A"),this.bindOutputTexture(n,(r+s)/4,i),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},r.prototype.submatrix=function(t,e,n,r,o,i,a){this.program=this.submatrix_program,this.selectProgram(this.program);var s=this.getPad(t),u=this.getPad(n),l=this.context.getUniformLocation(this.program,"N"),c=this.context.getUniformLocation(this.program,"pad"),f=this.context.getUniformLocation(this.program,"N_in"),p=this.context.getUniformLocation(this.program,"pad_in"),h=this.context.getUniformLocation(this.program,"offset");stride_gl=this.context.getUniformLocation(this.program,"stride"),this.context.uniform1f(l,n),this.context.uniform1f(c,u),this.context.uniform1f(f,t),this.context.uniform1f(p,s),this.context.uniform1f(stride_gl,r),this.context.uniform1f(h,o),this.bindInputTexture(i,this.context.TEXTURE0,"X"),this.bindOutputTexture(e,(n+u)/4,a),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},r.prototype.combine=function(t,e,n,r,o,i){this.program=this.combine_program,this.selectProgram(this.program);var a=2*e,s=this.getPad(e),u=this.getPad(a),l=this.context.getUniformLocation(this.program,"N_in"),c=this.context.getUniformLocation(this.program,"pad_in"),f=this.context.getUniformLocation(this.program,"stride");this.context.uniform1f(l,e),this.context.uniform1f(c,s),this.context.uniform1f(f,n),this.bindInputTexture(r,this.context.TEXTURE0,"A"),this.bindInputTexture(o,this.context.TEXTURE1,"B"),this.bindOutputTexture(t,(a+u)/4,i),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},r.prototype.bindInputTexture=function(t,e,n){var r=this.context,o=this.program;r.activeTexture(e),r.bindTexture(r.TEXTURE_2D,t);var i=r.getUniformLocation(o,n);r.uniform1i(i,e-r.TEXTURE0)},r.prototype.createProgram=function(t){var e,n=this.context;if(e=n.createShader(n.FRAGMENT_SHADER),n.shaderSource(e,t),n.compileShader(e),0==n.getShaderParameter(e,n.COMPILE_STATUS))throw new Error(n.getShaderInfoLog(e));var r=n.createProgram();return n.attachShader(r,this.vertexShader),n.attachShader(r,e),n.linkProgram(r),r},r.prototype.selectProgram=function(t){var e=this.context;e.useProgram(t),this.bindVertices(t)},r.prototype.bindVertices=function(t){var e=this.context,n=t,o=e.getAttribLocation(n,r.POSITION_UNIFORM_NAME),i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i);var a=[-1,-1,0,1,-1,0,1,1,0,-1,1,0];e.bufferData(e.ARRAY_BUFFER,new Float32Array(a),e.STATIC_DRAW),e.vertexAttribPointer(o,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o);var s=e.getAttribLocation(n,r.TEXTURE_UNIFORM_NAME),u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u);var l=[0,0,1,0,1,1,0,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(l),e.STATIC_DRAW),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s);var c=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,c);var f=[0,1,2,0,2,3];e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(f),e.STATIC_DRAW)},r.prototype.createDataTexture=function(t,e,n){var o=this.context,i=[0,0,0,0],a=e%r.COMPONENTS_PER_TEXEL,s=0==a?0:r.COMPONENTS_PER_TEXEL-a,u=o.createTexture();if(o.bindTexture(o.TEXTURE_2D,u),0==s||null==n||"undefined"==typeof n)o.texImage2D(o.TEXTURE_2D,0,o.RGBA,(e+s)/r.COMPONENTS_PER_TEXEL,t,0,o.RGBA,o.FLOAT,n);else{o.texImage2D(o.TEXTURE_2D,0,o.RGBA,(e+s)/r.COMPONENTS_PER_TEXEL,t,0,o.RGBA,o.FLOAT,null);for(var l,c,f=e-a,p=f/r.COMPONENTS_PER_TEXEL,h=0,d=new Float32Array(i),v=0;t>v;v++)h=v*e,full_texel_row_end=h+f,l=new Float32Array(n.buffer,h*n.BYTES_PER_ELEMENT,f),f>0&&o.texSubImage2D(o.TEXTURE_2D,0,0,v,p,1,o.RGBA,o.FLOAT,l),c=new Float32Array(n.buffer,full_texel_row_end*n.BYTES_PER_ELEMENT,a),d.set(c),o.texSubImage2D(o.TEXTURE_2D,0,p,v,1,1,o.RGBA,o.FLOAT,d)}return o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.bindTexture(o.TEXTURE_2D,null),u},r.prototype.createOutputTexture=function(t,e){var n=this.context,r=this.getPad(e),o=n.createTexture();return n.bindTexture(n.TEXTURE_2D,o),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,e+r,t,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.bindTexture(n.TEXTURE_2D,null),o},r.prototype.bindOutputTexture=function(t,e,n){var r=this.context;if(this.canvas.height=t,this.canvas.width=e,r.viewport(0,0,e,t),this.framebuffer=this.framebuffer||r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n,0),r.checkFramebufferStatus(r.FRAMEBUFFER)!=r.FRAMEBUFFER_COMPLETE)throw new Error("Bound framebuffer is not complete.");return this.framebuffer},r.prototype.unbindInputTexture=function(t){var e=this.context;e.activeTexture(t),e.bindTexture(e.TEXTURE_2D,null)},r.prototype.readData=function(t,e){var n=this.context;return rawbuffer=new ArrayBuffer(t*e*Float32Array.BYTES_PER_ELEMENT),prod=new Uint8Array(rawbuffer),n.readPixels(0,0,e,t,n.RGBA,n.UNSIGNED_BYTE,prod),rawbuffer},r.prototype.getPad=function(t){var e=t%r.COMPONENTS_PER_TEXEL,n=0==e?0:r.COMPONENTS_PER_TEXEL-e;return n}},{}]},{},[1])(1)})},function(t,e,n){t.exports=n(206)},function(t,e,n){"use strict";function r(t){var e=new a(t),n=i(a.prototype.request,e);return o.extend(n,a.prototype,e),o.extend(n,e),n}var o=n(20),i=n(139),a=n(208),s=n(95),u=r(s);u.Axios=a,u.create=function(t){return r(o.merge(s,t))},u.Cancel=n(136),u.CancelToken=n(207),u.isCancel=n(137),u.all=function(t){return Promise.all(t)},u.spread=n(222),t.exports=u,t.exports.default=u},function(t,e,n){"use strict";function r(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new o(t), e(n.reason))})}var o=n(136);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var t,e=new r(function(e){t=e});return{token:e,cancel:t}},t.exports=r},function(t,e,n){"use strict";function r(t){this.defaults=t,this.interceptors={request:new a,response:new a}}var o=n(95),i=n(20),a=n(209),s=n(210),u=n(218),l=n(216);r.prototype.request=function(t){"string"==typeof t&&(t=i.merge({url:arguments[0]},arguments[1])),t=i.merge(o,this.defaults,{method:"get"},t),t.baseURL&&!u(t.url)&&(t.url=l(t.baseURL,t.url));var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},i.forEach(["delete","get","head"],function(t){r.prototype[t]=function(e,n){return this.request(i.merge(n||{},{method:t,url:e}))}}),i.forEach(["post","put","patch"],function(t){r.prototype[t]=function(e,n,r){return this.request(i.merge(r||{},{method:t,url:e,data:n}))}}),t.exports=r},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(20);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t,e,n){"use strict";function r(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var o=n(20),i=n(213),a=n(137),s=n(95);t.exports=function(t){r(t),t.headers=t.headers||{},t.data=i(t.data,t.headers,t.transformRequest),t.headers=o.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]});var e=t.adapter||s.adapter;return e(t).then(function(e){return r(t),e.data=i(e.data,e.headers,t.transformResponse),e},function(e){return a(e)||(r(t),e&&e.response&&(e.response.data=i(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(t,e,n){"use strict";t.exports=function(t,e,n,r){return t.config=e,n&&(t.code=n),t.response=r,t}},function(t,e,n){"use strict";var r=n(138);t.exports=function(t,e,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?e(r("Request failed with status code "+n.status,n.config,null,n)):t(n)}},function(t,e,n){"use strict";var r=n(20);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";function r(){this.message="String contains an invalid character"}function o(t){for(var e,n,o=String(t),a="",s=0,u=i;o.charAt(0|s)||(u="=",s%1);a+=u.charAt(63&e>>8-s%1*8)){if(n=o.charCodeAt(s+=.75),n>255)throw new r;e=e<<8|n}return a}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=o},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(20);t.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else if(o.isURLSearchParams(e))i=e.toString();else{var a=[];o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)&&(e+="[]"),o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),a.push(r(e)+"="+r(t))}))}),i=a.join("&")}return i&&(t+=(t.indexOf("?")===-1?"?":"&")+i),t}},function(t,e,n){"use strict";t.exports=function(t,e){return t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"")}},function(t,e,n){"use strict";var r=n(20);t.exports=r.isStandardBrowserEnv()?function(){return{write:function(t,e,n,o,i,a){var s=[];s.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(i)&&s.push("domain="+i),a===!0&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,n){"use strict";var r=n(20);t.exports=r.isStandardBrowserEnv()?function(){function t(t){var e=t;return n&&(o.setAttribute("href",e),e=o.href),o.setAttribute("href",e),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var e,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return e=t(window.location.href),function(n){var o=r.isString(n)?t(n):n;return o.protocol===e.protocol&&o.host===e.host}}():function(){return function(){return!0}}()},function(t,e,n){"use strict";var r=n(20);t.exports=function(t,e){r.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}},function(t,e,n){"use strict";var r=n(20);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=16384;if("undefined"!=typeof window){var o=document.createElement("canvas"),i=o.getContext("webgl")||o.getContext("experimental-webgl");i?e.MAX_TEXTURE_SIZE=r=i.getParameter(i.MAX_TEXTURE_SIZE):console.log("Unable to initialize WebGL. Your browser may not support it.")}e.MAX_TEXTURE_SIZE=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n-1))throw new Error(t+" mode currently not supported in WebGLMerge layer.");r.program=r.webgl.createProgram(n(641))}return r.mode=t,r.modeCode=d[t],r}return a(e,t),s(e,[{key:"_bindInputTexturesArray",value:function(t){if(t.length>this.MAX_NUM_TEXTURES)throw new Error("Max number of inputs to WebGLMerge exceeded.");var n=this.webgl.context;this.numTextures=t.length;for(var r=0;r1&&(e+=t[t.length-1]),t.push(e),t},[0]).slice(0,-1),a=(0,h.default)(t.map(function(t){return t.shape[0]}));n.uniform1i(n.getUniformLocation(this.program,e.OUTPUT_ROWS_UNIFORM_NAME),a),n.uniform1iv(n.getUniformLocation(this.program,e.INPUT_CHANNEL_START_INDICES_UNIFORM_NAME),i)}else n.uniform1i(n.getUniformLocation(this.program,e.MODE_CODE_UNIFORM_NAME),this.modeCode)}},{key:"_bindOutputTexture",value:function(t,e){var n=t[0].shape[0];"concat"===this.mode&&(n=(0,h.default)(t.map(function(t){return t.shape[0]})));var r=t[0].shape[1],o=this.webgl.getPad(r);this.webgl.bindOutputTexture(n,(r+o)/4,e.texture)}},{key:"call",value:function(t){this.webgl.selectProgram(this.program);var e=void 0;if("concat"===this.mode){if(!t.every(function(e){return e.shape[0]===t[0].shape[0]}))throw new Error("Non-concat axis dimension of inputs to WebGLMerge must all be the same.");var n=t.map(function(t){return t.transpose()}),r=[(0,h.default)(n.map(function(t){return t.shape[0]})),n[0].shape[1]];e=new weblas.pipeline.Tensor(r,null),this.webgl.selectProgram(this.program),this._bindInputTexturesArray(n),this._bindUniforms(n),this._bindOutputTexture(n,e)}else e=new weblas.pipeline.Tensor(t[0].shape,null),this._bindInputTexturesArray(t),this._bindUniforms(t),this._bindOutputTexture(t,e);return this._compute(),this._unbindInputTextures(),"concat"===this.mode&&(e=e.transpose()),e}}]),e}(l.default);v.INPUT_TEXTURES_ARRAY_NAME="inputs",v.INPUT_CHANNEL_START_INDICES_UNIFORM_NAME="inputChannelStartIndices",v.NUM_INPUTS_UNIFORM_NAME="numInputs",v.MODE_CODE_UNIFORM_NAME="modeCode",v.OUTPUT_ROWS_UNIFORM_NAME="outputRows",v.OUTPUT_COLS_UNIFORM_NAME="outputCols",v.OUTPUT_COL_PAD_UNIFORM_NAME="outputColPad",e.default=v},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="InputLayer";var r=t.shape,a=void 0===r?[]:r;return n.shape=t.batchInputShape&&t.batchInputShape.length?t.batchInputShape.slice(1):a,n}return a(e,t),s(e,[{key:"call",value:function(t){if(!(0,f.default)(t.tensor.shape,this.shape))throw new Error("[InputLayer] input tensor shape "+t.tensor.shape+" does not match specified shape "+this.shape+".");return t}}]),e}(l.default);e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));h.call(n),n.layerClass="ELU";var r=t.alpha,a=void 0===r?1:r;return n.alpha=a,n}return a(e,t),s(e,[{key:"call",value:function(t){return this._compute(t.tensor,this.alpha),t}}]),e}(l.default),h=function(){this._compute=(0,f.default)({args:["array","scalar"],body:function(t,e){t=Math.max(t,0)+e*(Math.exp(Math.min(t,0))-1)}})};e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="LeakyReLU";var r=t.alpha,a=void 0===r?.3:r;return n.alpha=a,n}return a(e,t),s(e,[{key:"call",value:function(t){return(0,c.relu)(t,{alpha:this.alpha}),t}}]),e}(l.default);e.default=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n._compute=(0,f.default)({args:["array","array"],body:function(t,e){t=Math.max(t,0)+e*Math.min(t,0)}}),n.layerClass="PReLU",n.params=["alphas"],n}return a(e,t),s(e,[{key:"call",value:function(t){return this._compute(t.tensor,this.weights.alphas.tensor),t}}]),e}(l.default);e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n._compute=(0,f.default)({args:["array","array","array"],body:function(t,e,n){t=e*Math.log(1+Math.exp(n*t))}}),n.layerClass="ParametricSoftplus",n.params=["alphas","betas"],n}return a(e,t),s(e,[{key:"call",value:function(t){return this._compute(t.tensor,this.weights.alphas.tensor,this.weights.betas.tensor),t}}]),e}(l.default);e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n._compute=(0,f.default)({args:["array","array","array","array","array"],body:function(t,e,n,r,o){t=e+Math.min(Math.max(t-e,0),Math.abs(r))+n*Math.min(t-e,0)+Math.max(t-(e+Math.abs(r)),0)*o}}),n.layerClass="SReLU",n.params=["t_left","a_left","t_right","a_right"],n}return a(e,t),s(e,[{key:"call",value:function(t){return this._compute(t.tensor,this.weights.t_left.tensor,this.weights.a_left.tensor,this.weights.t_right.tensor,this.weights.a_right.tensor),t}}]),e}(l.default);e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));h.call(n),n.layerClass="ThresholdedReLU";var r=t.theta,a=void 0===r?1:r;return n.theta=a,n}return a(e,t),s(e,[{key:"call",value:function(t){return this._compute(t.tensor,this.theta),t}}]),e}(l.default),h=function(){this._compute=(0,f.default)({args:["array","scalar"],body:function(t,e){t*=Number(t>e)}})};e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.SReLU=e.ThresholdedReLU=e.ParametricSoftplus=e.ELU=e.PReLU=e.LeakyReLU=void 0;var o=n(230),i=r(o),a=n(231),s=r(a),u=n(229),l=r(u),c=n(232),f=r(c),p=n(234),h=r(p),d=n(233),v=r(d);e.LeakyReLU=i.default,e.PReLU=s.default,e.ELU=l.default,e.ParametricSoftplus=f.default,e.ThresholdedReLU=h.default,e.SReLU=v.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="AtrousConvolution2D";var r=t.atrousRate,a=void 0===r?[1,1]:r;return n.atrousRate=a,n}return a(e,t),u(e,[{key:"_calcOutputShape",value:function(t){var e=t[0],n=t[1],r=s(this.kernelShape,3),o=r[0],i=r[1],a=r[2],u=i+(i-1)*(this.atrousRate[0]-1),l=a+(a-1)*(this.atrousRate[1]-1),c="same"===this.borderMode?Math.floor((e+this.subsample[0]-1)/this.subsample[0]):Math.floor((e-u+this.subsample[0])/this.subsample[0]),f="same"===this.borderMode?Math.floor((n+this.subsample[1]-1)/this.subsample[1]):Math.floor((n-l+this.subsample[1])/this.subsample[1]),p=o,h="same"===this.borderMode?Math.max(0,Math.floor((c-1)*this.subsample[0]+u-e)):0,d="same"===this.borderMode?Math.max(0,Math.floor((f-1)*this.subsample[1]+l-n)):0,v=Math.floor(h/2),m=h-v,_=Math.floor(d/2),g=d-_; this.outputShape=[c,f,p],this.inputPadding=[v,m,_,g]}},{key:"_im2col",value:function(t){var e=s(t.tensor.shape,3),n=e[0],r=e[1],o=e[2],i=this.kernelShape[1],a=this.kernelShape[2],u=this.outputShape[0],l=this.outputShape[1],f=u*l,p=i*a*o,h=i+(i-1)*(this.atrousRate[0]-1),v=a+(a-1)*(this.atrousRate[1]-1);this._imColsMat||(this._imColsMat=new c.default([],[f,p]));for(var m=new c.default([],[i,a,o]),_=0,g=0,y=n-h;g<=y;g+=this.subsample[0])for(var b=0,w=r-v;b<=w;b+=this.subsample[1])d.default.assign(m.tensor,t.tensor.hi(g+h,b+v,o).lo(g,b,0).step(this.atrousRate[0],this.atrousRate[1],1)),this._imColsMat.tensor.data.set(m.tensor.data,_),_+=p;return this._useWeblas&&this._imColsMat.createWeblasTensor(),this._imColsMat}}]),e}(p.default);e.default=v},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Convolution1D";var r=t.nbFilter,a=void 0===r?1:r,s=t.filterLength,u=void 0===s?1:s,l=t.activation,c=void 0===l?"linear":l,p=t.borderMode,h=void 0===p?"valid":p,d=t.subsampleLength,v=void 0===d?1:d,m=t.bias,_=void 0===m||m;if("valid"!==h&&"same"!==h)throw new Error(n.name+" [Convolution1D layer] Invalid borderMode.");n.bias=_,n.params=n.bias?["W","b"]:["W"];var g={nbFilter:a,nbRow:u,nbCol:1,activation:c,borderMode:h,subsample:[v,1],dimOrdering:"th",bias:_};return n._conv2dAttrs=g,n._conv2d=new f.default(Object.assign(g,{gpu:t.gpu})),n}return a(e,t),s(e,[{key:"setWeights",value:function(t){var e=this._conv2dAttrs,n=e.nbFilter,r=e.nbRow,o=e.nbCol,i=t[0].tensor.shape;if(i[0]!==r||i[1]!==o||i[3]!==n){if(console.warn("Using legacy shape of weights"),!(i[0]===n&(i[2]===r&i[3]===o)))throw new Error("Unsupported shape of weights")}else t[0].tensor=t[0].tensor.transpose(3,2,0,1);this._conv2d.setWeights(t)}},{key:"call",value:function(t){t.tensor=(0,v.default)(t.tensor).transpose(0,2,1);var e=this._conv2d.call(t);return t.tensor=(0,h.default)(e.tensor).transpose(1,0,2),t}}]),e}(l.default);e.default=m},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Convolution3D";var r=t.nbFilter,o=void 0===r?1:r,s=t.kernelDim1,u=void 0===s?1:s,l=t.kernelDim2,c=void 0===l?1:l,f=t.kernelDim3,h=void 0===f?1:f,d=t.activation,v=void 0===d?"linear":d,m=t.borderMode,_=void 0===m?"valid":m,g=t.subsample,y=void 0===g?[1,1,1]:g,b=t.dimOrdering,w=void 0===b?"tf":b,x=t.bias,E=void 0===x||x;if(n.kernelShape=[o,u,c,h],n.activation=v,n.activationFunc=p[v],"valid"!==_&&"same"!==_)throw new Error(n.name+" [Convolution3D layer] Invalid borderMode.");if(n.borderMode=_,n.subsample=y,"tf"!==w&&"th"!==w)throw new Error(n.name+" [Convolution3D layer] Only tf and th dim ordering are allowed.");return n.dimOrdering=w,n.bias=E,n.params=n.bias?["W","b"]:["W"],n.gpu&&weblas&&(n._useWeblas=!0,n._pipelineEnabled=!1),n}return s(e,t),l(e,[{key:"setWeights",value:function(t){"th"===this.dimOrdering&&(t[0].tensor=t[0].tensor.transpose(2,3,4,1,0)),c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setWeights",this).call(this,t),this._wRowsMat=this._w2row(),this._useWeblas&&(this._wRowsMat.createWeblasTensor(),this._wRowsMat._gpuMaxSizeExceeded||(this._wRowsMat.weblasTensor=this._wRowsMat.weblasTensor.transpose()),this.bias?this.weights.b.createWeblasTensor():(this._zerosVec=new d.default([],[this.weights.W.tensor.shape[4]]),this._zerosVec.createWeblasTensor()))}},{key:"_calcOutputShape",value:function(t){var e=t.tensor.shape[0],n=t.tensor.shape[1],r=t.tensor.shape[2],o=u(this.kernelShape,4),i=o[0],a=o[1],s=o[2],l=o[3],c="same"===this.borderMode?Math.floor((e+this.subsample[0]-1)/this.subsample[0]):Math.floor((e-a+this.subsample[0])/this.subsample[0]),f="same"===this.borderMode?Math.floor((n+this.subsample[1]-1)/this.subsample[1]):Math.floor((n-s+this.subsample[1])/this.subsample[1]),p="same"===this.borderMode?Math.floor((r+this.subsample[2]-1)/this.subsample[2]):Math.floor((r-l+this.subsample[2])/this.subsample[2]),h=i,d="same"===this.borderMode?Math.max(0,Math.floor((c-1)*this.subsample[0]+a-e)):0,v="same"===this.borderMode?Math.max(0,Math.floor((f-1)*this.subsample[1]+s-n)):0,m="same"===this.borderMode?Math.max(0,Math.floor((p-1)*this.subsample[2]+l-r)):0,_=Math.floor(d/2),g=d-_,y=Math.floor(v/2),b=v-y,w=Math.floor(m/2),x=m-w;this.outputShape=[c,f,p,h],this.inputPadding=[_,g,y,b,w,x]}},{key:"_padInput",value:function(t){if("same"===this.borderMode){var e=u(t.tensor.shape,4),n=e[0],r=e[1],o=e[2],i=e[3],a=u(this.inputPadding,6),s=a[0],l=a[1],c=a[2],f=a[3],p=a[4],h=a[5],v=n+s+l,m=r+c+f,_=o+p+h,y=new d.default([],[v,m,_,i]);g.default.assign(y.tensor.hi(n+s,r+c,o+p,i).lo(s,c,p,0),t.tensor),t.tensor=y.tensor}return t}},{key:"_vol2col",value:function(t){var e=u(t.tensor.shape,4),n=e[0],r=e[1],o=e[2],i=e[3],a=this.kernelShape[1],s=this.kernelShape[2],l=this.kernelShape[3],c=this.outputShape[0],f=this.outputShape[1],p=this.outputShape[2],h=c*f*p,v=a*s*l*i;if(this._volColsMat||(this._volColsMat=new d.default([],[h,v])),1===a&&1===s&&1===l&&1===this.subsample[0]&&1===this.subsample[1]&&1===this.subsample[2])return this._volColsMat.replaceTensorData(t.tensor.data),this._useWeblas&&this._volColsMat.createWeblasTensor(),this._volColsMat;for(var m=new d.default([],[a,s,l,i]),_=0,y=0,b=n-a;y<=b;y+=this.subsample[0])for(var w=0,x=r-s;w<=x;w+=this.subsample[1])for(var E=0,T=o-l;E<=T;E+=this.subsample[2])g.default.assign(m.tensor,t.tensor.hi(y+a,w+s,E+l,i).lo(y,w,E,0)),this._volColsMat.tensor.data.set(m.tensor.data,_),_+=v;return this._useWeblas&&this._volColsMat.createWeblasTensor(),this._volColsMat}},{key:"_w2row",value:function(){for(var t=this.weights.W.tensor.shape[3],e=u(this.kernelShape,4),n=e[0],r=e[1],o=e[2],i=e[3],a=r*o*i*t,s=new d.default([],[a,n]),l=new d.default([],[r,o,i,t]),c=new d.default([],[a]),f=0;f0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Cropping1D";var r=t.cropping,a=void 0===r?[0,0]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.cropping=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){var e=t.tensor.shape,n=[e[0]-this.cropping[0]-this.cropping[1],e[1]],r=new f.default([],n);return h.default.assign(r.tensor,t.tensor.hi(e[0]-this.cropping[1],e[2]).lo(this.cropping[0],0)),t.tensor=r.tensor,t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Cropping2D";var r=t.cropping,a=void 0===r?[[0,0],[0,0]]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.cropping=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,0));var e=t.tensor.shape,n=[e[0]-this.cropping[0][0]-this.cropping[0][1],e[1]-this.cropping[1][0]-this.cropping[1][1],e[2]],r=new f.default([],n);return h.default.assign(r.tensor,t.tensor.hi(e[0]-this.cropping[0][1],e[1]-this.cropping[1][1],e[2]).lo(this.cropping[0][0],this.cropping[1][0],0)),t.tensor=r.tensor,"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(2,0,1)),t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Cropping3D";var r=t.cropping,a=void 0===r?[[0,0],[0,0],[0,0]]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.cropping=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,3,0));var e=t.tensor.shape,n=[e[0]-this.cropping[0][0]-this.cropping[0][1],e[1]-this.cropping[1][0]-this.cropping[1][1],e[2]-this.cropping[2][0]-this.cropping[2][1],e[3]],r=new f.default([],n);return h.default.assign(r.tensor,t.tensor.hi(e[0]-this.cropping[0][1],e[1]-this.cropping[1][1],e[2]-this.cropping[2][1],e[3]).lo(this.cropping[0][0],this.cropping[1][0],this.cropping[2][0],0)),t.tensor=r.tensor,"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(3,0,1,2)),t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Deconvolution2D";var r=t.nbFilter,o=void 0===r?1:r,s=t.nbRow,u=void 0===s?1:s,l=t.nbCol,c=void 0===l?1:l,f=t.outputShape,h=void 0===f?[]:f,d=t.activation,v=void 0===d?"linear":d,m=t.borderMode,_=void 0===m?"valid":m,g=t.subsample,y=void 0===g?[1,1]:g,b=t.dimOrdering,w=void 0===b?"tf":b,x=t.bias,E=void 0===x||x;if(n.kernelShape=[o,u,c],null==h[0]?n.outputShape=h.slice(1):n.outputShape=h,n.activation=v,n.activationFunc=p[v],"valid"!==_&&"same"!==_)throw new Error(n.name+" [Deconvolution2D layer] Invalid borderMode.");if(n.borderMode=_,n.subsample=y,"tf"!==w&&"th"!==w)throw new Error(n.name+" [Deconvolution2D layer] Only tf and th dim ordering are allowed.");return n.dimOrdering=w,n.bias=E,n.params=n.bias?["W","b"]:["W"],n.gpu&&weblas&&(n._useWeblas=!0,n._pipelineEnabled=!1),n}return s(e,t),l(e,[{key:"setWeights",value:function(t){"th"===this.dimOrdering&&(t[0].tensor=t[0].tensor.transpose(2,3,1,0)),c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setWeights",this).call(this,t),this._wRowsMat=this._w2row(),this._useWeblas&&(this._wRowsMat.createWeblasTensor(),this._wRowsMat._gpuMaxSizeExceeded||(this._wRowsMat.weblasTensor=this._wRowsMat.weblasTensor.transpose()))}},{key:"_calcOutputPadding",value:function(t){var e=t.tensor.shape[0],n=t.tensor.shape[1],r=this.kernelShape[1],o=this.kernelShape[2],i=this.outputShape[0],a=this.outputShape[1],s="same"===this.borderMode?Math.max(0,Math.floor((e-1)*this.subsample[0]+r-i)):0,u="same"===this.borderMode?Math.max(0,Math.floor((n-1)*this.subsample[1]+o-a)):0,l=Math.floor(s/2),c=s-l,f=Math.floor(u/2),p=u-f;this.outputPadding=[l,c,f,p]}},{key:"_im2col",value:function(t){for(var e=u(t.tensor.shape,3),n=e[0],r=e[1],o=e[2],i=new d.default([],[n*r,o]),a=new d.default([],[n*r]),s=new d.default([],[n,r]),l=0;l0&&void 0!==arguments[0]?arguments[0]:{};return i(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t))}return s(e,t),l(e,[{key:"_im2col",value:function(t){var e=u(t.tensor.shape,3),n=e[0],r=e[1],o=e[2],i=this.kernelShape[1],a=this.kernelShape[2],s=this.outputShape[0],l=this.outputShape[1],c=s*l,f=i*a;this._imColsMat||(this._imColsMat=new h.default([],[c*o,f]));for(var p=new h.default([],[i,a,1]),d=0,v=0;v0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="SeparableConvolution2D";var r=t.nbFilter,o=void 0===r?1:r,s=t.nbRow,u=void 0===s?1:s,l=t.nbCol,c=void 0===l?1:l,p=t.activation,h=void 0===p?"linear":p,d=t.borderMode,v=void 0===d?"valid":d,m=t.subsample,_=void 0===m?[1,1]:m,g=t.depthMultiplier,y=void 0===g?1:g,b=t.dimOrdering,w=void 0===b?"tf":b,x=t.bias,E=void 0===x||x;if(n.activation=h,n.activationFunc=f[h],"valid"!==v&&"same"!==v)throw new Error(n.name+" [SeparableConvolution2D layer] Invalid borderMode.");if(n.borderMode=v,n.subsample=_,n.depthMultiplier=y,"tf"!==w&&"th"!==w)throw new Error(n.name+" [SeparableConvolution2D layer] Only tf and th dim ordering are allowed.");return n.dimOrdering=w,n.bias=E,n.params=n.bias?["depthwise_kernel","pointwise_kernel","b"]:["depthwise_kernel","pointwise_kernel"],n.depthwiseConvAttrs={nbFilter:n.depthMultiplier,nbRow:u,nbCol:c,activation:"linear",borderMode:v,subsample:_,dimOrdering:w,bias:!1,gpu:t.gpu},n.pointwiseConvAttrs={nbFilter:o,nbRow:1,nbCol:1,activation:"linear",borderMode:v,subsample:[1,1],dimOrdering:w,bias:n.bias,gpu:t.gpu},n}return s(e,t),l(e,[{key:"setWeights",value:function(t){this._depthwiseConv=new x(this.depthwiseConvAttrs),this._depthwiseConv.setWeights(t.slice(0,1)),this._pointwiseConv=new _.default(this.pointwiseConvAttrs),this._pointwiseConv.setWeights(t.slice(1,3))}},{key:"call",value:function(t){var e=this._depthwiseConv.call(t),n=this._pointwiseConv.call(e);return t.tensor=n.tensor,this.activationFunc(t),t}}]),e}(v.default);e.default=E},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="UpSampling1D";var r=t.length,a=void 0===r?2:r;return n.length=a,n}return a(e,t),s(e,[{key:"call",value:function(t){for(var e=t.tensor.shape,n=[e[0]*this.length,e[1]],r=new f.default([],n),o=0;o0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="UpSampling2D";var r=t.size,a=void 0===r?[2,2]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.size=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,0));for(var e=t.tensor.shape,n=[e[0]*this.size[0],e[1]*this.size[1],e[2]],r=new f.default([],n),o=0;o0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="UpSampling3D";var r=t.size,a=void 0===r?[2,2,2]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.size=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,3,0));for(var e=t.tensor.shape,n=[e[0]*this.size[0],e[1]*this.size[1],e[2]*this.size[2],e[3]],r=new f.default([],n),o=0;o0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="ZeroPadding1D";var r=t.padding,a=void 0===r?1:r;return n.padding=a,n}return a(e,t),s(e,[{key:"call",value:function(t){var e=t.tensor.shape,n=[e[0]+2*this.padding,e[1]],r=new f.default([],n);return h.default.assign(r.tensor.hi(e[0]+this.padding,e[1]).lo(this.padding,0),t.tensor),t.tensor=r.tensor,t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="ZeroPadding2D";var r=t.padding,a=void 0===r?[1,1]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.padding=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,0));var e=t.tensor.shape,n=[e[0]+2*this.padding[0],e[1]+2*this.padding[1],e[2]],r=new f.default([],n);return h.default.assign(r.tensor.hi(e[0]+this.padding[0],e[1]+this.padding[1],e[2]).lo(this.padding[0],this.padding[1],0),t.tensor),t.tensor=r.tensor,"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(2,0,1)),t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="ZeroPadding3D";var r=t.padding,a=void 0===r?[1,1,1]:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.padding=a,n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,3,0));var e=t.tensor.shape,n=[e[0]+2*this.padding[0],e[1]+2*this.padding[1],e[2]+2*this.padding[2],e[3]],r=new f.default([],n);return h.default.assign(r.tensor.hi(e[0]+this.padding[0],e[1]+this.padding[1],e[2]+this.padding[2],e[3]).lo(this.padding[0],this.padding[1],this.padding[2],0),t.tensor),t.tensor=r.tensor,"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(3,0,1,2)),t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.Cropping3D=e.Cropping2D=e.Cropping1D=e.ZeroPadding3D=e.ZeroPadding2D=e.ZeroPadding1D=e.UpSampling3D=e.UpSampling2D=e.UpSampling1D=e.Convolution3D=e.Deconvolution2D=e.SeparableConvolution2D=e.AtrousConvolution2D=e.Convolution2D=e.Convolution1D=void 0;var o=n(237),i=r(o),a=n(69),s=r(a),u=n(236),l=r(u),c=n(243),f=r(c),p=n(242),h=r(p),d=n(238),v=r(d),m=n(244),_=r(m),g=n(245),y=r(g),b=n(246),w=r(b),x=n(247),E=r(x),T=n(248),O=r(T),S=n(249),P=r(S),M=n(239),j=r(M),A=n(240),C=r(A),R=n(241),k=r(R);e.Convolution1D=i.default,e.Convolution2D=s.default,e.AtrousConvolution2D=l.default,e.SeparableConvolution2D=f.default,e.Deconvolution2D=h.default,e.Convolution3D=v.default,e.UpSampling1D=_.default,e.UpSampling2D=y.default,e.UpSampling3D=w.default,e.ZeroPadding1D=E.default,e.ZeroPadding2D=O.default,e.ZeroPadding3D=P.default,e.Cropping1D=j.default,e.Cropping2D=C.default,e.Cropping3D=k.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Activation";var r=t.activation,o=void 0===r?"linear":r;if(n.activation=o,n.activationFunc=c[o],n.gpu&&weblas&&(n._useWeblas=!0,n.pipeline)){var s=(0,d.default)(n.layerClass,t);s?(n._pipelineEnabled=!0,n.webglActivation=new m.default):n._pipelineEnabled=!1}return n}return s(e,t),u(e,[{key:"_callPipelineMode",value:function(t){return t._fromPipeline?(t.weblasTensor=this.webglActivation.call(t.weblasTensor,this.activation),t):this._callRegularMode(t)}},{key:"_callRegularMode",value:function(t){return this.activationFunc(t),t}},{key:"call",value:function(t){return this._pipelineEnabled?this._callPipelineMode(t):this._callRegularMode(t)}}]),e}(p.default);e.default=_},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Dense";var r=t.outputDim,o=void 0===r?1:r,s=t.activation,u=void 0===s?"linear":s,l=t.inputDim,c=void 0===l?null:l,p=t.bias,h=void 0===p||p;return n.activation=u,n.activationFunc=f[u],n.outputDim=o,n.inputDim=c,n.bias=h,n.params=n.bias?["W","b"]:["W"],n.inputDim&&(n.inputShape=[n.inputDim]),n.gpu&&weblas&&(n._useWeblas=!0,n._pipelineEnabled=!1),n}return s(e,t),u(e,[{key:"setWeights",value:function(t){l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setWeights",this).call(this,t),this._useWeblas&&(this.weights.W.createWeblasTensor(),this.weights.W._gpuMaxSizeExceeded||(this.weights.W.weblasTensor=this.weights.W.weblasTensor.transpose()),this.bias?this.weights.b.createWeblasTensor():(this._zerosVec=new h.default([],[this.weights.W.tensor.shape[1]]),this._zerosVec.createWeblasTensor()))}},{key:"call",value:function(t){var e=new h.default([],[this.outputDim]);if(this._useWeblas&&t.createWeblasTensor(),!this._useWeblas||t._gpuMaxSizeExceeded||this.weights.W._gpuMaxSizeExceeded)this.bias&&g.default.assign(e.tensor,this.weights.b.tensor),(0,m.gemv)(1,this.weights.W.tensor.transpose(1,0),t.tensor,1,e.tensor);else{var n=this.bias?this.weights.b.weblasTensor:this._zerosVec.weblasTensor;e.tensor.data=weblas.pipeline.sgemm(1,t.weblasTensor,this.weights.W.weblasTensor,1,n).transfer()}return t.tensor=e.tensor,this.activationFunc(t),t}}]),e}(v.default);e.default=y},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Dropout";var r=t.p,a=void 0===r?.5:r;return n.p=Math.min(Math.max(0,a),1),n}return a(e,t),s(e,[{key:"call",value:function(t){return t}}]),e}(l.default);e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="Flatten",n}return a(e,t),s(e,[{key:"call",value:function(t){if(t.tensor.shape.length>1){var e=new l.default([],[t.tensor.shape.reduce(function(t,e){return t*e},1)]);e.replaceTensorData(t.tensor.data),t.tensor=e.tensor}return t}}]),e}(f.default);e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n._computeOutput=(0,y.default)({args:["array","array","array"],body:function(t,e,n){t=e*n+(1-n)*t}}),n.layerClass="Highway";var r=t.transformBias,o=void 0===r?-2:r,s=t.activation,u=void 0===s?"linear":s,l=t.bias,f=void 0===l||l;return n.transformBias=o,n.activation=u,n.activationFunc=c[u],n.bias=f,n.params=n.bias?["W","b","W_carry","b_carry"]:["W","W_carry"],n}return s(e,t),u(e,[{key:"call",value:function(t){var e=new p.default([],[this.weights.W.tensor.shape[1]]);this.bias&&_.default.assign(e.tensor,this.weights.b.tensor),(0,v.gemv)(1,this.weights.W.tensor.transpose(1,0),t.tensor,1,e.tensor),this.activationFunc(e);var n=new p.default([],[this.weights.W_carry.tensor.shape[1]]);return this.bias&&_.default.assign(n.tensor,this.weights.b_carry.tensor),(0,v.gemv)(1,this.weights.W_carry.tensor.transpose(1,0),t.tensor,1,n.tensor),c.sigmoid(n),this._computeOutput(t.tensor,e.tensor,n.tensor),t}}]),e}(d.default);e.default=b},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="MaxoutDense";var r=t.outputDim,a=void 0===r?1:r,s=t.inputDim,u=void 0===s?null:s,l=t.bias,c=void 0===l||l;return n.outputDim=a,n.inputDim=u,n.bias=c,n.params=n.bias?["W","b"]:["W"],n}return a(e,t),s(e,[{key:"call",value:function(t){for(var e=this.weights.W.tensor.shape[0],n=new l.default([],[this.outputDim]),r=0;r0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Merge";var r=t.mode,o=void 0===r?"sum":r,s=t.concatAxis,u=void 0===s?-1:s,l=t.dotAxes,c=void 0===l?-1:l,f=t.outputShape,p=void 0===f?null:f,h=t.outputMask,d=void 0===h?null:h,v=["sum","mul","concat","ave","cos","dot","max"];if(!(v.indexOf(o)>-1))throw new Error(n.name+" [Merge layer] "+o+" not available.");if(n.mode=o,n.concatAxis=u<=0?u:u-1,Array.isArray(c)?n.dotAxes=[c[0]<=0?c[0]:c[0]-1,c[1]<=0?c[1]:c[1]-1]:n.dotAxes=[c<=0?c:c-1,c<=0?c:c-1],n.outputShape=p,n.outputMask=d,n.gpu&&weblas&&(n._useWeblas=!0,n.pipeline)){var m=(0,M.default)(n.layerClass,t);m?(n._pipelineEnabled=!0,n.webglMerge=new A.default(n.mode)):n._pipelineEnabled=!1}return n}return s(e,t),u(e,[{key:"_validateInputs",value:function(t){var e=t.map(function(t){return t.tensor.shape.slice()});if(["sum","mul","ave","cos","max"].indexOf(this.mode)>-1&&!e.every(function(t){return(0,x.default)(t,e[0])}))throw new Error(this.name+" [Merge layer] All input shapes must be the same for mode "+this.mode+".");if(["cos","dot"].indexOf(this.mode)>-1){if(2!==t.length)throw new Error(this.name+" [Merge layer] Exactly 2 inputs required for mode "+this.mode+".");if(this.dotAxes[0]<0&&(this.dotAxes[0]=e[0].length+this.dotAxes[0]),this.dotAxes[1]<0&&(this.dotAxes[1]=e[1].length+this.dotAxes[1]),e[0][this.dotAxes[0]]!==e[1][this.dotAxes[1]])throw new Error(this.name+" [Merge layer] Dimensions incompatibility using dot mode.")}else if("concat"===this.mode){var n=e.slice(),r=this.concatAxis<0?n[0].length+this.concatAxis:this.concatAxis;if(0===this.concatAxis&&(r=0),(0,T.default)(n.length).forEach(function(t){n[t].splice(r,1)}),!n.every(function(t){return(0,x.default)(t,n[0])}))throw new Error(this.name+" [Merge layer] In concat mode, all shapes must be the same except along the concat axis.")}return!0}},{key:"_callPipelineMode",value:function(t){if(!t.every(function(t){return t._fromPipeline}))return this._callRegularMode(t);var e=new c.default([],t[0].weblasTensor.shape);return e.weblasTensor=this.webglMerge.call(t.map(function(t){return t.weblasTensor})),e._fromPipeline=!0,e._actualShape=t[0]._actualShape,"concat"===this.mode&&(e._actualShape=[].concat(o(t[0]._actualShape.slice(0,-1)),[(0,S.default)(t.map(function(t){return t._actualShape.slice(-1)[0]}))])),e}},{key:"_callRegularMode",value:function(t){var e=this._validateInputs(t);if(!e)throw new Error(this.name+" [Merge layer] Invalid inputs to call method.");var n=void 0,r=void 0;if(["sum","mul","ave","max"].indexOf(this.mode)>-1)r=t[0].tensor.shape.slice(),n=new c.default([],r);else if("concat"===this.mode){r=t[0].tensor.shape.slice();var o=this.concatAxis<0?r.length+this.concatAxis:this.concatAxis;0===this.concatAxis&&(o=0),t.slice(1,t.length).forEach(function(t){var e=t.tensor.shape.slice()[o];r[o]+=e}),n=new c.default([],r)}else if(["cos","dot"].indexOf(this.mode)>-1){var i=t[0].tensor.shape.slice(),a=t[1].tensor.shape.slice();i.splice(this.dotAxes[0],1),a.splice(this.dotAxes[1],1),r=i.concat(a),1===r.length&&r.push(1),n=new c.default([],r)}if("sum"===this.mode)for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Permute";var r=t.dims,o=void 0===r?[]:r;return n.dims=o.map(function(t){return t-1}),n}return s(e,t),u(e,[{key:"call",value:function(t){var e;if(this.dims.length!==t.tensor.shape.length)throw new Error(this.name+" [Permute layer] The specified dims permutation must match the number of dimensions.");return t.tensor=(e=t.tensor).transpose.apply(e,o(this.dims)),t}}]),e}(c.default);e.default=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="RepeatVector";var r=t.n,a=void 0===r?1:r;return n.n=a,n}return a(e,t),s(e,[{key:"call",value:function(t){if(1!==t.tensor.shape.length)throw new Error(this.name+" [RepeatVector layer] Only 1D tensor inputs allowed.");return t.tensor=(0,h.default)((0,f.default)(t.tensor,0),[this.n,1]),t}}]),e}(l.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Reshape";var r=t.targetShape,a=void 0===r?[]:r;return n.targetShape=a,n}return a(e,t),s(e,[{key:"call",value:function(t){if(this.targetShape.reduce(function(t,e){return t*e},1)!==t.tensor.size)throw new Error(this.name+" [Reshape layer] The total size of new array must be unchanged in reshape layer.");var e=new l.default([],this.targetShape);return e.replaceTensorData(t.tensor.data),t.tensor=e.tensor,t}}]),e}(f.default);e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="SpatialDropout2D";var r=t.p,a=void 0===r?.5:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.p=Math.min(Math.max(0,a),1),n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){return t}}]),e}(l.default);e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="SpatialDropout3D";var r=t.p,a=void 0===r?.5:r,s=t.dimOrdering,u=void 0===s?"tf":s;return n.p=Math.min(Math.max(0,a),1),n.dimOrdering=u,n}return a(e,t),s(e,[{key:"call",value:function(t){return t}}]),e}(l.default);e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.MaxoutDense=e.Highway=e.Merge=e.RepeatVector=e.Permute=e.Reshape=e.Flatten=e.SpatialDropout3D=e.SpatialDropout2D=e.Dropout=e.Activation=e.Dense=void 0; var o=n(252),i=r(o),a=n(251),s=r(a),u=n(253),l=r(u),c=n(261),f=r(c),p=n(262),h=r(p),d=n(254),v=r(d),m=n(260),_=r(m),g=n(258),y=r(g),b=n(259),w=r(b),x=n(257),E=r(x),T=n(255),O=r(T),S=n(256),P=r(S);e.Dense=i.default,e.Activation=s.default,e.Dropout=l.default,e.SpatialDropout2D=f.default,e.SpatialDropout3D=h.default,e.Flatten=v.default,e.Reshape=_.default,e.Permute=y.default,e.RepeatVector=w.default,e.Merge=E.default,e.Highway=O.default,e.MaxoutDense=P.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Embedding";var r=t.inputDim,a=void 0===r?1:r,s=t.outputDim,u=void 0===s?1:s,l=t.inputLength,c=void 0===l?0:l,f=t.maskZero,p=void 0!==f&&f,h=t.dropout,d=void 0===h?0:h;return n.inputDim=a,n.outputDim=u,n.inputLength=c,n.maskZero=p,n.dropout=d,n.params=["W"],n}return a(e,t),s(e,[{key:"call",value:function(t){for(var e=new f.default([],[t.tensor.shape[0],this.weights.W.tensor.shape[1]]),n=0,r=t.tensor.shape[0];n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="GaussianDropout";var r=t.p,a=void 0===r?.5:r;return n.p=Math.min(Math.max(0,a),1),n}return a(e,t),s(e,[{key:"call",value:function(t){return t}}]),e}(l.default);e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="GaussianNoise";t.sigma;return n}return a(e,t),s(e,[{key:"call",value:function(t){return t}}]),e}(l.default);e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.GaussianNoise=e.GaussianDropout=void 0;var o=n(266),i=r(o),a=n(267),s=r(a);e.GaussianDropout=i.default,e.GaussianNoise=s.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="BatchNormalization";var r=t.epsilon,a=void 0===r?.001:r,s=t.mode,u=void 0===s?0:s,l=t.axis,c=void 0===l?-1:l;if(n.epsilon=a,n.mode=u,n.axis=c,n.axisNormalized=!1,n.params=0===n.mode?["gamma","beta","running_mean","running_std"]:["gamma","beta"],n.gpu&&weblas&&(n._useWeblas=!0,n.pipeline)){var f=(0,b.default)(n.layerClass,t);f?(n._pipelineEnabled=!0,n.webglBatchNorm=new x.default):n._pipelineEnabled=!1}return n}return a(e,t),s(e,[{key:"setWeights",value:function(t){var n=this;u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setWeights",this).call(this,t),this._useWeblas&&this.params.forEach(function(t){n.weights[t].createWeblasTensor()})}},{key:"_callPipelineMode",value:function(t){return t._fromPipeline?(t.weblasTensor=this.webglBatchNorm.call(t.weblasTensor,this.epsilon,this.weights.gamma.weblasTensor,this.weights.beta.weblasTensor,this.weights.running_mean.weblasTensor,this.weights.running_std.weblasTensor),t):this._callRegularMode(t)}},{key:"_callRegularMode",value:function(t){var e=this;this.axisNormalized||(this.axis=this.axis<0?t.tensor.shape.length+this.axis:this.axis-1,this.axisNormalized=!0);for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="AveragePooling1D",n.poolingFunc="average",n}return a(e,t),e}(u.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(142),u=r(s),l=n(51),c=r(l),f=n(140),p=r(f),h=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));if(n.layerClass="AveragePooling2D",n.poolingFunc="average",n.gpu&&weblas&&(n._useWeblas=!0,n.pipeline)){var r=(0,c.default)(n.layerClass,t);r?(n._pipelineEnabled=!0,n.webglPooling2D=new p.default(n.poolingFunc)):n._pipelineEnabled=!1}return n}return a(e,t),e}(u.default);e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(143),u=r(s),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="AveragePooling3D",n.poolingFunc="average",n}return a(e,t),e}(u.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="GlobalAveragePooling1D",n}return a(e,t),u(e,[{key:"call",value:function(t){for(var e=s(t.tensor.shape,2),n=e[0],r=e[1],o=new p.default([],[r]),i=0,a=r;i0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="GlobalAveragePooling2D";var r=t.dimOrdering,a=void 0===r?"tf":r;return n.dimOrdering=a,n}return a(e,t),u(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,0));for(var e=s(t.tensor.shape,3),n=e[0],r=e[1],o=e[2],i=new p.default([],[o]),a=0,u=o;a0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="GlobalMaxPooling1D",n}return a(e,t),s(e,[{key:"call",value:function(t){for(var e=t.tensor.shape[1],n=new f.default([],[e]),r=0,o=e;r0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="GlobalMaxPooling2D";var r=t.dimOrdering,a=void 0===r?"tf":r;return n.dimOrdering=a,n}return a(e,t),s(e,[{key:"call",value:function(t){"th"===this.dimOrdering&&(t.tensor=t.tensor.transpose(1,2,0));for(var e=t.tensor.shape[2],n=new f.default([],[e]),r=0,o=e;r0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="MaxPooling1D",n.poolingFunc="max",n}return a(e,t),e}(u.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(142),u=r(s),l=n(51),c=r(l),f=n(140),p=r(f),h=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));if(n.layerClass="MaxPooling2D",n.poolingFunc="max",n.gpu&&weblas&&(n._useWeblas=!0,n.pipeline)){var r=(0,c.default)(n.layerClass,t);r?(n._pipelineEnabled=!0,n.webglPooling2D=new p.default(n.poolingFunc)):n._pipelineEnabled=!1}return n}return a(e,t),e}(u.default);e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(143),u=r(s),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.layerClass="MaxPooling3D",n.poolingFunc="max",n}return a(e,t),e}(u.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalAveragePooling2D=e.GlobalMaxPooling2D=e.GlobalAveragePooling1D=e.GlobalMaxPooling1D=e.AveragePooling3D=e.AveragePooling2D=e.AveragePooling1D=e.MaxPooling3D=e.MaxPooling2D=e.MaxPooling1D=void 0;var o=n(278),i=r(o),a=n(279),s=r(a),u=n(280),l=r(u),c=n(271),f=r(c),p=n(272),h=r(p),d=n(273),v=r(d),m=n(276),_=r(m),g=n(274),y=r(g),b=n(277),w=r(b),x=n(275),E=r(x);e.MaxPooling1D=i.default,e.MaxPooling2D=s.default,e.MaxPooling3D=l.default,e.AveragePooling1D=f.default,e.AveragePooling2D=h.default,e.AveragePooling3D=v.default,e.GlobalMaxPooling1D=_.default,e.GlobalAveragePooling1D=y.default,e.GlobalMaxPooling2D=w.default,e.GlobalAveragePooling2D=E.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n._combine=(0,y.default)({args:["array","array","array","array"],body:function(t,e,n,r){t=e+n+r}}),n._update=(0,y.default)({args:["array","array","array"],body:function(t,e,n){t=t*(1-n)+e*n}}),n.layerClass="GRU";var r=t.outputDim,o=void 0===r?1:r,s=t.activation,u=void 0===s?"tanh":s,l=t.innerActivation,f=void 0===l?"hardSigmoid":l,p=t.returnSequences,h=void 0!==p&&p,d=t.goBackwards,v=void 0!==d&&d,m=t.stateful,_=void 0!==m&&m;return n.outputDim=o,n.activation=u,n.innerActivation=f,n.activationFunc=c[u],n.innerActivationFunc=c[f],n.returnSequences=h,n.goBackwards=v,n.stateful=_,n.params=["W_z","U_z","b_z","W_r","U_r","b_r","W_h","U_h","b_h"],n}return s(e,t),u(e,[{key:"call",value:function(t){var e=this,n=new p.default([],[t.tensor.shape[1]]),r=this.weights.b_z.tensor.shape[0],o=this.weights.b_r.tensor.shape[0],i=this.weights.b_h.tensor.shape[0],a=new p.default([],[r]),s=new p.default([],[r]),u=new p.default([],[r]),l=new p.default([],[o]),c=new p.default([],[o]),f=new p.default([],[o]),h=this.stateful&&this.currentHiddenState?this.currentHiddenState:new p.default([],[i]),d=new p.default([],[i]),m=new p.default([],[i]),g=new p.default([],[i]);this.hiddenStateSequence=new p.default([],[t.tensor.shape[0],i]);for(var y=function(){var t=[s,u,c,f,d,m];t.forEach(function(t){return _.default.assigns(t.tensor,0)})},b=function(){_.default.assign(g.tensor,h.tensor),(0,v.gemv)(1,e.weights.W_z.tensor.transpose(1,0),n.tensor,1,s.tensor),(0,v.gemv)(1,e.weights.U_z.tensor.transpose(1,0),g.tensor,1,u.tensor),e._combine(a.tensor,s.tensor,u.tensor,e.weights.b_z.tensor),e.innerActivationFunc(a),(0,v.gemv)(1,e.weights.W_r.tensor.transpose(1,0),n.tensor,1,c.tensor),(0,v.gemv)(1,e.weights.U_r.tensor.transpose(1,0),g.tensor,1,f.tensor),e._combine(l.tensor,c.tensor,f.tensor,e.weights.b_r.tensor),e.innerActivationFunc(l),_.default.muleq(l.tensor,g.tensor),(0,v.gemv)(1,e.weights.W_h.tensor.transpose(1,0),n.tensor,1,d.tensor),(0,v.gemv)(1,e.weights.U_h.tensor.transpose(1,0),l.tensor,1,m.tensor),e._combine(h.tensor,d.tensor,m.tensor,e.weights.b_h.tensor),e.activationFunc(h),e._update(h.tensor,g.tensor,a.tensor)},w=0,x=t.tensor.shape[0];w0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n._combine=(0,y.default)({args:["array","array","array","array"],body:function(t,e,n,r){t=e+n+r}}),n._update=(0,y.default)({args:["array","array","array","array"],body:function(t,e,n,r){t=t*n+e*r}}),n.layerClass="LSTM";var r=t.outputDim,o=void 0===r?1:r,s=t.activation,u=void 0===s?"tanh":s,l=t.innerActivation,f=void 0===l?"hardSigmoid":l,p=t.returnSequences,h=void 0!==p&&p,d=t.goBackwards,v=void 0!==d&&d,m=t.stateful,_=void 0!==m&&m;return n.outputDim=o,n.activation=u,n.innerActivation=f,n.activationFunc=c[u],n.innerActivationFunc=c[f],n.returnSequences=h,n.goBackwards=v,n.stateful=_,n.params=["W_i","U_i","b_i","W_c","U_c","b_c","W_f","U_f","b_f","W_o","U_o","b_o"],n}return s(e,t),u(e,[{key:"call",value:function(t){var e=this,n=new p.default([],[t.tensor.shape[1]]),r=this.weights.b_i.tensor.shape[0],o=this.weights.b_c.tensor.shape[0],i=this.weights.b_f.tensor.shape[0],a=this.weights.b_o.tensor.shape[0],s=new p.default([],[r]),u=new p.default([],[r]),l=new p.default([],[r]),c=new p.default([],[i]),f=new p.default([],[i]),h=new p.default([],[i]),d=new p.default([],[a]),m=new p.default([],[a]),g=new p.default([],[a]),y=new p.default([],[o]),b=new p.default([],[o]),w=new p.default([],[o]),x=this.stateful&&this.previousCandidate?this.previousCandidate:new p.default([],[o]),E=this.stateful&&this.currentHiddenState?this.currentHiddenState:new p.default([],[o]),T=new p.default([],[o]);this.hiddenStateSequence=new p.default([],[t.tensor.shape[0],o]);for(var O=function(){var t=[u,l,f,h,m,g,b,w];t.forEach(function(t){return _.default.assigns(t.tensor,0)})},S=function(){_.default.assign(T.tensor,E.tensor),(0,v.gemv)(1,e.weights.W_i.tensor.transpose(1,0),n.tensor,1,u.tensor),(0,v.gemv)(1,e.weights.U_i.tensor.transpose(1,0),T.tensor,1,l.tensor),e._combine(s.tensor,u.tensor,l.tensor,e.weights.b_i.tensor),e.innerActivationFunc(s),(0,v.gemv)(1,e.weights.W_f.tensor.transpose(1,0),n.tensor,1,f.tensor),(0,v.gemv)(1,e.weights.U_f.tensor.transpose(1,0),T.tensor,1,h.tensor),e._combine(c.tensor,f.tensor,h.tensor,e.weights.b_f.tensor),e.innerActivationFunc(c),(0,v.gemv)(1,e.weights.W_o.tensor.transpose(1,0),n.tensor,1,m.tensor),(0,v.gemv)(1,e.weights.U_o.tensor.transpose(1,0),T.tensor,1,g.tensor),e._combine(d.tensor,m.tensor,g.tensor,e.weights.b_o.tensor),e.innerActivationFunc(d), (0,v.gemv)(1,e.weights.W_c.tensor.transpose(1,0),n.tensor,1,b.tensor),(0,v.gemv)(1,e.weights.U_c.tensor.transpose(1,0),T.tensor,1,w.tensor),e._combine(y.tensor,b.tensor,w.tensor,e.weights.b_c.tensor),e.activationFunc(y),e._update(y.tensor,x.tensor,s.tensor,c.tensor),_.default.assign(x.tensor,y.tensor),e.activationFunc(y),_.default.mul(E.tensor,d.tensor,y.tensor)},P=0,M=t.tensor.shape[0];P0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n._combine=(0,y.default)({args:["array","array","array","array"],body:function(t,e,n,r){t=e+n+r}}),n.layerClass="SimpleRNN";var r=t.outputDim,o=void 0===r?1:r,s=t.activation,u=void 0===s?"tanh":s,l=t.returnSequences,f=void 0!==l&&l,p=t.goBackwards,h=void 0!==p&&p,d=t.stateful,v=void 0!==d&&d;return n.outputDim=o,n.activation=u,n.activationFunc=c[u],n.returnSequences=f,n.goBackwards=h,n.stateful=v,n.params=["W","U","b"],n}return s(e,t),u(e,[{key:"call",value:function(t){var e=this,n=new p.default([],[t.tensor.shape[1]]),r=this.weights.b.tensor.shape[0],o=this.stateful&&this.currentHiddenState?this.currentHiddenState:new p.default([],[r]),i=new p.default([],[r]),a=new p.default([],[r]),s=new p.default([],[r]);this.hiddenStateSequence=new p.default([],[t.tensor.shape[0],r]);for(var u=function(){var t=[i,a];t.forEach(function(t){return _.default.assigns(t.tensor,0)})},l=function(){_.default.assign(s.tensor,o.tensor),(0,v.gemv)(1,e.weights.W.tensor.transpose(1,0),n.tensor,1,i.tensor),(0,v.gemv)(1,e.weights.U.tensor.transpose(1,0),s.tensor,1,a.tensor),e._combine(o.tensor,i.tensor,a.tensor,e.weights.b.tensor),e.activationFunc(o)},c=0,f=t.tensor.shape[0];c0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="Bidirectional";var r=t.layer,o=t.mergeMode,s=void 0===o?"concat":o;if(!r)throw new Error("[Bidirectional] wrapped layer is undefined.");n.forwardLayer=r;var u=(0,m.default)(r,["outputDim","activation","innerActivation","returnSequences","goBackwards","stateful"]);return u.goBackwards=!u.goBackwards,n.backwardLayer=new g[r.layerClass](u),n.mergeMode=s,n}return s(e,t),u(e,[{key:"setWeights",value:function(t){this.forwardLayer.setWeights(t.slice(0,t.length/2)),this.backwardLayer.setWeights(t.slice(t.length/2))}},{key:"call",value:function(t){var e=new p.default(t.tensor.data,t.tensor.shape),n=new p.default(t.tensor.data,t.tensor.shape),r=this.forwardLayer.call(e),o=this.backwardLayer.call(n);if("concat"===this.mergeMode){var i=r.tensor.shape.slice();i[i.length-1]+=o.tensor.shape[i.length-1];var a=new p.default([],i);this.forwardLayer.returnSequences?(d.default.assign(a.tensor.hi(i[0],r.tensor.shape[1]).lo(0,0),r.tensor),d.default.assign(a.tensor.hi(i[0],i[1]).lo(0,r.tensor.shape[1]),o.tensor.step(-1))):(d.default.assign(a.tensor.hi(r.tensor.shape[0]).lo(0),r.tensor),d.default.assign(a.tensor.hi(i[0]).lo(r.tensor.shape[0]),o.tensor)),t.tensor=a.tensor}else if("sum"===this.mergeMode){var s=r.tensor.shape.slice(),u=new p.default([],s);d.default.addeq(u.tensor,r.tensor),d.default.addeq(u.tensor,o.tensor),t.tensor=u.tensor}else if("mul"===this.mergeMode){var l=r.tensor.shape.slice(),c=new p.default([],l);d.default.assigns(c.tensor,1),d.default.muleq(c.tensor,r.tensor),d.default.muleq(c.tensor,o.tensor),t.tensor=c.tensor}else if("ave"===this.mergeMode){var f=r.tensor.shape.slice(),h=new p.default([],f);d.default.addeq(h.tensor,r.tensor),d.default.addeq(h.tensor,o.tensor),d.default.divseq(h.tensor,2),t.tensor=h.tensor}return t}}]),e}(c.default);e.default=y},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.layerClass="TimeDistributed";var r=t.layer;if(!r)throw new Error("[TimeDistributed] wrapped layer is undefined.");return n.layer=r,n}return s(e,t),u(e,[{key:"setWeights",value:function(t){this.layer.setWeights(t)}},{key:"call",value:function(t){var e,n,r=[].concat(o(t.tensor.shape.slice(1))),i=new p.default([],r);d.default.assign(i.tensor,(e=t.tensor).pick.apply(e,[0].concat(o(r.map(function(t){return null})))));var a=this.layer.call(i),s=a.tensor.shape.slice(),u=new p.default([],[t.tensor.shape[0]].concat(o(s)));d.default.assign((n=u.tensor).pick.apply(n,[0].concat(o(s.map(function(t){return null})))),a.tensor);for(var l=1,c=t.tensor.shape[0];l0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function o(t){return 3*t.length/4-r(t)}function i(t){var e,n,o,i,a,s,u=t.length;a=r(t),s=new f(3*u/4-a),o=a>0?u-4:u;var l=0;for(e=0,n=0;e>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===a?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[l++]=255&i):1===a&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}function a(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function s(t,e,n){for(var r,o=[],i=e;ic?c:u+a));return 1===r?(e=t[n-1],o+=l[e>>2],o+=l[e<<4&63],o+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],o+=l[e>>10],o+=l[e>>4&63],o+=l[e<<2&63],o+="="),i.push(o),i.join("")}e.byteLength=o,e.toByteArray=i,e.fromByteArray=u;for(var l=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,d=p.length;h0)-(t<0)},e.abs=function(t){var e=t>>o-1;return(t^e)-e},e.min=function(t,e){return e^(t^e)&-(t65535)<<4,t>>>=e,n=(t>255)<<3,t>>>=n,e|=n,n=(t>15)<<2,t>>>=n,e|=n,n=(t>3)<<1,t>>>=n,e|=n,e|t>>1},e.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},e.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},e.countTrailingZeros=r,e.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},e.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},e.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var n=e,r=e,o=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--o;t[e]=r<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},e.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},e.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},e.interleave3=function(t,e,n){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,n&=1023,n=4278190335&(n|n<<16),n=251719695&(n|n<<8),n=3272356035&(n|n<<4),n=1227133513&(n|n<<2),t|n<<2},e.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},e.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>r(t)+1}},function(t,e,n){(function(e,n,r){!function(e){t.exports=e()}(function(){var t,o,i;return function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof _dereq_&&_dereq_;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return o(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof _dereq_&&_dereq_,a=0;a0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},o.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},n.exports=o,n.exports.firstLineError=u},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var o=!1,i=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(i,i,null,this,t)},s=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(i){o||(o=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(i),c=new t(e);c._propagateFrom(this,1);var f=this._target();if(c._setBoundTo(l),l instanceof t){var p={promiseRejectionQueued:!1,promise:c,target:f,bindingPromise:l};f._then(e,a,void 0,c,p),l._then(s,u,void 0,c,p),c._setOnCancel(l)}else c._resolveCallback(f);return c},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=this._bitField&-2097153},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===i&&(Promise=o)}catch(t){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=t("./promise")();i.noConflict=r,e.exports=i},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var o="Object "+s.classString(t)+" has no method '"+s.toString(n)+"'";throw new e.TypeError(o)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function o(t){return t[this]}function i(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}var a,s=t("./util"),u=s.canEvaluate;s.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=i;else if(u){var r=a(t);e=null!==r?r:o}else e=o;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,o){var i=t("./util"),a=i.tryCatch,s=i.errorObj,u=e._async;e.prototype.break=e.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(i.isArray(t))for(var n=0;n=0)return i[t]}var o=!1,i=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=i.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,i=t.prototype._popContext,a=t._peekContext,s=t.prototype._peekContext,u=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=i,t._peekContext=a,t.prototype._peekContext=s,t.prototype._promiseCreated=u,o=!1},o=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,n,r){"use strict";n.exports=function(n,r){function o(t,e){return{promise:e}}function i(){return!1}function a(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+D.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function s(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?D.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function u(){return this._onCancelField}function l(t){this._onCancelField=t}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function f(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(){var t=this._boundTo;return void 0!==t&&t instanceof n?t.isFulfilled()?t.value():void 0:t}function d(){this._trace=new R(this._peekContext())}function v(t,e){if(B(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=T(t);D.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),D.notEnumerableProp(t,"__stackCleaned__",!0)}}}function m(t,e,n,r,o){if(void 0===t&&null!==e&&$){if(void 0!==o&&o._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var i="",a="";if(e._trace){for(var s=e._trace.stack.split("\n"),u=x(s),l=u.length-1;l>=0;--l){var c=u[l];if(!X.test(c)){var f=c.match(W);f&&(i="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0)for(var p=u[0],l=0;l0&&(a="\n"+s[l-1]);break}}var h="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(h,!0,e)}}function _(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),g(n)}function g(t,e,r){if(at.warnings){var o,i=new L(t);if(e)r._attachExtraTrace(i);else if(at.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(i);else{var a=T(i);i.stack=a.message+"\n"+a.stack.join("\n")}et("warning",i)||O(i,"",!0)}}function y(t,e){for(var n=0;n=0;--s)if(r[s]===i){a=s;break}for(var s=a;s>=0;--s){var u=r[s];if(e[o]!==u)break;e.pop(),o--}e=r}}function x(t){for(var e=[],n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function T(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?E(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:x(e)}}function O(t,e,n){if("undefined"!=typeof console){var r;if(D.isObject(t)){var o=t.stack;r=e+G(o,t)}else r=e+String(t);"function"==typeof N?N(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function S(t,e,n,r){var o=!1;try{"function"==typeof e&&(o=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){F.throwLater(t)}"unhandledRejection"===t?et(t,n,r)||o||O(n,"Unhandled rejection "):et(t,r)}function P(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():D.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+M(e)+">, no stack trace)"}function M(t){var e=41;return t.length=s||(rt=function(t){if(V.test(t))return!0;var e=A(t);return!!(e&&e.fileName===n&&a<=e.line&&e.line<=s)})}}function R(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,R),e>32&&this.uncycle()}var k,I,N,U=n._getDomain,F=n._async,L=t("./errors").Warning,D=t("./util"),B=D.canAttachTrace,V=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,X=/\((?:timers\.js):\d+:\d+\)/,W=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,z=null,G=null,q=!1,H=!(0==D.env("BLUEBIRD_DEBUG")),Y=!(0==D.env("BLUEBIRD_WARNINGS")||!H&&!D.env("BLUEBIRD_WARNINGS")),K=!(0==D.env("BLUEBIRD_LONG_STACK_TRACES")||!H&&!D.env("BLUEBIRD_LONG_STACK_TRACES")),$=0!=D.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(Y||!!D.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=t._bitField&-1048577|524288},n.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),F.invokeLater(this._notifyUnhandledRejection,this,void 0))},n.prototype._notifyUnhandledRejectionIsHandled=function(){S("rejectionHandled",k,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),S("unhandledRejection",I,t,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-262145},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-1048577,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(t,e,n){return g(t,e,n||this)},n.onPossiblyUnhandledRejection=function(t){var e=U();I="function"==typeof t?null===e?t:D.domainBind(e,t):void 0},n.onUnhandledRejectionHandled=function(t){var e=U();k="function"==typeof t?null===e?t:D.domainBind(e,t):void 0};var Z=function(){};n.longStackTraces=function(){if(F.haveItemsQueued()&&!at.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!at.longStackTraces&&j()){var t=n.prototype._captureStackTrace,e=n.prototype._attachExtraTrace;at.longStackTraces=!0,Z=function(){if(F.haveItemsQueued()&&!at.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=t,n.prototype._attachExtraTrace=e,r.deactivateLongStackTraces(),F.enableTrampoline(),at.longStackTraces=!1},n.prototype._captureStackTrace=d,n.prototype._attachExtraTrace=v,r.activateLongStackTraces(),F.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return at.longStackTraces&&j()};var Q=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return D.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!D.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return D.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!D.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),D.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!D.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),J=function(){return D.isNode?function(){return e.emit.apply(e,arguments)}:D.global?function(t){var e="on"+t.toLowerCase(),n=D.global[e];return!!n&&(n.apply(D.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),tt={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:o},et=function(t){var e=!1;try{e=J.apply(null,arguments)}catch(t){F.throwLater(t),e=!0}var n=!1;try{n=Q(t,tt[t].apply(null,arguments))}catch(t){F.throwLater(t),n=!0}return n||e};n.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?n.longStackTraces():!t.longStackTraces&&n.hasLongStackTraces()&&Z()),"warnings"in t){var e=t.warnings;at.warnings=!!e,$=at.warnings,D.isObject(e)&&"wForgottenReturn"in e&&($=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!at.cancellation){if(F.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=c,n.prototype._propagateFrom=f,n.prototype._onCancel=u,n.prototype._setOnCancel=l,n.prototype._attachCancellationCallback=s,n.prototype._execute=a,nt=f,at.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!at.monitoring?(at.monitoring=!0,n.prototype._fireEvent=et):!t.monitoring&&at.monitoring&&(at.monitoring=!1, n.prototype._fireEvent=i)),n},n.prototype._fireEvent=i,n.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(t){},n.prototype._attachCancellationCallback=function(t){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(t,e){};var nt=p,rt=function(){return!1},ot=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;D.inherits(R,Error),r.CapturedTrace=R,R.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],n={},r=0,o=this;void 0!==o;++r)e.push(o),o=o._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var i=e[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;r0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var u=r>0?e[r-1]:this;s=0;--c)e[c]._length=l,l++;return}}}},R.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=T(t),n=e.message,r=[e.stack],o=this;void 0!==o;)r.push(x(o.stack.split("\n"))),o=o._parent;w(r),b(r),D.notEnumerableProp(t,"stack",y(n,r)),D.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():P(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,z=t,G=e;var n=Error.captureStackTrace;return rt=function(t){return V.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return z=/@/,G=e,q=!0,function(t){t.stack=(new Error).stack};var o;try{throw new Error}catch(t){o="stack"in t}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(G=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?P(e):e.toString()},null):(z=t,G=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(N=function(t){console.warn(t)},D.isNode&&e.stderr.isTTY?N=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:D.isNode||"string"!=typeof(new Error).stack||(N=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var at={warnings:Y,longStackTraces:!1,cancellation:!1,monitoring:!1};return K&&n.longStackTraces(),{longStackTraces:function(){return at.longStackTraces},warnings:function(){return at.warnings},cancellation:function(){return at.cancellation},monitoring:function(){return at.monitoring},propagateFromFunction:function(){return nt},boundValueFunction:function(){return h},checkForgottenReturns:m,setBounds:C,warn:g,deprecated:_,CapturedTrace:R,fireDomEvent:Q,fireGlobalEvent:J}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var o=function(){return r};return this.caught(n,o)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return i(this)}function r(t,n){return o(t,n,e,e)}var o=t.reduce,i=t.all;t.prototype.each=function(t){return o(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return o(this,t,e,e)},t.each=function(t,r){return o(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(f(this,"message","string"==typeof r?r:e),f(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return c(n,Error),n}function o(t){return this instanceof o?(f(this,"name","OperationalError"),f(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(f(this,"message",t.message),f(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new o(t)}var i,a,s=t("./es5"),u=s.freeze,l=t("./util"),c=l.inherits,f=l.notEnumerableProp,p=r("Warning","warning"),h=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),v=r("AggregateError","aggregate error");try{i=TypeError,a=RangeError}catch(t){i=r("TypeError","type error"),a=r("RangeError","range error")}for(var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),_=0;_1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function a(){return u.call(this,this.promise._target()._settledValue())}function s(t){if(!i(this,t))return f.e=t,f}function u(t){var r=this.promise,u=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?u.call(r._boundValue()):u.call(r._boundValue(),t);if(void 0!==l){r._setReturnedNonUndefined();var p=n(l,r);if(p instanceof e){if(null!=this.cancelPromise){if(p._isCancelled()){var h=new c("late cancellation observer");return r._attachExtraTrace(h),f.e=h,f}p.isPending()&&p._attachCancellationCallback(new o(this))}return p._then(a,s,void 0,this,void 0)}}}return r.isRejected()?(i(this),f.e=t,f):(i(this),t)}var l=t("./util"),c=e.CancellationError,f=l.errorObj;return r.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){i(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,o){return"function"!=typeof t?this.then():this._then(n,o,void 0,new r(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,u,u)},e.prototype.tap=function(t){return this._passThrough(t,1,u)},r}},{"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i,a){function s(t,n,r){for(var i=0;i0&&"function"==typeof arguments[e]){t=arguments[e];var r}var o=[].slice.call(arguments);t&&o.pop();var r=new n(o).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i,a){function s(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();var o=l();this._callback=null===o?e:c.domainBind(o,e),this._preservedValues=r===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],h.invoke(this._asyncInit,this,void 0)}function u(t,n,o,i){if("function"!=typeof n)return r("expecting a function but got "+c.classString(n));var a=0;if(void 0!==o){if("object"!=typeof o||null===o)return e.reject(new TypeError("options argument must be an object but it is "+c.classString(o)));if("number"!=typeof o.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+c.classString(o.concurrency)));a=o.concurrency}return a="number"==typeof a&&isFinite(a)&&a>=1?a:0,new s(t,n,a,i).promise()}var l=e._getDomain,c=t("./util"),f=c.tryCatch,p=c.errorObj,h=e._async;c.inherits(s,n),s.prototype._asyncInit=function(){this._init$(void 0,-2)},s.prototype._init=function(){},s.prototype._promiseFulfilled=function(t,n){var r=this._values,i=this.length(),s=this._preservedValues,u=this._limit;if(n<0){if(n=n*-1-1,r[n]=t,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return r[n]=t,this._queue.push(n),!1;null!==s&&(s[n]=t);var l=this._promise,c=this._callback,h=l._boundValue();l._pushContext();var d=f(c).call(h,t,n,i),v=l._popContext();if(a.checkForgottenReturns(d,v,null!==s?"Promise.filter":"Promise.map",l),d===p)return this._reject(d.e),!0;var m=o(d,this._promise);if(m instanceof e){m=m._target();var _=m._bitField;if(0===(50397184&_))return u>=1&&this._inFlight++,r[n]=m,m._proxy(this,(n+1)*-1),!1;if(0===(33554432&_))return 0!==(16777216&_)?(this._reject(m._reason()),!0):(this._cancel(),!0);d=m._value()}r[n]=d}var g=++this._totalResolved;return g>=i&&(null!==s?this._filter(r,s):this._resolve(r),!0)},s.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight1){i.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],c=arguments[2];u=a.isArray(l)?s(t).apply(c,l):s(t).call(c,l)}else u=s(t)();var f=r._popContext();return i.checkForgottenReturns(u,f,"Promise.try",r),r._resolveFromSyncValue(u),r},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&c.getPrototypeOf(t)===Error.prototype}function o(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=c.keys(t),o=0;o1){var n,r=new Array(e-1),o=0;for(n=0;n0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+d.classString(t);arguments.length>1&&(n+=", "+d.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+d.classString(t)):this.all()._then(t,void 0,void 0,x,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new O(this).promise()},i.prototype.error=function(t){return this.caught(d.originatesFromRejection,t)},i.getNewLibraryCopy=n.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(w);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=k(t)(C(e,n));return r===R&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new O(t).promise()},i.cast=function(t){var e=T(t);return e instanceof i||(e=new i(w),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(w);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new y("expecting a function but got "+d.classString(t));return _.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var a=void 0!==o,s=a?o:new i(w),u=this._target(),c=u._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&c)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var f=l();if(0!==(50397184&c)){var p,h,v=u._settlePromiseCtx;0!==(33554432&c)?(h=u._rejectionHandler0,p=t):0!==(16777216&c)?(h=u._fulfillmentHandler0,p=e,u._unsetRejectionIsUnhandled()):(v=u._settlePromiseLateCancellationObserver,h=new b("late cancellation observer"),u._attachExtraTrace(h),p=e),_.invoke(v,u,{handler:null===f?p:"function"==typeof p&&d.domainBind(f,p),promise:s,receiver:r,value:h})}else u._addCallbacks(t,e,s,r,f);return s},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=this._bitField&-65536|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){_.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==h)return void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,o=t._receiverAt(0);void 0===o&&(o=h),this._addCallbacks(e,n,r,o,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),o=t._promiseAt(e),i=t._receiverAt(e);void 0===i&&(i=h),this._addCallbacks(n,r,o,i,null)},i.prototype._addCallbacks=function(t,e,n,r,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===o?t:d.domainBind(o,t)),"function"==typeof e&&(this._rejectionHandler0=null===o?e:d.domainBind(o,e));else{var a=4*i-4;this[a+2]=n,this[a+3]=r,"function"==typeof t&&(this[a+0]=null===o?t:d.domainBind(o,t)),"function"==typeof e&&(this[a+1]=null===o?e:d.domainBind(o,e))}return this._setLength(i+1),i},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=T(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(c());var o=r._bitField;if(0===(50397184&o)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;s>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():_.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?_.fatalError(t,d.isNode):void((65535&e)>0?_.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;n0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){M.deprecated("Promise.defer","new Promise");var t=new i(w);return{promise:t,resolve:a,reject:s}},d.notEnumerableProp(i,"_makeSelfResolutionError",c),t("./method")(i,w,T,p,M),t("./bind")(i,w,T,M),t("./cancel")(i,O,p,M),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,O,T,w,_,l),i.Promise=i,i.version="3.4.7",t("./map.js")(i,O,p,T,w,M),t("./call_get.js")(i),t("./using.js")(i,p,T,P,w,M),t("./timers.js")(i,w,M),t("./generators.js")(i,p,w,T,r,M),t("./nodeify.js")(i),t("./promisify.js")(i,w),t("./props.js")(i,O,T,p),t("./race.js")(i,w,T,p),t("./reduce.js")(i,O,p,T,w,M),t("./settle.js")(i,O,M),t("./some.js")(i,O,p),t("./filter.js")(i,w),t("./each.js")(i,w),t("./any.js")(i),d.toFastProperties(i),d.toFastProperties(i.prototype),u({a:1}),u({b:2}),u({c:3}),u(1),u(function(){}),u(void 0),u(!1),u(new i(w)),M.setBounds(m.firstLineError,d.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i){function a(t){switch(t){case-2:return[];case-3:return{}}}function s(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var u=t("./util");u.isArray;return u.inherits(s,i),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,i){var s=r(this._values,this._promise);if(s instanceof e){s=s._target();var l=s._bitField;if(this._values=s,0===(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,i);if(0===(33554432&l))return 0!==(16777216&l)?this._reject(s._reason()):this._cancel(); s=s._value()}if(s=u.asArray(s),null===s){var c=o("expecting an array or an iterable object but got "+u.classString(s)).reason();return void this._promise._rejectCallback(c,!1)}return 0===s.length?void(i===-5?this._resolveEmptyArray():this._resolve(a(i))):void this._iterate(s)},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var o=this._promise,i=!1,a=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n=this._length){var r;if(this._isMap)r=p(this._values);else{r={};for(var o=this.length(),i=0,a=this.length();i>1},e.prototype.props=function(){return a(this)},e.props=function(t){return a(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,o){for(var i=0;i=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(t,e){var n=new i;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},o.prototype._promiseRejected=function(t,e){var n=new i;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new o(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function o(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function i(t,e){if((0|e)!==e||e<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new o(t),i=n.promise();return n.setHowMany(e),n.init(),i}var a=t("./util"),s=t("./errors").RangeError,u=t("./errors").AggregateError,l=a.isArray,c={};a.inherits(o,n),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=l(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(t){this._howMany=t},o.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},o.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},o.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(c),this._checkOutcome())},o.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new u,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},o.prototype._fulfilled=function(){return this._totalResolved},o.prototype._rejected=function(){return this._values.length-this.length()},o.prototype._addRejected=function(t){this._values.push(t)},o.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},o.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},o.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new s(e)},o.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return i(t,e)},e.prototype.some=function(t){return i(this,t)},e._SomePromiseArray=o}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},o=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},i=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},a=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return a.call(this._target())},t.prototype.isRejected=function(){return i.call(this._target())},t.prototype.isFulfilled=function(){return o.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(c(t)){if(t instanceof e)return t;var o=i(t);if(o===l){r&&r._pushContext();var u=e.reject(o.e);return r&&r._popContext(),u}if("function"==typeof o){if(a(t)){var u=new e(n);return t._then(u._fulfill,u._reject,void 0,u,null),u}return s(t,o,r)}}return t}function o(t){return t.then}function i(t){try{return o(t)}catch(t){return l.e=t,l}}function a(t){try{return f.call(t,"_promise0")}catch(t){return!1}}function s(t,r,o){function i(t){s&&(s._resolveCallback(t),s=null)}function a(t){s&&(s._rejectCallback(t,f,!0),s=null)}var s=new e(n),c=s;o&&o._pushContext(),s._captureStackTrace(),o&&o._popContext();var f=!0,p=u.tryCatch(r).call(t,i,a);return f=!1,s&&p===l&&(s._rejectCallback(p.e,!0,!0),s=null),c}var u=t("./util"),l=u.errorObj,c=u.isObject,f={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function o(t){this.handle=t}function i(t){return clearTimeout(this.handle),t}function a(t){throw clearTimeout(this.handle),t}var s=t("./util"),u=e.TimeoutError;o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(t){return c(+this).thenReturn(t)},c=e.delay=function(t,i){var a,s;return void 0!==i?(a=e.resolve(i)._then(l,null,null,t,void 0),r.cancellation()&&i instanceof e&&a._setOnCancel(i)):(a=new e(n),s=setTimeout(function(){a._fulfill()},+t),r.cancellation()&&a._setOnCancel(new o(s)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};e.prototype.delay=function(t){return c(t,this)};var f=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new u("operation timed out"):new u(e),s.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,s,u=new o(setTimeout(function(){n.isPending()&&f(n,e,s)},t));return r.cancellation()?(s=this.then(),n=s._then(i,a,void 0,u,void 0),n._setOnCancel(u)):n=this._then(i,a,void 0,u,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,o,i,a){function s(t){setTimeout(function(){throw t},0)}function u(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function l(t,n){function o(){if(a>=l)return c._fulfill();var i=u(t[a++]);if(i instanceof e&&i._isDisposable()){try{i=r(i._getDisposer().tryDispose(n),t.promise)}catch(t){return s(t)}if(i instanceof e)return i._then(o,s,null,null,null)}o()}var a=0,l=t.length,c=new e(i);return o(),c}function c(t,e,n){this._data=t,this._promise=e,this._context=n}function f(t,e,n){this.constructor$(t,e,n)}function p(t){return c.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function h(t){this.length=t,this.promise=null,this[t-1]=null}var d=t("./util"),v=t("./errors").TypeError,m=t("./util").inherits,_=d.errorObj,g=d.tryCatch,y={};c.prototype.data=function(){return this._data},c.prototype.promise=function(){return this._promise},c.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():y},c.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==y?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},c.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},m(f,c),f.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},h.prototype._resultCancelled=function(){for(var t=this.length,n=0;n0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new f(t,this,o());throw new v}}},{"./errors":12,"./util":36}],36:[function(t,r,o){"use strict";function i(){try{var t=C;return C=null,t.apply(this,arguments)}catch(t){return A.e=t,A}}function a(t){return C=t,i}function s(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function u(t){return"function"==typeof t||"object"==typeof t&&null!==t}function l(t){return s(t)?new Error(g(t)):t}function c(t,e){var n,r=t.length,o=new Array(r+1);for(n=0;n1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),o=N.test(t+"")&&M.names(t).length>0;if(n||r||o)return!0}return!1}catch(t){return!1}}function v(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function m(t){return U.test(t)}function _(t,e,n){for(var r=new Array(t),o=0;o10||t[0]>0}(),X.isNode&&X.toFastProperties(e);try{throw new Error}catch(t){X.lastLineError=t}r.exports=X},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(e,n(93),n(39),n(649).setImmediate)},function(t,e,n){"use strict";(function(t){function r(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function o(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function m(t){return+t!=t&&(t=0),a.alloc(+t)}function _(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(r)return G(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return j(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return R(this,e,n);case"base64":return M(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,o);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,o){function i(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,u=e.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}var l;if(o){var c=-1;for(l=n;ls&&(n=s-u),l=n;l>=0;l--){for(var f=!0,p=0;po&&(r=o)):r=o;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a239?4:i>223?3:i>191?2:1;if(o+s<=n){var u,l,c,f;switch(s){case 1:i<128&&(a=i);break;case 2:u=t[o+1],128===(192&u)&&(f=(31&i)<<6|63&u,f>127&&(a=f));break;case 3:u=t[o+1],l=t[o+2],128===(192&u)&&128===(192&l)&&(f=(15&i)<<12|(63&u)<<6|63&l,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:u=t[o+1],l=t[o+2],c=t[o+3],128===(192&u)&&128===(192&l)&&128===(192&c)&&(f=(15&i)<<18|(63&u)<<12|(63&l)<<6|63&c, f>65535&&f<1114112&&(a=f))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=s}return A(r)}function A(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var n="",r=0;rr)&&(n=r);for(var o="",i=e;in)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,n,r,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function F(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(r?o:1-o)}function L(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(r?o:3-o)&255}function D(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(t,e,n,r,o){return o||D(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(t,e,n,r,23,4),n+4}function V(t,e,n,r,o){return o||D(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(t,e,n,r,52,8),n+8}function X(t){if(t=W(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function W(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var n,r=t.length,o=null,i=[],a=0;a55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=(o-55296<<10|n-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function q(t){for(var e=[],n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function Y(t){return Z.toByteArray(X(t))}function K(t,e,n,r){for(var o=0;o=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function $(t){return t!==t}var Z=n(288),Q=n(478),J=n(292);e.Buffer=a,e.SlowBuffer=m,e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),e.kMaxLength=o(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,n){return s(null,t,e,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,n){return l(null,t,e,n)},a.allocUnsafe=function(t){return c(null,t)},a.allocUnsafeSlow=function(t){return c(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},a.prototype.compare=function(t,e,n,r,o){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var i=o-r,s=n-e,u=Math.min(i,s),l=this.slice(r,o),c=t.slice(e,n),f=0;fo)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return x(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return T(this,t,e,n);case"latin1":case"binary":return O(this,t,e,n);case"base64":return S(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e0&&(o*=256);)r+=this[t+--e]*o;return r},a.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||N(t,e,this.length);for(var r=this[t],o=1,i=0;++i=o&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||N(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Q.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Q.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Q.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Q.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){var o=Math.pow(2,8*n)-1;U(this,t,e,n,o,0)}var i=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+i]=t/a&255;return e+n},a.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);U(this,t,e,n,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},a.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);U(this,t,e,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,n){return B(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},a.prototype.writeDoubleLE=function(t,e,n){return V(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return V(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--o)t[o+e]=this[o+n];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;il;)u.call(t,a=s[l++])&&e.push(a);return e}},function(t,e,n){var r=n(44),o=n(18);t.exports=function(t,e){for(var n,i=o(t),a=r(i),s=a.length,u=0;s>u;)if(i[n=a[u++]]===e)return n}},function(t,e,n){"use strict";var r=n(300),o=n(74),i=n(14);t.exports=function(){for(var t=i(this),e=arguments.length,n=Array(e),a=0,s=r._,u=!1;e>a;)(n[a]=arguments[a++])===s&&(u=!0);return function(){var r,i=this,a=arguments.length,l=0,c=0;if(!u&&!a)return o(t,n,i);if(r=n.slice(),u)for(;e>l;l++)r[l]===s&&(r[l]=arguments[c++]);for(;a>c;)r.push(arguments[c++]);return o(t,r,i)}}},function(t,e,n){t.exports=n(5)},function(t,e){t.exports=function(t,e){var n=e===Object(e)?function(t){return e[t]}:e;return function(e){return String(e).replace(t,n)}}},function(t,e,n){var r=n(0),o=n(301)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(t){return o(t)}})},function(t,e,n){var r=n(0);r(r.P,"Array",{copyWithin:n(146)}),n(52)("copyWithin")},function(t,e,n){"use strict";var r=n(0),o=n(27)(4);r(r.P+r.F*!n(25)([].every,!0),"Array",{every:function(t){return o(this,t,arguments[1])}})},function(t,e,n){var r=n(0);r(r.P,"Array",{fill:n(96)}),n(52)("fill")},function(t,e,n){"use strict";var r=n(0),o=n(27)(2);r(r.P+r.F*!n(25)([].filter,!0),"Array",{filter:function(t){return o(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(0),o=n(27)(6),i="findIndex",a=!0;i in[]&&Array(1)[i](function(){a=!1}),r(r.P+r.F*a,"Array",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),n(52)(i)},function(t,e,n){"use strict";var r=n(0),o=n(27)(5),i="find",a=!0;i in[]&&Array(1)[i](function(){a=!1}),r(r.P+r.F*a,"Array",{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),n(52)(i)},function(t,e,n){"use strict";var r=n(0),o=n(27)(0),i=n(25)([].forEach,!0);r(r.P+r.F*!i,"Array",{forEach:function(t){return o(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(33),o=n(0),i=n(12),a=n(155),s=n(103),u=n(11),l=n(97),c=n(120);o(o.S+o.F*!n(76)(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,o,f,p=i(t),h="function"==typeof this?this:Array,d=arguments.length,v=d>1?arguments[1]:void 0,m=void 0!==v,_=0,g=c(p);if(m&&(v=r(v,d>2?arguments[2]:void 0,2)),void 0==g||h==Array&&s(g))for(e=u(p.length),n=new h(e);e>_;_++)l(n,_,m?v(p[_],_):p[_]);else for(f=g.call(p),n=new h;!(o=f.next()).done;_++)l(n,_,m?a(f,v,[o.value,_],!0):o.value);return n.length=_,n}})},function(t,e,n){"use strict";var r=n(0),o=n(70)(!1),i=[].indexOf,a=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(25)(i)),"Array",{indexOf:function(t){return a?i.apply(this,arguments)||0:o(this,t,arguments[1])}})},function(t,e,n){var r=n(0);r(r.S,"Array",{isArray:n(104)})},function(t,e,n){"use strict";var r=n(0),o=n(18),i=[].join;r(r.P+r.F*(n(61)!=Object||!n(25)(i)),"Array",{join:function(t){return i.call(o(this),void 0===t?",":t)}})},function(t,e,n){"use strict";var r=n(0),o=n(18),i=n(38),a=n(11),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(25)(s)),"Array",{lastIndexOf:function(t){if(u)return s.apply(this,arguments)||0;var e=o(this),n=a(e.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,i(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in e&&e[r]===t)return r||0;return-1}})},function(t,e,n){"use strict";var r=n(0),o=n(27)(1);r(r.P+r.F*!n(25)([].map,!0),"Array",{map:function(t){return o(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(0),o=n(97);r(r.S+r.F*n(6)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);e>t;)o(n,t,arguments[t++]);return n.length=e,n}})},function(t,e,n){"use strict";var r=n(0),o=n(148);r(r.P+r.F*!n(25)([].reduceRight,!0),"Array",{reduceRight:function(t){return o(this,t,arguments.length,arguments[1],!0)}})},function(t,e,n){"use strict";var r=n(0),o=n(148);r(r.P+r.F*!n(25)([].reduce,!0),"Array",{reduce:function(t){return o(this,t,arguments.length,arguments[1],!1)}})},function(t,e,n){"use strict";var r=n(0),o=n(101),i=n(23),a=n(47),s=n(11),u=[].slice;r(r.P+r.F*n(6)(function(){o&&u.call(o)}),"Array",{slice:function(t,e){var n=s(this.length),r=i(this);if(e=void 0===e?n:e,"Array"==r)return u.call(this,t,e);for(var o=a(t,n),l=a(e,n),c=s(l-o),f=Array(c),p=0;p9?t:"0"+t};r(r.P+r.F*(o(function(){return"0385-07-25T07:06:39.999Z"!=new Date(-5e13-1).toISOString()})||!o(function(){new Date(NaN).toISOString()})),"Date",{toISOString:function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}})},function(t,e,n){"use strict";var r=n(0),o=n(12),i=n(29);r(r.P+r.F*n(6)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var e=o(this),n=i(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},function(t,e,n){var r=n(8)("toPrimitive"),o=Date.prototype;r in o||n(15)(o,r,n(296))},function(t,e,n){var r=Date.prototype,o="Invalid Date",i="toString",a=r[i],s=r.getTime;new Date(NaN)+""!=o&&n(16)(r,i,function(){var t=s.call(this);return t===t?a.call(this):o})},function(t,e,n){var r=n(0);r(r.P,"Function",{bind:n(149)})},function(t,e,n){"use strict";var r=n(7),o=n(22),i=n(8)("hasInstance"),a=Function.prototype;i in a||n(10).f(a,i,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=o(t);)if(this.prototype===t)return!0;return!1}})},function(t,e,n){var r=n(10).f,o=n(37),i=n(13),a=Function.prototype,s=/^\s*function ([^ (]*)/,u="name",l=Object.isExtensible||function(){return!0};u in a||n(9)&&r(a,u,{configurable:!0,get:function(){try{var t=this,e=(""+t).match(s)[1];return i(t,u)||!l(t)||r(t,u,o(5,e)),e}catch(t){return""}}})},function(t,e,n){var r=n(0),o=n(157),i=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:o(t-1+i(t-1)*i(t+1))}})},function(t,e,n){function r(t){return isFinite(t=+t)&&0!=t?t<0?-r(-t):Math.log(t+Math.sqrt(t*t+1)):t}var o=n(0),i=Math.asinh;o(o.S+o.F*!(i&&1/i(0)>0),"Math",{asinh:r})},function(t,e,n){var r=n(0),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,e,n){var r=n(0),o=n(108);r(r.S,"Math",{cbrt:function(t){return o(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,e,n){var r=n(0);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,e,n){var r=n(0),o=Math.exp;r(r.S,"Math",{cosh:function(t){return(o(t=+t)+o(-t))/2}})},function(t,e,n){var r=n(0),o=n(107);r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},function(t,e,n){var r=n(0),o=n(108),i=Math.pow,a=i(2,-52),s=i(2,-23),u=i(2,127)*(2-s),l=i(2,-126),c=function(t){return t+1/a-1/a};r(r.S,"Math",{fround:function(t){var e,n,r=Math.abs(t),i=o(t);return ru||n!=n?i*(1/0):i*n)}})},function(t,e,n){var r=n(0),o=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,i=0,a=0,s=arguments.length,u=0;a0?(r=n/u,i+=r*r):i+=n;return u===1/0?1/0:u*Math.sqrt(i)}})},function(t,e,n){var r=n(0),o=Math.imul;r(r.S+r.F*n(6)(function(){return o(4294967295,5)!=-5||2!=o.length}),"Math",{imul:function(t,e){var n=65535,r=+t,o=+e,i=n&r,a=n&o;return 0|i*a+((n&r>>>16)*a+i*(n&o>>>16)<<16>>>0)}})},function(t,e,n){var r=n(0);r(r.S,"Math",{log10:function(t){return Math.log(t)/Math.LN10}})},function(t,e,n){var r=n(0);r(r.S,"Math",{log1p:n(157)})},function(t,e,n){var r=n(0);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,e,n){var r=n(0);r(r.S,"Math",{sign:n(108)})},function(t,e,n){var r=n(0),o=n(107),i=Math.exp;r(r.S+r.F*n(6)(function(){return!Math.sinh(-2e-17)!=-2e-17}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(o(t)-o(-t))/2:(i(t-1)-i(-t-1))*(Math.E/2)}})},function(t,e,n){var r=n(0),o=n(107),i=Math.exp;r(r.S,"Math",{tanh:function(t){var e=o(t=+t),n=o(-t);return e==1/0?1:n==1/0?-1:(e-n)/(i(t)+i(-t))}})},function(t,e,n){var r=n(0);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,e,n){"use strict";var r=n(5),o=n(13),i=n(23),a=n(102),s=n(29),u=n(6),l=n(43).f,c=n(21).f,f=n(10).f,p=n(56).trim,h="Number",d=r[h],v=d,m=d.prototype,_=i(n(42)(m))==h,g="trim"in String.prototype,y=function(t){var e=s(t,!1);if("string"==typeof e&&e.length>2){e=g?e.trim():p(e,3);var n,r,o,i=e.charCodeAt(0);if(43===i||45===i){if(n=e.charCodeAt(2),88===n||120===n)return NaN}else if(48===i){switch(e.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+e}for(var a,u=e.slice(2),l=0,c=u.length;lo)return NaN;return parseInt(u,r)}}return+e};if(!d(" 0o1")||!d("0b1")||d("+0x1")){d=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof d&&(_?u(function(){m.valueOf.call(n)}):i(n)!=h)?a(new v(y(e)),n,d):y(e)};for(var b,w=n(9)?l(v):"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++)o(v,b=w[x])&&!o(d,b)&&f(d,b,c(v,b));d.prototype=m,m.constructor=d,n(16)(r,h,d)}},function(t,e,n){var r=n(0);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,e,n){var r=n(0),o=n(5).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&o(t)}})},function(t,e,n){var r=n(0);r(r.S,"Number",{isInteger:n(154)})},function(t,e,n){var r=n(0);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,e,n){var r=n(0),o=n(154),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return o(t)&&i(t)<=9007199254740991}})},function(t,e,n){var r=n(0);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,e,n){var r=n(0);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,e,n){var r=n(0),o=n(164);r(r.S+r.F*(Number.parseFloat!=o),"Number",{parseFloat:o})},function(t,e,n){var r=n(0),o=n(165);r(r.S+r.F*(Number.parseInt!=o),"Number",{parseInt:o})},function(t,e,n){"use strict";var r=n(0),o=n(38),i=n(145),a=n(115),s=1..toFixed,u=Math.floor,l=[0,0,0,0,0,0],c="Number.toFixed: incorrect invocation!",f="0",p=function(t,e){for(var n=-1,r=e;++n<6;)r+=t*l[n],l[n]=r%1e7,r=u(r/1e7)},h=function(t){for(var e=6,n=0;--e>=0;)n+=l[e],l[e]=u(n/t),n=n%t*1e7},d=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==l[t]){var n=String(l[t]);e=""===e?n:e+a.call(f,7-n.length)+n}return e},v=function(t,e,n){return 0===e?n:e%2===1?v(t,e-1,n*t):v(t*t,e/2,n)},m=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e};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(6)(function(){s.call({})})),"Number",{toFixed:function(t){var e,n,r,s,u=i(this,c),l=o(t),_="",g=f;if(l<0||l>20)throw RangeError(c);if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return String(u);if(u<0&&(_="-",u=-u),u>1e-21)if(e=m(u*v(2,69,1))-69,n=e<0?u*v(2,-e,1):u/v(2,e,1),n*=4503599627370496,e=52-e,e>0){for(p(0,n),r=l;r>=7;)p(1e7,0),r-=7;for(p(v(10,r,1),0),r=e-1;r>=23;)h(1<<23),r-=23;h(1<0?(s=g.length,g=_+(s<=l?"0."+a.call(f,l-s)+g:g.slice(0,s-l)+"."+g.slice(s-l))):g=_+g,g}})},function(t,e,n){"use strict";var r=n(0),o=n(6),i=n(145),a=1..toPrecision;r(r.P+r.F*(o(function(){return"1"!==a.call(1,void 0)})||!o(function(){a.call({})})),"Number",{toPrecision:function(t){var e=i(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},function(t,e,n){var r=n(0);r(r.S+r.F,"Object",{assign:n(158)})},function(t,e,n){var r=n(0);r(r.S,"Object",{create:n(42)})},function(t,e,n){var r=n(0);r(r.S+r.F*!n(9),"Object",{defineProperties:n(159)})},function(t,e,n){var r=n(0);r(r.S+r.F*!n(9),"Object",{defineProperty:n(10).f})},function(t,e,n){var r=n(7),o=n(36).onFreeze;n(28)("freeze",function(t){return function(e){return t&&r(e)?t(o(e)):e}})},function(t,e,n){var r=n(18),o=n(21).f;n(28)("getOwnPropertyDescriptor",function(){return function(t,e){return o(r(t),e)}})},function(t,e,n){n(28)("getOwnPropertyNames",function(){return n(160).f})},function(t,e,n){var r=n(12),o=n(22);n(28)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(7);n(28)("isExtensible",function(t){return function(e){return!!r(e)&&(!t||t(e))}})},function(t,e,n){var r=n(7);n(28)("isFrozen",function(t){return function(e){return!r(e)||!!t&&t(e)}})},function(t,e,n){var r=n(7);n(28)("isSealed",function(t){return function(e){return!r(e)||!!t&&t(e)}})},function(t,e,n){var r=n(0);r(r.S,"Object",{is:n(166)})},function(t,e,n){var r=n(12),o=n(44);n(28)("keys",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(7),o=n(36).onFreeze;n(28)("preventExtensions",function(t){return function(e){return t&&r(e)?t(o(e)):e}})},function(t,e,n){var r=n(7),o=n(36).onFreeze;n(28)("seal",function(t){return function(e){return t&&r(e)?t(o(e)):e}})},function(t,e,n){var r=n(0);r(r.S,"Object",{setPrototypeOf:n(110).set})},function(t,e,n){"use strict";var r=n(60),o={};o[n(8)("toStringTag")]="z",o+""!="[object z]"&&n(16)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){var r=n(0),o=n(164);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(t,e,n){var r=n(0),o=n(165);r(r.G+r.F*(parseInt!=o),{parseInt:o})},function(t,e,n){"use strict";var r,o,i,a=n(41),s=n(5),u=n(33),l=n(60),c=n(0),f=n(7),p=n(14),h=n(40),d=n(53),v=n(112),m=n(117).set,_=n(109)(),g="Promise",y=s.TypeError,b=s.process,w=s[g],b=s.process,x="process"==l(b),E=function(){},T=!!function(){try{var t=w.resolve(1),e=(t.constructor={})[n(8)("species")]=function(t){t(E,E)};return(x||"function"==typeof PromiseRejectionEvent)&&t.then(E)instanceof e}catch(t){}}(),O=function(t,e){return t===e||t===w&&e===i},S=function(t){var e;return!(!f(t)||"function"!=typeof(e=t.then))&&e},P=function(t){return O(w,t)?new M(t):new o(t)},M=o=function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw y("Bad Promise constructor");e=t,n=r}),this.resolve=p(e),this.reject=p(n)},j=function(t){try{t()}catch(t){return{error:t}}},A=function(t,e){if(!t._n){t._n=!0;var n=t._c;_(function(){for(var r=t._v,o=1==t._s,i=0,a=function(e){var n,i,a=o?e.ok:e.fail,s=e.resolve,u=e.reject,l=e.domain;try{a?(o||(2==t._h&&k(t),t._h=1),a===!0?n=r:(l&&l.enter(),n=a(r),l&&l.exit()),n===e.promise?u(y("Promise-chain cycle")):(i=S(n))?i.call(n,s,u):s(n)):u(r)}catch(t){u(t)}};n.length>i;)a(n[i++]);t._c=[],t._n=!1,e&&!t._h&&C(t)})}},C=function(t){m.call(s,function(){var e,n,r,o=t._v;if(R(t)&&(e=j(function(){x?b.emit("unhandledRejection",o,t):(n=s.onunhandledrejection)?n({promise:t,reason:o}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",o)}),t._h=x||R(t)?2:1),t._a=void 0,e)throw e.error})},R=function(t){if(1==t._h)return!1;for(var e,n=t._a||t._c,r=0;n.length>r;)if(e=n[r++],e.fail||!R(e.promise))return!1;return!0},k=function(t){m.call(s,function(){var e;x?b.emit("rejectionHandled",t):(e=s.onrejectionhandled)&&e({promise:t,reason:t._v})})},I=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),A(e,!0))},N=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw y("Promise can't be resolved itself");(e=S(t))?_(function(){var r={_w:n,_d:!1};try{e.call(t,u(N,r,1),u(I,r,1))}catch(t){I.call(r,t)}}):(n._v=t,n._s=1,A(n,!1))}catch(t){I.call({_w:n,_d:!1},t)}}};T||(w=function(t){h(this,w,g,"_h"),p(t),r.call(this);try{t(u(N,this,1),u(I,this,1))}catch(t){I.call(this,t)}},r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(45)(w.prototype,{then:function(t,e){var n=P(v(this,w));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=x?b.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&A(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),M=function(){var t=new r;this.promise=t,this.resolve=u(N,t,1),this.reject=u(I,t,1)}),c(c.G+c.W+c.F*!T,{Promise:w}),n(55)(w,g),n(46)(g),i=n(32)[g],c(c.S+c.F*!T,g,{reject:function(t){var e=P(this),n=e.reject;return n(t),e.promise}}),c(c.S+c.F*(a||!T),g,{resolve:function(t){if(t instanceof w&&O(t.constructor,this))return t;var e=P(this),n=e.resolve;return n(t), e.promise}}),c(c.S+c.F*!(T&&n(76)(function(t){w.all(t).catch(E)})),g,{all:function(t){var e=this,n=P(e),r=n.resolve,o=n.reject,i=j(function(){var n=[],i=0,a=1;d(t,!1,function(t){var s=i++,u=!1;n.push(void 0),a++,e.resolve(t).then(function(t){u||(u=!0,n[s]=t,--a||r(n))},o)}),--a||r(n)});return i&&o(i.error),n.promise},race:function(t){var e=this,n=P(e),r=n.reject,o=j(function(){d(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return o&&r(o.error),n.promise}})},function(t,e,n){var r=n(0),o=n(14),i=n(4),a=(n(5).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(6)(function(){a(function(){})}),"Reflect",{apply:function(t,e,n){var r=o(t),u=i(n);return a?a(r,e,u):s.call(r,e,u)}})},function(t,e,n){var r=n(0),o=n(42),i=n(14),a=n(4),s=n(7),u=n(6),l=n(149),c=(n(5).Reflect||{}).construct,f=u(function(){function t(){}return!(c(function(){},[],t)instanceof t)}),p=!u(function(){c(function(){})});r(r.S+r.F*(f||p),"Reflect",{construct:function(t,e){i(t),a(e);var n=arguments.length<3?t:i(arguments[2]);if(p&&!f)return c(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(l.apply(t,r))}var u=n.prototype,h=o(s(u)?u:Object.prototype),d=Function.apply.call(t,h,e);return s(d)?d:h}})},function(t,e,n){var r=n(10),o=n(0),i=n(4),a=n(29);o(o.S+o.F*n(6)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,n){i(t),e=a(e,!0),i(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},function(t,e,n){var r=n(0),o=n(21).f,i=n(4);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=o(i(t),e);return!(n&&!n.configurable)&&delete t[e]}})},function(t,e,n){"use strict";var r=n(0),o=n(4),i=function(t){this._t=o(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)};n(105)(i,"Object",function(){var t,e=this,n=e._k;do if(e._i>=n.length)return{value:void 0,done:!0};while(!((t=n[e._i++])in e._t));return{value:t,done:!1}}),r(r.S,"Reflect",{enumerate:function(t){return new i(t)}})},function(t,e,n){var r=n(21),o=n(0),i=n(4);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(i(t),e)}})},function(t,e,n){var r=n(0),o=n(22),i=n(4);r(r.S,"Reflect",{getPrototypeOf:function(t){return o(i(t))}})},function(t,e,n){function r(t,e){var n,s,c=arguments.length<3?t:arguments[2];return l(t)===c?t[e]:(n=o.f(t,e))?a(n,"value")?n.value:void 0!==n.get?n.get.call(c):void 0:u(s=i(t))?r(s,e,c):void 0}var o=n(21),i=n(22),a=n(13),s=n(0),u=n(7),l=n(4);s(s.S,"Reflect",{get:r})},function(t,e,n){var r=n(0);r(r.S,"Reflect",{has:function(t,e){return e in t}})},function(t,e,n){var r=n(0),o=n(4),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return o(t),!i||i(t)}})},function(t,e,n){var r=n(0);r(r.S,"Reflect",{ownKeys:n(163)})},function(t,e,n){var r=n(0),o=n(4),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){o(t);try{return i&&i(t),!0}catch(t){return!1}}})},function(t,e,n){var r=n(0),o=n(110);o&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){o.check(t,e);try{return o.set(t,e),!0}catch(t){return!1}}})},function(t,e,n){function r(t,e,n){var u,p,h=arguments.length<4?t:arguments[3],d=i.f(c(t),e);if(!d){if(f(p=a(t)))return r(p,e,n,h);d=l(0)}return s(d,"value")?!(d.writable===!1||!f(h))&&(u=i.f(h,e)||l(0),u.value=n,o.f(h,e,u),!0):void 0!==d.set&&(d.set.call(h,n),!0)}var o=n(10),i=n(21),a=n(22),s=n(13),u=n(0),l=n(37),c=n(4),f=n(7);u(u.S,"Reflect",{set:r})},function(t,e,n){var r=n(5),o=n(102),i=n(10).f,a=n(43).f,s=n(75),u=n(73),l=r.RegExp,c=l,f=l.prototype,p=/a/g,h=/a/g,d=new l(p)!==p;if(n(9)&&(!d||n(6)(function(){return h[n(8)("match")]=!1,l(p)!=p||l(h)==h||"/a/i"!=l(p,"i")}))){l=function(t,e){var n=this instanceof l,r=s(t),i=void 0===e;return!n&&r&&t.constructor===l&&i?t:o(d?new c(r&&!i?t.source:t,e):c((r=t instanceof l)?t.source:t,r&&i?u.call(t):e),n?this:f,l)};for(var v=(function(t){t in l||i(l,t,{configurable:!0,get:function(){return c[t]},set:function(e){c[t]=e}})}),m=a(c),_=0;m.length>_;)v(m[_++]);f.constructor=l,l.prototype=f,n(16)(r,"RegExp",l)}n(46)("RegExp")},function(t,e,n){n(72)("match",1,function(t,e,n){return[function(n){"use strict";var r=t(this),o=void 0==n?void 0:n[e];return void 0!==o?o.call(n,r):new RegExp(n)[e](String(r))},n]})},function(t,e,n){n(72)("replace",2,function(t,e,n){return[function(r,o){"use strict";var i=t(this),a=void 0==r?void 0:r[e];return void 0!==a?a.call(r,i,o):n.call(String(i),r,o)},n]})},function(t,e,n){n(72)("search",1,function(t,e,n){return[function(n){"use strict";var r=t(this),o=void 0==n?void 0:n[e];return void 0!==o?o.call(n,r):new RegExp(n)[e](String(r))},n]})},function(t,e,n){n(72)("split",2,function(t,e,r){"use strict";var o=n(75),i=r,a=[].push,s="split",u="length",l="lastIndex";if("c"=="abbc"[s](/(b)*/)[1]||4!="test"[s](/(?:)/,-1)[u]||2!="ab"[s](/(?:ab)*/)[u]||4!="."[s](/(.?)(.?)/)[u]||"."[s](/()()/)[u]>1||""[s](/.?/)[u]){var c=void 0===/()??/.exec("")[1];r=function(t,e){var n=String(this);if(void 0===t&&0===e)return[];if(!o(t))return i.call(n,t,e);var r,s,f,p,h,d=[],v=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),m=0,_=void 0===e?4294967295:e>>>0,g=new RegExp(t.source,v+"g");for(c||(r=new RegExp("^"+g.source+"$(?!\\s)",v));(s=g.exec(n))&&(f=s.index+s[0][u],!(f>m&&(d.push(n.slice(m,s.index)),!c&&s[u]>1&&s[0].replace(r,function(){for(h=1;h1&&s.index=_)));)g[l]===s.index&&g[l]++;return m===n[u]?!p&&g.test("")||d.push(""):d.push(n.slice(m)),d[u]>_?d.slice(0,_):d}}else"0"[s](void 0,0)[u]&&(r=function(t,e){return void 0===t&&0===e?[]:i.call(this,t,e)});return[function(n,o){var i=t(this),a=void 0==n?void 0:n[e];return void 0!==a?a.call(n,i,o):r.call(String(i),n,o)},r]})},function(t,e,n){"use strict";n(170);var r=n(4),o=n(73),i=n(9),a="toString",s=/./[a],u=function(t){n(16)(RegExp.prototype,a,t,!0)};n(6)(function(){return"/a/b"!=s.call({source:"a",flags:"b"})})?u(function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!i&&t instanceof RegExp?o.call(t):void 0)}):s.name!=a&&u(function(){return s.call(this)})},function(t,e,n){"use strict";n(17)("anchor",function(t){return function(e){return t(this,"a","name",e)}})},function(t,e,n){"use strict";n(17)("big",function(t){return function(){return t(this,"big","","")}})},function(t,e,n){"use strict";n(17)("blink",function(t){return function(){return t(this,"blink","","")}})},function(t,e,n){"use strict";n(17)("bold",function(t){return function(){return t(this,"b","","")}})},function(t,e,n){"use strict";var r=n(0),o=n(113)(!1);r(r.P,"String",{codePointAt:function(t){return o(this,t)}})},function(t,e,n){"use strict";var r=n(0),o=n(11),i=n(114),a="endsWith",s=""[a];r(r.P+r.F*n(100)(a),"String",{endsWith:function(t){var e=i(this,t,a),n=arguments.length>1?arguments[1]:void 0,r=o(e.length),u=void 0===n?r:Math.min(o(n),r),l=String(t);return s?s.call(e,l,u):e.slice(u-l.length,u)===l}})},function(t,e,n){"use strict";n(17)("fixed",function(t){return function(){return t(this,"tt","","")}})},function(t,e,n){"use strict";n(17)("fontcolor",function(t){return function(e){return t(this,"font","color",e)}})},function(t,e,n){"use strict";n(17)("fontsize",function(t){return function(e){return t(this,"font","size",e)}})},function(t,e,n){var r=n(0),o=n(47),i=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,a=0;r>a;){if(e=+arguments[a++],o(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?i(e):i(((e-=65536)>>10)+55296,e%1024+56320))}return n.join("")}})},function(t,e,n){"use strict";var r=n(0),o=n(114),i="includes";r(r.P+r.F*n(100)(i),"String",{includes:function(t){return!!~o(this,t,i).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){"use strict";n(17)("italics",function(t){return function(){return t(this,"i","","")}})},function(t,e,n){"use strict";var r=n(113)(!0);n(106)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){"use strict";n(17)("link",function(t){return function(e){return t(this,"a","href",e)}})},function(t,e,n){var r=n(0),o=n(18),i=n(11);r(r.S,"String",{raw:function(t){for(var e=o(t.raw),n=i(e.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(e[s++])),s1?arguments[1]:void 0,e.length)),r=String(t);return s?s.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){"use strict";n(17)("strike",function(t){return function(){return t(this,"strike","","")}})},function(t,e,n){"use strict";n(17)("sub",function(t){return function(){return t(this,"sub","","")}})},function(t,e,n){"use strict";n(17)("sup",function(t){return function(){return t(this,"sup","","")}})},function(t,e,n){"use strict";n(56)("trim",function(t){return function(){return t(this,3)}})},function(t,e,n){"use strict";var r=n(5),o=n(13),i=n(9),a=n(0),s=n(16),u=n(36).KEY,l=n(6),c=n(79),f=n(55),p=n(48),h=n(8),d=n(168),v=n(119),m=n(298),_=n(297),g=n(104),y=n(4),b=n(18),w=n(29),x=n(37),E=n(42),T=n(160),O=n(21),S=n(10),P=n(44),M=O.f,j=S.f,A=T.f,C=r.Symbol,R=r.JSON,k=R&&R.stringify,I="prototype",N=h("_hidden"),U=h("toPrimitive"),F={}.propertyIsEnumerable,L=c("symbol-registry"),D=c("symbols"),B=c("op-symbols"),V=Object[I],X="function"==typeof C,W=r.QObject,z=!W||!W[I]||!W[I].findChild,G=i&&l(function(){return 7!=E(j({},"a",{get:function(){return j(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=M(V,e);r&&delete V[e],j(t,e,n),r&&t!==V&&j(V,e,r)}:j,q=function(t){var e=D[t]=E(C[I]);return e._k=t,e},H=X&&"symbol"==typeof C.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof C},Y=function(t,e,n){return t===V&&Y(B,e,n),y(t),e=w(e,!0),y(n),o(D,e)?(n.enumerable?(o(t,N)&&t[N][e]&&(t[N][e]=!1),n=E(n,{enumerable:x(0,!1)})):(o(t,N)||j(t,N,x(1,{})),t[N][e]=!0),G(t,e,n)):j(t,e,n)},K=function(t,e){y(t);for(var n,r=_(e=b(e)),o=0,i=r.length;i>o;)Y(t,n=r[o++],e[n]);return t},$=function(t,e){return void 0===e?E(t):K(E(t),e)},Z=function(t){var e=F.call(this,t=w(t,!0));return!(this===V&&o(D,t)&&!o(B,t))&&(!(e||!o(this,t)||!o(D,t)||o(this,N)&&this[N][t])||e)},Q=function(t,e){if(t=b(t),e=w(e,!0),t!==V||!o(D,e)||o(B,e)){var n=M(t,e);return!n||!o(D,e)||o(t,N)&&t[N][e]||(n.enumerable=!0),n}},J=function(t){for(var e,n=A(b(t)),r=[],i=0;n.length>i;)o(D,e=n[i++])||e==N||e==u||r.push(e);return r},tt=function(t){for(var e,n=t===V,r=A(n?B:b(t)),i=[],a=0;r.length>a;)!o(D,e=r[a++])||n&&!o(V,e)||i.push(D[e]);return i};X||(C=function(){if(this instanceof C)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===V&&e.call(B,n),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),G(this,t,x(1,n))};return i&&z&&G(V,t,{configurable:!0,set:e}),q(t)},s(C[I],"toString",function(){return this._k}),O.f=Q,S.f=Y,n(43).f=T.f=J,n(62).f=Z,n(78).f=tt,i&&!n(41)&&s(V,"propertyIsEnumerable",Z,!0),d.f=function(t){return q(h(t))}),a(a.G+a.W+a.F*!X,{Symbol:C});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)h(et[nt++]);for(var et=P(h.store),nt=0;et.length>nt;)v(et[nt++]);a(a.S+a.F*!X,"Symbol",{for:function(t){return o(L,t+="")?L[t]:L[t]=C(t)},keyFor:function(t){if(H(t))return m(L,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){z=!0},useSimple:function(){z=!1}}),a(a.S+a.F*!X,"Object",{create:$,defineProperty:Y,defineProperties:K,getOwnPropertyDescriptor:Q,getOwnPropertyNames:J,getOwnPropertySymbols:tt}),R&&a(a.S+a.F*(!X||l(function(){var t=C();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!H(t)){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);return e=r[1],"function"==typeof e&&(n=e),!n&&g(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!H(e))return e}),r[1]=e,k.apply(R,r)}}}),C[I][U]||n(15)(C[I],U,C[I].valueOf),f(C,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){"use strict";var r=n(0),o=n(80),i=n(118),a=n(4),s=n(47),u=n(11),l=n(7),c=n(5).ArrayBuffer,f=n(112),p=i.ArrayBuffer,h=i.DataView,d=o.ABV&&c.isView,v=p.prototype.slice,m=o.VIEW,_="ArrayBuffer";r(r.G+r.W+r.F*(c!==p),{ArrayBuffer:p}),r(r.S+r.F*!o.CONSTR,_,{isView:function(t){return d&&d(t)||l(t)&&m in t}}),r(r.P+r.U+r.F*n(6)(function(){return!new p(2).slice(1,void 0).byteLength}),_,{slice:function(t,e){if(void 0!==v&&void 0===e)return v.call(a(this),t);for(var n=a(this).byteLength,r=s(t,n),o=s(void 0===e?n:e,n),i=new(f(this,p))(u(o-r)),l=new h(this),c=new h(i),d=0;r0?arguments[0]:void 0)}},{add:function(t){return r.def(this,t,!0)}},r,!1,!0)},function(t,e,n){"use strict";var r=n(0),o=n(70)(!0);r(r.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),n(52)("includes")},function(t,e,n){var r=n(0),o=n(109)(),i=n(5).process,a="process"==n(23)(i);r(r.G,{asap:function(t){var e=a&&i.domain;o(e?e.bind(t):t)}})},function(t,e,n){var r=n(0),o=n(23);r(r.S,"Error",{isError:function(t){return"Error"===o(t)}})},function(t,e,n){var r=n(0);r(r.P+r.R,"Map",{toJSON:n(151)("Map")})},function(t,e,n){var r=n(0);r(r.S,"Math",{iaddh:function(t,e,n,r){var o=t>>>0,i=e>>>0,a=n>>>0;return i+(r>>>0)+((o&a|(o|a)&~(o+a>>>0))>>>31)|0}})},function(t,e,n){var r=n(0);r(r.S,"Math",{imulh:function(t,e){var n=65535,r=+t,o=+e,i=r&n,a=o&n,s=r>>16,u=o>>16,l=(s*a>>>0)+(i*a>>>16);return s*u+(l>>16)+((i*u>>>0)+(l&n)>>16)}})},function(t,e,n){var r=n(0);r(r.S,"Math",{isubh:function(t,e,n,r){var o=t>>>0,i=e>>>0,a=n>>>0;return i-(r>>>0)-((~o&a|~(o^a)&o-a>>>0)>>>31)|0}})},function(t,e,n){var r=n(0);r(r.S,"Math",{umulh:function(t,e){var n=65535,r=+t,o=+e,i=r&n,a=o&n,s=r>>>16,u=o>>>16,l=(s*a>>>0)+(i*a>>>16);return s*u+(l>>>16)+((i*u>>>0)+(l&n)>>>16)}})},function(t,e,n){"use strict";var r=n(0),o=n(12),i=n(14),a=n(10);n(9)&&r(r.P+n(77),"Object",{__defineGetter__:function(t,e){a.f(o(this),t,{get:i(e),enumerable:!0,configurable:!0})}})},function(t,e,n){"use strict";var r=n(0),o=n(12),i=n(14),a=n(10);n(9)&&r(r.P+n(77),"Object",{__defineSetter__:function(t,e){a.f(o(this),t,{set:i(e),enumerable:!0,configurable:!0})}})},function(t,e,n){var r=n(0),o=n(162)(!0);r(r.S,"Object",{entries:function(t){return o(t)}})},function(t,e,n){var r=n(0),o=n(163),i=n(18),a=n(21),s=n(97);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n=i(t),r=a.f,u=o(n),l={},c=0;u.length>c;)s(l,e=u[c++],r(n,e));return l}})},function(t,e,n){"use strict";var r=n(0),o=n(12),i=n(29),a=n(22),s=n(21).f;n(9)&&r(r.P+n(77),"Object",{__lookupGetter__:function(t){var e,n=o(this),r=i(t,!0);do if(e=s(n,r))return e.get;while(n=a(n))}})},function(t,e,n){"use strict";var r=n(0),o=n(12),i=n(29),a=n(22),s=n(21).f;n(9)&&r(r.P+n(77),"Object",{__lookupSetter__:function(t){var e,n=o(this),r=i(t,!0);do if(e=s(n,r))return e.set;while(n=a(n))}})},function(t,e,n){var r=n(0),o=n(162)(!1);r(r.S,"Object",{values:function(t){return o(t)}})},function(t,e,n){"use strict";var r=n(0),o=n(5),i=n(32),a=n(109)(),s=n(8)("observable"),u=n(14),l=n(4),c=n(40),f=n(45),p=n(15),h=n(53),d=h.RETURN,v=function(t){return null==t?void 0:u(t)},m=function(t){var e=t._c;e&&(t._c=void 0,e())},_=function(t){return void 0===t._o},g=function(t){_(t)||(t._o=void 0,m(t))},y=function(t,e){l(t),this._c=void 0,this._o=t,t=new b(this);try{var n=e(t),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:u(n),this._c=n)}catch(e){return void t.error(e)}_(this)&&m(this)};y.prototype=f({},{unsubscribe:function(){g(this)}});var b=function(t){this._s=t};b.prototype=f({},{next:function(t){var e=this._s;if(!_(e)){var n=e._o;try{var r=v(n.next);if(r)return r.call(n,t)}catch(t){try{g(e)}finally{throw t}}}},error:function(t){var e=this._s;if(_(e))throw t;var n=e._o;e._o=void 0;try{var r=v(n.error);if(!r)throw t;t=r.call(n,t)}catch(t){try{m(e)}finally{throw t}}return m(e),t},complete:function(t){var e=this._s;if(!_(e)){var n=e._o;e._o=void 0;try{var r=v(n.complete);t=r?r.call(n,t):void 0}catch(t){try{m(e)}finally{throw t}}return m(e),t}}});var w=function(t){c(this,w,"Observable","_f")._f=u(t)};f(w.prototype,{subscribe:function(t){return new y(t,this._f)},forEach:function(t){var e=this;return new(i.Promise||o.Promise)(function(n,r){u(t);var o=e.subscribe({next:function(e){try{return t(e)}catch(t){r(t),o.unsubscribe()}},error:r,complete:n})})}}),f(w,{from:function(t){var e="function"==typeof this?this:w,n=v(l(t)[s]);if(n){var r=l(n.call(t));return r.constructor===e?r:new e(function(t){return r.subscribe(t)})}return new e(function(e){var n=!1;return a(function(){if(!n){try{if(h(t,!1,function(t){if(e.next(t),n)return d})===d)return}catch(t){if(n)throw t;return void e.error(t)}e.complete()}}),function(){n=!0}})},of:function(){for(var t=0,e=arguments.length,n=Array(e);t1?arguments[1]:void 0,!1)}})},function(t,e,n){"use strict";var r=n(0),o=n(167);r(r.P,"String",{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,e,n){"use strict";n(56)("trimLeft",function(t){return function(){return t(this,1)}},"trimStart")},function(t,e,n){"use strict";n(56)("trimRight",function(t){return function(){return t(this,2)}},"trimEnd")},function(t,e,n){n(119)("asyncIterator")},function(t,e,n){n(119)("observable")},function(t,e,n){var r=n(0);r(r.S,"System",{global:n(5)})},function(t,e,n){for(var r=n(121),o=n(16),i=n(5),a=n(15),s=n(54),u=n(8),l=u("iterator"),c=u("toStringTag"),f=s.Array,p=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],h=0;h<5;h++){var d,v=p[h],m=i[v],_=m&&m.prototype;if(_){_[l]||a(_,l,f),_[c]||a(_,c,v),s[v]=f;for(d in r)_[d]||o(_,d,r[d],!0)}}},function(t,e,n){var r=n(0),o=n(117);r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},function(t,e,n){var r=n(5),o=n(0),i=n(74),a=n(299),s=r.navigator,u=!!s&&/MSIE .\./.test(s.userAgent),l=function(t){return u?function(e,n){return t(i(a,[].slice.call(arguments,2),"function"==typeof e?e:Function(e)),n)}:t};o(o.G+o.B+o.F*u,{setTimeout:l(r.setTimeout),setInterval:l(r.setInterval)})},function(t,e,n){n(422),n(361),n(363),n(362),n(365),n(367),n(372),n(366),n(364),n(374),n(373),n(369),n(370),n(368),n(360),n(371),n(375),n(376),n(328),n(330),n(329),n(378),n(377),n(348),n(358),n(359),n(349),n(350),n(351),n(352),n(353),n(354),n(355),n(356),n(357),n(331),n(332),n(333),n(334),n(335),n(336),n(337),n(338),n(339),n(340),n(341),n(342),n(343),n(344),n(345),n(346),n(347),n(409),n(414),n(421),n(412),n(404),n(405),n(410),n(415),n(417),n(400),n(401),n(402),n(403),n(406),n(407),n(408),n(411),n(413),n(416),n(418),n(419),n(420),n(323),n(325),n(324),n(327),n(326),n(312),n(310),n(316),n(313),n(319),n(321),n(309),n(315),n(306),n(320),n(304),n(318),n(317),n(311),n(314),n(303),n(305),n(308),n(307),n(322),n(121),n(394),n(399),n(170),n(395),n(396),n(397),n(398),n(379),n(169),n(171),n(172),n(434),n(423),n(424),n(429),n(432),n(433),n(427),n(430),n(428),n(431),n(425),n(426),n(380),n(381),n(382),n(383),n(384),n(387),n(385),n(386),n(388),n(389),n(390),n(391),n(393),n(392),n(435),n(461),n(464),n(463),n(465),n(466),n(462),n(467),n(468),n(446),n(449),n(445),n(443),n(444),n(447),n(448),n(438),n(460),n(469),n(437),n(439),n(441),n(440),n(442),n(451),n(452),n(454),n(453),n(456),n(455),n(457),n(458),n(459),n(436),n(450),n(472),n(471),n(470),t.exports=n(32)},function(t,e,n){"use strict";function r(t,e,n){var r,o,i=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r=0;--r)c=t[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function o(t,e,n,o){for(var i=e.length,a=n.arrayArgs.length,s=n.blockSize,u=n.indexArgs.length>0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",e[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",e[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",e[c],"]=j",c].join(""));for(var c=0;c0&&(n=n&&e[r]===e[r-1])}return n?e[0]:e.join("")}function u(t,e){for(var n=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,u=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),f=0;f0&&w.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var x=new Array(n),f=0;f3&&b.push(a(t.pre,t,c));var S=a(t.body,t,c),P=i(m);P3&&b.push(a(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+b.join("\n")+"\n----------");var M=[t.funcName||"unnamed","_cwise_loop_",u[0].join("s"),"m",P,s(c)].join(""),j=new Function(["function ",M,"(",y.join(","),"){",b.join("\n"),"} return ",M].join(""));return j()}var l=n(200);t.exports=u},function(t,e,n){"use strict";function r(t){var e=["'use strict'","var CACHED={}"],n=[],r=t.funcName+"_cwise_thunk";e.push(["return function ",r,"(",t.shimArgs.join(","),"){"].join(""));for(var i=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),l.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;c=0){var l=g[u],c=h(r);c&T&&(l.lvalue=!0),c&O&&(l.rvalue=!0),++l.count,s(r,l.name)}else i(a)||s(r,e(a))}else if("Literal"===r.type)"string"==typeof r.value&&s(r,f(r.value));else{if("WithStatement"===r.type)throw new Error("cwise-parser: with() statements not allowed");for(var p=Object.keys(r),d=0,v=p.length;d=48&&t<=57}function r(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function o(t){return"01234567".indexOf(t)>=0}function i(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function a(t){return 10===t||13===t||8232===t||8233===t}function s(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&ie.NonAsciiIdentifierStart.test(String.fromCharCode(t))}function u(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&ie.NonAsciiIdentifierPart.test(String.fromCharCode(t))}function l(t){switch(t){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function c(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function f(t){return"eval"===t||"arguments"===t}function p(t){if(ue&&c(t))return!0;switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t||"let"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}}function h(t,n,r,o,i){var a;e("number"==typeof r,"Comment must have valid position"),ve.lastCommentStart>=r||(ve.lastCommentStart=r,a={type:t,value:n},me.range&&(a.range=[r,o]),me.loc&&(a.loc=i),me.comments.push(a),me.attachComment&&(me.leadingComments.push(a),me.trailingComments.push(a)))}function d(t){var e,n,r,o;for(e=le-t,n={start:{line:ce,column:le-fe-t}};le=pe&&V({},oe.UnexpectedToken,"ILLEGAL");else if(42===n){if(47===se.charCodeAt(le+1))return++le,++le,void(me.comments&&(r=se.slice(t+2,le-2),e.end={line:ce,column:le-fe},h("Block",r,t,le,e)));++le}else++le;V({},oe.UnexpectedToken,"ILLEGAL")}function m(){var t,e;for(e=0===le;le>>="===r?(le+=4,{type:Jt.Punctuator,value:r,lineNumber:ce,lineStart:fe,start:o,end:le}):(n=r.substr(0,3),">>>"===n||"<<="===n||">>="===n?(le+=3,{type:Jt.Punctuator,value:n,lineNumber:ce,lineStart:fe,start:o,end:le}):(e=n.substr(0,2),a===e[1]&&"+-<>&|".indexOf(a)>=0||"=>"===e?(le+=2,{type:Jt.Punctuator,value:e,lineNumber:ce,lineStart:fe,start:o,end:le}):"<>=!+-*%&|^/".indexOf(a)>=0?(++le,{type:Jt.Punctuator,value:a,lineNumber:ce,lineStart:fe,start:o,end:le}):void V({},oe.UnexpectedToken,"ILLEGAL")))}function x(t){for(var e="";le=0&&le0&&(r=me.tokens[me.tokens.length-1],r.range[0]===t&&"Punctuator"===r.type&&("/"!==r.value&&"/="!==r.value||me.tokens.pop())),me.tokens.push({type:"RegularExpression",value:n.literal,range:[t,le],loc:e})),n}function R(t){return t.type===Jt.Identifier||t.type===Jt.Keyword||t.type===Jt.BooleanLiteral||t.type===Jt.NullLiteral}function k(){var t,e;if(t=me.tokens[me.tokens.length-1],!t)return C();if("Punctuator"===t.type){if("]"===t.value)return w();if(")"===t.value)return e=me.tokens[me.openParenToken-1],!e||"Keyword"!==e.type||"if"!==e.value&&"while"!==e.value&&"for"!==e.value&&"with"!==e.value?w():C();if("}"===t.value){if(me.tokens[me.openCurlyToken-3]&&"Keyword"===me.tokens[me.openCurlyToken-3].type){if(e=me.tokens[me.openCurlyToken-4],!e)return w()}else{if(!me.tokens[me.openCurlyToken-4]||"Keyword"!==me.tokens[me.openCurlyToken-4].type)return w();if(e=me.tokens[me.openCurlyToken-5],!e)return C()}return ee.indexOf(e.value)>=0?w():C()}return C()}return"Keyword"===t.type&&"this"!==t.value?C():w()}function I(){var t;return m(),le>=pe?{type:Jt.EOF,lineNumber:ce,lineStart:fe,start:le,end:le}:(t=se.charCodeAt(le),s(t)?b():40===t||41===t||59===t?w():39===t||34===t?S():46===t?n(se.charCodeAt(le+1))?O():w():n(t)?O():me.tokenize&&47===t?k():w())}function N(){var t,e,n;return m(),t={start:{line:ce,column:le-fe}},e=I(),t.end={line:ce,column:le-fe},e.type!==Jt.EOF&&(n=se.slice(e.start,e.end),me.tokens.push({type:te[e.type],value:n,range:[e.start,e.end],loc:t})),e}function U(){var t;return t=de,le=t.end,ce=t.lineNumber,fe=t.lineStart,de="undefined"!=typeof me.tokens?N():I(),le=t.end,ce=t.lineNumber,fe=t.lineStart,t}function F(){var t,e,n;t=le,e=ce,n=fe,de="undefined"!=typeof me.tokens?N():I(),le=t,ce=e,fe=n}function L(t,e){this.line=t,this.column=e}function D(t,e,n,r){this.start=new L(t,e),this.end=new L(n,r)}function B(){var t,e,n,r;return t=le,e=ce,n=fe,m(),r=ce!==e,le=t,ce=e,fe=n,r}function V(t,n){var r,o=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,function(t,n){return e(n>="===t||">>>="===t||"&="===t||"^="===t||"|="===t)}function K(){var t,e=le,n=ce,r=fe,o=de;return 59===se.charCodeAt(le)||q(";")?void U():(t=ce,m(),ce!==t?(le=e,ce=n,fe=r,void(de=o)):void(de.type===Jt.EOF||q("}")||W(de)))}function $(t){return t.type===ne.Identifier||t.type===ne.MemberExpression}function Z(){var t,e=[];for(t=de,z("[");!q("]");)q(",")?(U(),e.push(null)):(e.push(mt()),q("]")||z(","));return U(),he.markEnd(he.createArrayExpression(e),t)}function Q(t,e){var n,r,o;return n=ue,o=de,r=Wt(),e&&ue&&f(t[0].name)&&X(e,oe.StrictParamName),ue=n,he.markEnd(he.createFunctionExpression(null,t,[],r),o)}function J(){var t,e;return e=de,t=U(),t.type===Jt.StringLiteral||t.type===Jt.NumericLiteral?(ue&&t.octal&&X(t,oe.StrictOctalLiteral),he.markEnd(he.createLiteral(t),e)):he.markEnd(he.createIdentifier(t.value),e)}function tt(){var t,e,n,r,o,i;return t=de,i=de,t.type===Jt.Identifier?(n=J(),"get"!==t.value||q(":")?"set"!==t.value||q(":")?(z(":"),r=mt(),he.markEnd(he.createProperty("init",n,r),i)):(e=J(),z("("),t=de,t.type!==Jt.Identifier?(z(")"),X(t,oe.UnexpectedToken,t.value),r=Q([])):(o=[bt()],z(")"),r=Q(o,t)),he.markEnd(he.createProperty("set",e,r),i)):(e=J(),z("("),z(")"),r=Q([]),he.markEnd(he.createProperty("get",e,r),i))):t.type!==Jt.EOF&&t.type!==Jt.Punctuator?(e=J(),z(":"),r=mt(),he.markEnd(he.createProperty("init",e,r),i)):void W(t)}function et(){var t,e,n,r,o,i=[],a={},s=String;for(o=de,z("{");!q("}");)t=tt(),e=t.key.type===ne.Identifier?t.key.name:s(t.key.value),r="init"===t.kind?re.Data:"get"===t.kind?re.Get:re.Set,n="$"+e,Object.prototype.hasOwnProperty.call(a,n)?(a[n]===re.Data?ue&&r===re.Data?X({},oe.StrictDuplicateProperty):r!==re.Data&&X({},oe.AccessorDataProperty):r===re.Data?X({},oe.AccessorDataProperty):a[n]&r&&X({},oe.AccessorGetSet),a[n]|=r):a[n]=r,i.push(t),q("}")||z(",");return z("}"),he.markEnd(he.createObjectExpression(i),o)}function nt(){var t;return z("("),t=_t(),z(")"),t}function rt(){var t,e,n,r;if(q("("))return nt();if(q("["))return Z();if(q("{"))return et();if(t=de.type,r=de,t===Jt.Identifier)n=he.createIdentifier(U().value);else if(t===Jt.StringLiteral||t===Jt.NumericLiteral)ue&&de.octal&&X(de,oe.StrictOctalLiteral),n=he.createLiteral(U());else if(t===Jt.Keyword){if(H("function"))return qt();H("this")?(U(),n=he.createThisExpression()):W(U())}else t===Jt.BooleanLiteral?(e=U(),e.value="true"===e.value,n=he.createLiteral(e)):t===Jt.NullLiteral?(e=U(),e.value=null,n=he.createLiteral(e)):q("/")||q("/=")?(n="undefined"!=typeof me.tokens?he.createLiteral(C()):he.createLiteral(A()),F()):W(U());return he.markEnd(n,r)}function ot(){var t=[];if(z("("),!q(")"))for(;le":case"<=":case">=":case"instanceof":n=7;break;case"in":n=e?7:0;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function dt(){var t,e,n,r,o,i,a,s,u,l;if(t=de,u=pt(),r=de,o=ht(r,ve.allowIn),0===o)return u;for(r.prec=o,U(),e=[t,de],a=pt(),i=[u,r,a];(o=ht(de,ve.allowIn))>0;){for(;i.length>2&&o<=i[i.length-2].prec;)a=i.pop(),s=i.pop().value,u=i.pop(),n=he.createBinaryExpression(s,u,a),e.pop(),t=e[e.length-1],he.markEnd(n,t),i.push(n);r=U(),r.prec=o,i.push(r),e.push(de),n=pt(),i.push(n)}for(l=i.length-1,n=i[l],e.pop();l>1;)n=he.createBinaryExpression(i[l-1].value,i[l-2],n),l-=2,t=e.pop(),he.markEnd(n,t);return n}function vt(){var t,e,n,r,o;return o=de,t=dt(),q("?")&&(U(),e=ve.allowIn,ve.allowIn=!0,n=mt(),ve.allowIn=e,z(":"),r=mt(),t=he.createConditionalExpression(t,n,r),he.markEnd(t,o)),t}function mt(){var t,e,n,r,o;return t=de,o=de,r=e=vt(),Y()&&($(e)||X({},oe.InvalidLHSInAssignment),ue&&e.type===ne.Identifier&&f(e.name)&&X(t,oe.StrictLHSAssignment),t=U(),n=mt(),r=he.markEnd(he.createAssignmentExpression(t.value,e,n),o)),r}function _t(){var t,e=de;if(t=mt(),q(",")){for(t=he.createSequenceExpression([t]);le0?1:0,fe=0,pe=se.length,de=null,ve={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},me={},e=e||{},e.tokens=!0,me.tokens=[],me.tokenize=!0,me.openParenToken=-1,me.openCurlyToken=-1,me.range="boolean"==typeof e.range&&e.range,me.loc="boolean"==typeof e.loc&&e.loc,"boolean"==typeof e.comment&&e.comment&&(me.comments=[]),"boolean"==typeof e.tolerant&&e.tolerant&&(me.errors=[]);try{if(F(),de.type===Jt.EOF)return me.tokens;for(r=U();de.type!==Jt.EOF;)try{r=U()}catch(t){if(r=de,me.errors){me.errors.push(t);break}throw t}$t(),o=me.tokens,"undefined"!=typeof me.comments&&(o.comments=me.comments),"undefined"!=typeof me.errors&&(o.errors=me.errors)}catch(t){throw t}finally{me={}}return o}function Qt(t,e){var n,r;r=String,"string"==typeof t||t instanceof String||(t=r(t)),he=ae,se=t,le=0,ce=se.length>0?1:0,fe=0,pe=se.length,de=null,ve={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},me={},"undefined"!=typeof e&&(me.range="boolean"==typeof e.range&&e.range,me.loc="boolean"==typeof e.loc&&e.loc,me.attachComment="boolean"==typeof e.attachComment&&e.attachComment,me.loc&&null!==e.source&&void 0!==e.source&&(me.source=r(e.source)),"boolean"==typeof e.tokens&&e.tokens&&(me.tokens=[]),"boolean"==typeof e.comment&&e.comment&&(me.comments=[]),"boolean"==typeof e.tolerant&&e.tolerant&&(me.errors=[]),me.attachComment&&(me.range=!0,me.comments=[],me.bottomRightStack=[],me.trailingComments=[],me.leadingComments=[]));try{n=Kt(),"undefined"!=typeof me.comments&&(n.comments=me.comments),"undefined"!=typeof me.tokens&&($t(),n.tokens=me.tokens),"undefined"!=typeof me.errors&&(n.errors=me.errors)}catch(t){throw t}finally{me={}}return n}var Jt,te,ee,ne,re,oe,ie,ae,se,ue,le,ce,fe,pe,he,de,ve,me;Jt={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9},te={},te[Jt.BooleanLiteral]="Boolean",te[Jt.EOF]="",te[Jt.Identifier]="Identifier",te[Jt.Keyword]="Keyword",te[Jt.NullLiteral]="Null",te[Jt.NumericLiteral]="Numeric",te[Jt.Punctuator]="Punctuator",te[Jt.StringLiteral]="String",te[Jt.RegularExpression]="RegularExpression",ee=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="],ne={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"},re={Data:1,Get:2,Set:4},oe={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode", StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},ie={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},ae={name:"SyntaxTree",processComment:function(t){var e,n;if(!(t.type===ne.Program&&t.body.length>0)){for(me.trailingComments.length>0?me.trailingComments[0].range[0]>=t.range[1]?(n=me.trailingComments,me.trailingComments=[]):me.trailingComments.length=0:me.bottomRightStack.length>0&&me.bottomRightStack[me.bottomRightStack.length-1].trailingComments&&me.bottomRightStack[me.bottomRightStack.length-1].trailingComments[0].range[0]>=t.range[1]&&(n=me.bottomRightStack[me.bottomRightStack.length-1].trailingComments,delete me.bottomRightStack[me.bottomRightStack.length-1].trailingComments);me.bottomRightStack.length>0&&me.bottomRightStack[me.bottomRightStack.length-1].range[0]>=t.range[0];)e=me.bottomRightStack.pop();e?e.leadingComments&&e.leadingComments[e.leadingComments.length-1].range[1]<=t.range[0]&&(t.leadingComments=e.leadingComments,delete e.leadingComments):me.leadingComments.length>0&&me.leadingComments[me.leadingComments.length-1].range[1]<=t.range[0]&&(t.leadingComments=me.leadingComments,me.leadingComments=[]),n&&(t.trailingComments=n),me.bottomRightStack.push(t)}},markEnd:function(t,e){return me.range&&(t.range=[e.start,le]),me.loc&&(t.loc=new D(void 0===e.startLineNumber?e.lineNumber:e.startLineNumber,e.start-(void 0===e.startLineStart?e.lineStart:e.startLineStart),ce,le-fe),this.postProcess(t)),me.attachComment&&this.processComment(t),t},postProcess:function(t){return me.source&&(t.loc.source=me.source),t},createArrayExpression:function(t){return{type:ne.ArrayExpression,elements:t}},createAssignmentExpression:function(t,e,n){return{type:ne.AssignmentExpression,operator:t,left:e,right:n}},createBinaryExpression:function(t,e,n){var r="||"===t||"&&"===t?ne.LogicalExpression:ne.BinaryExpression;return{type:r,operator:t,left:e,right:n}},createBlockStatement:function(t){return{type:ne.BlockStatement,body:t}},createBreakStatement:function(t){return{type:ne.BreakStatement,label:t}},createCallExpression:function(t,e){return{type:ne.CallExpression,callee:t,arguments:e}},createCatchClause:function(t,e){return{type:ne.CatchClause,param:t,body:e}},createConditionalExpression:function(t,e,n){return{type:ne.ConditionalExpression,test:t,consequent:e,alternate:n}},createContinueStatement:function(t){return{type:ne.ContinueStatement,label:t}},createDebuggerStatement:function(){return{type:ne.DebuggerStatement}},createDoWhileStatement:function(t,e){return{type:ne.DoWhileStatement,body:t,test:e}},createEmptyStatement:function(){return{type:ne.EmptyStatement}},createExpressionStatement:function(t){return{type:ne.ExpressionStatement,expression:t}},createForStatement:function(t,e,n,r){return{type:ne.ForStatement,init:t,test:e,update:n,body:r}},createForInStatement:function(t,e,n){return{type:ne.ForInStatement,left:t,right:e,body:n,each:!1}},createFunctionDeclaration:function(t,e,n,r){return{type:ne.FunctionDeclaration,id:t,params:e,defaults:n,body:r,rest:null,generator:!1,expression:!1}},createFunctionExpression:function(t,e,n,r){return{type:ne.FunctionExpression,id:t,params:e,defaults:n,body:r,rest:null,generator:!1,expression:!1}},createIdentifier:function(t){return{type:ne.Identifier,name:t}},createIfStatement:function(t,e,n){return{type:ne.IfStatement,test:t,consequent:e,alternate:n}},createLabeledStatement:function(t,e){return{type:ne.LabeledStatement,label:t,body:e}},createLiteral:function(t){return{type:ne.Literal,value:t.value,raw:se.slice(t.start,t.end)}},createMemberExpression:function(t,e,n){return{type:ne.MemberExpression,computed:"["===t,object:e,property:n}},createNewExpression:function(t,e){return{type:ne.NewExpression,callee:t,arguments:e}},createObjectExpression:function(t){return{type:ne.ObjectExpression,properties:t}},createPostfixExpression:function(t,e){return{type:ne.UpdateExpression,operator:t,argument:e,prefix:!1}},createProgram:function(t){return{type:ne.Program,body:t}},createProperty:function(t,e,n){return{type:ne.Property,key:e,value:n,kind:t}},createReturnStatement:function(t){return{type:ne.ReturnStatement,argument:t}},createSequenceExpression:function(t){return{type:ne.SequenceExpression,expressions:t}},createSwitchCase:function(t,e){return{type:ne.SwitchCase,test:t,consequent:e}},createSwitchStatement:function(t,e){return{type:ne.SwitchStatement,discriminant:t,cases:e}},createThisExpression:function(){return{type:ne.ThisExpression}},createThrowStatement:function(t){return{type:ne.ThrowStatement,argument:t}},createTryStatement:function(t,e,n,r){return{type:ne.TryStatement,block:t,guardedHandlers:e,handlers:n,finalizer:r}},createUnaryExpression:function(t,e){return"++"===t||"--"===t?{type:ne.UpdateExpression,operator:t,argument:e,prefix:!0}:{type:ne.UnaryExpression,operator:t,argument:e,prefix:!0}},createVariableDeclaration:function(t,e){return{type:ne.VariableDeclaration,declarations:t,kind:e}},createVariableDeclarator:function(t,e){return{type:ne.VariableDeclarator,id:t,init:e}},createWhileStatement:function(t,e){return{type:ne.WhileStatement,test:t,body:e}},createWithStatement:function(t,e){return{type:ne.WithStatement,object:t,body:e}}},t.version="1.2.5",t.tokenize=Zt,t.parse=Qt,t.Syntax=function(){var t,e={};"function"==typeof Object.create&&(e=Object.create(null));for(t in ne)ne.hasOwnProperty(t)&&(e[t]=ne[t]);return"function"==typeof Object.freeze&&Object.freeze(e),e}()})},function(t,e){e.read=function(t,e,n,r,o){var i,a,s=8*o-r-1,u=(1<>1,c=-7,f=n?o-1:0,p=n?-1:1,h=t[e+f];for(f+=p,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+t[e+f],f+=p,c-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:(h?-1:1)*(1/0);a+=Math.pow(2,r),i-=l}return(h?-1:1)*a*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var a,s,u,l=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,d=r?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+f>=1?p/u:p*Math.pow(2,1-f),e*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(e*u-1)*Math.pow(2,o),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;t[n+h]=255&s,h+=d,s/=256,o-=8);for(a=a<0;t[n+h]=255&a,h+=d,a/=256,l-=8);t[n+h-d]|=128*v}},function(t,e,n){"use strict";function r(t){for(var e=new Array(t),n=0;no?0:o+e),n=n>o?o:n,n<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r=r?t:o(t,e,n)}var o=n(519);t.exports=r},function(t,e,n){var r=n(30),o=r["__core-js_shared__"];t.exports=o},function(t,e,n){function r(t,e){return function(n,r){if(null==n)return n;if(!o(n))return t(n,r);for(var i=n.length,a=e?i:-1,s=Object(n);(e?a--:++a-1?s[u?e[l]:l]:void 0}}var o=n(83),i=n(89),a=n(50);t.exports=r},function(t,e,n){function r(t){return function(e,n,r){return r&&"number"!=typeof r&&i(e,n,r)&&(n=r=void 0),e=a(e),void 0===n?(n=e,e=0):n=a(n),r=void 0===r?e-1}var o=n(82);t.exports=r},function(t,e,n){function r(t,e){var n=this.__data__,r=o(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var o=n(82);t.exports=r},function(t,e,n){function r(){this.size=0,this.__data__={hash:new o,map:new(a||i),string:new o}}var o=n(482),i=n(81),a=n(122);t.exports=r},function(t,e,n){function r(t){var e=o(this,t).delete(t);return this.size-=e?1:0,e}var o=n(85);t.exports=r},function(t,e,n){function r(t){return o(this,t).get(t)}var o=n(85);t.exports=r},function(t,e,n){function r(t){return o(this,t).has(t)}var o=n(85);t.exports=r},function(t,e,n){function r(t,e){var n=o(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var o=n(85);t.exports=r},function(t,e,n){function r(t){var e=o(t,function(t){return n.size===i&&n.clear(),t}),n=e.cache;return e}var o=n(598),i=500;t.exports=r},function(t,e,n){var r=n(570),o=r(Object.keys,Object);t.exports=o},function(t,e,n){(function(t){var r=n(182),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o,s=a&&r.process,u=function(){try{return s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=u}).call(e,n(94)(t))},function(t,e){function n(t){return o.call(t)}var r=Object.prototype,o=r.toString;t.exports=n},function(t,e){function n(t,e){return function(n){return t(e(n))}}t.exports=n},function(t,e,n){function r(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var r=arguments,a=-1,s=i(r.length-e,0),u=Array(s);++a0){if(++e>=r)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var r=800,o=16,i=Date.now;t.exports=n},function(t,e,n){function r(){this.__data__=new o,this.size=0}var o=n(81);t.exports=r},function(t,e){function n(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}t.exports=n},function(t,e){function n(t){return this.__data__.get(t)}t.exports=n},function(t,e){function n(t){return this.__data__.has(t)}t.exports=n},function(t,e,n){function r(t,e){var n=this.__data__;if(n instanceof o){var r=n.__data__;if(!i||r.length=0;e--,o+=r)i+=Math.abs(n[o]);return i}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o=e.data,i=n.data,a=e.stride[0],s=n.stride[0],u=e.offset,l=n.offset;for(r=e.shape[0]-1;r>=0;r--,u+=a,l+=s)i[l]+=t*o[u]}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r=t.data,o=e.data,i=t.stride[0],a=e.stride[0],s=t.offset,u=e.offset;for(n=t.shape[0]-1;n>=0;n--,s+=i,u+=a)o[u]=r[s]}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r,o=e.data,i=n.data,a=e.stride[0],s=n.stride[0],u=e.offset,l=n.offset;for(r=e.shape[0]-1;r>=0;r--,u+=a,l+=s)i[l]=t*o[u]}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,o=t.data,i=t.stride[0],a=t.offset,s=0;if(t===e)for(n=t.shape[0]-1;n>=0;n--,a+=i)r=o[a],s+=r*r;else{var u=e.data,l=e.stride[0],c=e.offset;for(n=t.shape[0]-1;n>=0;n--,a+=i,c+=l)s+=u[c]*o[a]}return s}},function(t,e,n){"use strict";t.exports=function(t){var e,n,r,o=-(1/0),i=t.data,a=t.stride[0],s=t.offset,u=t.shape[0];for(e=0;eo&&(o=n,r=e);return r}},function(t,e,n){"use strict";var r=function(t,e){if(0===t&&0===e)return 0;var n=Math.abs(t),r=Math.abs(e),o=Math.min(n,r),i=Math.max(n,r);return o/=i,i*Math.sqrt(1+o*o)};t.exports=function(t){var e,n,o=t.data,i=t.stride[0],a=t.offset,s=0;for(e=t.shape[0]-1;e>=0;e--,a+=i)n=o[a],s=r(s,n);return s}},function(t,e,n){"use strict";Math.sign=Math.sign||function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},t.exports=function(t,e,n){var r=0,o=0,i=0,a=0,s=0;return 0===e?(r=Math.sign(t),o=0,i=Math.abs(t)):0===t?(r=0,o=Math.sign(e),i=Math.abs(e)):Math.abs(t)>Math.abs(e)?(a=e/t,s=Math.sign(t)*Math.sqrt(1+a*a),r=1/s,o=a*r,i=t*s):(a=t/e,s=Math.sign(t)*Math.sqrt(1+a*a),o=1/s,r=a*o,i=e*s),void 0!==n&&n.length>2?(n[0]=r,n[1]=o,n[2]=i,void 0):[r,o,i]}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r=e.data,o=e.stride[0],i=e.offset;for(n=e.shape[0]-1;n>=0;n--,i+=o)r[i]*=t}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,o=t.data,i=e.data,a=t.stride[0],s=e.stride[0],u=t.offset,l=e.offset;for(n=t.shape[0]-1;n>=0;n--,u+=a,l+=s)r=o[u],o[u]=i[l],i[l]=r}},function(t,e,n){"use strict";function r(t,e,n,r,o,i,a){for(var s=0,u=0,l=0,c=0,f=0,p=t.shape[0],h=t.shape[1],d=Math.min(e,p-1),v=Math.min(n,h-1),m=void 0===i?1:i,_=void 0===a?0:a;s<=d;){c=0;var g=Math.min(s+v,h-1);for(l=0;l<=g;l++)c+=t.get(s,l)*r.get(l);o.set(s,c*m+_*o.get(s)),s++}if(s=0;s--)i.set(s,i.get(s)*r+t*a(e.pick(s,null),n));return!0}var o=n(91);t.exports=r},function(t,e,n){"use strict";function r(){console.error("GER (rank 1 operation A := alpha*x*y' + A) not yet implemented")}t.exports=r},function(t,e,n){"use strict";function r(){console.error("SBMV (symmetric banded matrix vector multiply) not yet implemented")}t.exports=r},function(t,e,n){"use strict";(function(t){function e(){console.error("SPMV (symmetric packed matrix vector multiply) not yet implemented")}t.exporst=e}).call(e,n(94)(t))},function(t,e,n){"use strict";function r(){console.error("SPR (symmetric packed rank 1 operation A := alpha*x*y' + A) not yet implemented")}t.exports=r},function(t,e,n){"use strict";function r(){console.error("SPR (symmetric packed rank 2 operation A := alpha*x*y' + alpha*y*x' + A) not yet implemented")}t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r,i,a){var s=t.shape[0],u=r||!0,l=void 0===i?1:i,c=void 0===a?0:a,f=0,p=0,h=0,d=0;if(0===c)for(f=0;f=0;a--)e.set(a,r(t.pick(a,null).hi(a+1),e.hi(a+1)));else for(a=0;a=0;a--)e.set(a,(e.get(a)-r(t.pick(a,null).lo(a+1),e.lo(a+1)))/t.get(a,a));return!0}var o=n(91);t.exports=r},function(t,e,n){"use strict";function r(){var t,e,n,r,u,l,c,f,p,h;if(r=o({},s),0===arguments.length)throw new Error("Array of ndarrays to concatenate must not be empty");if(Array.isArray(arguments[0])?(n=arguments[0],o(r,arguments[1]||{})):2===arguments.length&&(n=arguments[1],t=arguments[0],o(r,arguments[2]||{})),0===n.length)throw new Error("Array of ndarrays to concatenate must not be empty");for(u=0;u0;){","var w",m,"=",p,";","if(i",m,"<",p,"){","w",m,"=i",m,";","i",m,"=0;","}else{","i",m,"-=",p,";","}");c.push.apply(c,o(h,"o",t,"i0","i1","w1")),c.push("for(i=0;i=0&&(c[h]+=a[h],c[h]===s[h]);)c[h]=0,h--}return n}var o=n(197),i=n(3);t.exports=r},function(t,e){},function(t,e){t.exports='// 2D convolution fragment shader - based on im2col + gemm implementation\n// The input texture, X, is already configured as column matrix, after\n// input_transform.glsl is run on it if necessary. The output texture is in column\n// matrix configuration, and will need to be reshaped or transformed prior to the\n// next layer.\n\n// The following code is adapted from weblas, specifically the sgemm parts.\n// https://github.com/waylonflinn/weblas\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2015 Waylon Flinn\n// Modified by Leon Chen, 2017\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the "Software"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D X;\nuniform sampler2D W;\nuniform sampler2D b;\nuniform int inputCols;\nuniform int outputCols;\nuniform int inputColPad;\nuniform int outputColPad;\nuniform int relu;\n\n// sum of products between elements in row i (from X) x col j (from B)\n//\n// Calculate the dot product between the row (from X) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol (float y, float x, sampler2D X, sampler2D W, int K) {\n float delta_t = 1. / float(K); // space (on texture) between elements\n float sum = 0.; // sum for this row/column pair\n float z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n for (int l = 0; l < 4096; ++l) {\n if (l >= K / 4) break; // stop when we finish the row/column\n // l is in pixel space, so we divide by four\n\n // retrieve next four elements from each texture\n vec4 a_ik = texture2D(X, vec2(z, y));\n vec4 b_kj = texture2D(W, vec2(z, x));\n\n // use `dot` to process four elements at a time\n sum += dot(a_ik, b_kj);\n z += (4.0 * delta_t); // (z + 0.5)*delta\n }\n return sum;\n}\n\nvoid main(void) {\n\n // get the implied row and column from .y and .x of passed (output)\n // texture coordinate. These map directly to input texture space when\n // the relevant dimensions are the same.\n float row_t = outTex.y;\n float col_t = outTex.x;\n vec4 b_v = texture2D(b, vec2(col_t, 0.5));\n\n vec4 sum_v = vec4(0.0, 0.0, 0.0, 0.0);\n float col = (col_t * float(outputCols + outputColPad) - 2.0); // index of first element in pixel (matrix space)\n sum_v.r = dot_rowcol(row_t, (col + 0.5) / float(outputCols), X, W, inputCols + inputColPad);\n // in the padding region?\n if (outputColPad > 0 && (col + 4.0) > float(outputCols)) {\n // pad\n if (outputColPad < 3) {\n sum_v.g = dot_rowcol(row_t, (col + 1.5) / float(outputCols), X, W, inputCols + inputColPad);\n }\n if (outputColPad < 2) {\n sum_v.b = dot_rowcol(row_t, (col + 2.5) / float(outputCols), X, W, inputCols + inputColPad);\n }\n } else {\n sum_v.g = dot_rowcol(row_t, (col + 1.5) / float(outputCols), X, W, inputCols + inputColPad);\n sum_v.b = dot_rowcol(row_t, (col + 2.5) / float(outputCols), X, W, inputCols + inputColPad);\n sum_v.a = dot_rowcol(row_t, (col + 3.5) / float(outputCols), X, W, inputCols + inputColPad);\n }\n\n if (relu == 1) {\n gl_FragColor = max(sum_v + b_v, 0.0);\n } else {\n gl_FragColor = sum_v + b_v;\n }\n}\n'},function(t,e){t.exports="// Transform input matrix X based on index mappings, indexMappingRow and indexMappingCol.\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D X;\nuniform sampler2D indexMappingRow;\nuniform sampler2D indexMappingCol;\nuniform int inputRows;\nuniform int inputCols;\nuniform int outputCols;\nuniform int inputColPad;\nuniform int outputColPad;\n\nfloat select_index(vec4 v, int index) {\n float val = 0.0;\n if (index == 0) {\n val = v.r;\n } else if (index == 1) {\n val = v.g;\n } else if (index == 2) {\n val = v.b;\n } else if (index == 3) {\n val = v.a;\n }\n return val;\n}\n\nvoid fix_pad(inout vec4 v, int pad) {\n v.a = 0.0;\n if (pad == 2) {\n v.b = 0.0;\n } else if (pad == 3) {\n v.b = 0.0;\n v.g = 0.0;\n }\n}\n\nvoid main(void) {\n // index of first element in pixel (matrix space)\n float col = floor(outTex.x * float(outputCols + outputColPad) - 1.5);\n\n vec4 rowIndices = texture2D(indexMappingRow, vec2(outTex.x, outTex.y));\n vec4 colIndices = texture2D(indexMappingCol, vec2(outTex.x, outTex.y));\n\n float rowIndex;\n float colIndex;\n float inputCoordX;\n float inputCoordY;\n vec2 inputCoords;\n int inputChannel;\n vec4 mappedValues = vec4(0.0, 0.0, 0.0, 0.0);\n for (int i = 0; i < 4; i++) {\n rowIndex = select_index(rowIndices, i);\n colIndex = select_index(colIndices, i);\n\n if (rowIndex != -1.0 && colIndex != -1.0) {\n inputCoordX = (float(colIndex) + 0.5) / float(inputCols + inputColPad);\n inputCoordY = (float(rowIndex) + 0.5) / float(inputRows);\n inputCoords = vec2(inputCoordX, inputCoordY);\n inputChannel = int(mod(colIndex, 4.0));\n if (i == 0) {\n mappedValues.r = select_index(texture2D(X, inputCoords), inputChannel);\n } else if (i == 1) {\n mappedValues.g = select_index(texture2D(X, inputCoords), inputChannel);\n } else if (i == 2) {\n mappedValues.b = select_index(texture2D(X, inputCoords), inputChannel);\n } else if (i == 3) {\n mappedValues.a = select_index(texture2D(X, inputCoords), inputChannel);\n }\n }\n\n // set pad values to 0.0, if in padded region of output texture\n if (outputColPad > 0 && col + 4.0 > float(outputCols)) {\n fix_pad(mappedValues, outputColPad);\n }\n }\n\n gl_FragColor = mappedValues;\n}\n"},function(t,e){t.exports="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D X;\nuniform int relu;\n\nvoid main(void) {\n if (relu == 1) {\n gl_FragColor = max(texture2D(X, vec2(outTex.x, outTex.y)), 0.0);\n } else {\n gl_FragColor = texture2D(X, vec2(outTex.x, outTex.y));\n }\n}\n"},function(t,e){t.exports="// Merge op.\n// Modes: 'sum', 'mul', 'ave', 'max'\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D inputs[8]; // array length must be fixed\nuniform int numInputs;\nuniform int modeCode;\nuniform int outputCols;\nuniform int outputColPad;\n\nvoid fix_pad(inout vec4 v, int pad) {\n v.a = 0.0;\n if (pad == 2) {\n v.b = 0.0;\n } else if (pad == 3) {\n v.b = 0.0;\n v.g = 0.0;\n }\n}\n\nvoid main(void) {\n // index of first element in pixel (matrix space)\n float col = floor(outTex.x * float(outputCols + outputColPad) - 1.5);\n\n vec4 mergeValues = vec4(0.0, 0.0, 0.0, 0.0);\n if (modeCode == 1) {\n // mul\n mergeValues = vec4(1.0, 1.0, 1.0, 1.0);\n } else if (modeCode == 4) {\n // max\n const float min = -1.0e+08;\n mergeValues = vec4(min, min, min, min);\n }\n\n for (int i = 0; i < 8; i += 1) {\n if (i >= numInputs) {\n break;\n }\n\n if (modeCode == 0 || modeCode == 3) {\n // sum\n // ave\n mergeValues = mergeValues + texture2D(inputs[i], vec2(outTex.x, outTex.y));\n } else if (modeCode == 1) {\n // mul\n mergeValues = mergeValues * texture2D(inputs[i], vec2(outTex.x, outTex.y));\n } else if (modeCode == 4) {\n // max\n mergeValues = max(mergeValues, texture2D(inputs[i], vec2(outTex.x, outTex.y)));\n }\n }\n\n if (modeCode == 3) {\n // ave\n mergeValues = mergeValues / float(numInputs);\n }\n\n // set pad values to 0.0, if in padded region of output texture\n if (outputColPad > 0 && col + 4.0 > float(outputCols)) {\n fix_pad(mergeValues, outputColPad);\n }\n\n gl_FragColor = mergeValues;\n}\n"},function(t,e){t.exports="// Merge op.\n// Modes: 'concat'\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D inputs[8]; // array length must be fixed\nuniform int numInputs;\nuniform int inputChannelStartIndices[8];\nuniform int outputRows;\nuniform int outputCols;\nuniform int outputColPad;\n\nvoid fix_pad(inout vec4 v, int pad) {\n v.a = 0.0;\n if (pad == 2) {\n v.b = 0.0;\n } else if (pad == 3) {\n v.b = 0.0;\n v.g = 0.0;\n }\n}\n\nvoid main(void) {\n // index of first element in pixel (matrix space)\n float col = floor(outTex.x * float(outputCols + outputColPad) - 0.5);\n\n vec4 outValues = vec4(0.0, 0.0, 0.0, 0.0);\n int row = int(floor(outTex.y * float(outputRows)));\n float inputCoordY;\n for (int i = 0; i < 8; i += 1) {\n if (i >= numInputs) {\n break;\n }\n\n if (i == numInputs - 1) {\n inputCoordY = (0.5 + floor(outTex.y * float(outputRows)) - float(inputChannelStartIndices[i])) / float(outputRows - inputChannelStartIndices[i]);\n outValues = texture2D(inputs[i], vec2(outTex.x, inputCoordY));\n break;\n } else if (row >= inputChannelStartIndices[i] && row < inputChannelStartIndices[i + 1]) {\n inputCoordY = (0.5 + floor(outTex.y * float(outputRows)) - float(inputChannelStartIndices[i])) / float(inputChannelStartIndices[i + 1] - inputChannelStartIndices[i]);\n outValues = texture2D(inputs[i], vec2(outTex.x, inputCoordY));\n break;\n }\n }\n\n // set pad values to 0.0, if in padded region of output texture\n if (outputColPad > 0 && col + 4.0 > float(outputCols)) {\n fix_pad(outValues, outputColPad);\n }\n\n gl_FragColor = outValues;\n}\n"},function(t,e){t.exports="// Batch normalization op.\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D X;\nuniform sampler2D gamma;\nuniform sampler2D beta;\nuniform sampler2D mean;\nuniform sampler2D std;\nuniform float epsilon;\nuniform int outputCols;\nuniform int outputColPad;\n\nvoid fix_pad(inout vec4 v, int pad) {\n v.a = 0.0;\n if (pad == 2) {\n v.b = 0.0;\n } else if (pad == 3) {\n v.b = 0.0;\n v.g = 0.0;\n }\n}\n\nvoid main(void) {\n // index of first element in pixel (matrix space)\n float col = floor(outTex.x * float(outputCols + outputColPad) - 1.5);\n\n vec4 _x = texture2D(X, vec2(outTex.x, outTex.y));\n vec4 _mean = texture2D(mean, vec2(outTex.x, 0.5));\n vec4 _std = texture2D(std, vec2(outTex.x, 0.5));\n vec4 _gamma = texture2D(gamma, vec2(outTex.x, 0.5));\n vec4 _beta = texture2D(beta, vec2(outTex.x, 0.5));\n vec4 sumValues = _beta + _gamma * (_x - _mean) / sqrt(_std + epsilon);\n\n // set pad values to 0.0, if in padded region of output texture\n if (outputColPad > 0 && col + 4.0 > float(outputCols)) {\n fix_pad(sumValues, outputColPad);\n }\n\n gl_FragColor = sumValues;\n}\n"},function(t,e){t.exports="// 2D Average Pooling op.\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D X;\nuniform sampler2D poolIndexMapping;\nuniform int inputRows;\nuniform int channels;\nuniform int channelsPad;\nuniform int poolElements;\nuniform int poolElementsPad;\n\nfloat select_index(vec4 v, int index) {\n float val = 0.0;\n if (index == 0) {\n val = v.r;\n } else if (index == 1) {\n val = v.g;\n } else if (index == 2) {\n val = v.b;\n } else if (index == 3) {\n val = v.a;\n }\n return val;\n}\n\nvoid fix_pad(inout vec4 v, int pad) {\n v.a = 0.0;\n if (pad == 2) {\n v.b = 0.0;\n } else if (pad == 3) {\n v.b = 0.0;\n v.g = 0.0;\n }\n}\n\nvoid main(void) {\n // index of first element in pixel (matrix space)\n float col = floor(outTex.x * float(channels + channelsPad) - 1.5);\n\n float poolIndexCoordX;\n vec4 poolIndices;\n int poolIndexRGBA;\n float poolIndex;\n vec4 mappedValues;\n float inputCoordY;\n vec4 currentSum = vec4(0.0, 0.0, 0.0, 0.0);\n int poolElementsEffective = poolElements;\n for (int i = 0; i < 100; i += 1) {\n if (i >= poolElements) {\n break;\n }\n\n poolIndexCoordX = (float(i) + 0.5) / float(poolElements + poolElementsPad);\n poolIndices = texture2D(poolIndexMapping, vec2(poolIndexCoordX, outTex.y));\n poolIndexRGBA = int(mod(float(i), 4.0));\n poolIndex = select_index(poolIndices, poolIndexRGBA);\n\n if (poolIndex != -1.0) {\n inputCoordY = (poolIndex + 0.5) / float(inputRows);\n mappedValues = texture2D(X, vec2(outTex.x, inputCoordY));\n currentSum = currentSum + mappedValues;\n } else {\n poolElementsEffective = poolElementsEffective - 1;\n }\n }\n\n currentSum = currentSum / float(poolElementsEffective);\n\n // set pad values to 0.0, if in padded region of output texture\n if (channelsPad > 0 && col + 4.0 > float(channels)) {\n fix_pad(mappedValues, channelsPad);\n }\n\n gl_FragColor = currentSum;\n}\n"},function(t,e){t.exports="// 2D Max Pooling op.\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D X;\nuniform sampler2D poolIndexMapping;\nuniform int inputRows;\nuniform int channels;\nuniform int channelsPad;\nuniform int poolElements;\nuniform int poolElementsPad;\n\nfloat select_index(vec4 v, int index) {\n float val = 0.0;\n if (index == 0) {\n val = v.r;\n } else if (index == 1) {\n val = v.g;\n } else if (index == 2) {\n val = v.b;\n } else if (index == 3) {\n val = v.a;\n }\n return val;\n}\n\nvoid fix_pad(inout vec4 v, int pad) {\n v.a = 0.0;\n if (pad == 2) {\n v.b = 0.0;\n } else if (pad == 3) {\n v.b = 0.0;\n v.g = 0.0;\n }\n}\n\nvoid main(void) {\n // index of first element in pixel (matrix space)\n float col = floor(outTex.x * float(channels + channelsPad) - 1.5);\n\n float poolIndexCoordX;\n vec4 poolIndices;\n int poolIndexRGBA;\n float poolIndex;\n vec4 mappedValues;\n float inputCoordY;\n const float min = -1.0e+08;\n vec4 currentMax = vec4(min, min, min, min);\n for (int i = 0; i < 100; i += 1) {\n if (i >= poolElements) {\n break;\n }\n\n poolIndexCoordX = (float(i) + 0.5) / float(poolElements + poolElementsPad);\n poolIndices = texture2D(poolIndexMapping, vec2(poolIndexCoordX, outTex.y));\n poolIndexRGBA = int(mod(float(i), 4.0));\n poolIndex = select_index(poolIndices, poolIndexRGBA);\n\n if (poolIndex != -1.0) {\n inputCoordY = (poolIndex + 0.5) / float(inputRows);\n mappedValues = texture2D(X, vec2(outTex.x, inputCoordY));\n }\n\n currentMax = max(currentMax, mappedValues);\n }\n\n // set pad values to 0.0, if in padded region of output texture\n if (channelsPad > 0 && col + 4.0 > float(channels)) {\n fix_pad(mappedValues, channelsPad);\n }\n\n gl_FragColor = currentMax;\n}\n"},function(t,e){t.exports="// Copy texture\n// This is an extension of weblas.\n// https://github.com/waylonflinn/weblas\n\nprecision highp float;\n#define GLSLIFY 1\n\nvarying vec2 outTex;\nuniform sampler2D source;\n\nvoid main(void) {\n gl_FragColor = texture2D(source, vec2(outTex.x, outTex.y));\n}\n"},function(t,e,n){(function(e,n){!function(e){"use strict";function r(t,e,n,r){var o=e&&e.prototype instanceof i?e:i,a=Object.create(o.prototype),s=new d(r||[]);return a._invoke=c(t,n,s),a}function o(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function a(){}function s(){}function u(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function l(t){function e(n,r,i,a){var s=o(t[n],t,r);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&y.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(l).then(function(t){u.value=t,i(u)},a)}a(s.arg)}function r(t,n){function r(){return new Promise(function(r,o){e(t,n,r,o)})}return i=i?i.then(r,r):r()}"object"==typeof n&&n.domain&&(e=n.domain.bind(e));var i;this._invoke=r}function c(t,e,n){var r=O;return function(i,a){if(r===P)throw new Error("Generator is already running");if(r===M){if("throw"===i)throw a;return m()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=f(s,n);if(u){if(u===j)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===O)throw r=M,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=P;var l=o(t,e,n);if("normal"===l.type){if(r=n.done?M:S,l.arg===j)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r=M,n.method="throw",n.arg=l.arg)}}}function f(t,e){var n=t.iterator[e.method];if(n===_){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=_,f(t,e),"throw"===e.method))return j;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return j}var r=o(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,j;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=_),e.delegate=null,j):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,j)}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function h(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function v(t){if(t){var e=t[w];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=y.call(o,"catchLoc"),s=y.call(o,"finallyLoc");if(a&&s){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),h(n),j}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;h(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:v(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=_),j}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:this)}).call(e,n(39),n(93))},function(t,e,n){(function(t,e){!function(t,n){"use strict";function r(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(648),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){"use strict";(function(t,r){function o(t){if(t){var e=t.length||t.byteLength,n=g.log2(e);x[n].push(t)}}function i(t){o(t.buffer)}function a(t){var t=g.nextPow2(t),e=g.log2(t),n=x[e];return n.length>0?n.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function u(t){return new Uint16Array(a(2*t),0,t)}function l(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function f(t){return new Int16Array(a(2*t),0,t)}function p(t){return new Int32Array(a(4*t),0,t)}function h(t){return new Float32Array(a(4*t),0,t)}function d(t){return new Float64Array(a(8*t),0,t)}function v(t){return b?new Uint8ClampedArray(a(t),0,t):s(t)}function m(t){return new DataView(a(t),0,t)}function _(t){t=g.nextPow2(t);var e=g.log2(t),n=E[e];return n.length>0?n.pop():new r(t)}var g=n(289),y=n(174);t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:y([32,0]),UINT16:y([32,0]),UINT32:y([32,0]),INT8:y([32,0]),INT16:y([32,0]),INT32:y([32,0]),FLOAT:y([32,0]),DOUBLE:y([32,0]),DATA:y([32,0]),UINT8C:y([32,0]),BUFFER:y([32,0])});var b="undefined"!=typeof Uint8ClampedArray,w=t.__TYPEDARRAY_POOL;w.UINT8C||(w.UINT8C=y([32,0])),w.BUFFER||(w.BUFFER=y([32,0]));var x=w.DATA,E=w.BUFFER;e.free=function(t){if(r.isBuffer(t))E[g.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,n=0|g.log2(e);x[n].push(t)}},e.freeUint8=e.freeUint16=e.freeUint32=e.freeInt8=e.freeInt16=e.freeInt32=e.freeFloat32=e.freeFloat=e.freeFloat64=e.freeDouble=e.freeUint8Clamped=e.freeDataView=i,e.freeArrayBuffer=o,e.freeBuffer=function(t){E[g.log2(t.length)].push(t)},e.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return u(t);case"uint32":return l(t);case"int8":return c(t);case"int16":return f(t);case"int32":return p(t);case"float":case"float32":return h(t);case"double":case"float64":return d(t);case"uint8_clamped":return v(t);case"buffer":return _(t);case"data":case"dataview":return m(t);default:return null}return null},e.mallocArrayBuffer=a,e.mallocUint8=s,e.mallocUint16=u,e.mallocUint32=l,e.mallocInt8=c,e.mallocInt16=f,e.mallocInt32=p,e.mallocFloat32=e.mallocFloat=h,e.mallocFloat64=e.mallocDouble=d,e.mallocUint8Clamped=v,e.mallocDataView=m,e.mallocBuffer=_,e.clearCache=function(){for(var t=0;t<32;++t)w.UINT8[t].length=0,w.UINT16[t].length=0,w.UINT32[t].length=0,w.INT8[t].length=0,w.INT16[t].length=0,w.INT32[t].length=0,w.FLOAT[t].length=0,w.DOUBLE[t].length=0,w.UINT8C[t].length=0,x[t].length=0,E[t].length=0}}).call(e,n(39),n(291).Buffer)},function(t,e){function n(t,e){if(!e||"object"!=typeof e)return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}t.exports=n},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.testUtils=e.layers=e.activations=e.Tensor=e.Model=void 0,n(203);var i=n(201),a=o(i),s=n(2),u=o(s),l=n(19),c=r(l),f=n(134),p=r(f),h=n(202),d=r(h);if("undefined"!=typeof window){var v=n(204);window.weblas=v}e.Model=a.default,e.Tensor=u.default,e.activations=c,e.layers=p,e.testUtils=d}])}); //# sourceMappingURL=keras.js.map