-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.js
4 lines (4 loc) · 82.9 KB
/
mod.js
1
2
3
4
// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
/// <reference types="./mod.d.ts" />
var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var e=Object.defineProperty;function t(r){return"number"==typeof r}function n(r){var e,t="";for(e=0;e<r;e++)t+="0";return t}function i(r,e,t){var i=!1,o=e-r.length;return o<0||(function(r){return"-"===r[0]}(r)&&(i=!0,r=r.substr(1)),r=t?r+n(o):n(o)+r,i&&(r="-"+r)),r}var o=String.prototype.toLowerCase,a=String.prototype.toUpperCase;function u(r){var e,n,u;switch(r.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(n=r.arg,u=parseInt(n,10),!isFinite(u)){if(!t(n))throw new Error("invalid integer. Value: "+n);u=0}return u<0&&("u"===r.specifier||10!==e)&&(u=4294967295+u+1),u<0?(n=(-u).toString(e),r.precision&&(n=i(n,r.precision,r.padRight)),n="-"+n):(n=u.toString(e),u||r.precision?r.precision&&(n=i(n,r.precision,r.padRight)):n="",r.sign&&(n=r.sign+n)),16===e&&(r.alternate&&(n="0x"+n),n=r.specifier===a.call(r.specifier)?a.call(n):o.call(n)),8===e&&r.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var f=Math.abs,s=String.prototype.toLowerCase,l=String.prototype.toUpperCase,c=String.prototype.replace,h=/e\+(\d)$/,p=/e-(\d)$/,g=/^(\d+)$/,y=/^(\d+)e/,m=/\.0$/,v=/\.0*e/,w=/(\..*[^0])0*e/;function b(r){var e,n,i=parseFloat(r.arg);if(!isFinite(i)){if(!t(r.arg))throw new Error("invalid floating-point number. Value: "+n);i=r.arg}switch(r.specifier){case"e":case"E":n=i.toExponential(r.precision);break;case"f":case"F":n=i.toFixed(r.precision);break;case"g":case"G":f(i)<1e-4?((e=r.precision)>0&&(e-=1),n=i.toExponential(e)):n=i.toPrecision(r.precision),r.alternate||(n=c.call(n,w,"$1e"),n=c.call(n,v,"e"),n=c.call(n,m,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=c.call(n,h,"e+0$1"),n=c.call(n,p,"e-0$1"),r.alternate&&(n=c.call(n,g,"$1."),n=c.call(n,y,"$1.e")),i>=0&&r.sign&&(n=r.sign+n),n=r.specifier===l.call(r.specifier)?l.call(n):s.call(n)}function d(r){var e,t="";for(e=0;e<r;e++)t+=" ";return t}var E=String.fromCharCode,T=Array.isArray;function _(r){return r!=r}function x(r){var e={};return e.specifier=r.specifier,e.precision=void 0===r.precision?1:r.precision,e.width=r.width,e.flags=r.flags||"",e.mapping=r.mapping,e}function A(r){var e,t,n,o,a,f,s,l,c,h,p,g,y;if(!T(r))throw new TypeError("invalid argument. First argument must be an array. Value: `"+r+"`.");for(f="",s=1,l=0;l<r.length;l++)if(n=r[l],"string"==typeof n)f+=n;else{if(e=void 0!==n.precision,!(n=x(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+l+"`. Value: `"+n+"`.");for(n.mapping&&(s=n.mapping),t=n.flags,c=0;c<t.length;c++)switch(o=t.charAt(c)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=t.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+o)}if("*"===n.width){if(n.width=parseInt(arguments[s],10),s+=1,_(n.width))throw new TypeError("the argument for * width at position "+s+" 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[s],10),s+=1,_(n.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,e=!1)}switch(n.arg=arguments[s],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(n.padZeros=!1),n.arg=u(n);break;case"s":n.maxWidth=e?n.precision:-1,n.arg=String(n.arg);break;case"c":if(!_(n.arg)){if((a=parseInt(n.arg,10))<0||a>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=_(a)?String(n.arg):E(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=b(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=i(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(h=n.arg,p=n.width,g=n.padRight,y=void 0,(y=p-h.length)<0?h:h=g?h+d(y):d(y)+h)),f+=n.arg||"",s+=1}return f}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function O(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function L(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push(O(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function j(r){var e,t;if("string"!=typeof r)throw new TypeError(j("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[L(r)],t=1;t<arguments.length;t++)e.push(arguments[t]);return A.apply(null,e)}var S,R=Object.prototype,N=R.toString,F=R.__defineGetter__,I=R.__defineSetter__,P=R.__lookupGetter__,k=R.__lookupSetter__;S=function(){try{return r({},"x",{}),!0}catch(r){return!1}}()?e:function(r,e,t){var n,i,o,a;if("object"!=typeof r||null===r||"[object Array]"===N.call(r))throw new TypeError(j("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===N.call(t))throw new TypeError(j("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(P.call(r,e)||k.call(r,e)?(n=r.__proto__,r.__proto__=R,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),o="get"in t,a="set"in t,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&&F&&F.call(r,e,t.get),a&&I&&I.call(r,e,t.set),r};var M=S;function B(r,e,t){M(r,e,{configurable:!1,enumerable:!1,writable:!1,value:t})}function C(r,e,t){M(r,e,{configurable:!1,enumerable:!1,get:t})}function U(r,e,t,n){M(r,e,{configurable:!1,enumerable:!1,get:t,set:n})}function Y(r){return function(){return r}}function G(){}var W=/./;function J(r){return"boolean"==typeof r}var q="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function H(){return q&&"symbol"==typeof Symbol.toStringTag}var $=Object.prototype.toString;var X=Object.prototype.hasOwnProperty;function z(r,e){return null!=r&&X.call(r,e)}var Z="function"==typeof Symbol?Symbol:void 0,D="function"==typeof Z?Z.toStringTag:"";var K=H()?function(r){var e,t,n;if(null==r)return $.call(r);t=r[D],e=z(r,D);try{r[D]=void 0}catch(e){return $.call(r)}return n=$.call(r),e?r[D]=t:delete r[D],n}:function(r){return $.call(r)},Q=Boolean,rr=Boolean.prototype.toString;var er=H();function tr(r){return"object"==typeof r&&(r instanceof Q||(er?function(r){try{return rr.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===K(r)))}function nr(r){return J(r)||tr(r)}B(nr,"isPrimitive",J),B(nr,"isObject",tr);var ir="object"==typeof self?self:null,or="object"==typeof window?window:null,ar="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ur="object"==typeof ar?ar:null,fr="object"==typeof globalThis?globalThis:null;var sr=function(r){if(arguments.length){if(!J(r))throw new TypeError(j("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(fr)return fr;if(ir)return ir;if(or)return or;if(ur)return ur;throw new Error("unexpected error. Unable to resolve global object.")}(),lr=sr.document&&sr.document.childNodes,cr=Int8Array;function hr(){return/^\s*function\s*([^(]*)/i}var pr=/^\s*function\s*([^(]*)/i;B(hr,"REGEXP",pr);var gr=Array.isArray?Array.isArray:function(r){return"[object Array]"===K(r)};function yr(r){return null!==r&&"object"==typeof r}function mr(r){return yr(r)&&(r._isBuffer||r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))}function vr(r){var e,t,n;if(("Object"===(t=K(r).slice(8,-1))||"Error"===t)&&r.constructor){if("string"==typeof(n=r.constructor).name)return n.name;if(e=pr.exec(n.toString()))return e[1]}return mr(r)?"Buffer":t}B(yr,"isObjectLikeArray",function(r){if("function"!=typeof r)throw new TypeError(j("invalid argument. Must provide a function. Value: `%s`.",r));return function(e){var t,n;if(!gr(e))return!1;if(0===(t=e.length))return!1;for(n=0;n<t;n++)if(!1===r(e[n]))return!1;return!0}}(yr));var wr="function"==typeof W||"object"==typeof cr||"function"==typeof lr?function(r){return vr(r).toLowerCase()}:function(r){var e;return null===r?"null":"object"===(e=typeof r)?vr(r).toLowerCase():e};function br(r){return"function"===wr(r)}var dr=br(Object.assign),Er=Object.assign;function Tr(r){return Object.keys(Object(r))}var _r=void 0!==Object.keys;function xr(r){return"[object Arguments]"===K(r)}var Ar=function(){return xr(arguments)}();function Vr(r){return"string"==typeof r}var Or=String.prototype.valueOf;var Lr=H();function jr(r){return"object"==typeof r&&(r instanceof String||(Lr?function(r){try{return Or.call(r),!0}catch(r){return!1}}(r):"[object String]"===K(r)))}function Sr(r){return Vr(r)||jr(r)}function Rr(r){return"number"==typeof r}B(Sr,"isPrimitive",Vr),B(Sr,"isObject",jr);var Nr=Number,Fr=Nr.prototype.toString;var Ir=H();function Pr(r){return"object"==typeof r&&(r instanceof Nr||(Ir?function(r){try{return Fr.call(r),!0}catch(r){return!1}}(r):"[object Number]"===K(r)))}function kr(r){return Rr(r)||Pr(r)}function Mr(r){return r!=r}function Br(r){return Rr(r)&&Mr(r)}function Cr(r){return Pr(r)&&Mr(r.valueOf())}function Ur(r){return Br(r)||Cr(r)}B(kr,"isPrimitive",Rr),B(kr,"isObject",Pr),B(Ur,"isPrimitive",Br),B(Ur,"isObject",Cr);var Yr=Number.POSITIVE_INFINITY,Gr=Nr.NEGATIVE_INFINITY,Wr=Math.floor;function Jr(r){return Wr(r)===r}function qr(r){return r<Yr&&r>Gr&&Jr(r)}function Hr(r){return Rr(r)&&qr(r)}function $r(r){return Pr(r)&&qr(r.valueOf())}function Xr(r){return Hr(r)||$r(r)}B(Xr,"isPrimitive",Hr),B(Xr,"isObject",$r);var zr=Object.prototype.propertyIsEnumerable;var Zr=!zr.call("beep","0");function Dr(r,e){var t;return null!=r&&(!(t=zr.call(r,e))&&Zr&&Sr(r)?!Br(e=+e)&&Hr(e)&&e>=0&&e<r.length:t)}var Kr=4294967295;var Qr=Ar?xr:function(r){return null!==r&&"object"==typeof r&&!gr(r)&&"number"==typeof r.length&&Jr(r.length)&&r.length>=0&&r.length<=Kr&&z(r,"callee")&&!Dr(r,"callee")},re=Array.prototype.slice;var ee=Dr(G,"prototype"),te=!Dr({toString:null},"toString"),ne=9007199254740991;function ie(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&Jr(r.length)&&r.length>=0&&r.length<=ne}function oe(r,e,t){var n,i;if(!ie(r)&&!Vr(r))throw new TypeError(j("invalid argument. First argument must be an array-like object. Value: `%s`.",r));if(0===(n=r.length))return-1;if(3===arguments.length){if(!Hr(t))throw new TypeError(j("invalid argument. Third argument must be an integer. Value: `%s`.",t));if(t>=0){if(t>=n)return-1;i=t}else(i=n+t)<0&&(i=0)}else i=0;if(Ur(e)){for(;i<n;i++)if(Ur(r[i]))return i}else for(;i<n;i++)if(r[i]===e)return i;return-1}function ae(r){return r.constructor&&r.constructor.prototype===r}var ue=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],fe="undefined"==typeof window?void 0:window;var se=function(){var r;if("undefined"===wr(fe))return!1;for(r in fe)try{-1===oe(ue,r)&&z(fe,r)&&null!==fe[r]&&"object"===wr(fe[r])&&ae(fe[r])}catch(r){return!0}return!1}(),le="undefined"!=typeof window;var ce=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var he=_r?function(){return 2!==(Tr(arguments)||"").length}(1,2)?function(r){return Qr(r)?Tr(re.call(r)):Tr(r)}:Tr:function(r){var e,t,n,i,o,a,u;if(i=[],Qr(r)){for(u=0;u<r.length;u++)i.push(u.toString());return i}if("string"==typeof r){if(r.length>0&&!z(r,"0"))for(u=0;u<r.length;u++)i.push(u.toString())}else{if(!1==(n="function"==typeof r)&&!yr(r))return i;t=ee&&n}for(o in r)t&&"prototype"===o||!z(r,o)||i.push(String(o));if(te)for(e=function(r){if(!1===le&&!se)return ae(r);try{return ae(r)}catch(r){return!1}}(r),u=0;u<ce.length;u++)a=ce[u],e&&"constructor"===a||!z(r,a)||i.push(String(a));return i},pe=void 0!==Object.getOwnPropertySymbols,ge=Object,ye=ge.getOwnPropertySymbols;var me,ve=pe?function(r){return ye(ge(r))}:function(){return[]};function we(r){var e,t,n;for(e=he(r),t=ve(r),n=0;n<t.length;n++)Dr(r,t[n])&&e.push(t[n]);return e}me=dr?Er:function(r){var e,t,n,i,o,a,u;if(null==r)throw new TypeError(j("invalid argument. First argument must be a non-null object. Value: `%s`.",r));for(o=ge(r),a=1;a<arguments.length;a++)if(null!=(e=arguments[a]))for(i=(t=we(ge(e))).length,u=0;u<i;u++)o[n=t[u]]=e[n];return o};var be=me;function de(r){return Rr(r)&&r>0}function Ee(r){return Pr(r)&&r.valueOf()>0}function Te(r){return de(r)||Ee(r)}function _e(r){return"object"==typeof r&&null!==r&&!gr(r)}B(Te,"isPrimitive",de),B(Te,"isObject",Ee);var xe,Ae=Object.getPrototypeOf;xe=br(Object.getPrototypeOf)?Ae:function(r){var e=function(r){return r.__proto__}(r);return e||null===e?e:"[object Function]"===K(r.constructor)?r.constructor.prototype:r instanceof Object?Object.prototype:null};var Ve=xe;function Oe(r){return null==r?null:(r=ge(r),Ve(r))}var Le=Object.prototype;function je(r){var e;return!!_e(r)&&(!(e=Oe(r))||!z(r,"constructor")&&z(e,"constructor")&&br(e.constructor)&&"[object Function]"===K(e.constructor)&&z(e,"isPrototypeOf")&&br(e.isPrototypeOf)&&(e===Le||function(r){var e;for(e in r)if(!z(r,e))return!1;return!0}(r)))}function Se(r){return Hr(r)&&r>=0}function Re(r){return $r(r)&&r.valueOf()>=0}function Ne(r){return Se(r)||Re(r)}B(Ne,"isPrimitive",Se),B(Ne,"isObject",Re);var Fe=17976931348623157e292,Ie="function"==typeof Uint32Array;function Pe(r){return Ie&&r instanceof Uint32Array||"[object Uint32Array]"===K(r)}function ke(r){return Hr(r)&&r>0}function Me(r){return $r(r)&&r.valueOf()>0}function Be(r){return ke(r)||Me(r)}B(Be,"isPrimitive",ke),B(Be,"isObject",Me);var Ce=9007199254740991,Ue="function"==typeof Uint32Array?Uint32Array:null;var Ye,Ge="function"==typeof Uint32Array?Uint32Array:void 0;Ye=function(){var r,e;if("function"!=typeof Ue)return!1;try{r=Pe(e=new Ue(e=[1,3.14,-3.14,Kr+1,Kr+2]))&&1===e[0]&&3===e[1]&&e[2]===Kr-2&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Ge:function(){throw new Error("not implemented")};var We=Ye;function Je(r,e){return Mr(r)||Mr(e)?NaN:r===Yr||e===Yr?Yr:r===e&&0===r?function(r){return 0===r&&1/r===Yr}(r)?r:e:r>e?r:e}var qe=65535;function He(r,e){var t,n;return((t=((r>>>=0)&qe)>>>0)*(n=((e>>>=0)&qe)>>>0)>>>0)+((r>>>16>>>0)*n+t*(e>>>16>>>0)<<16>>>0)>>>0}var $e="function";var Xe={float64:function(r,e){return r[e]},float32:function(r,e){return r[e]},int32:function(r,e){return r[e]},int16:function(r,e){return r[e]},int8:function(r,e){return r[e]},uint32:function(r,e){return r[e]},uint16:function(r,e){return r[e]},uint8:function(r,e){return r[e]},uint8c:function(r,e){return r[e]},generic:function(r,e){return r[e]},default:function(r,e){return r[e]}};function ze(r){var e=Xe[r];return"function"==typeof e?e:Xe.default}var Ze={float64:function(r,e,t){r[e]=t},float32:function(r,e,t){r[e]=t},int32:function(r,e,t){r[e]=t},int16:function(r,e,t){r[e]=t},int8:function(r,e,t){r[e]=t},uint32:function(r,e,t){r[e]=t},uint16:function(r,e,t){r[e]=t},uint8:function(r,e,t){r[e]=t},uint8c:function(r,e,t){r[e]=t},generic:function(r,e,t){r[e]=t},default:function(r,e,t){r[e]=t}};function De(r){var e=Ze[r];return"function"==typeof e?e:Ze.default}var Ke={complex128:function(r,e){return r.get(e)},complex64:function(r,e){return r.get(e)},default:function(r,e){return r.get(e)}};function Qe(r){var e=Ke[r];return"function"==typeof e?e:Ke.default}var rt={complex128:function(r,e,t){r.set(t,e)},complex64:function(r,e,t){r.set(t,e)},default:function(r,e,t){r.set(t,e)}};function et(r){var e=rt[r];return"function"==typeof e?e:rt.default}var tt={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},nt="function"==typeof Float64Array;var it="function"==typeof Float64Array?Float64Array:null;function ot(){var r,e,t;if("function"!=typeof it)return!1;try{e=new it([1,3.14,-3.14,NaN]),t=e,r=(nt&&t instanceof Float64Array||"[object Float64Array]"===K(t))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){r=!1}return r}var at="function"==typeof Float64Array?Float64Array:void 0;var ut=ot()?at:function(){throw new Error("not implemented")},ft="function"==typeof Float32Array;var st="function"==typeof Float32Array?Float32Array:null;var lt,ct="function"==typeof Float32Array?Float32Array:void 0;lt=function(){var r,e,t;if("function"!=typeof st)return!1;try{e=new st([1,3.14,-3.14,5e40]),t=e,r=(ft&&t instanceof Float32Array||"[object Float32Array]"===K(t))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===Yr}catch(e){r=!1}return r}()?ct:function(){throw new Error("not implemented")};var ht=lt,pt="function"==typeof Int32Array;var gt="function"==typeof Int32Array?Int32Array:null;var yt,mt="function"==typeof Int32Array?Int32Array:void 0;yt=function(){var r,e,t;if("function"!=typeof gt)return!1;try{e=new gt([1,3.14,-3.14,2147483648]),t=e,r=(pt&&t instanceof Int32Array||"[object Int32Array]"===K(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){r=!1}return r}()?mt:function(){throw new Error("not implemented")};var vt=yt,wt="function"==typeof Uint16Array;var bt="function"==typeof Uint16Array?Uint16Array:null;var dt,Et="function"==typeof Uint16Array?Uint16Array:void 0;dt=function(){var r,e,t;if("function"!=typeof bt)return!1;try{e=new bt(e=[1,3.14,-3.14,65536,65537]),t=e,r=(wt&&t instanceof Uint16Array||"[object Uint16Array]"===K(t))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Et:function(){throw new Error("not implemented")};var Tt=dt,_t="function"==typeof Int16Array;var xt="function"==typeof Int16Array?Int16Array:null;var At,Vt="function"==typeof Int16Array?Int16Array:void 0;At=function(){var r,e,t;if("function"!=typeof xt)return!1;try{e=new xt([1,3.14,-3.14,32768]),t=e,r=(_t&&t instanceof Int16Array||"[object Int16Array]"===K(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){r=!1}return r}()?Vt:function(){throw new Error("not implemented")};var Ot=At,Lt="function"==typeof Uint8Array;var jt="function"==typeof Uint8Array?Uint8Array:null;var St,Rt="function"==typeof Uint8Array?Uint8Array:void 0;St=function(){var r,e,t;if("function"!=typeof jt)return!1;try{e=new jt(e=[1,3.14,-3.14,256,257]),t=e,r=(Lt&&t instanceof Uint8Array||"[object Uint8Array]"===K(t))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Rt:function(){throw new Error("not implemented")};var Nt=St,Ft="function"==typeof Uint8ClampedArray;var It="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var Pt,kt="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;Pt=function(){var r,e,t;if("function"!=typeof It)return!1;try{e=new It([-1,0,1,3.14,4.99,255,256]),t=e,r=(Ft&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===K(t))&&0===e[0]&&0===e[1]&&1===e[2]&&3===e[3]&&5===e[4]&&255===e[5]&&255===e[6]}catch(e){r=!1}return r}()?kt:function(){throw new Error("not implemented")};var Mt=Pt,Bt="function"==typeof Int8Array;var Ct="function"==typeof Int8Array?Int8Array:null;var Ut,Yt="function"==typeof Int8Array?Int8Array:void 0;Ut=function(){var r,e,t;if("function"!=typeof Ct)return!1;try{e=new Ct([1,3.14,-3.14,128]),t=e,r=(Bt&&t instanceof Int8Array||"[object Int8Array]"===K(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){r=!1}return r}()?Yt:function(){throw new Error("not implemented")};var Gt=Ut,Wt=4294967295;function Jt(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&Jr(r.length)&&r.length>=0&&r.length<=Wt}var qt="function"==typeof ArrayBuffer;function Ht(r){return qt&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===K(r)}function $t(r,e){if(!(this instanceof $t))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Rr(r))throw new TypeError(j("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Rr(e))throw new TypeError(j("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}B($t,"BYTES_PER_ELEMENT",8),B($t.prototype,"BYTES_PER_ELEMENT",8),B($t.prototype,"byteLength",16),B($t.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),B($t.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var Xt="function"==typeof Math.fround?Math.fround:null,zt=new ht(1);var Zt="function"==typeof Xt?Xt:function(r){return zt[0]=r,zt[0]};function Dt(r,e){if(!(this instanceof Dt))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Rr(r))throw new TypeError(j("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Rr(e))throw new TypeError(j("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Zt(r)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Zt(e)}),this}function Kt(r){return r instanceof $t||r instanceof Dt||"object"==typeof r&&null!==r&&"number"==typeof r.re&&"number"==typeof r.im}function Qt(r){return Jr(r/2)}B(Dt,"BYTES_PER_ELEMENT",4),B(Dt.prototype,"BYTES_PER_ELEMENT",4),B(Dt.prototype,"byteLength",8),B(Dt.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),B(Dt.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var rn=8;function en(r){return"object"==typeof r&&null!==r&&"Complex64Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===rn}var tn=16;function nn(r){return"object"==typeof r&&null!==r&&"Complex128Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===tn}function on(){return"function"==typeof Z&&"symbol"==typeof Z("foo")&&z(Z,"iterator")&&"symbol"==typeof Z.iterator}var an=on()?Symbol.iterator:null;function un(r,e){if(!(this instanceof un))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Rr(r))throw new TypeError(j("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Rr(e))throw new TypeError(j("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Zt(r)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Zt(e)}),this}function fn(r){return r.re}function sn(r){return r.im}function ln(r,e){return new ht(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function cn(r,e){return new ut(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function hn(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(Jt(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Kt(n))return new TypeError(j("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(fn(n),sn(n))}return e}B(un,"BYTES_PER_ELEMENT",4),B(un.prototype,"BYTES_PER_ELEMENT",4),B(un.prototype,"byteLength",8),B(un.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),B(un.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var pn=2*ht.BYTES_PER_ELEMENT,gn=on();function yn(r){return r instanceof wn||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function mn(r){return r===wn||"Complex128Array"===r.name}function vn(r,e){return new un(r[e*=2],r[e+1])}function wn(){var r,e,t,n;if(e=arguments.length,!(this instanceof wn))return 0===e?new wn:1===e?new wn(arguments[0]):2===e?new wn(arguments[0],arguments[1]):new wn(arguments[0],arguments[1],arguments[2]);if(0===e)t=new ht(0);else if(1===e)if(Se(arguments[0]))t=new ht(2*arguments[0]);else if(ie(arguments[0]))if((n=(t=arguments[0]).length)&&gr(t)&&Kt(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;i<t;i++){if(!Kt(n=e[i]))return null;r[o]=fn(n),r[o+1]=sn(n),o+=2}return r}(new ht(2*n),t),null===t){if(!Qt(n))throw new RangeError(j("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new ht(arguments[0])}}else{if(en(t))t=ln(t,0);else if(nn(t))t=cn(t,0);else if(!Qt(n))throw new RangeError(j("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new ht(t)}else if(Ht(arguments[0])){if(!Jr((t=arguments[0]).byteLength/pn))throw new RangeError(j("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",pn,t.byteLength));t=new ht(t)}else{if(!_e(arguments[0]))throw new TypeError(j("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(t=arguments[0],!1===gn)throw new TypeError(j("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",t));if(!br(t[an]))throw new TypeError(j("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if(!br((t=t[an]()).next))throw new TypeError(j("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if((t=hn(t))instanceof Error)throw t;t=new ht(t)}else{if(!Ht(t=arguments[0]))throw new TypeError(j("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(!Se(r=arguments[1]))throw new TypeError(j("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",r));if(!Jr(r/pn))throw new RangeError(j("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",pn,r));if(2===e){if(!Jr((n=t.byteLength-r)/pn))throw new RangeError(j("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",pn,n));t=new ht(t,r)}else{if(!Se(n=arguments[2]))throw new TypeError(j("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*pn>t.byteLength-r)throw new RangeError(j("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*pn));t=new ht(t,r,2*n)}}return B(this,"_buffer",t),B(this,"_length",t.length/2),this}function bn(r,e){if(!(this instanceof bn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Rr(r))throw new TypeError(j("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Rr(e))throw new TypeError(j("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}function dn(r){return r.re}function En(r){return r.im}function Tn(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(Jt(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Kt(n))return new TypeError(j("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(dn(n),En(n))}return e}B(wn,"BYTES_PER_ELEMENT",pn),B(wn,"name","Complex64Array"),B(wn,"from",(function(r){var e,t,n,i,o,a,u,f,s,l,c,h;if(!br(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!mn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!br(n=arguments[1]))throw new TypeError(j("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(yn(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Kt(l=n.call(e,r.get(c),c)))o[h]=fn(l),o[h+1]=sn(l);else{if(!(Jt(l)&&l.length>=2))throw new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(r)}if(ie(r)){if(n){for(f=r.length,u=r.get&&r.set?Qe("default"):ze("default"),c=0;c<f;c++)if(!Kt(u(r,c))){s=!0;break}if(s){if(!Qt(f))throw new RangeError(j("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,c=0;c<f;c++)o[c]=n.call(e,u(r,c),c);return i}for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Kt(l=n.call(e,u(r,c),c)))o[h]=fn(l),o[h+1]=sn(l);else{if(!(Jt(l)&&l.length>=2))throw new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(r)}if(_e(r)&&gn&&br(r[an])){if(!br((o=r[an]()).next))throw new TypeError(j("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(a=n?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,Jt(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Kt(o))return new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(fn(o),sn(o))}return n}(o,n,e):hn(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c<f;c++)o[c]=a[c];return i}throw new TypeError(j("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))})),B(wn,"of",(function(){var r,e;if(!br(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!mn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),B(wn.prototype,"at",(function(r){if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Jr(r))throw new TypeError(j("invalid argument. Must provide an integer. Value: `%s`.",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return vn(this._buffer,r)})),C(wn.prototype,"buffer",(function(){return this._buffer.buffer})),C(wn.prototype,"byteLength",(function(){return this._buffer.byteLength})),C(wn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),B(wn.prototype,"BYTES_PER_ELEMENT",wn.BYTES_PER_ELEMENT),B(wn.prototype,"copyWithin",(function(r,e){if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),B(wn.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,r=this._buffer,n=this._length,o=-1,a=-2,B(t={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new un(r[a+=2],r[a+1]),{value:[o,e],done:!1}})),B(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),an&&B(t,an,(function(){return e.entries()})),t})),B(wn.prototype,"every",(function(r,e){var t,n;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,vn(t,n),n,this))return!1;return!0})),B(wn.prototype,"fill",(function(r,e,t){var n,i,o,a,u,f;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(n=this._buffer,i=this._length,arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!Jr(t))throw new TypeError(j("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else e=0,t=i;for(a=fn(r),u=sn(r),f=e;f<t;f++)n[o=2*f]=a,n[o+1]=u;return this})),B(wn.prototype,"filter",(function(r,e){var t,n,i,o;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=[],i=0;i<this._length;i++)o=vn(t,i),r.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),B(wn.prototype,"find",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=vn(t,n),r.call(e,i,n,this))return i})),B(wn.prototype,"findIndex",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=vn(t,n),r.call(e,i,n,this))return n;return-1})),B(wn.prototype,"findLast",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=vn(t,n),r.call(e,i,n,this))return i})),B(wn.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=vn(t,n),r.call(e,i,n,this))return n;return-1})),B(wn.prototype,"forEach",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)i=vn(t,n),r.call(e,i,n,this)})),B(wn.prototype,"get",(function(r){if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Se(r))throw new TypeError(j("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return vn(this._buffer,r)})),B(wn.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=fn(r),o=sn(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return!0;return!1})),B(wn.prototype,"indexOf",(function(r,e){var t,n,i,o,a;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=fn(r),o=sn(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),B(wn.prototype,"join",(function(r){var e,t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!Vr(r))throw new TypeError(j("invalid argument. First argument must be a string. Value: `%s`.",r));n=r}for(e=[],t=this._buffer,i=0;i<this._length;i++)e.push(vn(t,i).toString());return e.join(n)})),B(wn.prototype,"lastIndexOf",(function(r,e){var t,n,i,o,a;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=fn(r),o=sn(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),C(wn.prototype,"length",(function(){return this._length})),B(wn.prototype,"map",(function(r,e){var t,n,i,o,a;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(Kt(a=r.call(e,vn(n,o),o,this)))t[2*o]=fn(a),t[2*o+1]=sn(a);else{if(!Jt(a)||2!==a.length)throw new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));t[2*o]=a[0],t[2*o+1]=a[1]}return i})),B(wn.prototype,"reduce",(function(r,e){var t,n,i,o;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));if(t=this._buffer,i=this._length,arguments.length>1)n=e,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=vn(t,0),o=1}for(;o<i;o++)n=r(n,vn(t,o),o,this);return n})),B(wn.prototype,"reverse",(function(){var r,e,t,n,i,o;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,r=this._buffer,n=Wr(t/2),i=0;i<n;i++)o=t-i-1,e=r[2*i],r[2*i]=r[2*o],r[2*o]=e,e=r[2*i+1],r[2*i+1]=r[2*o+1],r[2*o+1]=e;return this})),B(wn.prototype,"set",(function(r){var e,t,n,i,o,a,u,f,s;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!Se(t=arguments[1]))throw new TypeError(j("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Kt(r)){if(t>=this._length)throw new RangeError(j("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=fn(r),void(n[t+1]=sn(r))}if(yn(r)){if(t+(a=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,s=n.byteOffset+t*pn,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new ht(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(t*=2,s=0,f=0;f<a;f++)n[t]=e[s],n[t+1]=e[s+1],t+=2,s+=2}else{if(!ie(r))throw new TypeError(j("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",r));for(a=r.length,f=0;f<a;f++)if(!Kt(r[f])){o=!0;break}if(o){if(!Qt(a))throw new RangeError(j("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(t+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,s=n.byteOffset+t*pn,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new ht(a),f=0;f<a;f++)i[f]=e[f];e=i}for(t*=2,a/=2,s=0,f=0;f<a;f++)n[t]=e[s],n[t+1]=e[s+1],t+=2,s+=2;return}if(t+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;f<a;f++)u=r[f],n[t]=fn(u),n[t+1]=sn(u),t+=2}})),B(wn.prototype,"slice",(function(r,e){var t,n,i,o,a,u,f;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!Jr(r))throw new TypeError(j("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(i=new this.constructor(t))._buffer,f=0;f<t;f++)o=2*(f+r),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),B(wn.prototype,"some",(function(r,e){var t,n;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,vn(t,n),n,this))return!0;return!1})),B(wn.prototype,"subarray",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)r=0,e=i;else{if(!Jr(r))throw new TypeError(j("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),1===arguments.length)e=i;else{if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*pn):(i=e-r,t=n.byteOffset+r*pn),new this.constructor(n.buffer,t,i<0?0:i)})),B(wn.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;i<t;i++)o=t-i-1,r[2*i]=n[2*o],r[2*i+1]=n[2*o+1];return e})),B(wn.prototype,"toString",(function(){var r,e,t;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(vn(e,t).toString());return r.join(",")})),B(wn.prototype,"with",(function(r,e){var t,n,i;if(!yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Jr(r))throw new TypeError(j("invalid argument. First argument must be an integer. Value: `%s`.",r));if(i=this._length,r<0&&(r+=i),r<0||r>=i)throw new RangeError(j("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!Kt(e))throw new TypeError(j("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=fn(e),t[2*r+1]=sn(e),n})),B(bn,"BYTES_PER_ELEMENT",8),B(bn.prototype,"BYTES_PER_ELEMENT",8),B(bn.prototype,"byteLength",16),B(bn.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),B(bn.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var _n=2*ut.BYTES_PER_ELEMENT,xn=on();function An(r){return r instanceof Ln||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function Vn(r){return r===Ln||"Complex64Array"===r.name}function On(r,e){return new bn(r[e*=2],r[e+1])}function Ln(){var r,e,t,n;if(e=arguments.length,!(this instanceof Ln))return 0===e?new Ln:1===e?new Ln(arguments[0]):2===e?new Ln(arguments[0],arguments[1]):new Ln(arguments[0],arguments[1],arguments[2]);if(0===e)t=new ut(0);else if(1===e)if(Se(arguments[0]))t=new ut(2*arguments[0]);else if(ie(arguments[0]))if((n=(t=arguments[0]).length)&&gr(t)&&Kt(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;i<t;i++){if(!Kt(n=e[i]))return null;r[o]=dn(n),r[o+1]=En(n),o+=2}return r}(new ut(2*n),t),null===t){if(!Qt(n))throw new RangeError(j("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new ut(arguments[0])}}else{if(en(t))t=ln(t,0);else if(nn(t))t=cn(t,0);else if(!Qt(n))throw new RangeError(j("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new ut(t)}else if(Ht(arguments[0])){if(!Jr((t=arguments[0]).byteLength/_n))throw new RangeError(j("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",_n,t.byteLength));t=new ut(t)}else{if(!_e(arguments[0]))throw new TypeError(j("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(t=arguments[0],!1===xn)throw new TypeError(j("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",t));if(!br(t[an]))throw new TypeError(j("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if(!br((t=t[an]()).next))throw new TypeError(j("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if((t=Tn(t))instanceof Error)throw t;t=new ut(t)}else{if(!Ht(t=arguments[0]))throw new TypeError(j("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(!Se(r=arguments[1]))throw new TypeError(j("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",r));if(!Jr(r/_n))throw new RangeError(j("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",_n,r));if(2===e){if(!Jr((n=t.byteLength-r)/_n))throw new RangeError(j("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",_n,n));t=new ut(t,r)}else{if(!Se(n=arguments[2]))throw new TypeError(j("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*_n>t.byteLength-r)throw new RangeError(j("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*_n));t=new ut(t,r,2*n)}}return B(this,"_buffer",t),B(this,"_length",t.length/2),this}B(Ln,"BYTES_PER_ELEMENT",_n),B(Ln,"name","Complex128Array"),B(Ln,"from",(function(r){var e,t,n,i,o,a,u,f,s,l,c,h;if(!br(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Vn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!br(n=arguments[1]))throw new TypeError(j("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(An(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Kt(l=n.call(e,r.get(c),c)))o[h]=dn(l),o[h+1]=En(l);else{if(!(Jt(l)&&l.length>=2))throw new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(r)}if(ie(r)){if(n){for(f=r.length,u=r.get&&r.set?Qe("default"):ze("default"),c=0;c<f;c++)if(!Kt(u(r,c))){s=!0;break}if(s){if(!Qt(f))throw new RangeError(j("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,c=0;c<f;c++)o[c]=n.call(e,u(r,c),c);return i}for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Kt(l=n.call(e,u(r,c),c)))o[h]=dn(l),o[h+1]=En(l);else{if(!(Jt(l)&&l.length>=2))throw new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[h]=l[0],o[h+1]=l[1]}h+=2}return i}return new this(r)}if(_e(r)&&xn&&br(r[an])){if(!br((o=r[an]()).next))throw new TypeError(j("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(a=n?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,Jt(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Kt(o))return new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(dn(o),En(o))}return n}(o,n,e):Tn(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c<f;c++)o[c]=a[c];return i}throw new TypeError(j("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))})),B(Ln,"of",(function(){var r,e;if(!br(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Vn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),B(Ln.prototype,"at",(function(r){if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Jr(r))throw new TypeError(j("invalid argument. Must provide an integer. Value: `%s`.",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return On(this._buffer,r)})),C(Ln.prototype,"buffer",(function(){return this._buffer.buffer})),C(Ln.prototype,"byteLength",(function(){return this._buffer.byteLength})),C(Ln.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),B(Ln.prototype,"BYTES_PER_ELEMENT",Ln.BYTES_PER_ELEMENT),B(Ln.prototype,"copyWithin",(function(r,e){if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),B(Ln.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,r=this._buffer,n=this._length,o=-1,a=-2,B(t={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new bn(r[a+=2],r[a+1]),{value:[o,e],done:!1}})),B(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),an&&B(t,an,(function(){return e.entries()})),t})),B(Ln.prototype,"every",(function(r,e){var t,n;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,On(t,n),n,this))return!1;return!0})),B(Ln.prototype,"fill",(function(r,e,t){var n,i,o,a,u,f;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(n=this._buffer,i=this._length,arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!Jr(t))throw new TypeError(j("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else e=0,t=i;for(a=dn(r),u=En(r),f=e;f<t;f++)n[o=2*f]=a,n[o+1]=u;return this})),B(Ln.prototype,"filter",(function(r,e){var t,n,i,o;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=[],i=0;i<this._length;i++)o=On(t,i),r.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),B(Ln.prototype,"find",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=On(t,n),r.call(e,i,n,this))return i})),B(Ln.prototype,"findIndex",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=On(t,n),r.call(e,i,n,this))return n;return-1})),B(Ln.prototype,"findLast",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=On(t,n),r.call(e,i,n,this))return i})),B(Ln.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=On(t,n),r.call(e,i,n,this))return n;return-1})),B(Ln.prototype,"forEach",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)i=On(t,n),r.call(e,i,n,this)})),B(Ln.prototype,"get",(function(r){if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Se(r))throw new TypeError(j("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return On(this._buffer,r)})),C(Ln.prototype,"length",(function(){return this._length})),B(Ln.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=dn(r),o=En(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return!0;return!1})),B(Ln.prototype,"indexOf",(function(r,e){var t,n,i,o,a;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=dn(r),o=En(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),B(Ln.prototype,"join",(function(r){var e,t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!Sr(r))throw new TypeError(j("invalid argument. First argument must be a string. Value: `%s`.",r));n=r}for(e=[],t=this._buffer,i=0;i<this._length;i++)e.push(On(t,i).toString());return e.join(n)})),B(Ln.prototype,"lastIndexOf",(function(r,e){var t,n,i,o,a;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Kt(r))throw new TypeError(j("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=dn(r),o=En(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),B(Ln.prototype,"map",(function(r,e){var t,n,i,o,a;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(Kt(a=r.call(e,On(n,o),o,this)))t[2*o]=dn(a),t[2*o+1]=En(a);else{if(!Jt(a)||2!==a.length)throw new TypeError(j("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));t[2*o]=a[0],t[2*o+1]=a[1]}return i})),B(Ln.prototype,"reduce",(function(r,e){var t,n,i,o;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));if(t=this._buffer,i=this._length,arguments.length>1)n=e,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=On(t,0),o=1}for(;o<i;o++)n=r(n,On(t,o),o,this);return n})),B(Ln.prototype,"reverse",(function(){var r,e,t,n,i,o;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,r=this._buffer,n=Wr(t/2),i=0;i<n;i++)o=t-i-1,e=r[2*i],r[2*i]=r[2*o],r[2*o]=e,e=r[2*i+1],r[2*i+1]=r[2*o+1],r[2*o+1]=e;return this})),B(Ln.prototype,"set",(function(r){var e,t,n,i,o,a,u,f,s;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!Se(t=arguments[1]))throw new TypeError(j("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Kt(r)){if(t>=this._length)throw new RangeError(j("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=dn(r),void(n[t+1]=En(r))}if(An(r)){if(t+(a=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,s=n.byteOffset+t*_n,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new ut(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(t*=2,s=0,f=0;f<a;f++)n[t]=e[s],n[t+1]=e[s+1],t+=2,s+=2}else{if(!ie(r))throw new TypeError(j("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",r));for(a=r.length,f=0;f<a;f++)if(!Kt(r[f])){o=!0;break}if(o){if(!Qt(a))throw new RangeError(j("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(t+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,s=n.byteOffset+t*_n,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(i=new ut(a),f=0;f<a;f++)i[f]=e[f];e=i}for(t*=2,a/=2,s=0,f=0;f<a;f++)n[t]=e[s],n[t+1]=e[s+1],t+=2,s+=2;return}if(t+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;f<a;f++)u=r[f],n[t]=dn(u),n[t+1]=En(u),t+=2}})),B(Ln.prototype,"slice",(function(r,e){var t,n,i,o,a,u,f;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!Jr(r))throw new TypeError(j("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(i=new this.constructor(t))._buffer,f=0;f<t;f++)o=2*(f+r),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),B(Ln.prototype,"some",(function(r,e){var t,n;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!br(r))throw new TypeError(j("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,On(t,n),n,this))return!0;return!1})),B(Ln.prototype,"subarray",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)r=0,e=i;else{if(!Jr(r))throw new TypeError(j("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),1===arguments.length)e=i;else{if(!Jr(e))throw new TypeError(j("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*_n):(i=e-r,t=n.byteOffset+r*_n),new this.constructor(n.buffer,t,i<0?0:i)})),B(Ln.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;i<t;i++)o=t-i-1,r[2*i]=n[2*o],r[2*i+1]=n[2*o+1];return e})),B(Ln.prototype,"toString",(function(){var r,e,t;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(On(e,t).toString());return r.join(",")})),B(Ln.prototype,"with",(function(r,e){var t,n,i;if(!An(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Jr(r))throw new TypeError(j("invalid argument. First argument must be an integer. Value: `%s`.",r));if(i=this._length,r<0&&(r+=i),r<0||r>=i)throw new RangeError(j("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!Kt(e))throw new TypeError(j("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=dn(e),t[2*r+1]=En(e),n}));var jn=[ut,ht,vt,We,Ot,Tt,Gt,Nt,Mt,wn,Ln],Sn=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],Rn=Sn.length;function Nn(r){var e,t=function(r){var e;if(gr(r))return"generic";if(mr(r))return null;for(e=0;e<Rn;e++)if(r instanceof jn[e])return Sn[e];return tt[vr(r)]||null}(r);return typeof(e=r).get===$e&&typeof e.set===$e?{data:r,dtype:t,accessorProtocol:!0,accessors:[Qe(t),et(t)]}:{data:r,dtype:t,accessorProtocol:!1,accessors:[ze(t),De(t)]}}function Fn(r,e,t,n,i,o,a){var u,f,s,l,c,h,p;for(u=e.data,f=i.data,l=e.accessors[0],s=i.accessors[1],c=n,h=a,p=0;p<r;p++)s(f,h,l(u,c)),c+=t,h+=o;return e}var In=8;function Pn(r,e,t,n,i){var o,a,u,f,s,l;if(r<=0)return n;if(u=Nn(e),f=Nn(n),u.accessorProtocol||f.accessorProtocol)return Fn(r,u,t,o=t<0?(1-r)*t:0,f,i,a=i<0?(1-r)*i:0),f.data;if(1===t&&1===i){if((s=r%In)>0)for(l=0;l<s;l++)n[l]=e[l];if(r<In)return n;for(l=s;l<r;l+=In)n[l]=e[l],n[l+1]=e[l+1],n[l+2]=e[l+2],n[l+3]=e[l+3],n[l+4]=e[l+4],n[l+5]=e[l+5],n[l+6]=e[l+6],n[l+7]=e[l+7];return n}for(o=t<0?(1-r)*t:0,a=i<0?(1-r)*i:0,l=0;l<r;l++)n[a]=e[o],o+=t,a+=i;return n}function kn(){}B(Pn,"ndarray",(function(r,e,t,n,i,o,a){var u,f,s,l,c,h;if(r<=0)return i;if(s=Nn(e),l=Nn(i),s.accessorProtocol||l.accessorProtocol)return Fn(r,s,t,n,l,o,a),l.data;if(u=n,f=a,1===t&&1===o){if((c=r%8)>0)for(h=0;h<c;h++)i[f]=e[u],u+=t,f+=o;if(r<8)return i;for(h=c;h<r;h+=8)i[f]=e[u],i[f+1]=e[u+1],i[f+2]=e[u+2],i[f+3]=e[u+3],i[f+4]=e[u+4],i[f+5]=e[u+5],i[f+6]=e[u+6],i[f+7]=e[u+7],u+=8,f+=8;return i}for(h=0;h<r;h++)i[f]=e[u],u+=t,f+=o;return i}));var Mn="foo"===kn.name;var Bn=[ut,ht,vt,We,Ot,Tt,Gt,Nt,Mt],Cn=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],Un=ot()?Oe(ut):Yn;function Yn(){}Un="TypedArray"===function(r){if(!1===br(r))throw new TypeError(j("invalid argument. Must provide a function. Value: `%s`.",r));return Mn?r.name:pr.exec(r.toString())[1]}(Un)?Un:Yn;var Gn=[Ln,wn],Wn=["Complex64Array","Complex128Array"];function Jn(r,e){if("function"!=typeof e)throw new TypeError(j("invalid argument. Second argument must be callable. Value: `%s`.",e));return r instanceof e}var qn=[[ut,"Float64Array"],[ht,"Float32Array"],[vt,"Int32Array"],[We,"Uint32Array"],[Ot,"Int16Array"],[Tt,"Uint16Array"],[Gt,"Int8Array"],[Nt,"Uint8Array"],[Mt,"Uint8ClampedArray"],[wn,"Complex64Array"],[Ln,"Complex128Array"]];function Hn(r){var e,t;for(t=0;t<qn.length;t++)if(Jn(r,qn[t][0]))return qn[t][1];for(;r;){for(e=vr(r),t=0;t<qn.length;t++)if(e===qn[t][1])return qn[t][1];r=Oe(r)}}function $n(r){var e,t,n;if(function(r){var e,t;if("object"!=typeof r||null===r)return!1;if(r instanceof Un)return!0;for(t=0;t<Bn.length;t++)if(r instanceof Bn[t])return!0;for(;r;){for(e=vr(r),t=0;t<Cn.length;t++)if(Cn[t]===e)return!0;r=Oe(r)}return!1}(r))e=r;else{if(!function(r){var e,t;if("object"!=typeof r||null===r)return!1;for(t=0;t<Gn.length;t++)if(r instanceof Gn[t])return!0;for(;r;){for(e=vr(r),t=0;t<Wn.length;t++)if(Wn[t]===e)return!0;r=Oe(r)}return!1}(r))throw new TypeError(j("invalid argument. Must provide a typed array. Value: `%s`.",r));e=8===r.BYTES_PER_ELEMENT?ln(r,0):cn(r,0)}for(t={type:Hn(r),data:[]},n=0;n<e.length;n++)t.data.push(e[n]);return t}var Xn=Kr-1;function zn(){return Wr(1+Xn*Math.random())>>>0}var Zn=624,Dn=397,Kn=Kr>>>0,Qn=19650218,ri=2147483648,ei=2147483647,ti=1812433253,ni=1664525,ii=1566083941,oi=2636928640,ai=4022730752,ui=[0,2567483615],fi=1/9007199254740992,si=67108864,li=2147483648,ci=1,hi=Ce*fi,pi=1,gi=3,yi=2,mi=Zn+3,vi=Zn+5,wi=Zn+6;function bi(r,e){var t;return t=e?"option":"argument",r.length<wi+1?new RangeError(j("invalid %s. `state` array has insufficient length.",t)):r[0]!==pi?new RangeError(j("invalid %s. `state` array has an incompatible schema version. Expected: `%s`. Actual: `%s.`",t,pi,r[0])):r[1]!==gi?new RangeError(j("invalid %s. `state` array has an incompatible number of sections. Expected: `%s`. Actual: `%s`.",t,gi,r[1])):r[yi]!==Zn?new RangeError(j("invalid %s. `state` array has an incompatible state length. Expected: `%u`. Actual: `%u`.",t,Zn,r[yi])):1!==r[mi]?new RangeError(j("invalid %s. `state` array has an incompatible section length. Expected: `%u`. Actual: `%u`.",t,1,r[mi])):r[vi]!==r.length-wi?new RangeError(j("invalid %s. `state` array length is incompatible with seed section length. Expected: `%u`. Actual: `%u`.",t,r.length-wi,r[vi])):null}function di(r,e,t){var n;for(r[0]=t>>>0,n=1;n<e;n++)t=((t=r[n-1]>>>0)^t>>>30)>>>0,r[n]=He(t,ti)+n>>>0;return r}function Ei(r){var e,t,n,i,o,a;if(n={},arguments.length){if(!je(r))throw new TypeError(j("invalid argument. Options argument must be an object. Value: `%s`.",r));if(z(r,"copy")&&(n.copy=r.copy,!J(r.copy)))throw new TypeError(j("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",r.copy));if(z(r,"state")){if(t=r.state,n.state=!0,!Pe(t))throw new TypeError(j("invalid option. `%s` option must be a Uint32Array. Option: `%s`.","state",t));if(a=bi(t,!0))throw a;!1===n.copy?e=t:(e=new We(t.length),Pn(t.length,t,1,e,1)),t=new We(e.buffer,e.byteOffset+(yi+1)*e.BYTES_PER_ELEMENT,Zn),i=new We(e.buffer,e.byteOffset+(vi+1)*e.BYTES_PER_ELEMENT,t[vi])}if(void 0===i)if(z(r,"seed"))if(i=r.seed,n.seed=!0,ke(i)){if(i>Kn)throw new RangeError(j("invalid option. `%s` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.","seed",i));i>>>=0}else{if(!1===ie(i)||i.length<1)throw new TypeError(j("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",i));if(1===i.length){if(!ke(i=i[0]))throw new TypeError(j("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",i));if(i>Kn)throw new RangeError(j("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.","seed",i));i>>>=0}else o=i.length,(e=new We(wi+o))[0]=pi,e[1]=gi,e[yi]=Zn,e[mi]=1,e[mi+1]=Zn,e[vi]=o,Pn.ndarray(o,i,1,0,e,1,vi+1),t=new We(e.buffer,e.byteOffset+(yi+1)*e.BYTES_PER_ELEMENT,Zn),i=new We(e.buffer,e.byteOffset+(vi+1)*e.BYTES_PER_ELEMENT,o),t=function(r,e,t,n){var i,o,a,u;for(o=1,a=0,u=Je(e,n);u>0;u--)i=He(i=((i=r[o-1]>>>0)^i>>>30)>>>0,ni)>>>0,r[o]=(r[o]>>>0^i)+t[a]+a>>>0,a+=1,(o+=1)>=e&&(r[0]=r[e-1],o=1),a>=n&&(a=0);for(u=e-1;u>0;u--)i=He(i=((i=r[o-1]>>>0)^i>>>30)>>>0,ii)>>>0,r[o]=(r[o]>>>0^i)-o>>>0,(o+=1)>=e&&(r[0]=r[e-1],o=1);return r[0]=li,r}(t=di(t,Zn,Qn),Zn,i,o)}else i=zn()>>>0}else i=zn()>>>0;return void 0===t&&((e=new We(wi+1))[0]=pi,e[1]=gi,e[yi]=Zn,e[mi]=1,e[mi+1]=Zn,e[vi]=1,e[vi+1]=i,t=new We(e.buffer,e.byteOffset+(yi+1)*e.BYTES_PER_ELEMENT,Zn),i=new We(e.buffer,e.byteOffset+(vi+1)*e.BYTES_PER_ELEMENT,1),t=di(t,Zn,i)),B(g,"NAME","mt19937"),C(g,"seed",u),C(g,"seedLength",f),U(g,"state",c,h),C(g,"stateLength",s),C(g,"byteLength",l),B(g,"toJSON",p),B(g,"MIN",0),B(g,"MAX",Kr),B(g,"normalized",y),B(y,"NAME",g.NAME),C(y,"seed",u),C(y,"seedLength",f),U(y,"state",c,h),C(y,"stateLength",s),C(y,"byteLength",l),B(y,"toJSON",p),B(y,"MIN",0),B(y,"MAX",hi),g;function u(){var r=e[vi];return Pn(r,i,1,new We(r),1)}function f(){return e[vi]}function s(){return e.length}function l(){return e.byteLength}function c(){var r=e.length;return Pn(r,e,1,new We(r),1)}function h(r){var o;if(!Pe(r))throw new TypeError(j("invalid argument. Must provide a Uint32Array. Value: `%s`.",r));if(o=bi(r,!1))throw o;!1===n.copy?n.state&&r.length===e.length?Pn(r.length,r,1,e,1):(e=r,n.state=!0):(r.length!==e.length&&(e=new We(r.length)),Pn(r.length,r,1,e,1)),t=new We(e.buffer,e.byteOffset+(yi+1)*e.BYTES_PER_ELEMENT,Zn),i=new We(e.buffer,e.byteOffset+(vi+1)*e.BYTES_PER_ELEMENT,e[vi])}function p(){var r={type:"PRNG"};return r.name=g.NAME,r.state=$n(e),r.params=[],r}function g(){var r,n;return(n=e[mi+1])>=Zn&&(t=function(r){var e,t,n,i;for(i=Zn-Dn,t=0;t<i;t++)e=r[t]&ri|r[t+1]&ei,r[t]=r[t+Dn]^e>>>1^ui[e&ci];for(n=Zn-1;t<n;t++)e=r[t]&ri|r[t+1]&ei,r[t]=r[t-i]^e>>>1^ui[e&ci];return e=r[n]&ri|r[0]&ei,r[n]=r[Dn-1]^e>>>1^ui[e&ci],r}(t),n=0),r=t[n],e[mi+1]=n+1,r^=r>>>11,r^=r<<7&oi,r^=r<<15&ai,(r^=r>>>18)>>>0}function y(){var r=g()>>>5,e=g()>>>6;return(r*si+e)*fi}}function Ti(r){return Math.abs(r)}B(Ei({seed:zn()}),"factory",Ei);var _i=Math.ceil;function xi(r){return r<0?_i(r):Wr(r)}var Ai=1023,Vi=1023,Oi=-1023,Li=-1074;function ji(r){return r===Yr||r===Gr}var Si,Ri=2147483648,Ni=2147483647,Fi={uint16:Tt,uint8:Nt};(Si=new Fi.uint16(1))[0]=4660;var Ii,Pi,ki=52===new Fi.uint8(Si.buffer)[0];!0===ki?(Ii=1,Pi=0):(Ii=0,Pi=1);var Mi={HIGH:Ii,LOW:Pi},Bi=new ut(1),Ci=new We(Bi.buffer),Ui=Mi.HIGH,Yi=Mi.LOW;function Gi(r,e,t,n){return Bi[0]=r,e[n]=Ci[Ui],e[n+t]=Ci[Yi],e}function Wi(r){return Gi(r,[0,0],1,0)}B(Wi,"assign",Gi);var Ji,qi,Hi=!0===ki?1:0,$i=new ut(1),Xi=new We($i.buffer);function zi(r){return $i[0]=r,Xi[Hi]}!0===ki?(Ji=1,qi=0):(Ji=0,qi=1);var Zi={HIGH:Ji,LOW:qi},Di=new ut(1),Ki=new We(Di.buffer),Qi=Zi.HIGH,ro=Zi.LOW;function eo(r,e){return Ki[Qi]=r,Ki[ro]=e,Di[0]}var to=[0,0];function no(r,e){var t,n;return Wi.assign(r,to,1,0),t=to[0],t&=Ni,n=zi(e),eo(t|=n&=Ri,to[1])}var io=22250738585072014e-324,oo=4503599627370496;function ao(r,e,t,n){return Mr(r)||ji(r)?(e[n]=r,e[n+t]=0,e):0!==r&&Ti(r)<io?(e[n]=r*oo,e[n+t]=-52,e):(e[n]=r,e[n+t]=0,e)}B((function(r){return ao(r,[0,0],1,0)}),"assign",ao);var uo=2146435072;var fo=2220446049250313e-31,so=2148532223,lo=[0,0],co=[0,0];function ho(r,e){var t,n;return 0===e||0===r||Mr(r)||ji(r)?r:(ao(r,lo,1,0),r=lo[0],e+=lo[1],e+=function(r){var e=zi(r);return(e=(e&uo)>>>20)-Ai|0}(r),e<Li?no(0,r):e>Vi?r<0?Gr:Yr:(e<=Oi?(e+=52,n=fo):n=1,Wi.assign(r,co,1,0),t=co[0],t&=so,n*eo(t|=e+Ai<<20,co[1])))}var po=.6931471803691238,go=1.9082149292705877e-10,yo=1.4426950408889634,mo=709.782712893384,vo=-745.1332191019411,wo=1/(1<<28),bo=-wo;function Eo(r){var e;return Mr(r)||r===Yr?r:r===Gr?0:r>mo?Yr:r<vo?0:r>bo&&r<wo?1+r:function(r,e,t){var n,i,o,a;return ho(1-(e-(n=r-e)*(o=n-(i=n*n)*(0===(a=i)?.16666666666666602:.16666666666666602+a*(a*(6613756321437934e-20+a*(4.1381367970572385e-8*a-16533902205465252e-22))-.0027777777777015593)))/(2-o)-r),t)}(r-(e=xi(r<0?yo*r-.5:yo*r+.5))*po,e*go,e)}var To=Math.sqrt,_o=!0===ki?1:0,xo=new ut(1),Ao=new We(xo.buffer);function Vo(r,e){return xo[0]=r,Ao[_o]=e>>>0,xo[0]}var Oo=.6931471803691238,Lo=1.9082149292705877e-10,jo=0x40000000000000,So=.3333333333333333,Ro=1048575,No=2146435072,Fo=1048576,Io=1072693248;function Po(r){var e,t,n,i,o,a,u,f,s,l,c,h;return 0===r?Gr:Mr(r)||r<0?NaN:(o=0,(t=zi(r))<Fo&&(o-=54,t=zi(r*=jo)),t>=No?r+r:(o+=(t>>20)-Ai|0,o+=(f=(t&=Ro)+614244&1048576|0)>>20|0,u=(r=Vo(r,t|f^Io))-1,(Ro&2+t)<3?0===u?0===o?0:o*Oo+o*Lo:(a=u*u*(.5-So*u),0===o?u-a:o*Oo-(a-o*Lo-u)):(f=t-398458|0,s=440401-t|0,i=(c=(h=(l=u/(2+u))*l)*h)*function(r){return 0===r?.3999999999940942:.3999999999940942+r*(.22222198432149784+.15313837699209373*r)}(c),n=h*function(r){return 0===r?.6666666666666735:.6666666666666735+r*(.2857142874366239+r*(.1818357216161805+.14798198605116586*r))}(c),a=n+i,(f|=s)>0?(e=.5*u*u,0===o?u-(e-l*(e+a)):o*Oo-(e-(l*(e+a)+o*Lo)-u)):0===o?u-l*(u-a):o*Oo-(l*(u-a)-o*Lo-u))))}var ko=.00991256303526217;function Mo(r,e,t){var n,i;do{n=Po(r())/e,i=Po(r())}while(-2*i<n*n);return t?n-e:e-n}var Bo=3.442619855899,Co=function(r,e){var t,n,i;for(n=Eo(-.5*e*e),(t=[]).push(ko/n),t.push(e),i=2;i<r;i++)t[i]=To(-2*Po(ko/t[i-1]+n)),n=Eo(-.5*t[i]*t[i]);return t.push(0),t}(128,Bo),Uo=function(r){var e,t;for(e=[],t=0;t<r.length-1;t++)e.push(r[t+1]/r[t]);return e}(Co),Yo=127;function Go(r){var e,t,n,i;if(i={copy:!0},arguments.length){if(!je(r))throw new TypeError(j("invalid argument. Must provide an object. Value: `%s`.",r));if(z(r,"copy")&&(i.copy=r.copy,!J(r.copy)))throw new TypeError(j("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",r.copy));if(z(r,"prng")){if(!br(r.prng))throw new TypeError(j("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",r.prng));e=r.prng}else if(z(r,"state")){if(i.state=r.state,!Pe(r.state))throw new TypeError(j("invalid option. `%s` option must be a Uint32Array. Option: `%s`.","state",r.state))}else if(z(r,"seed")&&(i.seed=r.seed,void 0===r.seed))throw new TypeError(j("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",r.seed))}return void 0===i.state?void 0===e?e=(t=Ei(i)).normalized:(t=Ei({seed:Wr(1+Kr*e()),copy:i.copy}),i.seed=null):e=(t=Ei(i)).normalized,n=function(r,e){return function(){for(var t,n,i,o,a,u,f;;){if(a=2*r()-1,u=e()&Yo,Ti(a)<Uo[u])return a*Co[u];if(0===u)return Mo(r,Bo,a<0);if(i=(o=a*Co[u])*o,f=u+1,t=Eo(-.5*(Co[u]*Co[u]-i)),(n=Eo(-.5*(Co[f]*Co[f]-i)))+r()*(t-n)<1)return o}}}(e,t),B(n,"NAME","improved-ziggurat"),null===i.seed?(B(n,"seed",null),B(n,"seedLength",null)):(C(n,"seed",(function(){return t.seed})),C(n,"seedLength",(function(){return t.seedLength}))),r&&r.prng?(U(n,"state",Y(null),G),B(n,"stateLength",null),B(n,"byteLength",null),B(n,"toJSON",Y(null))):(U(n,"state",(function(){return t.state}),(function(r){t.state=r})),C(n,"stateLength",(function(){return t.stateLength})),C(n,"byteLength",(function(){return t.byteLength})),B(n,"toJSON",(function(){var r={type:"PRNG"};return r.name=n.NAME,r.state=$n(t.state),r.params=[],r}))),B(n,"PRNG",e),n}function Wo(r){return Qt(r>0?r-1:r+1)}B(Go(),"factory",Go);var Jo=!0===ki?0:1,qo=new ut(1),Ho=new We(qo.buffer);function $o(r,e){return qo[0]=r,Ho[Jo]=e>>>0,qo[0]}function Xo(r){return 0|r}var zo=1072693247,Zo=1e300,Do=1e-300;var Ko=1048575,Qo=1048576,ra=1072693248,ea=536870912,ta=524288,na=20,ia=9007199254740992,oa=.9617966939259756,aa=.9617967009544373,ua=-7.028461650952758e-9,fa=[1,1.5],sa=[0,.5849624872207642],la=[0,1.350039202129749e-8];var ca=1.4426950408889634,ha=1.4426950216293335,pa=1.9259629911266175e-8;var ga=.6931471805599453,ya=1048575;var ma=1048576,va=1071644672,wa=20,ba=.6931471824645996,da=-1.904654299957768e-9;var Ea=1072693247,Ta=1105199104,_a=1139802112,xa=1083179008,Aa=1072693248,Va=1083231232,Oa=3230714880,La=31,ja=1e300,Sa=1e-300,Ra=8008566259537294e-32,Na=[0,0],Fa=[0,0];function Ia(r,e){var t,n,i,o,a,u,f,s,l,c,h,p,g,y;if(Mr(r)||Mr(e))return NaN;if(Wi.assign(e,Na,1,0),a=Na[0],0===Na[1]){if(0===e)return 1;if(1===e)return r;if(-1===e)return 1/r;if(.5===e)return To(r);if(-.5===e)return 1/To(r);if(2===e)return r*r;if(3===e)return r*r*r;if(4===e)return(r*=r)*r;if(ji(e))return function(r,e){return-1===r?(r-r)/(r-r):1===r?1:Ti(r)<1==(e===Yr)?0:Yr}(r,e)}if(Wi.assign(r,Na,1,0),o=Na[0],0===Na[1]){if(0===o)return function(r,e){return e===Gr?Yr:e===Yr?0:e>0?Wo(e)?r:0:Wo(e)?no(Yr,r):Yr}(r,e);if(1===r)return 1;if(-1===r&&Wo(e))return-1;if(ji(r))return r===Gr?Ia(-0,-e):e<0?0:Yr}if(r<0&&!1===Jr(e))return(r-r)/(r-r);if(i=Ti(r),t=o&Ni|0,n=a&Ni|0,f=a>>>La|0,u=(u=o>>>La|0)&&Wo(e)?-1:1,n>Ta){if(n>_a)return function(r,e){return(zi(r)&Ni)<=zo?e<0?Zo*Zo:Do*Do:e>0?Zo*Zo:Do*Do}(r,e);if(t<Ea)return 1===f?u*ja*ja:u*Sa*Sa;if(t>Aa)return 0===f?u*ja*ja:u*Sa*Sa;h=function(r,e){var t,n,i,o,a,u,f;return o=(i=e-1)*i*(0===(f=i)?.5:.5+f*(.25*f-.3333333333333333)),t=(u=i*pa-o*ca)-((n=$o(n=(a=ha*i)+u,0))-a),r[0]=n,r[1]=t,r}(Fa,i)}else h=function(r,e,t){var n,i,o,a,u,f,s,l,c,h,p,g,y,m,v,w,b,d,E,T,_;return d=0,t<Qo&&(d-=53,t=zi(e*=ia)),d+=(t>>na)-Ai|0,t=(E=t&Ko|0)|ra|0,E<=235662?T=0:E<767610?T=1:(T=0,d+=1,t-=Qo),a=$o(i=(w=(e=Vo(e,t))-(s=fa[T]))*(b=1/(e+s)),0),n=(t>>1|ea)+ta,f=Vo(0,n+=T<<18),v=(o=i*i)*o*(0===(_=o)?.5999999999999946:.5999999999999946+_*(.4285714285785502+_*(.33333332981837743+_*(.272728123808534+_*(.23066074577556175+.20697501780033842*_))))),f=$o(f=3+(o=a*a)+(v+=(u=b*(w-a*f-a*(e-(f-s))))*(a+i)),0),c=$o(c=(w=a*f)+(b=u*f+(v-(f-3-o))*i),0),h=aa*c,y=(p=ua*c+(b-(c-w))*oa+la[T])-((g=$o(g=h+p+(l=sa[T])+(m=d),0))-m-l-h),r[0]=g,r[1]=y,r}(Fa,i,t);if(p=(c=(e-(s=$o(e,0)))*h[0]+e*h[1])+(l=s*h[0]),Wi.assign(p,Na,1,0),g=Xo(Na[0]),y=Xo(Na[1]),g>=xa){if(0!=(g-xa|y))return u*ja*ja;if(c+Ra>p-l)return u*ja*ja}else if((g&Ni)>=Va){if(0!=(g-Oa|y))return u*Sa*Sa;if(c<=p-l)return u*Sa*Sa}return p=function(r,e,t){var n,i,o,a,u,f,s,l,c,h;return c=((l=r&Ni|0)>>wa)-Ai|0,s=0,l>va&&(i=Vo(0,((s=r+(ma>>c+1)>>>0)&~(ya>>(c=((s&Ni)>>wa)-Ai|0)))>>>0),s=(s&ya|ma)>>wa-c>>>0,r<0&&(s=-s),e-=i),r=Xo(r=zi(f=1-((f=(o=(i=$o(i=t+e,0))*ba)+(a=(t-(i-e))*ga+i*da))*(n=f-(i=f*f)*(0===(h=i)?.16666666666666602:.16666666666666602+h*(h*(6613756321437934e-20+h*(4.1381367970572385e-8*h-16533902205465252e-22))-.0027777777777015593)))/(n-2)-((u=a-(f-o))+f*u)-f))),(r+=s<<wa>>>0)>>wa<=0?ho(f,s):Vo(f,r)}(g,l,c),u*p}function Pa(r,e,t,n,i){var o,a,u,f,s,l,c;for(o=!0;o;){do{c=1+i*(s=e())}while(c<=0);u=1-.331*(a=s*s)*a,f=.5*a+n*(1-(c*=c*c)+Po(c)),((l=r())<u||Po(l)<f)&&(o=!1)}return 1/t*n*c}var ka=1/3;function Ma(){var r,e,t,n,i,o,a,u,f,s,l;if(u=!0,0===arguments.length)o=Ei(i={copy:!1});else if(1===arguments.length){if(!je(i=arguments[0]))throw new TypeError(j("invalid argument. Options argument must be an object. Value: `%s`.",i));if(z(i,"copy")&&!J(i.copy))throw new TypeError(j("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",i.copy));if(z(i,"prng")){if(!br(i.prng))throw new TypeError(j("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",i.prng));o=i.prng}else{if(z(i,"state")&&!Pe(i.state))throw new TypeError(j("invalid option. `%s` option must be a Uint32Array. Option: `%s`.","state",i.state));!1===(i=be({},i)).copy?u=!1:i.state&&(i.state=Pn(i.state.length,i.state,1,new We(i.state.length),1)),i.copy=!1,o=Ei(i)}}else{if(f=function(r,e){return de(r)?de(e)?null:new TypeError(j("invalid argument. Second argument must be a positive number. Value: `%s`.",e)):new TypeError(j("invalid argument. First argument must be a positive number. Value: `%s`.",r))}(e=arguments[0],n=arguments[1]))throw f;if(arguments.length>2){if(!je(i=arguments[2]))throw new TypeError(j("invalid argument. Options argument must be an object. Value: `%s`.",i));if(z(i,"copy")&&!J(i.copy))throw new TypeError(j("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",i.copy));if(z(i,"prng")){if(!br(i.prng))throw new TypeError(j("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",i.prng));o=i.prng}else{if(z(i,"state")&&!Pe(i.state))throw new TypeError(j("invalid option. `%s` option must be a Uint32Array. Option: `%s`.","state",i.state));!1===(i=be({},i)).copy?u=!1:i.state&&(i.state=Pn(i.state.length,i.state,1,new We(i.state.length),1)),i.copy=!1,o=Ei(i)}}else o=Ei(i={copy:!1})}return i&&i.prng?t=Go({prng:i.prng}):(i.state?r=i.state:(r=o.state,o.state=r),t=Go({state:r,copy:!1})),void 0===e?a=function(r,e){var n,i;if(Mr(r)||Mr(e)||r<=0||e<=0)return NaN;if(r<1)return n=1/To(9*(i=r+1-ka)),Pa(o,t,e,i,n)*Ia(o(),1/r);return i=r-ka,n=1/To(9*i),Pa(o,t,e,i,n)}:(e>=1?(a=function(){return Pa(o,t,n,l,s)},l=e-ka):(a=function(){return Pa(o,t,n,l,s)*Ia(o(),1/e)},l=e+1-ka),s=1/To(9*l)),B(a,"NAME","gamma"),i&&i.prng?(B(a,"seed",null),B(a,"seedLength",null),U(a,"state",Y(null),G),B(a,"stateLength",null),B(a,"byteLength",null),B(a,"toJSON",Y(null)),B(a,"PRNG",o)):(C(a,"seed",(function(){return o.seed})),C(a,"seedLength",(function(){return o.seedLength})),U(a,"state",(function(){return o.state}),(function(r){if(!Pe(r))throw new TypeError(j("invalid argument. Must provide a Uint32Array. Value: `%s`.",r));u&&(r=Pn(r.length,r,1,new We(r.length),1));o.state=r})),C(a,"stateLength",(function(){return o.stateLength})),C(a,"byteLength",(function(){return o.byteLength})),B(a,"toJSON",(function(){var r={type:"PRNG"};r.name=a.NAME,r.state=$n(o.state),r.params=void 0===e?[]:[e,n];return r})),B(a,"PRNG",o),o=o.normalized),a}function Ba(){var r,e,t,n,i,o,a;if(0===arguments.length)r=Ma();else if(1===arguments.length){if(!je(n=arguments[0]))throw new TypeError(j("invalid argument. Options argument must be an object. Value: `%s`.",n));if(z(n,"prng")){if(!br(n.prng))throw new TypeError(j("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",n.prng));r=Ma({prng:n.prng})}else r=Ma(n)}else{if(a=function(r,e){return de(r)?de(e)?null:new TypeError(j("invalid argument. Second argument must be a positive number. Value: `%s`.",e)):new TypeError(j("invalid argument. First argument must be a positive number. Value: `%s`.",r))}(e=arguments[0],t=arguments[1]))throw a;if(arguments.length>2){if(!je(n=arguments[2]))throw new TypeError(j("invalid argument. Options argument must be an object. Value: `%s`.",n));if(z(n,"prng")){if(!br(n.prng))throw new TypeError(j("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",n.prng));r=Ma(e,t,{prng:n.prng})}else r=Ma(e,t,n)}else r=Ma(e,t)}return o=void 0===e?function(e,t){if(Mr(e)||Mr(t)||e<=0||t<=0)return NaN;return 1/r(e,t)}:function(){return 1/r()},i=r.PRNG,B(o,"NAME","invgamma"),n&&n.prng?(B(o,"seed",null),B(o,"seedLength",null),U(o,"state",Y(null),G),B(o,"stateLength",null),B(o,"byteLength",null),B(o,"toJSON",Y(null))):(C(o,"seed",(function(){return i.seed})),C(o,"seedLength",(function(){return i.seedLength})),U(o,"state",(function(){return i.state}),(function(r){i.state=r})),C(o,"stateLength",(function(){return i.stateLength})),C(o,"byteLength",(function(){return i.byteLength})),B(o,"toJSON",(function(){var r={type:"PRNG"};r.name=o.NAME,r.state=$n(i.state),r.params=void 0===e?[]:[e,t];return r}))),B(o,"PRNG",i),o}function Ca(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r<e.length;r++)t+="&arg[]="+encodeURIComponent(e[r]);return t}function Ua(r,e,t){var n,i,o,a,u;if(!de(r))throw new TypeError(Ca("0pt71",r));if(!de(e))throw new TypeError(Ca("0pt72",e));if(arguments.length>2){if(!je(t))throw new TypeError(Ca("0pt2V",t));if(z(n=be({},t),"iter")){if(!Se(n.iter))throw new TypeError(Ca("0pt2t","iter",n.iter))}else n.iter=Fe;o=Ba(r,e,n),void 0===n.prng&&!1!==n.copy&&(n.state=o.state)}else o=Ba(r,e),n={iter:Fe,state:o.state};return u=0,B(i={},"next",(function(){if(u+=1,a||u>n.iter)return{done:!0};return{value:o(),done:!1}})),B(i,"return",(function(r){if(a=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),n&&n.prng?(B(i,"seed",null),B(i,"seedLength",null),U(i,"state",Y(null),G),B(i,"stateLength",null),B(i,"byteLength",null)):(C(i,"seed",(function(){return o.PRNG.seed})),C(i,"seedLength",(function(){return o.PRNG.seedLength})),U(i,"state",(function(){return o.PRNG.state}),(function(r){o.PRNG.state=r})),C(i,"stateLength",(function(){return o.PRNG.stateLength})),C(i,"byteLength",(function(){return o.PRNG.byteLength}))),B(i,"PRNG",o.PRNG),an&&B(i,an,(function(){return Ua(r,e,n)})),i}B(Ma(),"factory",Ma),B(Ba(),"factory",Ba);export{Ua as default};
//# sourceMappingURL=mod.js.map