-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.js
4 lines (4 loc) · 117 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 e(e,r){return null!=e&&t.call(e,r)}var r="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function n(){return r&&"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 r,n,o;if(null==t)return i.call(t);n=t[a],r=e(t,a);try{t[a]=void 0}catch(e){return i.call(t)}return o=i.call(t),r?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 l(t){return"object"==typeof t&&null!==t&&!f(t)}var s=/./,c="function"==typeof Object.defineProperty?Object.defineProperty:null;var p=Object.defineProperty;function h(t){return"number"==typeof t}function y(t){var e,r="";for(e=0;e<t;e++)r+="0";return r}function g(t,e,r){var n=!1,i=e-t.length;return i<0||(function(t){return"-"===t[0]}(t)&&(n=!0,t=t.substr(1)),t=r?t+y(i):y(i)+t,n&&(t="-"+t)),t}var m=String.prototype.toLowerCase,d=String.prototype.toUpperCase;function v(t){var e,r,n;switch(t.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(r=t.arg,n=parseInt(r,10),!isFinite(n)){if(!h(r))throw new Error("invalid integer. Value: "+r);n=0}return n<0&&("u"===t.specifier||10!==e)&&(n=4294967295+n+1),n<0?(r=(-n).toString(e),t.precision&&(r=g(r,t.precision,t.padRight)),r="-"+r):(r=n.toString(e),n||t.precision?t.precision&&(r=g(r,t.precision,t.padRight)):r="",t.sign&&(r=t.sign+r)),16===e&&(t.alternate&&(r="0x"+r),r=t.specifier===d.call(t.specifier)?d.call(r):m.call(r)),8===e&&t.alternate&&"0"!==r.charAt(0)&&(r="0"+r),r}function b(t){return"string"==typeof t}var w=Math.abs,_=String.prototype.toLowerCase,E=String.prototype.toUpperCase,A=String.prototype.replace,T=/e\+(\d)$/,x=/e-(\d)$/,j=/^(\d+)$/,O=/^(\d+)e/,S=/\.0$/,R=/\.0*e/,I=/(\..*[^0])0*e/;function P(t){var e,r,n=parseFloat(t.arg);if(!isFinite(n)){if(!h(t.arg))throw new Error("invalid floating-point number. Value: "+r);n=t.arg}switch(t.specifier){case"e":case"E":r=n.toExponential(t.precision);break;case"f":case"F":r=n.toFixed(t.precision);break;case"g":case"G":w(n)<1e-4?((e=t.precision)>0&&(e-=1),r=n.toExponential(e)):r=n.toPrecision(t.precision),t.alternate||(r=A.call(r,I,"$1e"),r=A.call(r,R,"e"),r=A.call(r,S,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return r=A.call(r,T,"e+0$1"),r=A.call(r,x,"e-0$1"),t.alternate&&(r=A.call(r,j,"$1."),r=A.call(r,O,"$1.e")),n>=0&&t.sign&&(r=t.sign+r),r=t.specifier===E.call(t.specifier)?E.call(r):_.call(r)}function B(t){var e,r="";for(e=0;e<t;e++)r+=" ";return r}function V(t,e,r){var n=e-t.length;return n<0?t:t=r?t+B(n):B(n)+t}var U=String.fromCharCode,L=isNaN,M=Array.isArray;function k(t){var e={};return e.specifier=t.specifier,e.precision=void 0===t.precision?1:t.precision,e.width=t.width,e.flags=t.flags||"",e.mapping=t.mapping,e}function N(t){var e,r,n,i,o,a,u,f,l;if(!M(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(b(n=t[f]))a+=n;else{if(e=void 0!==n.precision,!(n=k(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+f+"`. Value: `"+n+"`.");for(n.mapping&&(u=n.mapping),r=n.flags,l=0;l<r.length;l++)switch(i=r.charAt(l)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=r.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,L(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(e&&"*"===n.precision){if(n.precision=parseInt(arguments[u],10),u+=1,L(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,e=!1)}switch(n.arg=arguments[u],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(n.padZeros=!1),n.arg=v(n);break;case"s":n.maxWidth=e?n.precision:-1;break;case"c":if(!L(n.arg)){if((o=parseInt(n.arg,10))<0||o>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=L(o)?String(n.arg):U(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=P(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=g(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=V(n.arg,n.width,n.padRight)),a+=n.arg||"",u+=1}return a}var C=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function Y(t){var e={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]&&(e.precision="1"),e}function F(t){var e,r,n,i;for(r=[],i=0,n=C.exec(t);n;)(e=t.slice(i,C.lastIndex-n[0].length)).length&&r.push(e),r.push(Y(n)),i=C.lastIndex,n=C.exec(t);return(e=t.slice(i)).length&&r.push(e),r}function D(t){return"string"==typeof t}function G(t){var e,r,n;if(!D(t))throw new TypeError(G("invalid argument. First argument must be a string. Value: `%s`.",t));for(e=F(t),(r=new Array(arguments.length))[0]=e,n=1;n<r.length;n++)r[n]=arguments[n];return N.apply(null,r)}var W,z=Object.prototype,J=z.toString,$=z.__defineGetter__,X=z.__defineSetter__,q=z.__lookupGetter__,H=z.__lookupSetter__;W=function(){try{return c({},"x",{}),!0}catch(t){return!1}}()?p:function(t,e,r){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===J.call(t))throw new TypeError(G("invalid argument. First argument must be an object. Value: `%s`.",t));if("object"!=typeof r||null===r||"[object Array]"===J.call(r))throw new TypeError(G("invalid argument. Property descriptor must be an object. Value: `%s`.",r));if((i="value"in r)&&(q.call(t,e)||H.call(t,e)?(n=t.__proto__,t.__proto__=z,delete t[e],t[e]=r.value,t.__proto__=n):t[e]=r.value),o="get"in r,a="set"in r,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&&$&&$.call(t,e,r.get),a&&X&&X.call(t,e,r.set),t};var Z=W;function K(t,e,r){Z(t,e,{configurable:!1,enumerable:!1,writable:!1,value:r})}function Q(t){return"boolean"==typeof t}var tt=Boolean,et=Boolean.prototype.toString;var rt=n();function nt(t){return"object"==typeof t&&(t instanceof tt||(rt?function(t){try{return et.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===u(t)))}function it(t){return Q(t)||nt(t)}function ot(){return new Function("return this;")()}K(it,"isPrimitive",Q),K(it,"isObject",nt);var at="object"==typeof self?self:null,ut="object"==typeof window?window:null,ft="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},lt="object"==typeof ft?ft:null,st="object"==typeof globalThis?globalThis:null;function ct(t){if(arguments.length){if(!Q(t))throw new TypeError(G("invalid argument. Must provide a boolean. Value: `%s`.",t));if(t)return ot()}if(st)return st;if(at)return at;if(ut)return ut;if(lt)return lt;throw new Error("unexpected error. Unable to resolve global object.")}var pt=ct(),ht=pt.document&&pt.document.childNodes,yt=Int8Array;function gt(){return/^\s*function\s*([^(]*)/i}var mt=/^\s*function\s*([^(]*)/i;function dt(t){return null!==t&&"object"==typeof t}K(gt,"REGEXP",mt);var vt=function(t){if("function"!=typeof t)throw new TypeError(G("invalid argument. Must provide a function. Value: `%s`.",t));return function(e){var r,n;if(!f(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}(dt);function bt(t){return dt(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function wt(t){var e,r,n;if(("Object"===(r=u(t).slice(8,-1))||"Error"===r)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(e=mt.exec(n.toString()))return e[1]}return bt(t)?"Buffer":r}K(dt,"isObjectLikeArray",vt);var _t="function"==typeof s||"object"==typeof yt||"function"==typeof ht?function(t){return wt(t).toLowerCase()}:function(t){var e;return null===t?"null":"object"===(e=typeof t)?wt(t).toLowerCase():e};function Et(t){return"function"===_t(t)}var At,Tt=Object,xt=Object.getPrototypeOf;At=Et(Object.getPrototypeOf)?xt:function(t){var e=function(t){return t.__proto__}(t);return e||null===e?e:"[object Function]"===u(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null};var jt=At;var Ot=Object.prototype;function St(t){var r;return!!l(t)&&(r=function(t){return null==t?null:(t=Tt(t),jt(t))}(t),!r||!e(t,"constructor")&&e(r,"constructor")&&Et(r.constructor)&&"[object Function]"===u(r.constructor)&&e(r,"isPrototypeOf")&&Et(r.isPrototypeOf)&&(r===Ot||function(t){var r;for(r in t)if(!e(t,r))return!1;return!0}(t)))}function Rt(t){return"number"==typeof t}var It=Number,Pt=It.prototype.toString;var Bt=n();function Vt(t){return"object"==typeof t&&(t instanceof It||(Bt?function(t){try{return Pt.call(t),!0}catch(t){return!1}}(t):"[object Number]"===u(t)))}function Ut(t){return Rt(t)||Vt(t)}K(Ut,"isPrimitive",Rt),K(Ut,"isObject",Vt);var Lt=Number.POSITIVE_INFINITY,Mt=It.NEGATIVE_INFINITY,kt=Math.floor;function Nt(t){return kt(t)===t}function Ct(t){return t<Lt&&t>Mt&&Nt(t)}function Yt(t){return Rt(t)&&Ct(t)}function Ft(t){return Vt(t)&&Ct(t.valueOf())}function Dt(t){return Yt(t)||Ft(t)}function Gt(t){return Yt(t)&&t>=0}function Wt(t){return Ft(t)&&t.valueOf()>=0}function zt(t){return Gt(t)||Wt(t)}K(Dt,"isPrimitive",Yt),K(Dt,"isObject",Ft),K(zt,"isPrimitive",Gt),K(zt,"isObject",Wt);var Jt=ct();function $t(t,e,r){Z(t,e,{configurable:!1,enumerable:!1,get:r})}var Xt={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 qt(t){return Math.abs(t)}function Ht(t){var e,r,n,i,o,a;if(0===(r=t.length))return 0;for(e=!0,n=!0,i=qt(t[0]),a=1;a<r;a++){if(o=qt(t[a]),e&&o<i?e=!1:n&&o>i&&(n=!1),!n&&!e)return 0;i=o}return n&&e?3:n?1:2}function Zt(t,e){return e&&(2===t||3===t)}function Kt(t,e){return e&&(1===t||3===t)}function Qt(t,e,r){var n,i,o,a,u;for(n=t.length,i=r,o=r,u=0;u<n;u++){if(0===t[u])return[r,r];(a=e[u])>0?o+=a*(t[u]-1):a<0&&(i+=a*(t[u]-1))}return[i,o]}function te(t){return t.re}function ee(t){return t.im}function re(t){return"string"==typeof t}K(Qt,"assign",(function(t,e,r,n){var i,o,a,u,f;for(i=t.length,o=r,a=r,f=0;f<i;f++){if(0===t[f])return n[0]=r,n[1]=r,n;(u=e[f])>0?a+=u*(t[f]-1):u<0&&(o+=u*(t[f]-1))}return n[0]=o,n[1]=a,n}));var ne=String.prototype.valueOf;var ie=n();function oe(t){return"object"==typeof t&&(t instanceof String||(ie?function(t){try{return ne.call(t),!0}catch(t){return!1}}(t):"[object String]"===u(t)))}function ae(t){return re(t)||oe(t)}K(ae,"isPrimitive",re),K(ae,"isObject",oe);var ue=/[-\/\\^$*+?.()|[\]{}]/g;var fe=RegExp.prototype.exec;var le=n();function se(t){return"object"==typeof t&&(t instanceof RegExp||(le?function(t){try{return fe.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===u(t)))}function ce(t,e,r){if(!re(t))throw new TypeError(G("invalid argument. First argument must be a string. Value: `%s`.",t));if(re(e))e=new RegExp(function(t){var e,r;if(!re(t))throw new TypeError(G("invalid argument. Must provide a regular expression string. Value: `%s`.",t));if("/"===t[0])for(r=t.length-1;r>=0&&"/"!==t[r];r--);return void 0===r||r<=0?t.replace(ue,"\\$&"):(e=(e=t.substring(1,r)).replace(ue,"\\$&"),t=t[0]+e+t.substring(r))}(e),"g");else if(!se(e))throw new TypeError(G("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",e));if(!re(r)&&!Et(r))throw new TypeError(G("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",r));return function(t,e,r){return t.replace(e,r)}(t,e,r)}var pe={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 he="function"==typeof Uint8Array;var ye="function"==typeof Uint8Array?Uint8Array:null;var ge,me="function"==typeof Uint8Array?Uint8Array:void 0;ge=function(){var t,e,r;if("function"!=typeof ye)return!1;try{e=new ye(e=[1,3.14,-3.14,256,257]),r=e,t=(he&&r instanceof Uint8Array||"[object Uint8Array]"===u(r))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?me:function(){throw new Error("not implemented")};var de=ge,ve="function"==typeof Uint16Array;var be="function"==typeof Uint16Array?Uint16Array:null;var we,_e="function"==typeof Uint16Array?Uint16Array:void 0;we=function(){var t,e,r;if("function"!=typeof be)return!1;try{e=new be(e=[1,3.14,-3.14,65536,65537]),r=e,t=(ve&&r instanceof Uint16Array||"[object Uint16Array]"===u(r))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?_e:function(){throw new Error("not implemented")};var Ee,Ae=we,Te={uint16:Ae,uint8:de};(Ee=new Te.uint16(1))[0]=4660;var xe=52===new Te.uint8(Ee.buffer)[0],je="function"==typeof ArrayBuffer;function Oe(t){return je&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===u(t)}var Se="function"==typeof Float64Array;var Re="function"==typeof Float64Array?Float64Array:null;var Ie,Pe="function"==typeof Float64Array?Float64Array:void 0;Ie=function(){var t,e,r;if("function"!=typeof Re)return!1;try{e=new Re([1,3.14,-3.14,NaN]),r=e,t=(Se&&r instanceof Float64Array||"[object Float64Array]"===u(r))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){t=!1}return t}()?Pe:function(){throw new Error("not implemented")};var Be=Ie,Ve="function"==typeof ArrayBuffer?ArrayBuffer:null;var Ue,Le="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Ue=function(){var t,e,r;if("function"!=typeof Ve)return!1;try{(t=Oe(r=new Ve(16))&&"function"==typeof Ve.isView)&&((e=new Be(r))[0]=-3.14,e[1]=NaN,t=t&&Ve.isView(e)&&16===r.byteLength&&-3.14===e[0]&&e[1]!=e[1])}catch(e){t=!1}return t}()?Le:function(){throw new Error("not implemented")};var Me=Ue,ke="function"==typeof DataView;var Ne="function"==typeof DataView?DataView:null;var Ce,Ye="function"==typeof DataView?DataView:void 0;Ce=function(){var t,e,r,n;if("function"!=typeof Ne)return!1;try{r=new Me(24),e=new Ne(r,8),n=e,(t=(ke&&n instanceof DataView||"[object DataView]"===u(n))&&"function"==typeof e.getFloat64&&"function"==typeof e.setFloat64)&&(e.setFloat64(0,-3.14),e.setFloat64(8,NaN),t=t&&e.buffer===r&&16===e.byteLength&&8===e.byteOffset&&-3.14===e.getFloat64(0)&&e.getFloat64(8)!=e.getFloat64(8))}catch(e){t=!1}return t}()?Ye:function(){throw new Error("not implemented")};var Fe=Ce,De="function"==typeof BigInt?BigInt:void 0,Ge={all:["binary","complex64","complex128","float32","float64","generic","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 We(){var t;return 0===arguments.length?Ge.all.slice():(t=Ge[arguments[0]])?t.slice():[]}function ze(){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 Je(t,e,r){Z(t,e,{configurable:!1,enumerable:!0,writable:!1,value:r})}function $e(t){return Object.keys(Object(t))}var Xe=void 0!==Object.keys;function qe(t){return"[object Arguments]"===u(t)}var He=function(){return qe(arguments)}();function Ze(t){return t!=t}function Ke(t){return Rt(t)&&Ze(t)}function Qe(t){return Vt(t)&&Ze(t.valueOf())}function tr(t){return Ke(t)||Qe(t)}K(tr,"isPrimitive",Ke),K(tr,"isObject",Qe);var er=Object.prototype.propertyIsEnumerable;var rr=!er.call("beep","0");function nr(t,e){var r;return null!=t&&(!(r=er.call(t,e))&&rr&&ae(t)?!Ke(e=+e)&&Yt(e)&&e>=0&&e<t.length:r)}var ir=He?qe:function(t){return null!==t&&"object"==typeof t&&!f(t)&&"number"==typeof t.length&&Nt(t.length)&&t.length>=0&&t.length<=4294967295&&e(t,"callee")&&!nr(t,"callee")},or=Array.prototype.slice;var ar=nr((function(){}),"prototype"),ur=!nr({toString:null},"toString");function fr(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Nt(t.length)&&t.length>=0&&t.length<=9007199254740991}function lr(t,e,r){var n,i;if(!fr(t)&&!re(t))throw new TypeError(G("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(!Yt(r))throw new TypeError(G("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(tr(e)){for(;i<n;i++)if(tr(t[i]))return i}else for(;i<n;i++)if(t[i]===e)return i;return-1}function sr(t){return t.constructor&&t.constructor.prototype===t}var cr=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],pr="undefined"==typeof window?void 0:window;var hr=function(){var t;if("undefined"===_t(pr))return!1;for(t in pr)try{-1===lr(cr,t)&&e(pr,t)&&null!==pr[t]&&"object"===_t(pr[t])&&sr(pr[t])}catch(t){return!0}return!1}(),yr="undefined"!=typeof window;var gr=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var mr=Xe?function(){return 2!==($e(arguments)||"").length}(1,2)?function(t){return ir(t)?$e(or.call(t)):$e(t)}:$e:function(t){var r,n,i,o,a,u,f;if(o=[],ir(t)){for(f=0;f<t.length;f++)o.push(f.toString());return o}if("string"==typeof t){if(t.length>0&&!e(t,"0"))for(f=0;f<t.length;f++)o.push(f.toString())}else{if(!1==(i="function"==typeof t)&&!dt(t))return o;n=ar&&i}for(a in t)n&&"prototype"===a||!e(t,a)||o.push(String(a));if(ur)for(r=function(t){if(!1===yr&&!hr)return sr(t);try{return sr(t)}catch(t){return!1}}(t),f=0;f<gr.length;f++)u=gr[f],r&&"constructor"===u||!e(t,u)||o.push(String(u));return o};K(We,"enum",ze),function(t,e){var r,n,i;for(r=mr(e),i=0;i<r.length;i++)Je(t,n=r[i],e[n])}(We,{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 dr=["row-major","column-major"];function vr(){return dr.slice()}function br(){return{"row-major":1,"column-major":2}}K(vr,"enum",br);var wr=["throw","clamp","wrap"];function _r(){return wr.slice()}function Er(){return{throw:1,clamp:2,wrap:3}}K(_r,"enum",Er);var Ar={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},Tr={"row-major":1,"column-major":2},xr={throw:1,clamp:2,wrap:3};var jr=new de(8),Or=new Fe(jr.buffer);function Sr(t,e,r,n){var i,o,a;if(0===t){for(a=0;a<jr.length;a++)e[n]=0,n+=r;return e}for(o=(4294967295&t)>>>0,i=kt(t/4294967296),xe?(Or.setUint32(0,o,xe),Or.setUint32(4,i,xe)):(Or.setUint32(0,i,xe),Or.setUint32(4,o,xe)),a=0;a<jr.length;a++)e[n]=jr[a],n+=r;return e}K((function(t){var e,r,n,i;return e=new de(8),0===t||(i=(4294967295&t)>>>0,n=kt(t/4294967296),r=new Fe(e.buffer),xe?(r.setUint32(0,i,xe),r.setUint32(4,n,xe)):(r.setUint32(0,n,xe),r.setUint32(4,i,xe))),e}),"assign",Sr);var Rr={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},Ir={"row-major":1,"column-major":2},Pr={throw:1,clamp:2,wrap:3};function Br(t,e,r,n,i,o){var a,u,f,l,s;if(!(this instanceof Br))return new Br(t,e,r,n,i,o);for(l=1,s=0;s<r.length;s++)l*=r[s];return u=e.BYTES_PER_ELEMENT?e.BYTES_PER_ELEMENT*l:null,this._byteLength=u,this._bytesPerElement=function(t){return Xt[t]||null}(t),this._buffer=e,this._dtype=t,this._length=l,this._ndims=r.length,this._offset=i,this._order=o,this._shape=r,this._strides=n,this._accessors=tt(e.get&&e.set),this._iterationOrder=function(t){var e,r;for(e=0,r=0;r<t.length;r++)t[r]<0&&(e+=1);return 0===e?1:e===t.length?-1:0}(n),a=function(t,e,r,n,i){var o;return 0!==t&&0!==i&&t===(o=Qt(e,r,n))[1]-o[0]+1}(l,r,n,i,this._iterationOrder),f=Ht(n),this._flags={ROW_MAJOR_CONTIGUOUS:Kt(f,a),COLUMN_MAJOR_CONTIGUOUS:Zt(f,a),READONLY:!1},this.__meta_dataview__=null,this}function Vr(t){return t instanceof Br||null!==t&&"object"==typeof t&&"object"==typeof t.data&&"object"==typeof t.shape&&"object"==typeof t.strides&&"number"==typeof t.offset&&"string"==typeof t.order&&"number"==typeof t.ndims&&"string"==typeof t.dtype&&"number"==typeof t.length&&"object"==typeof t.flags&&"function"==typeof t.get&&"function"==typeof t.set}function Ur(t,e){return"column-major"===e?function(t){var e,r,n;for(e=[],r=1,n=0;n<t.length;n++)e.push(r),r*=t[n];return e}(t):function(t){var e,r,n,i;for(e=t.length,r=[],i=0;i<e;i++)r.push(0);for(n=1,i=e-1;i>=0;i--)r[i]=n,n*=t[i];return r}(t)}function Lr(t,e){var r,n,i;for(n=t.length,r=0,i=0;i<n;i++)e[i]<0&&(r-=e[i]*(t[i]-1));return r}function Mr(t){var e,r,n;if(0===(e=t.length))return 0;for(r=1,n=0;n<e;n++)r*=t[n];return r}K(Br,"name","ndarray"),$t(Br.prototype,"byteLength",(function(){return this._byteLength})),$t(Br.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),$t(Br.prototype,"data",(function(){return this._buffer})),$t(Br.prototype,"dtype",(function(){return this._dtype})),$t(Br.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})),$t(Br.prototype,"length",(function(){return this._length})),$t(Br.prototype,"ndims",(function(){return this._ndims})),$t(Br.prototype,"offset",(function(){return this._offset})),$t(Br.prototype,"order",(function(){return this._order})),$t(Br.prototype,"shape",(function(){return this._shape.slice()})),$t(Br.prototype,"strides",(function(){return this._strides.slice()})),K(Br.prototype,"get",(function(){var t,e;for(t=this._offset,e=0;e<arguments.length;e++)t+=this._strides[e]*arguments[e];return this._accessors?this._buffer.get(t):this._buffer[t]})),K(Br.prototype,"iget",(function(t){var e,r,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(r=this._shape,e=this._strides,i=this._offset,"column-major"===this._order){for(a=0;a<n;a++)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]}for(a=n-1;a>=0;a--)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),K(Br.prototype,"set",(function(){var t,e;for(t=this._offset,e=0;e<arguments.length-1;e++)t+=this._strides[e]*arguments[e];return this._accessors?this._buffer.set(arguments[e],t):this._buffer[t]=arguments[e],this})),K(Br.prototype,"iset",(function(t,e){var r,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(e,this._offset+t):this._buffer[this._offset+t]=e,this;if(-1===this._iterationOrder)return this._accessors?this._buffer.set(e,this._offset-t):this._buffer[this._offset-t]=e,this}if(n=this._shape,r=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*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this}for(u=i-1;u>=0;u--)t-=a=t%n[u],t/=n[u],o+=a*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this})),K(Br.prototype,"toString",(function(){var t,e,r,n,i,o;if(e=this._shape.length,r="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o<this._length;o++)t+=te(i=this.iget(o))+", "+ee(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+=te(i=this.iget(o))+", "+ee(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+=te(i=this.iget(this._length-1-o))+", "+ee(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(r+=ce(pe[this.dtype],"{{data}}",t),r+=", ",r+=0===e?"[]":"[ "+this._shape.join(", ")+" ]",r+=", ",r+="[ ",0===e)r+="0";else for(o=0;o<e;o++)this._strides[o]<0?r+=-this._strides[o]:r+=this._strides[o],o<e-1&&(r+=", ");return r+=" ]",r+=", ",r+="0",r+=", ",r+="'"+this._order+"'",r+=" )"})),K(Br.prototype,"toJSON",(function(){var t,e,r,n;for(e=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<e;n++)t.strides[n]<0&&(t.strides[n]*=-1);if(t.data=[],"complex64"===t.dtype||"complex128"===t.dtype)for(n=0;n<e;n++)r=this.iget(n),t.data.push(te(r),ee(r));else for(n=0;n<e;n++)t.data.push(this.iget(n));return t})),K(Br.prototype,"__array_meta_dataview__","function"==typeof Jt.BigInt&&"function"==typeof BigInt&&"bigint"==typeof Jt.BigInt("1")&&"bigint"==typeof BigInt("1")?function(){var t,e,r,n,i,o,a,u,f,l,s,c,p,h;if(f=this._mode||"throw",a=this._submode||[f],r=33+16*(c=this._ndims)+(p=a.length),(u=this.__meta_dataview__)&&u.byteLength===r)return u;for(u=new Fe(new Me(r)),i=this._shape,o=this._strides,n=this._dtype,t=this._bytesPerElement,l=0,u.setInt8(l,xe?1:0),l+=1,u.setInt16(l,Ar[n],xe),l+=2,u.setBigInt64(l,De(c),xe),s=8*c,l+=8,h=0;h<c;h++)u.setBigInt64(l,De(i[h]),xe),u.setBigInt64(l+s,De(o[h]*t),xe),l+=8;for(l+=s,u.setBigInt64(l,De(this._offset*t),xe),l+=8,u.setInt8(l,Tr[this._order]),l+=1,u.setInt8(l,xr[f]),l+=1,u.setBigInt64(l,De(p),xe),l+=8,h=0;h<p;h++)u.setInt8(l,xr[a[h]]),l+=1;return e=0,e|=this._flags.READONLY?4:0,u.setInt32(l,e,xe),this.__meta_dataview__=u,u}:function(){var t,e,r,n,i,o,a,u,f,l,s,c,p,h,y;if(l=this._mode||"throw",u=this._submode||[l],n=33+16*(p=this._ndims)+(h=u.length),(f=this.__meta_dataview__)&&f.byteLength===n)return f;for(f=new Fe(new Me(n)),e=new de(f.buffer),o=this._shape,a=this._strides,i=this._dtype,t=this._bytesPerElement,s=0,f.setInt8(s,xe?1:0),s+=1,f.setInt16(s,Rr[i],xe),Sr(p,e,1,s+=2),c=8*p,s+=8,y=0;y<p;y++)Sr(o[y],e,1,s),Sr(a[y]*t,e,1,s+c),s+=8;for(s+=c,Sr(this._offset*t,e,1,s),s+=8,f.setInt8(s,Ir[this._order]),s+=1,f.setInt8(s,Pr[l]),Sr(h,e,1,s+=1),s+=8,y=0;y<h;y++)f.setInt8(s,Pr[u[y]]),s+=1;return r=0,r|=this._flags.READONLY?4:0,f.setInt32(s,r,xe),this.__meta_dataview__=f,f}),K(Ur,"assign",(function(t,e,r){return"column-major"===e?function(t,e){var r,n;for(r=1,n=0;n<t.length;n++)e[n]=r,r*=t[n];return e}(t,r):function(t,e){var r,n;for(r=1,n=t.length-1;n>=0;n--)e[n]=r,r*=t[n];return e}(t,r)}));function kr(t){if("function"!=typeof t)throw new TypeError(G("invalid argument. Must provide a function. Value: `%s`.",t));return function(e){var r,n;if(!function(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&Nt(t.length)&&t.length>=0&&t.length<=4294967295}(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}var Nr=kr(zt.isPrimitive),Cr=kr(zt.isObject),Yr=kr(zt);K(Yr,"primitives",Nr),K(Yr,"objects",Cr);var Fr=kr(Dt.isPrimitive),Dr=kr(Dt.isObject),Gr=kr(Dt);K(Gr,"primitives",Fr),K(Gr,"objects",Dr);var Wr=vr(),zr=Wr.length;function Jr(t){var e;for(e=0;e<zr;e++)if(t===Wr[e])return!0;return!1}function $r(t){return"function"==typeof t.get&&"function"==typeof t.set}var Xr={complex128:function(t,e){return t.get(e)},complex64:function(t,e){return t.get(e)},default:function(t,e){return t.get(e)}};function qr(t){var e=Xr[t];return"function"==typeof e?e:Xr.default}var Hr={float64:function(t,e){return t[e]},float32:function(t,e){return t[e]},int32:function(t,e){return t[e]},int16:function(t,e){return t[e]},int8:function(t,e){return t[e]},uint32:function(t,e){return t[e]},uint16:function(t,e){return t[e]},uint8:function(t,e){return t[e]},uint8c:function(t,e){return t[e]},generic:function(t,e){return t[e]},default:function(t,e){return t[e]}};function Zr(t){var e=Hr[t];return"function"==typeof e?e:Hr.default}var Kr={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},Qr="function"==typeof Float32Array;var tn="function"==typeof Float32Array?Float32Array:null;var en,rn="function"==typeof Float32Array?Float32Array:void 0;en=function(){var t,e,r;if("function"!=typeof tn)return!1;try{e=new tn([1,3.14,-3.14,5e40]),r=e,t=(Qr&&r instanceof Float32Array||"[object Float32Array]"===u(r))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===Lt}catch(e){t=!1}return t}()?rn:function(){throw new Error("not implemented")};var nn=en,on="function"==typeof Uint32Array;var an="function"==typeof Uint32Array?Uint32Array:null;var un,fn="function"==typeof Uint32Array?Uint32Array:void 0;un=function(){var t,e,r;if("function"!=typeof an)return!1;try{e=new an(e=[1,3.14,-3.14,4294967296,4294967297]),r=e,t=(on&&r instanceof Uint32Array||"[object Uint32Array]"===u(r))&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?fn:function(){throw new Error("not implemented")};var ln=un,sn="function"==typeof Int32Array;var cn="function"==typeof Int32Array?Int32Array:null;var pn,hn="function"==typeof Int32Array?Int32Array:void 0;pn=function(){var t,e,r;if("function"!=typeof cn)return!1;try{e=new cn([1,3.14,-3.14,2147483648]),r=e,t=(sn&&r instanceof Int32Array||"[object Int32Array]"===u(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){t=!1}return t}()?hn:function(){throw new Error("not implemented")};var yn=pn,gn="function"==typeof Int16Array;var mn="function"==typeof Int16Array?Int16Array:null;var dn,vn="function"==typeof Int16Array?Int16Array:void 0;dn=function(){var t,e,r;if("function"!=typeof mn)return!1;try{e=new mn([1,3.14,-3.14,32768]),r=e,t=(gn&&r instanceof Int16Array||"[object Int16Array]"===u(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){t=!1}return t}()?vn:function(){throw new Error("not implemented")};var bn=dn,wn="function"==typeof Uint8ClampedArray;var _n="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var En,An="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;En=function(){var t,e,r;if("function"!=typeof _n)return!1;try{e=new _n([-1,0,1,3.14,4.99,255,256]),r=e,t=(wn&&r instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===u(r))&&0===e[0]&&0===e[1]&&1===e[2]&&3===e[3]&&5===e[4]&&255===e[5]&&255===e[6]}catch(e){t=!1}return t}()?An:function(){throw new Error("not implemented")};var Tn=En,xn="function"==typeof Int8Array;var jn="function"==typeof Int8Array?Int8Array:null;var On,Sn="function"==typeof Int8Array?Int8Array:void 0;On=function(){var t,e,r;if("function"!=typeof jn)return!1;try{e=new jn([1,3.14,-3.14,128]),r=e,t=(xn&&r instanceof Int8Array||"[object Int8Array]"===u(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){t=!1}return t}()?Sn:function(){throw new Error("not implemented")};var Rn=On;function In(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Nt(t.length)&&t.length>=0&&t.length<=4294967295}function Pn(t,e){if(!(this instanceof Pn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Rt(t))throw new TypeError(G("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Rt(e))throw new TypeError(G("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Z(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),Z(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}K(Pn,"BYTES_PER_ELEMENT",8),K(Pn.prototype,"BYTES_PER_ELEMENT",8),K(Pn.prototype,"byteLength",16),K(Pn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),K(Pn.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,Vn=new nn(1);var Un="function"==typeof Bn?Bn:function(t){return Vn[0]=t,Vn[0]};function Ln(t,e){if(!(this instanceof Ln))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Rt(t))throw new TypeError(G("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Rt(e))throw new TypeError(G("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Z(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Un(t)}),Z(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Un(e)}),this}function Mn(t){return t instanceof Pn||t instanceof Ln||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function kn(t){return Nt(t/2)}function Nn(){return"function"==typeof o&&"symbol"==typeof o("foo")&&e(o,"iterator")&&"symbol"==typeof o.iterator}K(Ln,"BYTES_PER_ELEMENT",4),K(Ln.prototype,"BYTES_PER_ELEMENT",4),K(Ln.prototype,"byteLength",8),K(Ln.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),K(Ln.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Cn=Nn()?Symbol.iterator:null;function Yn(t){return t.re}function Fn(t){return t.im}function Dn(t,e){return new nn(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function Gn(t,e){return new Be(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function Wn(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(In(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Mn(n))return new TypeError(G("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(Yn(n),Fn(n))}return e}function zn(t,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,In(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Mn(o))return new TypeError(G("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Yn(o),Fn(o))}return n}function Jn(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;i<r;i++){if(!Mn(n=e[i]))return null;t[o]=Yn(n),t[o+1]=Fn(n),o+=2}return t}var $n=2*nn.BYTES_PER_ELEMENT,Xn=Nn();function qn(t){return t instanceof Qn||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Hn(t){return t===Qn||"Complex128Array"===t.name}function Zn(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===$n}function Kn(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===2*$n}function Qn(){var t,e,r,n;if(e=arguments.length,!(this instanceof Qn))return 0===e?new Qn:1===e?new Qn(arguments[0]):2===e?new Qn(arguments[0],arguments[1]):new Qn(arguments[0],arguments[1],arguments[2]);if(0===e)r=new nn(0);else if(1===e)if(Gt(arguments[0]))r=new nn(2*arguments[0]);else if(fr(arguments[0]))if((n=(r=arguments[0]).length)&&f(r)&&Mn(r[0])){if(null===(r=Jn(new nn(2*n),r))){if(!kn(n))throw new RangeError(G("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new nn(arguments[0])}}else{if(Zn(r))r=Dn(r,0);else if(Kn(r))r=Gn(r,0);else if(!kn(n))throw new RangeError(G("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new nn(r)}else if(Oe(arguments[0])){if(!Nt((r=arguments[0]).byteLength/$n))throw new RangeError(G("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",$n,r.byteLength));r=new nn(r)}else{if(!l(arguments[0]))throw new TypeError(G("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(r=arguments[0],!1===Xn)throw new TypeError(G("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",r));if(!Et(r[Cn]))throw new TypeError(G("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if(!Et((r=r[Cn]()).next))throw new TypeError(G("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if((r=Wn(r))instanceof Error)throw r;r=new nn(r)}else{if(!Oe(r=arguments[0]))throw new TypeError(G("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",r));if(!Gt(t=arguments[1]))throw new TypeError(G("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Nt(t/$n))throw new RangeError(G("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",$n,t));if(2===e){if(!Nt((n=r.byteLength-t)/$n))throw new RangeError(G("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",$n,n));r=new nn(r,t)}else{if(!Gt(n=arguments[2]))throw new TypeError(G("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*$n>r.byteLength-t)throw new RangeError(G("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*$n));r=new nn(r,t,2*n)}}return K(this,"_buffer",r),K(this,"_length",r.length/2),this}function ti(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(In(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Mn(n))return new TypeError(G("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(te(n),ee(n))}return e}function ei(t,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,In(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Mn(o))return new TypeError(G("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(te(o),ee(o))}return n}function ri(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;i<r;i++){if(!Mn(n=e[i]))return null;t[o]=te(n),t[o+1]=ee(n),o+=2}return t}K(Qn,"BYTES_PER_ELEMENT",$n),K(Qn,"name","Complex64Array"),K(Qn,"from",(function(t){var e,r,n,i,o,a,u,f,s,c,p,h;if(!Et(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Hn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!Et(n=arguments[1]))throw new TypeError(G("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(qn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,h=0,p=0;p<f;p++){if(Mn(c=n.call(e,t.get(p),p)))o[h]=Yn(c),o[h+1]=Fn(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(G("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[h]=c[0],o[h+1]=c[1]}h+=2}return i}return new this(t)}if(fr(t)){if(n){for(f=t.length,u=t.get&&t.set?qr("default"):Zr("default"),p=0;p<f;p++)if(!Mn(u(t,p))){s=!0;break}if(s){if(!kn(f))throw new RangeError(G("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,p=0;p<f;p++)o[p]=n.call(e,u(t,p),p);return i}for(o=(i=new this(f))._buffer,h=0,p=0;p<f;p++){if(Mn(c=n.call(e,u(t,p),p)))o[h]=Yn(c),o[h+1]=Fn(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(G("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[h]=c[0],o[h+1]=c[1]}h+=2}return i}return new this(t)}if(l(t)&&Xn&&Et(t[Cn])){if(!Et((o=t[Cn]()).next))throw new TypeError(G("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if((a=n?zn(o,n,e):Wn(o))instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,p=0;p<f;p++)o[p]=a[p];return i}throw new TypeError(G("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),K(Qn,"of",(function(){var t,e;if(!Et(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Hn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),$t(Qn.prototype,"buffer",(function(){return this._buffer.buffer})),$t(Qn.prototype,"byteLength",(function(){return this._buffer.byteLength})),$t(Qn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),K(Qn.prototype,"BYTES_PER_ELEMENT",Qn.BYTES_PER_ELEMENT),K(Qn.prototype,"copyWithin",(function(t,e){if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),K(Qn.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,K(r={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new Ln(t[a+=2],t[a+1]),{value:[o,e],done:!1}})),K(r,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Cn&&K(r,Cn,(function(){return e.entries()})),r})),K(Qn.prototype,"get",(function(t){var e;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Gt(t))throw new TypeError(G("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return new Ln((e=this._buffer)[t*=2],e[t+1])})),$t(Qn.prototype,"length",(function(){return this._length})),K(Qn.prototype,"set",(function(t){var e,r,n,i,o,a,u,f,l;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!Gt(r=arguments[1]))throw new TypeError(G("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if(Mn(t)){if(r>=this._length)throw new RangeError(G("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));return n[r*=2]=Yn(t),void(n[r+1]=Fn(t))}if(qn(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,l=n.byteOffset+r*$n,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new nn(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(r*=2,l=0,f=0;f<a;f++)n[r]=e[l],n[r+1]=e[l+1],r+=2,l+=2}else{if(!fr(t))throw new TypeError(G("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(!Mn(t[f])){o=!0;break}if(o){if(!kn(a))throw new RangeError(G("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(r+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,l=n.byteOffset+r*$n,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new nn(a),f=0;f<a;f++)i[f]=e[f];e=i}for(r*=2,a/=2,l=0,f=0;f<a;f++)n[r]=e[l],n[r+1]=e[l+1],r+=2,l+=2;return}if(r+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,f=0;f<a;f++)u=t[f],n[r]=Yn(u),n[r+1]=Fn(u),r+=2}}));var ni=2*Be.BYTES_PER_ELEMENT,ii=Nn();function oi(t){return t instanceof li||"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===li||"Complex64Array"===t.name}function ui(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===ni/2}function fi(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===ni}function li(){var t,e,r,n;if(e=arguments.length,!(this instanceof li))return 0===e?new li:1===e?new li(arguments[0]):2===e?new li(arguments[0],arguments[1]):new li(arguments[0],arguments[1],arguments[2]);if(0===e)r=new Be(0);else if(1===e)if(Gt(arguments[0]))r=new Be(2*arguments[0]);else if(fr(arguments[0]))if((n=(r=arguments[0]).length)&&f(r)&&Mn(r[0])){if(null===(r=ri(new Be(2*n),r))){if(!kn(n))throw new RangeError(G("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new Be(arguments[0])}}else{if(ui(r))r=Dn(r,0);else if(fi(r))r=Gn(r,0);else if(!kn(n))throw new RangeError(G("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new Be(r)}else if(Oe(arguments[0])){if(!Nt((r=arguments[0]).byteLength/ni))throw new RangeError(G("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",ni,r.byteLength));r=new Be(r)}else{if(!l(arguments[0]))throw new TypeError(G("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(r=arguments[0],!1===ii)throw new TypeError(G("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",r));if(!Et(r[Cn]))throw new TypeError(G("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if(!Et((r=r[Cn]()).next))throw new TypeError(G("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if((r=ti(r))instanceof Error)throw r;r=new Be(r)}else{if(!Oe(r=arguments[0]))throw new TypeError(G("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",r));if(!Gt(t=arguments[1]))throw new TypeError(G("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Nt(t/ni))throw new RangeError(G("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",ni,t));if(2===e){if(!Nt((n=r.byteLength-t)/ni))throw new RangeError(G("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",ni,n));r=new Be(r,t)}else{if(!Gt(n=arguments[2]))throw new TypeError(G("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*ni>r.byteLength-t)throw new RangeError(G("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*ni));r=new Be(r,t,2*n)}}return K(this,"_buffer",r),K(this,"_length",r.length/2),this}K(li,"BYTES_PER_ELEMENT",ni),K(li,"name","Complex128Array"),K(li,"from",(function(t){var e,r,n,i,o,a,u,f,s,c,p,h;if(!Et(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((r=arguments.length)>1){if(!Et(n=arguments[1]))throw new TypeError(G("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(oi(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,h=0,p=0;p<f;p++){if(Mn(c=n.call(e,t.get(p),p)))o[h]=te(c),o[h+1]=ee(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(G("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[h]=c[0],o[h+1]=c[1]}h+=2}return i}return new this(t)}if(fr(t)){if(n){for(f=t.length,u=t.get&&t.set?qr("default"):Zr("default"),p=0;p<f;p++)if(!Mn(u(t,p))){s=!0;break}if(s){if(!kn(f))throw new RangeError(G("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,p=0;p<f;p++)o[p]=n.call(e,u(t,p),p);return i}for(o=(i=new this(f))._buffer,h=0,p=0;p<f;p++){if(Mn(c=n.call(e,u(t,p),p)))o[h]=te(c),o[h+1]=ee(c);else{if(!(In(c)&&c.length>=2))throw new TypeError(G("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",c));o[h]=c[0],o[h+1]=c[1]}h+=2}return i}return new this(t)}if(l(t)&&ii&&Et(t[Cn])){if(!Et((o=t[Cn]()).next))throw new TypeError(G("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if((a=n?ei(o,n,e):ti(o))instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,p=0;p<f;p++)o[p]=a[p];return i}throw new TypeError(G("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),K(li,"of",(function(){var t,e;if(!Et(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=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),$t(li.prototype,"buffer",(function(){return this._buffer.buffer})),$t(li.prototype,"byteLength",(function(){return this._buffer.byteLength})),$t(li.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),K(li.prototype,"BYTES_PER_ELEMENT",li.BYTES_PER_ELEMENT),K(li.prototype,"copyWithin",(function(t,e){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*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),K(li.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,K(r={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new Pn(t[a+=2],t[a+1]),{value:[o,e],done:!1}})),K(r,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Cn&&K(r,Cn,(function(){return e.entries()})),r})),K(li.prototype,"get",(function(t){var e;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Gt(t))throw new TypeError(G("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return new Pn((e=this._buffer)[t*=2],e[t+1])})),$t(li.prototype,"length",(function(){return this._length})),K(li.prototype,"set",(function(t){var e,r,n,i,o,a,u,f,l;if(!oi(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!Gt(r=arguments[1]))throw new TypeError(G("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if(Mn(t)){if(r>=this._length)throw new RangeError(G("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));return n[r*=2]=te(t),void(n[r+1]=ee(t))}if(oi(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,l=n.byteOffset+r*ni,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new Be(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(r*=2,l=0,f=0;f<a;f++)n[r]=e[l],n[r+1]=e[l+1],r+=2,l+=2}else{if(!fr(t))throw new TypeError(G("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(!Mn(t[f])){o=!0;break}if(o){if(!kn(a))throw new RangeError(G("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(r+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,l=n.byteOffset+r*ni,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new Be(a),f=0;f<a;f++)i[f]=e[f];e=i}for(r*=2,a/=2,l=0,f=0;f<a;f++)n[r]=e[l],n[r+1]=e[l+1],r+=2,l+=2;return}if(r+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,f=0;f<a;f++)u=t[f],n[r]=te(u),n[r+1]=ee(u),r+=2}}));var si=[Be,nn,yn,ln,bn,Ae,Rn,de,Tn,Qn,li],ci=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],pi=ci.length;function hi(t){var e;if(f(t))return"generic";if(bt(t))return null;for(e=0;e<pi;e++)if(t instanceof si[e])return ci[e];return Kr[wt(t)]||null}function yi(t){var e,r,n;if(!fr(t))throw new TypeError(G("invalid argument. Must provide an array-like object. Value: `%s`.",t));return n=hi(t),$r(t)&&(e=qr(n)),r=t.length,void 0===e?function(e){var n;for(n=0;n<r;n++)if(t[n]===e)return!0;return!1}:function(n){var i;for(i=0;i<r;i++)if(e(t,i)===n)return!0;return!1}}K((function(t,e){var r,n,i,o;for(i=hi(t),n=$r(t)?qr(i):Zr(i),r=t.length,o=0;o<r;o++)if(n(t,o)===e)return!0;return!1}),"factory",yi);var gi=yi(We());function mi(t,e,r,n){var i=Qt(e,r,n);return i[0]>=0&&i[1]<t}function di(){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 vi={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"},bi={"dtypes.default":vi.dtypes.default,"dtypes.numeric":vi.dtypes.numeric,"dtypes.real":vi.dtypes.real,"dtypes.floating_point":vi.dtypes.floating_point,"dtypes.real_floating_point":vi.dtypes.real_floating_point,"dtypes.complex_floating_point":vi.dtypes.complex_floating_point,"dtypes.integer":vi.dtypes.integer,"dtypes.signed_integer":vi.dtypes.signed_integer,"dtypes.unsigned_integer":vi.dtypes.unsigned_integer,order:vi.order,casting:vi.casting,index_mode:vi.index_mode};function wi(t){var e=typeof t;return null===t||"object"!==e&&"function"!==e?new TypeError(G("invalid argument. A provided constructor must be either an object (except null) or a function. Value: `%s`.",t)):null}K(di,"get",(function(t){var e=bi[t];return void 0===e?null:e}));var _i=Object.create;function Ei(){}var Ai="function"==typeof _i?_i:function(t){return Ei.prototype=t,new Ei};function Ti(t,e,r){if("clamp"===r)return function(t,e){return t<0?0:t>e?e:t}(t,e);if("wrap"===r)return function(t,e){var r=e+1;return t<0?((t+=r)<0&&0!=(t%=r)&&(t+=r),t):t>e?((t-=r)>e&&(t%=r),t):t}(t,e);if(t<0||t>e)throw new RangeError(G("invalid argument. Index must be on the interval: [0, %d]. Value: `%d`.",e,t));return t}var xi=Br.prototype.iget;var ji=Br.prototype.iset;function Oi(t,e){var r,n;for(r=[],n=0;n<e;n++)r.push(t[n]);return r}var Si=_r(),Ri=Si.length;function Ii(t){var e;for(e=0;e<Ri;e++)if(t===Si[e])return!0;return!1}function Pi(t,r){var n;if(!St(r))return new TypeError(G("invalid argument. Options argument must be an object. Value: `%s`.",r));if(e(r,"mode")&&(t.mode=r.mode,!Ii(t.mode)))return new TypeError(G("invalid option. `%s` option must be a recognized mode. Option: `%s`.","mode",t.mode));if(e(r,"submode")){if(t.submode=r.submode,!f(t.submode))return new TypeError(G("invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.","submode",t.submode));if(0===t.submode.length)return new TypeError(G("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(!Ii(t.submode[n]))return new TypeError(G("invalid option. Each submode must be a recognized mode. Option: `%s`.",t.submode[n]));t.submode=t.submode.slice()}return e(r,"readonly")&&(t.readonly=r.readonly,!Q(t.readonly))?new TypeError(G("invalid option. `%s` option must be a boolean. Option: `%s`.","readonly",t.readonly)):null}var Bi=di.get("index_mode");function Vi(t,e,r,n,i,o,a){var u,f,l,s,c;if(!(this instanceof Vi))return arguments.length<7?new Vi(t,e,r,n,i,o):new Vi(t,e,r,n,i,o,a);if(!gi(t))throw new TypeError(G("invalid argument. First argument must be a supported ndarray data type. Value: `%s`.",t));if(!fr(e))throw new TypeError(G("invalid argument. Second argument must be an array-like object, typed-array-like, or a Buffer. Value: `%s`.",e));if(e.get&&e.set&&(!Et(e.get)||!Et(e.set)))throw new TypeError(G("invalid argument. Second argument `get` and `set` properties must be functions. Value: `%s`.",e));if(!Nr(r)&&(!fr(r)||r.length>0))throw new TypeError(G("invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.",r));if((u=r.length)>32767)throw new RangeError(G("invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.",32767,u));if(!Fr(n))throw new TypeError(G("invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.",n));if(u>0){if(n.length!==u)throw new RangeError(G("invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.",u,n.length))}else{if(1!==n.length)throw new RangeError("invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.");if(0!==n[0])throw new RangeError(G("invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.",n[0]))}if(!Gt(i))throw new TypeError(G("invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.",i));if(!Jr(o))throw new TypeError(G("invalid argument. Sixth argument must be a supported order. Value: `%s`.",o));if(u>0&&!mi(e.length,r,n,i)&&Mr(r)>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((f={}).mode=Bi,f.readonly=false,arguments.length>6&&(l=Pi(f,a)))throw l;return this._mode=f.mode,void 0===f.submode&&(f.submode=[this._mode]),this._submode=f.submode,s=Oi(r,u),c=Oi(n,u||1),Br.call(this,t,e,s,c,i,o),this._flags.READONLY=f.readonly,this}!function(t,e){var r=wi(t);if(r)throw r;if(r=wi(e))throw r;if(void 0===e.prototype)throw new TypeError(G("invalid argument. Second argument must have a prototype from which another object can inherit. Value: `%s`.",e.prototype));t.prototype=Ai(e.prototype),Z(t.prototype,"constructor",{configurable:!0,enumerable:!1,writable:!0,value:t})}(Vi,Br),K(Vi,"name","ndarray"),K(Vi.prototype,"get",(function(){var t,e,r,n;if(arguments.length!==this._ndims)throw new RangeError(G("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(t=this._offset,r=this._submode.length,n=0;n<arguments.length;n++){if(!Yt(arguments[n]))throw new TypeError(G("invalid argument. Indices must be integer valued. Argument: `%u`. Value: `%s`.",n,arguments[n]));e=Ti(arguments[n],this._shape[n]-1,this._submode[n%r]),t+=this._strides[n]*e}return this._accessors?this._buffer.get(t):this._buffer[t]})),K(Vi.prototype,"iget",(function(t){if(this._ndims>0){if(!Yt(t))throw new TypeError(G("invalid argument. Index must be an integer. Value: `%s`.",t));return t=Ti(t,this._length-1,this._mode),xi.call(this,t)}return xi.call(this)})),K(Vi.prototype,"set",(function(){var t,e,r,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(G("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(t=this._offset,r=this._submode.length,n=0;n<arguments.length-1;n++){if(!Yt(arguments[n]))throw new TypeError(G("invalid argument. Indices must be integer valued. Argument: `%i`. Value: `%s`.",n,arguments[n]));e=Ti(arguments[n],this._shape[n]-1,this._submode[n%r]),t+=this._strides[n]*e}return this._accessors?this._buffer.set(arguments[n],t):this._buffer[t]=arguments[n],this})),K(Vi.prototype,"iset",(function(t,e){if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(this._ndims>0){if(!Yt(t))throw new TypeError(G("invalid argument. Index must be an integer. Value: `%s`.",t));t=Ti(t,this._length-1,this._mode),ji.call(this,t,e)}else ji.call(this,t);return this}));var Ui=["none","equiv","safe","same-kind","unsafe"];function Li(){return Ui.slice()}K(Li,"enum",(function(){return{none:0,equiv:1,safe:2,"same-kind":3,unsafe:4}}));var Mi=Li(),ki=Mi.length;function Ni(t){var e;for(e=0;e<ki;e++)if(t===Mi[e])return!0;return!1}function Ci(t){return Object.keys(Object(t))}var Yi=void 0!==Object.keys;var Fi="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function Di(){return Fi&&"symbol"==typeof Symbol.toStringTag}var Gi=Object.prototype.toString;var Wi=Object.prototype.hasOwnProperty;function zi(t,e){return null!=t&&Wi.call(t,e)}var Ji="function"==typeof Symbol?Symbol.toStringTag:"";var $i=Di()?function(t){var e,r,n;if(null==t)return Gi.call(t);r=t[Ji],e=zi(t,Ji);try{t[Ji]=void 0}catch(e){return Gi.call(t)}return n=Gi.call(t),e?t[Ji]=r:delete t[Ji],n}:function(t){return Gi.call(t)};function Xi(t){return"[object Arguments]"===$i(t)}var qi=function(){return Xi(arguments)}(),Hi="function"==typeof Object.defineProperty?Object.defineProperty:null;var Zi,Ki=Object.defineProperty,Qi=Object.prototype,to=Qi.toString,eo=Qi.__defineGetter__,ro=Qi.__defineSetter__,no=Qi.__lookupGetter__,io=Qi.__lookupSetter__;Zi=function(){try{return Hi({},"x",{}),!0}catch(t){return!1}}()?Ki:function(t,e,r){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===to.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof r||null===r||"[object Array]"===to.call(r))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+r+"`.");if((i="value"in r)&&(no.call(t,e)||io.call(t,e)?(n=t.__proto__,t.__proto__=Qi,delete t[e],t[e]=r.value,t.__proto__=n):t[e]=r.value),o="get"in r,a="set"in r,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&&eo&&eo.call(t,e,r.get),a&&ro&&ro.call(t,e,r.set),t};var oo=Zi;function ao(t,e,r){oo(t,e,{configurable:!1,enumerable:!1,writable:!1,value:r})}function uo(t){return"string"==typeof t}var fo=String.prototype.valueOf;var lo=Di();function so(t){return"object"==typeof t&&(t instanceof String||(lo?function(t){try{return fo.call(t),!0}catch(t){return!1}}(t):"[object String]"===$i(t)))}function co(t){return uo(t)||so(t)}function po(t){return"number"==typeof t}ao(co,"isPrimitive",uo),ao(co,"isObject",so);var ho=Number,yo=ho.prototype.toString;var go=Di();function mo(t){return"object"==typeof t&&(t instanceof ho||(go?function(t){try{return yo.call(t),!0}catch(t){return!1}}(t):"[object Number]"===$i(t)))}function vo(t){return po(t)||mo(t)}function bo(t){return t!=t}function wo(t){return po(t)&&bo(t)}function _o(t){return mo(t)&&bo(t.valueOf())}function Eo(t){return wo(t)||_o(t)}ao(vo,"isPrimitive",po),ao(vo,"isObject",mo),ao(Eo,"isPrimitive",wo),ao(Eo,"isObject",_o);var Ao=Number.POSITIVE_INFINITY,To=ho.NEGATIVE_INFINITY,xo=Math.floor;function jo(t){return xo(t)===t}function Oo(t){return t<Ao&&t>To&&jo(t)}function So(t){return po(t)&&Oo(t)}function Ro(t){return mo(t)&&Oo(t.valueOf())}function Io(t){return So(t)||Ro(t)}ao(Io,"isPrimitive",So),ao(Io,"isObject",Ro);var Po=Object.prototype.propertyIsEnumerable;var Bo=!Po.call("beep","0");function Vo(t,e){var r;return null!=t&&(!(r=Po.call(t,e))&&Bo&&co(t)?!wo(e=+e)&&So(e)&&e>=0&&e<t.length:r)}var Uo=Array.isArray?Array.isArray:function(t){return"[object Array]"===$i(t)};var Lo=qi?Xi:function(t){return null!==t&&"object"==typeof t&&!Uo(t)&&"number"==typeof t.length&&jo(t.length)&&t.length>=0&&t.length<=4294967295&&zi(t,"callee")&&!Vo(t,"callee")},Mo=Array.prototype.slice;function ko(t){return null!==t&&"object"==typeof t}var No=function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(e){var r,n;if(!Uo(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}(ko);ao(ko,"isObjectLikeArray",No);var Co=Vo((function(){}),"prototype"),Yo=!Vo({toString:null},"toString");function Fo(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&jo(t.length)&&t.length>=0&&t.length<=9007199254740991}function Do(t,e,r){var n,i;if(!Fo(t)&&!uo(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(n=t.length))return-1;if(3===arguments.length){if(!So(r))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+r+"`.");if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(Eo(e)){for(;i<n;i++)if(Eo(t[i]))return i}else for(;i<n;i++)if(t[i]===e)return i;return-1}var Go=/./;function Wo(t){return"boolean"==typeof t}var zo=Boolean.prototype.toString;var Jo=Di();function $o(t){return"object"==typeof t&&(t instanceof Boolean||(Jo?function(t){try{return zo.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===$i(t)))}function Xo(t){return Wo(t)||$o(t)}function qo(){return new Function("return this;")()}ao(Xo,"isPrimitive",Wo),ao(Xo,"isObject",$o);var Ho="object"==typeof self?self:null,Zo="object"==typeof window?window:null,Ko="object"==typeof ft?ft:null;var Qo=function(t){if(arguments.length){if(!Wo(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return qo()}if(Ho)return Ho;if(Zo)return Zo;if(Ko)return Ko;throw new Error("unexpected error. Unable to resolve global object.")}(),ta=Qo.document&&Qo.document.childNodes,ea=Int8Array;function ra(){return/^\s*function\s*([^(]*)/i}var na=/^\s*function\s*([^(]*)/i;function ia(t){var e,r,n,i;if(("Object"===(r=$i(t).slice(8,-1))||"Error"===r)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(e=na.exec(n.toString()))return e[1]}return ko(i=t)&&(i._isBuffer||i.constructor&&"function"==typeof i.constructor.isBuffer&&i.constructor.isBuffer(i))?"Buffer":r}ao(ra,"REGEXP",na);var oa="function"==typeof Go||"object"==typeof ea||"function"==typeof ta?function(t){return ia(t).toLowerCase()}:function(t){var e;return null===t?"null":"object"===(e=typeof t)?ia(t).toLowerCase():e};function aa(t){return t.constructor&&t.constructor.prototype===t}var ua=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],fa="undefined"==typeof window?void 0:window;var la=function(){var t;if("undefined"===oa(fa))return!1;for(t in fa)try{-1===Do(ua,t)&&zi(fa,t)&&null!==fa[t]&&"object"===oa(fa[t])&&aa(fa[t])}catch(t){return!0}return!1}(),sa="undefined"!=typeof window;var ca=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var pa=Yi?function(){return 2!==(Ci(arguments)||"").length}(1,2)?function(t){return Lo(t)?Ci(Mo.call(t)):Ci(t)}:Ci:function(t){var e,r,n,i,o,a,u;if(i=[],Lo(t)){for(u=0;u<t.length;u++)i.push(u.toString());return i}if("string"==typeof t){if(t.length>0&&!zi(t,"0"))for(u=0;u<t.length;u++)i.push(u.toString())}else{if(!1==(n="function"==typeof t)&&!ko(t))return i;r=Co&&n}for(o in t)r&&"prototype"===o||!zi(t,o)||i.push(String(o));if(Yo)for(e=function(t){if(!1===sa&&!la)return aa(t);try{return aa(t)}catch(t){return!1}}(t),u=0;u<ca.length;u++)a=ca[u],e&&"constructor"===a||!zi(t,a)||i.push(String(a));return i};function ha(t){return"function"===oa(t)}var ya,ga=Object.getPrototypeOf;ya=ha(Object.getPrototypeOf)?ga:function(t){var e=function(t){return t.__proto__}(t);return e||null===e?e:"[object Function]"===$i(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null};var ma=ya;var da=Object.prototype;function va(t){var e;return!!function(t){return"object"==typeof t&&null!==t&&!Uo(t)}(t)&&(e=function(t){return null==t?null:(t=Object(t),ma(t))}(t),!e||!zi(t,"constructor")&&zi(e,"constructor")&&ha(e.constructor)&&"[object Function]"===$i(e.constructor)&&zi(e,"isPrototypeOf")&&ha(e.isPrototypeOf)&&(e===da||function(t){var e;for(e in t)if(!zi(t,e))return!1;return!0}(t)))}var ba="function"==typeof Object.defineProperty?Object.defineProperty:null;var wa,_a=Object.defineProperty,Ea=Object.prototype,Aa=Ea.toString,Ta=Ea.__defineGetter__,xa=Ea.__defineSetter__,ja=Ea.__lookupGetter__,Oa=Ea.__lookupSetter__;wa=function(){try{return ba({},"x",{}),!0}catch(t){return!1}}()?_a:function(t,e,r){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===Aa.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof r||null===r||"[object Array]"===Aa.call(r))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+r+"`.");if((i="value"in r)&&(ja.call(t,e)||Oa.call(t,e)?(n=t.__proto__,t.__proto__=Ea,delete t[e],t[e]=r.value,t.__proto__=n):t[e]=r.value),o="get"in r,a="set"in r,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&&Ta&&Ta.call(t,e,r.get),a&&xa&&xa.call(t,e,r.set),t};var Sa=wa;function Ra(t,e,r){Sa(t,e,{configurable:!1,enumerable:!1,writable:!1,value:r})}var Ia=["binary","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"];function Pa(){return Ia.slice()}var Ba=["binary","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"];function Va(){return Ba.slice()}function Ua(){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 La(t,e,r){Sa(t,e,{configurable:!1,enumerable:!0,writable:!1,value:r})}function Ma(t){return Object.keys(Object(t))}var ka=void 0!==Object.keys;var Na="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function Ca(){return Na&&"symbol"==typeof Symbol.toStringTag}var Ya=Object.prototype.toString;var Fa=Object.prototype.hasOwnProperty;function Da(t,e){return null!=t&&Fa.call(t,e)}var Ga="function"==typeof Symbol?Symbol.toStringTag:"";var Wa=Ca()?function(t){var e,r,n;if(null==t)return Ya.call(t);r=t[Ga],e=Da(t,Ga);try{t[Ga]=void 0}catch(e){return Ya.call(t)}return n=Ya.call(t),e?t[Ga]=r:delete t[Ga],n}:function(t){return Ya.call(t)};function za(t){return"[object Arguments]"===Wa(t)}var Ja=function(){return za(arguments)}();function $a(t){return"string"==typeof t}var Xa=String.prototype.valueOf;var qa=Ca();function Ha(t){return"object"==typeof t&&(t instanceof String||(qa?function(t){try{return Xa.call(t),!0}catch(t){return!1}}(t):"[object String]"===Wa(t)))}function Za(t){return $a(t)||Ha(t)}function Ka(t){return"number"==typeof t}Ra(Za,"isPrimitive",$a),Ra(Za,"isObject",Ha);var Qa=Number,tu=Qa.prototype.toString;var eu=Ca();function ru(t){return"object"==typeof t&&(t instanceof Qa||(eu?function(t){try{return tu.call(t),!0}catch(t){return!1}}(t):"[object Number]"===Wa(t)))}function nu(t){return Ka(t)||ru(t)}function iu(t){return t!=t}function ou(t){return Ka(t)&&iu(t)}function au(t){return ru(t)&&iu(t.valueOf())}function uu(t){return ou(t)||au(t)}Ra(nu,"isPrimitive",Ka),Ra(nu,"isObject",ru),Ra(uu,"isPrimitive",ou),Ra(uu,"isObject",au);var fu=Number.POSITIVE_INFINITY,lu=Qa.NEGATIVE_INFINITY,su=Math.floor;function cu(t){return su(t)===t}function pu(t){return t<fu&&t>lu&&cu(t)}function hu(t){return Ka(t)&&pu(t)}function yu(t){return ru(t)&&pu(t.valueOf())}function gu(t){return hu(t)||yu(t)}Ra(gu,"isPrimitive",hu),Ra(gu,"isObject",yu);var mu=Object.prototype.propertyIsEnumerable;var du=!mu.call("beep","0");function vu(t,e){var r;return null!=t&&(!(r=mu.call(t,e))&&du&&Za(t)?!ou(e=+e)&&hu(e)&&e>=0&&e<t.length:r)}var bu=Array.isArray?Array.isArray:function(t){return"[object Array]"===Wa(t)};var wu=Ja?za:function(t){return null!==t&&"object"==typeof t&&!bu(t)&&"number"==typeof t.length&&cu(t.length)&&t.length>=0&&t.length<=4294967295&&Da(t,"callee")&&!vu(t,"callee")},_u=Array.prototype.slice;function Eu(t){return null!==t&&"object"==typeof t}var Au=function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(e){var r,n;if(!bu(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}(Eu);Ra(Eu,"isObjectLikeArray",Au);var Tu=vu((function(){}),"prototype"),xu=!vu({toString:null},"toString");function ju(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&cu(t.length)&&t.length>=0&&t.length<=9007199254740991}function Ou(t,e,r){var n,i;if(!ju(t)&&!$a(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(n=t.length))return-1;if(3===arguments.length){if(!hu(r))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+r+"`.");if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(uu(e)){for(;i<n;i++)if(uu(t[i]))return i}else for(;i<n;i++)if(t[i]===e)return i;return-1}var Su=/./;function Ru(t){return"boolean"==typeof t}var Iu=Boolean.prototype.toString;var Pu=Ca();function Bu(t){return"object"==typeof t&&(t instanceof Boolean||(Pu?function(t){try{return Iu.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===Wa(t)))}function Vu(t){return Ru(t)||Bu(t)}function Uu(){return new Function("return this;")()}Ra(Vu,"isPrimitive",Ru),Ra(Vu,"isObject",Bu);var Lu="object"==typeof self?self:null,Mu="object"==typeof window?window:null,ku="object"==typeof ft?ft:null;var Nu=function(t){if(arguments.length){if(!Ru(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return Uu()}if(Lu)return Lu;if(Mu)return Mu;if(ku)return ku;throw new Error("unexpected error. Unable to resolve global object.")}(),Cu=Nu.document&&Nu.document.childNodes,Yu=Int8Array;function Fu(){return/^\s*function\s*([^(]*)/i}var Du=/^\s*function\s*([^(]*)/i;function Gu(t){var e,r,n,i;if(("Object"===(r=Wa(t).slice(8,-1))||"Error"===r)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(e=Du.exec(n.toString()))return e[1]}return Eu(i=t)&&(i._isBuffer||i.constructor&&"function"==typeof i.constructor.isBuffer&&i.constructor.isBuffer(i))?"Buffer":r}Ra(Fu,"REGEXP",Du);var Wu="function"==typeof Su||"object"==typeof Yu||"function"==typeof Cu?function(t){return Gu(t).toLowerCase()}:function(t){var e;return null===t?"null":"object"===(e=typeof t)?Gu(t).toLowerCase():e};function zu(t){return t.constructor&&t.constructor.prototype===t}var Ju=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],$u="undefined"==typeof window?void 0:window;var Xu=function(){var t;if("undefined"===Wu($u))return!1;for(t in $u)try{-1===Ou(Ju,t)&&Da($u,t)&&null!==$u[t]&&"object"===Wu($u[t])&&zu($u[t])}catch(t){return!0}return!1}(),qu="undefined"!=typeof window;var Hu=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var Zu=ka?function(){return 2!==(Ma(arguments)||"").length}(1,2)?function(t){return wu(t)?Ma(_u.call(t)):Ma(t)}:Ma:function(t){var e,r,n,i,o,a,u;if(i=[],wu(t)){for(u=0;u<t.length;u++)i.push(u.toString());return i}if("string"==typeof t){if(t.length>0&&!Da(t,"0"))for(u=0;u<t.length;u++)i.push(u.toString())}else{if(!1==(n="function"==typeof t)&&!Eu(t))return i;r=Tu&&n}for(o in t)r&&"prototype"===o||!Da(t,o)||i.push(String(o));if(xu)for(e=function(t){if(!1===qu&&!Xu)return zu(t);try{return zu(t)}catch(t){return!1}}(t),u=0;u<Hu.length;u++)a=Hu[u],e&&"constructor"===a||!Da(t,a)||i.push(String(a));return i};Ra(Va,"enum",Ua),function(t,e){var r,n,i;for(r=Zu(e),i=0;i<r.length;i++)La(t,n=r[i],e[n])}(Va,{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 Ku={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 Qu(){return{bool:Ku.bool,int8:Ku.int8,uint8:Ku.uint8,uint8c:Ku.uint8c,int16:Ku.int16,uint16:Ku.uint16,int32:Ku.int32,uint32:Ku.uint32,int64:Ku.int64,uint64:Ku.uint64,float32:Ku.float32,float64:Ku.float64,complex64:Ku.complex64,complex128:Ku.complex128,binary:Ku.binary,generic:Ku.generic,notype:Ku.notype,userdefined_type:Ku.userdefined_type}}Ra(Pa,"enum",Qu),function(t,e){var r,n,i;for(r=Zu(e),i=0;i<r.length;i++)La(t,n=r[i],e[n])}(Pa,Qu());var tf=function(t,e){var r,n,i,o,a,u,f,l=!0;if(!ko(t))throw new TypeError("invalid argument. First argument must be object-like. Value: `"+t+"`.");if(arguments.length>1){if(!va(e))throw new TypeError("invalid argument. Options arguments must be an object. Value: `"+e+"`.");if(zi(e,"duplicates")&&!Wo(l=e.duplicates))throw new TypeError("invalid argument. `duplicates` option must be a boolean primitive. Option: `"+l+"`.")}if(n=(r=pa(t)).length,a={},l)for(f=0;f<n;f++)zi(a,o=t[i=r[f]])?(u=a[o],Uo(u)?a[o].push(i):a[o]=[u,i]):a[o]=i;else for(f=0;f<n;f++)a[t[i=r[f]]]=i;return a}(Qu(),{duplicates:!1});var ef={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 rf(t){var e=typeof t;return"string"===e?null===function(t){var e=ef[t];return"number"==typeof e?e:null}(t)?null:t:"number"===e?function(t){var e=tf[t];return"string"==typeof e?e:null}(t):null}var nf,of={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}};function af(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=mr(of)).length,f=0;f<e;f++){for(i=t[f],a=of[i],n={},u=0;u<e;u++)n[o=t[u]]=a[o];r[i]=n}return r}function uf(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=mr(of)).length,f=0;f<e;f++){for(i=t[f],a=of[i],n=[],u=0;u<e;u++)1===a[o=t[u]]&&n.push(o);r[i]=n}return r}var ff=function(t){return 0===arguments.length?af():(void 0===nf&&(nf=uf()),t=rf(t),e(nf,t)?nf[t].slice():null)}();var lf,sf={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}};function cf(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=mr(sf)).length,f=0;f<e;f++){for(i=t[f],a=sf[i],n={},u=0;u<e;u++)n[o=t[u]]=a[o];r[i]=n}return r}function pf(){var t,e,r,n,i,o,a,u,f;for(r={},e=(t=mr(sf)).length,f=0;f<e;f++){for(i=t[f],a=sf[i],n=[],u=0;u<e;u++)1===a[o=t[u]]&&n.push(o);r[i]=n}return r}var hf=function(t){return 0===arguments.length?cf():(void 0===lf&&(lf=pf()),t=rf(t),e(lf,t)?lf[t].slice():null)}();function yf(t,e,r){return"unsafe"===r||(t===e||"none"!==r&&"equiv"!==r&&("safe"===r?function(t,e){return t===e||ff[t][e]>0}(t,e):function(t,e){return t===e||hf[t][e]>0}(t,e)))}var gf=[],mf=[],df="undefined"!=typeof Uint8Array?Uint8Array:Array,vf=!1;function bf(){vf=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)gf[e]=t[e],mf[t.charCodeAt(e)]=e;mf["-".charCodeAt(0)]=62,mf["_".charCodeAt(0)]=63}function wf(t,e,r){for(var n,i,o=[],a=e;a<r;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(gf[(i=n)>>18&63]+gf[i>>12&63]+gf[i>>6&63]+gf[63&i]);return o.join("")}function _f(t){var e;vf||bf();for(var r=t.length,n=r%3,i="",o=[],a=16383,u=0,f=r-n;u<f;u+=a)o.push(wf(t,u,u+a>f?f:u+a));return 1===n?(e=t[r-1],i+=gf[e>>2],i+=gf[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=gf[e>>10],i+=gf[e>>4&63],i+=gf[e<<2&63],i+="="),o.push(i),o.join("")}function Ef(t,e,r,n,i){var o,a,u=8*i-n-1,f=(1<<u)-1,l=f>>1,s=-7,c=r?i-1:0,p=r?-1:1,h=t[e+c];for(c+=p,o=h&(1<<-s)-1,h>>=-s,s+=u;s>0;o=256*o+t[e+c],c+=p,s-=8);for(a=o&(1<<-s)-1,o>>=-s,s+=n;s>0;a=256*a+t[e+c],c+=p,s-=8);if(0===o)o=1-l;else{if(o===f)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=l}return(h?-1:1)*a*Math.pow(2,o-n)}function Af(t,e,r,n,i,o){var a,u,f,l=8*o-i-1,s=(1<<l)-1,c=s>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=s):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+c>=1?p/f:p*Math.pow(2,1-c))*f>=2&&(a++,f/=2),a+c>=s?(u=0,a=s):a+c>=1?(u=(e*f-1)*Math.pow(2,i),a+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+h]=255&u,h+=y,u/=256,i-=8);for(a=a<<i|u,l+=i;l>0;t[r+h]=255&a,h+=y,a/=256,l-=8);t[r+h-y]|=128*g}var Tf={}.toString,xf=Array.isArray||function(t){return"[object Array]"==Tf.call(t)};Rf.TYPED_ARRAY_SUPPORT=void 0===ft.TYPED_ARRAY_SUPPORT||ft.TYPED_ARRAY_SUPPORT;var jf=Of();function Of(){return Rf.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Sf(t,e){if(Of()<e)throw new RangeError("Invalid typed array length");return Rf.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Rf.prototype:(null===t&&(t=new Rf(e)),t.length=e),t}function Rf(t,e,r){if(!(Rf.TYPED_ARRAY_SUPPORT||this instanceof Rf))return new Rf(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Bf(this,t)}return If(this,t,e,r)}function If(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);Rf.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Rf.prototype:t=Vf(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!Rf.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Mf(e,r),i=(t=Sf(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(Lf(e)){var r=0|Uf(e.length);return 0===(t=Sf(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?Sf(t,0):Vf(t,e);if("Buffer"===e.type&&xf(e.data))return Vf(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function Pf(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 Bf(t,e){if(Pf(e),t=Sf(t,e<0?0:0|Uf(e)),!Rf.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function Vf(t,e){var r=e.length<0?0:0|Uf(e.length);t=Sf(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function Uf(t){if(t>=Of())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Of().toString(16)+" bytes");return 0|t}function Lf(t){return!(null==t||!t._isBuffer)}function Mf(t,e){if(Lf(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 r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return fl(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return ll(t).length;default:if(n)return fl(t).length;e=(""+e).toLowerCase(),n=!0}}function kf(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Zf(this,e,r);case"utf8":case"utf-8":return Xf(this,e,r);case"ascii":return qf(this,e,r);case"latin1":case"binary":return Hf(this,e,r);case"base64":return $f(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kf(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function Nf(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Cf(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Rf.from(e,n)),Lf(e))return 0===e.length?-1:Yf(t,e,r,n,i);if("number"==typeof e)return e&=255,Rf.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Yf(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Yf(t,e,r,n,i){var o,a=1,u=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,f/=2,r/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var s=-1;for(o=r;o<u;o++)if(l(t,o)===l(e,-1===s?0:o-s)){if(-1===s&&(s=o),o-s+1===f)return s*a}else-1!==s&&(o-=o-s),s=-1}else for(r+f>u&&(r=u-f),o=r;o>=0;o--){for(var c=!0,p=0;p<f;p++)if(l(t,o+p)!==l(e,p)){c=!1;break}if(c)return o}return-1}function Ff(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.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(e.substr(2*a,2),16);if(isNaN(u))return a;t[r+a]=u}return a}function Df(t,e,r,n){return sl(fl(e,t.length-r),t,r,n)}function Gf(t,e,r,n){return sl(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function Wf(t,e,r,n){return Gf(t,e,r,n)}function zf(t,e,r,n){return sl(ll(e),t,r,n)}function Jf(t,e,r,n){return sl(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=(r=t.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function $f(t,e,r){return 0===e&&r===t.length?_f(t):_f(t.slice(e,r))}function Xf(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,u,f,l=t[i],s=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c<=r)switch(c){case 1:l<128&&(s=l);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&l)<<6|63&o)>127&&(s=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&l)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(s=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&l)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&f<1114112&&(s=f)}null===s?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}Rf.poolSize=8192,Rf._augment=function(t){return t.__proto__=Rf.prototype,t},Rf.from=function(t,e,r){return If(null,t,e,r)},Rf.TYPED_ARRAY_SUPPORT&&(Rf.prototype.__proto__=Uint8Array.prototype,Rf.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Rf[Symbol.species]),Rf.alloc=function(t,e,r){return function(t,e,r,n){return Pf(e),e<=0?Sf(t,e):void 0!==r?"string"==typeof n?Sf(t,e).fill(r,n):Sf(t,e).fill(r):Sf(t,e)}(null,t,e,r)},Rf.allocUnsafe=function(t){return Bf(null,t)},Rf.allocUnsafeSlow=function(t){return Bf(null,t)},Rf.isBuffer=cl,Rf.compare=function(t,e){if(!Lf(t)||!Lf(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},Rf.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}},Rf.concat=function(t,e){if(!xf(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Rf.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=Rf.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!Lf(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Rf.byteLength=Mf,Rf.prototype._isBuffer=!0,Rf.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 e=0;e<t;e+=2)Nf(this,e,e+1);return this},Rf.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 e=0;e<t;e+=4)Nf(this,e,e+3),Nf(this,e+1,e+2);return this},Rf.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 e=0;e<t;e+=8)Nf(this,e,e+7),Nf(this,e+1,e+6),Nf(this,e+2,e+5),Nf(this,e+3,e+4);return this},Rf.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Xf(this,0,t):kf.apply(this,arguments)},Rf.prototype.equals=function(t){if(!Lf(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Rf.compare(this,t)},Rf.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+">"},Rf.prototype.compare=function(t,e,r,n,i){if(!Lf(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(o,a),f=this.slice(n,i),l=t.slice(e,r),s=0;s<u;++s)if(f[s]!==l[s]){o=f[s],a=l[s];break}return o<a?-1:a<o?1:0},Rf.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},Rf.prototype.indexOf=function(t,e,r){return Cf(this,t,e,r,!0)},Rf.prototype.lastIndexOf=function(t,e,r){return Cf(this,t,e,r,!1)},Rf.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Ff(this,t,e,r);case"utf8":case"utf-8":return Df(this,t,e,r);case"ascii":return Gf(this,t,e,r);case"latin1":case"binary":return Wf(this,t,e,r);case"base64":return zf(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jf(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Rf.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function qf(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function Hf(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Zf(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=ul(t[o]);return i}function Kf(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function Qf(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function tl(t,e,r,n,i,o){if(!Lf(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function el(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function rl(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function nl(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function il(t,e,r,n,i){return i||nl(t,0,r,4),Af(t,e,r,n,23,4),r+4}function ol(t,e,r,n,i){return i||nl(t,0,r,8),Af(t,e,r,n,52,8),r+8}Rf.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),Rf.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=Rf.prototype;else{var i=e-t;r=new Rf(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},Rf.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Qf(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},Rf.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||Qf(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},Rf.prototype.readUInt8=function(t,e){return e||Qf(t,1,this.length),this[t]},Rf.prototype.readUInt16LE=function(t,e){return e||Qf(t,2,this.length),this[t]|this[t+1]<<8},Rf.prototype.readUInt16BE=function(t,e){return e||Qf(t,2,this.length),this[t]<<8|this[t+1]},Rf.prototype.readUInt32LE=function(t,e){return e||Qf(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Rf.prototype.readUInt32BE=function(t,e){return e||Qf(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Rf.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||Qf(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},Rf.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Qf(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Rf.prototype.readInt8=function(t,e){return e||Qf(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Rf.prototype.readInt16LE=function(t,e){e||Qf(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Rf.prototype.readInt16BE=function(t,e){e||Qf(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Rf.prototype.readInt32LE=function(t,e){return e||Qf(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Rf.prototype.readInt32BE=function(t,e){return e||Qf(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Rf.prototype.readFloatLE=function(t,e){return e||Qf(t,4,this.length),Ef(this,t,!0,23,4)},Rf.prototype.readFloatBE=function(t,e){return e||Qf(t,4,this.length),Ef(this,t,!1,23,4)},Rf.prototype.readDoubleLE=function(t,e){return e||Qf(t,8,this.length),Ef(this,t,!0,52,8)},Rf.prototype.readDoubleBE=function(t,e){return e||Qf(t,8,this.length),Ef(this,t,!1,52,8)},Rf.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||tl(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},Rf.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||tl(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Rf.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,1,255,0),Rf.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Rf.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,2,65535,0),Rf.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):el(this,t,e,!0),e+2},Rf.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,2,65535,0),Rf.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):el(this,t,e,!1),e+2},Rf.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,4,4294967295,0),Rf.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):rl(this,t,e,!0),e+4},Rf.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,4,4294967295,0),Rf.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):rl(this,t,e,!1),e+4},Rf.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);tl(this,t,e,r,i-1,-i)}var o=0,a=1,u=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},Rf.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);tl(this,t,e,r,i-1,-i)}var o=r-1,a=1,u=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},Rf.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,1,127,-128),Rf.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Rf.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,2,32767,-32768),Rf.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):el(this,t,e,!0),e+2},Rf.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,2,32767,-32768),Rf.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):el(this,t,e,!1),e+2},Rf.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,4,2147483647,-2147483648),Rf.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):rl(this,t,e,!0),e+4},Rf.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||tl(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Rf.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):rl(this,t,e,!1),e+4},Rf.prototype.writeFloatLE=function(t,e,r){return il(this,t,e,!0,r)},Rf.prototype.writeFloatBE=function(t,e,r){return il(this,t,e,!1,r)},Rf.prototype.writeDoubleLE=function(t,e,r){return ol(this,t,e,!0,r)},Rf.prototype.writeDoubleBE=function(t,e,r){return ol(this,t,e,!1,r)},Rf.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Rf.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},Rf.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=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&&!Rf.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=Lf(t)?t:fl(new Rf(t,n).toString()),u=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%u]}return this};var al=/[^+\/0-9A-Za-z-_]/g;function ul(t){return t<16?"0"+t.toString(16):t.toString(16)}function fl(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function ll(t){return function(t){var e,r,n,i,o,a;vf||bf();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 df(3*u/4-o),n=o>0?u-4:u;var f=0;for(e=0,r=0;e<n;e+=4,r+=3)i=mf[t.charCodeAt(e)]<<18|mf[t.charCodeAt(e+1)]<<12|mf[t.charCodeAt(e+2)]<<6|mf[t.charCodeAt(e+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=255&i;return 2===o?(i=mf[t.charCodeAt(e)]<<2|mf[t.charCodeAt(e+1)]>>4,a[f++]=255&i):1===o&&(i=mf[t.charCodeAt(e)]<<10|mf[t.charCodeAt(e+1)]<<4|mf[t.charCodeAt(e+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(al,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function sl(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function cl(t){return null!=t&&(!!t._isBuffer||pl(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&pl(t.slice(0,0))}(t))}function pl(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var hl=Object.freeze({__proto__:null,Buffer:Rf,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Rf.alloc(+t)},isBuffer:cl,kMaxLength:jf}),yl=Rf;function gl(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];r.push.apply(r,arguments);var n=Function.bind.apply(e,r);return new n}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}var ml,dl=gl(hl).Buffer;ml=function(){var t,e;if("function"!=typeof yl)return!1;try{t=bt(e="function"==typeof yl.from?yl.from([1,2,3,4]):new yl([1,2,3,4]))&&1===e[0]&&2===e[1]&&3===e[2]&&4===e[3]}catch(e){t=!1}return t}()?dl:function(){throw new Error("not implemented")};var vl=ml,bl={binary:vl,float64:Be,float32:nn,generic:Array,int16:bn,int32:yn,int8:Rn,uint16:Ae,uint32:ln,uint8:de,uint8c:Tn,complex64:Qn,complex128:li};function wl(t){return bl[t]||null}var _l=Et(vl.allocUnsafe)?function(t){if(!zt(t))throw new TypeError(G("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return vl.allocUnsafe(t)}:function(t){if(!zt(t))throw new TypeError(G("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return new vl(t)};function El(t,e){return"generic"===t?function(t){var e,r;for(e=[],r=0;r<t;r++)e.push(0);return e}(e):"binary"===t?function(t){return function(t){var e;for(e=0;e<t.length;e++)t[e]=0;return t}(_l(t))}(e):function(t,e){var r=wl(t);return r?new r(e):null}(t,e)}var Al={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"},Tl=[Be,nn,yn,ln,bn,Ae,Rn,de,Tn,Qn,li],xl=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],jl=xl.length;function Ol(t){var e;if(f(t))return"generic";if(bt(t))return"binary";for(e=0;e<jl;e++)if(t instanceof Tl[e])return xl[e];return Al[wt(t)]||null}function Sl(t){var e;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(e=t.dtype,gi(e))return e;throw new TypeError(G("invalid argument. Must provide an ndarray having a supported data type. Value: `%s`.",e))}function Rl(t){var e,r,n,i;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!fr(r=t.shape))throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));for(e=[],i=0;i<r.length;i++){if(!Gt(n=r[i]))throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));e.push(n)}return e}function Il(t){var e,r,n,i,o,a;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!fr(i=t.strides)){if(!fr(n=t.shape))throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));return 0===n.length?[0]:(Jr(r=t.order)||(r="row-major"),Ur(n,r))}for(e=[],a=0;a<i.length;a++){if(!Yt(o=i[a]))throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));e.push(o)}return e}function Pl(t){var e,r,n;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(Gt(n=t.offset))return n;if(!fr(r=t.shape))throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(e=t.strides,0===r.length||!fr(e))return 0;if(Gt(n=Lr(r,e)))return n;throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t))}function Bl(t){var e;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));return Jr(e=t.order)?e:1===(e=Ht(Il(t)))||3===e?"row-major":2===e?"column-major":0===function(t){var e,r;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(Gt(r=t.ndims))return r;if(!fr(e=t.shape))throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));return e.length}(t)?"row-major":null}function Vl(t){var e;if("object"!=typeof t||null===t)throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(fr(e=t.data))return e;throw new TypeError(G("invalid argument. Must provide an ndarray. Value: `%s`.",t))}function Ul(t,e){var r=e[0];return In(r)&&(t.push(r.length),Ul(t,r)),t}function Ll(t,e,r,n,i){var o,a,u;for(o=e[r],u=0;u<n.length;u++){if(!In(a=n[u])||a.length!==o)return r;if(i&&(a=Ll(t,e,r+1,a,r+1<t-1))<t)return a}return t}function Ml(t){var e,r;if(!In(t))throw new TypeError(G("invalid argument. Must provide an array-like object. Value: `%s`.",t));return Ul(e=[t.length],t),(r=e.length)>1&&(e.length=Ll(r,e,1,t,r>2)),e}function kl(t){return function(t,e){var r,n;for(r=[],n=0;n<e;n++)r.push(t);return r}(0,t)}function Nl(t,e,r,n,i,o){var a,u,f,l,s;for(a=t.length,u=1,s=0;s<a;s++)u*=t[s];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(i<0||i>=u)throw new RangeError(G("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",u,i));if(f=r,"column-major"===n){for(s=0;s<a;s++)i-=l=i%t[s],i/=t[s],f+=l*e[s];return f}for(s=a-1;s>=0;s--)i-=l=i%t[s],i/=t[s],f+=l*e[s];return f}var Cl={float64:function(t,e,r){t[e]=r},float32:function(t,e,r){t[e]=r},int32:function(t,e,r){t[e]=r},int16:function(t,e,r){t[e]=r},int8:function(t,e,r){t[e]=r},uint32:function(t,e,r){t[e]=r},uint16:function(t,e,r){t[e]=r},uint8:function(t,e,r){t[e]=r},uint8c:function(t,e,r){t[e]=r},generic:function(t,e,r){t[e]=r},default:function(t,e,r){t[e]=r}};function Yl(t){var e=Cl[t];return"function"==typeof e?e:Cl.default}var Fl={complex128:function(t,e,r){t.set(r,e)},complex64:function(t,e,r){t.set(r,e)},default:function(t,e,r){t.set(r,e)}};function Dl(t){var e=Fl[t];return"function"==typeof e?e:Fl.default}function Gl(t){var e=function(t){var e=hi(t);return $r(t)?{accessorProtocol:!0,accessors:[qr(e),Dl(e)]}:{accessorProtocol:!1,accessors:[Zr(e),Yl(e)]}}(t);return{data:t,accessorProtocol:e.accessorProtocol,accessors:e.accessors}}function Wl(t,e,r,n){var i,o,a,u,f,l,s,c;for(i=e.data,a=e.accessors[0],o=e.accessors[1],s=kt(t/2),l=(f=n)+(t-1)*r,c=0;c<s;c++)u=a(i,f),o(i,f,a(i,l)),o(i,l,u),f+=r,l-=r;return e}function zl(t,e,r){var n,i,o,a,u,f,l;if(t<=0)return e;if((a=Gl(e)).accessorProtocol)return Wl(t,a,r,i=r<0?(1-t)*r:0),a.data;if(f=kt(t/2),1===r){if(o=t-1,(u=f%3)>0)for(i=0;i<u;i++)n=e[i],e[i]=e[o],e[o]=n,o-=1;if(f<3)return e;for(i=u;i<f;i+=3)n=e[i],e[i]=e[o],e[o]=n,n=e[i+1],e[i+1]=e[o-1],e[o-1]=n,n=e[i+2],e[i+2]=e[o-2],e[o-2]=n,o-=3;return e}for(o=(i=r<0?(1-t)*r:0)+(t-1)*r,l=0;l<f;l++)n=e[i],e[i]=e[o],e[o]=n,i+=r,o-=r;return e}K(zl,"ndarray",(function(t,e,r,n){var i,o,a,u,f,l,s;if(t<=0)return e;if((u=Gl(e)).accessorProtocol)return Wl(t,u,r,n),u.data;if(l=kt(t/2),o=n,1===r){if(a=o+t-1,(f=l%3)>0)for(s=0;s<f;s++)i=e[o],e[o]=e[a],e[a]=i,o+=r,a-=r;if(l<3)return e;for(s=f;s<l;s+=3)i=e[o],e[o]=e[a],e[a]=i,i=e[o+1],e[o+1]=e[a-1],e[a-1]=i,i=e[o+2],e[o+2]=e[a-2],e[a-2]=i,o+=3,a-=3;return e}for(a=o+(t-1)*r,s=0;s<l;s++)i=e[o],e[o]=e[a],e[a]=i,o+=r,a-=r;return e}));function Jl(t,e,r,n,i){var o;for(o=0;o<e;o++)r[i]=t[o],i+=n}function $l(t,e,r,n,i,o,a){var u,f,l,s;for(u=(l=n+1)===e,f=r[n],s=0;s<f;s++)u?(i[a]=t[s],a+=o):a=$l(t[s],e,r,l,i,o,a);return a}function Xl(t,e,r,n,i,o){var a=e.length;return 0===a?n:1===a?(Jl(t,e[0],n,i,o),n):r?(function(t,e,r,n,i,o){var a,u,f,l,s,c,p;for($l(t,e,r,0,u=kl(a=Mr(r)),1,0),s=Ur(r,f="row-major"),Jl(r,e,l=kl(e),1,0),zl(e,l,1),zl(e,s,1),p=0;p<a;p++)c=Nl(l,s,0,f,p,"throw"),n[o]=u[c],o+=i}(t,a,e,n,i,o),n):($l(t,a,e,0,n,i,o),n)}function ql(t,e,r){return Xl(t,e,r,kl(Mr(e)),1,0)}function Hl(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Nt(t.length)&&t.length>=0&&t.length<Lt}function Zl(t,e,r){var n,i,o;if(n=wl(r),"generic"===r)for(i=[],o=0;o<e;o++)i.push(t[o]);else if("binary"===r)for(i=_l(e),o=0;o<e;o++)i[o]=t[o];else for(i=new n(e),o=0;o<e;o++)i[o]=t[o];return i}K(ql,"assign",Xl);var Kl="number";var Ql={complex64:Ln,complex128:Pn};function ts(t,e){var r,n,i,o,a,u;if((a=Gl(n=new(wl(e))(r=t.length))).accessorProtocol)for(i=a.accessors[1],o=function(t,e,r){var n;if(!Et(t))throw new TypeError(G("invalid argument. First argument must be a function. Value: `%s`.",t));if(!Gt(e))throw new TypeError(G("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",e));if(!Et(r))throw new TypeError(G("invalid argument. Third argument must be a constructor function. Value: `%s`.",r));return n=[function(){var e=t();return typeof e===Kl?new r(e,0):e},function(e){var n=t(e);return typeof n===Kl?new r(n,0):n},function(e,n){var i=t(e,n);return typeof i===Kl?new r(i,0):i},function(e,n,i){var o=t(e,n,i);return typeof o===Kl?new r(o,0):o},function(e,n,i,o){var a=t(e,n,i,o);return typeof a===Kl?new r(a,0):a},function(e,n,i,o,a){var u=t(e,n,i,o,a);return typeof u===Kl?new r(u,0):u}],e<=5?n[e]:function(){var e,n,i;for(e=[],i=0;i<arguments.length;i++)e.push(arguments[i]);return typeof(n=t.apply(null,e))===Kl?new r(n,0):n}}((function(e){return t.iget(e)}),1,function(t){return Ql[t]||null}(e)),u=0;u<r;u++)i(n,u,o(u));else for(u=0;u<r;u++)n[u]=t.iget(u);return n}function es(t,e){var r;return r=new Br(Sl(t),Vl(t),Rl(t),Il(t),Pl(t),Bl(t)),"generic"===e?function(t){var e,r,n;for(e=t.length,r=[],n=0;n<e;n++)r.push(t.iget(n));return r}(r):"binary"===e?function(t){var e,r,n;for(e=t.length,r=_l(e),n=0;n<e;n++)r[n]=t.iget(n);return r}(r):ts(r,e)}function rs(t,e,r){var n,i;for(n=[],i=0;i<r-t;i++)n.push(1);for(i=0;i<t;i++)n.push(e[i]);return n}function ns(t,e,r,n){var i,o,a,u,f;if(f=t-(o=r.length),i=[],"row-major"===n){for(a=qt(r[0])*e[f],u=0;u<f;u++)i.push(a);for(u=0;u<o;u++)i.push(r[u])}else{for(u=0;u<f;u++)i.push(1);for(u=0;u<o;u++)i.push(r[u])}return i}var is={casting:di.get("casting"),copy:!1,dtype:di.get("dtypes.default"),flatten:!0,mode:di.get("index_mode"),ndmin:0,order:di.get("order"),readonly:!1};function os(){var t,r,n,i,o,a,u,l,s,c,p,h,y,g;if(1===arguments.length)if(Hl(arguments[0]))n=arguments[0],t={};else{if(!St(t=arguments[0]))throw new TypeError(G("invalid argument. Must provide either a valid data source, options argument, or both. Value: `%s`.",t));if(e(t,"buffer")&&!Hl(n=t.buffer))throw new TypeError(G("invalid option. `%s` option must be an array-like object, typed-array-like, a Buffer, or an ndarray. Option: `%s`.","buffer",n))}else{if(!Hl(n=arguments[0]))throw new TypeError(G("invalid option. Data source must be an array-like object, typed-array-like, a Buffer, or an ndarray. Value: `%s`.",n));if(!St(t=arguments[1]))throw new TypeError(G("invalid argument. Options argument must be an object. Value: `%s`.",t))}if(n&&(Vr(n)?(u=Sl(n),g=!0):(u=Ol(n),g=!1)),c={},p={},e(t,"casting")){if(p.casting=t.casting,!Ni(p.casting))throw new TypeError(G("invalid option. `%s` option must be a recognized casting mode. Option: `%s`.","casting",p.casting))}else p.casting=is.casting;if(e(t,"flatten")){if(p.flatten=t.flatten,!Q(p.flatten))throw new TypeError(G("invalid option. `%s` option must be a boolean. Option: `%s`.","flatten",p.flatten))}else p.flatten=is.flatten;if(e(t,"ndmin")){if(p.ndmin=t.ndmin,!Gt(p.ndmin))throw new TypeError(G("invalid option. `%s` option must be a nonnegative integer. Option: `%s`.","ndmin",p.ndmin))}else p.ndmin=is.ndmin;if(e(t,"dtype")){if(a=t.dtype,!gi(a))throw new TypeError(G("invalid option. `%s` option must be a recognized data type. Option: `%s`.","dtype",a));if(u&&!yf(u,a,p.casting))throw new Error(G("invalid option. Data type cast is not allowed. Casting mode: `%s`. From: `%s`. To: `%s`.",p.casting,u,a))}else a=u&&(g||"generic"!==u)?u:is.dtype;if(e(t,"order")){if("any"===(o=t.order)||"same"===o)g?"any"===o?o=3===Ht(Il(n))?is.order:Bl(n):"same"===o&&(o=Bl(n)):o=is.order;else if(!Jr(o))throw new TypeError(G("invalid option. `%s` option must be a recognized order. Option: `%s`.","order",o))}else o=is.order;if(e(t,"mode")?c.mode=t.mode:c.mode=is.mode,e(t,"submode")?c.submode=t.submode:c.submode=[c.mode],e(t,"readonly")?c.readonly=t.readonly:c.readonly=is.readonly,e(t,"copy")){if(p.copy=t.copy,!Q(p.copy))throw new TypeError(G("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",p.copy))}else p.copy=is.copy;if(e(t,"shape")){if(!Hl(l=t.shape))throw new TypeError(G("invalid option. `%s` option must be an array-like object containing nonnegative integers. Option: `%s`.","shape",l));s=l.length,y=Mr(l)}else{if(!n)throw new Error("invalid arguments. Must provide either a data source, array shape, or both.");g?(s=(l=Rl(n)).length,y=Mr(l)):p.flatten&&f(n)?(h=l=Ml(n),s=l.length,y=Mr(l)):(s=1,l=[y=n.length])}if(s<p.ndmin&&(l=rs(s,l,p.ndmin),s=p.ndmin),g){if(Mr(n.shape)!==y)throw new RangeError("invalid arguments. Array shape is incompatible with provided data source. Number of data source elements does not match array shape.");u!==a||p.copy?n=es(n,a):(r=Il(n),i=Pl(n),n=Vl(n),r.length<s&&(r=ns(s,l,r,o)))}else if(n){if("generic"===u&&p.flatten&&(n=ql(n,h||Ml(n),"column-major"===o)),n.length!==y)throw new RangeError("invalid arguments. Array shape is incompatible with provided data source. Number of data source elements does not match array shape.");(u!==a||p.copy)&&(n=Zl(n,y,a))}else n=El(a,y);return void 0===r&&(i=Lr(l,r=Ur(l,o))),new Vi(a,n,l,r,i,o,c)}export{os as default};
//# sourceMappingURL=mod.js.map