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