// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
///
var r=Math.floor;function e(e){return r(e)===e}var t=9007199254740991;function n(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&e(r.length)&&r.length>=0&&r.length<=t}var i="function"==typeof Object.defineProperty?Object.defineProperty:null;var o=Object.defineProperty;function a(r){return"number"==typeof r}function u(r){var e,t="";for(e=0;e0&&(e-=1),t=n.toExponential(e)):t=n.toPrecision(r.precision),r.alternate||(t=m.call(t,T,"$1e"),t=m.call(t,E,"e"),t=m.call(t,d,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=m.call(t,g,"e+0$1"),t=m.call(t,w,"e-0$1"),r.alternate&&(t=m.call(t,v,"$1."),t=m.call(t,b,"$1.e")),n>=0&&r.sign&&(t=r.sign+t),t=r.specifier===y.call(r.specifier)?y.call(t):p.call(t)}function x(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=S(o)?String(n.arg):A(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(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=f(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(h=n.arg,p=n.width,y=n.padRight,m=void 0,(m=p-h.length)<0?h:h=y?h+x(m):x(m)+h)),a+=n.arg||"",u+=1}return a}var k=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function L(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 I(r){var e,t,n,i;for(t=[],i=0,n=k.exec(r);n;)(e=r.slice(i,k.lastIndex-n[0].length)).length&&t.push(e),t.push(L(n)),i=k.lastIndex,n=k.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function R(r){var e,t;if("string"!=typeof r)throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[I(r)],t=1;tir&&e(r)}function ar(r){return $(r)&&or(r)}function ur(r){return er(r)&&or(r.valueOf())}function fr(r){return ar(r)||ur(r)}W(fr,"isPrimitive",ar),W(fr,"isObject",ur);var lr="function";var sr={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 cr(r){var e=sr[r];return"function"==typeof e?e:sr.default}var hr={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 pr(r){var e=hr[r];return"function"==typeof e?e:hr.default}var yr={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 mr(r){var e=yr[r];return"function"==typeof e?e:yr.default}var gr={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 wr(r){var e=gr[r];return"function"==typeof e?e:gr.default}var vr=Array.isArray?Array.isArray:function(r){return"[object Array]"===H(r)};function br(r){return null!==r&&"object"==typeof r}function dr(r){return br(r)&&(r._isBuffer||r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))}function Er(){return/^\s*function\s*([^(]*)/i}W(br,"isObjectLikeArray",function(r){if("function"!=typeof r)throw new TypeError(R("invalid argument. Must provide a function. Value: `%s`.",r));return function(e){var t,n;if(!vr(e))return!1;if(0===(t=e.length))return!1;for(n=0;n=0}function fe(r){return ur(r)&&r.valueOf()>=0}function le(r){return ue(r)||fe(r)}W(le,"isPrimitive",ue),W(le,"isObject",fe);var se=4294967295;function ce(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&e(r.length)&&r.length>=0&&r.length<=se}var he="function"==typeof ArrayBuffer;function pe(r){return he&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===H(r)}function ye(r){return"object"==typeof r&&null!==r&&!vr(r)}function me(r){return"string"==typeof r}var ge=String.prototype.valueOf;var we=Z();function ve(r){return"object"==typeof r&&(r instanceof String||(we?function(r){try{return ge.call(r),!0}catch(r){return!1}}(r):"[object String]"===H(r)))}function be(r){return me(r)||ve(r)}W(be,"isPrimitive",me),W(be,"isObject",ve);var de=/./;function Ee(r){return"boolean"==typeof r}var Te=Boolean,_e=Boolean.prototype.toString;var xe=Z();function Ae(r){return"object"==typeof r&&(r instanceof Te||(xe?function(r){try{return _e.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===H(r)))}function Ve(r){return Ee(r)||Ae(r)}W(Ve,"isPrimitive",Ee),W(Ve,"isObject",Ae);var Se="object"==typeof self?self:null,je="object"==typeof window?window:null,Fe="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ke="object"==typeof Fe?Fe:null,Le="object"==typeof globalThis?globalThis:null;var Ie=function(r){if(arguments.length){if(!Ee(r))throw new TypeError(R("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(je)return je;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 de||"object"==typeof Be||"function"==typeof Re?function(r){return _r(r).toLowerCase()}:function(r){var e;return null===r?"null":"object"===(e=typeof r)?_r(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(!$(r))throw new TypeError(R("invalid argument. Real component must be a number. Value: `%s`.",r));if(!$(e))throw new TypeError(R("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Y(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),Y(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}W(Me,"BYTES_PER_ELEMENT",8),W(Me.prototype,"BYTES_PER_ELEMENT",8),W(Me.prototype,"byteLength",16),W(Me.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),W(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,Ue=new Ir(1);var Ne="function"==typeof Pe?Pe:function(r){return Ue[0]=r,Ue[0]};function Ye(r,e){if(!(this instanceof Ye))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!$(r))throw new TypeError(R("invalid argument. Real component must be a number. Value: `%s`.",r));if(!$(e))throw new TypeError(R("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Y(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ne(r)}),Y(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ne(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 e(r/2)}W(Ye,"BYTES_PER_ELEMENT",4),W(Ye.prototype,"BYTES_PER_ELEMENT",4),W(Ye.prototype,"byteLength",8),W(Ye.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),W(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 q&&"symbol"==typeof q("foo")&&z(q,"iterator")&&"symbol"==typeof q.iterator}var qe=ze()?Symbol.iterator:null;function De(r,e,t){Y(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(!$(r))throw new TypeError(R("invalid argument. Real component must be a number. Value: `%s`.",r));if(!$(e))throw new TypeError(R("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Y(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ne(r)}),Y(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ne(e)}),this}function Ke(r){return r.re}function Qe(r){return r.im}function rt(r,e){return new Ir(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function et(r,e){return new jr(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(ce(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!We(n))return new TypeError(R("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}W(He,"BYTES_PER_ELEMENT",4),W(He.prototype,"BYTES_PER_ELEMENT",4),W(He.prototype,"byteLength",8),W(He.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),W(He.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var nt=2*Ir.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,t,i,o;if(t=arguments.length,!(this instanceof ft))return 0===t?new ft:1===t?new ft(arguments[0]):2===t?new ft(arguments[0],arguments[1]):new ft(arguments[0],arguments[1],arguments[2]);if(0===t)i=new Ir(0);else if(1===t)if(ue(arguments[0]))i=new Ir(2*arguments[0]);else if(n(arguments[0]))if((o=(i=arguments[0]).length)&&vr(i)&&We(i[0])){if(i=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;ii.byteLength-r)throw new RangeError(R("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",o*nt));i=new Ir(i,r,2*o)}}return W(this,"_buffer",i),W(this,"_length",i.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(!$(r))throw new TypeError(R("invalid argument. Real component must be a number. Value: `%s`.",r));if(!$(e))throw new TypeError(R("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Y(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),Y(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(ce(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!We(n))return new TypeError(R("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}W(ft,"BYTES_PER_ELEMENT",nt),W(ft,"name","Complex64Array"),W(ft,"from",(function(r){var e,t,i,o,a,u,f,l,s,c,h,p;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(i=arguments[1]))throw new TypeError(R("invalid argument. Second argument must be a function. Value: `%s`.",i));t>2&&(e=arguments[2])}if(ot(r)){if(l=r.length,i){for(a=(o=new this(l))._buffer,p=0,h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));a[p]=c[0],a[p+1]=c[1]}p+=2}return o}return new this(r)}if(n(r)){if(i){for(l=r.length,f=r.get&&r.set?mr("default"):cr("default"),h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));a[p]=c[0],a[p+1]=c[1]}p+=2}return o}return new this(r)}if(ye(r)&&it&&Ce(r[qe])){if(!Ce((a=r[qe]()).next))throw new TypeError(R("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(u=i?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,ce(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!We(o))return new TypeError(R("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}(a,i,e):tt(a),u instanceof Error)throw u;for(a=(o=new this(l=u.length/2))._buffer,h=0;h=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})),W(ft.prototype,"BYTES_PER_ELEMENT",ft.BYTES_PER_ELEMENT),W(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})),W(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,W(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}})),W(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),qe&&W(t,qe,(function(){return e.entries()})),t})),W(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(R("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=o)<0&&(t=0),arguments.length>2){if(!e(n))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",n));n<0&&(n+=o)<0&&(n=0),n>o&&(n=o)}else n=o}else t=0,n=o;for(u=Ke(r),f=Qe(r),l=t;l=0;n--)if(i=ut(t,n),r.call(e,i,n,this))return i})),W(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(R("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})),W(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(R("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n=this._length))return ut(this._buffer,r)})),W(ft.prototype,"includes",(function(r,t){var n,i,o,a,u;if(!ot(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(R("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(o=Ke(r),a=Qe(r),n=this._buffer,u=t;u1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(o=Ke(r),a=Qe(r),n=this._buffer,u=t;u1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));t>=this._length?t=this._length-1:t<0&&(t+=this._length)}else t=this._length-1;for(o=Ke(r),a=Qe(r),n=this._buffer,u=t;u>=0;u--)if(o===n[i=2*u]&&a===n[i+1])return u;return-1})),De(ft.prototype,"length",(function(){return this._length})),W(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(R("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;o1)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(;o1){if(!ue(t=arguments[1]))throw new TypeError(R("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(R("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return i[t*=2]=Ke(r),void(i[t+1]=Qe(r))}if(ot(r)){if(t+(u=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,s=i.byteOffset+t*nt,e.buffer===i.buffer&&e.byteOffsets){for(o=new Ir(e.length),l=0;lthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,s=i.byteOffset+t*nt,e.buffer===i.buffer&&e.byteOffsets){for(o=new Ir(u),l=0;lthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,l=0;lf&&(t=f)}}for(n=ro&&(t=o)}}return r>=o?(o=0,n=i.byteLength):r>=t?(o=0,n=i.byteOffset+r*nt):(o=t-r,n=i.byteOffset+r*nt),new this.constructor(i.buffer,n,o<0?0:o)})),W(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=o)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!We(t))throw new TypeError(R("invalid argument. Second argument must be a complex number. Value: `%s`.",t));return(n=(i=new this.constructor(this._buffer))._buffer)[2*r]=Ke(t),n[2*r+1]=Qe(t),i})),W(lt,"BYTES_PER_ELEMENT",8),W(lt.prototype,"BYTES_PER_ELEMENT",8),W(lt.prototype,"byteLength",16),W(lt.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),W(lt.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var pt=2*jr.BYTES_PER_ELEMENT,yt=ze();function mt(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,t,i,o;if(t=arguments.length,!(this instanceof vt))return 0===t?new vt:1===t?new vt(arguments[0]):2===t?new vt(arguments[0],arguments[1]):new vt(arguments[0],arguments[1],arguments[2]);if(0===t)i=new jr(0);else if(1===t)if(ue(arguments[0]))i=new jr(2*arguments[0]);else if(n(arguments[0]))if((o=(i=arguments[0]).length)&&vr(i)&&We(i[0])){if(i=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;ii.byteLength-r)throw new RangeError(R("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",o*pt));i=new jr(i,r,2*o)}}return W(this,"_buffer",i),W(this,"_length",i.length/2),this}W(vt,"BYTES_PER_ELEMENT",pt),W(vt,"name","Complex128Array"),W(vt,"from",(function(r){var e,t,i,o,a,u,f,l,s,c,h,p;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(i=arguments[1]))throw new TypeError(R("invalid argument. Second argument must be a function. Value: `%s`.",i));t>2&&(e=arguments[2])}if(mt(r)){if(l=r.length,i){for(a=(o=new this(l))._buffer,p=0,h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));a[p]=c[0],a[p+1]=c[1]}p+=2}return o}return new this(r)}if(n(r)){if(i){for(l=r.length,f=r.get&&r.set?mr("default"):cr("default"),h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));a[p]=c[0],a[p+1]=c[1]}p+=2}return o}return new this(r)}if(ye(r)&&yt&&Ce(r[qe])){if(!Ce((a=r[qe]()).next))throw new TypeError(R("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(u=i?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,ce(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!We(o))return new TypeError(R("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}(a,i,e):ht(a),u instanceof Error)throw u;for(a=(o=new this(l=u.length/2))._buffer,h=0;h=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})),W(vt.prototype,"BYTES_PER_ELEMENT",vt.BYTES_PER_ELEMENT),W(vt.prototype,"copyWithin",(function(r,e){if(!mt(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})),W(vt.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!mt(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,W(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}})),W(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),qe&&W(t,qe,(function(){return e.entries()})),t})),W(vt.prototype,"every",(function(r,e){var t,n;if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=o)<0&&(t=0),arguments.length>2){if(!e(n))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",n));n<0&&(n+=o)<0&&(n=0),n>o&&(n=o)}else n=o}else t=0,n=o;for(u=st(r),f=ct(r),l=t;l=0;n--)if(i=wt(t,n),r.call(e,i,n,this))return i})),W(vt.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(R("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})),W(vt.prototype,"forEach",(function(r,e){var t,n,i;if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n=this._length))return wt(this._buffer,r)})),De(vt.prototype,"length",(function(){return this._length})),W(vt.prototype,"includes",(function(r,t){var n,i,o,a,u;if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!We(r))throw new TypeError(R("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(o=st(r),a=ct(r),n=this._buffer,u=t;u1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(o=st(r),a=ct(r),n=this._buffer,u=t;u1){if(!e(t))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",t));t>=this._length?t=this._length-1:t<0&&(t+=this._length)}else t=this._length-1;for(o=st(r),a=ct(r),n=this._buffer,u=t;u>=0;u--)if(o===n[i=2*u]&&a===n[i+1])return u;return-1})),W(vt.prototype,"map",(function(r,e){var t,n,i,o,a;if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ce(r))throw new TypeError(R("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;o1)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(;o1){if(!ue(t=arguments[1]))throw new TypeError(R("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(R("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return i[t*=2]=st(r),void(i[t+1]=ct(r))}if(mt(r)){if(t+(u=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,s=i.byteOffset+t*pt,e.buffer===i.buffer&&e.byteOffsets){for(o=new jr(e.length),l=0;lthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,s=i.byteOffset+t*pt,e.buffer===i.buffer&&e.byteOffsets){for(o=new jr(u),l=0;lthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,l=0;lf&&(t=f)}}for(n=ro&&(t=o)}}return r>=o?(o=0,n=i.byteLength):r>=t?(o=0,n=i.byteOffset+r*pt):(o=t-r,n=i.byteOffset+r*pt),new this.constructor(i.buffer,n,o<0?0:o)})),W(vt.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!mt(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=o)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!We(t))throw new TypeError(R("invalid argument. Second argument must be a complex number. Value: `%s`.",t));return(n=(i=new this.constructor(this._buffer))._buffer)[2*r]=st(t),n[2*r+1]=ct(t),i}));var bt=[jr,Ir,Nr,Cr,zr,Gr,ae,Kr,te,ft,vt],dt=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],Et=dt.length;function Tt(r){var e,t=function(r){var e;if(vr(r))return"generic";if(dr(r))return null;for(e=0;e1){if(!ar(e=arguments[1]))throw new TypeError(At("1pF7f",e));if(arguments.length>2){if(!ar(t=arguments[2]))throw new TypeError(At("1pF2z",t))}else t=r.length}else e=0,t=r.length;return xt(r,e,t)}export{Vt as default};
//# sourceMappingURL=mod.js.map