// Copyright (c) 2025 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).maybeBroadcastArray=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;r0&&(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;r127)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;ei&&(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;u0?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}C(ht,"assign",(function(t,r,e,n){var i,o,a,u,f;for(i=t.length,o=e,a=e,f=0;f0?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)}C(vt,"isPrimitive",yt),C(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;C(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=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(!Bt(r))throw new TypeError(S("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!yt(e)&&!Ft(e))throw new TypeError(S("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return Ut(t,r,e)}var Ct={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 Nt="function"==typeof Uint8Array;var Pt="function"==typeof Uint8Array?Uint8Array:null;var Yt,Dt="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=(Nt&&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}()?Dt:function(){throw new Error("not implemented")};var Wt=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:Wt};(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=Ut(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 Fr(t){return Ar(t)&&Rr(t)}function Lr(t){return Sr(t)&&Rr(t.valueOf())}function Mr(t){return Fr(t)||Lr(t)}C(Ir,"isPrimitive",Ar),C(Ir,"isObject",Sr),C(Mr,"isPrimitive",Fr),C(Mr,"isObject",Lr);var Br=Number.POSITIVE_INFINITY,Ur=Vr.NEGATIVE_INFINITY,kr=Math.floor;function Cr(t){return kr(t)===t}function Nr(t){return tUr&&Cr(t)}function Pr(t){return Ar(t)&&Nr(t)}function Yr(t){return Sr(t)&&Nr(t.valueOf())}function Dr(t){return Pr(t)||Yr(t)}C(Dr,"isPrimitive",Pr),C(Dr,"isObject",Yr);var Wr=Object.prototype.propertyIsEnumerable;var Gr=!Wr.call("beep","0");function Jr(t,r){var e;return null!=t&&(!(e=Wr.call(t,r))&&Gr&&vt(t)?!Fr(r=+r)&&Pr(r)&&r>=0&&r=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&&Cr(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(;i0&&!G(t,"0"))for(u=0;u>>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}C((function(t){var r,e,n,i;return r=new Wt(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=0}function Ie(t){return Yr(t)&&t.valueOf()>=0}function Re(t){return Se(t)||Ie(t)}function Fe(t){var r,e,n;for(e=t.length,r=[],n=0;n=0;a--)t-=o=t%e[a],t/=e[a],i+=o*r[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),C(je.prototype,"set",(function(){var t,r;for(t=this._offset,r=0;r=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})),C(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=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(Ct[this.dtype],"{{data}}",t),e+=", ",e+=0===r?"[]":"[ "+this._shape.join(", ")+" ]",e+=", ",e+="[ ",0===r)e+="0";else for(o=0;o=0&&t.length<=wn}function dn(t){return"object"==typeof t&&null!==t&&!Vt(t)}function bn(t,r){if(!(this instanceof bn))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}C(bn,"BYTES_PER_ELEMENT",8),C(bn.prototype,"BYTES_PER_ELEMENT",8),C(bn.prototype,"byteLength",16),C(bn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(bn.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var _n="function"==typeof Math.fround?Math.fround:null,En=new Ge(1);var Tn="function"==typeof _n?_n:function(t){return En[0]=t,En[0]};function xn(t,r){if(!(this instanceof xn))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:Tn(t)}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Tn(r)}),this}function An(t){return t instanceof bn||t instanceof xn||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function Vn(t){return Cr(t/2)}C(xn,"BYTES_PER_ELEMENT",4),C(xn.prototype,"BYTES_PER_ELEMENT",4),C(xn.prototype,"byteLength",8),C(xn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(xn.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var jn=8;function On(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===jn}var Sn=16;function In(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Sn}function Rn(){return"function"==typeof J&&"symbol"==typeof J("foo")&&G(J,"iterator")&&"symbol"==typeof J.iterator}var Fn=Rn()?Symbol.iterator:null;function Ln(t,r){if(!(this instanceof Ln))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:Tn(t)}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Tn(r)}),this}function Mn(t){return t.re}function Bn(t){return t.im}function Un(t,r){return new Ge(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function kn(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(vn(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!An(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(Mn(n),Bn(n))}return r}C(Ln,"BYTES_PER_ELEMENT",4),C(Ln.prototype,"BYTES_PER_ELEMENT",4),C(Ln.prototype,"byteLength",8),C(Ln.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(Ln.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Nn=2*Ge.BYTES_PER_ELEMENT,Pn=Rn();function Yn(t){return t instanceof Gn||"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===Gn||"Complex128Array"===t.name}function Wn(t,r){return new Ln(t[r*=2],t[r+1])}function Gn(){var t,r,e,n;if(r=arguments.length,!(this instanceof Gn))return 0===r?new Gn:1===r?new Gn(arguments[0]):2===r?new Gn(arguments[0],arguments[1]):new Gn(arguments[0],arguments[1],arguments[2]);if(0===r)e=new Ge(0);else if(1===r)if(Se(arguments[0]))e=new Ge(2*arguments[0]);else if(Kr(arguments[0]))if((n=(e=arguments[0]).length)&&Vt(e)&&An(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;ie.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*Nn));e=new Ge(e,t,2*n)}}return C(this,"_buffer",e),C(this,"_length",e.length/2),this}function Jn(t,r){if(!(this instanceof Jn))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 $n(t){return t.re}function zn(t){return t.im}function Xn(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(vn(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!An(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($n(n),zn(n))}return r}C(Gn,"BYTES_PER_ELEMENT",Nn),C(Gn,"name","Complex64Array"),C(Gn,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Ft(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(!Ft(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Yn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=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?Ue("default"):Ce("default"),h=0;h=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(dn(t)&&Pn&&Ft(t[Fn])){if(!Ft((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,vn(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!An(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(Mn(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=this._length))return Wn(this._buffer,t)})),ot(Gn.prototype,"buffer",(function(){return this._buffer.buffer})),ot(Gn.prototype,"byteLength",(function(){return this._buffer.byteLength})),ot(Gn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(Gn.prototype,"BYTES_PER_ELEMENT",Gn.BYTES_PER_ELEMENT),C(Gn.prototype,"copyWithin",(function(t,r){if(!Yn(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})),C(Gn.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Yn(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,C(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Ln(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),C(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Fn&&C(e,Fn,(function(){return r.entries()})),e})),C(Gn.prototype,"every",(function(t,r){var e,n;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!Cr(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(!Cr(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=Mn(t),u=Bn(t),f=r;f=0;n--)if(i=Wn(e,n),t.call(r,i,n,this))return i})),C(Gn.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(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=Wn(e,n),t.call(r,i,n,this))return n;return-1})),C(Gn.prototype,"forEach",(function(t,r){var e,n,i;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(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))return Wn(this._buffer,t)})),C(Gn.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!An(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Cr(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=Mn(t),o=Bn(t),e=this._buffer,a=r;a1){if(!Cr(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=Mn(t),o=Bn(t),e=this._buffer,a=r;a1){if(!Cr(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=Mn(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(Gn.prototype,"length",(function(){return this._length})),C(Gn.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(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;o1)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=Wn(e,0),o=1}for(;o1){if(!Se(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(An(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=Mn(t),void(n[e+1]=Bn(t))}if(Yn(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*Nn,r.buffer===n.buffer&&r.byteOffsets){for(i=new Ge(r.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*Nn,r.buffer===n.buffer&&r.byteOffsets){for(i=new Ge(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;fu&&(r=u)}}for(e=ti&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*Nn):(i=r-t,e=n.byteOffset+t*Nn),new this.constructor(n.buffer,e,i<0?0:i)})),C(Gn.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Yn(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=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!An(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]=Mn(r),e[2*t+1]=Bn(r),n})),C(Jn,"BYTES_PER_ELEMENT",8),C(Jn.prototype,"BYTES_PER_ELEMENT",8),C(Jn.prototype,"byteLength",16),C(Jn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(Jn.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Zn=2*ir.BYTES_PER_ELEMENT,Hn=Rn();function qn(t){return t instanceof ti||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Kn(t){return t===ti||"Complex64Array"===t.name}function Qn(t,r){return new Jn(t[r*=2],t[r+1])}function ti(){var t,r,e,n;if(r=arguments.length,!(this instanceof ti))return 0===r?new ti:1===r?new ti(arguments[0]):2===r?new ti(arguments[0],arguments[1]):new ti(arguments[0],arguments[1],arguments[2]);if(0===r)e=new ir(0);else if(1===r)if(Se(arguments[0]))e=new ir(2*arguments[0]);else if(Kr(arguments[0]))if((n=(e=arguments[0]).length)&&Vt(e)&&An(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;ie.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*Zn));e=new ir(e,t,2*n)}}return C(this,"_buffer",e),C(this,"_length",e.length/2),this}C(ti,"BYTES_PER_ELEMENT",Zn),C(ti,"name","Complex128Array"),C(ti,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Ft(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Ft(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(qn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=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?Ue("default"):Ce("default"),h=0;h=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(dn(t)&&Hn&&Ft(t[Fn])){if(!Ft((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,vn(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!An(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($n(o),zn(o))}return n}(o,n,r):Xn(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Qn(this._buffer,t)})),ot(ti.prototype,"buffer",(function(){return this._buffer.buffer})),ot(ti.prototype,"byteLength",(function(){return this._buffer.byteLength})),ot(ti.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(ti.prototype,"BYTES_PER_ELEMENT",ti.BYTES_PER_ELEMENT),C(ti.prototype,"copyWithin",(function(t,r){if(!qn(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})),C(ti.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!qn(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,C(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Jn(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),C(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Fn&&C(e,Fn,(function(){return r.entries()})),e})),C(ti.prototype,"every",(function(t,r){var e,n;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!Cr(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(!Cr(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=$n(t),u=zn(t),f=r;f=0;n--)if(i=Qn(e,n),t.call(r,i,n,this))return i})),C(ti.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(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=Qn(e,n),t.call(r,i,n,this))return n;return-1})),C(ti.prototype,"forEach",(function(t,r){var e,n,i;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(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))return Qn(this._buffer,t)})),ot(ti.prototype,"length",(function(){return this._length})),C(ti.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!An(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Cr(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=$n(t),o=zn(t),e=this._buffer,a=r;a1){if(!Cr(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=$n(t),o=zn(t),e=this._buffer,a=r;a1){if(!Cr(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=$n(t),o=zn(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),C(ti.prototype,"map",(function(t,r){var e,n,i,o,a;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ft(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;o1)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=Qn(e,0),o=1}for(;o1){if(!Se(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(An(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=$n(t),void(n[e+1]=zn(t))}if(qn(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*Zn,r.buffer===n.buffer&&r.byteOffsets){for(i=new ir(r.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*Zn,r.buffer===n.buffer&&r.byteOffsets){for(i=new ir(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;fu&&(r=u)}}for(e=ti&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*Zn):(i=r-t,e=n.byteOffset+t*Zn),new this.constructor(n.buffer,e,i<0?0:i)})),C(ti.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!qn(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=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!An(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]=$n(r),e[2*t+1]=zn(r),n}));var ri=[ir,Ge,tn,Ze,an,Zt,gn,Wt,hn,Gn,ti],ei=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],ni=ei.length;function ii(t){var r;if(Vt(t))return"generic";if(St(t))return null;for(r=0;r0&&r.push("generic"),r)}function si(){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}}C(fi,"enum",si),function(t,r){var e,n,i;for(e=ue(r),i=0;i=0;i--)e[i]=n,n*=t[i];return e}(t)}function gi(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]:(yi(e=t.order)||(e="row-major"),mi(n,e))}for(r=[],a=0;a=0;n--)r[n]=e,e*=t[n];return r}(t,e)}));var wi="row-major",vi="column-major";function di(t){var r;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return yi(r=t.order)?r:1===(r=ft(gi(t)))||3===r?wi:2===r?vi: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(Se(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)?wi:null}function bi(t,r){var e,n,i,o,a,u,f,s,l;if(!Oe(t))throw new TypeError(S("invalid argument. First argument must be an ndarray. Value: `%s`.",t));if(!Kr(r))throw new TypeError(S("invalid argument. Second argument must be an array of nonnegative integers. Value: `%s`.",r));if((a=r.length)<(u=(i=hi(t)).length))throw new Error("invalid argument. Cannot broadcast an array to a shape having fewer dimensions. Arrays can only be broadcasted to shapes having the same or more dimensions.");for(e=[],s=0;s=0;s--)if(!((l=u-a+s)<0)){if(f=i[l],!Se(n=r[s]))throw new TypeError(S("invalid argument. Second argument must be an array of nonnegative integers. Value: `%s`.","["+r.join(",")+"]"));if(0!==n&&n