-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
3 lines (3 loc) · 75.4 KB
/
index.js
1
2
3
// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).ndarray2array=r()}(this,(function(){"use strict";var t="function"==typeof Object.defineProperty?Object.defineProperty:null;var r=Object.defineProperty;function e(t){return"number"==typeof t}function n(t){var r,e="";for(r=0;r<t;r++)e+="0";return e}function i(t,r,e){var i=!1,o=r-t.length;return o<0||(function(t){return"-"===t[0]}(t)&&(i=!0,t=t.substr(1)),t=e?t+n(o):n(o)+t,i&&(t="-"+t)),t}var o=String.prototype.toLowerCase,a=String.prototype.toUpperCase;function u(t){var r,n,u;switch(t.specifier){case"b":r=2;break;case"o":r=8;break;case"x":case"X":r=16;break;default:r=10}if(n=t.arg,u=parseInt(n,10),!isFinite(u)){if(!e(n))throw new Error("invalid integer. Value: "+n);u=0}return u<0&&("u"===t.specifier||10!==r)&&(u=4294967295+u+1),u<0?(n=(-u).toString(r),t.precision&&(n=i(n,t.precision,t.padRight)),n="-"+n):(n=u.toString(r),u||t.precision?t.precision&&(n=i(n,t.precision,t.padRight)):n="",t.sign&&(n=t.sign+n)),16===r&&(t.alternate&&(n="0x"+n),n=t.specifier===a.call(t.specifier)?a.call(n):o.call(n)),8===r&&t.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var f=Math.abs,s=String.prototype.toLowerCase,l=String.prototype.toUpperCase,h=String.prototype.replace,c=/e\+(\d)$/,p=/e-(\d)$/,y=/^(\d+)$/,m=/^(\d+)e/,g=/\.0$/,w=/\.0*e/,v=/(\..*[^0])0*e/;function d(t){var r,n,i=parseFloat(t.arg);if(!isFinite(i)){if(!e(t.arg))throw new Error("invalid floating-point number. Value: "+n);i=t.arg}switch(t.specifier){case"e":case"E":n=i.toExponential(t.precision);break;case"f":case"F":n=i.toFixed(t.precision);break;case"g":case"G":f(i)<1e-4?((r=t.precision)>0&&(r-=1),n=i.toExponential(r)):n=i.toPrecision(t.precision),t.alternate||(n=h.call(n,v,"$1e"),n=h.call(n,w,"e"),n=h.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),t.alternate&&(n=h.call(n,y,"$1."),n=h.call(n,m,"$1.e")),i>=0&&t.sign&&(n=t.sign+n),n=t.specifier===l.call(t.specifier)?l.call(n):s.call(n)}function b(t){var r,e="";for(r=0;r<t;r++)e+=" ";return e}var _=String.fromCharCode,E=Array.isArray;function T(t){return t!=t}function x(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 A(t){var r,e,n,o,a,f,s,l,h,c,p,y,m;if(!E(t))throw new TypeError("invalid argument. First argument must be an array. Value: `"+t+"`.");for(f="",s=1,l=0;l<t.length;l++)if(n=t[l],"string"==typeof n)f+=n;else{if(r=void 0!==n.precision,!(n=x(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+l+"`. Value: `"+n+"`.");for(n.mapping&&(s=n.mapping),e=n.flags,h=0;h<e.length;h++)switch(o=e.charAt(h)){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: "+o)}if("*"===n.width){if(n.width=parseInt(arguments[s],10),s+=1,T(n.width))throw new TypeError("the argument for * width at position "+s+" 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[s],10),s+=1,T(n.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,r=!1)}switch(n.arg=arguments[s],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":r&&(n.padZeros=!1),n.arg=u(n);break;case"s":n.maxWidth=r?n.precision:-1,n.arg=String(n.arg);break;case"c":if(!T(n.arg)){if((a=parseInt(n.arg,10))<0||a>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=T(a)?String(n.arg):_(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":r||(n.precision=6),n.arg=d(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=i(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(c=n.arg,p=n.width,y=n.padRight,m=void 0,(m=p-c.length)<0?c:c=y?c+b(m):b(m)+c)),f+=n.arg||"",s+=1}return f}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function j(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 O(t){var r,e,n,i;for(e=[],i=0,n=V.exec(t);n;)(r=t.slice(i,V.lastIndex-n[0].length)).length&&e.push(r),e.push(j(n)),i=V.lastIndex,n=V.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function S(t){var r,e;if("string"!=typeof t)throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));for(r=[O(t)],e=1;e<arguments.length;e++)r.push(arguments[e]);return A.apply(null,r)}var I,R=Object.prototype,L=R.toString,F=R.__defineGetter__,M=R.__defineSetter__,U=R.__lookupGetter__,B=R.__lookupSetter__;I=function(){try{return t({},"x",{}),!0}catch(t){return!1}}()?r:function(t,r,e){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===L.call(t))throw new TypeError(S("invalid argument. First argument must be an object. Value: `%s`.",t));if("object"!=typeof e||null===e||"[object Array]"===L.call(e))throw new TypeError(S("invalid argument. Property descriptor must be an object. Value: `%s`.",e));if((i="value"in e)&&(U.call(t,r)||B.call(t,r)?(n=t.__proto__,t.__proto__=R,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&&F&&F.call(t,r,e.get),a&&M&&M.call(t,r,e.set),t};var k=I;function N(t,r,e){k(t,r,{configurable:!1,enumerable:!1,writable:!1,value:e})}function C(t){return"boolean"==typeof t}var P="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function Y(){return P&&"symbol"==typeof Symbol.toStringTag}var W=Object.prototype.toString;var D=Object.prototype.hasOwnProperty;function G(t,r){return null!=t&&D.call(t,r)}var J="function"==typeof Symbol?Symbol:void 0,$="function"==typeof J?J.toStringTag:"";var z=Y()?function(t){var r,e,n;if(null==t)return W.call(t);e=t[$],r=G(t,$);try{t[$]=void 0}catch(r){return W.call(t)}return n=W.call(t),r?t[$]=e:delete t[$],n}:function(t){return W.call(t)},X=Boolean,Z=Boolean.prototype.toString;var H=Y();function q(t){return"object"==typeof t&&(t instanceof X||(H?function(t){try{return Z.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===z(t)))}function K(t){return C(t)||q(t)}N(K,"isPrimitive",C),N(K,"isObject",q);var Q="object"==typeof self?self:null,tt="object"==typeof window?window:null,rt="object"==typeof global?global:null,et="object"==typeof globalThis?globalThis:null;function nt(t){if(arguments.length){if(!C(t))throw new TypeError(S("invalid argument. Must provide a boolean. Value: `%s`.",t));if(t)return new Function("return this;")()}if(et)return et;if(Q)return Q;if(tt)return tt;if(rt)return rt;throw new Error("unexpected error. Unable to resolve global object.")}var it=nt();function ot(t,r,e){k(t,r,{configurable:!1,enumerable:!1,get:e})}var at={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 ut(t){return Math.abs(t)}function ft(t){var r,e,n,i,o,a;if(0===(e=t.length))return 0;for(r=!0,n=!0,i=ut(t[0]),a=1;a<e;a++){if(o=ut(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 st(t,r){return r&&(2===t||3===t)}function lt(t,r){return r&&(1===t||3===t)}function ht(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 ct(t){return t.re}function pt(t){return t.im}function yt(t){return"string"==typeof t}N(ht,"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 mt=String.prototype.valueOf;var gt=Y();function wt(t){return"object"==typeof t&&(t instanceof String||(gt?function(t){try{return mt.call(t),!0}catch(t){return!1}}(t):"[object String]"===z(t)))}function vt(t){return yt(t)||wt(t)}N(vt,"isPrimitive",yt),N(vt,"isObject",wt);var dt=/[-\/\\^$*+?.()|[\]{}]/g;var bt=/./,_t=nt(),Et=_t.document&&_t.document.childNodes,Tt=Int8Array;function xt(){return/^\s*function\s*([^(]*)/i}var At=/^\s*function\s*([^(]*)/i;N(xt,"REGEXP",At);var Vt=Array.isArray?Array.isArray:function(t){return"[object Array]"===z(t)};function jt(t){return null!==t&&"object"==typeof t}var Ot=function(t){if("function"!=typeof t)throw new TypeError(S("invalid argument. Must provide a function. Value: `%s`.",t));return function(r){var e,n;if(!Vt(r))return!1;if(e=r.length,0===e)return!1;for(n=0;n<e;n++)if(!1===t(r[n]))return!1;return!0}}(jt);function St(t){return jt(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function It(t){var r,e,n;if(("Object"===(e=z(t).slice(8,-1))||"Error"===e)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(r=At.exec(n.toString()))return r[1]}return St(t)?"Buffer":e}N(jt,"isObjectLikeArray",Ot);var Rt="function"==typeof bt||"object"==typeof Tt||"function"==typeof Et?function(t){return It(t).toLowerCase()}:function(t){var r;return null===t?"null":"object"===(r=typeof t)?It(t).toLowerCase():r};function Lt(t){return"function"===Rt(t)}var Ft=RegExp.prototype.exec;var Mt=Y();function Ut(t){return"object"==typeof t&&(t instanceof RegExp||(Mt?function(t){try{return Ft.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===z(t)))}function Bt(t,r,e){return t.replace(r,e)}function kt(t,r,e){if(!yt(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));if(yt(r))r=new RegExp(function(t){var r,e;if(!yt(t))throw new TypeError(S("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(dt,"\\$&"):(r=(r=t.substring(1,e)).replace(dt,"\\$&"),t=t[0]+r+t.substring(e))}(r),"g");else if(!Ut(r))throw new TypeError(S("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!yt(e)&&!Lt(e))throw new TypeError(S("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return Bt(t,r,e)}var Nt={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 Ct="function"==typeof Uint8Array;var Pt="function"==typeof Uint8Array?Uint8Array:null;var Yt,Wt="function"==typeof Uint8Array?Uint8Array:void 0;Yt=function(){var t,r,e;if("function"!=typeof Pt)return!1;try{r=new Pt(r=[1,3.14,-3.14,256,257]),e=r,t=(Ct&&e instanceof Uint8Array||"[object Uint8Array]"===z(e))&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?Wt:function(){throw new Error("not implemented")};var Dt=Yt,Gt="function"==typeof Uint16Array;var Jt="function"==typeof Uint16Array?Uint16Array:null;var $t,zt="function"==typeof Uint16Array?Uint16Array:void 0;$t=function(){var t,r,e;if("function"!=typeof Jt)return!1;try{r=new Jt(r=[1,3.14,-3.14,65536,65537]),e=r,t=(Gt&&e instanceof Uint16Array||"[object Uint16Array]"===z(e))&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?zt:function(){throw new Error("not implemented")};var Xt,Zt=$t,Ht={uint16:Zt,uint8:Dt};(Xt=new Ht.uint16(1))[0]=4660;var qt=52===new Ht.uint8(Xt.buffer)[0],Kt="function"==typeof ArrayBuffer;function Qt(t){return Kt&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===z(t)}var tr="function"==typeof Float64Array;var rr="function"==typeof Float64Array?Float64Array:null;var er,nr="function"==typeof Float64Array?Float64Array:void 0;er=function(){var t,r,e;if("function"!=typeof rr)return!1;try{r=new rr([1,3.14,-3.14,NaN]),e=r,t=(tr&&e instanceof Float64Array||"[object Float64Array]"===z(e))&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t}()?nr:function(){throw new Error("not implemented")};var ir=er,or="function"==typeof ArrayBuffer?ArrayBuffer:null;var ar,ur="function"==typeof ArrayBuffer?ArrayBuffer:void 0;ar=function(){var t,r,e;if("function"!=typeof or)return!1;try{(t=Qt(e=new or(16))&&"function"==typeof or.isView)&&((r=new ir(e))[0]=-3.14,r[1]=NaN,t=t&&or.isView(r)&&16===e.byteLength&&-3.14===r[0]&&r[1]!=r[1])}catch(r){t=!1}return t}()?ur:function(){throw new Error("not implemented")};var fr=ar,sr="function"==typeof DataView;var lr="function"==typeof DataView?DataView:null;var hr,cr="function"==typeof DataView?DataView:void 0;hr=function(){var t,r,e,n;if("function"!=typeof lr)return!1;try{e=new fr(24),r=new lr(e,8),n=r,(t=(sr&&n instanceof DataView||"[object DataView]"===z(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}()?cr:function(){throw new Error("not implemented")};var pr=hr,yr="function"==typeof BigInt?BigInt:void 0,mr={all:["binary","bool","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"],typed:["binary","bool","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"],boolean:["bool"],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"]},gr=/_and_generic$/;function wr(){var t,r,e;return 0===arguments.length?mr.all.slice():(e=!1,t=arguments[0],gr.test(t)&&"all"!==(t=Bt(t,gr,""))&&(e=!0),r=(r=mr[t])?r.slice():[],e&&r.length>0&&r.push("generic"),r)}function vr(){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 dr(t,r,e){k(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}function br(t){return Object.keys(Object(t))}var _r,Er=void 0!==Object.keys;function Tr(t){return"[object Arguments]"===z(t)}_r=function(){return Tr(arguments)}();var xr=_r;function Ar(t){return"number"==typeof t}var Vr=Number,jr=Vr.prototype.toString;var Or=Y();function Sr(t){return"object"==typeof t&&(t instanceof Vr||(Or?function(t){try{return jr.call(t),!0}catch(t){return!1}}(t):"[object Number]"===z(t)))}function Ir(t){return Ar(t)||Sr(t)}function Rr(t){return t!=t}function Lr(t){return Ar(t)&&Rr(t)}function Fr(t){return Sr(t)&&Rr(t.valueOf())}function Mr(t){return Lr(t)||Fr(t)}N(Ir,"isPrimitive",Ar),N(Ir,"isObject",Sr),N(Mr,"isPrimitive",Lr),N(Mr,"isObject",Fr);var Ur=Number.POSITIVE_INFINITY,Br=Vr.NEGATIVE_INFINITY,kr=Math.floor;function Nr(t){return kr(t)===t}function Cr(t){return t<Ur&&t>Br&&Nr(t)}function Pr(t){return Ar(t)&&Cr(t)}function Yr(t){return Sr(t)&&Cr(t.valueOf())}function Wr(t){return Pr(t)||Yr(t)}N(Wr,"isPrimitive",Pr),N(Wr,"isObject",Yr);var Dr=Object.prototype.propertyIsEnumerable;var Gr=!Dr.call("beep","0");function Jr(t,r){var e;return null!=t&&(!(e=Dr.call(t,r))&&Gr&&vt(t)?!Lr(r=+r)&&Pr(r)&&r>=0&&r<t.length:e)}var $r=4294967295;var zr=xr?Tr:function(t){return null!==t&&"object"==typeof t&&!Vt(t)&&"number"==typeof t.length&&Nr(t.length)&&t.length>=0&&t.length<=$r&&G(t,"callee")&&!Jr(t,"callee")},Xr=Array.prototype.slice;var Zr=Jr((function(){}),"prototype"),Hr=!Jr({toString:null},"toString"),qr=9007199254740991;function Kr(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Nr(t.length)&&t.length>=0&&t.length<=qr}function Qr(t,r,e){var n,i;if(!Kr(t)&&!yt(t))throw new TypeError(S("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(!Pr(e))throw new TypeError(S("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(Mr(r)){for(;i<n;i++)if(Mr(t[i]))return i}else for(;i<n;i++)if(t[i]===r)return i;return-1}function te(t){return t.constructor&&t.constructor.prototype===t}var re=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],ee="undefined"==typeof window?void 0:window;var ne=function(){var t;if("undefined"===Rt(ee))return!1;for(t in ee)try{-1===Qr(re,t)&&G(ee,t)&&null!==ee[t]&&"object"===Rt(ee[t])&&te(ee[t])}catch(t){return!0}return!1}(),ie="undefined"!=typeof window;var oe,ae=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];oe=Er?function(){return 2!==(br(arguments)||"").length}(1,2)?function(t){return zr(t)?br(Xr.call(t)):br(t)}:br:function(t){var r,e,n,i,o,a,u;if(i=[],zr(t)){for(u=0;u<t.length;u++)i.push(u.toString());return i}if("string"==typeof t){if(t.length>0&&!G(t,"0"))for(u=0;u<t.length;u++)i.push(u.toString())}else{if(!1==(n="function"==typeof t)&&!jt(t))return i;e=Zr&&n}for(o in t)e&&"prototype"===o||!G(t,o)||i.push(String(o));if(Hr)for(r=function(t){if(!1===ie&&!ne)return te(t);try{return te(t)}catch(t){return!1}}(t),u=0;u<ae.length;u++)a=ae[u],r&&"constructor"===a||!G(t,a)||i.push(String(a));return i};var ue=oe;N(wr,"enum",vr),function(t,r){var e,n,i;for(e=ue(r),i=0;i<e.length;i++)dr(t,n=e[i],r[n])}(wr,{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 fe=["row-major","column-major"];function se(){return fe.slice()}var le=["row-major","column-major"];function he(){return{"row-major":101,"column-major":102}}N((function(){return le.slice()}),"enum",he);var ce={"row-major":101,"column-major":102};function pe(){return{"row-major":ce["row-major"],"column-major":ce["column-major"]}}N(se,"enum",pe);var ye=["throw","normalize","clamp","wrap"];function me(){return{throw:1,clamp:2,wrap:3,normalize:4}}N((function(){return ye.slice()}),"enum",me);var ge={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},we=pe(),ve={throw:1,clamp:2,wrap:3,normalize:4};var de=4294967295,be=4294967296,_e=new Dt(8),Ee=new pr(_e.buffer);function Te(t,r,e,n){var i,o,a;if(0===t){for(a=0;a<_e.length;a++)r[n]=0,n+=e;return r}for(o=(t&de)>>>0,i=kr(t/be),qt?(Ee.setUint32(0,o,qt),Ee.setUint32(4,i,qt)):(Ee.setUint32(0,i,qt),Ee.setUint32(4,o,qt)),a=0;a<_e.length;a++)r[n]=_e[a],n+=e;return r}N((function(t){var r,e,n,i;return r=new Dt(8),0===t||(i=(4294967295&t)>>>0,n=kr(t/4294967296),e=new pr(r.buffer),qt?(e.setUint32(0,i,qt),e.setUint32(4,n,qt)):(e.setUint32(0,n,qt),e.setUint32(4,i,qt))),r}),"assign",Te);var xe={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},Ae=pe(),Ve={throw:1,clamp:2,wrap:3,normalize:4};function je(t,r,e,n,i,o){var a,u,f,s,l;if(!(this instanceof je))return new je(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 at[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=X(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=ht(r,e,n))[1]-o[0]+1}(s,e,n,i,this._iterationOrder),f=ft(n),this._flags={ROW_MAJOR_CONTIGUOUS:lt(f,a),COLUMN_MAJOR_CONTIGUOUS:st(f,a),READONLY:!1},this.__meta_dataview__=null,this}N(je,"name","ndarray"),ot(je.prototype,"byteLength",(function(){return this._byteLength})),ot(je.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),ot(je.prototype,"data",(function(){return this._buffer})),ot(je.prototype,"dtype",(function(){return this._dtype})),ot(je.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})),ot(je.prototype,"length",(function(){return this._length})),ot(je.prototype,"ndims",(function(){return this._ndims})),ot(je.prototype,"offset",(function(){return this._offset})),ot(je.prototype,"order",(function(){return this._order})),ot(je.prototype,"shape",(function(){return this._shape.slice()})),ot(je.prototype,"strides",(function(){return this._strides.slice()})),N(je.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]})),N(je.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]})),N(je.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})),N(je.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})),N(je.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+=ct(i=this.iget(o))+", "+pt(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+=ct(i=this.iget(o))+", "+pt(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+=ct(i=this.iget(this._length-1-o))+", "+pt(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(e+=kt(Nt[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+=" )"})),N(je.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(ct(e),pt(e));else for(n=0;n<r;n++)t.data.push(this.iget(n));return t})),N(je.prototype,"__array_meta_dataview__","function"==typeof it.BigInt&&"function"==typeof BigInt&&"bigint"==typeof it.BigInt("1")&&"bigint"==typeof BigInt("1")?function(){var t,r,e,n,i,o,a,u,f,s,l,h,c,p;if(f=this._mode||"throw",a=this._submode||[f],e=33+16*(h=this._ndims)+(c=a.length),(u=this.__meta_dataview__)&&u.byteLength===e)return u;for(u=new pr(new fr(e)),i=this._shape,o=this._strides,n=this._dtype,t=this._bytesPerElement,s=0,u.setInt8(s,qt?1:0),s+=1,u.setInt16(s,ge[n],qt),s+=2,u.setBigInt64(s,yr(h),qt),l=8*h,s+=8,p=0;p<h;p++)u.setBigInt64(s,yr(i[p]),qt),u.setBigInt64(s+l,yr(o[p]*t),qt),s+=8;for(s+=l,u.setBigInt64(s,yr(this._offset*t),qt),s+=8,u.setInt8(s,we[this._order]),s+=1,u.setInt8(s,ve[f]),s+=1,u.setBigInt64(s,yr(c),qt),s+=8,p=0;p<c;p++)u.setInt8(s,ve[a[p]]),s+=1;return r=0,r|=this._flags.READONLY?4:0,u.setInt32(s,r,qt),this.__meta_dataview__=u,u}:function(){var t,r,e,n,i,o,a,u,f,s,l,h,c,p,y;if(s=this._mode||"throw",u=this._submode||[s],n=33+16*(c=this._ndims)+(p=u.length),(f=this.__meta_dataview__)&&f.byteLength===n)return f;for(f=new pr(new fr(n)),r=new Dt(f.buffer),o=this._shape,a=this._strides,i=this._dtype,t=this._bytesPerElement,l=0,f.setInt8(l,qt?1:0),l+=1,f.setInt16(l,xe[i],qt),Te(c,r,1,l+=2),h=8*c,l+=8,y=0;y<c;y++)Te(o[y],r,1,l),Te(a[y]*t,r,1,l+h),l+=8;for(l+=h,Te(this._offset*t,r,1,l),l+=8,f.setInt8(l,Ae[this._order]),l+=1,f.setInt8(l,Ve[s]),Te(p,r,1,l+=1),l+=8,y=0;y<p;y++)f.setInt8(l,Ve[u[y]]),l+=1;return e=0,e|=this._flags.READONLY?4:0,f.setInt32(l,e,qt),this.__meta_dataview__=f,f});var Oe="function";var Se={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 Ie(t){var r=Se[t];return"function"==typeof r?r:Se.default}var Re={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 Le(t){var r=Re[t];return"function"==typeof r?r:Re.default}var Fe={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 Me(t){var r=Fe[t];return"function"==typeof r?r:Fe.default}var Ue={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 Be(t){var r=Ue[t];return"function"==typeof r?r:Ue.default}var ke={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},Ne="function"==typeof Float32Array;var Ce="function"==typeof Float32Array?Float32Array:null;var Pe,Ye="function"==typeof Float32Array?Float32Array:void 0;Pe=function(){var t,r,e;if("function"!=typeof Ce)return!1;try{r=new Ce([1,3.14,-3.14,5e40]),e=r,t=(Ne&&e instanceof Float32Array||"[object Float32Array]"===z(e))&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===Ur}catch(r){t=!1}return t}()?Ye:function(){throw new Error("not implemented")};var We=Pe,De="function"==typeof Uint32Array;var Ge="function"==typeof Uint32Array?Uint32Array:null;var Je,$e="function"==typeof Uint32Array?Uint32Array:void 0;Je=function(){var t,r,e;if("function"!=typeof Ge)return!1;try{r=new Ge(r=[1,3.14,-3.14,4294967296,4294967297]),e=r,t=(De&&e instanceof Uint32Array||"[object Uint32Array]"===z(e))&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?$e:function(){throw new Error("not implemented")};var ze=Je,Xe="function"==typeof Int32Array;var Ze="function"==typeof Int32Array?Int32Array:null;var He,qe="function"==typeof Int32Array?Int32Array:void 0;He=function(){var t,r,e;if("function"!=typeof Ze)return!1;try{r=new Ze([1,3.14,-3.14,2147483648]),e=r,t=(Xe&&e instanceof Int32Array||"[object Int32Array]"===z(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t}()?qe:function(){throw new Error("not implemented")};var Ke=He,Qe="function"==typeof Int16Array;var tn="function"==typeof Int16Array?Int16Array:null;var rn,en="function"==typeof Int16Array?Int16Array:void 0;rn=function(){var t,r,e;if("function"!=typeof tn)return!1;try{r=new tn([1,3.14,-3.14,32768]),e=r,t=(Qe&&e instanceof Int16Array||"[object Int16Array]"===z(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t}()?en:function(){throw new Error("not implemented")};var nn=rn,on="function"==typeof Uint8ClampedArray;var an="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var un,fn="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;un=function(){var t,r,e;if("function"!=typeof an)return!1;try{r=new an([-1,0,1,3.14,4.99,255,256]),e=r,t=(on&&e instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===z(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}()?fn:function(){throw new Error("not implemented")};var sn=un,ln="function"==typeof Int8Array;var hn="function"==typeof Int8Array?Int8Array:null;var cn,pn="function"==typeof Int8Array?Int8Array:void 0;cn=function(){var t,r,e;if("function"!=typeof hn)return!1;try{r=new hn([1,3.14,-3.14,128]),e=r,t=(ln&&e instanceof Int8Array||"[object Int8Array]"===z(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t}()?pn:function(){throw new Error("not implemented")};var yn=cn;function mn(t){return Pr(t)&&t>=0}function gn(t){return Yr(t)&&t.valueOf()>=0}function wn(t){return mn(t)||gn(t)}N(wn,"isPrimitive",mn),N(wn,"isObject",gn);var vn=4294967295;function dn(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Nr(t.length)&&t.length>=0&&t.length<=vn}function bn(t){return"object"==typeof t&&null!==t&&!Vt(t)}function _n(t,r){if(!(this instanceof _n))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}N(_n,"BYTES_PER_ELEMENT",8),N(_n.prototype,"BYTES_PER_ELEMENT",8),N(_n.prototype,"byteLength",16),N(_n.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(_n.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var En="function"==typeof Math.fround?Math.fround:null,Tn=new We(1);var xn="function"==typeof En?En:function(t){return Tn[0]=t,Tn[0]};function An(t,r){if(!(this instanceof An))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:xn(t)}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:xn(r)}),this}function Vn(t){return t instanceof _n||t instanceof An||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function jn(t){return Nr(t/2)}N(An,"BYTES_PER_ELEMENT",4),N(An.prototype,"BYTES_PER_ELEMENT",4),N(An.prototype,"byteLength",8),N(An.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(An.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var On=8;function Sn(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===On}var In=16;function Rn(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===In}function Ln(){return"function"==typeof J&&"symbol"==typeof J("foo")&&G(J,"iterator")&&"symbol"==typeof J.iterator}var Fn=Ln()?Symbol.iterator:null;function Mn(t,r){if(!(this instanceof Mn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:xn(t)}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:xn(r)}),this}function Un(t){return t.re}function Bn(t){return t.im}function kn(t,r){return new We(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function Nn(t,r){return new ir(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function Cn(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(dn(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Vn(n))return new TypeError(S("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(Un(n),Bn(n))}return r}N(Mn,"BYTES_PER_ELEMENT",4),N(Mn.prototype,"BYTES_PER_ELEMENT",4),N(Mn.prototype,"byteLength",8),N(Mn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(Mn.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Pn=2*We.BYTES_PER_ELEMENT,Yn=Ln();function Wn(t){return t instanceof Jn||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Dn(t){return t===Jn||"Complex128Array"===t.name}function Gn(t,r){return new Mn(t[r*=2],t[r+1])}function Jn(){var t,r,e,n;if(r=arguments.length,!(this instanceof Jn))return 0===r?new Jn:1===r?new Jn(arguments[0]):2===r?new Jn(arguments[0],arguments[1]):new Jn(arguments[0],arguments[1],arguments[2]);if(0===r)e=new We(0);else if(1===r)if(mn(arguments[0]))e=new We(2*arguments[0]);else if(Kr(arguments[0]))if((n=(e=arguments[0]).length)&&Vt(e)&&Vn(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;i<e;i++){if(!Vn(n=r[i]))return null;t[o]=Un(n),t[o+1]=Bn(n),o+=2}return t}(new We(2*n),e),null===e){if(!jn(n))throw new RangeError(S("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new We(arguments[0])}}else{if(Sn(e))e=kn(e,0);else if(Rn(e))e=Nn(e,0);else if(!jn(n))throw new RangeError(S("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new We(e)}else if(Qt(arguments[0])){if(!Nr((e=arguments[0]).byteLength/Pn))throw new RangeError(S("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",Pn,e.byteLength));e=new We(e)}else{if(!bn(arguments[0]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(e=arguments[0],!1===Yn)throw new TypeError(S("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",e));if(!Lt(e[Fn]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if(!Lt((e=e[Fn]()).next))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if((e=Cn(e))instanceof Error)throw e;e=new We(e)}else{if(!Qt(e=arguments[0]))throw new TypeError(S("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(!mn(t=arguments[1]))throw new TypeError(S("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Nr(t/Pn))throw new RangeError(S("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",Pn,t));if(2===r){if(!Nr((n=e.byteLength-t)/Pn))throw new RangeError(S("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",Pn,n));e=new We(e,t)}else{if(!mn(n=arguments[2]))throw new TypeError(S("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*Pn>e.byteLength-t)throw new RangeError(S("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Pn));e=new We(e,t,2*n)}}return N(this,"_buffer",e),N(this,"_length",e.length/2),this}function $n(t,r){if(!(this instanceof $n))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}function zn(t){return t.re}function Xn(t){return t.im}function Zn(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(dn(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Vn(n))return new TypeError(S("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(zn(n),Xn(n))}return r}N(Jn,"BYTES_PER_ELEMENT",Pn),N(Jn,"name","Complex64Array"),N(Jn,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Lt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Lt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Wn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h<f;h++){if(Vn(l=n.call(r,t.get(h),h)))o[c]=Un(l),o[c+1]=Bn(l);else{if(!(dn(l)&&l.length>=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(Kr(t)){if(n){for(f=t.length,u=t.get&&t.set?Me("default"):Ie("default"),h=0;h<f;h++)if(!Vn(u(t,h))){s=!0;break}if(s){if(!jn(f))throw new RangeError(S("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,c=0,h=0;h<f;h++){if(Vn(l=n.call(r,u(t,h),h)))o[c]=Un(l),o[c+1]=Bn(l);else{if(!(dn(l)&&l.length>=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(bn(t)&&Yn&&Lt(t[Fn])){if(!Lt((o=t[Fn]()).next))throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(a=n?function(t,r,e){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,dn(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Vn(o))return new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Un(o),Bn(o))}return n}(o,n,r):Cn(o),a 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(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),N(Jn,"of",(function(){var t,r;if(!Lt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Dn(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)})),N(Jn.prototype,"at",(function(t){if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Nr(t))throw new TypeError(S("invalid argument. Must provide an integer. Value: `%s`.",t));if(t<0&&(t+=this._length),!(t<0||t>=this._length))return Gn(this._buffer,t)})),ot(Jn.prototype,"buffer",(function(){return this._buffer.buffer})),ot(Jn.prototype,"byteLength",(function(){return this._buffer.byteLength})),ot(Jn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(Jn.prototype,"BYTES_PER_ELEMENT",Jn.BYTES_PER_ELEMENT),N(Jn.prototype,"copyWithin",(function(t,r){if(!Wn(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})),N(Jn.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Wn(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,N(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Mn(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),N(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Fn&&N(e,Fn,(function(){return r.entries()})),e})),N(Jn.prototype,"every",(function(t,r){var e,n;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("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,Gn(e,n),n,this))return!1;return!0})),N(Jn.prototype,"fill",(function(t,r,e){var n,i,o,a,u,f;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Nr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Nr(e))throw new TypeError(S("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=Un(t),u=Bn(t),f=r;f<e;f++)n[o=2*f]=a,n[o+1]=u;return this})),N(Jn.prototype,"filter",(function(t,r){var e,n,i,o;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=[],i=0;i<this._length;i++)o=Gn(e,i),t.call(r,o,i,this)&&n.push(o);return new this.constructor(n)})),N(Jn.prototype,"find",(function(t,r){var e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=Gn(e,n),t.call(r,i,n,this))return i})),N(Jn.prototype,"findIndex",(function(t,r){var e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=Gn(e,n),t.call(r,i,n,this))return n;return-1})),N(Jn.prototype,"findLast",(function(t,r){var e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=Gn(e,n),t.call(r,i,n,this))return i})),N(Jn.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=Gn(e,n),t.call(r,i,n,this))return n;return-1})),N(Jn.prototype,"forEach",(function(t,r){var e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)i=Gn(e,n),t.call(r,i,n,this)})),N(Jn.prototype,"get",(function(t){if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!mn(t))throw new TypeError(S("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return Gn(this._buffer,t)})),N(Jn.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Nr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Un(t),o=Bn(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return!0;return!1})),N(Jn.prototype,"indexOf",(function(t,r){var e,n,i,o,a;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Nr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Un(t),o=Bn(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),N(Jn.prototype,"join",(function(t){var r,e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!yt(t))throw new TypeError(S("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(Gn(e,i).toString());return r.join(n)})),N(Jn.prototype,"lastIndexOf",(function(t,r){var e,n,i,o,a;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Nr(r))throw new TypeError(S("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=Un(t),o=Bn(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),ot(Jn.prototype,"length",(function(){return this._length})),N(Jn.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("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(Vn(a=t.call(r,Gn(n,o),o,this)))e[2*o]=Un(a),e[2*o+1]=Bn(a);else{if(!dn(a)||2!==a.length)throw new TypeError(S("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})),N(Jn.prototype,"reduce",(function(t,r){var e,n,i,o;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(e=this._buffer,i=this._length,arguments.length>1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=Gn(e,0),o=1}for(;o<i;o++)n=t(n,Gn(e,o),o,this);return n})),N(Jn.prototype,"reverse",(function(){var t,r,e,n,i,o;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,t=this._buffer,n=kr(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})),N(Jn.prototype,"set",(function(t){var r,e,n,i,o,a,u,f,s;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!mn(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(Vn(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=Un(t),void(n[e+1]=Bn(t))}if(Wn(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*Pn,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new We(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(!Kr(t))throw new TypeError(S("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(!Vn(t[f])){o=!0;break}if(o){if(!jn(a))throw new RangeError(S("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*Pn,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new We(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]=Un(u),n[e+1]=Bn(u),e+=2}})),N(Jn.prototype,"slice",(function(t,r){var e,n,i,o,a,u,f;if(!Wn(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(!Nr(t))throw new TypeError(S("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(!Nr(r))throw new TypeError(S("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})),N(Jn.prototype,"some",(function(t,r){var e,n;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("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,Gn(e,n),n,this))return!0;return!1})),N(Jn.prototype,"subarray",(function(t,r){var e,n,i;if(!Wn(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(!Nr(t))throw new TypeError(S("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(!Nr(r))throw new TypeError(S("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*Pn):(i=r-t,e=n.byteOffset+t*Pn),new this.constructor(n.buffer,e,i<0?0:i)})),N(Jn.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Wn(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})),N(Jn.prototype,"toString",(function(){var t,r,e;if(!Wn(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(Gn(r,e).toString());return t.join(",")})),N(Jn.prototype,"with",(function(t,r){var e,n,i;if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Nr(t))throw new TypeError(S("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(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!Vn(r))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=Un(r),e[2*t+1]=Bn(r),n})),N($n,"BYTES_PER_ELEMENT",8),N($n.prototype,"BYTES_PER_ELEMENT",8),N($n.prototype,"byteLength",16),N($n.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N($n.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Hn=2*ir.BYTES_PER_ELEMENT,qn=Ln();function Kn(t){return t instanceof ri||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Qn(t){return t===ri||"Complex64Array"===t.name}function ti(t,r){return new $n(t[r*=2],t[r+1])}function ri(){var t,r,e,n;if(r=arguments.length,!(this instanceof ri))return 0===r?new ri:1===r?new ri(arguments[0]):2===r?new ri(arguments[0],arguments[1]):new ri(arguments[0],arguments[1],arguments[2]);if(0===r)e=new ir(0);else if(1===r)if(mn(arguments[0]))e=new ir(2*arguments[0]);else if(Kr(arguments[0]))if((n=(e=arguments[0]).length)&&Vt(e)&&Vn(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;i<e;i++){if(!Vn(n=r[i]))return null;t[o]=zn(n),t[o+1]=Xn(n),o+=2}return t}(new ir(2*n),e),null===e){if(!jn(n))throw new RangeError(S("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new ir(arguments[0])}}else{if(Sn(e))e=kn(e,0);else if(Rn(e))e=Nn(e,0);else if(!jn(n))throw new RangeError(S("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new ir(e)}else if(Qt(arguments[0])){if(!Nr((e=arguments[0]).byteLength/Hn))throw new RangeError(S("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",Hn,e.byteLength));e=new ir(e)}else{if(!bn(arguments[0]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(e=arguments[0],!1===qn)throw new TypeError(S("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",e));if(!Lt(e[Fn]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if(!Lt((e=e[Fn]()).next))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if((e=Zn(e))instanceof Error)throw e;e=new ir(e)}else{if(!Qt(e=arguments[0]))throw new TypeError(S("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(!mn(t=arguments[1]))throw new TypeError(S("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Nr(t/Hn))throw new RangeError(S("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",Hn,t));if(2===r){if(!Nr((n=e.byteLength-t)/Hn))throw new RangeError(S("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",Hn,n));e=new ir(e,t)}else{if(!mn(n=arguments[2]))throw new TypeError(S("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*Hn>e.byteLength-t)throw new RangeError(S("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Hn));e=new ir(e,t,2*n)}}return N(this,"_buffer",e),N(this,"_length",e.length/2),this}N(ri,"BYTES_PER_ELEMENT",Hn),N(ri,"name","Complex128Array"),N(ri,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Lt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Lt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Kn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h<f;h++){if(Vn(l=n.call(r,t.get(h),h)))o[c]=zn(l),o[c+1]=Xn(l);else{if(!(dn(l)&&l.length>=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(Kr(t)){if(n){for(f=t.length,u=t.get&&t.set?Me("default"):Ie("default"),h=0;h<f;h++)if(!Vn(u(t,h))){s=!0;break}if(s){if(!jn(f))throw new RangeError(S("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,c=0,h=0;h<f;h++){if(Vn(l=n.call(r,u(t,h),h)))o[c]=zn(l),o[c+1]=Xn(l);else{if(!(dn(l)&&l.length>=2))throw new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(bn(t)&&qn&&Lt(t[Fn])){if(!Lt((o=t[Fn]()).next))throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(a=n?function(t,r,e){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,dn(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Vn(o))return new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(zn(o),Xn(o))}return n}(o,n,r):Zn(o),a 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(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),N(ri,"of",(function(){var t,r;if(!Lt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Qn(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)})),N(ri.prototype,"at",(function(t){if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Nr(t))throw new TypeError(S("invalid argument. Must provide an integer. Value: `%s`.",t));if(t<0&&(t+=this._length),!(t<0||t>=this._length))return ti(this._buffer,t)})),ot(ri.prototype,"buffer",(function(){return this._buffer.buffer})),ot(ri.prototype,"byteLength",(function(){return this._buffer.byteLength})),ot(ri.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(ri.prototype,"BYTES_PER_ELEMENT",ri.BYTES_PER_ELEMENT),N(ri.prototype,"copyWithin",(function(t,r){if(!Kn(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})),N(ri.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Kn(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,N(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new $n(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),N(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Fn&&N(e,Fn,(function(){return r.entries()})),e})),N(ri.prototype,"every",(function(t,r){var e,n;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("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,ti(e,n),n,this))return!1;return!0})),N(ri.prototype,"fill",(function(t,r,e){var n,i,o,a,u,f;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Nr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Nr(e))throw new TypeError(S("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=zn(t),u=Xn(t),f=r;f<e;f++)n[o=2*f]=a,n[o+1]=u;return this})),N(ri.prototype,"filter",(function(t,r){var e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=[],i=0;i<this._length;i++)o=ti(e,i),t.call(r,o,i,this)&&n.push(o);return new this.constructor(n)})),N(ri.prototype,"find",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=ti(e,n),t.call(r,i,n,this))return i})),N(ri.prototype,"findIndex",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=ti(e,n),t.call(r,i,n,this))return n;return-1})),N(ri.prototype,"findLast",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=ti(e,n),t.call(r,i,n,this))return i})),N(ri.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=ti(e,n),t.call(r,i,n,this))return n;return-1})),N(ri.prototype,"forEach",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)i=ti(e,n),t.call(r,i,n,this)})),N(ri.prototype,"get",(function(t){if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!mn(t))throw new TypeError(S("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return ti(this._buffer,t)})),ot(ri.prototype,"length",(function(){return this._length})),N(ri.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Nr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=zn(t),o=Xn(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return!0;return!1})),N(ri.prototype,"indexOf",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Nr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=zn(t),o=Xn(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),N(ri.prototype,"join",(function(t){var r,e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!vt(t))throw new TypeError(S("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(ti(e,i).toString());return r.join(n)})),N(ri.prototype,"lastIndexOf",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Vn(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Nr(r))throw new TypeError(S("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=zn(t),o=Xn(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),N(ri.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("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(Vn(a=t.call(r,ti(n,o),o,this)))e[2*o]=zn(a),e[2*o+1]=Xn(a);else{if(!dn(a)||2!==a.length)throw new TypeError(S("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})),N(ri.prototype,"reduce",(function(t,r){var e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(e=this._buffer,i=this._length,arguments.length>1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=ti(e,0),o=1}for(;o<i;o++)n=t(n,ti(e,o),o,this);return n})),N(ri.prototype,"reverse",(function(){var t,r,e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,t=this._buffer,n=kr(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})),N(ri.prototype,"set",(function(t){var r,e,n,i,o,a,u,f,s;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!mn(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(Vn(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=zn(t),void(n[e+1]=Xn(t))}if(Kn(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*Hn,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new ir(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(!Kr(t))throw new TypeError(S("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(!Vn(t[f])){o=!0;break}if(o){if(!jn(a))throw new RangeError(S("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*Hn,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new ir(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]=zn(u),n[e+1]=Xn(u),e+=2}})),N(ri.prototype,"slice",(function(t,r){var e,n,i,o,a,u,f;if(!Kn(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(!Nr(t))throw new TypeError(S("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(!Nr(r))throw new TypeError(S("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})),N(ri.prototype,"some",(function(t,r){var e,n;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Lt(t))throw new TypeError(S("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,ti(e,n),n,this))return!0;return!1})),N(ri.prototype,"subarray",(function(t,r){var e,n,i;if(!Kn(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(!Nr(t))throw new TypeError(S("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(!Nr(r))throw new TypeError(S("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*Hn):(i=r-t,e=n.byteOffset+t*Hn),new this.constructor(n.buffer,e,i<0?0:i)})),N(ri.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Kn(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})),N(ri.prototype,"toString",(function(){var t,r,e;if(!Kn(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(ti(r,e).toString());return t.join(",")})),N(ri.prototype,"with",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Nr(t))throw new TypeError(S("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(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!Vn(r))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=zn(r),e[2*t+1]=Xn(r),n}));var ei=[ir,We,Ke,ze,nn,Zt,yn,Dt,sn,Jn,ri],ni=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],ii=ni.length;function oi(t){var r,e=function(t){var r;if(Vt(t))return"generic";if(St(t))return null;for(r=0;r<ii;r++)if(t instanceof ei[r])return ni[r];return ke[It(t)]||null}(t);return typeof(r=t).get===Oe&&typeof r.set===Oe?{data:t,dtype:e,accessorProtocol:!0,accessors:[Me(e),Be(e)]}:{data:t,dtype:e,accessorProtocol:!1,accessors:[Ie(e),Le(e)]}}function ai(t,r,e,n,i,o){var a,u,f,s,l;if(o>=r.length)return t.accessors[0](t.data,n);for(f=[],s=r[o],a=e[o],l=0;l<s;l++)u=ai(t,r,e,n,i,o+1),f.push(u),n+=a;return f}function ui(t,r,e,n,i){var o;if(0===r.length)return[];for(o=0;o<r.length;o++)if(0===r[o])return[];return ai(oi(t),r,e,n,i,0)}var fi=se(),si=fi.length;function li(t){var r;for(r=0;r<si;r++)if(t===fi[r])return!0;return!1}function hi(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 ci(t){var r,e,n,i,o,a;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!Kr(i=t.strides)){if(!Kr(n=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return 0===n.length?[0]:(li(e=t.order)||(e="row-major"),hi(n,e))}for(r=[],a=0;a<i.length;a++){if(!Pr(o=i[a]))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));r.push(o)}return r}N(hi,"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)}));var pi="row-major",yi="column-major";function mi(t){var r;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return li(r=t.order)?r:1===(r=ft(ci(t)))||3===r?pi:2===r?yi:0===function(t){var r,e;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(mn(e=t.ndims))return e;if(!Kr(r=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return r.length}(t)?pi:null}return function(t){if(!((r=t)instanceof je||null!==r&&"object"==typeof r&&"object"==typeof r.data&&"object"==typeof r.shape&&"object"==typeof r.strides&&"number"==typeof r.offset&&"string"==typeof r.order&&"number"==typeof r.ndims&&"string"==typeof r.dtype&&"number"==typeof r.length&&"object"==typeof r.flags&&"function"==typeof r.get&&"function"==typeof r.set))throw new TypeError(function(){var t,r=arguments,e="https://stdlib.io/e/"+r[0]+"?";for(t=1;t<r.length;t++)e+="&arg[]="+encodeURIComponent(r[t]);return e}("1dfDv",t));var r;return ui(function(t){var r;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(Kr(r=t.data))return r;throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t))}(t),function(t){var r,e,n,i;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!Kr(e=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));for(r=[],i=0;i<e.length;i++){if(!mn(n=e[i]))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));r.push(n)}return r}(t),ci(t),function(t){var r,e,n;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(mn(n=t.offset))return n;if(!Kr(e=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(r=t.strides,0===e.length||!Kr(r))return 0;if(n=function(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}(e,r),mn(n))return n;throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t))}(t),mi(t))}}));
//# sourceMappingURL=index.js.map