-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.js
4 lines (4 loc) · 96.1 KB
/
mod.js
1
2
3
4
// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
/// <reference types="./mod.d.ts" />
var t=Object.prototype.hasOwnProperty;function e(e,r){return null!=e&&t.call(e,r)}var r="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function n(){return r&&"symbol"==typeof Symbol.toStringTag}var i=Object.prototype.toString;var o="function"==typeof Symbol?Symbol.toStringTag:"";var a=n()?function(t){var r,n,a;if(null==t)return i.call(t);n=t[o],r=e(t,o);try{t[o]=void 0}catch(e){return i.call(t)}return a=i.call(t),r?t[o]=n:delete t[o],a}:function(t){return i.call(t)};var u=Array.isArray?Array.isArray:function(t){return"[object Array]"===a(t)};function f(t){return"object"==typeof t&&null!==t&&!u(t)}var s=/./,l="function"==typeof Object.defineProperty?Object.defineProperty:null;var c,h=Object.defineProperty,p=Object.prototype,g=p.toString,y=p.__defineGetter__,m=p.__defineSetter__,d=p.__lookupGetter__,w=p.__lookupSetter__;c=function(){try{return l({},"x",{}),!0}catch(t){return!1}}()?h:function(t,e,r){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===g.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof r||null===r||"[object Array]"===g.call(r))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+r+"`.");if((i="value"in r)&&(d.call(t,e)||w.call(t,e)?(n=t.__proto__,t.__proto__=p,delete t[e],t[e]=r.value,t.__proto__=n):t[e]=r.value),o="get"in r,a="set"in r,i&&(o||a))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&y&&y.call(t,e,r.get),a&&m&&m.call(t,e,r.set),t};var b=c;function v(t,e,r){b(t,e,{configurable:!1,enumerable:!1,writable:!1,value:r})}function E(t){return"boolean"==typeof t}var _=Boolean.prototype.toString;var A=n();function T(t){return"object"==typeof t&&(t instanceof Boolean||(A?function(t){try{return _.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===a(t)))}function x(t){return E(t)||T(t)}function O(){return new Function("return this;")()}v(x,"isPrimitive",E),v(x,"isObject",T);var R="object"==typeof self?self:null,j="object"==typeof window?window:null,S="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},I="object"==typeof S?S:null;function U(t){if(arguments.length){if(!E(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return O()}if(R)return R;if(j)return j;if(I)return I;throw new Error("unexpected error. Unable to resolve global object.")}var B=U(),L=B.document&&B.document.childNodes,P=Int8Array;function V(){return/^\s*function\s*([^(]*)/i}var M=/^\s*function\s*([^(]*)/i;function k(t){return null!==t&&"object"==typeof t}v(V,"REGEXP",M);var C=function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(e){var r,n;if(!u(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}(k);function N(t){return k(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function Y(t){var e,r,n;if(("Object"===(r=a(t).slice(8,-1))||"Error"===r)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(e=M.exec(n.toString()))return e[1]}return N(t)?"Buffer":r}v(k,"isObjectLikeArray",C);var F="function"==typeof s||"object"==typeof P||"function"==typeof L?function(t){return Y(t).toLowerCase()}:function(t){var e;return null===t?"null":"object"===(e=typeof t)?Y(t).toLowerCase():e};function D(t){return"function"===F(t)}var z,G=Object.getPrototypeOf;z=D(Object.getPrototypeOf)?G:function(t){var e=function(t){return t.__proto__}(t);return e||null===e?e:"[object Function]"===a(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null};var W=z;function $(t){return null==t?null:(t=Object(t),W(t))}var J=Object.prototype;function X(t){var r;return!!f(t)&&(!(r=$(t))||!e(t,"constructor")&&e(r,"constructor")&&D(r.constructor)&&"[object Function]"===a(r.constructor)&&e(r,"isPrototypeOf")&&D(r.isPrototypeOf)&&(r===J||function(t){var r;for(r in t)if(!e(t,r))return!1;return!0}(t)))}function q(t){return"number"==typeof t}var Z=Number,H=Z.prototype.toString;var K=n();function Q(t){return"object"==typeof t&&(t instanceof Z||(K?function(t){try{return H.call(t),!0}catch(t){return!1}}(t):"[object Number]"===a(t)))}function tt(t){return q(t)||Q(t)}v(tt,"isPrimitive",q),v(tt,"isObject",Q);var et=Number.POSITIVE_INFINITY,rt=Z.NEGATIVE_INFINITY,nt=Math.floor;function it(t){return nt(t)===t}function ot(t){return t<et&&t>rt&&it(t)}function at(t){return q(t)&&ot(t)}function ut(t){return Q(t)&&ot(t.valueOf())}function ft(t){return at(t)||ut(t)}function st(t){return at(t)&&t>=0}function lt(t){return ut(t)&&t.valueOf()>=0}function ct(t){return st(t)||lt(t)}v(ft,"isPrimitive",at),v(ft,"isObject",ut),v(ct,"isPrimitive",st),v(ct,"isObject",lt);var ht=U();function pt(t,e,r){b(t,e,{configurable:!1,enumerable:!1,get:r})}var gt={binary:1,bool:1,complex64:8,complex128:16,float16:2,bfloat16:2,float32:4,float64:8,float128:16,generic:null,int8:1,int16:2,int32:4,int64:8,int128:16,int256:32,uint8:1,uint8c:1,uint16:2,uint32:4,uint64:8,uint128:16,uint256:32};function yt(t){return Math.abs(t)}function mt(t){var e,r,n,i,o,a;if(0===(r=t.length))return 0;for(e=!0,n=!0,i=yt(t[0]),a=1;a<r;a++){if(o=yt(t[a]),e&&o<i?e=!1:n&&o>i&&(n=!1),!n&&!e)return 0;i=o}return n&&e?3:n?1:2}function dt(t,e){return e&&(2===t||3===t)}function wt(t,e){return e&&(1===t||3===t)}function bt(t,e,r){var n,i,o,a,u;for(n=t.length,i=r,o=r,u=0;u<n;u++){if(0===t[u])return[r,r];(a=e[u])>0?o+=a*(t[u]-1):a<0&&(i+=a*(t[u]-1))}return[i,o]}function vt(t){return t.re}function Et(t){return t.im}function _t(t){return"string"==typeof t}v(bt,"assign",(function(t,e,r,n){var i,o,a,u,f;for(i=t.length,o=r,a=r,f=0;f<i;f++){if(0===t[f])return n[0]=r,n[1]=r,n;(u=e[f])>0?a+=u*(t[f]-1):u<0&&(o+=u*(t[f]-1))}return n[0]=o,n[1]=a,n}));var At=String.prototype.valueOf;var Tt=n();function xt(t){return"object"==typeof t&&(t instanceof String||(Tt?function(t){try{return At.call(t),!0}catch(t){return!1}}(t):"[object String]"===a(t)))}function Ot(t){return _t(t)||xt(t)}function Rt(t){return"number"==typeof t}function jt(t){var e,r="";for(e=0;e<t;e++)r+="0";return r}function St(t,e,r){var n=!1,i=e-t.length;return i<0||(function(t){return"-"===t[0]}(t)&&(n=!0,t=t.substr(1)),t=r?t+jt(i):jt(i)+t,n&&(t="-"+t)),t}v(Ot,"isPrimitive",_t),v(Ot,"isObject",xt);var It=String.prototype.toLowerCase,Ut=String.prototype.toUpperCase;function Bt(t){var e,r,n;switch(t.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(r=t.arg,n=parseInt(r,10),!isFinite(n)){if(!Rt(r))throw new Error("invalid integer. Value: "+r);n=0}return n<0&&("u"===t.specifier||10!==e)&&(n=4294967295+n+1),n<0?(r=(-n).toString(e),t.precision&&(r=St(r,t.precision,t.padRight)),r="-"+r):(r=n.toString(e),n||t.precision?t.precision&&(r=St(r,t.precision,t.padRight)):r="",t.sign&&(r=t.sign+r)),16===e&&(t.alternate&&(r="0x"+r),r=t.specifier===Ut.call(t.specifier)?Ut.call(r):It.call(r)),8===e&&t.alternate&&"0"!==r.charAt(0)&&(r="0"+r),r}function Lt(t){return"string"==typeof t}var Pt=Math.abs,Vt=String.prototype.toLowerCase,Mt=String.prototype.toUpperCase,kt=String.prototype.replace,Ct=/e\+(\d)$/,Nt=/e-(\d)$/,Yt=/^(\d+)$/,Ft=/^(\d+)e/,Dt=/\.0$/,zt=/\.0*e/,Gt=/(\..*[^0])0*e/;function Wt(t){var e,r,n=parseFloat(t.arg);if(!isFinite(n)){if(!Rt(t.arg))throw new Error("invalid floating-point number. Value: "+r);n=t.arg}switch(t.specifier){case"e":case"E":r=n.toExponential(t.precision);break;case"f":case"F":r=n.toFixed(t.precision);break;case"g":case"G":Pt(n)<1e-4?((e=t.precision)>0&&(e-=1),r=n.toExponential(e)):r=n.toPrecision(t.precision),t.alternate||(r=kt.call(r,Gt,"$1e"),r=kt.call(r,zt,"e"),r=kt.call(r,Dt,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return r=kt.call(r,Ct,"e+0$1"),r=kt.call(r,Nt,"e-0$1"),t.alternate&&(r=kt.call(r,Yt,"$1."),r=kt.call(r,Ft,"$1.e")),n>=0&&t.sign&&(r=t.sign+r),r=t.specifier===Mt.call(t.specifier)?Mt.call(r):Vt.call(r)}function $t(t){var e,r="";for(e=0;e<t;e++)r+=" ";return r}function Jt(t,e,r){var n=e-t.length;return n<0?t:t=r?t+$t(n):$t(n)+t}var Xt=String.fromCharCode,qt=isNaN,Zt=Array.isArray;function Ht(t){var e={};return e.specifier=t.specifier,e.precision=void 0===t.precision?1:t.precision,e.width=t.width,e.flags=t.flags||"",e.mapping=t.mapping,e}function Kt(t){var e,r,n,i,o,a,u,f,s;if(!Zt(t))throw new TypeError("invalid argument. First argument must be an array. Value: `"+t+"`.");for(a="",u=1,f=0;f<t.length;f++)if(Lt(n=t[f]))a+=n;else{if(e=void 0!==n.precision,!(n=Ht(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+f+"`. Value: `"+n+"`.");for(n.mapping&&(u=n.mapping),r=n.flags,s=0;s<r.length;s++)switch(i=r.charAt(s)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=r.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+i)}if("*"===n.width){if(n.width=parseInt(arguments[u],10),u+=1,qt(n.width))throw new TypeError("the argument for * width at position "+u+" is not a number. Value: `"+n.width+"`.");n.width<0&&(n.padRight=!0,n.width=-n.width)}if(e&&"*"===n.precision){if(n.precision=parseInt(arguments[u],10),u+=1,qt(n.precision))throw new TypeError("the argument for * precision at position "+u+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,e=!1)}switch(n.arg=arguments[u],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(n.padZeros=!1),n.arg=Bt(n);break;case"s":n.maxWidth=e?n.precision:-1;break;case"c":if(!qt(n.arg)){if((o=parseInt(n.arg,10))<0||o>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=qt(o)?String(n.arg):Xt(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=Wt(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=St(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=Jt(n.arg,n.width,n.padRight)),a+=n.arg||"",u+=1}return a}var Qt=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function te(t){var e={mapping:t[1]?parseInt(t[1],10):void 0,flags:t[2],width:t[3],precision:t[5],specifier:t[6]};return"."===t[4]&&void 0===t[5]&&(e.precision="1"),e}function ee(t){var e,r,n,i;for(r=[],i=0,n=Qt.exec(t);n;)(e=t.slice(i,Qt.lastIndex-n[0].length)).length&&r.push(e),r.push(te(n)),i=Qt.lastIndex,n=Qt.exec(t);return(e=t.slice(i)).length&&r.push(e),r}function re(t){return"string"==typeof t}function ne(t){var e,r,n;if(!re(t))throw new TypeError(ne("invalid argument. First argument must be a string. Value: `%s`.",t));for(e=ee(t),(r=new Array(arguments.length))[0]=e,n=1;n<r.length;n++)r[n]=arguments[n];return Kt.apply(null,r)}var ie=/[-\/\\^$*+?.()|[\]{}]/g;var oe=RegExp.prototype.exec;var ae=n();function ue(t){return"object"==typeof t&&(t instanceof RegExp||(ae?function(t){try{return oe.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===a(t)))}function fe(t,e,r){if(!_t(t))throw new TypeError(ne("invalid argument. First argument must be a string. Value: `%s`.",t));if(_t(e))e=function(t){var e,r;if(!_t(t))throw new TypeError(ne("invalid argument. Must provide a regular expression string. Value: `%s`.",t));if("/"===t[0])for(r=t.length-1;r>=0&&"/"!==t[r];r--);return void 0===r||r<=0?t.replace(ie,"\\$&"):(e=(e=t.substring(1,r)).replace(ie,"\\$&"),t=t[0]+e+t.substring(r))}(e),e=new RegExp(e,"g");else if(!ue(e))throw new TypeError(ne("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",e));if(!_t(r)&&!D(r))throw new TypeError(ne("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",r));return t.replace(e,r)}var se={int8:"new Int8Array( [ {{data}} ] )",uint8:"new Uint8Array( [ {{data}} ] )",uint8c:"new Uint8ClampedArray( [ {{data}} ] )",int16:"new Int16Array( [ {{data}} ] )",uint16:"new Uint16Array( [ {{data}} ] )",int32:"new Int32Array( [ {{data}} ] )",uint32:"new Uint32Array( [ {{data}} ] )",float32:"new Float32Array( [ {{data}} ] )",float64:"new Float64Array( [ {{data}} ] )",generic:"[ {{data}} ]",binary:"new Buffer( [ {{data}} ] )",complex64:"new Complex64Array( [ {{data}} ] )",complex128:"new Complex128Array( [ {{data}} ] )"};var le="function"==typeof Uint8Array;var ce="function"==typeof Uint8Array?Uint8Array:null;var he,pe="function"==typeof Uint8Array?Uint8Array:void 0;he=function(){var t,e,r;if("function"!=typeof ce)return!1;try{e=new ce(e=[1,3.14,-3.14,256,257]),r=e,t=(le&&r instanceof Uint8Array||"[object Uint8Array]"===a(r))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?pe:function(){throw new Error("not implemented")};var ge=he,ye="function"==typeof Uint16Array;var me="function"==typeof Uint16Array?Uint16Array:null;var de,we="function"==typeof Uint16Array?Uint16Array:void 0;de=function(){var t,e,r;if("function"!=typeof me)return!1;try{e=new me(e=[1,3.14,-3.14,65536,65537]),r=e,t=(ye&&r instanceof Uint16Array||"[object Uint16Array]"===a(r))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?we:function(){throw new Error("not implemented")};var be,ve=de,Ee={uint16:ve,uint8:ge};(be=new Ee.uint16(1))[0]=4660;var _e=52===new Ee.uint8(be.buffer)[0],Ae="function"==typeof ArrayBuffer;function Te(t){return Ae&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===a(t)}var xe="function"==typeof Float64Array;var Oe="function"==typeof Float64Array?Float64Array:null;var Re,je="function"==typeof Float64Array?Float64Array:void 0;Re=function(){var t,e,r;if("function"!=typeof Oe)return!1;try{e=new Oe([1,3.14,-3.14,NaN]),r=e,t=(xe&&r instanceof Float64Array||"[object Float64Array]"===a(r))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){t=!1}return t}()?je:function(){throw new Error("not implemented")};var Se=Re,Ie="function"==typeof ArrayBuffer?ArrayBuffer:null;var Ue,Be="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Ue=function(){var t,e,r;if("function"!=typeof Ie)return!1;try{(t=Te(r=new Ie(16))&&"function"==typeof Ie.isView)&&((e=new Se(r))[0]=-3.14,e[1]=NaN,t=t&&Ie.isView(e)&&16===r.byteLength&&-3.14===e[0]&&e[1]!=e[1])}catch(e){t=!1}return t}()?Be:function(){throw new Error("not implemented")};var Le=Ue,Pe="function"==typeof DataView;var Ve="function"==typeof DataView?DataView:null;var Me,ke="function"==typeof DataView?DataView:void 0;Me=function(){var t,e,r,n;if("function"!=typeof Ve)return!1;try{r=new Le(24),e=new Ve(r,8),n=e,(t=(Pe&&n instanceof DataView||"[object DataView]"===a(n))&&"function"==typeof e.getFloat64&&"function"==typeof e.setFloat64)&&(e.setFloat64(0,-3.14),e.setFloat64(8,NaN),t=t&&e.buffer===r&&16===e.byteLength&&8===e.byteOffset&&-3.14===e.getFloat64(0)&&e.getFloat64(8)!=e.getFloat64(8))}catch(e){t=!1}return t}()?ke:function(){throw new Error("not implemented")};var Ce=Me,Ne="function"==typeof BigInt?BigInt:void 0,Ye=["binary","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"];function Fe(){return Ye.slice()}function De(){return{bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256}}function ze(t,e,r){b(t,e,{configurable:!1,enumerable:!0,writable:!1,value:r})}function Ge(t){return Object.keys(Object(t))}var We=void 0!==Object.keys;function $e(t){return"[object Arguments]"===a(t)}var Je=function(){return $e(arguments)}();function Xe(t){return t!=t}function qe(t){return q(t)&&Xe(t)}function Ze(t){return Q(t)&&Xe(t.valueOf())}function He(t){return qe(t)||Ze(t)}v(He,"isPrimitive",qe),v(He,"isObject",Ze);var Ke=Object.prototype.propertyIsEnumerable;var Qe=!Ke.call("beep","0");function tr(t,e){var r;return null!=t&&(!(r=Ke.call(t,e))&&Qe&&Ot(t)?!qe(e=+e)&&at(e)&&e>=0&&e<t.length:r)}var er=Je?$e:function(t){return null!==t&&"object"==typeof t&&!u(t)&&"number"==typeof t.length&&it(t.length)&&t.length>=0&&t.length<=4294967295&&e(t,"callee")&&!tr(t,"callee")},rr=Array.prototype.slice;var nr=tr((function(){}),"prototype"),ir=!tr({toString:null},"toString");function or(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&it(t.length)&&t.length>=0&&t.length<=9007199254740991}function ar(t,e,r){var n,i;if(!or(t)&&!_t(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(n=t.length))return-1;if(3===arguments.length){if(!at(r))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+r+"`.");if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(He(e)){for(;i<n;i++)if(He(t[i]))return i}else for(;i<n;i++)if(t[i]===e)return i;return-1}function ur(t){return t.constructor&&t.constructor.prototype===t}var fr=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],sr="undefined"==typeof window?void 0:window;var lr=function(){var t;if("undefined"===F(sr))return!1;for(t in sr)try{-1===ar(fr,t)&&e(sr,t)&&null!==sr[t]&&"object"===F(sr[t])&&ur(sr[t])}catch(t){return!0}return!1}(),cr="undefined"!=typeof window;var hr=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var pr=We?function(){return 2!==(Ge(arguments)||"").length}(1,2)?function(t){return er(t)?Ge(rr.call(t)):Ge(t)}:Ge:function(t){var r,n,i,o,a,u,f;if(o=[],er(t)){for(f=0;f<t.length;f++)o.push(f.toString());return o}if("string"==typeof t){if(t.length>0&&!e(t,"0"))for(f=0;f<t.length;f++)o.push(f.toString())}else{if(!1==(i="function"==typeof t)&&!k(t))return o;n=nr&&i}for(a in t)n&&"prototype"===a||!e(t,a)||o.push(String(a));if(ir)for(r=function(t){if(!1===cr&&!lr)return ur(t);try{return ur(t)}catch(t){return!1}}(t),f=0;f<hr.length;f++)u=hr[f],r&&"constructor"===u||!e(t,u)||o.push(String(u));return o};v(Fe,"enum",De),function(t,e){var r,n,i;for(r=pr(e),i=0;i<r.length;i++)ze(t,n=r[i],e[n])}(Fe,{bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256});var gr=["row-major","column-major"];function yr(){return gr.slice()}function mr(){return{"row-major":1,"column-major":2}}v(yr,"enum",mr);var dr=["throw","clamp","wrap"];function wr(){return dr.slice()}function br(){return{throw:1,clamp:2,wrap:3}}v(wr,"enum",br);var vr={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256},Er={"row-major":1,"column-major":2},_r={throw:1,clamp:2,wrap:3};var Ar=new ge(8),Tr=new Ce(Ar.buffer);function xr(t,e,r,n){var i,o,a;if(0===t){for(a=0;a<Ar.length;a++)e[n]=0,n+=r;return e}for(o=(4294967295&t)>>>0,i=nt(t/4294967296),_e?(Tr.setUint32(0,o,_e),Tr.setUint32(4,i,_e)):(Tr.setUint32(0,i,_e),Tr.setUint32(4,o,_e)),a=0;a<Ar.length;a++)e[n]=Ar[a],n+=r;return e}v((function(t){var e,r,n,i;return e=new ge(8),0===t||(i=(4294967295&t)>>>0,n=nt(t/4294967296),r=new Ce(e.buffer),_e?(r.setUint32(0,i,_e),r.setUint32(4,n,_e)):(r.setUint32(0,n,_e),r.setUint32(4,i,_e))),e}),"assign",xr);var Or={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256},Rr={"row-major":1,"column-major":2},jr={throw:1,clamp:2,wrap:3};function Sr(t,e,r,n,i,o){var a,u,f,s,l;if(!(this instanceof Sr))return new Sr(t,e,r,n,i,o);for(s=1,l=0;l<r.length;l++)s*=r[l];return u=e.BYTES_PER_ELEMENT?e.BYTES_PER_ELEMENT*s:null,this._byteLength=u,this._bytesPerElement=function(t){return gt[t]||null}(t),this._buffer=e,this._dtype=t,this._length=s,this._ndims=r.length,this._offset=i,this._order=o,this._shape=r,this._strides=n,this._accessors=Boolean(e.get&&e.set),this._iterationOrder=function(t){var e,r;for(e=0,r=0;r<t.length;r++)t[r]<0&&(e+=1);return 0===e?1:e===t.length?-1:0}(n),a=function(t,e,r,n,i){var o;return 0!==t&&0!==i&&t===(o=bt(e,r,n))[1]-o[0]+1}(s,r,n,i,this._iterationOrder),f=mt(n),this._flags={ROW_MAJOR_CONTIGUOUS:wt(f,a),COLUMN_MAJOR_CONTIGUOUS:dt(f,a),READONLY:!1},this.__meta_dataview__=null,this}function Ir(t){return t instanceof Sr||null!==t&&"object"==typeof t&&"object"==typeof t.data&&"object"==typeof t.shape&&"object"==typeof t.strides&&"number"==typeof t.offset&&"string"==typeof t.order&&"number"==typeof t.ndims&&"string"==typeof t.dtype&&"number"==typeof t.length&&"object"==typeof t.flags&&"function"==typeof t.get&&"function"==typeof t.set}function Ur(t,e){return"column-major"===e?function(t){var e,r,n;for(e=[],r=1,n=0;n<t.length;n++)e.push(r),r*=t[n];return e}(t):function(t){var e,r,n,i;for(e=t.length,r=[],i=0;i<e;i++)r.push(0);for(n=1,i=e-1;i>=0;i--)r[i]=n,n*=t[i];return r}(t)}function Br(t,e){var r,n,i;for(n=t.length,r=0,i=0;i<n;i++)e[i]<0&&(r-=e[i]*(t[i]-1));return r}function Lr(t){var e,r,n;if(0===(e=t.length))return 0;for(r=1,n=0;n<e;n++)r*=t[n];return r}v(Sr,"name","ndarray"),pt(Sr.prototype,"byteLength",(function(){return this._byteLength})),pt(Sr.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),pt(Sr.prototype,"data",(function(){return this._buffer})),pt(Sr.prototype,"dtype",(function(){return this._dtype})),pt(Sr.prototype,"flags",(function(){return{ROW_MAJOR_CONTIGUOUS:(t=this._flags).ROW_MAJOR_CONTIGUOUS,COLUMN_MAJOR_CONTIGUOUS:t.COLUMN_MAJOR_CONTIGUOUS,READONLY:t.READONLY};var t})),pt(Sr.prototype,"length",(function(){return this._length})),pt(Sr.prototype,"ndims",(function(){return this._ndims})),pt(Sr.prototype,"offset",(function(){return this._offset})),pt(Sr.prototype,"order",(function(){return this._order})),pt(Sr.prototype,"shape",(function(){return this._shape.slice()})),pt(Sr.prototype,"strides",(function(){return this._strides.slice()})),v(Sr.prototype,"get",(function(){var t,e;for(t=this._offset,e=0;e<arguments.length;e++)t+=this._strides[e]*arguments[e];return this._accessors?this._buffer.get(t):this._buffer[t]})),v(Sr.prototype,"iget",(function(t){var e,r,n,i,o,a;if(0===(n=this._ndims))return this._accessors?this._buffer.get(this._offset):this._buffer[this._offset];if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(1===this._iterationOrder)return this._accessors?this._buffer.get(this._offset+t):this._buffer[this._offset+t];if(-1===this._iterationOrder)return this._accessors?this._buffer.get(this.offset-t):this._buffer[this._offset-t]}if(r=this._shape,e=this._strides,i=this._offset,"column-major"===this._order){for(a=0;a<n;a++)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]}for(a=n-1;a>=0;a--)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),v(Sr.prototype,"set",(function(){var t,e;for(t=this._offset,e=0;e<arguments.length-1;e++)t+=this._strides[e]*arguments[e];return this._accessors?this._buffer.set(arguments[e],t):this._buffer[t]=arguments[e],this})),v(Sr.prototype,"iset",(function(t,e){var r,n,i,o,a,u;if(0===(i=this._ndims))return this._accessors?this._buffer.set(t,this._offset):this._buffer[this._offset]=t,this;if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(1===this._iterationOrder)return this._accessors?this._buffer.set(e,this._offset+t):this._buffer[this._offset+t]=e,this;if(-1===this._iterationOrder)return this._accessors?this._buffer.set(e,this._offset-t):this._buffer[this._offset-t]=e,this}if(n=this._shape,r=this._strides,o=this._offset,"column-major"===this._order){for(u=0;u<i;u++)t-=a=t%n[u],t/=n[u],o+=a*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this}for(u=i-1;u>=0;u--)t-=a=t%n[u],t/=n[u],o+=a*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this})),v(Sr.prototype,"toString",(function(){var t,e,r,n,i,o;if(e=this._shape.length,r="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o<this._length;o++)t+=vt(i=this.iget(o))+", "+Et(i),o<this._length-1&&(t+=", ");else for(o=0;o<this._length;o++)t+=this.iget(o),o<this._length-1&&(t+=", ");else{if("complex64"===n||"complex128"===n)for(o=0;o<3;o++)t+=vt(i=this.iget(o))+", "+Et(i),o<2&&(t+=", ");else for(o=0;o<3;o++)t+=this.iget(o),o<2&&(t+=", ");if(t+=", ..., ","complex64"===n||"complex128"===n)for(o=2;o>=0;o--)t+=vt(i=this.iget(this._length-1-o))+", "+Et(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(r+=fe(se[this.dtype],"{{data}}",t),r+=", ",r+=0===e?"[]":"[ "+this._shape.join(", ")+" ]",r+=", ",r+="[ ",0===e)r+="0";else for(o=0;o<e;o++)this._strides[o]<0?r+=-this._strides[o]:r+=this._strides[o],o<e-1&&(r+=", ");return r+=" ]",r+=", ",r+="0",r+=", ",r+="'"+this._order+"'",r+=" )"})),v(Sr.prototype,"toJSON",(function(){var t,e,r,n;for(e=this._length,(t={}).type="ndarray",t.dtype=this.dtype,t.flags={READONLY:this._flags.READONLY},t.order=this._order,t.shape=this._shape.slice(),t.strides=this._strides.slice(),n=0;n<e;n++)t.strides[n]<0&&(t.strides[n]*=-1);if(t.data=[],"complex64"===t.dtype||"complex128"===t.dtype)for(n=0;n<e;n++)r=this.iget(n),t.data.push(vt(r),Et(r));else for(n=0;n<e;n++)t.data.push(this.iget(n));return t})),v(Sr.prototype,"__array_meta_dataview__","function"==typeof ht.BigInt&&"function"==typeof BigInt&&"bigint"==typeof ht.BigInt("1")&&"bigint"==typeof BigInt("1")?function(){var t,e,r,n,i,o,a,u,f,s,l,c,h,p;if(f=this._mode||"throw",a=this._submode||[f],r=33+16*(c=this._ndims)+(h=a.length),(u=this.__meta_dataview__)&&u.byteLength===r)return u;for(u=new Ce(new Le(r)),i=this._shape,o=this._strides,n=this._dtype,t=this._bytesPerElement,s=0,u.setInt8(s,_e?1:0),s+=1,u.setInt16(s,vr[n],_e),s+=2,u.setBigInt64(s,Ne(c),_e),l=8*c,s+=8,p=0;p<c;p++)u.setBigInt64(s,Ne(i[p]),_e),u.setBigInt64(s+l,Ne(o[p]*t),_e),s+=8;for(s+=l,u.setBigInt64(s,Ne(this._offset*t),_e),s+=8,u.setInt8(s,Er[this._order]),s+=1,u.setInt8(s,_r[f]),s+=1,u.setBigInt64(s,Ne(h),_e),s+=8,p=0;p<h;p++)u.setInt8(s,_r[a[p]]),s+=1;return e=0,e|=this._flags.READONLY?4:0,u.setInt32(s,e,_e),this.__meta_dataview__=u,u}:function(){var t,e,r,n,i,o,a,u,f,s,l,c,h,p,g;if(s=this._mode||"throw",u=this._submode||[s],n=33+16*(h=this._ndims)+(p=u.length),(f=this.__meta_dataview__)&&f.byteLength===n)return f;for(f=new Ce(new Le(n)),e=new ge(f.buffer),o=this._shape,a=this._strides,i=this._dtype,t=this._bytesPerElement,l=0,f.setInt8(l,_e?1:0),l+=1,f.setInt16(l,Or[i],_e),xr(h,e,1,l+=2),c=8*h,l+=8,g=0;g<h;g++)xr(o[g],e,1,l),xr(a[g]*t,e,1,l+c),l+=8;for(l+=c,xr(this._offset*t,e,1,l),l+=8,f.setInt8(l,Rr[this._order]),l+=1,f.setInt8(l,jr[s]),xr(p,e,1,l+=1),l+=8,g=0;g<p;g++)f.setInt8(l,jr[u[g]]),l+=1;return r=0,r|=this._flags.READONLY?4:0,f.setInt32(l,r,_e),this.__meta_dataview__=f,f}),v(Ur,"assign",(function(t,e,r){return"column-major"===e?function(t,e){var r,n;for(r=1,n=0;n<t.length;n++)e[n]=r,r*=t[n];return e}(t,r):function(t,e){var r,n;for(r=1,n=t.length-1;n>=0;n--)e[n]=r,r*=t[n];return e}(t,r)}));function Pr(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(e){var r,n;if(!function(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&it(t.length)&&t.length>=0&&t.length<=4294967295}(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}var Vr=Pr(ct.isPrimitive),Mr=Pr(ct.isObject),kr=Pr(ct);v(kr,"primitives",Vr),v(kr,"objects",Mr);var Cr=Pr(ft.isPrimitive),Nr=Pr(ft.isObject),Yr=Pr(ft);v(Yr,"primitives",Cr),v(Yr,"objects",Nr);var Fr=yr(),Dr=Fr.length;function zr(t){var e;for(e=0;e<Dr;e++)if(t===Fr[e])return!0;return!1}var Gr=Fe(),Wr=Gr.length;function $r(t){var e;for(e=0;e<Wr;e++)if(t===Gr[e])return!0;return!1}function Jr(t,e,r,n){var i=bt(e,r,n);return i[0]>=0&&i[1]<t}function Xr(t){var e=typeof t;return null===t||"object"!==e&&"function"!==e?new TypeError("invalid argument. A provided constructor must be either an object (except null) or a function. Value: `"+t+"`."):null}var qr=Object.create;function Zr(){}var Hr="function"==typeof qr?qr:function(t){return Zr.prototype=t,new Zr};var Kr="throw",Qr=!1;function tn(t,e,r){if("clamp"===r)return function(t,e){return t<0?0:t>e?e:t}(t,e);if("wrap"===r)return function(t,e){var r=e+1;return t<0?((t+=r)<0&&0!=(t%=r)&&(t+=r),t):t>e?((t-=r)>e&&(t%=r),t):t}(t,e);if(t<0||t>e)throw new RangeError("invalid argument. Index must be on the interval: [0,"+e+"]. Value: `"+t+"`.");return t}var en=Sr.prototype.iget;var rn=Sr.prototype.iset;function nn(t,e){var r,n;for(r=[],n=0;n<e;n++)r.push(t[n]);return r}var on=wr(),an=on.length;function un(t){var e;for(e=0;e<an;e++)if(t===on[e])return!0;return!1}function fn(t,r){var n;if(!X(r))return new TypeError("invalid argument. Options must be an object. Value: `"+r+"`.");if(e(r,"mode")&&(t.mode=r.mode,!un(t.mode)))return new TypeError("invalid option. `mode` option must be a recognized mode. Option: `"+t.mode+"`.");if(e(r,"submode")){if(t.submode=r.submode,!u(t.submode))return new TypeError("invalid option. `submode` option must be an array containing recognized modes. Option: `"+t.submode+"`.");if(0===t.submode.length)return new TypeError("invalid option. `submode` option must be an array containing recognized modes. Option: `"+t.submode.join(",")+"`.");for(n=0;n<t.submode.length;n++)if(!un(t.submode[n]))return new TypeError("invalid option. Each `submode` must be a recognized modes. Option: `"+t.submode[n]+"`.");t.submode=t.submode.slice()}return e(r,"readonly")&&(t.readonly=r.readonly,!E(t.readonly))?new TypeError("invalid option. `readonly` option must be a boolean. Option: `"+t.readonly+"`."):null}function sn(t,e,r,n,i,o,a){var u,f,s,l,c;if(!(this instanceof sn))return arguments.length<7?new sn(t,e,r,n,i,o):new sn(t,e,r,n,i,o,a);if(!$r(t))throw new TypeError("invalid argument. `dtype` argument must be a supported ndarray data type. Value: `"+t+"`.");if(!or(e))throw new TypeError("invalid argument. `buffer` argument must be an array-like object, typed-array-like, or a Buffer. Value: `"+e+"`.");if(e.get&&e.set&&(!D(e.get)||!D(e.set)))throw new TypeError("invalid argument. `buffer` argument `get` and `set` properties must be functions. Value: `"+e+"`.");if(!Vr(r)&&(!or(r)||r.length>0))throw new TypeError("invalid argument. `shape` argument must be an array-like object containing nonnegative integers. Value: `"+r+"`.");if((u=r.length)>32767)throw new RangeError("invalid argument. Number of dimensions must not exceed 32767 due to stack limits. Value: `"+u+"`.");if(!Cr(n))throw new TypeError("invalid argument. `strides` argument must be an array-like object containing integers. Value: `"+n+"`.");if(u>0){if(n.length!==u)throw new RangeError("invalid argument. `strides` argument length must match the number of dimensions. Expected number of dimensions: "+u+". Strides length: "+n.length+".")}else{if(1!==n.length)throw new RangeError("invalid argument. `strides` length must be equal to 1 when creating a zero-dimensional ndarray.");if(0!==n[0])throw new RangeError("invalid argument. `strides` argument must contain a single element equal to `0`. Value: `"+n[0]+"`.")}if(!st(i))throw new TypeError("invalid argument. `offset` argument must be a nonnegative integer. Value: `"+i+"`.");if(!zr(o))throw new TypeError("invalid argument. `order` argument must be a supported order. Value: `"+o+"`.");if(u>0&&!Jr(e.length,r,n,i)&&Lr(r)>0)throw new Error("invalid arguments. The input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.");if((f={}).mode=Kr,f.readonly=Qr,arguments.length>6&&(s=fn(f,a)))throw s;return this._mode=f.mode,void 0===f.submode&&(f.submode=[this._mode]),this._submode=f.submode,l=nn(r,u),c=nn(n,u||1),Sr.call(this,t,e,l,c,i,o),this._flags.READONLY=f.readonly,this}!function(t,e){var r=Xr(t);if(r)throw r;if(r=Xr(e))throw r;if(void 0===e.prototype)throw new TypeError("invalid argument. Second argument must have a prototype from which another object can inherit. Value: `"+e.prototype+"`.");t.prototype=Hr(e.prototype),b(t.prototype,"constructor",{configurable:!0,enumerable:!1,writable:!0,value:t})}(sn,Sr),v(sn,"name","ndarray"),v(sn.prototype,"get",(function(){var t,e,r,n;if(arguments.length!==this._ndims)throw new RangeError("invalid arguments. Number of indices must match the number of dimensions. ndims: "+this._ndims+". nargs: "+arguments.length+".");for(t=this._offset,r=this._submode.length,n=0;n<arguments.length;n++){if(!at(arguments[n]))throw new TypeError("invalid argument. Indices must be integer valued. Argument: "+n+". Value: `"+arguments[n]+"`.");e=tn(arguments[n],this._shape[n]-1,this._submode[n%r]),t+=this._strides[n]*e}return this._accessors?this._buffer.get(t):this._buffer[t]})),v(sn.prototype,"iget",(function(t){if(this._ndims>0){if(!at(t))throw new TypeError("invalid argument. Index must be an integer value. Value: `"+t+"`.");return t=tn(t,this._length-1,this._mode),en.call(this,t)}return en.call(this)})),v(sn.prototype,"set",(function(){var t,e,r,n;if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(arguments.length!==this._ndims+1)throw new RangeError("invalid arguments. Number of indices must match the number of dimensions. ndims: "+this._ndims+". nargs: "+arguments.length+".");for(t=this._offset,r=this._submode.length,n=0;n<arguments.length-1;n++){if(!at(arguments[n]))throw new TypeError("invalid argument. Indices must be integer valued. Argument: "+n+". Value: `"+arguments[n]+"`.");e=tn(arguments[n],this._shape[n]-1,this._submode[n%r]),t+=this._strides[n]*e}return this._accessors?this._buffer.set(arguments[n],t):this._buffer[t]=arguments[n],this})),v(sn.prototype,"iset",(function(t,e){if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(this._ndims>0){if(!at(t))throw new TypeError("invalid argument. Index must be an integer value. Value: `"+t+"`.");t=tn(t,this._length-1,this._mode),rn.call(this,t,e)}else rn.call(this,t);return this}));var ln=["none","equiv","safe","same-kind","unsafe"];function cn(){return ln.slice()}v(cn,"enum",(function(){return{none:0,equiv:1,safe:2,"same-kind":3,unsafe:4}}));var hn=cn(),pn=hn.length;function gn(t){var e;for(e=0;e<pn;e++)if(t===hn[e])return!0;return!1}var yn=["binary","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"];function mn(){return yn.slice()}var dn={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256};function wn(){return{bool:dn.bool,int8:dn.int8,uint8:dn.uint8,uint8c:dn.uint8c,int16:dn.int16,uint16:dn.uint16,int32:dn.int32,uint32:dn.uint32,int64:dn.int64,uint64:dn.uint64,float32:dn.float32,float64:dn.float64,complex64:dn.complex64,complex128:dn.complex128,binary:dn.binary,generic:dn.generic,notype:dn.notype,userdefined_type:dn.userdefined_type}}v(mn,"enum",wn),function(t,e){var r,n,i;for(r=pr(e),i=0;i<r.length;i++)ze(t,n=r[i],e[n])}(mn,wn());var bn=function(t,r){var n,i,o,a,f,s,l,c=!0;if(!k(t))throw new TypeError("invalid argument. First argument must be object-like. Value: `"+t+"`.");if(arguments.length>1){if(!X(r))throw new TypeError("invalid argument. Options arguments must be an object. Value: `"+r+"`.");if(e(r,"duplicates")&&!E(c=r.duplicates))throw new TypeError("invalid argument. `duplicates` option must be a boolean primitive. Option: `"+c+"`.")}if(i=(n=pr(t)).length,f={},c)for(l=0;l<i;l++)e(f,a=t[o=n[l]])?(s=f[a],u(s)?f[a].push(o):f[a]=[s,o]):f[a]=o;else for(l=0;l<i;l++)f[t[o=n[l]]]=o;return f}(wn(),{duplicates:!1});var vn={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256};function En(t){var e=typeof t;return"string"===e?null===function(t){var e=vn[t];return"number"==typeof e?e:null}(t)?null:t:"number"===e?function(t){var e=bn[t];return"string"==typeof e?e:null}(t):null}var _n,An={float64:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function Tn(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=pr(An)).length,f=0;f<e;f++){for(i=t[f],a=An[i],n={},u=0;u<e;u++)n[o=t[u]]=a[o];r[i]=n}return r}function xn(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=pr(An)).length,f=0;f<e;f++){for(i=t[f],a=An[i],n=[],u=0;u<e;u++)1===a[o=t[u]]&&n.push(o);r[i]=n}return r}var On=function(t){return 0===arguments.length?Tn():(void 0===_n&&(_n=xn()),t=En(t),e(_n,t)?_n[t].slice():null)}();var Rn,jn={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function Sn(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=pr(jn)).length,f=0;f<e;f++){for(i=t[f],a=jn[i],n={},u=0;u<e;u++)n[o=t[u]]=a[o];r[i]=n}return r}function In(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=pr(jn)).length,f=0;f<e;f++){for(i=t[f],a=jn[i],n=[],u=0;u<e;u++)1===a[o=t[u]]&&n.push(o);r[i]=n}return r}var Un=function(t){return 0===arguments.length?Sn():(void 0===Rn&&(Rn=In()),t=En(t),e(Rn,t)?Rn[t].slice():null)}();function Bn(t,e,r){return"unsafe"===r||(t===e||"none"!==r&&"equiv"!==r&&("safe"===r?function(t,e){return t===e||On[t][e]>0}(t,e):function(t,e){return t===e||Un[t][e]>0}(t,e)))}var Ln=[],Pn=[],Vn="undefined"!=typeof Uint8Array?Uint8Array:Array,Mn=!1;function kn(){Mn=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)Ln[e]=t[e],Pn[t.charCodeAt(e)]=e;Pn["-".charCodeAt(0)]=62,Pn["_".charCodeAt(0)]=63}function Cn(t,e,r){for(var n,i,o=[],a=e;a<r;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Ln[(i=n)>>18&63]+Ln[i>>12&63]+Ln[i>>6&63]+Ln[63&i]);return o.join("")}function Nn(t){var e;Mn||kn();for(var r=t.length,n=r%3,i="",o=[],a=16383,u=0,f=r-n;u<f;u+=a)o.push(Cn(t,u,u+a>f?f:u+a));return 1===n?(e=t[r-1],i+=Ln[e>>2],i+=Ln[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=Ln[e>>10],i+=Ln[e>>4&63],i+=Ln[e<<2&63],i+="="),o.push(i),o.join("")}function Yn(t,e,r,n,i){var o,a,u=8*i-n-1,f=(1<<u)-1,s=f>>1,l=-7,c=r?i-1:0,h=r?-1:1,p=t[e+c];for(c+=h,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[e+c],c+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===o)o=1-s;else{if(o===f)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=s}return(p?-1:1)*a*Math.pow(2,o-n)}function Fn(t,e,r,n,i,o){var a,u,f,s=8*o-i-1,l=(1<<s)-1,c=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,g=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+c>=1?h/f:h*Math.pow(2,1-c))*f>=2&&(a++,f/=2),a+c>=l?(u=0,a=l):a+c>=1?(u=(e*f-1)*Math.pow(2,i),a+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&u,p+=g,u/=256,i-=8);for(a=a<<i|u,s+=i;s>0;t[r+p]=255&a,p+=g,a/=256,s-=8);t[r+p-g]|=128*y}var Dn={}.toString,zn=Array.isArray||function(t){return"[object Array]"==Dn.call(t)};Jn.TYPED_ARRAY_SUPPORT=void 0===S.TYPED_ARRAY_SUPPORT||S.TYPED_ARRAY_SUPPORT;var Gn=Wn();function Wn(){return Jn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function $n(t,e){if(Wn()<e)throw new RangeError("Invalid typed array length");return Jn.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Jn.prototype:(null===t&&(t=new Jn(e)),t.length=e),t}function Jn(t,e,r){if(!(Jn.TYPED_ARRAY_SUPPORT||this instanceof Jn))return new Jn(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Zn(this,t)}return Xn(this,t,e,r)}function Xn(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);Jn.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Jn.prototype:t=Hn(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!Jn.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|ti(e,r),i=(t=$n(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(Qn(e)){var r=0|Kn(e.length);return 0===(t=$n(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?$n(t,0):Hn(t,e);if("Buffer"===e.type&&zn(e.data))return Hn(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function qn(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Zn(t,e){if(qn(e),t=$n(t,e<0?0:0|Kn(e)),!Jn.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function Hn(t,e){var r=e.length<0?0:0|Kn(e.length);t=$n(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function Kn(t){if(t>=Wn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wn().toString(16)+" bytes");return 0|t}function Qn(t){return!(null==t||!t._isBuffer)}function ti(t,e){if(Qn(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 r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Oi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ri(t).length;default:if(n)return Oi(t).length;e=(""+e).toLowerCase(),n=!0}}function ei(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return yi(this,e,r);case"utf8":case"utf-8":return hi(this,e,r);case"ascii":return pi(this,e,r);case"latin1":case"binary":return gi(this,e,r);case"base64":return ci(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mi(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function ri(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function ni(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Jn.from(e,n)),Qn(e))return 0===e.length?-1:ii(t,e,r,n,i);if("number"==typeof e)return e&=255,Jn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ii(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ii(t,e,r,n,i){var o,a=1,u=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,f/=2,r/=2}function s(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<u;o++)if(s(t,o)===s(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===f)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+f>u&&(r=u-f),o=r;o>=0;o--){for(var c=!0,h=0;h<f;h++)if(s(t,o+h)!==s(e,h)){c=!1;break}if(c)return o}return-1}function oi(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var u=parseInt(e.substr(2*a,2),16);if(isNaN(u))return a;t[r+a]=u}return a}function ai(t,e,r,n){return ji(Oi(e,t.length-r),t,r,n)}function ui(t,e,r,n){return ji(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function fi(t,e,r,n){return ui(t,e,r,n)}function si(t,e,r,n){return ji(Ri(e),t,r,n)}function li(t,e,r,n){return ji(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=(r=t.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function ci(t,e,r){return 0===e&&r===t.length?Nn(t):Nn(t.slice(e,r))}function hi(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,u,f,s=t[i],l=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=r)switch(c){case 1:s<128&&(l=s);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&s)<<6|63&o)>127&&(l=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&s)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(l=f);break;case 4:o=t[i+1],a=t[i+2],u=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(f=(15&s)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&f<1114112&&(l=f)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}Jn.poolSize=8192,Jn._augment=function(t){return t.__proto__=Jn.prototype,t},Jn.from=function(t,e,r){return Xn(null,t,e,r)},Jn.TYPED_ARRAY_SUPPORT&&(Jn.prototype.__proto__=Uint8Array.prototype,Jn.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Jn[Symbol.species]),Jn.alloc=function(t,e,r){return function(t,e,r,n){return qn(e),e<=0?$n(t,e):void 0!==r?"string"==typeof n?$n(t,e).fill(r,n):$n(t,e).fill(r):$n(t,e)}(null,t,e,r)},Jn.allocUnsafe=function(t){return Zn(null,t)},Jn.allocUnsafeSlow=function(t){return Zn(null,t)},Jn.isBuffer=Si,Jn.compare=function(t,e){if(!Qn(t)||!Qn(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},Jn.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Jn.concat=function(t,e){if(!zn(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Jn.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=Jn.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!Qn(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Jn.byteLength=ti,Jn.prototype._isBuffer=!0,Jn.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)ri(this,e,e+1);return this},Jn.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)ri(this,e,e+3),ri(this,e+1,e+2);return this},Jn.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)ri(this,e,e+7),ri(this,e+1,e+6),ri(this,e+2,e+5),ri(this,e+3,e+4);return this},Jn.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?hi(this,0,t):ei.apply(this,arguments)},Jn.prototype.equals=function(t){if(!Qn(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Jn.compare(this,t)},Jn.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Jn.prototype.compare=function(t,e,r,n,i){if(!Qn(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(o,a),f=this.slice(n,i),s=t.slice(e,r),l=0;l<u;++l)if(f[l]!==s[l]){o=f[l],a=s[l];break}return o<a?-1:a<o?1:0},Jn.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},Jn.prototype.indexOf=function(t,e,r){return ni(this,t,e,r,!0)},Jn.prototype.lastIndexOf=function(t,e,r){return ni(this,t,e,r,!1)},Jn.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return oi(this,t,e,r);case"utf8":case"utf-8":return ai(this,t,e,r);case"ascii":return ui(this,t,e,r);case"latin1":case"binary":return fi(this,t,e,r);case"base64":return si(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return li(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Jn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function pi(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function gi(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function yi(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=xi(t[o]);return i}function mi(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function di(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function wi(t,e,r,n,i,o){if(!Qn(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function bi(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function vi(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function Ei(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _i(t,e,r,n,i){return i||Ei(t,0,r,4),Fn(t,e,r,n,23,4),r+4}function Ai(t,e,r,n,i){return i||Ei(t,0,r,8),Fn(t,e,r,n,52,8),r+8}Jn.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),Jn.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=Jn.prototype;else{var i=e-t;r=new Jn(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},Jn.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||di(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},Jn.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||di(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},Jn.prototype.readUInt8=function(t,e){return e||di(t,1,this.length),this[t]},Jn.prototype.readUInt16LE=function(t,e){return e||di(t,2,this.length),this[t]|this[t+1]<<8},Jn.prototype.readUInt16BE=function(t,e){return e||di(t,2,this.length),this[t]<<8|this[t+1]},Jn.prototype.readUInt32LE=function(t,e){return e||di(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Jn.prototype.readUInt32BE=function(t,e){return e||di(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Jn.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||di(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},Jn.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||di(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Jn.prototype.readInt8=function(t,e){return e||di(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Jn.prototype.readInt16LE=function(t,e){e||di(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Jn.prototype.readInt16BE=function(t,e){e||di(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Jn.prototype.readInt32LE=function(t,e){return e||di(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Jn.prototype.readInt32BE=function(t,e){return e||di(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Jn.prototype.readFloatLE=function(t,e){return e||di(t,4,this.length),Yn(this,t,!0,23,4)},Jn.prototype.readFloatBE=function(t,e){return e||di(t,4,this.length),Yn(this,t,!1,23,4)},Jn.prototype.readDoubleLE=function(t,e){return e||di(t,8,this.length),Yn(this,t,!0,52,8)},Jn.prototype.readDoubleBE=function(t,e){return e||di(t,8,this.length),Yn(this,t,!1,52,8)},Jn.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||wi(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},Jn.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||wi(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Jn.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,1,255,0),Jn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Jn.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,2,65535,0),Jn.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):bi(this,t,e,!0),e+2},Jn.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,2,65535,0),Jn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):bi(this,t,e,!1),e+2},Jn.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,4,4294967295,0),Jn.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):vi(this,t,e,!0),e+4},Jn.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,4,4294967295,0),Jn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):vi(this,t,e,!1),e+4},Jn.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);wi(this,t,e,r,i-1,-i)}var o=0,a=1,u=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},Jn.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);wi(this,t,e,r,i-1,-i)}var o=r-1,a=1,u=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},Jn.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,1,127,-128),Jn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Jn.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,2,32767,-32768),Jn.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):bi(this,t,e,!0),e+2},Jn.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,2,32767,-32768),Jn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):bi(this,t,e,!1),e+2},Jn.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,4,2147483647,-2147483648),Jn.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):vi(this,t,e,!0),e+4},Jn.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||wi(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Jn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):vi(this,t,e,!1),e+4},Jn.prototype.writeFloatLE=function(t,e,r){return _i(this,t,e,!0,r)},Jn.prototype.writeFloatBE=function(t,e,r){return _i(this,t,e,!1,r)},Jn.prototype.writeDoubleLE=function(t,e,r){return Ai(this,t,e,!0,r)},Jn.prototype.writeDoubleBE=function(t,e,r){return Ai(this,t,e,!1,r)},Jn.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Jn.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},Jn.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Jn.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=Qn(t)?t:Oi(new Jn(t,n).toString()),u=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%u]}return this};var Ti=/[^+\/0-9A-Za-z-_]/g;function xi(t){return t<16?"0"+t.toString(16):t.toString(16)}function Oi(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Ri(t){return function(t){var e,r,n,i,o,a;Mn||kn();var u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[u-2]?2:"="===t[u-1]?1:0,a=new Vn(3*u/4-o),n=o>0?u-4:u;var f=0;for(e=0,r=0;e<n;e+=4,r+=3)i=Pn[t.charCodeAt(e)]<<18|Pn[t.charCodeAt(e+1)]<<12|Pn[t.charCodeAt(e+2)]<<6|Pn[t.charCodeAt(e+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=255&i;return 2===o?(i=Pn[t.charCodeAt(e)]<<2|Pn[t.charCodeAt(e+1)]>>4,a[f++]=255&i):1===o&&(i=Pn[t.charCodeAt(e)]<<10|Pn[t.charCodeAt(e+1)]<<4|Pn[t.charCodeAt(e+2)]>>2,a[f++]=i>>8&255,a[f++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Ti,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ji(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Si(t){return null!=t&&(!!t._isBuffer||Ii(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Ii(t.slice(0,0))}(t))}function Ii(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Ui=Object.freeze({__proto__:null,Buffer:Jn,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Jn.alloc(+t)},isBuffer:Si,kMaxLength:Gn}),Bi=Jn;function Li(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];r.push.apply(r,arguments);var n=Function.bind.apply(e,r);return new n}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}var Pi,Vi=Li(Ui).Buffer;Pi=function(){var t,e;if("function"!=typeof Bi)return!1;try{t=N(e="function"==typeof Bi.from?Bi.from([1,2,3,4]):new Bi([1,2,3,4]))&&1===e[0]&&2===e[1]&&3===e[2]&&4===e[3]}catch(e){t=!1}return t}()?Vi:function(){throw new Error("not implemented")};var Mi=Pi,ki="function"==typeof Float32Array;var Ci="function"==typeof Float32Array?Float32Array:null;var Ni,Yi="function"==typeof Float32Array?Float32Array:void 0;Ni=function(){var t,e,r;if("function"!=typeof Ci)return!1;try{e=new Ci([1,3.14,-3.14,5e40]),r=e,t=(ki&&r instanceof Float32Array||"[object Float32Array]"===a(r))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===et}catch(e){t=!1}return t}()?Yi:function(){throw new Error("not implemented")};var Fi=Ni,Di="function"==typeof Int16Array;var zi="function"==typeof Int16Array?Int16Array:null;var Gi,Wi="function"==typeof Int16Array?Int16Array:void 0;Gi=function(){var t,e,r;if("function"!=typeof zi)return!1;try{e=new zi([1,3.14,-3.14,32768]),r=e,t=(Di&&r instanceof Int16Array||"[object Int16Array]"===a(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){t=!1}return t}()?Wi:function(){throw new Error("not implemented")};var $i=Gi,Ji="function"==typeof Int32Array;var Xi="function"==typeof Int32Array?Int32Array:null;var qi,Zi="function"==typeof Int32Array?Int32Array:void 0;qi=function(){var t,e,r;if("function"!=typeof Xi)return!1;try{e=new Xi([1,3.14,-3.14,2147483648]),r=e,t=(Ji&&r instanceof Int32Array||"[object Int32Array]"===a(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){t=!1}return t}()?Zi:function(){throw new Error("not implemented")};var Hi=qi,Ki="function"==typeof Int8Array;var Qi="function"==typeof Int8Array?Int8Array:null;var to,eo="function"==typeof Int8Array?Int8Array:void 0;to=function(){var t,e,r;if("function"!=typeof Qi)return!1;try{e=new Qi([1,3.14,-3.14,128]),r=e,t=(Ki&&r instanceof Int8Array||"[object Int8Array]"===a(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){t=!1}return t}()?eo:function(){throw new Error("not implemented")};var ro=to,no="function"==typeof Uint32Array;var io="function"==typeof Uint32Array?Uint32Array:null;var oo,ao="function"==typeof Uint32Array?Uint32Array:void 0;oo=function(){var t,e,r;if("function"!=typeof io)return!1;try{e=new io(e=[1,3.14,-3.14,4294967296,4294967297]),r=e,t=(no&&r instanceof Uint32Array||"[object Uint32Array]"===a(r))&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?ao:function(){throw new Error("not implemented")};var uo=oo,fo="function"==typeof Uint8ClampedArray;var so="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var lo,co="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;lo=function(){var t,e,r;if("function"!=typeof so)return!1;try{e=new so([-1,0,1,3.14,4.99,255,256]),r=e,t=(fo&&r instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===a(r))&&0===e[0]&&0===e[1]&&1===e[2]&&3===e[3]&&5===e[4]&&255===e[5]&&255===e[6]}catch(e){t=!1}return t}()?co:function(){throw new Error("not implemented")};var ho=lo;function po(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&it(t.length)&&t.length>=0&&t.length<=4294967295}function go(t,e){if(!(this instanceof go))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!q(t))throw new TypeError("invalid argument. Real component must be a number primitive. Value: `"+t+"`.");if(!q(e))throw new TypeError("invalid argument. Imaginary component must be a number primitive. Value: `"+e+"`.");return b(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),b(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}v(go,"BYTES_PER_ELEMENT",8),v(go.prototype,"BYTES_PER_ELEMENT",8),v(go.prototype,"byteLength",16),v(go.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),v(go.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var yo="function"==typeof Math.fround?Math.fround:null,mo=new Fi(1);var wo="function"==typeof yo?yo:function(t){return mo[0]=t,mo[0]};function bo(t,e){if(!(this instanceof bo))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!q(t))throw new TypeError("invalid argument. Real component must be a number primitive. Value: `"+t+"`.");if(!q(e))throw new TypeError("invalid argument. Imaginary component must be a number primitive. Value: `"+e+"`.");return b(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:wo(t)}),b(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:wo(e)}),this}function vo(t){return t instanceof go||t instanceof bo||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function Eo(t){return it(t/2)}function _o(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")&&e(Symbol,"iterator")&&"symbol"==typeof Symbol.iterator}v(bo,"BYTES_PER_ELEMENT",4),v(bo.prototype,"BYTES_PER_ELEMENT",4),v(bo.prototype,"byteLength",8),v(bo.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),v(bo.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Ao=_o()?Symbol.iterator:null;function To(t){return t.re}function xo(t){return t.im}function Oo(t,e){return new Fi(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function Ro(t,e){return new Se(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function jo(t,e){return t[e]}function So(t,e){return t.get(e)}function Io(t,e,r){t[e]=r}function Uo(t,e,r){t.set(r,e)}function Bo(t){var e=Boolean(t.get&&t.set);return{data:t,accessors:e,getter:e?So:jo,setter:e?Uo:Io}}function Lo(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(po(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!vo(n))return new TypeError("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `"+n+"`.");e.push(To(n),xo(n))}return e}function Po(t,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,po(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!vo(o))return new TypeError("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `"+o+"`.");n.push(To(o),xo(o))}return n}function Vo(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;i<r;i++){if(!vo(n=e[i]))return null;t[o]=To(n),t[o+1]=xo(n),o+=2}return t}var Mo=2*Fi.BYTES_PER_ELEMENT,ko=_o();function Co(t){return t instanceof Do||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function No(t){return t===Do||"Complex128Array"===t.name}function Yo(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Mo}function Fo(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===2*Mo}function Do(){var t,e,r,n;if(e=arguments.length,!(this instanceof Do))return 0===e?new Do:1===e?new Do(arguments[0]):2===e?new Do(arguments[0],arguments[1]):new Do(arguments[0],arguments[1],arguments[2]);if(0===e)r=new Fi(0);else if(1===e)if(st(arguments[0]))r=new Fi(2*arguments[0]);else if(or(arguments[0]))if((n=(r=arguments[0]).length)&&u(r)&&vo(r[0])){if(null===(r=Vo(new Fi(2*n),r))){if(!Eo(n))throw new RangeError("invalid argument. Array-like object input arguments must have a length which is a multiple of two. Length: `"+n+"`.");r=new Fi(arguments[0])}}else{if(Yo(r))r=Oo(r,0);else if(Fo(r))r=Ro(r,0);else if(!Eo(n))throw new RangeError("invalid argument. Array-like object and typed array input arguments must have a length which is a multiple of two. Length: `"+n+"`.");r=new Fi(r)}else if(Te(arguments[0])){if(!it((r=arguments[0]).byteLength/Mo))throw new RangeError("invalid argument. ArrayBuffer byte length must be a multiple of "+Mo+". Byte length: `"+r.byteLength+"`.");r=new Fi(r)}else{if(!f(arguments[0]))throw new TypeError("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `"+arguments[0]+"`.");if(r=arguments[0],!1===ko)throw new TypeError("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `"+r+"`.");if(!D(r[Ao]))throw new TypeError("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `"+r+"`.");if(!D((r=r[Ao]()).next))throw new TypeError("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable.");if((r=Lo(r))instanceof Error)throw r;r=new Fi(r)}else{if(!Te(r=arguments[0]))throw new TypeError("invalid argument. First argument must be an array buffer. Value: `"+r+"`.");if(!st(t=arguments[1]))throw new TypeError("invalid argument. Byte offset must be a nonnegative integer. Value: `"+t+"`.");if(!it(t/Mo))throw new RangeError("invalid argument. Byte offset must be a multiple of "+Mo+". Value: `"+t+"`.");if(2===e){if(!it((n=r.byteLength-t)/Mo))throw new RangeError("invalid arguments. ArrayBuffer view byte length must be a multiple of "+Mo+". View byte length: `"+n+"`.");r=new Fi(r,t)}else{if(!st(n=arguments[2]))throw new TypeError("invalid argument. Length must be a nonnegative integer. Value: `"+n+"`.");if(n*Mo>r.byteLength-t)throw new RangeError("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `"+n*Mo+"`.");r=new Fi(r,t,2*n)}}return v(this,"_buffer",r),v(this,"_length",r.length/2),this}function zo(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(po(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!vo(n))return new TypeError("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `"+n+"`.");e.push(vt(n),Et(n))}return e}function Go(t,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,po(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!vo(o))return new TypeError("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `"+o+"`.");n.push(vt(o),Et(o))}return n}function Wo(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;i<r;i++){if(!vo(n=e[i]))return null;t[o]=vt(n),t[o+1]=Et(n),o+=2}return t}v(Do,"BYTES_PER_ELEMENT",Mo),v(Do,"name","Complex64Array"),v(Do,"from",(function(t){var e,r,n,i,o,a,u,s,l,c,h;if(!D(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!No(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!D(n=arguments[1]))throw new TypeError("invalid argument. Second argument must be a function. Value: `"+n+"`.");r>2&&(e=arguments[2])}if(Co(t)){if(u=t.length,n){for(o=(i=new this(u))._buffer,h=0,c=0;c<u;c++){if(vo(l=n.call(e,t.get(c),c)))o[h]=To(l),o[h+1]=xo(l);else{if(!(po(l)&&l.length>=2))throw new TypeError("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `"+l+"`.");o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(t)}if(or(t)){if(n){for(u=t.length,a=Bo(t),c=0;c<u;c++)if(!vo(a.getter(t,c))){s=!0;break}if(s){if(!Eo(u))throw new RangeError("invalid argument. First argument must have a length which is a multiple of two. Length: `"+u+"`.");for(o=(i=new this(u/2))._buffer,c=0;c<u;c++)o[c]=n.call(e,a.getter(t,c),c);return i}for(o=(i=new this(u))._buffer,h=0,c=0;c<u;c++){if(vo(l=n.call(e,a.getter(t,c),c)))o[h]=To(l),o[h+1]=xo(l);else{if(!(po(l)&&l.length>=2))throw new TypeError("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `"+l+"`.");o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(t)}if(f(t)&&ko&&D(t[Ao])){if(!D((o=t[Ao]()).next))throw new TypeError("invalid argument. First argument must be an array-like object or an iterable.");if((a=n?Po(o,n,e):Lo(o))instanceof Error)throw a;for(o=(i=new this(u=a.length/2))._buffer,c=0;c<u;c++)o[c]=a[c];return i}throw new TypeError("invalid argument. First argument must be an array-like object or an iterable. Value: `"+t+"`.")})),v(Do,"of",(function(){var t,e;if(!D(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!No(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),pt(Do.prototype,"buffer",(function(){return this._buffer.buffer})),pt(Do.prototype,"byteLength",(function(){return this._buffer.byteLength})),pt(Do.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),v(Do.prototype,"BYTES_PER_ELEMENT",Do.BYTES_PER_ELEMENT),v(Do.prototype,"copyWithin",(function(t,e){if(!Co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),v(Do.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!Co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,v(r={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new bo(t[a+=2],t[a+1]),{value:[o,e],done:!1}})),v(r,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Ao&&v(r,Ao,(function(){return e.entries()})),r})),v(Do.prototype,"get",(function(t){var e;if(!Co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!st(t))throw new TypeError("invalid argument. Must provide a nonnegative integer. Value: `"+t+"`.");if(!(t>=this._length))return new bo((e=this._buffer)[t*=2],e[t+1])})),pt(Do.prototype,"length",(function(){return this._length})),v(Do.prototype,"set",(function(t){var e,r,n,i,o,a,u,f,s;if(!Co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!st(r=arguments[1]))throw new TypeError("invalid argument. Index argument must be a nonnegative integer. Value: `"+r+"`.")}else r=0;if(vo(t)){if(r>=this._length)throw new RangeError("invalid argument. Index argument is out-of-bounds. Value: `"+r+"`.");return n[r*=2]=To(t),void(n[r+1]=xo(t))}if(Co(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,s=n.byteOffset+r*Mo,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new Fi(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(r*=2,s=0,f=0;f<a;f++)n[r]=e[s],n[r+1]=e[s+1],r+=2,s+=2}else{if(!or(t))throw new TypeError("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `"+t+"`.");for(a=t.length,f=0;f<a;f++)if(!vo(t[f])){o=!0;break}if(o){if(!Eo(a))throw new RangeError("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `"+a+"`.");if(r+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,s=n.byteOffset+r*Mo,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new Fi(a),f=0;f<a;f++)i[f]=e[f];e=i}for(r*=2,a/=2,s=0,f=0;f<a;f++)n[r]=e[s],n[r+1]=e[s+1],r+=2,s+=2;return}if(r+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,f=0;f<a;f++)u=t[f],n[r]=To(u),n[r+1]=xo(u),r+=2}}));var $o=2*Se.BYTES_PER_ELEMENT,Jo=_o();function Xo(t){return t instanceof Ko||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function qo(t){return t===Ko||"Complex64Array"===t.name}function Zo(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===$o/2}function Ho(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===$o}function Ko(){var t,e,r,n;if(e=arguments.length,!(this instanceof Ko))return 0===e?new Ko:1===e?new Ko(arguments[0]):2===e?new Ko(arguments[0],arguments[1]):new Ko(arguments[0],arguments[1],arguments[2]);if(0===e)r=new Se(0);else if(1===e)if(st(arguments[0]))r=new Se(2*arguments[0]);else if(or(arguments[0]))if((n=(r=arguments[0]).length)&&u(r)&&vo(r[0])){if(null===(r=Wo(new Se(2*n),r))){if(!Eo(n))throw new RangeError("invalid argument. Array-like object input arguments must have a length which is a multiple of two. Length: `"+n+"`.");r=new Se(arguments[0])}}else{if(Zo(r))r=Oo(r,0);else if(Ho(r))r=Ro(r,0);else if(!Eo(n))throw new RangeError("invalid argument. Array-like object and typed array input arguments must have a length which is a multiple of two. Length: `"+n+"`.");r=new Se(r)}else if(Te(arguments[0])){if(!it((r=arguments[0]).byteLength/$o))throw new RangeError("invalid argument. ArrayBuffer byte length must be a multiple of "+$o+". Byte length: `"+r.byteLength+"`.");r=new Se(r)}else{if(!f(arguments[0]))throw new TypeError("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `"+arguments[0]+"`.");if(r=arguments[0],!1===Jo)throw new TypeError("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `"+r+"`.");if(!D(r[Ao]))throw new TypeError("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `"+r+"`.");if(!D((r=r[Ao]()).next))throw new TypeError("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable.");if((r=zo(r))instanceof Error)throw r;r=new Se(r)}else{if(!Te(r=arguments[0]))throw new TypeError("invalid argument. First argument must be an array buffer. Value: `"+r+"`.");if(!st(t=arguments[1]))throw new TypeError("invalid argument. Byte offset must be a nonnegative integer. Value: `"+t+"`.");if(!it(t/$o))throw new RangeError("invalid argument. Byte offset must be a multiple of "+$o+". Value: `"+t+"`.");if(2===e){if(!it((n=r.byteLength-t)/$o))throw new RangeError("invalid arguments. ArrayBuffer view byte length must be a multiple of "+$o+". View byte length: `"+n+"`.");r=new Se(r,t)}else{if(!st(n=arguments[2]))throw new TypeError("invalid argument. Length must be a nonnegative integer. Value: `"+n+"`.");if(n*$o>r.byteLength-t)throw new RangeError("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `"+n*$o+"`.");r=new Se(r,t,2*n)}}return v(this,"_buffer",r),v(this,"_length",r.length/2),this}v(Ko,"BYTES_PER_ELEMENT",$o),v(Ko,"name","Complex128Array"),v(Ko,"from",(function(t){var e,r,n,i,o,a,u,s,l,c,h;if(!D(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!qo(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!D(n=arguments[1]))throw new TypeError("invalid argument. Second argument must be a function. Value: `"+n+"`.");r>2&&(e=arguments[2])}if(Xo(t)){if(u=t.length,n){for(o=(i=new this(u))._buffer,h=0,c=0;c<u;c++){if(vo(l=n.call(e,t.get(c),c)))o[h]=vt(l),o[h+1]=Et(l);else{if(!(po(l)&&l.length>=2))throw new TypeError("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `"+l+"`.");o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(t)}if(or(t)){if(n){for(u=t.length,a=Bo(t),c=0;c<u;c++)if(!vo(a.getter(t,c))){s=!0;break}if(s){if(!Eo(u))throw new RangeError("invalid argument. First argument must have a length which is a multiple of two. Length: `"+u+"`.");for(o=(i=new this(u/2))._buffer,c=0;c<u;c++)o[c]=n.call(e,a.getter(t,c),c);return i}for(o=(i=new this(u))._buffer,h=0,c=0;c<u;c++){if(vo(l=n.call(e,a.getter(t,c),c)))o[h]=vt(l),o[h+1]=Et(l);else{if(!(po(l)&&l.length>=2))throw new TypeError("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `"+l+"`.");o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(t)}if(f(t)&&Jo&&D(t[Ao])){if(!D((o=t[Ao]()).next))throw new TypeError("invalid argument. First argument must be an array-like object or an iterable.");if((a=n?Go(o,n,e):zo(o))instanceof Error)throw a;for(o=(i=new this(u=a.length/2))._buffer,c=0;c<u;c++)o[c]=a[c];return i}throw new TypeError("invalid argument. First argument must be an array-like object or an iterable. Value: `"+t+"`.")})),v(Ko,"of",(function(){var t,e;if(!D(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!qo(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),pt(Ko.prototype,"buffer",(function(){return this._buffer.buffer})),pt(Ko.prototype,"byteLength",(function(){return this._buffer.byteLength})),pt(Ko.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),v(Ko.prototype,"BYTES_PER_ELEMENT",Ko.BYTES_PER_ELEMENT),v(Ko.prototype,"copyWithin",(function(t,e){if(!Xo(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),v(Ko.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!Xo(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,v(r={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new go(t[a+=2],t[a+1]),{value:[o,e],done:!1}})),v(r,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Ao&&v(r,Ao,(function(){return e.entries()})),r})),v(Ko.prototype,"get",(function(t){var e;if(!Xo(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!st(t))throw new TypeError("invalid argument. Must provide a nonnegative integer. Value: `"+t+"`.");if(!(t>=this._length))return new go((e=this._buffer)[t*=2],e[t+1])})),pt(Ko.prototype,"length",(function(){return this._length})),v(Ko.prototype,"set",(function(t){var e,r,n,i,o,a,u,f,s;if(!Xo(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!st(r=arguments[1]))throw new TypeError("invalid argument. Index argument must be a nonnegative integer. Value: `"+r+"`.")}else r=0;if(vo(t)){if(r>=this._length)throw new RangeError("invalid argument. Index argument is out-of-bounds. Value: `"+r+"`.");return n[r*=2]=vt(t),void(n[r+1]=Et(t))}if(Xo(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,s=n.byteOffset+r*$o,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new Se(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(r*=2,s=0,f=0;f<a;f++)n[r]=e[s],n[r+1]=e[s+1],r+=2,s+=2}else{if(!or(t))throw new TypeError("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `"+t+"`.");for(a=t.length,f=0;f<a;f++)if(!vo(t[f])){o=!0;break}if(o){if(!Eo(a))throw new RangeError("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `"+a+"`.");if(r+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,s=n.byteOffset+r*$o,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new Se(a),f=0;f<a;f++)i[f]=e[f];e=i}for(r*=2,a/=2,s=0,f=0;f<a;f++)n[r]=e[s],n[r+1]=e[s+1],r+=2,s+=2;return}if(r+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,f=0;f<a;f++)u=t[f],n[r]=vt(u),n[r+1]=Et(u),r+=2}}));var Qo={binary:Mi,float64:Se,float32:Fi,generic:Array,int16:$i,int32:Hi,int8:ro,uint16:ve,uint32:uo,uint8:ge,uint8c:ho,complex64:Do,complex128:Ko};function ta(t){return Qo[t]||null}var ea=D(Mi.allocUnsafe)?function(t){if(!ct(t))throw new TypeError("invalid argument. Must provide a nonnegative integer. Value: `"+t+"`");return Mi.allocUnsafe(t)}:function(t){if(!ct(t))throw new TypeError("invalid argument. Must provide a nonnegative integer. Value: `"+t+"`");return new Mi(t)};function ra(t,e){return"generic"===t?function(t){var e,r;for(e=[],r=0;r<t;r++)e.push(0);return e}(e):"binary"===t?function(t){return function(t){var e;for(e=0;e<t.length;e++)t[e]=0;return t}(ea(t))}(e):function(t,e){var r=ta(t);return r?new r(e):null}(t,e)}var na={Buffer:"binary",Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Object:"generic",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},ia=[Se,Fi,Hi,uo,$i,ve,ro,ge,ho,Do,Ko],oa=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],aa=oa.length;function ua(t){var e;if(u(t))return"generic";if(N(t))return"binary";for(e=0;e<aa;e++)if(t instanceof ia[e])return oa[e];return na[Y(t)]||null}function fa(t,e){var r=e[0];return po(r)&&(t.push(r.length),fa(t,r)),t}function sa(t,e,r,n,i){var o,a,u;for(o=e[r],u=0;u<n.length;u++){if(!po(a=n[u])||a.length!==o)return r;if(i&&(a=sa(t,e,r+1,a,r+1<t-1))<t)return a}return t}function la(t){var e,r;if(!po(t))throw new TypeError("invalid argument. Must provide an array-like object. Value: `"+t+"`.");return fa(e=[t.length],t),(r=e.length)>1&&(e.length=sa(r,e,1,t,r>2)),e}function ca(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/}v(ca,"REGEXP",/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/);var ha=void 0!==Object.getOwnPropertyNames,pa=Object.getOwnPropertyNames;var ga=ha?function(t){return pa(Object(t))}:function(t){return pr(Object(t))},ya=void 0!==Object.getOwnPropertyDescriptor,ma=Object.getOwnPropertyDescriptor;var da,wa=ya?function(t,e){var r;return null==t||void 0===(r=ma(t,e))?null:r}:function(t,r){return e(t,r)?{configurable:!0,enumerable:!0,writable:!0,value:t[r]}:null};da=D(Mi.from)?function(t){if(!N(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Mi.from(t)}:function(t){if(!N(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new Mi(t)};var ba=da;function va(t){return new ro(t)}function Ea(t){return new ge(t)}function _a(t){return new ho(t)}function Aa(t){return new $i(t)}function Ta(t){return new ve(t)}function xa(t){return new Hi(t)}function Oa(t){return new uo(t)}function Ra(t){return new Fi(t)}function ja(t){return new Se(t)}var Sa={int8array:va,uint8array:Ea,uint8clampedarray:_a,int16array:Aa,uint16array:Ta,int32array:xa,uint32array:Oa,float32array:Ra,float64array:ja};function Ia(t,r,n,i,o){var f,s,l,c,h,p,g,y,m,d;if(o-=1,"object"!=typeof t||null===t)return t;if(N(t))return ba(t);if(function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===a(t))return!0;t=$(t)}return!1}(t))return function(t){var r,n,i,o,a,f,s=[],l=[];for(a=new t.constructor(t.message),s.push(t),l.push(a),t.stack&&(a.stack=t.stack),t.code&&(a.code=t.code),t.errno&&(a.errno=t.errno),t.syscall&&(a.syscall=t.syscall),r=pr(t),f=0;f<r.length;f++)o=r[f],e(n=wa(t,o),"value")&&(i=u(t[o])?[]:{},n.value=Ia(t[o],i,s,l,-1)),b(a,o,n);return a}(t);if("date"===(l=F(t)))return new Date(+t);if("regexp"===l)return function(t){if(!_t(t))throw new TypeError(ne("invalid argument. Must provide a regular expression string. Value: `%s`.",t));return(t=/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/.exec(t))?new RegExp(t[1],t[2]):null}(t.toString());if("set"===l)return new Set(t);if("map"===l)return new Map(t);if("string"===l||"boolean"===l||"number"===l)return t.valueOf();if(h=Sa[l])return h(t);if("array"!==l&&"object"!==l)return"function"==typeof Object.freeze?function(t){var r,n,i,o,a,f,s,l;for(r=[],o=[],s=Object.create($(t)),r.push(t),o.push(s),n=ga(t),l=0;l<n.length;l++)i=n[l],e(a=wa(t,i),"value")&&(f=u(t[i])?[]:{},a.value=Ia(t[i],f,r,o,-1)),b(s,i,a);return Object.isExtensible(t)||Object.preventExtensions(s),Object.isSealed(t)&&Object.seal(s),Object.isFrozen(t)&&Object.freeze(s),s}(t):{};if(s=pr(t),o>0)for(f=l,d=0;d<s.length;d++)y=t[p=s[d]],l=F(y),"object"!=typeof y||null===y||"array"!==l&&"object"!==l||N(y)?"object"===f?(e(c=wa(t,p),"value")&&(c.value=Ia(y)),b(r,p,c)):r[p]=Ia(y):-1===(m=ar(n,y))?(g=u(y)?new Array(y.length):{},n.push(y),i.push(g),"array"===f?r[p]=Ia(y,g,n,i,o):(e(c=wa(t,p),"value")&&(c.value=Ia(y,g,n,i,o)),b(r,p,c))):r[p]=i[m];else if("array"===l)for(d=0;d<s.length;d++)r[p=s[d]]=t[p];else for(d=0;d<s.length;d++)p=s[d],c=wa(t,p),b(r,p,c);return Object.isExtensible(t)||Object.preventExtensions(r),Object.isSealed(t)&&Object.seal(r),Object.isFrozen(t)&&Object.freeze(r),r}function Ua(t,e){var r;if(arguments.length>1){if(!st(e))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+e+"`.");if(0===e)return t}else e=et;return Ia(t,r=u(t)?new Array(t.length):{},[t],[r],e)}var Ba=!1,La=17976931348623157e292;function Pa(t,r){return X(r)?e(r,"depth")&&(t.depth=r.depth,!st(t.depth))?new TypeError("invalid option. `depth` option must be a nonnegative integer. Option: `"+t.depth+"`."):e(r,"copy")&&(t.copy=r.copy,!E(t.copy))?new TypeError("invalid option. `copy` option must be a boolean primitive. Option: `"+t.copy+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")}function Va(t,e,r){var n,i;for(i=0;i<e.length;i++)n=e[i],r&&po(n)?Va(t,n,r-1):t.push(n);return t}function Ma(t,e){var r,n,i;if(!po(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(r={copy:Ba,depth:La},arguments.length>1&&(n=Pa(r,e)))throw n;return i=0===r.depth?t:Va([],t,r.depth),r.copy?Ua(i):i}function ka(t){return at(t)&&t>0}function Ca(t){return ut(t)&&t.valueOf()>0}function Na(t){return ka(t)||Ca(t)}v(Na,"isPrimitive",ka),v(Na,"isObject",Ca);var Ya=Pr(Na.isPrimitive),Fa=Pr(Na.isObject),Da=Pr(Na);function za(t){var e,r,n,i;for(n="return function flattenArray(x){",r=(e=t.length)-1,n+="var o=[];var ",i=0;i<e;i++)n+="i"+i,n+=i<r?",":";";for(i=0;i<e;i++)n+="for(i"+i+"=0;i"+i+"<"+t[i]+";i"+i+"++){";for(n+="o.push(x",i=0;i<e;i++)n+="[i"+i+"]";for(n+=");",i=0;i<e;i++)n+="}";return n+="return o;",n+="}",n+="//# sourceURL=flatten_array.gen_fcn.js",new Function(n)()}function Ga(t){return function(e){if(!po(e))throw new TypeError("invalid argument. Must provide an array-like object. Value: `"+e+"`.");return t(e)}}function Wa(t){return function(e){if(!po(e))throw new TypeError("invalid argument. Must provide an array-like object. Value: `"+e+"`.");return Ua(t(e))}}function $a(){var t,e=arguments,r=e[0],n="https://stdlib.io/e/"+r+"?";for(t=1;t<e.length;t++)n+="&arg[]="+encodeURIComponent(e[t]);return n}function Ja(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&it(t.length)&&t.length>=0&&t.length<et}v(Da,"primitives",Ya),v(Da,"objects",Fa),v(Ma,"factory",(function(t,r){var n,i;if(!Ya(t))throw new TypeError("invalid argument. First argument must be an array of positive integers. Value: `"+t+"`.");if(n=Ba,arguments.length>1){if(!X(r))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.");if(e(r,"copy")&&!E(n=r.copy))throw new TypeError("invalid option. `copy` option must be a boolean primitive. Option: `"+n+"`.")}return i=za(t),n?Wa(i):Ga(i)}));var Xa="safe",qa=!1,Za="float64",Ha=!0,Ka="throw",Qa=0,tu="row-major",eu=!1;function ru(t,e,r){var n,i,o;if(n=ta(r),"generic"===r)for(i=[],o=0;o<e;o++)i.push(t[o]);else if("binary"===r)for(i=ea(e),o=0;o<e;o++)i[o]=t[o];else for(i=new n(e),o=0;o<e;o++)i[o]=t[o];return i}function nu(t,e){return"generic"===e?function(t){var e,r,n;for(e=t.length,r=[],n=0;n<e;n++)r.push(t.get(n));return r}(t):"binary"===e?function(t){var e,r,n;for(e=t.length,r=ea(e),n=0;n<e;n++)r[n]=t.get(n);return r}(t):function(t,e){var r,n,i;for(n=new(ta(e))(r=t.length),i=0;i<r;i++)n[i]=t.get(i);return n}(t,e)}function iu(t,e,r){var n,i;for(n=[],i=0;i<r-t;i++)n.push(1);for(i=0;i<t;i++)n.push(e[i]);return n}function ou(t,e,r,n){var i,o,a,u,f;if(f=t-(o=r.length),i=[],"row-major"===n){for(a=yt(r[0])*e[f],u=0;u<f;u++)i.push(a);for(u=0;u<o;u++)i.push(r[u])}else{for(u=0;u<f;u++)i.push(1);for(u=0;u<o;u++)i.push(r[u])}return i}function au(){var t,r,n,i,o,a,f,s,l,c,h,p,g;if(1===arguments.length)if(Ja(arguments[0]))n=arguments[0],t={};else{if(!X(t=arguments[0]))throw new TypeError($a("0Le5K",t));if(e(t,"buffer")&&!Ja(n=t.buffer))throw new TypeError($a("0Le5L","buffer",n))}else{if(!Ja(n=arguments[0]))throw new TypeError($a("0Le5M",n));if(!X(t=arguments[1]))throw new TypeError($a("0Le2h",t))}if(n&&(Ir(n)?(f=n.dtype,g=!0):(f=ua(n),g=!1)),c={},h={},e(t,"casting")){if(h.casting=t.casting,!gn(h.casting))throw new TypeError($a("0Le5N","casting",h.casting))}else h.casting=Xa;if(e(t,"flatten")){if(h.flatten=t.flatten,!E(h.flatten))throw new TypeError($a("0Le30","flatten",h.flatten))}else h.flatten=Ha;if(e(t,"ndmin")){if(h.ndmin=t.ndmin,!st(h.ndmin))throw new TypeError($a("0Le35","ndmin",h.ndmin))}else h.ndmin=Qa;if(e(t,"dtype")){if(!$r(a=t.dtype))throw new TypeError($a("0Le5O","dtype",a));if(f&&!Bn(f,a,h.casting))throw new Error($a("0Le5P",h.casting,f,a))}else a=f&&(g||"generic"!==f)?f:Za;if(e(t,"order")){if("any"===(o=t.order)||"same"===o)g?"any"===o?o=3===mt(n.strides)?tu:n.order:"same"===o&&(o=n.order):o=tu;else if(!zr(o))throw new TypeError($a("0Le5Q","order",o))}else o=tu;if(e(t,"mode")?c.mode=t.mode:c.mode=Ka,e(t,"submode")?c.submode=t.submode:c.submode=[c.mode],e(t,"readonly")?c.readonly=t.readonly:c.readonly=eu,e(t,"copy")){if(h.copy=t.copy,!E(h.copy))throw new TypeError($a("0Le30","copy",h.copy))}else h.copy=qa;if(e(t,"shape")){if(!Ja(s=t.shape))throw new TypeError($a("0Le5R","shape",s));l=s.length,p=Lr(s)}else{if(!n)throw new Error($a("0Le0X"));g?(s=n.shape,l=n.ndims,p=n.length):h.flatten&&u(n)?(l=(s=la(n)).length,p=Lr(s)):(l=1,s=[p=n.length])}if(l<h.ndmin&&(s=iu(l,s,h.ndmin),l=h.ndmin),g){if(n.length!==p)throw new RangeError($a("0Le0Y"));f!==a||h.copy?n=nu(n,a):(r=n.strides,i=n.offset,n=n.data,r.length<l&&(r=ou(l,s,r,o)))}else if(n){if("generic"===f&&h.flatten&&(n=Ma(n)),n.length!==p)throw new RangeError($a("0Le0Y"));(f!==a||h.copy)&&(n=ru(n,p,a))}else n=ra(a,p);return void 0===r&&(i=Br(s,r=Ur(s,o))),new sn(a,n,s,r,i,o,c)}export{au as default};
//# sourceMappingURL=mod.js.map