-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.js
4 lines (4 loc) · 121 KB
/
mod.js
1
2
3
4
// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
/// <reference types="./mod.d.ts" />
var t=Object.prototype.hasOwnProperty;function r(r,e){return null!=r&&t.call(r,e)}var e="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function n(){return e&&"symbol"==typeof Symbol.toStringTag}var i=Object.prototype.toString;var o="function"==typeof Symbol?Symbol:void 0,a="function"==typeof o?o.toStringTag:"";var u=n()?function(t){var e,n,o;if(null==t)return i.call(t);n=t[a],e=r(t,a);try{t[a]=void 0}catch(r){return i.call(t)}return o=i.call(t),e?t[a]=n:delete t[a],o}:function(t){return i.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=/./,c="function"==typeof Object.defineProperty?Object.defineProperty:null;var h=Object.defineProperty;function p(t){return"number"==typeof t}function g(t){var r,e="";for(r=0;r<t;r++)e+="0";return e}function y(t,r,e){var n=!1,i=r-t.length;return i<0||(function(t){return"-"===t[0]}(t)&&(n=!0,t=t.substr(1)),t=e?t+g(i):g(i)+t,n&&(t="-"+t)),t}var m=String.prototype.toLowerCase,d=String.prototype.toUpperCase;function w(t){var r,e,n;switch(t.specifier){case"b":r=2;break;case"o":r=8;break;case"x":case"X":r=16;break;default:r=10}if(e=t.arg,n=parseInt(e,10),!isFinite(n)){if(!p(e))throw new Error("invalid integer. Value: "+e);n=0}return n<0&&("u"===t.specifier||10!==r)&&(n=4294967295+n+1),n<0?(e=(-n).toString(r),t.precision&&(e=y(e,t.precision,t.padRight)),e="-"+e):(e=n.toString(r),n||t.precision?t.precision&&(e=y(e,t.precision,t.padRight)):e="",t.sign&&(e=t.sign+e)),16===r&&(t.alternate&&(e="0x"+e),e=t.specifier===d.call(t.specifier)?d.call(e):m.call(e)),8===r&&t.alternate&&"0"!==e.charAt(0)&&(e="0"+e),e}var v=Math.abs,b=String.prototype.toLowerCase,_=String.prototype.toUpperCase,E=String.prototype.replace,T=/e\+(\d)$/,x=/e-(\d)$/,A=/^(\d+)$/,R=/^(\d+)e/,V=/\.0$/,O=/\.0*e/,j=/(\..*[^0])0*e/;function S(t){var r,e,n=parseFloat(t.arg);if(!isFinite(n)){if(!p(t.arg))throw new Error("invalid floating-point number. Value: "+e);n=t.arg}switch(t.specifier){case"e":case"E":e=n.toExponential(t.precision);break;case"f":case"F":e=n.toFixed(t.precision);break;case"g":case"G":v(n)<1e-4?((r=t.precision)>0&&(r-=1),e=n.toExponential(r)):e=n.toPrecision(t.precision),t.alternate||(e=E.call(e,j,"$1e"),e=E.call(e,O,"e"),e=E.call(e,V,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return e=E.call(e,T,"e+0$1"),e=E.call(e,x,"e-0$1"),t.alternate&&(e=E.call(e,A,"$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 I(t){var r,e="";for(r=0;r<t;r++)e+=" ";return e}var U=String.fromCharCode,B=isNaN,P=Array.isArray;function L(t){var r={};return r.specifier=t.specifier,r.precision=void 0===t.precision?1:t.precision,r.width=t.width,r.flags=t.flags||"",r.mapping=t.mapping,r}function M(t){var r,e,n,i,o,a,u,f,s,l,c,h,p;if(!P(t))throw new TypeError("invalid argument. First argument must be an array. Value: `"+t+"`.");for(a="",u=1,f=0;f<t.length;f++)if(n=t[f],"string"==typeof n)a+=n;else{if(r=void 0!==n.precision,!(n=L(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+f+"`. Value: `"+n+"`.");for(n.mapping&&(u=n.mapping),e=n.flags,s=0;s<e.length;s++)switch(i=e.charAt(s)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=e.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+i)}if("*"===n.width){if(n.width=parseInt(arguments[u],10),u+=1,B(n.width))throw new TypeError("the argument for * width at position "+u+" is not a number. Value: `"+n.width+"`.");n.width<0&&(n.padRight=!0,n.width=-n.width)}if(r&&"*"===n.precision){if(n.precision=parseInt(arguments[u],10),u+=1,B(n.precision))throw new TypeError("the argument for * precision at position "+u+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,r=!1)}switch(n.arg=arguments[u],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":r&&(n.padZeros=!1),n.arg=w(n);break;case"s":n.maxWidth=r?n.precision:-1;break;case"c":if(!B(n.arg)){if((o=parseInt(n.arg,10))<0||o>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=B(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=S(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,c=n.width,h=n.padRight,p=void 0,(p=c-l.length)<0?l:l=h?l+I(p):I(p)+l)),a+=n.arg||"",u+=1}return a}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function C(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 k(t){var r,e,n,i;for(e=[],i=0,n=F.exec(t);n;)(r=t.slice(i,F.lastIndex-n[0].length)).length&&e.push(r),e.push(C(n)),i=F.lastIndex,n=F.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function N(t){var r,e;if("string"!=typeof t)throw new TypeError(N("invalid argument. First argument must be a string. Value: `%s`.",t));for(r=[k(t)],e=1;e<arguments.length;e++)r.push(arguments[e]);return M.apply(null,r)}var Y,D=Object.prototype,z=D.toString,W=D.__defineGetter__,G=D.__defineSetter__,J=D.__lookupGetter__,$=D.__lookupSetter__;Y=function(){try{return c({},"x",{}),!0}catch(t){return!1}}()?h:function(t,r,e){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===z.call(t))throw new TypeError(N("invalid argument. First argument must be an object. Value: `%s`.",t));if("object"!=typeof e||null===e||"[object Array]"===z.call(e))throw new TypeError(N("invalid argument. Property descriptor must be an object. Value: `%s`.",e));if((i="value"in e)&&(J.call(t,r)||$.call(t,r)?(n=t.__proto__,t.__proto__=D,delete t[r],t[r]=e.value,t.__proto__=n):t[r]=e.value),o="get"in e,a="set"in e,i&&(o||a))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&W&&W.call(t,r,e.get),a&&G&&G.call(t,r,e.set),t};var X=Y;function q(t,r,e){X(t,r,{configurable:!1,enumerable:!1,writable:!1,value:e})}function Z(t){return"boolean"==typeof t}var H=Boolean,K=Boolean.prototype.toString;var Q=n();function tt(t){return"object"==typeof t&&(t instanceof H||(Q?function(t){try{return K.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===u(t)))}function rt(t){return Z(t)||tt(t)}q(rt,"isPrimitive",Z),q(rt,"isObject",tt);var et="object"==typeof self?self:null,nt="object"==typeof window?window:null,it="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ot="object"==typeof it?it:null,at="object"==typeof globalThis?globalThis:null;function ut(t){if(arguments.length){if(!Z(t))throw new TypeError(N("invalid argument. Must provide a boolean. Value: `%s`.",t));if(t)return new Function("return this;")()}if(at)return at;if(et)return et;if(nt)return nt;if(ot)return ot;throw new Error("unexpected error. Unable to resolve global object.")}var ft=ut(),st=ft.document&&ft.document.childNodes,lt=Int8Array;function ct(){return/^\s*function\s*([^(]*)/i}var ht=/^\s*function\s*([^(]*)/i;function pt(t){return null!==t&&"object"==typeof t}q(ct,"REGEXP",ht);var gt=function(t){if("function"!=typeof t)throw new TypeError(N("invalid argument. Must provide a function. Value: `%s`.",t));return function(r){var e,n;if(!f(r))return!1;if(e=r.length,0===e)return!1;for(n=0;n<e;n++)if(!1===t(r[n]))return!1;return!0}}(pt);function yt(t){return pt(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function mt(t){var r,e,n;if(("Object"===(e=u(t).slice(8,-1))||"Error"===e)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(r=ht.exec(n.toString()))return r[1]}return yt(t)?"Buffer":e}q(pt,"isObjectLikeArray",gt);var dt="function"==typeof l||"object"==typeof lt||"function"==typeof st?function(t){return mt(t).toLowerCase()}:function(t){var r;return null===t?"null":"object"===(r=typeof t)?mt(t).toLowerCase():r};function wt(t){return"function"===dt(t)}var vt,bt=Object,_t=Object.getPrototypeOf;vt=wt(Object.getPrototypeOf)?_t:function(t){var r=function(t){return t.__proto__}(t);return r||null===r?r:"[object Function]"===u(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null};var Et=vt;var Tt=Object.prototype;function xt(t){var e;return!!s(t)&&(e=function(t){return null==t?null:(t=bt(t),Et(t))}(t),!e||!r(t,"constructor")&&r(e,"constructor")&&wt(e.constructor)&&"[object Function]"===u(e.constructor)&&r(e,"isPrototypeOf")&&wt(e.isPrototypeOf)&&(e===Tt||function(t){var e;for(e in t)if(!r(t,e))return!1;return!0}(t)))}function At(t){return"number"==typeof t}var Rt=Number,Vt=Rt.prototype.toString;var Ot=n();function jt(t){return"object"==typeof t&&(t instanceof Rt||(Ot?function(t){try{return Vt.call(t),!0}catch(t){return!1}}(t):"[object Number]"===u(t)))}function St(t){return At(t)||jt(t)}q(St,"isPrimitive",At),q(St,"isObject",jt);var It=Number.POSITIVE_INFINITY,Ut=Rt.NEGATIVE_INFINITY,Bt=Math.floor;function Pt(t){return Bt(t)===t}function Lt(t){return t<It&&t>Ut&&Pt(t)}function Mt(t){return At(t)&&Lt(t)}function Ft(t){return jt(t)&&Lt(t.valueOf())}function Ct(t){return Mt(t)||Ft(t)}function kt(t){return Mt(t)&&t>=0}function Nt(t){return Ft(t)&&t.valueOf()>=0}function Yt(t){return kt(t)||Nt(t)}q(Ct,"isPrimitive",Mt),q(Ct,"isObject",Ft),q(Yt,"isPrimitive",kt),q(Yt,"isObject",Nt);var Dt=ut();function zt(t,r,e){X(t,r,{configurable:!1,enumerable:!1,get:e})}var Wt={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 Gt(t){return Math.abs(t)}function Jt(t){var r,e,n,i,o,a;if(0===(e=t.length))return 0;for(r=!0,n=!0,i=Gt(t[0]),a=1;a<e;a++){if(o=Gt(t[a]),r&&o<i?r=!1:n&&o>i&&(n=!1),!n&&!r)return 0;i=o}return n&&r?3:n?1:2}function $t(t,r){return r&&(2===t||3===t)}function Xt(t,r){return r&&(1===t||3===t)}function qt(t,r,e){var n,i,o,a,u;for(n=t.length,i=e,o=e,u=0;u<n;u++){if(0===t[u])return[e,e];(a=r[u])>0?o+=a*(t[u]-1):a<0&&(i+=a*(t[u]-1))}return[i,o]}function Zt(t){return t.re}function Ht(t){return t.im}function Kt(t){return"string"==typeof t}q(qt,"assign",(function(t,r,e,n){var i,o,a,u,f;for(i=t.length,o=e,a=e,f=0;f<i;f++){if(0===t[f])return n[0]=e,n[1]=e,n;(u=r[f])>0?a+=u*(t[f]-1):u<0&&(o+=u*(t[f]-1))}return n[0]=o,n[1]=a,n}));var Qt=String.prototype.valueOf;var tr=n();function rr(t){return"object"==typeof t&&(t instanceof String||(tr?function(t){try{return Qt.call(t),!0}catch(t){return!1}}(t):"[object String]"===u(t)))}function er(t){return Kt(t)||rr(t)}q(er,"isPrimitive",Kt),q(er,"isObject",rr);var nr=/[-\/\\^$*+?.()|[\]{}]/g;var ir=RegExp.prototype.exec;var or=n();function ar(t){return"object"==typeof t&&(t instanceof RegExp||(or?function(t){try{return ir.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===u(t)))}function ur(t,r,e){if(!Kt(t))throw new TypeError(N("invalid argument. First argument must be a string. Value: `%s`.",t));if(Kt(r))r=new RegExp(function(t){var r,e;if(!Kt(t))throw new TypeError(N("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(nr,"\\$&"):(r=(r=t.substring(1,e)).replace(nr,"\\$&"),t=t[0]+r+t.substring(e))}(r),"g");else if(!ar(r))throw new TypeError(N("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!Kt(e)&&!wt(e))throw new TypeError(N("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return function(t,r,e){return t.replace(r,e)}(t,r,e)}var fr={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 sr="function"==typeof Uint8Array;var lr="function"==typeof Uint8Array?Uint8Array:null;var cr,hr="function"==typeof Uint8Array?Uint8Array:void 0;cr=function(){var t,r,e;if("function"!=typeof lr)return!1;try{r=new lr(r=[1,3.14,-3.14,256,257]),e=r,t=(sr&&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}()?hr:function(){throw new Error("not implemented")};var pr=cr,gr="function"==typeof Uint16Array;var yr="function"==typeof Uint16Array?Uint16Array:null;var mr,dr="function"==typeof Uint16Array?Uint16Array:void 0;mr=function(){var t,r,e;if("function"!=typeof yr)return!1;try{r=new yr(r=[1,3.14,-3.14,65536,65537]),e=r,t=(gr&&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}()?dr:function(){throw new Error("not implemented")};var wr,vr=mr,br={uint16:vr,uint8:pr};(wr=new br.uint16(1))[0]=4660;var _r=52===new br.uint8(wr.buffer)[0],Er="function"==typeof ArrayBuffer;function Tr(t){return Er&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===u(t)}var xr="function"==typeof Float64Array;var Ar="function"==typeof Float64Array?Float64Array:null;var Rr,Vr="function"==typeof Float64Array?Float64Array:void 0;Rr=function(){var t,r,e;if("function"!=typeof Ar)return!1;try{r=new Ar([1,3.14,-3.14,NaN]),e=r,t=(xr&&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}()?Vr:function(){throw new Error("not implemented")};var Or=Rr,jr="function"==typeof ArrayBuffer?ArrayBuffer:null;var Sr,Ir="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Sr=function(){var t,r,e;if("function"!=typeof jr)return!1;try{(t=Tr(e=new jr(16))&&"function"==typeof jr.isView)&&((r=new Or(e))[0]=-3.14,r[1]=NaN,t=t&&jr.isView(r)&&16===e.byteLength&&-3.14===r[0]&&r[1]!=r[1])}catch(r){t=!1}return t}()?Ir:function(){throw new Error("not implemented")};var Ur=Sr,Br="function"==typeof DataView;var Pr="function"==typeof DataView?DataView:null;var Lr,Mr="function"==typeof DataView?DataView:void 0;Lr=function(){var t,r,e,n;if("function"!=typeof Pr)return!1;try{e=new Ur(24),r=new Pr(e,8),n=r,(t=(Br&&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}()?Mr:function(){throw new Error("not implemented")};var Fr=Lr,Cr="function"==typeof BigInt?BigInt:void 0,kr={all:["binary","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"],typed:["binary","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"],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"]};function Nr(){var t;return 0===arguments.length?kr.all.slice():(t=kr[arguments[0]])?t.slice():[]}function Yr(){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){X(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}function zr(t){return Object.keys(Object(t))}var Wr=void 0!==Object.keys;function Gr(t){return"[object Arguments]"===u(t)}var Jr=function(){return Gr(arguments)}();function $r(t){return t!=t}function Xr(t){return At(t)&&$r(t)}function qr(t){return jt(t)&&$r(t.valueOf())}function Zr(t){return Xr(t)||qr(t)}q(Zr,"isPrimitive",Xr),q(Zr,"isObject",qr);var Hr=Object.prototype.propertyIsEnumerable;var Kr=!Hr.call("beep","0");function Qr(t,r){var e;return null!=t&&(!(e=Hr.call(t,r))&&Kr&&er(t)?!Xr(r=+r)&&Mt(r)&&r>=0&&r<t.length:e)}var te=4294967295;var re=Jr?Gr:function(t){return null!==t&&"object"==typeof t&&!f(t)&&"number"==typeof t.length&&Pt(t.length)&&t.length>=0&&t.length<=te&&r(t,"callee")&&!Qr(t,"callee")},ee=Array.prototype.slice;var ne=Qr((function(){}),"prototype"),ie=!Qr({toString:null},"toString"),oe=9007199254740991;function ae(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Pt(t.length)&&t.length>=0&&t.length<=oe}function ue(t,r,e){var n,i;if(!ae(t)&&!Kt(t))throw new TypeError(N("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(!Mt(e))throw new TypeError(N("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(Zr(r)){for(;i<n;i++)if(Zr(t[i]))return i}else for(;i<n;i++)if(t[i]===r)return i;return-1}function fe(t){return t.constructor&&t.constructor.prototype===t}var se=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],le="undefined"==typeof window?void 0:window;var ce=function(){var t;if("undefined"===dt(le))return!1;for(t in le)try{-1===ue(se,t)&&r(le,t)&&null!==le[t]&&"object"===dt(le[t])&&fe(le[t])}catch(t){return!0}return!1}(),he="undefined"!=typeof window;var pe=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var ge=Wr?function(){return 2!==(zr(arguments)||"").length}(1,2)?function(t){return re(t)?zr(ee.call(t)):zr(t)}:zr:function(t){var e,n,i,o,a,u,f;if(o=[],re(t)){for(f=0;f<t.length;f++)o.push(f.toString());return o}if("string"==typeof t){if(t.length>0&&!r(t,"0"))for(f=0;f<t.length;f++)o.push(f.toString())}else{if(!1==(i="function"==typeof t)&&!pt(t))return o;n=ne&&i}for(a in t)n&&"prototype"===a||!r(t,a)||o.push(String(a));if(ie)for(e=function(t){if(!1===he&&!ce)return fe(t);try{return fe(t)}catch(t){return!1}}(t),f=0;f<pe.length;f++)u=pe[f],e&&"constructor"===u||!r(t,u)||o.push(String(u));return o};q(Nr,"enum",Yr),function(t,r){var e,n,i;for(e=ge(r),i=0;i<e.length;i++)Dr(t,n=e[i],r[n])}(Nr,{bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256});var ye=["row-major","column-major"];function me(){return ye.slice()}function de(){return{"row-major":1,"column-major":2}}q(me,"enum",de);var we=["throw","normalize","clamp","wrap"];function ve(){return we.slice()}function be(){return{throw:1,clamp:2,wrap:3,normalize:4}}q(ve,"enum",be);var _e={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},Ee={"row-major":1,"column-major":2},Te={throw:1,clamp:2,wrap:3,normalize:4};var xe=4294967295,Ae=4294967296,Re=new pr(8),Ve=new Fr(Re.buffer);function Oe(t,r,e,n){var i,o,a;if(0===t){for(a=0;a<Re.length;a++)r[n]=0,n+=e;return r}for(o=(t&xe)>>>0,i=Bt(t/Ae),_r?(Ve.setUint32(0,o,_r),Ve.setUint32(4,i,_r)):(Ve.setUint32(0,i,_r),Ve.setUint32(4,o,_r)),a=0;a<Re.length;a++)r[n]=Re[a],n+=e;return r}q((function(t){var r,e,n,i;return r=new pr(8),0===t||(i=(4294967295&t)>>>0,n=Bt(t/4294967296),e=new Fr(r.buffer),_r?(e.setUint32(0,i,_r),e.setUint32(4,n,_r)):(e.setUint32(0,n,_r),e.setUint32(4,i,_r))),r}),"assign",Oe);var je={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},Se={"row-major":1,"column-major":2},Ie={throw:1,clamp:2,wrap:3,normalize:4};function Ue(t,r,e,n,i,o){var a,u,f,s,l;if(!(this instanceof Ue))return new Ue(t,r,e,n,i,o);for(s=1,l=0;l<e.length;l++)s*=e[l];return u=r.BYTES_PER_ELEMENT?r.BYTES_PER_ELEMENT*s:null,this._byteLength=u,this._bytesPerElement=function(t){return Wt[t]||null}(t),this._buffer=r,this._dtype=t,this._length=s,this._ndims=e.length,this._offset=i,this._order=o,this._shape=e,this._strides=n,this._accessors=H(r.get&&r.set),this._iterationOrder=function(t){var r,e;for(r=0,e=0;e<t.length;e++)t[e]<0&&(r+=1);return 0===r?1:r===t.length?-1:0}(n),a=function(t,r,e,n,i){var o;return 0!==t&&0!==i&&t===(o=qt(r,e,n))[1]-o[0]+1}(s,e,n,i,this._iterationOrder),f=Jt(n),this._flags={ROW_MAJOR_CONTIGUOUS:Xt(f,a),COLUMN_MAJOR_CONTIGUOUS:$t(f,a),READONLY:!1},this.__meta_dataview__=null,this}function Be(t,r){return"column-major"===r?function(t){var r,e,n;for(r=[],e=1,n=0;n<t.length;n++)r.push(e),e*=t[n];return r}(t):function(t){var r,e,n,i;for(r=t.length,e=[],i=0;i<r;i++)e.push(0);for(n=1,i=r-1;i>=0;i--)e[i]=n,n*=t[i];return e}(t)}function Pe(t,r){var e,n,i;for(n=t.length,e=0,i=0;i<n;i++)r[i]<0&&(e-=r[i]*(t[i]-1));return e}function Le(t){var r,e,n;if(0===(r=t.length))return 0;for(e=1,n=0;n<r;n++)e*=t[n];return e}q(Ue,"name","ndarray"),zt(Ue.prototype,"byteLength",(function(){return this._byteLength})),zt(Ue.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),zt(Ue.prototype,"data",(function(){return this._buffer})),zt(Ue.prototype,"dtype",(function(){return this._dtype})),zt(Ue.prototype,"flags",(function(){return{ROW_MAJOR_CONTIGUOUS:(t=this._flags).ROW_MAJOR_CONTIGUOUS,COLUMN_MAJOR_CONTIGUOUS:t.COLUMN_MAJOR_CONTIGUOUS,READONLY:t.READONLY};var t})),zt(Ue.prototype,"length",(function(){return this._length})),zt(Ue.prototype,"ndims",(function(){return this._ndims})),zt(Ue.prototype,"offset",(function(){return this._offset})),zt(Ue.prototype,"order",(function(){return this._order})),zt(Ue.prototype,"shape",(function(){return this._shape.slice()})),zt(Ue.prototype,"strides",(function(){return this._strides.slice()})),q(Ue.prototype,"get",(function(){var t,r;for(t=this._offset,r=0;r<arguments.length;r++)t+=this._strides[r]*arguments[r];return this._accessors?this._buffer.get(t):this._buffer[t]})),q(Ue.prototype,"iget",(function(t){var r,e,n,i,o,a;if(0===(n=this._ndims))return this._accessors?this._buffer.get(this._offset):this._buffer[this._offset];if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(1===this._iterationOrder)return this._accessors?this._buffer.get(this._offset+t):this._buffer[this._offset+t];if(-1===this._iterationOrder)return this._accessors?this._buffer.get(this.offset-t):this._buffer[this._offset-t]}if(e=this._shape,r=this._strides,i=this._offset,"column-major"===this._order){for(a=0;a<n;a++)t-=o=t%e[a],t/=e[a],i+=o*r[a];return this._accessors?this._buffer.get(i):this._buffer[i]}for(a=n-1;a>=0;a--)t-=o=t%e[a],t/=e[a],i+=o*r[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),q(Ue.prototype,"set",(function(){var t,r;for(t=this._offset,r=0;r<arguments.length-1;r++)t+=this._strides[r]*arguments[r];return this._accessors?this._buffer.set(arguments[r],t):this._buffer[t]=arguments[r],this})),q(Ue.prototype,"iset",(function(t,r){var e,n,i,o,a,u;if(0===(i=this._ndims))return this._accessors?this._buffer.set(t,this._offset):this._buffer[this._offset]=t,this;if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(1===this._iterationOrder)return this._accessors?this._buffer.set(r,this._offset+t):this._buffer[this._offset+t]=r,this;if(-1===this._iterationOrder)return this._accessors?this._buffer.set(r,this._offset-t):this._buffer[this._offset-t]=r,this}if(n=this._shape,e=this._strides,o=this._offset,"column-major"===this._order){for(u=0;u<i;u++)t-=a=t%n[u],t/=n[u],o+=a*e[u];return this._accessors?this._buffer.set(r,o):this._buffer[o]=r,this}for(u=i-1;u>=0;u--)t-=a=t%n[u],t/=n[u],o+=a*e[u];return this._accessors?this._buffer.set(r,o):this._buffer[o]=r,this})),q(Ue.prototype,"toString",(function(){var t,r,e,n,i,o;if(r=this._shape.length,e="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o<this._length;o++)t+=Zt(i=this.iget(o))+", "+Ht(i),o<this._length-1&&(t+=", ");else for(o=0;o<this._length;o++)t+=this.iget(o),o<this._length-1&&(t+=", ");else{if("complex64"===n||"complex128"===n)for(o=0;o<3;o++)t+=Zt(i=this.iget(o))+", "+Ht(i),o<2&&(t+=", ");else for(o=0;o<3;o++)t+=this.iget(o),o<2&&(t+=", ");if(t+=", ..., ","complex64"===n||"complex128"===n)for(o=2;o>=0;o--)t+=Zt(i=this.iget(this._length-1-o))+", "+Ht(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(e+=ur(fr[this.dtype],"{{data}}",t),e+=", ",e+=0===r?"[]":"[ "+this._shape.join(", ")+" ]",e+=", ",e+="[ ",0===r)e+="0";else for(o=0;o<r;o++)this._strides[o]<0?e+=-this._strides[o]:e+=this._strides[o],o<r-1&&(e+=", ");return e+=" ]",e+=", ",e+="0",e+=", ",e+="'"+this._order+"'",e+=" )"})),q(Ue.prototype,"toJSON",(function(){var t,r,e,n;for(r=this._length,(t={}).type="ndarray",t.dtype=this.dtype,t.flags={READONLY:this._flags.READONLY},t.order=this._order,t.shape=this._shape.slice(),t.strides=this._strides.slice(),n=0;n<r;n++)t.strides[n]<0&&(t.strides[n]*=-1);if(t.data=[],"complex64"===t.dtype||"complex128"===t.dtype)for(n=0;n<r;n++)e=this.iget(n),t.data.push(Zt(e),Ht(e));else for(n=0;n<r;n++)t.data.push(this.iget(n));return t})),q(Ue.prototype,"__array_meta_dataview__","function"==typeof Dt.BigInt&&"function"==typeof BigInt&&"bigint"==typeof Dt.BigInt("1")&&"bigint"==typeof BigInt("1")?function(){var t,r,e,n,i,o,a,u,f,s,l,c,h,p;if(f=this._mode||"throw",a=this._submode||[f],e=33+16*(c=this._ndims)+(h=a.length),(u=this.__meta_dataview__)&&u.byteLength===e)return u;for(u=new Fr(new Ur(e)),i=this._shape,o=this._strides,n=this._dtype,t=this._bytesPerElement,s=0,u.setInt8(s,_r?1:0),s+=1,u.setInt16(s,_e[n],_r),s+=2,u.setBigInt64(s,Cr(c),_r),l=8*c,s+=8,p=0;p<c;p++)u.setBigInt64(s,Cr(i[p]),_r),u.setBigInt64(s+l,Cr(o[p]*t),_r),s+=8;for(s+=l,u.setBigInt64(s,Cr(this._offset*t),_r),s+=8,u.setInt8(s,Ee[this._order]),s+=1,u.setInt8(s,Te[f]),s+=1,u.setBigInt64(s,Cr(h),_r),s+=8,p=0;p<h;p++)u.setInt8(s,Te[a[p]]),s+=1;return r=0,r|=this._flags.READONLY?4:0,u.setInt32(s,r,_r),this.__meta_dataview__=u,u}:function(){var t,r,e,n,i,o,a,u,f,s,l,c,h,p,g;if(s=this._mode||"throw",u=this._submode||[s],n=33+16*(h=this._ndims)+(p=u.length),(f=this.__meta_dataview__)&&f.byteLength===n)return f;for(f=new Fr(new Ur(n)),r=new pr(f.buffer),o=this._shape,a=this._strides,i=this._dtype,t=this._bytesPerElement,l=0,f.setInt8(l,_r?1:0),l+=1,f.setInt16(l,je[i],_r),Oe(h,r,1,l+=2),c=8*h,l+=8,g=0;g<h;g++)Oe(o[g],r,1,l),Oe(a[g]*t,r,1,l+c),l+=8;for(l+=c,Oe(this._offset*t,r,1,l),l+=8,f.setInt8(l,Se[this._order]),l+=1,f.setInt8(l,Ie[s]),Oe(p,r,1,l+=1),l+=8,g=0;g<p;g++)f.setInt8(l,Ie[u[g]]),l+=1;return e=0,e|=this._flags.READONLY?4:0,f.setInt32(l,e,_r),this.__meta_dataview__=f,f}),q(Be,"assign",(function(t,r,e){return"column-major"===r?function(t,r){var e,n;for(e=1,n=0;n<t.length;n++)r[n]=e,e*=t[n];return r}(t,e):function(t,r){var e,n;for(e=1,n=t.length-1;n>=0;n--)r[n]=e,e*=t[n];return r}(t,e)}));var Me=4294967295;function Fe(t){if("function"!=typeof t)throw new TypeError(N("invalid argument. Must provide a function. Value: `%s`.",t));return function(r){var e,n;if(!function(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&Pt(t.length)&&t.length>=0&&t.length<=Me}(r))return!1;if(e=r.length,0===e)return!1;for(n=0;n<e;n++)if(!1===t(r[n]))return!1;return!0}}var Ce=Fe(Yt.isPrimitive),ke=Fe(Yt.isObject),Ne=Fe(Yt);q(Ne,"primitives",Ce),q(Ne,"objects",ke);var Ye=Fe(Ct.isPrimitive),De=Fe(Ct.isObject),ze=Fe(Ct);q(ze,"primitives",Ye),q(ze,"objects",De);var We=me(),Ge=We.length;function Je(t){var r;for(r=0;r<Ge;r++)if(t===We[r])return!0;return!1}var $e="function";function Xe(t){return typeof t.get===$e&&typeof t.set===$e}var qe={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 Ze(t){var r=qe[t];return"function"==typeof r?r:qe.default}var He={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 Ke(t){var r=He[t];return"function"==typeof r?r:He.default}var Qe={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},tn="function"==typeof Float32Array;var rn="function"==typeof Float32Array?Float32Array:null;var en,nn="function"==typeof Float32Array?Float32Array:void 0;en=function(){var t,r,e;if("function"!=typeof rn)return!1;try{r=new rn([1,3.14,-3.14,5e40]),e=r,t=(tn&&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}()?nn:function(){throw new Error("not implemented")};var on=en,an="function"==typeof Uint32Array;var un="function"==typeof Uint32Array?Uint32Array:null;var fn,sn="function"==typeof Uint32Array?Uint32Array:void 0;fn=function(){var t,r,e;if("function"!=typeof un)return!1;try{r=new un(r=[1,3.14,-3.14,4294967296,4294967297]),e=r,t=(an&&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}()?sn:function(){throw new Error("not implemented")};var ln=fn,cn="function"==typeof Int32Array;var hn="function"==typeof Int32Array?Int32Array:null;var pn,gn="function"==typeof Int32Array?Int32Array:void 0;pn=function(){var t,r,e;if("function"!=typeof hn)return!1;try{r=new hn([1,3.14,-3.14,2147483648]),e=r,t=(cn&&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}()?gn:function(){throw new Error("not implemented")};var yn=pn,mn="function"==typeof Int16Array;var dn="function"==typeof Int16Array?Int16Array:null;var wn,vn="function"==typeof Int16Array?Int16Array:void 0;wn=function(){var t,r,e;if("function"!=typeof dn)return!1;try{r=new dn([1,3.14,-3.14,32768]),e=r,t=(mn&&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}()?vn:function(){throw new Error("not implemented")};var bn=wn,_n="function"==typeof Uint8ClampedArray;var En="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var Tn,xn="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;Tn=function(){var t,r,e;if("function"!=typeof En)return!1;try{r=new En([-1,0,1,3.14,4.99,255,256]),e=r,t=(_n&&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}()?xn:function(){throw new Error("not implemented")};var An=Tn,Rn="function"==typeof Int8Array;var Vn="function"==typeof Int8Array?Int8Array:null;var On,jn="function"==typeof Int8Array?Int8Array:void 0;On=function(){var t,r,e;if("function"!=typeof Vn)return!1;try{r=new Vn([1,3.14,-3.14,128]),e=r,t=(Rn&&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}()?jn:function(){throw new Error("not implemented")};var Sn=On;function In(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Pt(t.length)&&t.length>=0&&t.length<=Me}function Un(t,r){if(!(this instanceof Un))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!At(t))throw new TypeError(N("invalid argument. Real component must be a number. Value: `%s`.",t));if(!At(r))throw new TypeError(N("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}q(Un,"BYTES_PER_ELEMENT",8),q(Un.prototype,"BYTES_PER_ELEMENT",8),q(Un.prototype,"byteLength",16),q(Un.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),q(Un.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Bn="function"==typeof Math.fround?Math.fround:null,Pn=new on(1);var Ln="function"==typeof Bn?Bn:function(t){return Pn[0]=t,Pn[0]};function Mn(t,r){if(!(this instanceof Mn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!At(t))throw new TypeError(N("invalid argument. Real component must be a number. Value: `%s`.",t));if(!At(r))throw new TypeError(N("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return X(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ln(t)}),X(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ln(r)}),this}function Fn(t){return t instanceof Un||t instanceof Mn||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function Cn(t){return Pt(t/2)}q(Mn,"BYTES_PER_ELEMENT",4),q(Mn.prototype,"BYTES_PER_ELEMENT",4),q(Mn.prototype,"byteLength",8),q(Mn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),q(Mn.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var kn=8;function Nn(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===kn}var Yn=16;function Dn(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Yn}function zn(){return"function"==typeof o&&"symbol"==typeof o("foo")&&r(o,"iterator")&&"symbol"==typeof o.iterator}var Wn=zn()?Symbol.iterator:null;function Gn(t){return t.re}function Jn(t){return t.im}function $n(t,r){return new on(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function Xn(t,r){return new Or(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function qn(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(In(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Fn(n))return new TypeError(N("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(Gn(n),Jn(n))}return r}var Zn=2*on.BYTES_PER_ELEMENT,Hn=zn();function Kn(t){return t instanceof ri||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Qn(t){return t===ri||"Complex128Array"===t.name}function ti(t,r){return new Mn(t[r*=2],t[r+1])}function ri(){var t,r,e,n;if(r=arguments.length,!(this instanceof ri))return 0===r?new ri:1===r?new ri(arguments[0]):2===r?new ri(arguments[0],arguments[1]):new ri(arguments[0],arguments[1],arguments[2]);if(0===r)e=new on(0);else if(1===r)if(kt(arguments[0]))e=new on(2*arguments[0]);else if(ae(arguments[0]))if((n=(e=arguments[0]).length)&&f(e)&&Fn(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;i<e;i++){if(!Fn(n=r[i]))return null;t[o]=Gn(n),t[o+1]=Jn(n),o+=2}return t}(new on(2*n),e),null===e){if(!Cn(n))throw new RangeError(N("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new on(arguments[0])}}else{if(Nn(e))e=$n(e,0);else if(Dn(e))e=Xn(e,0);else if(!Cn(n))throw new RangeError(N("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new on(e)}else if(Tr(arguments[0])){if(!Pt((e=arguments[0]).byteLength/Zn))throw new RangeError(N("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",Zn,e.byteLength));e=new on(e)}else{if(!s(arguments[0]))throw new TypeError(N("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(e=arguments[0],!1===Hn)throw new TypeError(N("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",e));if(!wt(e[Wn]))throw new TypeError(N("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if(!wt((e=e[Wn]()).next))throw new TypeError(N("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if((e=qn(e))instanceof Error)throw e;e=new on(e)}else{if(!Tr(e=arguments[0]))throw new TypeError(N("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(!kt(t=arguments[1]))throw new TypeError(N("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Pt(t/Zn))throw new RangeError(N("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",Zn,t));if(2===r){if(!Pt((n=e.byteLength-t)/Zn))throw new RangeError(N("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",Zn,n));e=new on(e,t)}else{if(!kt(n=arguments[2]))throw new TypeError(N("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*Zn>e.byteLength-t)throw new RangeError(N("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Zn));e=new on(e,t,2*n)}}return q(this,"_buffer",e),q(this,"_length",e.length/2),this}function ei(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(In(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Fn(n))return new TypeError(N("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(Zt(n),Ht(n))}return r}q(ri,"BYTES_PER_ELEMENT",Zn),q(ri,"name","Complex64Array"),q(ri,"from",(function(t){var r,e,n,i,o,a,u,f,l,c,h,p;if(!wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!wt(n=arguments[1]))throw new TypeError(N("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Kn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,p=0,h=0;h<f;h++){if(Fn(c=n.call(r,t.get(h),h)))o[p]=Gn(c),o[p+1]=Jn(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[p]=c[0],o[p+1]=c[1]}p+=2}return i}return new this(t)}if(ae(t)){if(n){for(f=t.length,u=t.get&&t.set?Ze("default"):Ke("default"),h=0;h<f;h++)if(!Fn(u(t,h))){l=!0;break}if(l){if(!Cn(f))throw new RangeError(N("invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.",2,f));for(o=(i=new this(f/2))._buffer,h=0;h<f;h++)o[h]=n.call(r,u(t,h),h);return i}for(o=(i=new this(f))._buffer,p=0,h=0;h<f;h++){if(Fn(c=n.call(r,u(t,h),h)))o[p]=Gn(c),o[p+1]=Jn(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[p]=c[0],o[p+1]=c[1]}p+=2}return i}return new this(t)}if(s(t)&&Hn&&wt(t[Wn])){if(!wt((o=t[Wn]()).next))throw new TypeError(N("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,In(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Fn(o))return new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Gn(o),Jn(o))}return n}(o,n,r):qn(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h<f;h++)o[h]=a[h];return i}throw new TypeError(N("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),q(ri,"of",(function(){var t,r;if(!wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);return new this(t)})),q(ri.prototype,"at",(function(t){if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Pt(t))throw new TypeError(N("invalid argument. Must provide an integer. Value: `%s`.",t));if(t<0&&(t+=this._length),!(t<0||t>=this._length))return ti(this._buffer,t)})),zt(ri.prototype,"buffer",(function(){return this._buffer.buffer})),zt(ri.prototype,"byteLength",(function(){return this._buffer.byteLength})),zt(ri.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),q(ri.prototype,"BYTES_PER_ELEMENT",ri.BYTES_PER_ELEMENT),q(ri.prototype,"copyWithin",(function(t,r){if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*r):this._buffer.copyWithin(2*t,2*r,2*arguments[2]),this})),q(ri.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,t=this._buffer,n=this._length,o=-1,a=-2,q(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Mn(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),q(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Wn&&q(e,Wn,(function(){return r.entries()})),e})),q(ri.prototype,"every",(function(t,r){var e,n;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(!t.call(r,ti(e,n),n,this))return!1;return!0})),q(ri.prototype,"fill",(function(t,r,e){var n,i,o,a,u,f;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Pt(e))throw new TypeError(N("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=Gn(t),u=Jn(t),f=r;f<e;f++)n[o=2*f]=a,n[o+1]=u;return this})),q(ri.prototype,"filter",(function(t,r){var e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=[],i=0;i<this._length;i++)o=ti(e,i),t.call(r,o,i,this)&&n.push(o);return new this.constructor(n)})),q(ri.prototype,"find",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=ti(e,n),t.call(r,i,n,this))return i})),q(ri.prototype,"findIndex",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=ti(e,n),t.call(r,i,n,this))return n;return-1})),q(ri.prototype,"findLast",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=ti(e,n),t.call(r,i,n,this))return i})),q(ri.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=ti(e,n),t.call(r,i,n,this))return n;return-1})),q(ri.prototype,"forEach",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)i=ti(e,n),t.call(r,i,n,this)})),q(ri.prototype,"get",(function(t){if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!kt(t))throw new TypeError(N("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return ti(this._buffer,t)})),q(ri.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Gn(t),o=Jn(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return!0;return!1})),q(ri.prototype,"indexOf",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Gn(t),o=Jn(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),q(ri.prototype,"join",(function(t){var r,e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!Kt(t))throw new TypeError(N("invalid argument. First argument must be a string. Value: `%s`.",t));n=t}for(r=[],e=this._buffer,i=0;i<this._length;i++)r.push(ti(e,i).toString());return r.join(n)})),q(ri.prototype,"lastIndexOf",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Pt(r))throw new TypeError(N("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=Gn(t),o=Jn(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),zt(ri.prototype,"length",(function(){return this._length})),q(ri.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(Fn(a=t.call(r,ti(n,o),o,this)))e[2*o]=Gn(a),e[2*o+1]=Jn(a);else{if(!In(a)||2!==a.length)throw new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));e[2*o]=a[0],e[2*o+1]=a[1]}return i})),q(ri.prototype,"reduce",(function(t,r){var e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));if(e=this._buffer,i=this._length,arguments.length>1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=ti(e,0),o=1}for(;o<i;o++)n=t(n,ti(e,o),o,this);return n})),q(ri.prototype,"reverse",(function(){var t,r,e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,t=this._buffer,n=Bt(e/2),i=0;i<n;i++)o=e-i-1,r=t[2*i],t[2*i]=t[2*o],t[2*o]=r,r=t[2*i+1],t[2*i+1]=t[2*o+1],t[2*o+1]=r;return this})),q(ri.prototype,"set",(function(t){var r,e,n,i,o,a,u,f,s;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!kt(e=arguments[1]))throw new TypeError(N("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(Fn(t)){if(e>=this._length)throw new RangeError(N("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=Gn(t),void(n[e+1]=Jn(t))}if(Kn(t)){if(e+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t._buffer,s=n.byteOffset+e*Zn,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new on(r.length),f=0;f<r.length;f++)i[f]=r[f];r=i}for(e*=2,s=0,f=0;f<a;f++)n[e]=r[s],n[e+1]=r[s+1],e+=2,s+=2}else{if(!ae(t))throw new TypeError(N("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",t));for(a=t.length,f=0;f<a;f++)if(!Fn(t[f])){o=!0;break}if(o){if(!Cn(a))throw new RangeError(N("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(e+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*Zn,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new on(a),f=0;f<a;f++)i[f]=r[f];r=i}for(e*=2,a/=2,s=0,f=0;f<a;f++)n[e]=r[s],n[e+1]=r[s+1],e+=2,s+=2;return}if(e+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;f<a;f++)u=t[f],n[e]=Gn(u),n[e+1]=Jn(u),e+=2}})),q(ri.prototype,"slice",(function(t,r){var e,n,i,o,a,u,f;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)t=0,r=u;else{if(!Pt(t))throw new TypeError(N("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=u)<0&&(t=0),1===arguments.length)r=u;else{if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=u)<0&&(r=0):r>u&&(r=u)}}for(e=t<r?r-t:0,n=(i=new this.constructor(e))._buffer,f=0;f<e;f++)o=2*(f+t),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),q(ri.prototype,"some",(function(t,r){var e,n;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(t.call(r,ti(e,n),n,this))return!0;return!1})),q(ri.prototype,"subarray",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)t=0,r=i;else{if(!Pt(t))throw new TypeError(N("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=i)<0&&(t=0),1===arguments.length)r=i;else{if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=i)<0&&(r=0):r>i&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*Zn):(i=r-t,e=n.byteOffset+t*Zn),new this.constructor(n.buffer,e,i<0?0:i)})),q(ri.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,r=new this.constructor(e),n=this._buffer,t=r._buffer,i=0;i<e;i++)o=e-i-1,t[2*i]=n[2*o],t[2*i+1]=n[2*o+1];return r})),q(ri.prototype,"toString",(function(){var t,r,e;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],r=this._buffer,e=0;e<this._length;e++)t.push(ti(r,e).toString());return t.join(",")})),q(ri.prototype,"with",(function(t,r){var e,n,i;if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Pt(t))throw new TypeError(N("invalid argument. First argument must be an integer. Value: `%s`.",t));if(i=this._length,t<0&&(t+=i),t<0||t>=i)throw new RangeError(N("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!Fn(r))throw new TypeError(N("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=Gn(r),e[2*t+1]=Jn(r),n}));var ni=2*Or.BYTES_PER_ELEMENT,ii=zn();function oi(t){return t instanceof fi||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function ai(t){return t===fi||"Complex64Array"===t.name}function ui(t,r){return new Un(t[r*=2],t[r+1])}function fi(){var t,r,e,n;if(r=arguments.length,!(this instanceof fi))return 0===r?new fi:1===r?new fi(arguments[0]):2===r?new fi(arguments[0],arguments[1]):new fi(arguments[0],arguments[1],arguments[2]);if(0===r)e=new Or(0);else if(1===r)if(kt(arguments[0]))e=new Or(2*arguments[0]);else if(ae(arguments[0]))if((n=(e=arguments[0]).length)&&f(e)&&Fn(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;i<e;i++){if(!Fn(n=r[i]))return null;t[o]=Zt(n),t[o+1]=Ht(n),o+=2}return t}(new Or(2*n),e),null===e){if(!Cn(n))throw new RangeError(N("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new Or(arguments[0])}}else{if(Nn(e))e=$n(e,0);else if(Dn(e))e=Xn(e,0);else if(!Cn(n))throw new RangeError(N("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));e=new Or(e)}else if(Tr(arguments[0])){if(!Pt((e=arguments[0]).byteLength/ni))throw new RangeError(N("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",ni,e.byteLength));e=new Or(e)}else{if(!s(arguments[0]))throw new TypeError(N("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(e=arguments[0],!1===ii)throw new TypeError(N("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",e));if(!wt(e[Wn]))throw new TypeError(N("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if(!wt((e=e[Wn]()).next))throw new TypeError(N("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",e));if((e=ei(e))instanceof Error)throw e;e=new Or(e)}else{if(!Tr(e=arguments[0]))throw new TypeError(N("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(!kt(t=arguments[1]))throw new TypeError(N("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Pt(t/ni))throw new RangeError(N("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",ni,t));if(2===r){if(!Pt((n=e.byteLength-t)/ni))throw new RangeError(N("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",ni,n));e=new Or(e,t)}else{if(!kt(n=arguments[2]))throw new TypeError(N("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*ni>e.byteLength-t)throw new RangeError(N("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*ni));e=new Or(e,t,2*n)}}return q(this,"_buffer",e),q(this,"_length",e.length/2),this}q(fi,"BYTES_PER_ELEMENT",ni),q(fi,"name","Complex128Array"),q(fi,"from",(function(t){var r,e,n,i,o,a,u,f,l,c,h,p;if(!wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!ai(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(N("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(oi(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,p=0,h=0;h<f;h++){if(Fn(c=n.call(r,t.get(h),h)))o[p]=Zt(c),o[p+1]=Ht(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[p]=c[0],o[p+1]=c[1]}p+=2}return i}return new this(t)}if(ae(t)){if(n){for(f=t.length,u=t.get&&t.set?Ze("default"):Ke("default"),h=0;h<f;h++)if(!Fn(u(t,h))){l=!0;break}if(l){if(!Cn(f))throw new RangeError(N("invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.",f));for(o=(i=new this(f/2))._buffer,h=0;h<f;h++)o[h]=n.call(r,u(t,h),h);return i}for(o=(i=new this(f))._buffer,p=0,h=0;h<f;h++){if(Fn(c=n.call(r,u(t,h),h)))o[p]=Zt(c),o[p+1]=Ht(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[p]=c[0],o[p+1]=c[1]}p+=2}return i}return new this(t)}if(s(t)&&ii&&wt(t[Wn])){if(!wt((o=t[Wn]()).next))throw new TypeError(N("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,In(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Fn(o))return new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Zt(o),Ht(o))}return n}(o,n,r):ei(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h<f;h++)o[h]=a[h];return i}throw new TypeError(N("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),q(fi,"of",(function(){var t,r;if(!wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!ai(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);return new this(t)})),q(fi.prototype,"at",(function(t){if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Pt(t))throw new TypeError(N("invalid argument. Must provide an integer. Value: `%s`.",t));if(t<0&&(t+=this._length),!(t<0||t>=this._length))return ui(this._buffer,t)})),zt(fi.prototype,"buffer",(function(){return this._buffer.buffer})),zt(fi.prototype,"byteLength",(function(){return this._buffer.byteLength})),zt(fi.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),q(fi.prototype,"BYTES_PER_ELEMENT",fi.BYTES_PER_ELEMENT),q(fi.prototype,"copyWithin",(function(t,r){if(!oi(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})),q(fi.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!oi(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,q(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Un(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),q(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Wn&&q(e,Wn,(function(){return r.entries()})),e})),q(fi.prototype,"every",(function(t,r){var e,n;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(!t.call(r,ui(e,n),n,this))return!1;return!0})),q(fi.prototype,"fill",(function(t,r,e){var n,i,o,a,u,f;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Pt(e))throw new TypeError(N("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=Zt(t),u=Ht(t),f=r;f<e;f++)n[o=2*f]=a,n[o+1]=u;return this})),q(fi.prototype,"filter",(function(t,r){var e,n,i,o;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=[],i=0;i<this._length;i++)o=ui(e,i),t.call(r,o,i,this)&&n.push(o);return new this.constructor(n)})),q(fi.prototype,"find",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=ui(e,n),t.call(r,i,n,this))return i})),q(fi.prototype,"findIndex",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(i=ui(e,n),t.call(r,i,n,this))return n;return-1})),q(fi.prototype,"findLast",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=ui(e,n),t.call(r,i,n,this))return i})),q(fi.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=ui(e,n),t.call(r,i,n,this))return n;return-1})),q(fi.prototype,"forEach",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)i=ui(e,n),t.call(r,i,n,this)})),q(fi.prototype,"get",(function(t){if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!kt(t))throw new TypeError(N("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return ui(this._buffer,t)})),zt(fi.prototype,"length",(function(){return this._length})),q(fi.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Zt(t),o=Ht(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return!0;return!1})),q(fi.prototype,"indexOf",(function(t,r){var e,n,i,o,a;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Zt(t),o=Ht(t),e=this._buffer,a=r;a<this._length;a++)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),q(fi.prototype,"join",(function(t){var r,e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!er(t))throw new TypeError(N("invalid argument. First argument must be a string. Value: `%s`.",t));n=t}for(r=[],e=this._buffer,i=0;i<this._length;i++)r.push(ui(e,i).toString());return r.join(n)})),q(fi.prototype,"lastIndexOf",(function(t,r){var e,n,i,o,a;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fn(t))throw new TypeError(N("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Pt(r))throw new TypeError(N("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=Zt(t),o=Ht(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),q(fi.prototype,"map",(function(t,r){var e,n,i,o,a;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(Fn(a=t.call(r,ui(n,o),o,this)))e[2*o]=Zt(a),e[2*o+1]=Ht(a);else{if(!In(a)||2!==a.length)throw new TypeError(N("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));e[2*o]=a[0],e[2*o+1]=a[1]}return i})),q(fi.prototype,"reduce",(function(t,r){var e,n,i,o;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));if(e=this._buffer,i=this._length,arguments.length>1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=ui(e,0),o=1}for(;o<i;o++)n=t(n,ui(e,o),o,this);return n})),q(fi.prototype,"reverse",(function(){var t,r,e,n,i,o;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,t=this._buffer,n=Bt(e/2),i=0;i<n;i++)o=e-i-1,r=t[2*i],t[2*i]=t[2*o],t[2*o]=r,r=t[2*i+1],t[2*i+1]=t[2*o+1],t[2*o+1]=r;return this})),q(fi.prototype,"set",(function(t){var r,e,n,i,o,a,u,f,s;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!kt(e=arguments[1]))throw new TypeError(N("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(Fn(t)){if(e>=this._length)throw new RangeError(N("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=Zt(t),void(n[e+1]=Ht(t))}if(oi(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*ni,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new Or(r.length),f=0;f<r.length;f++)i[f]=r[f];r=i}for(e*=2,s=0,f=0;f<a;f++)n[e]=r[s],n[e+1]=r[s+1],e+=2,s+=2}else{if(!ae(t))throw new TypeError(N("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",t));for(a=t.length,f=0;f<a;f++)if(!Fn(t[f])){o=!0;break}if(o){if(!Cn(a))throw new RangeError(N("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(e+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*ni,r.buffer===n.buffer&&r.byteOffset<s&&r.byteOffset+r.byteLength>s){for(i=new Or(a),f=0;f<a;f++)i[f]=r[f];r=i}for(e*=2,a/=2,s=0,f=0;f<a;f++)n[e]=r[s],n[e+1]=r[s+1],e+=2,s+=2;return}if(e+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;f<a;f++)u=t[f],n[e]=Zt(u),n[e+1]=Ht(u),e+=2}})),q(fi.prototype,"slice",(function(t,r){var e,n,i,o,a,u,f;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)t=0,r=u;else{if(!Pt(t))throw new TypeError(N("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=u)<0&&(t=0),1===arguments.length)r=u;else{if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=u)<0&&(r=0):r>u&&(r=u)}}for(e=t<r?r-t:0,n=(i=new this.constructor(e))._buffer,f=0;f<e;f++)o=2*(f+t),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),q(fi.prototype,"some",(function(t,r){var e,n;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n<this._length;n++)if(t.call(r,ui(e,n),n,this))return!0;return!1})),q(fi.prototype,"subarray",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)t=0,r=i;else{if(!Pt(t))throw new TypeError(N("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=i)<0&&(t=0),1===arguments.length)r=i;else{if(!Pt(r))throw new TypeError(N("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=i)<0&&(r=0):r>i&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*ni):(i=r-t,e=n.byteOffset+t*ni),new this.constructor(n.buffer,e,i<0?0:i)})),q(fi.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,r=new this.constructor(e),n=this._buffer,t=r._buffer,i=0;i<e;i++)o=e-i-1,t[2*i]=n[2*o],t[2*i+1]=n[2*o+1];return r})),q(fi.prototype,"toString",(function(){var t,r,e;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],r=this._buffer,e=0;e<this._length;e++)t.push(ui(r,e).toString());return t.join(",")})),q(fi.prototype,"with",(function(t,r){var e,n,i;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Pt(t))throw new TypeError(N("invalid argument. First argument must be an integer. Value: `%s`.",t));if(i=this._length,t<0&&(t+=i),t<0||t>=i)throw new RangeError(N("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!Fn(r))throw new TypeError(N("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=Zt(r),e[2*t+1]=Ht(r),n}));var si=[Or,on,yn,ln,bn,vr,Sn,pr,An,ri,fi],li=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],ci=li.length;function hi(t){var r;if(f(t))return"generic";if(yt(t))return null;for(r=0;r<ci;r++)if(t instanceof si[r])return li[r];return Qe[mt(t)]||null}function pi(t){var r,e,n;if(!ae(t))throw new TypeError(N("invalid argument. Must provide an array-like object. Value: `%s`.",t));return n=hi(t),Xe(t)&&(r=Ze(n)),e=t.length,void 0===r?function(r){var n;for(n=0;n<e;n++)if(t[n]===r)return!0;return!1}:function(n){var i;for(i=0;i<e;i++)if(r(t,i)===n)return!0;return!1}}q((function(t,r){var e,n,i,o;for(i=hi(t),n=Xe(t)?Ze(i):Ke(i),e=t.length,o=0;o<e;o++)if(n(t,o)===r)return!0;return!1}),"factory",pi);var gi=pi(Nr());function yi(){return{dtypes:{default:"float64",numeric:"float64",real:"float64",floating_point:"float64",real_floating_point:"float64",complex_floating_point:"complex128",integer:"int32",signed_integer:"int32",unsigned_integer:"uint32"},order:"row-major",casting:"safe",index_mode:"throw"}}var mi={dtypes:{default:"float64",numeric:"float64",real:"float64",floating_point:"float64",real_floating_point:"float64",complex_floating_point:"complex128",integer:"int32",signed_integer:"int32",unsigned_integer:"uint32"},order:"row-major",casting:"safe",index_mode:"throw"},di={"dtypes.default":mi.dtypes.default,"dtypes.numeric":mi.dtypes.numeric,"dtypes.real":mi.dtypes.real,"dtypes.floating_point":mi.dtypes.floating_point,"dtypes.real_floating_point":mi.dtypes.real_floating_point,"dtypes.complex_floating_point":mi.dtypes.complex_floating_point,"dtypes.integer":mi.dtypes.integer,"dtypes.signed_integer":mi.dtypes.signed_integer,"dtypes.unsigned_integer":mi.dtypes.unsigned_integer,order:mi.order,casting:mi.casting,index_mode:mi.index_mode};function wi(t){var r=typeof t;return null===t||"object"!==r&&"function"!==r?new TypeError(N("invalid argument. A provided constructor must be either an object (except null) or a function. Value: `%s`.",t)):null}q(yi,"get",(function(t){var r=di[t];return void 0===r?null:r}));var vi=Object.create;function bi(){}var _i="function"==typeof vi?vi:function(t){return bi.prototype=t,new bi};function Ei(t,r){return t<0?0:t>r?r:t}function Ti(t,r){var e=r+1;return t<0?((t+=e)<0&&0!==(t%=e)&&(t+=e),t):t>r?((t-=e)>r&&(t%=e),t):t}function xi(t,r){return t<0?(t+=r+1)<0?-1:t:t>r?-1:t}var Ai=pi(ve()),Ri={wrap:Ti,clamp:Ei,normalize:function(t,r){var e=xi(t,r);if(e<0||e>r)throw new RangeError(N("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",r,t));return e},throw:function(t,r){if(t<0||t>r)throw new RangeError(N("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",r,t));return t}};function Vi(t,r,e){var n;if("clamp"===e)return Ei(t,r);if("wrap"===e)return Ti(t,r);if(n=t,"normalize"===e&&(n=xi(n,r)),n<0||n>r)throw new RangeError(N("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",r,t));return n}q(Vi,"factory",(function(t){if(!Ai(t))throw new TypeError(N("invalid argument. First argument must be a recognized index mode. Value: `%s`.",t));return Ri[t]}));var Oi=Ue.prototype.iget;var ji=Ue.prototype.iset;function Si(t,r){var e,n;for(e=[],n=0;n<r;n++)e.push(t[n]);return e}var Ii=32767,Ui=yi.get("index_mode"),Bi=!1;function Pi(t,e,n,i,o,a,u){var s,l,c,h,p;if(!(this instanceof Pi))return arguments.length<7?new Pi(t,e,n,i,o,a):new Pi(t,e,n,i,o,a,u);if(!gi(t))throw new TypeError(N("invalid argument. First argument must be a supported ndarray data type. Value: `%s`.",t));if(!ae(e))throw new TypeError(N("invalid argument. Second argument must be an array-like object, typed-array-like, or a Buffer. Value: `%s`.",e));if(e.get&&e.set&&(!wt(e.get)||!wt(e.set)))throw new TypeError(N("invalid argument. Second argument `get` and `set` properties must be functions. Value: `%s`.",e));if(!Ce(n)&&(!ae(n)||n.length>0))throw new TypeError(N("invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.",n));if((s=n.length)>Ii)throw new RangeError(N("invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.",Ii,s));if(!Ye(i))throw new TypeError(N("invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.",i));if(s>0){if(i.length!==s)throw new RangeError(N("invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.",s,i.length))}else{if(1!==i.length)throw new RangeError("invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.");if(0!==i[0])throw new RangeError(N("invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.",i[0]))}if(!kt(o))throw new TypeError(N("invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.",o));if(!Je(a))throw new TypeError(N("invalid argument. Sixth argument must be a supported order. Value: `%s`.",a));if(s>0&&!function(t,r,e,n){var i=qt(r,e,n);return i[0]>=0&&i[1]<t}(e.length,n,i,o)&&Le(n)>0)throw new Error("invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.");if((l={}).mode=Ui,l.readonly=Bi,arguments.length>6&&(c=function(t,e){var n;if(!xt(e))return new TypeError(N("invalid argument. Options argument must be an object. Value: `%s`.",e));if(r(e,"mode")&&(t.mode=e.mode,!Ai(t.mode)))return new TypeError(N("invalid option. `%s` option must be a recognized mode. Option: `%s`.","mode",t.mode));if(r(e,"submode")){if(t.submode=e.submode,!f(t.submode))return new TypeError(N("invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.","submode",t.submode));if(0===t.submode.length)return new TypeError(N("invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.","submode",t.submode.join(",")));for(n=0;n<t.submode.length;n++)if(!Ai(t.submode[n]))return new TypeError(N("invalid option. Each submode must be a recognized mode. Option: `%s`.",t.submode[n]));t.submode=t.submode.slice()}return r(e,"readonly")&&(t.readonly=e.readonly,!Z(t.readonly))?new TypeError(N("invalid option. `%s` option must be a boolean. Option: `%s`.","readonly",t.readonly)):null}(l,u),c))throw c;return this._mode=l.mode,void 0===l.submode&&(l.submode=[this._mode]),this._submode=l.submode,h=Si(n,s),p=Si(i,s||1),Ue.call(this,t,e,h,p,o,a),this._flags.READONLY=l.readonly,this}!function(t,r){var e=wi(t);if(e)throw e;if(e=wi(r))throw e;if(void 0===r.prototype)throw new TypeError(N("invalid argument. Second argument must have a prototype from which another object can inherit. Value: `%s`.",r.prototype));t.prototype=_i(r.prototype),X(t.prototype,"constructor",{configurable:!0,enumerable:!1,writable:!0,value:t})}(Pi,Ue),q(Pi,"name","ndarray"),q(Pi.prototype,"get",(function(){var t,r,e,n;if(arguments.length!==this._ndims)throw new RangeError(N("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(t=this._offset,e=this._submode.length,n=0;n<arguments.length;n++){if(!Mt(arguments[n]))throw new TypeError(N("invalid argument. Indices must be integer valued. Argument: `%u`. Value: `%s`.",n,arguments[n]));r=Vi(arguments[n],this._shape[n]-1,this._submode[n%e]),t+=this._strides[n]*r}return this._accessors?this._buffer.get(t):this._buffer[t]})),q(Pi.prototype,"iget",(function(t){if(this._ndims>0){if(!Mt(t))throw new TypeError(N("invalid argument. Index must be an integer. Value: `%s`.",t));return t=Vi(t,this._length-1,this._mode),Oi.call(this,t)}return Oi.call(this)})),q(Pi.prototype,"set",(function(){var t,r,e,n;if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(arguments.length!==this._ndims+1)throw new RangeError(N("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(t=this._offset,e=this._submode.length,n=0;n<arguments.length-1;n++){if(!Mt(arguments[n]))throw new TypeError(N("invalid argument. Indices must be integer valued. Argument: `%i`. Value: `%s`.",n,arguments[n]));r=Vi(arguments[n],this._shape[n]-1,this._submode[n%e]),t+=this._strides[n]*r}return this._accessors?this._buffer.set(arguments[n],t):this._buffer[t]=arguments[n],this})),q(Pi.prototype,"iset",(function(t,r){if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(this._ndims>0){if(!Mt(t))throw new TypeError(N("invalid argument. Index must be an integer. Value: `%s`.",t));t=Vi(t,this._length-1,this._mode),ji.call(this,t,r)}else ji.call(this,t);return this}));var Li=["none","equiv","safe","mostly-safe","same-kind","unsafe"];function Mi(){return Li.slice()}q(Mi,"enum",(function(){return{none:0,equiv:1,safe:2,"mostly-safe":3,"same-kind":4,unsafe:5}}));var Fi=Mi(),Ci=Fi.length;function ki(t){var r;for(r=0;r<Ci;r++)if(t===Fi[r])return!0;return!1}var Ni=function(t,e){var n,i,o,a,u,s,l,c=!0;if(!pt(t))throw new TypeError(N("invalid argument. First argument must be an object (except null). Value: `%s`.",t));if(arguments.length>1){if(!xt(e))throw new TypeError(N("invalid argument. Options argument must be an object. Value: `%s`.",e));if(r(e,"duplicates")&&!Z(c=e.duplicates))throw new TypeError(N("invalid option. `%s` option must be a boolean. Option: `%s`.","duplicates",c))}if(i=(n=ge(t)).length,u={},c)for(l=0;l<i;l++)r(u,a=t[o=n[l]])?(s=u[a],f(s)?u[a].push(o):u[a]=[s,o]):u[a]=o;else for(l=0;l<i;l++)u[t[o=n[l]]]=o;return u}({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},{duplicates:!1});var Yi={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 Di(t){var r=typeof t;return"string"===r?null===function(t){var r=Yi[t];return"number"==typeof r?r:null}(t)?null:t:"number"===r?function(t){var r=Ni[t];return"string"==typeof r?r:null}(t):null}var zi,Wi={float64:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};var Gi=function(t){return 0===arguments.length?function(){var t,r,e,n,i,o,a,u,f;for(e={},r=(t=ge(Wi)).length,f=0;f<r;f++){for(i=t[f],a=Wi[i],n={},u=0;u<r;u++)n[o=t[u]]=a[o];e[i]=n}return e}():(void 0===zi&&(zi=function(){var t,r,e,n,i,o,a,u,f;for(e={},r=(t=ge(Wi)).length,f=0;f<r;f++){for(i=t[f],a=Wi[i],n=[],u=0;u<r;u++)1===a[o=t[u]]&&n.push(o);e[i]=n}return e}()),t=Di(t),r(zi,t)?zi[t].slice():null)}();var Ji,$i={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};var Xi=function(t){return 0===arguments.length?function(){var t,r,e,n,i,o,a,u,f;for(e={},r=(t=ge($i)).length,f=0;f<r;f++){for(i=t[f],a=$i[i],n={},u=0;u<r;u++)n[o=t[u]]=a[o];e[i]=n}return e}():(void 0===Ji&&(Ji=function(){var t,r,e,n,i,o,a,u,f;for(e={},r=(t=ge($i)).length,f=0;f<r;f++){for(i=t[f],a=$i[i],n=[],u=0;u<r;u++)1===a[o=t[u]]&&n.push(o);e[i]=n}return e}()),t=Di(t),r(Ji,t)?Ji[t].slice():null)}();var qi,Zi={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};var Hi=function(t){return 0===arguments.length?function(){var t,r,e,n,i,o,a,u,f;for(e={},r=(t=ge(Zi)).length,f=0;f<r;f++){for(i=t[f],a=Zi[i],n={},u=0;u<r;u++)n[o=t[u]]=a[o];e[i]=n}return e}():(void 0===qi&&(qi=function(){var t,r,e,n,i,o,a,u,f;for(e={},r=(t=ge(Zi)).length,f=0;f<r;f++){for(i=t[f],a=Zi[i],n=[],u=0;u<r;u++)1===a[o=t[u]]&&n.push(o);e[i]=n}return e}()),t=Di(t),r(qi,t)?qi[t].slice():null)}();function Ki(t,r,e){return"unsafe"===e||(t===r||"none"!==e&&"equiv"!==e&&("safe"===e?function(t,r){return t===r||Gi[t][r]>0}(t,r):"mostly-safe"===e?function(t,r){return t===r||Xi[t][r]>0}(t,r):function(t,r){return t===r||Hi[t][r]>0}(t,r)))}var Qi=[],to=[],ro="undefined"!=typeof Uint8Array?Uint8Array:Array,eo=!1;function no(){eo=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)Qi[r]=t[r],to[t.charCodeAt(r)]=r;to["-".charCodeAt(0)]=62,to["_".charCodeAt(0)]=63}function io(t,r,e){for(var n,i,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Qi[(i=n)>>18&63]+Qi[i>>12&63]+Qi[i>>6&63]+Qi[63&i]);return o.join("")}function oo(t){var r;eo||no();for(var e=t.length,n=e%3,i="",o=[],a=16383,u=0,f=e-n;u<f;u+=a)o.push(io(t,u,u+a>f?f:u+a));return 1===n?(r=t[e-1],i+=Qi[r>>2],i+=Qi[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=Qi[r>>10],i+=Qi[r>>4&63],i+=Qi[r<<2&63],i+="="),o.push(i),o.join("")}function ao(t,r,e,n,i){var o,a,u=8*i-n-1,f=(1<<u)-1,s=f>>1,l=-7,c=e?i-1:0,h=e?-1:1,p=t[r+c];for(c+=h,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[r+c],c+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[r+c],c+=h,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 uo(t,r,e,n,i,o){var a,u,f,s=8*o-i-1,l=(1<<s)-1,c=l>>1,h=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+c>=1?h/f:h*Math.pow(2,1-c))*f>=2&&(a++,f/=2),a+c>=l?(u=0,a=l):a+c>=1?(u=(r*f-1)*Math.pow(2,i),a+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[e+p]=255&u,p+=g,u/=256,i-=8);for(a=a<<i|u,s+=i;s>0;t[e+p]=255&a,p+=g,a/=256,s-=8);t[e+p-g]|=128*y}var fo={}.toString,so=Array.isArray||function(t){return"[object Array]"==fo.call(t)};po.TYPED_ARRAY_SUPPORT=void 0===it.TYPED_ARRAY_SUPPORT||it.TYPED_ARRAY_SUPPORT;var lo=co();function co(){return po.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ho(t,r){if(co()<r)throw new RangeError("Invalid typed array length");return po.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=po.prototype:(null===t&&(t=new po(r)),t.length=r),t}function po(t,r,e){if(!(po.TYPED_ARRAY_SUPPORT||this instanceof po))return new po(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return mo(this,t)}return go(this,t,r,e)}function go(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);po.TYPED_ARRAY_SUPPORT?(t=r).__proto__=po.prototype:t=wo(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!po.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|_o(r,e);t=ho(t,n);var i=t.write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(bo(r)){var e=0|vo(r.length);return 0===(t=ho(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?ho(t,0):wo(t,r);if("Buffer"===r.type&&so(r.data))return wo(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function yo(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function mo(t,r){if(yo(r),t=ho(t,r<0?0:0|vo(r)),!po.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function wo(t,r){var e=r.length<0?0:0|vo(r.length);t=ho(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function vo(t){if(t>=co())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+co().toString(16)+" bytes");return 0|t}function bo(t){return!(null==t||!t._isBuffer)}function _o(t,r){if(bo(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 Xo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return qo(t).length;default:if(n)return Xo(t).length;r=(""+r).toLowerCase(),n=!0}}function Eo(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 Fo(this,r,e);case"utf8":case"utf-8":return Bo(this,r,e);case"ascii":return Lo(this,r,e);case"latin1":case"binary":return Mo(this,r,e);case"base64":return Uo(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Co(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function To(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function xo(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=po.from(r,n)),bo(r))return 0===r.length?-1:Ao(t,r,e,n,i);if("number"==typeof r)return r&=255,po.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Ao(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Ao(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;o<u;o++)if(s(t,o)===s(r,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===f)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(e+f>u&&(e=u-f),o=e;o>=0;o--){for(var c=!0,h=0;h<f;h++)if(s(t,o+h)!==s(r,h)){c=!1;break}if(c)return o}return-1}function Ro(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(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<n;++a){var u=parseInt(r.substr(2*a,2),16);if(isNaN(u))return a;t[e+a]=u}return a}function Vo(t,r,e,n){return Zo(Xo(r,t.length-e),t,e,n)}function Oo(t,r,e,n){return Zo(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function jo(t,r,e,n){return Oo(t,r,e,n)}function So(t,r,e,n){return Zo(qo(r),t,e,n)}function Io(t,r,e,n){return Zo(function(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)n=(e=t.charCodeAt(a))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function Uo(t,r,e){return 0===r&&e===t.length?oo(t):oo(t.slice(r,e))}function Bo(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,a,u,f,s=t[i],l=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e)switch(c){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,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(t){var r=t.length;if(r<=Po)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Po));return e}(n)}po.poolSize=8192,po._augment=function(t){return t.__proto__=po.prototype,t},po.from=function(t,r,e){return go(null,t,r,e)},po.TYPED_ARRAY_SUPPORT&&(po.prototype.__proto__=Uint8Array.prototype,po.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&po[Symbol.species]),po.alloc=function(t,r,e){return function(t,r,e,n){return yo(r),r<=0?ho(t,r):void 0!==e?"string"==typeof n?ho(t,r).fill(e,n):ho(t,r).fill(e):ho(t,r)}(null,t,r,e)},po.allocUnsafe=function(t){return mo(null,t)},po.allocUnsafeSlow=function(t){return mo(null,t)},po.isBuffer=Ho,po.compare=function(t,r){if(!bo(t)||!bo(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},po.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},po.concat=function(t,r){if(!so(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return po.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=po.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!bo(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},po.byteLength=_o,po.prototype._isBuffer=!0,po.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)To(this,r,r+1);return this},po.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)To(this,r,r+3),To(this,r+1,r+2);return this},po.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)To(this,r,r+7),To(this,r+1,r+6),To(this,r+2,r+5),To(this,r+3,r+4);return this},po.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Bo(this,0,t):Eo.apply(this,arguments)},po.prototype.equals=function(t){if(!bo(t))throw new TypeError("Argument must be a Buffer");return this===t||0===po.compare(this,t)},po.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},po.prototype.compare=function(t,r,e,n,i){if(!bo(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;l<u;++l)if(f[l]!==s[l]){o=f[l],a=s[l];break}return o<a?-1:a<o?1:0},po.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},po.prototype.indexOf=function(t,r,e){return xo(this,t,r,e,!0)},po.prototype.lastIndexOf=function(t,r,e){return xo(this,t,r,e,!1)},po.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(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 Ro(this,t,r,e);case"utf8":case"utf-8":return Vo(this,t,r,e);case"ascii":return Oo(this,t,r,e);case"latin1":case"binary":return jo(this,t,r,e);case"base64":return So(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Io(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},po.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Po=4096;function Lo(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function Mo(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Fo(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=$o(t[o]);return i}function Co(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function ko(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function No(t,r,e,n,i,o){if(!bo(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function Yo(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Do(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function zo(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 Wo(t,r,e,n,i){return i||zo(t,0,e,4),uo(t,r,e,n,23,4),e+4}function Go(t,r,e,n,i){return i||zo(t,0,e,8),uo(t,r,e,n,52,8),e+8}po.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),r<t&&(r=t),po.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=po.prototype;else{var i=r-t;e=new po(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},po.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||ko(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},po.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||ko(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},po.prototype.readUInt8=function(t,r){return r||ko(t,1,this.length),this[t]},po.prototype.readUInt16LE=function(t,r){return r||ko(t,2,this.length),this[t]|this[t+1]<<8},po.prototype.readUInt16BE=function(t,r){return r||ko(t,2,this.length),this[t]<<8|this[t+1]},po.prototype.readUInt32LE=function(t,r){return r||ko(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},po.prototype.readUInt32BE=function(t,r){return r||ko(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},po.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||ko(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},po.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||ko(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},po.prototype.readInt8=function(t,r){return r||ko(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},po.prototype.readInt16LE=function(t,r){r||ko(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},po.prototype.readInt16BE=function(t,r){r||ko(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},po.prototype.readInt32LE=function(t,r){return r||ko(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},po.prototype.readInt32BE=function(t,r){return r||ko(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},po.prototype.readFloatLE=function(t,r){return r||ko(t,4,this.length),ao(this,t,!0,23,4)},po.prototype.readFloatBE=function(t,r){return r||ko(t,4,this.length),ao(this,t,!1,23,4)},po.prototype.readDoubleLE=function(t,r){return r||ko(t,8,this.length),ao(this,t,!0,52,8)},po.prototype.readDoubleBE=function(t,r){return r||ko(t,8,this.length),ao(this,t,!1,52,8)},po.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||No(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},po.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||No(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},po.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,1,255,0),po.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},po.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,2,65535,0),po.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Yo(this,t,r,!0),r+2},po.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,2,65535,0),po.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Yo(this,t,r,!1),r+2},po.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,4,4294967295,0),po.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Do(this,t,r,!0),r+4},po.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,4,4294967295,0),po.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Do(this,t,r,!1),r+4},po.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);No(this,t,r,e,i-1,-i)}var o=0,a=1,u=0;for(this[r]=255&t;++o<e&&(a*=256);)t<0&&0===u&&0!==this[r+o-1]&&(u=1),this[r+o]=(t/a>>0)-u&255;return r+e},po.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);No(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},po.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,1,127,-128),po.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},po.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,2,32767,-32768),po.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Yo(this,t,r,!0),r+2},po.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,2,32767,-32768),po.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Yo(this,t,r,!1),r+2},po.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,4,2147483647,-2147483648),po.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Do(this,t,r,!0),r+4},po.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||No(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),po.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Do(this,t,r,!1),r+4},po.prototype.writeFloatLE=function(t,r,e){return Wo(this,t,r,!0,e)},po.prototype.writeFloatBE=function(t,r,e){return Wo(this,t,r,!1,e)},po.prototype.writeDoubleLE=function(t,r,e){return Go(this,t,r,!0,e)},po.prototype.writeDoubleBE=function(t,r,e){return Go(this,t,r,!1,e)},po.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<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!po.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},po.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!po.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var a=bo(t)?t:Xo(new po(t,n).toString()),u=a.length;for(o=0;o<e-r;++o)this[o+r]=a[o%u]}return this};var Jo=/[^+\/0-9A-Za-z-_]/g;function $o(t){return t<16?"0"+t.toString(16):t.toString(16)}function Xo(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((e=t.charCodeAt(a))>55295&&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 qo(t){return function(t){var r,e,n,i,o,a;eo||no();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 ro(3*u/4-o),n=o>0?u-4:u;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=to[t.charCodeAt(r)]<<18|to[t.charCodeAt(r+1)]<<12|to[t.charCodeAt(r+2)]<<6|to[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=255&i;return 2===o?(i=to[t.charCodeAt(r)]<<2|to[t.charCodeAt(r+1)]>>4,a[f++]=255&i):1===o&&(i=to[t.charCodeAt(r)]<<10|to[t.charCodeAt(r+1)]<<4|to[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(Jo,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Zo(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ho(t){return null!=t&&(!!t._isBuffer||Ko(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Ko(t.slice(0,0))}(t))}function Ko(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Qo=Object.freeze({__proto__:null,Buffer:po,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),po.alloc(+t)},isBuffer:Ho,kMaxLength:lo}),ta=po;function ra(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 ea,na=ra(Qo).Buffer;ea=function(){var t,r;if("function"!=typeof ta)return!1;try{t=yt(r="function"==typeof ta.from?ta.from([1,2,3,4]):new ta([1,2,3,4]))&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t}()?na:function(){throw new Error("not implemented")};var ia=ea,oa={binary:ia,float64:Or,float32:on,generic:Array,int16:bn,int32:yn,int8:Sn,uint16:vr,uint32:ln,uint8:pr,uint8c:An,complex64:ri,complex128:fi};function aa(t){return oa[t]||null}var ua=wt(ia.allocUnsafe)?function(t){if(!Yt(t))throw new TypeError(N("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return ia.allocUnsafe(t)}:function(t){if(!Yt(t))throw new TypeError(N("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return new ia(t)};function fa(t,r){return"generic"===t?function(t){var r,e;for(r=[],e=0;e<t;e++)r.push(0);return r}(r):"binary"===t?function(t){return function(t){var r;for(r=0;r<t.length;r++)t[r]=0;return t}(ua(t))}(r):function(t,r){var e=aa(t);return e?new e(r):null}(t,r)}var sa={Buffer:"binary",Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Object:"generic",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},la=[Or,on,yn,ln,bn,vr,Sn,pr,An,ri,fi],ca=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],ha=ca.length;function pa(t){var r;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(r=t.dtype,gi(r))return r;throw new TypeError(N("invalid argument. Must provide an ndarray having a supported data type. Value: `%s`.",r))}function ga(t){var r,e,n,i;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!ae(e=t.shape))throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));for(r=[],i=0;i<e.length;i++){if(!kt(n=e[i]))throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));r.push(n)}return r}function ya(t){var r,e,n,i,o,a;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!ae(i=t.strides)){if(!ae(n=t.shape))throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));return 0===n.length?[0]:(Je(e=t.order)||(e="row-major"),Be(n,e))}for(r=[],a=0;a<i.length;a++){if(!Mt(o=i[a]))throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));r.push(o)}return r}function ma(t){var r,e,n;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(kt(n=t.offset))return n;if(!ae(e=t.shape))throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(r=t.strides,0===e.length||!ae(r))return 0;if(kt(n=Pe(e,r)))return n;throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t))}var da="row-major",wa="column-major";function va(t){var r;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));return Je(r=t.order)?r:1===(r=Jt(ya(t)))||3===r?da:2===r?wa:0===function(t){var r,e;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(kt(e=t.ndims))return e;if(!ae(r=t.shape))throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));return r.length}(t)?da:null}function ba(t){var r;if("object"!=typeof t||null===t)throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(ae(r=t.data))return r;throw new TypeError(N("invalid argument. Must provide an ndarray. Value: `%s`.",t))}function _a(t,r){var e=r[0];return In(e)&&(t.push(e.length),_a(t,e)),t}function Ea(t,r,e,n,i){var o,a,u;for(o=r[e],u=0;u<n.length;u++){if(!In(a=n[u])||a.length!==o)return e;if(i&&(a=Ea(t,r,e+1,a,e+1<t-1))<t)return a}return t}function Ta(t){var r,e;if(!In(t))throw new TypeError(N("invalid argument. Must provide an array-like object. Value: `%s`.",t));return _a(r=[t.length],t),(e=r.length)>1&&(r.length=Ea(e,r,1,t,e>2)),r}function xa(t){return function(t,r){var e,n;for(e=[],n=0;n<r;n++)e.push(t);return e}(0,t)}function Aa(t,r,e,n,i,o){var a,u,f,s,l;for(a=t.length,u=1,l=0;l<a;l++)u*=t[l];if("clamp"===o)i<0?i=0:i>=u&&(i=u-1);else if("wrap"===o)i<0?(i+=u)<0&&0!==(i%=u)&&(i+=u):i>=u&&(i-=u)>=u&&(i%=u);else if("normalize"===o&&i<0&&(i+=u),i<0||i>=u)throw new RangeError(N("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",u,i));if(f=e,"column-major"===n){for(l=0;l<a;l++)i-=s=i%t[l],i/=t[l],f+=s*r[l];return f}for(l=a-1;l>=0;l--)i-=s=i%t[l],i/=t[l],f+=s*r[l];return f}var Ra={float64:function(t,r,e){t[r]=e},float32:function(t,r,e){t[r]=e},int32:function(t,r,e){t[r]=e},int16:function(t,r,e){t[r]=e},int8:function(t,r,e){t[r]=e},uint32:function(t,r,e){t[r]=e},uint16:function(t,r,e){t[r]=e},uint8:function(t,r,e){t[r]=e},uint8c:function(t,r,e){t[r]=e},generic:function(t,r,e){t[r]=e},default:function(t,r,e){t[r]=e}};function Va(t){var r=Ra[t];return"function"==typeof r?r:Ra.default}var Oa={complex128:function(t,r,e){t.set(e,r)},complex64:function(t,r,e){t.set(e,r)},default:function(t,r,e){t.set(e,r)}};function ja(t){var r=Oa[t];return"function"==typeof r?r:Oa.default}function Sa(t){var r=hi(t);return Xe(t)?{data:t,dtype:r,accessorProtocol:!0,accessors:[Ze(r),ja(r)]}:{data:t,dtype:r,accessorProtocol:!1,accessors:[Ke(r),Va(r)]}}function Ia(t,r,e,n){var i,o,a,u,f,s,l,c;for(i=r.data,a=r.accessors[0],o=r.accessors[1],l=Bt(t/2),s=(f=n)+(t-1)*e,c=0;c<l;c++)u=a(i,f),o(i,f,a(i,s)),o(i,s,u),f+=e,s-=e;return r}var Ua=3;function Ba(t,r,e){var n,i,o,a,u,f,s;if(t<=0)return r;if((a=Sa(r)).accessorProtocol)return Ia(t,a,e,i=e<0?(1-t)*e:0),a.data;if(f=Bt(t/2),1===e){if(o=t-1,(u=f%Ua)>0)for(i=0;i<u;i++)n=r[i],r[i]=r[o],r[o]=n,o-=1;if(f<Ua)return r;for(i=u;i<f;i+=Ua)n=r[i],r[i]=r[o],r[o]=n,n=r[i+1],r[i+1]=r[o-1],r[o-1]=n,n=r[i+2],r[i+2]=r[o-2],r[o-2]=n,o-=Ua;return r}for(o=(i=e<0?(1-t)*e:0)+(t-1)*e,s=0;s<f;s++)n=r[i],r[i]=r[o],r[o]=n,i+=e,o-=e;return r}q(Ba,"ndarray",(function(t,r,e,n){var i,o,a,u,f,s,l;if(t<=0)return r;if((u=Sa(r)).accessorProtocol)return Ia(t,u,e,n),u.data;if(s=Bt(t/2),o=n,1===e){if(a=o+t-1,(f=s%3)>0)for(l=0;l<f;l++)i=r[o],r[o]=r[a],r[a]=i,o+=e,a-=e;if(s<3)return r;for(l=f;l<s;l+=3)i=r[o],r[o]=r[a],r[a]=i,i=r[o+1],r[o+1]=r[a-1],r[a-1]=i,i=r[o+2],r[o+2]=r[a-2],r[a-2]=i,o+=3,a-=3;return r}for(a=o+(t-1)*e,l=0;l<s;l++)i=r[o],r[o]=r[a],r[a]=i,o+=e,a-=e;return r}));var Pa="throw";function La(t,r,e,n,i){var o;for(o=0;o<r;o++)e[i]=t[o],i+=n}function Ma(t,r,e,n,i,o,a){var u,f,s,l;for(u=(s=n+1)===r,f=e[n],l=0;l<f;l++)u?(i[a]=t[l],a+=o):a=Ma(t[l],r,e,s,i,o,a);return a}function Fa(t,r,e,n,i,o){var a=r.length;return 0===a?n:1===a?(La(t,r[0],n,i,o),n):e?(function(t,r,e,n,i,o){var a,u,f,s,l,c,h;for(Ma(t,r,e,0,u=xa(a=Le(e)),1,0),l=Be(e,f="row-major"),La(e,r,s=xa(r),1,0),Ba(r,s,1),Ba(r,l,1),h=0;h<a;h++)c=Aa(s,l,0,f,h,Pa),n[o]=u[c],o+=i}(t,a,r,n,i,o),n):(Ma(t,a,r,0,n,i,o),n)}function Ca(t,r,e){return Fa(t,r,e,xa(Le(r)),1,0)}function ka(){var t,r=arguments,e="https://stdlib.io/e/"+r[0]+"?";for(t=1;t<r.length;t++)e+="&arg[]="+encodeURIComponent(r[t]);return e}function Na(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Pt(t.length)&&t.length>=0&&t.length<It}q(Ca,"assign",Fa);var Ya="number";var Da={complex64:Mn,complex128:Un};function za(t,r){var e,n,i,o,a,u;if((a=Sa(n=new(aa(r))(e=t.length))).accessorProtocol)for(i=a.accessors[1],o=function(t,r,e){var n;if(!wt(t))throw new TypeError(N("invalid argument. First argument must be a function. Value: `%s`.",t));if(!kt(r))throw new TypeError(N("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(!wt(e))throw new TypeError(N("invalid argument. Third argument must be a constructor function. Value: `%s`.",e));return n=[function(){var r=t();return typeof r===Ya?new e(r,0):r},function(r){var n=t(r);return typeof n===Ya?new e(n,0):n},function(r,n){var i=t(r,n);return typeof i===Ya?new e(i,0):i},function(r,n,i){var o=t(r,n,i);return typeof o===Ya?new e(o,0):o},function(r,n,i,o){var a=t(r,n,i,o);return typeof a===Ya?new e(a,0):a},function(r,n,i,o,a){var u=t(r,n,i,o,a);return typeof u===Ya?new e(u,0):u}],r<=5?n[r]:function(){var r,n,i;for(r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);return typeof(n=t.apply(null,r))===Ya?new e(n,0):n}}((function(r){return t.iget(r)}),1,function(t){return Da[t]||null}(r)),u=0;u<e;u++)i(n,u,o(u));else for(u=0;u<e;u++)n[u]=t.iget(u);return n}function Wa(t,r){var e;return e=new Ue(pa(t),ba(t),ga(t),ya(t),ma(t),va(t)),"generic"===r?function(t){var r,e,n;for(r=t.length,e=[],n=0;n<r;n++)e.push(t.iget(n));return e}(e):"binary"===r?function(t){var r,e,n;for(r=t.length,e=ua(r),n=0;n<r;n++)e[n]=t.iget(n);return e}(e):za(e,r)}var Ga={casting:yi.get("casting"),copy:!1,dtype:yi.get("dtypes.default"),flatten:!0,mode:yi.get("index_mode"),ndmin:0,order:yi.get("order"),readonly:!1};function Ja(){var t,e,n,i,o,a,u,s,l,c,h,p,g,y,m;if(1===arguments.length)if(Na(arguments[0]))n=arguments[0],t={};else{if(!xt(t=arguments[0]))throw new TypeError(ka("0hT56",t));if(r(t,"buffer")&&!Na(n=t.buffer))throw new TypeError(ka("0hT57","buffer",n))}else{if(!Na(n=arguments[0]))throw new TypeError(ka("0hT58",n));if(!xt(t=arguments[1]))throw new TypeError(ka("0hT2V",t))}if(n&&((m=n)instanceof Ue||null!==m&&"object"==typeof m&&"object"==typeof m.data&&"object"==typeof m.shape&&"object"==typeof m.strides&&"number"==typeof m.offset&&"string"==typeof m.order&&"number"==typeof m.ndims&&"string"==typeof m.dtype&&"number"==typeof m.length&&"object"==typeof m.flags&&"function"==typeof m.get&&"function"==typeof m.set?(u=pa(n),y=!0):(u=function(t){var r;if(f(t))return"generic";if(yt(t))return"binary";for(r=0;r<ha;r++)if(t instanceof la[r])return ca[r];return sa[mt(t)]||null}(n),y=!1)),c={},h={},r(t,"casting")){if(h.casting=t.casting,!ki(h.casting))throw new TypeError(ka("0hT59","casting",h.casting))}else h.casting=Ga.casting;if(r(t,"flatten")){if(h.flatten=t.flatten,!Z(h.flatten))throw new TypeError(ka("0hT2o","flatten",h.flatten))}else h.flatten=Ga.flatten;if(r(t,"ndmin")){if(h.ndmin=t.ndmin,!kt(h.ndmin))throw new TypeError(ka("0hT2t","ndmin",h.ndmin))}else h.ndmin=Ga.ndmin;if(r(t,"dtype")){if(a=t.dtype,!gi(a))throw new TypeError(ka("0hTBf","dtype",a));if(u&&!Ki(u,a,h.casting))throw new Error(ka("0hT5B",h.casting,u,a))}else a=u&&(y||"generic"!==u)?u:Ga.dtype;if(r(t,"order")){if("any"===(o=t.order)||"same"===o)y?"any"===o?o=3===Jt(ya(n))?Ga.order:va(n):"same"===o&&(o=va(n)):o=Ga.order;else if(!Je(o))throw new TypeError(ka("0hT5C","order",o))}else o=Ga.order;if(r(t,"mode")?c.mode=t.mode:c.mode=Ga.mode,r(t,"submode")?c.submode=t.submode:c.submode=[c.mode],r(t,"readonly")?c.readonly=t.readonly:c.readonly=Ga.readonly,r(t,"copy")){if(h.copy=t.copy,!Z(h.copy))throw new TypeError(ka("0hT2o","copy",h.copy))}else h.copy=Ga.copy;if(r(t,"shape")){if(!Na(s=t.shape))throw new TypeError(ka("0hT5D","shape",s));l=s.length,g=Le(s)}else{if(!n)throw new Error(ka("0hT0X"));y?(l=(s=ga(n)).length,g=Le(s)):h.flatten&&f(n)?(p=s=Ta(n),l=s.length,g=Le(s)):(l=1,s=[g=n.length])}if(l<h.ndmin&&(s=function(t,r,e){var n,i;for(n=[],i=0;i<e-t;i++)n.push(1);for(i=0;i<t;i++)n.push(r[i]);return n}(l,s,h.ndmin),l=h.ndmin),y){if(Le(n.shape)!==g)throw new RangeError(ka("0hT0Y"));u!==a||h.copy?n=Wa(n,a):(e=ya(n),i=ma(n),n=ba(n),e.length<l&&(e=function(t,r,e,n){var i,o,a,u,f;if(f=t-(o=e.length),i=[],"row-major"===n){for(a=Gt(e[0])*r[f],u=0;u<f;u++)i.push(a);for(u=0;u<o;u++)i.push(e[u])}else{for(u=0;u<f;u++)i.push(1);for(u=0;u<o;u++)i.push(e[u])}return i}(l,s,e,o)))}else if(n){if("generic"===u&&h.flatten&&(n=Ca(n,p||Ta(n),"column-major"===o)),n.length!==g)throw new RangeError(ka("0hT0Y"));(u!==a||h.copy)&&(n=function(t,r,e){var n,i,o;if(n=aa(e),"generic"===e)for(i=[],o=0;o<r;o++)i.push(t[o]);else if("binary"===e)for(i=ua(r),o=0;o<r;o++)i[o]=t[o];else for(i=new n(r),o=0;o<r;o++)i[o]=t[o];return i}(n,g,a))}else n=fa(a,g);return void 0===e&&(i=Pe(s,e=Be(s,o))),new Pi(a,n,s,e,i,o,c)}export{Ja as default};
//# sourceMappingURL=mod.js.map