Repository navigation
Expand file tree
/
Copy pathmod.js
More file actions
4 lines (4 loc) · 28.1 KB
/
Copy pathmod.js
File metadata and controls
4 lines (4 loc) · 28.1 KB
1
2
3
4
// Copyright (c) 2026 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 o(r,e,t){var o=!1,i=e-r.length;return i<0||(function(r){return"-"===r[0]}(r)&&(o=!0,r=r.substr(1)),r=t?r+n(i):n(i)+r,o&&(r="-"+r)),r}var i=String.prototype.toLowerCase,f=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=o(n,r.precision,r.padRight)),n="-"+n):(n=u.toString(e),u||r.precision?r.precision&&(n=o(n,r.precision,r.padRight)):n="",r.sign&&(n=r.sign+n)),16===e&&(r.alternate&&(n="0x"+n),n=r.specifier===f.call(r.specifier)?f.call(n):i.call(n)),8===e&&r.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var a=Math.abs,h=String.prototype.toLowerCase,s=String.prototype.toUpperCase,c=String.prototype.replace,l=/e\+(\d)$/,p=/e-(\d)$/,w=/^(\d+)$/,y=/^(\d+)e/,g=/\.0$/,b=/\.0*e/,E=/(\..*[^0])0*e/;function v(r,e){var t,n;switch(e.specifier){case"e":case"E":n=r.toExponential(e.precision);break;case"f":case"F":n=r.toFixed(e.precision);break;case"g":case"G":a(r)<1e-4?((t=e.precision)>0&&(t-=1),n=r.toExponential(t)):n=r.toPrecision(e.precision),e.alternate||(n=c.call(n,E,"$1e"),n=c.call(n,b,"e"),n=c.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return n=c.call(n,l,"e+0$1"),n=c.call(n,p,"e-0$1"),e.alternate&&(n=c.call(n,w,"$1."),n=c.call(n,y,"$1.e")),r>=0&&e.sign&&(n=e.sign+n),n=e.specifier===s.call(e.specifier)?s.call(n):h.call(n)}function d(r){var e,t="";for(e=0;e<r;e++)t+=" ";return t}var _=String.fromCharCode,R=Array.isArray;function T(r){return r!=r}function m(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 j(r){var e,n,i,f,a,h,s,c,l,p,w,y,g,b;if(!R(r))throw new TypeError("invalid argument. First argument must be an array. Value: `"+r+"`.");for(h="",s=1,l=0;l<r.length;l++)if(i=r[l],"string"==typeof i)h+=i;else{if(e=void 0!==i.precision,!(i=m(i)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+l+"`. Value: `"+i+"`.");for(i.mapping&&(s=i.mapping),n=i.flags,p=0;p<n.length;p++)switch(f=n.charAt(p)){case" ":i.sign=" ";break;case"+":i.sign="+";break;case"-":i.padRight=!0,i.padZeros=!1;break;case"0":i.padZeros=n.indexOf("-")<0;break;case"#":i.alternate=!0;break;default:throw new Error("invalid flag: "+f)}if("*"===i.width){if(i.width=parseInt(arguments[s],10),s+=1,T(i.width))throw new TypeError("the argument for * width at position "+s+" is not a number. Value: `"+i.width+"`.");i.width<0&&(i.padRight=!0,i.width=-i.width)}if(e&&"*"===i.precision){if(i.precision=parseInt(arguments[s],10),s+=1,T(i.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+i.precision+"`.");i.precision<0&&(i.precision=1,e=!1)}switch(i.arg=arguments[s],i.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(i.padZeros=!1),i.arg=u(i);break;case"s":i.maxWidth=e?i.precision:-1,i.arg=String(i.arg);break;case"c":if(!T(i.arg)){if((a=parseInt(i.arg,10))<0||a>127)throw new Error("invalid character code. Value: "+i.arg);i.arg=T(a)?String(i.arg):_(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(e||(i.precision=6),c=parseFloat(i.arg),!isFinite(c)){if(!t(i.arg))throw new Error("invalid floating-point number. Value: "+h);c=i.arg,i.padZeros=!1}i.arg=v(c,i);break;default:throw new Error("invalid specifier: "+i.specifier)}i.maxWidth>=0&&i.arg.length>i.maxWidth&&(i.arg=i.arg.substring(0,i.maxWidth)),i.padZeros?i.arg=o(i.arg,i.width||i.precision,i.padRight):i.width&&(i.arg=(w=i.arg,y=i.width,g=i.padRight,b=void 0,(b=y-w.length)<0?w:w=g?w+d(b):d(b)+w)),h+=i.arg||"",s+=1}return h}var S=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function x(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 A(r){var e,t,n,o;for(t=[],o=0,n=S.exec(r);n;)(e=r.slice(o,S.lastIndex-n[0].length)).length&&t.push(e),"%"===n[6]?t.push("%"):t.push(x(n)),o=S.lastIndex,n=S.exec(r);return(e=r.slice(o)).length&&t.push(e),t}function F(r){var e,t;if("string"!=typeof r)throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[A(r)],t=1;t<arguments.length;t++)e.push(arguments[t]);return j.apply(null,e)}var O,L=Object.prototype,P=L.toString,N=L.__defineGetter__,k=L.__defineSetter__,B=L.__lookupGetter__,I=L.__lookupSetter__;O=function(){try{return r({},"x",{}),!0}catch(r){return!1}}()?e:function(r,e,t){var n,o,i,f;if("object"!=typeof r||null===r||"[object Array]"===P.call(r))throw new TypeError(F("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===P.call(t))throw new TypeError(F("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((o="value"in t)&&(B.call(r,e)||I.call(r,e)?(n=r.__proto__,r.__proto__=L,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),i="get"in t,f="set"in t,o&&(i||f))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return i&&N&&N.call(r,e,t.get),f&&k&&k.call(r,e,t.set),r};var C=O;function V(r,e,t){C(r,e,{configurable:!1,enumerable:!1,writable:!1,value:t})}function M(r){return"number"==typeof r}var Y="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function G(){return Y&&"symbol"==typeof Symbol.toStringTag}var $=Object.prototype.toString;var W=Object.prototype.hasOwnProperty;function Z(r,e){return null!=r&&W.call(r,e)}var J="function"==typeof Symbol?Symbol:void 0,U="function"==typeof J?J.toStringTag:"";var X=G()?function(r){var e,t,n;if(null==r)return $.call(r);t=r[U],e=Z(r,U);try{r[U]=void 0}catch(e){return $.call(r)}return n=$.call(r),e?r[U]=t:delete r[U],n}:function(r){return $.call(r)},z=Number,H=z.prototype.toString;var K=G();function Q(r){return"object"==typeof r&&(r instanceof z||(K?function(r){try{return H.call(r),!0}catch(r){return!1}}(r):"[object Number]"===X(r)))}function q(r){return M(r)||Q(r)}V(q,"isPrimitive",M),V(q,"isObject",Q);var D=Number.POSITIVE_INFINITY,rr=z.NEGATIVE_INFINITY,er=Math.floor;function tr(r){return er(r)===r}function nr(r){return r<D&&r>rr&&tr(r)}function or(r){return M(r)&&nr(r)}function ir(r){return Q(r)&&nr(r.valueOf())}function fr(r){return or(r)||ir(r)}function ur(r){return or(r)&&r>=0}function ar(r){return ir(r)&&r.valueOf()>=0}function hr(r){return ur(r)||ar(r)}V(fr,"isPrimitive",or),V(fr,"isObject",ir),V(hr,"isPrimitive",ur),V(hr,"isObject",ar);var sr=4294967295;function cr(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&tr(r.length)&&r.length>=0&&r.length<=sr}var lr=9007199254740991;function pr(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&tr(r.length)&&r.length>=0&&r.length<=lr}var wr="function"==typeof ArrayBuffer;function yr(r){return wr&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===X(r)}var gr=Array.isArray?Array.isArray:function(r){return"[object Array]"===X(r)};function br(r){return"object"==typeof r&&null!==r&&!gr(r)}function Er(r){if("function"!=typeof r)throw new TypeError(F("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}}function vr(r){return"string"==typeof r}var dr=String.prototype.valueOf;var _r=G();function Rr(r){return"object"==typeof r&&(r instanceof String||(_r?function(r){try{return dr.call(r),!0}catch(r){return!1}}(r):"[object String]"===X(r)))}function Tr(r){return vr(r)||Rr(r)}V(Tr,"isPrimitive",vr),V(Tr,"isObject",Rr);var mr=Er(Tr.isPrimitive),jr=Er(Tr.isObject),Sr=Er(Tr);V(Sr,"primitives",mr),V(Sr,"objects",jr);var xr=/./;function Ar(r){return"boolean"==typeof r}var Fr=Boolean,Or=Boolean.prototype.toString;var Lr=G();function Pr(r){return"object"==typeof r&&(r instanceof Fr||(Lr?function(r){try{return Or.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===X(r)))}function Nr(r){return Ar(r)||Pr(r)}V(Nr,"isPrimitive",Ar),V(Nr,"isObject",Pr);var kr="object"==typeof self?self:null,Br="object"==typeof window?window:null,Ir="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Cr="object"==typeof Ir?Ir:null,Vr="object"==typeof globalThis?globalThis:null;var Mr=function(r){if(arguments.length){if(!Ar(r))throw new TypeError(F("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(Vr)return Vr;if(kr)return kr;if(Br)return Br;if(Cr)return Cr;throw new Error("unexpected error. Unable to resolve global object.")}(),Yr=Mr.document&&Mr.document.childNodes,Gr=Int8Array;function $r(){return/^\s*function\s*([^(]*)/i}var Wr=/^\s*function\s*([^(]*)/i;function Zr(r){return null!==r&&"object"==typeof r}function Jr(r){var e,t,n,o;if(("Object"===(t=X(r).slice(8,-1))||"Error"===t)&&r.constructor){if("string"==typeof(n=r.constructor).name)return n.name;if(e=Wr.exec(n.toString()))return e[1]}return Zr(o=r)&&(o._isBuffer||o.constructor&&"function"==typeof o.constructor.isBuffer&&o.constructor.isBuffer(o))?"Buffer":t}V($r,"REGEXP",Wr),V(Zr,"isObjectLikeArray",Er(Zr));var Ur="function"==typeof xr||"object"==typeof Gr||"function"==typeof Yr?function(r){return Jr(r).toLowerCase()}:function(r){var e;return null===r?"null":"object"===(e=typeof r)?Jr(r).toLowerCase():e};function Xr(r){return"function"===Ur(r)}function zr(r,e,t){C(r,e,{configurable:!1,enumerable:!0,writable:!1,value:t})}function Hr(r,e){if(!(this instanceof Hr))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!M(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!M(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return zr(this,"re",r),zr(this,"im",e),this}V(Hr,"name","Complex128"),V(Hr,"BYTES_PER_ELEMENT",8),V(Hr.prototype,"BYTES_PER_ELEMENT",8),V(Hr.prototype,"byteLength",16),V(Hr.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),V(Hr.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var Kr="function"==typeof Math.fround?Math.fround:null,Qr="function"==typeof Float32Array;var qr="function"==typeof Float32Array?Float32Array:null;var Dr="function"==typeof Float32Array?Float32Array:void 0;var re=function(){var r,e,t;if("function"!=typeof qr)return!1;try{e=new qr([1,3.14,-3.14,5e40]),t=e,r=(Qr&&t instanceof Float32Array||"[object Float32Array]"===X(t))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===D}catch(e){r=!1}return r}()?Dr:function(){throw new Error("not implemented")},ee=new re(1);var te="function"==typeof Kr?Kr:function(r){return ee[0]=r,ee[0]};function ne(r,e){if(!(this instanceof ne))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!M(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!M(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return zr(this,"re",te(r)),zr(this,"im",te(e)),this}function oe(r){return r instanceof Hr||r instanceof ne||"object"==typeof r&&null!==r&&"number"==typeof r.re&&"number"==typeof r.im}function ie(r){return tr(r/2)}V(ne,"name","Complex64"),V(ne,"BYTES_PER_ELEMENT",4),V(ne.prototype,"BYTES_PER_ELEMENT",4),V(ne.prototype,"byteLength",8),V(ne.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),V(ne.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var fe=8;var ue=16;function ae(){return"function"==typeof J&&"symbol"==typeof J("foo")&&Z(J,"iterator")&&"symbol"==typeof J.iterator}var he=ae()?Symbol.iterator:null;function se(r,e,t){C(r,e,{configurable:!1,enumerable:!1,get:t})}function ce(){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 le(r){return r.re}function pe(r){return r.im}var we="function"==typeof Float64Array;var ye="function"==typeof Float64Array?Float64Array:null;var ge="function"==typeof Float64Array?Float64Array:void 0;var be=function(){var r,e,t;if("function"!=typeof ye)return!1;try{e=new ye([1,3.14,-3.14,NaN]),t=e,r=(we&&t instanceof Float64Array||"[object Float64Array]"===X(t))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){r=!1}return r}()?ge:function(){throw new Error("not implemented")};var Ee={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]}};var ve={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 de(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(cr(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!oe(n))return new TypeError(ce("00R24",n));e.push(le(n),pe(n))}return e}var _e=2*re.BYTES_PER_ELEMENT,Re=ae();function Te(r){return r instanceof Se||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function me(r){return r===Se||"Complex128Array"===r.name}function je(r,e){return new ne(r[e*=2],r[e+1])}function Se(){var r,e,t,n,o,i,f;if(e=arguments.length,!(this instanceof Se))return 0===e?new Se:1===e?new Se(arguments[0]):2===e?new Se(arguments[0],arguments[1]):new Se(arguments[0],arguments[1],arguments[2]);if(0===e)t=new re(0);else if(1===e)if(ur(arguments[0]))t=new re(2*arguments[0]);else if(pr(arguments[0]))if((n=(t=arguments[0]).length)&&gr(t)&&oe(t[0])){if(t=function(r,e){var t,n,o,i;for(t=e.length,i=0,o=0;o<t;o++){if(!oe(n=e[o]))return null;r[i]=le(n),r[i+1]=pe(n),i+=2}return r}(new re(2*n),t),null===t){if(!ie(n))throw new RangeError(ce("00R26",n));t=new re(arguments[0])}}else{if("object"==typeof(f=t)&&null!==f&&"Complex64Array"===f.constructor.name&&f.BYTES_PER_ELEMENT===fe)i=0,t=new re((o=t).buffer,o.byteOffset+o.BYTES_PER_ELEMENT*i,2*(o.length-i));else if(function(r){return"object"==typeof r&&null!==r&&"Complex128Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===ue}(t))t=function(r,e){return new be(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}(t,0);else if(!ie(n))throw new RangeError(ce("00R27",n));t=new re(t)}else if(yr(arguments[0])){if(!tr((t=arguments[0]).byteLength/_e))throw new RangeError(ce("00RE9",_e,t.byteLength));t=new re(t)}else{if(!br(arguments[0]))throw new TypeError(ce("00R2A",arguments[0]));if(t=arguments[0],!1===Re)throw new TypeError(ce("00R29",t));if(!Xr(t[he]))throw new TypeError(ce("00R2A",t));if(!Xr((t=t[he]()).next))throw new TypeError(ce("00R2A",t));if((t=de(t))instanceof Error)throw t;t=new re(t)}else{if(!yr(t=arguments[0]))throw new TypeError(ce("00R2B",t));if(!ur(r=arguments[1]))throw new TypeError(ce("00R2C",r));if(!tr(r/_e))throw new RangeError(ce("00REA",_e,r));if(2===e){if(!tr((n=t.byteLength-r)/_e))throw new RangeError(ce("00R2E",_e,n));t=new re(t,r)}else{if(!ur(n=arguments[2]))throw new TypeError(ce("00R2F",n));if(n*_e>t.byteLength-r)throw new RangeError(ce("00R2G",n*_e));t=new re(t,r,2*n)}}return V(this,"_buffer",t),V(this,"_length",t.length/2),this}V(Se,"BYTES_PER_ELEMENT",_e),V(Se,"name","Complex64Array"),V(Se,"from",(function(r){var e,t,n,o,i,f,u,a,h,s,c,l;if(!Xr(this))throw new TypeError(ce("00R01"));if(!me(this))throw new TypeError(ce("00R02"));if((t=arguments.length)>1){if(!Xr(n=arguments[1]))throw new TypeError(ce("00R2H",n));t>2&&(e=arguments[2])}if(Te(r)){if(a=r.length,n){for(i=(o=new this(a))._buffer,l=0,c=0;c<a;c++){if(oe(s=n.call(e,r.get(c),c)))i[l]=le(s),i[l+1]=pe(s);else{if(!(cr(s)&&s.length>=2))throw new TypeError(ce("00R25",s));i[l]=s[0],i[l+1]=s[1]}l+=2}return o}return new this(r)}if(pr(r)){if(n){for(a=r.length,u=r.get&&r.set?function(r){var e=ve[r];return"function"==typeof e?e:ve.default}("default"):function(r){var e=Ee[r];return"function"==typeof e?e:Ee.default}("default"),c=0;c<a;c++)if(!oe(u(r,c))){h=!0;break}if(h){if(!ie(a))throw new RangeError(ce("00REB",2,a));for(i=(o=new this(a/2))._buffer,c=0;c<a;c++)i[c]=n.call(e,u(r,c),c);return o}for(i=(o=new this(a))._buffer,l=0,c=0;c<a;c++){if(oe(s=n.call(e,u(r,c),c)))i[l]=le(s),i[l+1]=pe(s);else{if(!(cr(s)&&s.length>=2))throw new TypeError(ce("00R25",s));i[l]=s[0],i[l+1]=s[1]}l+=2}return o}return new this(r)}if(br(r)&&Re&&Xr(r[he])){if(!Xr((i=r[he]()).next))throw new TypeError(ce("00R2J",r));if(f=n?function(r,e,t){var n,o,i,f;for(n=[],f=-1;!(o=r.next()).done;)if(f+=1,cr(i=e.call(t,o.value,f))&&i.length>=2)n.push(i[0],i[1]);else{if(!oe(i))return new TypeError(ce("00R25",i));n.push(le(i),pe(i))}return n}(i,n,e):de(i),f instanceof Error)throw f;for(i=(o=new this(a=f.length/2))._buffer,c=0;c<f.length;c++)i[c]=f[c];return o}throw new TypeError(ce("00R2J",r))})),V(Se,"of",(function(){var r,e;if(!Xr(this))throw new TypeError(ce("00R01"));if(!me(this))throw new TypeError(ce("00R02"));for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),V(Se.prototype,"at",(function(r){if(!Te(this))throw new TypeError(ce("00R02"));if(!tr(r))throw new TypeError(ce("00R8A",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return je(this._buffer,r)})),se(Se.prototype,"buffer",(function(){return this._buffer.buffer})),se(Se.prototype,"byteLength",(function(){return this._buffer.byteLength})),se(Se.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),V(Se.prototype,"BYTES_PER_ELEMENT",Se.BYTES_PER_ELEMENT),V(Se.prototype,"copyWithin",(function(r,e){if(!Te(this))throw new TypeError(ce("00R02"));return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),V(Se.prototype,"entries",(function(){var r,e,t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));return r=this,n=this._buffer,t=this._length,i=-1,V(e={},"next",(function(){if(i+=1,o||i>=t)return{done:!0};return{value:[i,je(n,i)],done:!1}})),V(e,"return",(function(r){if(o=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),he&&V(e,he,(function(){return r.entries()})),e})),V(Se.prototype,"every",(function(r,e){var t,n;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,je(t,n),n,this))return!1;return!0})),V(Se.prototype,"fill",(function(r,e,t){var n,o,i,f,u,a;if(!Te(this))throw new TypeError(ce("00R02"));if(!oe(r))throw new TypeError(ce("00RFG",r));if(n=this._buffer,o=this._length,arguments.length>1){if(!tr(e))throw new TypeError(ce("00R7f",e));if(e<0&&(e+=o)<0&&(e=0),arguments.length>2){if(!tr(t))throw new TypeError(ce("00R2z",t));t<0&&(t+=o)<0&&(t=0),t>o&&(t=o)}else t=o}else e=0,t=o;for(f=le(r),u=pe(r),a=e;a<t;a++)n[i=2*a]=f,n[i+1]=u;return this})),V(Se.prototype,"filter",(function(r,e){var t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=[],o=0;o<this._length;o++)i=je(t,o),r.call(e,i,o,this)&&n.push(i);return new this.constructor(n)})),V(Se.prototype,"find",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(o=je(t,n),r.call(e,o,n,this))return o})),V(Se.prototype,"findIndex",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(o=je(t,n),r.call(e,o,n,this))return n;return-1})),V(Se.prototype,"findLast",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(o=je(t,n),r.call(e,o,n,this))return o})),V(Se.prototype,"findLastIndex",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(o=je(t,n),r.call(e,o,n,this))return n;return-1})),V(Se.prototype,"forEach",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)o=je(t,n),r.call(e,o,n,this)})),V(Se.prototype,"get",(function(r){if(!Te(this))throw new TypeError(ce("00R02"));if(!ur(r))throw new TypeError(ce("00R2K",r));if(!(r>=this._length))return je(this._buffer,r)})),V(Se.prototype,"includes",(function(r,e){var t,n,o,i,f;if(!Te(this))throw new TypeError(ce("00R02"));if(!oe(r))throw new TypeError(ce("00RFG",r));if(arguments.length>1){if(!tr(e))throw new TypeError(ce("00R7f",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(o=le(r),i=pe(r),t=this._buffer,f=e;f<this._length;f++)if(o===t[n=2*f]&&i===t[n+1])return!0;return!1})),V(Se.prototype,"indexOf",(function(r,e){var t,n,o,i,f;if(!Te(this))throw new TypeError(ce("00R02"));if(!oe(r))throw new TypeError(ce("00RFG",r));if(arguments.length>1){if(!tr(e))throw new TypeError(ce("00R7f",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(o=le(r),i=pe(r),t=this._buffer,f=e;f<this._length;f++)if(o===t[n=2*f]&&i===t[n+1])return f;return-1})),V(Se.prototype,"join",(function(r){var e,t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(0===arguments.length)n=",";else{if(!vr(r))throw new TypeError(ce("00R3F",r));n=r}for(e=[],t=this._buffer,o=0;o<this._length;o++)e.push(je(t,o).toString());return e.join(n)})),V(Se.prototype,"keys",(function(){var r,e,t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));return r=this,t=this._length,o=-1,V(e={},"next",(function(){if(o+=1,n||o>=t)return{done:!0};return{value:o,done:!1}})),V(e,"return",(function(r){if(n=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),he&&V(e,he,(function(){return r.keys()})),e})),V(Se.prototype,"lastIndexOf",(function(r,e){var t,n,o,i,f;if(!Te(this))throw new TypeError(ce("00R02"));if(!oe(r))throw new TypeError(ce("00RFG",r));if(arguments.length>1){if(!tr(e))throw new TypeError(ce("00R7f",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(o=le(r),i=pe(r),t=this._buffer,f=e;f>=0;f--)if(o===t[n=2*f]&&i===t[n+1])return f;return-1})),se(Se.prototype,"length",(function(){return this._length})),V(Se.prototype,"map",(function(r,e){var t,n,o,i,f;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(n=this._buffer,t=(o=new this.constructor(this._length))._buffer,i=0;i<this._length;i++)if(oe(f=r.call(e,je(n,i),i,this)))t[2*i]=le(f),t[2*i+1]=pe(f);else{if(!cr(f)||2!==f.length)throw new TypeError(ce("00R25",f));t[2*i]=f[0],t[2*i+1]=f[1]}return o})),V(Se.prototype,"reduce",(function(r,e){var t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));if(t=this._buffer,o=this._length,arguments.length>1)n=e,i=0;else{if(0===o)throw new Error(ce("00RFc"));n=je(t,0),i=1}for(;i<o;i++)n=r(n,je(t,i),i,this);return n})),V(Se.prototype,"reduceRight",(function(r,e){var t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));if(t=this._buffer,o=this._length,arguments.length>1)n=e,i=o-1;else{if(0===o)throw new Error(ce("00RFc"));n=je(t,o-1),i=o-2}for(;i>=0;i--)n=r(n,je(t,i),i,this);return n})),V(Se.prototype,"reverse",(function(){var r,e,t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));for(t=this._length,r=this._buffer,n=er(t/2),o=0;o<n;o++)i=t-o-1,e=r[2*o],r[2*o]=r[2*i],r[2*i]=e,e=r[2*o+1],r[2*o+1]=r[2*i+1],r[2*i+1]=e;return this})),V(Se.prototype,"set",(function(r){var e,t,n,o,i,f,u,a,h;if(!Te(this))throw new TypeError(ce("00R02"));if(n=this._buffer,arguments.length>1){if(!ur(t=arguments[1]))throw new TypeError(ce("00R2L",t))}else t=0;if(oe(r)){if(t>=this._length)throw new RangeError(ce("00R2M",t));return n[t*=2]=le(r),void(n[t+1]=pe(r))}if(Te(r)){if(t+(f=r._length)>this._length)throw new RangeError(ce("00R03"));if(e=r._buffer,h=n.byteOffset+t*_e,e.buffer===n.buffer&&e.byteOffset<h&&e.byteOffset+e.byteLength>h){for(o=new re(e.length),a=0;a<e.length;a++)o[a]=e[a];e=o}for(t*=2,h=0,a=0;a<f;a++)n[t]=e[h],n[t+1]=e[h+1],t+=2,h+=2}else{if(!pr(r))throw new TypeError(ce("00R2N",r));for(f=r.length,a=0;a<f;a++)if(!oe(r[a])){i=!0;break}if(i){if(!ie(f))throw new RangeError(ce("00R26",f));if(t+f/2>this._length)throw new RangeError(ce("00R03"));if(e=r,h=n.byteOffset+t*_e,e.buffer===n.buffer&&e.byteOffset<h&&e.byteOffset+e.byteLength>h){for(o=new re(f),a=0;a<f;a++)o[a]=e[a];e=o}for(t*=2,f/=2,h=0,a=0;a<f;a++)n[t]=e[h],n[t+1]=e[h+1],t+=2,h+=2;return}if(t+f>this._length)throw new RangeError(ce("00R03"));for(t*=2,a=0;a<f;a++)u=r[a],n[t]=le(u),n[t+1]=pe(u),t+=2}})),V(Se.prototype,"slice",(function(r,e){var t,n,o,i,f,u,a;if(!Te(this))throw new TypeError(ce("00R02"));if(f=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!tr(r))throw new TypeError(ce("00R7e",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!tr(e))throw new TypeError(ce("00R7f",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(o=new this.constructor(t))._buffer,a=0;a<t;a++)i=2*(a+r),n[2*a]=f[i],n[2*a+1]=f[i+1];return o})),V(Se.prototype,"some",(function(r,e){var t,n;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,je(t,n),n,this))return!0;return!1})),V(Se.prototype,"sort",(function(r){var e,t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=this._length,e=[],o=0;o<n;o++)e.push(je(t,o));for(e.sort(r),o=0;o<n;o++)t[i=2*o]=le(e[o]),t[i+1]=pe(e[o]);return this})),V(Se.prototype,"subarray",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(n=this._buffer,o=this._length,0===arguments.length)r=0,e=o;else{if(!tr(r))throw new TypeError(ce("00R7e",r));if(r<0&&(r+=o)<0&&(r=0),1===arguments.length)e=o;else{if(!tr(e))throw new TypeError(ce("00R7f",e));e<0?(e+=o)<0&&(e=0):e>o&&(e=o)}}return r>=o?(o=0,t=n.byteLength):r>=e?(o=0,t=n.byteOffset+r*_e):(o=e-r,t=n.byteOffset+r*_e),new this.constructor(n.buffer,t,o<0?0:o)})),V(Se.prototype,"toLocaleString",(function(r,e){var t,n,o,i,f;if(!Te(this))throw new TypeError(ce("00R02"));if(0===arguments.length)n=[];else{if(!vr(r)&&!mr(r))throw new TypeError(ce("00RG5",r));n=r}if(arguments.length<2)t={};else{if(!br(e))throw new TypeError(ce("00R2V",e));t=e}for(i=this._buffer,o=[],f=0;f<this._length;f++)o.push(je(i,f).toLocaleString(n,t));return o.join(",")})),V(Se.prototype,"toReversed",(function(){var r,e,t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,o=0;o<t;o++)i=t-o-1,r[2*o]=n[2*i],r[2*o+1]=n[2*i+1];return e})),V(Se.prototype,"toSorted",(function(r){var e,t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!Xr(r))throw new TypeError(ce("00R3c",r));for(t=this._buffer,n=this._length,e=[],o=0;o<n;o++)e.push(je(t,o));return e.sort(r),new Se(e)})),V(Se.prototype,"toString",(function(){var r,e,t;if(!Te(this))throw new TypeError(ce("00R02"));for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(je(e,t).toString());return r.join(",")})),V(Se.prototype,"values",(function(){var r,e,t,n,o,i;if(!Te(this))throw new TypeError(ce("00R02"));return e=this,o=this._buffer,t=this._length,i=-1,V(r={},"next",(function(){if(i+=1,n||i>=t)return{done:!0};return{value:je(o,i),done:!1}})),V(r,"return",(function(r){if(n=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),he&&V(r,he,(function(){return e.values()})),r})),V(Se.prototype,"with",(function(r,e){var t,n,o;if(!Te(this))throw new TypeError(ce("00R02"));if(!tr(r))throw new TypeError(ce("00R7e",r));if(o=this._length,r<0&&(r+=o),r<0||r>=o)throw new RangeError(ce("00RFP",r));if(!oe(e))throw new TypeError(ce("00RFQ",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=le(e),t[2*r+1]=pe(e),n}));export{Se as default};
//# sourceMappingURL=mod.js.map