-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
3 lines (3 loc) · 57.1 KB
/
index.js
1
2
3
// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).gsumkbn2=e()}(this,(function(){"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var e=Object.defineProperty;function t(r){return"number"==typeof r}function n(r){var e,t="";for(e=0;e<r;e++)t+="0";return t}function i(r,e,t){var i=!1,o=e-r.length;return o<0||(function(r){return"-"===r[0]}(r)&&(i=!0,r=r.substr(1)),r=t?r+n(o):n(o)+r,i&&(r="-"+r)),r}var o=String.prototype.toLowerCase,a=String.prototype.toUpperCase;function u(r){var e,n,u;switch(r.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(n=r.arg,u=parseInt(n,10),!isFinite(u)){if(!t(n))throw new Error("invalid integer. Value: "+n);u=0}return u<0&&("u"===r.specifier||10!==e)&&(u=4294967295+u+1),u<0?(n=(-u).toString(e),r.precision&&(n=i(n,r.precision,r.padRight)),n="-"+n):(n=u.toString(e),u||r.precision?r.precision&&(n=i(n,r.precision,r.padRight)):n="",r.sign&&(n=r.sign+n)),16===e&&(r.alternate&&(n="0x"+n),n=r.specifier===a.call(r.specifier)?a.call(n):o.call(n)),8===e&&r.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var f=Math.abs,l=String.prototype.toLowerCase,s=String.prototype.toUpperCase,c=String.prototype.replace,h=/e\+(\d)$/,p=/e-(\d)$/,m=/^(\d+)$/,y=/^(\d+)e/,g=/\.0$/,w=/\.0*e/,v=/(\..*[^0])0*e/;function b(r){var e,n,i=parseFloat(r.arg);if(!isFinite(i)){if(!t(r.arg))throw new Error("invalid floating-point number. Value: "+n);i=r.arg}switch(r.specifier){case"e":case"E":n=i.toExponential(r.precision);break;case"f":case"F":n=i.toFixed(r.precision);break;case"g":case"G":f(i)<1e-4?((e=r.precision)>0&&(e-=1),n=i.toExponential(e)):n=i.toPrecision(r.precision),r.alternate||(n=c.call(n,v,"$1e"),n=c.call(n,w,"e"),n=c.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=c.call(n,h,"e+0$1"),n=c.call(n,p,"e-0$1"),r.alternate&&(n=c.call(n,m,"$1."),n=c.call(n,y,"$1.e")),i>=0&&r.sign&&(n=r.sign+n),n=r.specifier===s.call(r.specifier)?s.call(n):l.call(n)}function d(r){var e,t="";for(e=0;e<r;e++)t+=" ";return t}var E=String.fromCharCode,_=Array.isArray;function T(r){return r!=r}function x(r){var e={};return e.specifier=r.specifier,e.precision=void 0===r.precision?1:r.precision,e.width=r.width,e.flags=r.flags||"",e.mapping=r.mapping,e}function A(r){var e,t,n,o,a,f,l,s,c,h,p,m,y;if(!_(r))throw new TypeError("invalid argument. First argument must be an array. Value: `"+r+"`.");for(f="",l=1,s=0;s<r.length;s++)if(n=r[s],"string"==typeof n)f+=n;else{if(e=void 0!==n.precision,!(n=x(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+s+"`. Value: `"+n+"`.");for(n.mapping&&(l=n.mapping),t=n.flags,c=0;c<t.length;c++)switch(o=t.charAt(c)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=t.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+o)}if("*"===n.width){if(n.width=parseInt(arguments[l],10),l+=1,T(n.width))throw new TypeError("the argument for * width at position "+l+" is not a number. Value: `"+n.width+"`.");n.width<0&&(n.padRight=!0,n.width=-n.width)}if(e&&"*"===n.precision){if(n.precision=parseInt(arguments[l],10),l+=1,T(n.precision))throw new TypeError("the argument for * precision at position "+l+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,e=!1)}switch(n.arg=arguments[l],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(n.padZeros=!1),n.arg=u(n);break;case"s":n.maxWidth=e?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):E(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=b(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=(h=n.arg,p=n.width,m=n.padRight,y=void 0,(y=p-h.length)<0?h:h=m?h+d(y):d(y)+h)),f+=n.arg||"",l+=1}return f}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function j(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function S(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push(j(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function F(r){var e,t;if("string"!=typeof r)throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[S(r)],t=1;t<arguments.length;t++)e.push(arguments[t]);return A.apply(null,e)}var k,L=Object.prototype,I=L.toString,R=L.__defineGetter__,B=L.__defineSetter__,O=L.__lookupGetter__,C=L.__lookupSetter__;k=function(){try{return r({},"x",{}),!0}catch(r){return!1}}()?e:function(r,e,t){var n,i,o,a;if("object"!=typeof r||null===r||"[object Array]"===I.call(r))throw new TypeError(F("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===I.call(t))throw new TypeError(F("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(O.call(r,e)||C.call(r,e)?(n=r.__proto__,r.__proto__=L,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),o="get"in t,a="set"in t,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&&R&&R.call(r,e,t.get),a&&B&&B.call(r,e,t.set),r};var M=k;function P(r,e,t){M(r,e,{configurable:!1,enumerable:!1,writable:!1,value:t})}function N(r){return Math.abs(r)}var U="function";var Y={float64:function(r,e){return r[e]},float32:function(r,e){return r[e]},int32:function(r,e){return r[e]},int16:function(r,e){return r[e]},int8:function(r,e){return r[e]},uint32:function(r,e){return r[e]},uint16:function(r,e){return r[e]},uint8:function(r,e){return r[e]},uint8c:function(r,e){return r[e]},generic:function(r,e){return r[e]},default:function(r,e){return r[e]}};function W(r){var e=Y[r];return"function"==typeof e?e:Y.default}var $={float64:function(r,e,t){r[e]=t},float32:function(r,e,t){r[e]=t},int32:function(r,e,t){r[e]=t},int16:function(r,e,t){r[e]=t},int8:function(r,e,t){r[e]=t},uint32:function(r,e,t){r[e]=t},uint16:function(r,e,t){r[e]=t},uint8:function(r,e,t){r[e]=t},uint8c:function(r,e,t){r[e]=t},generic:function(r,e,t){r[e]=t},default:function(r,e,t){r[e]=t}};function G(r){var e=$[r];return"function"==typeof e?e:$.default}var Z={complex128:function(r,e){return r.get(e)},complex64:function(r,e){return r.get(e)},default:function(r,e){return r.get(e)}};function J(r){var e=Z[r];return"function"==typeof e?e:Z.default}var X={complex128:function(r,e,t){r.set(t,e)},complex64:function(r,e,t){r.set(t,e)},default:function(r,e,t){r.set(t,e)}};function z(r){var e=X[r];return"function"==typeof e?e:X.default}var q="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function D(){return q&&"symbol"==typeof Symbol.toStringTag}var H=Object.prototype.toString;var K=Object.prototype.hasOwnProperty;function Q(r,e){return null!=r&&K.call(r,e)}var rr="function"==typeof Symbol?Symbol:void 0,er="function"==typeof rr?rr.toStringTag:"";var tr=D()?function(r){var e,t,n;if(null==r)return H.call(r);t=r[er],e=Q(r,er);try{r[er]=void 0}catch(e){return H.call(r)}return n=H.call(r),e?r[er]=t:delete r[er],n}:function(r){return H.call(r)};var nr=Array.isArray?Array.isArray:function(r){return"[object Array]"===tr(r)};function ir(r){return null!==r&&"object"==typeof r}function or(r){return ir(r)&&(r._isBuffer||r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))}function ar(){return/^\s*function\s*([^(]*)/i}P(ir,"isObjectLikeArray",function(r){if("function"!=typeof r)throw new TypeError(F("invalid argument. Must provide a function. Value: `%s`.",r));return function(e){var t,n;if(!nr(e))return!1;if(0===(t=e.length))return!1;for(n=0;n<t;n++)if(!1===r(e[n]))return!1;return!0}}(ir));var ur=/^\s*function\s*([^(]*)/i;function fr(r){var e,t,n;if(("Object"===(t=tr(r).slice(8,-1))||"Error"===t)&&r.constructor){if("string"==typeof(n=r.constructor).name)return n.name;if(e=ur.exec(n.toString()))return e[1]}return or(r)?"Buffer":t}P(ar,"REGEXP",ur);var lr={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},sr="function"==typeof Float64Array;var cr="function"==typeof Float64Array?Float64Array:null;var hr="function"==typeof Float64Array?Float64Array:void 0;var pr=function(){var r,e,t;if("function"!=typeof cr)return!1;try{e=new cr([1,3.14,-3.14,NaN]),t=e,r=(sr&&t instanceof Float64Array||"[object Float64Array]"===tr(t))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){r=!1}return r}()?hr:function(){throw new Error("not implemented")},mr="function"==typeof Float32Array;var yr=Number.POSITIVE_INFINITY,gr="function"==typeof Float32Array?Float32Array:null;var wr="function"==typeof Float32Array?Float32Array:void 0;var vr=function(){var r,e,t;if("function"!=typeof gr)return!1;try{e=new gr([1,3.14,-3.14,5e40]),t=e,r=(mr&&t instanceof Float32Array||"[object Float32Array]"===tr(t))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===yr}catch(e){r=!1}return r}()?wr:function(){throw new Error("not implemented")},br="function"==typeof Uint32Array;var dr="function"==typeof Uint32Array?Uint32Array:null;var Er="function"==typeof Uint32Array?Uint32Array:void 0;var _r=function(){var r,e,t;if("function"!=typeof dr)return!1;try{e=new dr(e=[1,3.14,-3.14,4294967296,4294967297]),t=e,r=(br&&t instanceof Uint32Array||"[object Uint32Array]"===tr(t))&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Er:function(){throw new Error("not implemented")},Tr="function"==typeof Int32Array;var xr="function"==typeof Int32Array?Int32Array:null;var Ar="function"==typeof Int32Array?Int32Array:void 0;var Vr=function(){var r,e,t;if("function"!=typeof xr)return!1;try{e=new xr([1,3.14,-3.14,2147483648]),t=e,r=(Tr&&t instanceof Int32Array||"[object Int32Array]"===tr(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){r=!1}return r}()?Ar:function(){throw new Error("not implemented")},jr="function"==typeof Uint16Array;var Sr="function"==typeof Uint16Array?Uint16Array:null;var Fr="function"==typeof Uint16Array?Uint16Array:void 0;var kr=function(){var r,e,t;if("function"!=typeof Sr)return!1;try{e=new Sr(e=[1,3.14,-3.14,65536,65537]),t=e,r=(jr&&t instanceof Uint16Array||"[object Uint16Array]"===tr(t))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Fr:function(){throw new Error("not implemented")},Lr="function"==typeof Int16Array;var Ir="function"==typeof Int16Array?Int16Array:null;var Rr="function"==typeof Int16Array?Int16Array:void 0;var Br=function(){var r,e,t;if("function"!=typeof Ir)return!1;try{e=new Ir([1,3.14,-3.14,32768]),t=e,r=(Lr&&t instanceof Int16Array||"[object Int16Array]"===tr(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){r=!1}return r}()?Rr:function(){throw new Error("not implemented")},Or="function"==typeof Uint8Array;var Cr="function"==typeof Uint8Array?Uint8Array:null;var Mr="function"==typeof Uint8Array?Uint8Array:void 0;var Pr=function(){var r,e,t;if("function"!=typeof Cr)return!1;try{e=new Cr(e=[1,3.14,-3.14,256,257]),t=e,r=(Or&&t instanceof Uint8Array||"[object Uint8Array]"===tr(t))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Mr:function(){throw new Error("not implemented")},Nr="function"==typeof Uint8ClampedArray;var Ur="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var Yr="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;var Wr=function(){var r,e,t;if("function"!=typeof Ur)return!1;try{e=new Ur([-1,0,1,3.14,4.99,255,256]),t=e,r=(Nr&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===tr(t))&&0===e[0]&&0===e[1]&&1===e[2]&&3===e[3]&&5===e[4]&&255===e[5]&&255===e[6]}catch(e){r=!1}return r}()?Yr:function(){throw new Error("not implemented")},$r="function"==typeof Int8Array;var Gr="function"==typeof Int8Array?Int8Array:null;var Zr="function"==typeof Int8Array?Int8Array:void 0;var Jr=function(){var r,e,t;if("function"!=typeof Gr)return!1;try{e=new Gr([1,3.14,-3.14,128]),t=e,r=($r&&t instanceof Int8Array||"[object Int8Array]"===tr(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){r=!1}return r}()?Zr:function(){throw new Error("not implemented")};function Xr(r){return"number"==typeof r}var zr=Number,qr=zr.prototype.toString;var Dr=D();function Hr(r){return"object"==typeof r&&(r instanceof zr||(Dr?function(r){try{return qr.call(r),!0}catch(r){return!1}}(r):"[object Number]"===tr(r)))}function Kr(r){return Xr(r)||Hr(r)}P(Kr,"isPrimitive",Xr),P(Kr,"isObject",Hr);var Qr=zr.NEGATIVE_INFINITY,re=Math.floor;function ee(r){return re(r)===r}function te(r){return r<yr&&r>Qr&&ee(r)}function ne(r){return Xr(r)&&te(r)}function ie(r){return Hr(r)&&te(r.valueOf())}function oe(r){return ne(r)||ie(r)}function ae(r){return ne(r)&&r>=0}function ue(r){return ie(r)&&r.valueOf()>=0}function fe(r){return ae(r)||ue(r)}P(oe,"isPrimitive",ne),P(oe,"isObject",ie),P(fe,"isPrimitive",ae),P(fe,"isObject",ue);var le=4294967295;function se(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&ee(r.length)&&r.length>=0&&r.length<=le}var ce=9007199254740991;function he(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&ee(r.length)&&r.length>=0&&r.length<=ce}var pe="function"==typeof ArrayBuffer;function me(r){return pe&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===tr(r)}function ye(r){return"object"==typeof r&&null!==r&&!nr(r)}function ge(r){return"string"==typeof r}var we=String.prototype.valueOf;var ve=D();function be(r){return"object"==typeof r&&(r instanceof String||(ve?function(r){try{return we.call(r),!0}catch(r){return!1}}(r):"[object String]"===tr(r)))}function de(r){return ge(r)||be(r)}P(de,"isPrimitive",ge),P(de,"isObject",be);var Ee=/./;function _e(r){return"boolean"==typeof r}var Te=Boolean,xe=Boolean.prototype.toString;var Ae=D();function Ve(r){return"object"==typeof r&&(r instanceof Te||(Ae?function(r){try{return xe.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===tr(r)))}function je(r){return _e(r)||Ve(r)}P(je,"isPrimitive",_e),P(je,"isObject",Ve);var Se="object"==typeof self?self:null,Fe="object"==typeof window?window:null,ke="object"==typeof global?global:null,Le="object"==typeof globalThis?globalThis:null;var Ie=function(r){if(arguments.length){if(!_e(r))throw new TypeError(F("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(Le)return Le;if(Se)return Se;if(Fe)return Fe;if(ke)return ke;throw new Error("unexpected error. Unable to resolve global object.")}(),Re=Ie.document&&Ie.document.childNodes,Be=Int8Array;var Oe="function"==typeof Ee||"object"==typeof Be||"function"==typeof Re?function(r){return fr(r).toLowerCase()}:function(r){var e;return null===r?"null":"object"===(e=typeof r)?fr(r).toLowerCase():e};function Ce(r){return"function"===Oe(r)}function Me(r,e){if(!(this instanceof Me))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Xr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Xr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}P(Me,"BYTES_PER_ELEMENT",8),P(Me.prototype,"BYTES_PER_ELEMENT",8),P(Me.prototype,"byteLength",16),P(Me.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(Me.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var Pe="function"==typeof Math.fround?Math.fround:null,Ne=new vr(1);var Ue="function"==typeof Pe?Pe:function(r){return Ne[0]=r,Ne[0]};function Ye(r,e){if(!(this instanceof Ye))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Xr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Xr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ue(r)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ue(e)}),this}function We(r){return r instanceof Me||r instanceof Ye||"object"==typeof r&&null!==r&&"number"==typeof r.re&&"number"==typeof r.im}function $e(r){return ee(r/2)}P(Ye,"BYTES_PER_ELEMENT",4),P(Ye.prototype,"BYTES_PER_ELEMENT",4),P(Ye.prototype,"byteLength",8),P(Ye.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(Ye.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var Ge=8;function Ze(r){return"object"==typeof r&&null!==r&&"Complex64Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===Ge}var Je=16;function Xe(r){return"object"==typeof r&&null!==r&&"Complex128Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===Je}function ze(){return"function"==typeof rr&&"symbol"==typeof rr("foo")&&Q(rr,"iterator")&&"symbol"==typeof rr.iterator}var qe=ze()?Symbol.iterator:null;function De(r,e,t){M(r,e,{configurable:!1,enumerable:!1,get:t})}function He(r,e){if(!(this instanceof He))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Xr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Xr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ue(r)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ue(e)}),this}function Ke(r){return r.re}function Qe(r){return r.im}function rt(r,e){return new vr(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function et(r,e){return new pr(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function tt(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(se(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!We(n))return new TypeError(F("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(Ke(n),Qe(n))}return e}P(He,"BYTES_PER_ELEMENT",4),P(He.prototype,"BYTES_PER_ELEMENT",4),P(He.prototype,"byteLength",8),P(He.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(He.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var nt=2*vr.BYTES_PER_ELEMENT,it=ze();function ot(r){return r instanceof ft||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function at(r){return r===ft||"Complex128Array"===r.name}function ut(r,e){return new He(r[e*=2],r[e+1])}function ft(){var r,e,t,n;if(e=arguments.length,!(this instanceof ft))return 0===e?new ft:1===e?new ft(arguments[0]):2===e?new ft(arguments[0],arguments[1]):new ft(arguments[0],arguments[1],arguments[2]);if(0===e)t=new vr(0);else if(1===e)if(ae(arguments[0]))t=new vr(2*arguments[0]);else if(he(arguments[0]))if((n=(t=arguments[0]).length)&&nr(t)&&We(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;i<t;i++){if(!We(n=e[i]))return null;r[o]=Ke(n),r[o+1]=Qe(n),o+=2}return r}(new vr(2*n),t),null===t){if(!$e(n))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new vr(arguments[0])}}else{if(Ze(t))t=rt(t,0);else if(Xe(t))t=et(t,0);else if(!$e(n))throw new RangeError(F("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new vr(t)}else if(me(arguments[0])){if(!ee((t=arguments[0]).byteLength/nt))throw new RangeError(F("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",nt,t.byteLength));t=new vr(t)}else{if(!ye(arguments[0]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(t=arguments[0],!1===it)throw new TypeError(F("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",t));if(!Ce(t[qe]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if(!Ce((t=t[qe]()).next))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if((t=tt(t))instanceof Error)throw t;t=new vr(t)}else{if(!me(t=arguments[0]))throw new TypeError(F("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(!ae(r=arguments[1]))throw new TypeError(F("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",r));if(!ee(r/nt))throw new RangeError(F("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",nt,r));if(2===e){if(!ee((n=t.byteLength-r)/nt))throw new RangeError(F("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",nt,n));t=new vr(t,r)}else{if(!ae(n=arguments[2]))throw new TypeError(F("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*nt>t.byteLength-r)throw new RangeError(F("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*nt));t=new vr(t,r,2*n)}}return P(this,"_buffer",t),P(this,"_length",t.length/2),this}function lt(r,e){if(!(this instanceof lt))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Xr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Xr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}function st(r){return r.re}function ct(r){return r.im}function ht(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(se(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!We(n))return new TypeError(F("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(st(n),ct(n))}return e}P(ft,"BYTES_PER_ELEMENT",nt),P(ft,"name","Complex64Array"),P(ft,"from",(function(r){var e,t,n,i,o,a,u,f,l,s,c,h;if(!Ce(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!at(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!Ce(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(ot(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(We(s=n.call(e,r.get(c),c)))o[h]=Ke(s),o[h+1]=Qe(s);else{if(!(se(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(he(r)){if(n){for(f=r.length,u=r.get&&r.set?J("default"):W("default"),c=0;c<f;c++)if(!We(u(r,c))){l=!0;break}if(l){if(!$e(f))throw new RangeError(F("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,c=0;c<f;c++)o[c]=n.call(e,u(r,c),c);return i}for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(We(s=n.call(e,u(r,c),c)))o[h]=Ke(s),o[h+1]=Qe(s);else{if(!(se(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(ye(r)&&it&&Ce(r[qe])){if(!Ce((o=r[qe]()).next))throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(a=n?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,se(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!We(o))return new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Ke(o),Qe(o))}return n}(o,n,e):tt(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c<f;c++)o[c]=a[c];return i}throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))})),P(ft,"of",(function(){var r,e;if(!Ce(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!at(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),P(ft.prototype,"at",(function(r){if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!ee(r))throw new TypeError(F("invalid argument. Must provide an integer. Value: `%s`.",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return ut(this._buffer,r)})),De(ft.prototype,"buffer",(function(){return this._buffer.buffer})),De(ft.prototype,"byteLength",(function(){return this._buffer.byteLength})),De(ft.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(ft.prototype,"BYTES_PER_ELEMENT",ft.BYTES_PER_ELEMENT),P(ft.prototype,"copyWithin",(function(r,e){if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),P(ft.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,r=this._buffer,n=this._length,o=-1,a=-2,P(t={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new He(r[a+=2],r[a+1]),{value:[o,e],done:!1}})),P(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),qe&&P(t,qe,(function(){return e.entries()})),t})),P(ft.prototype,"every",(function(r,e){var t,n;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,ut(t,n),n,this))return!1;return!0})),P(ft.prototype,"fill",(function(r,e,t){var n,i,o,a,u,f;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(n=this._buffer,i=this._length,arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!ee(t))throw new TypeError(F("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else e=0,t=i;for(a=Ke(r),u=Qe(r),f=e;f<t;f++)n[o=2*f]=a,n[o+1]=u;return this})),P(ft.prototype,"filter",(function(r,e){var t,n,i,o;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=[],i=0;i<this._length;i++)o=ut(t,i),r.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),P(ft.prototype,"find",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=ut(t,n),r.call(e,i,n,this))return i})),P(ft.prototype,"findIndex",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=ut(t,n),r.call(e,i,n,this))return n;return-1})),P(ft.prototype,"findLast",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=ut(t,n),r.call(e,i,n,this))return i})),P(ft.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=ut(t,n),r.call(e,i,n,this))return n;return-1})),P(ft.prototype,"forEach",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)i=ut(t,n),r.call(e,i,n,this)})),P(ft.prototype,"get",(function(r){if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!ae(r))throw new TypeError(F("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return ut(this._buffer,r)})),P(ft.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=Ke(r),o=Qe(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return!0;return!1})),P(ft.prototype,"indexOf",(function(r,e){var t,n,i,o,a;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=Ke(r),o=Qe(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(ft.prototype,"join",(function(r){var e,t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!ge(r))throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));n=r}for(e=[],t=this._buffer,i=0;i<this._length;i++)e.push(ut(t,i).toString());return e.join(n)})),P(ft.prototype,"lastIndexOf",(function(r,e){var t,n,i,o,a;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=Ke(r),o=Qe(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),De(ft.prototype,"length",(function(){return this._length})),P(ft.prototype,"map",(function(r,e){var t,n,i,o,a;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(We(a=r.call(e,ut(n,o),o,this)))t[2*o]=Ke(a),t[2*o+1]=Qe(a);else{if(!se(a)||2!==a.length)throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));t[2*o]=a[0],t[2*o+1]=a[1]}return i})),P(ft.prototype,"reduce",(function(r,e){var t,n,i,o;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));if(t=this._buffer,i=this._length,arguments.length>1)n=e,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=ut(t,0),o=1}for(;o<i;o++)n=r(n,ut(t,o),o,this);return n})),P(ft.prototype,"reverse",(function(){var r,e,t,n,i,o;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,r=this._buffer,n=re(t/2),i=0;i<n;i++)o=t-i-1,e=r[2*i],r[2*i]=r[2*o],r[2*o]=e,e=r[2*i+1],r[2*i+1]=r[2*o+1],r[2*o+1]=e;return this})),P(ft.prototype,"set",(function(r){var e,t,n,i,o,a,u,f,l;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!ae(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(We(r)){if(t>=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=Ke(r),void(n[t+1]=Qe(r))}if(ot(r)){if(t+(a=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,l=n.byteOffset+t*nt,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new vr(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(t*=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2}else{if(!he(r))throw new TypeError(F("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",r));for(a=r.length,f=0;f<a;f++)if(!We(r[f])){o=!0;break}if(o){if(!$e(a))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(t+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,l=n.byteOffset+t*nt,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new vr(a),f=0;f<a;f++)i[f]=e[f];e=i}for(t*=2,a/=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2;return}if(t+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;f<a;f++)u=r[f],n[t]=Ke(u),n[t+1]=Qe(u),t+=2}})),P(ft.prototype,"slice",(function(r,e){var t,n,i,o,a,u,f;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!ee(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(i=new this.constructor(t))._buffer,f=0;f<t;f++)o=2*(f+r),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),P(ft.prototype,"some",(function(r,e){var t,n;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,ut(t,n),n,this))return!0;return!1})),P(ft.prototype,"subarray",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)r=0,e=i;else{if(!ee(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),1===arguments.length)e=i;else{if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*nt):(i=e-r,t=n.byteOffset+r*nt),new this.constructor(n.buffer,t,i<0?0:i)})),P(ft.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;i<t;i++)o=t-i-1,r[2*i]=n[2*o],r[2*i+1]=n[2*o+1];return e})),P(ft.prototype,"toString",(function(){var r,e,t;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(ut(e,t).toString());return r.join(",")})),P(ft.prototype,"with",(function(r,e){var t,n,i;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!ee(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(i=this._length,r<0&&(r+=i),r<0||r>=i)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!We(e))throw new TypeError(F("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=Ke(e),t[2*r+1]=Qe(e),n})),P(lt,"BYTES_PER_ELEMENT",8),P(lt.prototype,"BYTES_PER_ELEMENT",8),P(lt.prototype,"byteLength",16),P(lt.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(lt.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var pt=2*pr.BYTES_PER_ELEMENT,mt=ze();function yt(r){return r instanceof vt||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function gt(r){return r===vt||"Complex64Array"===r.name}function wt(r,e){return new lt(r[e*=2],r[e+1])}function vt(){var r,e,t,n;if(e=arguments.length,!(this instanceof vt))return 0===e?new vt:1===e?new vt(arguments[0]):2===e?new vt(arguments[0],arguments[1]):new vt(arguments[0],arguments[1],arguments[2]);if(0===e)t=new pr(0);else if(1===e)if(ae(arguments[0]))t=new pr(2*arguments[0]);else if(he(arguments[0]))if((n=(t=arguments[0]).length)&&nr(t)&&We(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;i<t;i++){if(!We(n=e[i]))return null;r[o]=st(n),r[o+1]=ct(n),o+=2}return r}(new pr(2*n),t),null===t){if(!$e(n))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new pr(arguments[0])}}else{if(Ze(t))t=rt(t,0);else if(Xe(t))t=et(t,0);else if(!$e(n))throw new RangeError(F("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new pr(t)}else if(me(arguments[0])){if(!ee((t=arguments[0]).byteLength/pt))throw new RangeError(F("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",pt,t.byteLength));t=new pr(t)}else{if(!ye(arguments[0]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(t=arguments[0],!1===mt)throw new TypeError(F("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",t));if(!Ce(t[qe]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if(!Ce((t=t[qe]()).next))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if((t=ht(t))instanceof Error)throw t;t=new pr(t)}else{if(!me(t=arguments[0]))throw new TypeError(F("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(!ae(r=arguments[1]))throw new TypeError(F("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",r));if(!ee(r/pt))throw new RangeError(F("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",pt,r));if(2===e){if(!ee((n=t.byteLength-r)/pt))throw new RangeError(F("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",pt,n));t=new pr(t,r)}else{if(!ae(n=arguments[2]))throw new TypeError(F("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*pt>t.byteLength-r)throw new RangeError(F("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*pt));t=new pr(t,r,2*n)}}return P(this,"_buffer",t),P(this,"_length",t.length/2),this}P(vt,"BYTES_PER_ELEMENT",pt),P(vt,"name","Complex128Array"),P(vt,"from",(function(r){var e,t,n,i,o,a,u,f,l,s,c,h;if(!Ce(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!gt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!Ce(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(yt(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(We(s=n.call(e,r.get(c),c)))o[h]=st(s),o[h+1]=ct(s);else{if(!(se(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(he(r)){if(n){for(f=r.length,u=r.get&&r.set?J("default"):W("default"),c=0;c<f;c++)if(!We(u(r,c))){l=!0;break}if(l){if(!$e(f))throw new RangeError(F("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,c=0;c<f;c++)o[c]=n.call(e,u(r,c),c);return i}for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(We(s=n.call(e,u(r,c),c)))o[h]=st(s),o[h+1]=ct(s);else{if(!(se(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(ye(r)&&mt&&Ce(r[qe])){if(!Ce((o=r[qe]()).next))throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(a=n?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,se(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!We(o))return new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(st(o),ct(o))}return n}(o,n,e):ht(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c<f;c++)o[c]=a[c];return i}throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))})),P(vt,"of",(function(){var r,e;if(!Ce(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!gt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),P(vt.prototype,"at",(function(r){if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!ee(r))throw new TypeError(F("invalid argument. Must provide an integer. Value: `%s`.",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return wt(this._buffer,r)})),De(vt.prototype,"buffer",(function(){return this._buffer.buffer})),De(vt.prototype,"byteLength",(function(){return this._buffer.byteLength})),De(vt.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(vt.prototype,"BYTES_PER_ELEMENT",vt.BYTES_PER_ELEMENT),P(vt.prototype,"copyWithin",(function(r,e){if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),P(vt.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,r=this._buffer,n=this._length,o=-1,a=-2,P(t={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new lt(r[a+=2],r[a+1]),{value:[o,e],done:!1}})),P(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),qe&&P(t,qe,(function(){return e.entries()})),t})),P(vt.prototype,"every",(function(r,e){var t,n;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,wt(t,n),n,this))return!1;return!0})),P(vt.prototype,"fill",(function(r,e,t){var n,i,o,a,u,f;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(n=this._buffer,i=this._length,arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!ee(t))throw new TypeError(F("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else e=0,t=i;for(a=st(r),u=ct(r),f=e;f<t;f++)n[o=2*f]=a,n[o+1]=u;return this})),P(vt.prototype,"filter",(function(r,e){var t,n,i,o;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=[],i=0;i<this._length;i++)o=wt(t,i),r.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),P(vt.prototype,"find",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=wt(t,n),r.call(e,i,n,this))return i})),P(vt.prototype,"findIndex",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=wt(t,n),r.call(e,i,n,this))return n;return-1})),P(vt.prototype,"findLast",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=wt(t,n),r.call(e,i,n,this))return i})),P(vt.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=wt(t,n),r.call(e,i,n,this))return n;return-1})),P(vt.prototype,"forEach",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)i=wt(t,n),r.call(e,i,n,this)})),P(vt.prototype,"get",(function(r){if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!ae(r))throw new TypeError(F("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return wt(this._buffer,r)})),De(vt.prototype,"length",(function(){return this._length})),P(vt.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=st(r),o=ct(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return!0;return!1})),P(vt.prototype,"indexOf",(function(r,e){var t,n,i,o,a;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=st(r),o=ct(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(vt.prototype,"join",(function(r){var e,t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!de(r))throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));n=r}for(e=[],t=this._buffer,i=0;i<this._length;i++)e.push(wt(t,i).toString());return e.join(n)})),P(vt.prototype,"lastIndexOf",(function(r,e){var t,n,i,o,a;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=st(r),o=ct(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(vt.prototype,"map",(function(r,e){var t,n,i,o,a;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(We(a=r.call(e,wt(n,o),o,this)))t[2*o]=st(a),t[2*o+1]=ct(a);else{if(!se(a)||2!==a.length)throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));t[2*o]=a[0],t[2*o+1]=a[1]}return i})),P(vt.prototype,"reduce",(function(r,e){var t,n,i,o;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));if(t=this._buffer,i=this._length,arguments.length>1)n=e,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=wt(t,0),o=1}for(;o<i;o++)n=r(n,wt(t,o),o,this);return n})),P(vt.prototype,"reverse",(function(){var r,e,t,n,i,o;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,r=this._buffer,n=re(t/2),i=0;i<n;i++)o=t-i-1,e=r[2*i],r[2*i]=r[2*o],r[2*o]=e,e=r[2*i+1],r[2*i+1]=r[2*o+1],r[2*o+1]=e;return this})),P(vt.prototype,"set",(function(r){var e,t,n,i,o,a,u,f,l;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!ae(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(We(r)){if(t>=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=st(r),void(n[t+1]=ct(r))}if(yt(r)){if(t+(a=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,l=n.byteOffset+t*pt,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new pr(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(t*=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2}else{if(!he(r))throw new TypeError(F("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",r));for(a=r.length,f=0;f<a;f++)if(!We(r[f])){o=!0;break}if(o){if(!$e(a))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(t+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,l=n.byteOffset+t*pt,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new pr(a),f=0;f<a;f++)i[f]=e[f];e=i}for(t*=2,a/=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2;return}if(t+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;f<a;f++)u=r[f],n[t]=st(u),n[t+1]=ct(u),t+=2}})),P(vt.prototype,"slice",(function(r,e){var t,n,i,o,a,u,f;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!ee(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(i=new this.constructor(t))._buffer,f=0;f<t;f++)o=2*(f+r),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),P(vt.prototype,"some",(function(r,e){var t,n;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,wt(t,n),n,this))return!0;return!1})),P(vt.prototype,"subarray",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)r=0,e=i;else{if(!ee(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),1===arguments.length)e=i;else{if(!ee(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*pt):(i=e-r,t=n.byteOffset+r*pt),new this.constructor(n.buffer,t,i<0?0:i)})),P(vt.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;i<t;i++)o=t-i-1,r[2*i]=n[2*o],r[2*i+1]=n[2*o+1];return e})),P(vt.prototype,"toString",(function(){var r,e,t;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(wt(e,t).toString());return r.join(",")})),P(vt.prototype,"with",(function(r,e){var t,n,i;if(!yt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!ee(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(i=this._length,r<0&&(r+=i),r<0||r>=i)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!We(e))throw new TypeError(F("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=st(e),t[2*r+1]=ct(e),n}));var bt=[pr,vr,Vr,_r,Br,kr,Jr,Pr,Wr,ft,vt],dt=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],Et=dt.length;function _t(r){var e,t=function(r){var e;if(nr(r))return"generic";if(or(r))return null;for(e=0;e<Et;e++)if(r instanceof bt[e])return dt[e];return lr[fr(r)]||null}(r);return typeof(e=r).get===U&&typeof e.set===U?{data:r,dtype:t,accessorProtocol:!0,accessors:[J(t),z(t)]}:{data:r,dtype:t,accessorProtocol:!1,accessors:[W(t),G(t)]}}function Tt(r,e,t,n){var i,o,a,u,f,l,s,c,h,p;if(r<=0)return 0;if((l=_t(e)).accessorProtocol)return function(r,e,t,n){var i,o,a,u,f,l,s,c,h,p,m;if(i=e.data,o=e.accessors[0],f=n,0===t)return r*o(i,f);for(a=0,u=0,l=0,m=0;m<r;m++)h=a+(c=o(i,f)),p=N(a)>=N(c)?a-h+c:c-h+a,a=h,h=l+p,s=N(l)>=N(p)?l-h+p:p-h+l,l=h,u+=s,f+=t;return a+l+u}(r,l,t,n);if(a=n,0===t)return r*e[a];for(i=0,o=0,u=0,p=0;p<r;p++)c=i+(s=e[a]),h=N(i)>=N(s)?i-c+s:s-c+i,i=c,c=u+h,f=N(u)>=N(h)?u-c+h:h-c+u,u=c,o+=f,a+=t;return i+u+o}function xt(r,e,t){return Tt(r,e,t,function(r,e){return e>0?0:(1-r)*e}(r,t))}return P(xt,"ndarray",Tt),xt}));
//# sourceMappingURL=index.js.map