// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 /// var t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function r(){return t&&"symbol"==typeof Symbol.toStringTag}var e=Object.prototype.toString;var n=Object.prototype.hasOwnProperty;function i(t,r){return null!=t&&n.call(t,r)}var o="function"==typeof Symbol?Symbol:void 0,a="function"==typeof o?o.toStringTag:"";var u=r()?function(t){var r,n,o;if(null==t)return e.call(t);n=t[a],r=i(t,a);try{t[a]=void 0}catch(r){return e.call(t)}return o=e.call(t),r?t[a]=n:delete t[a],o}:function(t){return e.call(t)};var f=Array.isArray?Array.isArray:function(t){return"[object Array]"===u(t)};function s(t){return"object"==typeof t&&null!==t&&!f(t)}var l=/./,h="function"==typeof Object.defineProperty?Object.defineProperty:null;var c=Object.defineProperty;function p(t){return"number"==typeof t}function g(t){var r,e="";for(r=0;r0&&(r-=1),e=n.toExponential(r)):e=n.toPrecision(t.precision),t.alternate||(e=E.call(e,V,"$1e"),e=E.call(e,O,"e"),e=E.call(e,S,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return e=E.call(e,T,"e+0$1"),e=E.call(e,A,"e-0$1"),t.alternate&&(e=E.call(e,x,"$1."),e=E.call(e,R,"$1.e")),n>=0&&t.sign&&(e=t.sign+e),e=t.specifier===_.call(t.specifier)?_.call(e):b.call(e)}function j(t){var r,e="";for(r=0;r127)throw new Error("invalid character code. Value: "+n.arg);n.arg=L(o)?String(n.arg):U(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":r||(n.precision=6),n.arg=I(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=y(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(l=n.arg,h=n.width,c=n.padRight,p=void 0,(p=h-l.length)<0?l:l=c?l+j(p):j(p)+l)),a+=n.arg||"",u+=1}return a}var C=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function M(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 N(t){var r,e,n,i;for(e=[],i=0,n=C.exec(t);n;)(r=t.slice(i,C.lastIndex-n[0].length)).length&&e.push(r),e.push(M(n)),i=C.lastIndex,n=C.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function k(t){var r,e;if("string"!=typeof t)throw new TypeError(k("invalid argument. First argument must be a string. Value: `%s`.",t));for(r=[N(t)],e=1;ejt&&Bt(t)}function Pt(t){return At(t)&&Lt(t)}function Ft(t){return Ot(t)&&Lt(t.valueOf())}function Ct(t){return Pt(t)||Ft(t)}Z(Ct,"isPrimitive",Pt),Z(Ct,"isObject",Ft);var Mt=ut();function Nt(t,r,e){X(t,r,{configurable:!1,enumerable:!1,get:e})}var kt={binary:1,bool:1,complex64:8,complex128:16,float16:2,bfloat16:2,float32:4,float64:8,float128:16,generic:null,int8:1,int16:2,int32:4,int64:8,int128:16,int256:32,uint8:1,uint8c:1,uint16:2,uint32:4,uint64:8,uint128:16,uint256:32};function Yt(t){return Math.abs(t)}function Dt(t){var r,e,n,i,o,a;if(0===(e=t.length))return 0;for(r=!0,n=!0,i=Yt(t[0]),a=1;ai&&(n=!1),!n&&!r)return 0;i=o}return n&&r?3:n?1:2}function Jt(t,r){return r&&(2===t||3===t)}function Wt(t,r){return r&&(1===t||3===t)}function zt(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 Gt(t){return t.re}function $t(t){return t.im}function Xt(t){return"string"==typeof t}Z(zt,"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 Zt=String.prototype.valueOf;var Ht=r();function qt(t){return"object"==typeof t&&(t instanceof String||(Ht?function(t){try{return Zt.call(t),!0}catch(t){return!1}}(t):"[object String]"===u(t)))}function Kt(t){return Xt(t)||qt(t)}Z(Kt,"isPrimitive",Xt),Z(Kt,"isObject",qt);var Qt=/[-\/\\^$*+?.()|[\]{}]/g;var tr=RegExp.prototype.exec;var rr=r();function er(t){return"object"==typeof t&&(t instanceof RegExp||(rr?function(t){try{return tr.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===u(t)))}function nr(t,r,e){return t.replace(r,e)}function ir(t,r,e){if(!Xt(t))throw new TypeError(k("invalid argument. First argument must be a string. Value: `%s`.",t));if(Xt(r))r=new RegExp(function(t){var r,e;if(!Xt(t))throw new TypeError(k("invalid argument. Must provide a regular expression string. Value: `%s`.",t));if("/"===t[0])for(e=t.length-1;e>=0&&"/"!==t[e];e--);return void 0===e||e<=0?t.replace(Qt,"\\$&"):(r=(r=t.substring(1,e)).replace(Qt,"\\$&"),t=t[0]+r+t.substring(e))}(r),"g");else if(!er(r))throw new TypeError(k("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!Xt(e)&&!wt(e))throw new TypeError(k("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return nr(t,r,e)}var or={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 ar="function"==typeof Uint8Array;var ur="function"==typeof Uint8Array?Uint8Array:null;var fr,sr="function"==typeof Uint8Array?Uint8Array:void 0;fr=function(){var t,r,e;if("function"!=typeof ur)return!1;try{r=new ur(r=[1,3.14,-3.14,256,257]),e=r,t=(ar&&e instanceof Uint8Array||"[object Uint8Array]"===u(e))&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?sr:function(){throw new Error("not implemented")};var lr=fr,hr="function"==typeof Uint16Array;var cr="function"==typeof Uint16Array?Uint16Array:null;var pr,gr="function"==typeof Uint16Array?Uint16Array:void 0;pr=function(){var t,r,e;if("function"!=typeof cr)return!1;try{r=new cr(r=[1,3.14,-3.14,65536,65537]),e=r,t=(hr&&e instanceof Uint16Array||"[object Uint16Array]"===u(e))&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?gr:function(){throw new Error("not implemented")};var yr,mr=pr,wr={uint16:mr,uint8:lr};(yr=new wr.uint16(1))[0]=4660;var vr=52===new wr.uint8(yr.buffer)[0],dr="function"==typeof ArrayBuffer;function br(t){return dr&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===u(t)}var _r="function"==typeof Float64Array;var Er="function"==typeof Float64Array?Float64Array:null;var Tr,Ar="function"==typeof Float64Array?Float64Array:void 0;Tr=function(){var t,r,e;if("function"!=typeof Er)return!1;try{r=new Er([1,3.14,-3.14,NaN]),e=r,t=(_r&&e instanceof Float64Array||"[object Float64Array]"===u(e))&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t}()?Ar:function(){throw new Error("not implemented")};var xr=Tr,Rr="function"==typeof ArrayBuffer?ArrayBuffer:null;var Sr,Or="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Sr=function(){var t,r,e;if("function"!=typeof Rr)return!1;try{(t=br(e=new Rr(16))&&"function"==typeof Rr.isView)&&((r=new xr(e))[0]=-3.14,r[1]=NaN,t=t&&Rr.isView(r)&&16===e.byteLength&&-3.14===r[0]&&r[1]!=r[1])}catch(r){t=!1}return t}()?Or:function(){throw new Error("not implemented")};var Vr=Sr,Ir="function"==typeof DataView;var jr="function"==typeof DataView?DataView:null;var Ur,Br="function"==typeof DataView?DataView:void 0;Ur=function(){var t,r,e,n;if("function"!=typeof jr)return!1;try{e=new Vr(24),r=new jr(e,8),n=r,(t=(Ir&&n instanceof DataView||"[object DataView]"===u(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}()?Br:function(){throw new Error("not implemented")};var Lr=Ur,Pr="function"==typeof BigInt?BigInt:void 0,Fr={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"]},Cr=/_and_generic$/;function Mr(){var t,r,e;return 0===arguments.length?Fr.all.slice():(e=!1,t=arguments[0],Cr.test(t)&&"all"!==(t=nr(t,Cr,""))&&(e=!0),r=(r=Fr[t])?r.slice():[],e&&r.length>0&&r.push("generic"),r)}function Nr(){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 kr(t,r,e){X(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}function Yr(t){return Object.keys(Object(t))}var Dr=void 0!==Object.keys;function Jr(t){return"[object Arguments]"===u(t)}var Wr=function(){return Jr(arguments)}();function zr(t){return t!=t}function Gr(t){return At(t)&&zr(t)}function $r(t){return Ot(t)&&zr(t.valueOf())}function Xr(t){return Gr(t)||$r(t)}Z(Xr,"isPrimitive",Gr),Z(Xr,"isObject",$r);var Zr=Object.prototype.propertyIsEnumerable;var Hr=!Zr.call("beep","0");function qr(t,r){var e;return null!=t&&(!(e=Zr.call(t,r))&&Hr&&Kt(t)?!Gr(r=+r)&&Pt(r)&&r>=0&&r=0&&t.length<=Kr&&i(t,"callee")&&!qr(t,"callee")},te=Array.prototype.slice;var re=qr((function(){}),"prototype"),ee=!qr({toString:null},"toString"),ne=9007199254740991;function ie(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Bt(t.length)&&t.length>=0&&t.length<=ne}function oe(t,r,e){var n,i;if(!ie(t)&&!Xt(t))throw new TypeError(k("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(!Pt(e))throw new TypeError(k("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(Xr(r)){for(;i0&&!i(t,"0"))for(f=0;f>>0,i=Ut(t/Ae),vr?(Re.setUint32(0,o,vr),Re.setUint32(4,i,vr)):(Re.setUint32(0,i,vr),Re.setUint32(4,o,vr)),a=0;a>>0,n=Ut(t/4294967296),e=new Lr(r.buffer),vr?(e.setUint32(0,i,vr),e.setUint32(4,n,vr)):(e.setUint32(0,n,vr),e.setUint32(4,i,vr))),r}),"assign",Se);var Oe={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},Ve=we(),Ie={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=r?e?{code:"ERR_SLICE_OUT_OF_BOUNDS"}:new Pe(r,r,1):t<0&&(t=r+t)<0?e?{code:"ERR_SLICE_OUT_OF_BOUNDS"}:new Pe(0,0,1):new Pe(t,t+1,1)}(t,r,e):function(t,r,e){var n,i,o;if(n=t.start,i=t.stop,null===(o=t.step)&&(o=1),null===n)n=o>0?0:r-1;else if(n<0){if((n=r+n)<0){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};n=0}}else if(n>=r){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};n=o<0?r-1:r}if(null===i)i=o>0?r:null;else if(i<0){if((i=r+i)<0)if(o>0){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};i=0}else{if(e&&i<-1)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};i=null}}else if(i>r){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};i=r}return new Pe(n,i,o)}(t,r,e)}function ke(t,r,e){var n,i,o,a;for(n=t.data,i=[],a=0;a=0;a--)t-=o=t%e[a],t/=e[a],i+=o*r[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),Z(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})),Z(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+=Gt(i=this.iget(this._length-1-o))+", "+$t(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(e+=ir(or[this.dtype],"{{data}}",t),e+=", ",e+=0===r?"[]":"[ "+this._shape.join(", ")+" ]",e+=", ",e+="[ ",0===r)e+="0";else for(o=0;o0&&e>=n||r<0&&e<=n?0:Ye((n-e)/r)}function Je(t){var r,e,n;for(r=t.data,e=[],n=0;n=0;i--)e[i]=n,n*=t[i];return e}(t)}Z(Ze,"assign",(function(t,r,e){return"column-major"===r?function(t,r){var e,n;for(e=1,n=0;n=0;n--)r[n]=e,e*=t[n];return r}(t,e)}));var He="row-major";var qe="row-major",Ke="column-major";function Qe(t){return t.data}var tn=[],rn=[],en="undefined"!=typeof Uint8Array?Uint8Array:Array,nn=!1;function on(){nn=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)tn[r]=t[r],rn[t.charCodeAt(r)]=r;rn["-".charCodeAt(0)]=62,rn["_".charCodeAt(0)]=63}function an(t,r,e){for(var n,i,o=[],a=r;a>18&63]+tn[i>>12&63]+tn[i>>6&63]+tn[63&i]);return o.join("")}function un(t){var r;nn||on();for(var e=t.length,n=e%3,i="",o=[],a=16383,u=0,f=e-n;uf?f:u+a));return 1===n?(r=t[e-1],i+=tn[r>>2],i+=tn[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=tn[r>>10],i+=tn[r>>4&63],i+=tn[r<<2&63],i+="="),o.push(i),o.join("")}function fn(t,r,e,n,i){var o,a,u=8*i-n-1,f=(1<>1,l=-7,h=e?i-1:0,c=e?-1:1,p=t[r+h];for(h+=c,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[r+h],h+=c,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[r+h],h+=c,l-=8);if(0===o)o=1-s;else{if(o===f)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=s}return(p?-1:1)*a*Math.pow(2,o-n)}function sn(t,r,e,n,i,o){var a,u,f,s=8*o-i-1,l=(1<>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,g=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=l):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),(r+=a+h>=1?c/f:c*Math.pow(2,1-h))*f>=2&&(a++,f/=2),a+h>=l?(u=0,a=l):a+h>=1?(u=(r*f-1)*Math.pow(2,i),a+=h):(u=r*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[e+p]=255&u,p+=g,u/=256,i-=8);for(a=a<0;t[e+p]=255&a,p+=g,a/=256,s-=8);t[e+p-g]|=128*y}var ln={}.toString,hn=Array.isArray||function(t){return"[object Array]"==ln.call(t)};yn.TYPED_ARRAY_SUPPORT=void 0===it.TYPED_ARRAY_SUPPORT||it.TYPED_ARRAY_SUPPORT;var cn=pn();function pn(){return yn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function gn(t,r){if(pn()=pn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+pn().toString(16)+" bytes");return 0|t}function _n(t){return!(null==t||!t._isBuffer)}function En(t,r){if(_n(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Zn(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return Hn(t).length;default:if(n)return Zn(t).length;r=(""+r).toLowerCase(),n=!0}}function Tn(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Mn(this,r,e);case"utf8":case"utf-8":return Ln(this,r,e);case"ascii":return Fn(this,r,e);case"latin1":case"binary":return Cn(this,r,e);case"base64":return Bn(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nn(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function An(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function xn(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=yn.from(r,n)),_n(r))return 0===r.length?-1:Rn(t,r,e,n,i);if("number"==typeof r)return r&=255,yn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Rn(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Rn(t,r,e,n,i){var o,a=1,u=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;a=2,u/=2,f/=2,e/=2}function s(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(i){var l=-1;for(o=e;ou&&(e=u-f),o=e;o>=0;o--){for(var h=!0,c=0;ci&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function Bn(t,r,e){return 0===r&&e===t.length?un(t):un(t.slice(r,e))}function Ln(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i239?4:s>223?3:s>191?2:1;if(i+h<=e)switch(h){case 1:s<128&&(l=s);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&s)<<6|63&o)>127&&(l=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&s)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(l=f);break;case 4:o=t[i+1],a=t[i+2],u=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(f=(15&s)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&f<1114112&&(l=f)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var r=t.length;if(r<=Pn)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},yn.prototype.compare=function(t,r,e,n,i){if(!_n(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(e>>>=0)-(r>>>=0),u=Math.min(o,a),f=this.slice(n,i),s=t.slice(r,e),l=0;li)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Sn(this,t,r,e);case"utf8":case"utf-8":return On(this,t,r,e);case"ascii":return Vn(this,t,r,e);case"latin1":case"binary":return In(this,t,r,e);case"base64":return jn(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Un(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},yn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Pn=4096;function Fn(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;in)&&(e=n);for(var i="",o=r;oe)throw new RangeError("Trying to access beyond buffer length")}function Yn(t,r,e,n,i,o){if(!_n(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||rt.length)throw new RangeError("Index out of range")}function Dn(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i>>8*(n?i:1-i)}function Jn(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i>>8*(n?i:3-i)&255}function Wn(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function zn(t,r,e,n,i){return i||Wn(t,0,e,4),sn(t,r,e,n,23,4),e+4}function Gn(t,r,e,n,i){return i||Wn(t,0,e,8),sn(t,r,e,n,52,8),e+8}yn.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r0&&(i*=256);)n+=this[t+--r]*i;return n},yn.prototype.readUInt8=function(t,r){return r||kn(t,1,this.length),this[t]},yn.prototype.readUInt16LE=function(t,r){return r||kn(t,2,this.length),this[t]|this[t+1]<<8},yn.prototype.readUInt16BE=function(t,r){return r||kn(t,2,this.length),this[t]<<8|this[t+1]},yn.prototype.readUInt32LE=function(t,r){return r||kn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},yn.prototype.readUInt32BE=function(t,r){return r||kn(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},yn.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||kn(t,r,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*r)),n},yn.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||kn(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},yn.prototype.readInt8=function(t,r){return r||kn(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},yn.prototype.readInt16LE=function(t,r){r||kn(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},yn.prototype.readInt16BE=function(t,r){r||kn(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},yn.prototype.readInt32LE=function(t,r){return r||kn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},yn.prototype.readInt32BE=function(t,r){return r||kn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},yn.prototype.readFloatLE=function(t,r){return r||kn(t,4,this.length),fn(this,t,!0,23,4)},yn.prototype.readFloatBE=function(t,r){return r||kn(t,4,this.length),fn(this,t,!1,23,4)},yn.prototype.readDoubleLE=function(t,r){return r||kn(t,8,this.length),fn(this,t,!0,52,8)},yn.prototype.readDoubleBE=function(t,r){return r||kn(t,8,this.length),fn(this,t,!1,52,8)},yn.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||Yn(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o=0&&(o*=256);)this[r+i]=t/o&255;return r+e},yn.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,1,255,0),yn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},yn.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,2,65535,0),yn.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Dn(this,t,r,!0),r+2},yn.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,2,65535,0),yn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Dn(this,t,r,!1),r+2},yn.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,4,4294967295,0),yn.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Jn(this,t,r,!0),r+4},yn.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,4,4294967295,0),yn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Jn(this,t,r,!1),r+4},yn.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);Yn(this,t,r,e,i-1,-i)}var o=0,a=1,u=0;for(this[r]=255&t;++o>0)-u&255;return r+e},yn.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);Yn(this,t,r,e,i-1,-i)}var o=e-1,a=1,u=0;for(this[r+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/a>>0)-u&255;return r+e},yn.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,1,127,-128),yn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},yn.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,2,32767,-32768),yn.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Dn(this,t,r,!0),r+2},yn.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,2,32767,-32768),yn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Dn(this,t,r,!1),r+2},yn.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,4,2147483647,-2147483648),yn.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Jn(this,t,r,!0),r+4},yn.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||Yn(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),yn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Jn(this,t,r,!1),r+4},yn.prototype.writeFloatLE=function(t,r,e){return zn(this,t,r,!0,e)},yn.prototype.writeFloatBE=function(t,r,e){return zn(this,t,r,!1,e)},yn.prototype.writeDoubleLE=function(t,r,e){return Gn(this,t,r,!0,e)},yn.prototype.writeDoubleBE=function(t,r,e){return Gn(this,t,r,!1,e)},yn.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r=0;--i)t[i+r]=this[i+e];else if(o<1e3||!yn.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function Hn(t){return function(t){var r,e,n,i,o,a;nn||on();var u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[u-2]?2:"="===t[u-1]?1:0,a=new en(3*u/4-o),n=o>0?u-4:u;var f=0;for(r=0,e=0;r>16&255,a[f++]=i>>8&255,a[f++]=255&i;return 2===o?(i=rn[t.charCodeAt(r)]<<2|rn[t.charCodeAt(r+1)]>>4,a[f++]=255&i):1===o&&(i=rn[t.charCodeAt(r)]<<10|rn[t.charCodeAt(r+1)]<<4|rn[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace($n,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function qn(t,r,e,n){for(var i=0;i=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Kn(t){return null!=t&&(!!t._isBuffer||Qn(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Qn(t.slice(0,0))}(t))}function Qn(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var ti=Object.freeze({__proto__:null,Buffer:yn,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),yn.alloc(+t)},isBuffer:Kn,kMaxLength:cn}),ri=yn;function ei(t){if(t.__esModule)return t;var r=t.default;if("function"==typeof r){var e=function t(){return this instanceof t?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};e.prototype=r.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var ni,ii=ei(ti).Buffer;ni=function(){var t,r;if("function"!=typeof ri)return!1;try{t=gt(r="function"==typeof ri.from?ri.from([1,2,3,4]):new ri([1,2,3,4]))&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t}()?ii:function(){throw new Error("not implemented")};var oi=ni,ai="function"==typeof Float32Array;var ui="function"==typeof Float32Array?Float32Array:null;var fi,si="function"==typeof Float32Array?Float32Array:void 0;fi=function(){var t,r,e;if("function"!=typeof ui)return!1;try{r=new ui([1,3.14,-3.14,5e40]),e=r,t=(ai&&e instanceof Float32Array||"[object Float32Array]"===u(e))&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===It}catch(r){t=!1}return t}()?si:function(){throw new Error("not implemented")};var li=fi,hi="function"==typeof Int16Array;var ci="function"==typeof Int16Array?Int16Array:null;var pi,gi="function"==typeof Int16Array?Int16Array:void 0;pi=function(){var t,r,e;if("function"!=typeof ci)return!1;try{r=new ci([1,3.14,-3.14,32768]),e=r,t=(hi&&e instanceof Int16Array||"[object Int16Array]"===u(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t}()?gi:function(){throw new Error("not implemented")};var yi=pi,mi="function"==typeof Int32Array;var wi="function"==typeof Int32Array?Int32Array:null;var vi,di="function"==typeof Int32Array?Int32Array:void 0;vi=function(){var t,r,e;if("function"!=typeof wi)return!1;try{r=new wi([1,3.14,-3.14,2147483648]),e=r,t=(mi&&e instanceof Int32Array||"[object Int32Array]"===u(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t}()?di:function(){throw new Error("not implemented")};var bi=vi,_i="function"==typeof Int8Array;var Ei="function"==typeof Int8Array?Int8Array:null;var Ti,Ai="function"==typeof Int8Array?Int8Array:void 0;Ti=function(){var t,r,e;if("function"!=typeof Ei)return!1;try{r=new Ei([1,3.14,-3.14,128]),e=r,t=(_i&&e instanceof Int8Array||"[object Int8Array]"===u(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t}()?Ai:function(){throw new Error("not implemented")};var xi=Ti,Ri="function"==typeof Uint32Array;var Si="function"==typeof Uint32Array?Uint32Array:null;var Oi,Vi="function"==typeof Uint32Array?Uint32Array:void 0;Oi=function(){var t,r,e;if("function"!=typeof Si)return!1;try{r=new Si(r=[1,3.14,-3.14,4294967296,4294967297]),e=r,t=(Ri&&e instanceof Uint32Array||"[object Uint32Array]"===u(e))&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?Vi:function(){throw new Error("not implemented")};var Ii=Oi,ji="function"==typeof Uint8ClampedArray;var Ui="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var Bi,Li="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;Bi=function(){var t,r,e;if("function"!=typeof Ui)return!1;try{r=new Ui([-1,0,1,3.14,4.99,255,256]),e=r,t=(ji&&e instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===u(e))&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t}()?Li:function(){throw new Error("not implemented")};var Pi=Bi;function Fi(t){return Pt(t)&&t>=0}function Ci(t){return Ft(t)&&t.valueOf()>=0}function Mi(t){return Fi(t)||Ci(t)}Z(Mi,"isPrimitive",Fi),Z(Mi,"isObject",Ci);var Ni=4294967295;function ki(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Bt(t.length)&&t.length>=0&&t.length<=Ni}function Yi(t,r){if(!(this instanceof Yi))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!At(t))throw new TypeError(k("invalid argument. Real component must be a number. Value: `%s`.",t));if(!At(r))throw new TypeError(k("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return X(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),X(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}Z(Yi,"BYTES_PER_ELEMENT",8),Z(Yi.prototype,"BYTES_PER_ELEMENT",8),Z(Yi.prototype,"byteLength",16),Z(Yi.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),Z(Yi.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Di="function"==typeof Math.fround?Math.fround:null,Ji=new li(1);var Wi="function"==typeof Di?Di:function(t){return Ji[0]=t,Ji[0]};function zi(t,r){if(!(this instanceof zi))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!At(t))throw new TypeError(k("invalid argument. Real component must be a number. Value: `%s`.",t));if(!At(r))throw new TypeError(k("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return X(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Wi(t)}),X(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Wi(r)}),this}function Gi(t){return t instanceof Yi||t instanceof zi||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function $i(t){return Bt(t/2)}Z(zi,"BYTES_PER_ELEMENT",4),Z(zi.prototype,"BYTES_PER_ELEMENT",4),Z(zi.prototype,"byteLength",8),Z(zi.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),Z(zi.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Xi=8;function Zi(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Xi}var Hi=16;function qi(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Hi}function Ki(){return"function"==typeof o&&"symbol"==typeof o("foo")&&i(o,"iterator")&&"symbol"==typeof o.iterator}var Qi=Ki()?Symbol.iterator:null;function to(t,r){if(!(this instanceof to))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!At(t))throw new TypeError(k("invalid argument. Real component must be a number. Value: `%s`.",t));if(!At(r))throw new TypeError(k("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return X(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Wi(t)}),X(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Wi(r)}),this}function ro(t){return t.re}function eo(t){return t.im}function no(t,r){return new li(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function io(t,r){return new xr(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}Z(to,"BYTES_PER_ELEMENT",4),Z(to.prototype,"BYTES_PER_ELEMENT",4),Z(to.prototype,"byteLength",8),Z(to.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),Z(to.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var oo={float64:function(t,r){return t[r]},float32:function(t,r){return t[r]},int32:function(t,r){return t[r]},int16:function(t,r){return t[r]},int8:function(t,r){return t[r]},uint32:function(t,r){return t[r]},uint16:function(t,r){return t[r]},uint8:function(t,r){return t[r]},uint8c:function(t,r){return t[r]},generic:function(t,r){return t[r]},default:function(t,r){return t[r]}};function ao(t){var r=oo[t];return"function"==typeof r?r:oo.default}var uo={complex128:function(t,r){return t.get(r)},complex64:function(t,r){return t.get(r)},default:function(t,r){return t.get(r)}};function fo(t){var r=uo[t];return"function"==typeof r?r:uo.default}function so(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(ki(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Gi(n))return new TypeError(k("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(ro(n),eo(n))}return r}var lo=2*li.BYTES_PER_ELEMENT,ho=Ki();function co(t){return t instanceof yo||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function po(t){return t===yo||"Complex128Array"===t.name}function go(t,r){return new to(t[r*=2],t[r+1])}function yo(){var t,r,e,n;if(r=arguments.length,!(this instanceof yo))return 0===r?new yo:1===r?new yo(arguments[0]):2===r?new yo(arguments[0],arguments[1]):new yo(arguments[0],arguments[1],arguments[2]);if(0===r)e=new li(0);else if(1===r)if(Fi(arguments[0]))e=new li(2*arguments[0]);else if(ie(arguments[0]))if((n=(e=arguments[0]).length)&&f(e)&&Gi(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(k("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*lo));e=new li(e,t,2*n)}}return Z(this,"_buffer",e),Z(this,"_length",e.length/2),this}function mo(t,r){if(!(this instanceof mo))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!At(t))throw new TypeError(k("invalid argument. Real component must be a number. Value: `%s`.",t));if(!At(r))throw new TypeError(k("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return X(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),X(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}function wo(t){return t.re}function vo(t){return t.im}function bo(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(ki(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Gi(n))return new TypeError(k("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(wo(n),vo(n))}return r}Z(yo,"BYTES_PER_ELEMENT",lo),Z(yo,"name","Complex64Array"),Z(yo,"from",(function(t){var r,e,n,i,o,a,u,f,l,h,c,p;if(!wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!po(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!wt(n=arguments[1]))throw new TypeError(k("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(co(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,p=0,c=0;c=2))throw new TypeError(k("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",h));o[p]=h[0],o[p+1]=h[1]}p+=2}return i}return new this(t)}if(ie(t)){if(n){for(f=t.length,u=t.get&&t.set?fo("default"):ao("default"),c=0;c=2))throw new TypeError(k("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",h));o[p]=h[0],o[p+1]=h[1]}p+=2}return i}return new this(t)}if(s(t)&&ho&&wt(t[Qi])){if(!wt((o=t[Qi]()).next))throw new TypeError(k("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,ki(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Gi(o))return new TypeError(k("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(ro(o),eo(o))}return n}(o,n,r):so(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c=this._length))return go(this._buffer,t)})),Nt(yo.prototype,"buffer",(function(){return this._buffer.buffer})),Nt(yo.prototype,"byteLength",(function(){return this._buffer.byteLength})),Nt(yo.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),Z(yo.prototype,"BYTES_PER_ELEMENT",yo.BYTES_PER_ELEMENT),Z(yo.prototype,"copyWithin",(function(t,r){if(!co(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})),Z(yo.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!co(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,Z(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new to(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),Z(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qi&&Z(e,Qi,(function(){return r.entries()})),e})),Z(yo.prototype,"every",(function(t,r){var e,n;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!Bt(r))throw new TypeError(k("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Bt(e))throw new TypeError(k("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=ro(t),u=eo(t),f=r;f=0;n--)if(i=go(e,n),t.call(r,i,n,this))return i})),Z(yo.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=go(e,n),t.call(r,i,n,this))return n;return-1})),Z(yo.prototype,"forEach",(function(t,r){var e,n,i;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return go(this._buffer,t)})),Z(yo.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Gi(t))throw new TypeError(k("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Bt(r))throw new TypeError(k("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=ro(t),o=eo(t),e=this._buffer,a=r;a1){if(!Bt(r))throw new TypeError(k("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=ro(t),o=eo(t),e=this._buffer,a=r;a1){if(!Bt(r))throw new TypeError(k("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=ro(t),o=eo(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),Nt(yo.prototype,"length",(function(){return this._length})),Z(yo.prototype,"map",(function(t,r){var e,n,i,o,a;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("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=go(e,0),o=1}for(;o1){if(!Fi(e=arguments[1]))throw new TypeError(k("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(Gi(t)){if(e>=this._length)throw new RangeError(k("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=ro(t),void(n[e+1]=eo(t))}if(co(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*lo,r.buffer===n.buffer&&r.byteOffsets){for(i=new li(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*lo,r.buffer===n.buffer&&r.byteOffsets){for(i=new li(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*lo):(i=r-t,e=n.byteOffset+t*lo),new this.constructor(n.buffer,e,i<0?0:i)})),Z(yo.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!co(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(k("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!Gi(r))throw new TypeError(k("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=ro(r),e[2*t+1]=eo(r),n})),Z(mo,"BYTES_PER_ELEMENT",8),Z(mo.prototype,"BYTES_PER_ELEMENT",8),Z(mo.prototype,"byteLength",16),Z(mo.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),Z(mo.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var _o=2*xr.BYTES_PER_ELEMENT,Eo=Ki();function To(t){return t instanceof Ro||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Ao(t){return t===Ro||"Complex64Array"===t.name}function xo(t,r){return new mo(t[r*=2],t[r+1])}function Ro(){var t,r,e,n;if(r=arguments.length,!(this instanceof Ro))return 0===r?new Ro:1===r?new Ro(arguments[0]):2===r?new Ro(arguments[0],arguments[1]):new Ro(arguments[0],arguments[1],arguments[2]);if(0===r)e=new xr(0);else if(1===r)if(Fi(arguments[0]))e=new xr(2*arguments[0]);else if(ie(arguments[0]))if((n=(e=arguments[0]).length)&&f(e)&&Gi(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(k("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*_o));e=new xr(e,t,2*n)}}return Z(this,"_buffer",e),Z(this,"_length",e.length/2),this}Z(Ro,"BYTES_PER_ELEMENT",_o),Z(Ro,"name","Complex128Array"),Z(Ro,"from",(function(t){var r,e,n,i,o,a,u,f,l,h,c,p;if(!wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Ao(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!wt(n=arguments[1]))throw new TypeError(k("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(To(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,p=0,c=0;c=2))throw new TypeError(k("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",h));o[p]=h[0],o[p+1]=h[1]}p+=2}return i}return new this(t)}if(ie(t)){if(n){for(f=t.length,u=t.get&&t.set?fo("default"):ao("default"),c=0;c=2))throw new TypeError(k("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",h));o[p]=h[0],o[p+1]=h[1]}p+=2}return i}return new this(t)}if(s(t)&&Eo&&wt(t[Qi])){if(!wt((o=t[Qi]()).next))throw new TypeError(k("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,ki(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Gi(o))return new TypeError(k("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(wo(o),vo(o))}return n}(o,n,r):bo(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c=this._length))return xo(this._buffer,t)})),Nt(Ro.prototype,"buffer",(function(){return this._buffer.buffer})),Nt(Ro.prototype,"byteLength",(function(){return this._buffer.byteLength})),Nt(Ro.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),Z(Ro.prototype,"BYTES_PER_ELEMENT",Ro.BYTES_PER_ELEMENT),Z(Ro.prototype,"copyWithin",(function(t,r){if(!To(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})),Z(Ro.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!To(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,Z(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new mo(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),Z(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qi&&Z(e,Qi,(function(){return r.entries()})),e})),Z(Ro.prototype,"every",(function(t,r){var e,n;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!Bt(r))throw new TypeError(k("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Bt(e))throw new TypeError(k("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=wo(t),u=vo(t),f=r;f=0;n--)if(i=xo(e,n),t.call(r,i,n,this))return i})),Z(Ro.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=xo(e,n),t.call(r,i,n,this))return n;return-1})),Z(Ro.prototype,"forEach",(function(t,r){var e,n,i;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return xo(this._buffer,t)})),Nt(Ro.prototype,"length",(function(){return this._length})),Z(Ro.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Gi(t))throw new TypeError(k("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Bt(r))throw new TypeError(k("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=wo(t),o=vo(t),e=this._buffer,a=r;a1){if(!Bt(r))throw new TypeError(k("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=wo(t),o=vo(t),e=this._buffer,a=r;a1){if(!Bt(r))throw new TypeError(k("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=wo(t),o=vo(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),Z(Ro.prototype,"map",(function(t,r){var e,n,i,o,a;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(k("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=xo(e,0),o=1}for(;o1){if(!Fi(e=arguments[1]))throw new TypeError(k("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(Gi(t)){if(e>=this._length)throw new RangeError(k("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=wo(t),void(n[e+1]=vo(t))}if(To(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*_o,r.buffer===n.buffer&&r.byteOffsets){for(i=new xr(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*_o,r.buffer===n.buffer&&r.byteOffsets){for(i=new xr(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*_o):(i=r-t,e=n.byteOffset+t*_o),new this.constructor(n.buffer,e,i<0?0:i)})),Z(Ro.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!To(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(k("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!Gi(r))throw new TypeError(k("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=wo(r),e[2*t+1]=vo(r),n}));var So={binary:oi,float64:xr,float32:li,generic:Array,int16:yi,int32:bi,int8:xi,uint16:mr,uint32:Ii,uint8:lr,uint8c:Pi,complex64:yo,complex128:Ro};var Oo=wt(oi.allocUnsafe)?function(t){if(!Mi(t))throw new TypeError(k("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return oi.allocUnsafe(t)}:function(t){if(!Mi(t))throw new TypeError(k("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return new oi(t)};function Vo(t,r){var e=function(t){return So[t]||null}(t);return e?new e(r):null}function Io(t,r){return"generic"===t?function(t){var r,e;for(r=[],e=0;e0&&(c=Ge(c.length))}else c=Je(p);return 0===$e(c)?function(t,r,e,n,i){var o,a;return o=0===(a=e.length)?[0]:Ge(a),new t(r,Io(r,0),e,o,0,n,{readonly:i})}(h,a,We(c,s),f,!n):(o=function(t,r,e){var n,i,o;for(n=t.data,i=e,o=0;o3){if(!Tt(n=arguments[3]))throw new TypeError(Uo("1lV2V",n));if(i(n,"strict")){if(!H(n.strict))throw new TypeError(Uo("1lV2o","strict",n.strict));o.strict=n.strict}}return function(t,r,e,n,i){var o,a,u,f,s;if(a=function(t){var r=t.ndims;return"number"==typeof r?r:t.shape.length}(t),0===a)throw new TypeError(k("invalid argument. First argument must be an ndarray having one or more dimensions. Number of dimensions: %d.",a));if(s=a-1,-1===(u=(f=r)<0?(f+=s+1)<0?-1:f:f>s?-1:f))throw new RangeError(k("invalid argument. Dimension index exceeds the number of dimensions. Number of dimensions: %d. Value: `%d`.",a,r));return(o=ze(null,a))[u]=new Pe(e),jo(t,Me(o),n,i)}(t,r,e,o.strict,!1)}export{Bo as default}; //# sourceMappingURL=mod.js.map