@shgysk8zer0/polyfills 0.3.13 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/all.min.js +2 -2
- package/all.min.js.map +1 -1
- package/array.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/all.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(){"use strict";!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?Object.defineProperty(Window.prototype,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:window}):"undefined"!=typeof global?Object.defineProperty(global,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:global}):"undefined"!=typeof self?Object.defineProperty(self,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:self}):Object.defineProperty(this,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:this}))}();const e=new WeakMap,t=/(\n|\r\n?|\u2028|\u2029)/g,r=/^\s*/,n=/\S/,o=Array.prototype.slice;function a(e,t){const r=e[t];if(void 0===r)throw new TypeError(`invalid cooked string at index ${t}`);return r}function i(t){const r=e.get(t);if(r)return r;const n=s(t);return e.set(t,n),Object.defineProperty(n,"raw",{value:Object.freeze(s(t.raw))}),Object.freeze(n),n}function s(e){const o=e.map((e=>null==e?void 0:e.split(t)));let a;for(let e=0;e<o.length;e++){const t=o[e];if(void 0===t)continue;const i=0===e,s=e+1===o.length;if(i){if(1===t.length||t[0].length>0)throw new Error("invalid content on opening line");t[1]=""}if(s){if(1===t.length||n.test(t[t.length-1]))throw new Error("invalid content on closing line");t[t.length-2]="",t[t.length-1]=""}for(let e=2;e<t.length;e+=2){const n=t[e],o=e+1===t.length&&!s,i=r.exec(n)[0];o||i.length!==n.length?a=l(i,a):t[e]=""}}const i=a?a.length:0;return o.map((e=>{if(void 0===e)return e;let t=e[0];for(let r=1;r<e.length;r+=2){t+=e[r]+e[r+1].slice(i)}return t}))}function l(e,t){if(void 0===t||e===t)return e;let r=0;for(const n=Math.min(e.length,t.length);r<n&&e[r]===t[r];r++);return e.slice(0,r)}String.dedent instanceof Function||(String.dedent=function(e){if("string"==typeof e)return s([e])[0];if("function"==typeof e)return function(){const t=o.call(arguments);return t[0]=i(t[0]),e.apply(this,t)};const t=i(e);let r=a(t,0);for(let e=1;e<t.length;e++)r+=arguments[e]+a(t,e);return r}),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce(((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce(((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e)),new Map)});const c=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach((e=>r(e,n-1))):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach(((n,o,a)=>{e.call(t,n,o,a)&&(r=n)}),t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach(((n,o,a)=>{e.call(t,n,o,a)&&(r=o)}),t),r}),!(Array.prototype.at instanceof Function)){const je=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const Ie of c)void 0!==Ie&&Object.defineProperty(Ie.prototype,"at",{value:je,writable:!0,enumerable:!1,configurable:!0})}function u(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:a=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:a})}function p(e,t,{get:r,set:n,enumerable:o=!0,configurable:a=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:r,set:n,enumerable:o,configurable:a})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every(((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)})))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){if(void 0===e)return[...new Set(this)];if("string"==typeof e){const t=[];return this.filter((r=>{const n=r[e];return!t.includes(n)&&(t.push(n),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...r)=>{try{const n=e.apply(this,r);return"string"==typeof n&&(!t.includes(n)&&(t.push(n),!0))}catch(e){return!1}}))}throw new TypeError("Not a valid argument for uniqueBy")}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,(e=>e.toString(16).padStart("0",2))).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e){const e=32768;let t="";for(let r=0;r<this.length;r+=e){const n=this.subarray(r,r+e);t+=String.fromCharCode.apply(null,n)}return btoa(t)}if("base64url"===e)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),(t=>parseInt(e.substring(t,t+2),16)))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return(new TextEncoder).encode(atob(e));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"Symbol"in globalThis){const Re=new Set(Reflect.ownKeys(Symbol).filter((e=>"symbol"==typeof Symbol[e])).map((e=>Symbol[e])));void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator")),u(Symbol,"isRegistered",(function(e){return"symbol"==typeof e&&"string"==typeof Symbol.keyFor(e)})),u(Symbol,"isWellKnown",(function(e){return Re.has(e)}))}!function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const r=this;return function(...n){if(e.has(r))return e.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(t||r,n).catch((t=>{throw e.delete(r),t}));return e.set(r,o),o}if(r instanceof Function){const o=r.apply(t||r,n);return e.set(r,o),o}}}}}(),u(URL,"parse",((e,t)=>{try{return new URL(e,t)}catch{return null}})),u(URL,"canParse",((e,t)=>{try{return new URL(e,t)instanceof URL}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,r=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:r})});const d="Iterator"in globalThis,f=d?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),h=d?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}}return Object.setPrototypeOf(t,e),t})(f);var m;h.range instanceof Function||(h.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return h.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return h.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:o=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(o){let r=e;return n>0?h.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):h.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return h.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return h.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),f[Symbol.toStringTag]||(f[Symbol.toStringTag]="Iterator"),f.take instanceof Function||(f.take=function(e){let t=0;const r=this;return h.from({next:()=>t++>=e?{done:!0}:r.next()})}),f.drop instanceof Function||(f.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),f.toArray instanceof Function||(f.toArray=function(){return Array.from(this)}),f.forEach instanceof Function||(f.forEach=function(e){for(const t of this)e.call(this,t)}),f.flatMap instanceof Function||(f.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?h.from({next:()=>({done:!0})}):h.from(e.call(t,r));let o=n(r);return h.from({next(){const{value:e,done:a=!0}=o.next();return r.done&&a?{done:!0}:a?r.done?{done:!0}:(r=t.next(),o=n(r),o.next()):{value:e,done:a}}})}),f.map instanceof Function||(f.map=function(e){const t=this;return h.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),f.reduce instanceof Function||(f.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),f.filter instanceof Function||(f.filter=function(e){const t=this;let r,n=!1;return h.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),f.some instanceof Function||(f.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),f.every instanceof Function||(f.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),f.find instanceof Function||(f.find=function(e){for(const t of this)if(e.call(this,t))return t}),f.indexed instanceof Function||(f.indexed=function(){let e=0;return this.map((t=>[e++,t]))}),f.chunks instanceof Function||(f.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return h.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),h.from instanceof Function||(h.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(f,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return h.from(e[Symbol.iterator]())}),d||(globalThis.Iterator=h),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce(((e,t)=>e+t**2),0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(m=new Float32Array(1),function(e){return m[0]=e,m[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",r=[t,"file:","wss:"],n=(e=globalThis.document)=>[...e.scripts].every((({src:r})=>{if(0===r.length)return!0;{const{protocol:n,hostname:o}=new URL(r,e.baseURI);return n===t||o===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!r.includes(location.protocol)&&!e.includes(location.hostname))&&n())}})}}();function b(e){return function(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}(e)||e instanceof Promise}
|
|
1
|
+
!function(){"use strict";!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?Object.defineProperty(Window.prototype,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:window}):"undefined"!=typeof global?Object.defineProperty(global,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:global}):"undefined"!=typeof self?Object.defineProperty(self,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:self}):Object.defineProperty(this,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:this}))}();const e=new WeakMap,t=/(\n|\r\n?|\u2028|\u2029)/g,r=/^\s*/,n=/\S/,o=Array.prototype.slice;function a(e,t){const r=e[t];if(void 0===r)throw new TypeError(`invalid cooked string at index ${t}`);return r}function i(t){const r=e.get(t);if(r)return r;const n=s(t);return e.set(t,n),Object.defineProperty(n,"raw",{value:Object.freeze(s(t.raw))}),Object.freeze(n),n}function s(e){const o=e.map((e=>null==e?void 0:e.split(t)));let a;for(let e=0;e<o.length;e++){const t=o[e];if(void 0===t)continue;const i=0===e,s=e+1===o.length;if(i){if(1===t.length||t[0].length>0)throw new Error("invalid content on opening line");t[1]=""}if(s){if(1===t.length||n.test(t[t.length-1]))throw new Error("invalid content on closing line");t[t.length-2]="",t[t.length-1]=""}for(let e=2;e<t.length;e+=2){const n=t[e],o=e+1===t.length&&!s,i=r.exec(n)[0];o||i.length!==n.length?a=l(i,a):t[e]=""}}const i=a?a.length:0;return o.map((e=>{if(void 0===e)return e;let t=e[0];for(let r=1;r<e.length;r+=2){t+=e[r]+e[r+1].slice(i)}return t}))}function l(e,t){if(void 0===t||e===t)return e;let r=0;for(const n=Math.min(e.length,t.length);r<n&&e[r]===t[r];r++);return e.slice(0,r)}String.dedent instanceof Function||(String.dedent=function(e){if("string"==typeof e)return s([e])[0];if("function"==typeof e)return function(){const t=o.call(arguments);return t[0]=i(t[0]),e.apply(this,t)};const t=i(e);let r=a(t,0);for(let e=1;e<t.length;e++)r+=arguments[e]+a(t,e);return r}),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce(((e,r,n)=>{const o=t.call(e,r,n);return e.hasOwnProperty(o)?e[o].push(r):e[o]=[r],e}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,n),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}throw new Error("Key is not found and no `insert()` given")}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce(((e,r,n)=>(e.emplace(t.call(e,r,n),{insert:()=>[r],update:e=>(e.push(r),e)}),e)),new Map)});const c=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const r=(e,n)=>{Array.isArray(e)&&n>=0?e.forEach((e=>r(e,n-1))):t.push(e)};return r(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let r;return this.forEach(((n,o,a)=>{e.call(t,n,o,a)&&(r=n)}),t),r}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let r=-1;return this.forEach(((n,o,a)=>{e.call(t,n,o,a)&&(r=o)}),t),r}),!(Array.prototype.at instanceof Function)){const je=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const Ie of c)void 0!==Ie&&Object.defineProperty(Ie.prototype,"at",{value:je,writable:!0,enumerable:!1,configurable:!0})}function u(e,t,r,{writable:n=!0,enumerable:o=!0,configurable:a=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:r,writable:n,enumerable:o,configurable:a})}function p(e,t,{get:r,set:n,enumerable:o=!0,configurable:a=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:r,set:n,enumerable:o,configurable:a})}if(!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,r=globalThis){let n=[];for await(const t of e)n.push(await t);return Array.from(n,t,r)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every(((t,r)=>{const n=e[r];return Array.isArray(t)?Array.isArray(n)&&t.equals(n):Object.is(t,n)})))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){if(void 0===e)return[...new Set(this)];if("string"==typeof e){const t=[];return this.filter((r=>{const n=r[e];return!t.includes(n)&&(t.push(n),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...r)=>{try{const n=e.apply(this,r);return"string"==typeof n&&(!t.includes(n)&&(t.push(n),!0))}catch(e){return!1}}))}throw new TypeError("Not a valid argument for uniqueBy")}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...r){const n=[...this];return n.splice(e,t,...r),n}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const r=[...this];return r[e]=t,r}),Array.isTemplateObject instanceof Function||(Array.isTemplateObject=function(e){return!!(Array.isArray(e)&&Array.isArray(e.raw)&&Object.isFrozen(e)&&Object.isFrozen(e.raw))&&(0!==e.length&&e.length===e.raw.length)}),Uint8Array.prototype.toHex instanceof Function||(Uint8Array.prototype.toHex=function(){return Array.from(this,(e=>e.toString(16).padStart("0",2))).join("")}),Uint8Array.prototype.toBase64 instanceof Function||(Uint8Array.prototype.toBase64=function({alphabet:e="base64"}={}){if("base64"===e){const e=32768;let t="";for(let r=0;r<this.length;r+=e){const n=this.subarray(r,r+e);t+=String.fromCharCode.apply(null,n)}return btoa(t)}if("base64url"===e)return this.toBase64({alphabet:"base64"}).replaceAll("+","-").replaceAll("/","_");throw new TypeError('expected alphabet to be either "base64" or "base64url')}),Uint8Array.fromHex instanceof Function||(Uint8Array.fromHex=function(e){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(0===!(1&e.length))throw new SyntaxError("string should be an even number of characters");return Uint8Array.from(globalThis.Iterator.range(0,e.length,{step:2}),(t=>parseInt(e.substring(t,t+2),16)))}),Uint8Array.fromBase64 instanceof Function||(Uint8Array.fromBase64=function(e,{alphabet:t="base64",lastChunkHandling:r="loose"}={}){if("string"!=typeof e)throw new TypeError("expected input to be a string");if(!["base64","base64url"].includes(t))throw new TypeError('expected alphabet to be either "base64" or "base64url');if(!["loose","strict","stop-before-partial"].includes(r))throw new TypeError(`Invalid \`lastChunkHandling\`: "${r}".`);if("base64"!==t)return Uint8Array.fromBase64(e.replaceAll("-","+").replaceAll("_","/"),{alphabet:"base64"});{const t=e.length%4;if(1===t)throw new TypeError("Invalid string length.");if(0===t)return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)));switch(r){case"strict":throw new SyntaxError("Missing padding.");case"loose":return Uint8Array.fromBase64(e.padEnd(e.length+(4-t),"="),{alphabet:"base64",lastChunkHandling:"strict"});case"stop-before-partial":return Uint8Array.fromBase64(e.slice(0,e.length-t),{alphabet:"base64",lastChunkHandling:"strict"})}}}),"Symbol"in globalThis){const Re=new Set(Reflect.ownKeys(Symbol).filter((e=>"symbol"==typeof Symbol[e])).map((e=>Symbol[e])));void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator")),u(Symbol,"isRegistered",(function(e){return"symbol"==typeof e&&"string"==typeof Symbol.keyFor(e)})),u(Symbol,"isWellKnown",(function(e){return Re.has(e)}))}!function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const r=this;return function(...n){if(e.has(r))return e.get(r);if("AsyncFunction"===r.constructor.name){const o=r.apply(t||r,n).catch((t=>{throw e.delete(r),t}));return e.set(r,o),o}if(r instanceof Function){const o=r.apply(t||r,n);return e.set(r,o),o}}}}}(),u(URL,"parse",((e,t)=>{try{return new URL(e,t)}catch{return null}})),u(URL,"canParse",((e,t)=>{try{return new URL(e,t)instanceof URL}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,r=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:r})});const d="Iterator"in globalThis,f=d?Object.getPrototypeOf(globalThis.Iterator):Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),h=d?globalThis.Iterator:(e=>{class t{[Symbol.iterator](){return this}}return Object.setPrototypeOf(t,e),t})(f);var m;h.range instanceof Function||(h.range=function(e,t,r){if("number"==typeof r||"bigint"==typeof r)return h.range(e,t,{step:r});if("object"!=typeof r||Object.is(r,null))return h.range(e,t,{});{const{step:n=("number"==typeof e?e<t?1:-1:e<t?1n:-1n),inclusive:o=!1}=r;if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Start must be a number");if(Number.isNaN(e))throw new RangeError("Invalid start");if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("End must be a number");if(Number.isNaN(t))throw new RangeError("Invalid end");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("Step must be a number");if(Number.isNaN(n))throw new RangeError("Invalid step");if(0===n)throw new RangeError("Step must not be 0");if(n<0&&e<t||n>0&&e>t)return;if(o){let r=e;return n>0?h.from({next(){const e=r<=t?{value:r,done:!1}:{done:!0};return r+=n,e}}):h.from({next(){const e=r>=t?{value:r,done:!1}:{done:!0};return r+=n,e}})}{let r=e;if(n>0)return h.from({next(){const e=r<t?{value:r,done:!1}:{done:!0};return r+=n,e}});{let r=e;return h.from({next(){const e=r>t?{value:r,done:!1}:{done:!0};return r+=n,e}})}}}}),f[Symbol.toStringTag]||(f[Symbol.toStringTag]="Iterator"),f.take instanceof Function||(f.take=function(e){let t=0;const r=this;return h.from({next:()=>t++>=e?{done:!0}:r.next()})}),f.drop instanceof Function||(f.drop=function(e){for(let t=0;t<e;t++){const{done:e}=this.next();if(e)break}return this}),f.toArray instanceof Function||(f.toArray=function(){return Array.from(this)}),f.forEach instanceof Function||(f.forEach=function(e){for(const t of this)e.call(this,t)}),f.flatMap instanceof Function||(f.flatMap=function(e){const t=this;let r=this.next();const n=({value:r,done:n=!0}={})=>n?h.from({next:()=>({done:!0})}):h.from(e.call(t,r));let o=n(r);return h.from({next(){const{value:e,done:a=!0}=o.next();return r.done&&a?{done:!0}:a?r.done?{done:!0}:(r=t.next(),o=n(r),o.next()):{value:e,done:a}}})}),f.map instanceof Function||(f.map=function(e){const t=this;return h.from({next(){const{done:r,value:n}=t.next();return r?{done:r}:{value:e.call(t,n),done:!1}}})}),f.reduce instanceof Function||(f.reduce=function(e,t){let r=void 0===t?this.next().value:t;for(const t of this)r=e.call(this,r,t);return r}),f.filter instanceof Function||(f.filter=function(e){const t=this;let r,n=!1;return h.from({next(){for(;!n;){const o=t.next();if(n=o.done,n)break;if(e.call(t,o.value)){r=o.value;break}}return{done:n,value:r}}})}),f.some instanceof Function||(f.some=function(e){let t=!1;for(const r of this)if(e.call(this,r)){t=!0;break}return t}),f.every instanceof Function||(f.every=function(e){let t=!0;for(const r of this)if(!e.call(this,r)){t=!1;break}return t}),f.find instanceof Function||(f.find=function(e){for(const t of this)if(e.call(this,t))return t}),f.indexed instanceof Function||(f.indexed=function(){let e=0;return this.map((t=>[e++,t]))}),f.chunks instanceof Function||(f.chunks=function(e){if(!Number.isSafeInteger(e)||e<1)throw new TypeError("Size must be a positive integer.");{const t=this;let r=!1;return h.from({next(){if(r)return{done:r};{const n=[];let o=0;for(;o++<e&&!r;){const e=t.next();if(e.done){r=!0,void 0!==e.value&&n.push(e.value);break}n.push(e.value)}return{value:n,done:!1}}}})}}),h.from instanceof Function||(h.from=function(e){if("object"!=typeof e||null===e)throw new TypeError("Not an object.");if(e.next instanceof Function){return Object.create(f,{next:{enumerable:!0,configurable:!1,writable:!1,value:(...t)=>e.next(...t)}})}if(e[Symbol.iterator]instanceof Function)return h.from(e[Symbol.iterator]())}),d||(globalThis.Iterator=h),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce(((e,t)=>e+t**2),0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(m=new Float32Array(1),function(e){return m[0]=e,m[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),Math.sumPrecise instanceof Function||(Math.sumPrecise=function(e){let t=-0;for(const r of e){if(!Number.isFinite(r)){t=-0;break}t+=r}return t}),Math.sum instanceof Function||(Math.sum=function(...e){return console.warn("Math.sum is deprecated. Please use Math.sumPrecise instead."),Math.sumPrecise(e)}),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",r=[t,"file:","wss:"],n=(e=globalThis.document)=>[...e.scripts].every((({src:r})=>{if(0===r.length)return!0;{const{protocol:n,hostname:o}=new URL(r,e.baseURI);return n===t||o===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!r.includes(location.protocol)&&!e.includes(location.hostname))&&n())}})}}();function b(e){return function(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}(e)||e instanceof Promise}
|
|
2
2
|
/**
|
|
3
3
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
4
4
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Lock
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/const w=new Map,v=Symbol("lock-key"),T="locks"in navigator&&navigator.locks.request instanceof Function;const S=async function(){return await new Promise((e=>{"locks"in navigator&&navigator.locks.request instanceof Function?navigator.locks.query().then((()=>e(!0))).catch((()=>e(!1))):e(!1)}))}();async function E(e,t=null){return new Promise(((r,n)=>{b(e)?e.call(globalThis,t).then(r,n):queueMicrotask((()=>{try{const n=e.call(globalThis,t);r(n)}catch(e){n(e)}}))}))}async function A(e){w.has(e)&&await w.get(e).promise.catch(console.error)}function M(e,t,r){const{resolve:n,reject:o,promise:a}=function(){if(Promise.withResolvers instanceof Function)return Promise.withResolvers();{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}}(),i=new AbortController,s=new g(e,t),l=function({name:e,mode:t}){switch(t){case"exclusive":return O().some((t=>t.name===e));case"shared":return O().some((t=>t.name===e&&"exclusive"===t.mode))}}(s);return w.set(s,{resolve:n,reject:o,promise:a,callback:r,pending:l,controller:i}),s}function L(e){return e instanceof g&&w.has(e)&&w.get(e).pending}function O(e){return"string"==typeof e?[...w.keys()].filter((t=>t.name===e)):[...w.keys()]}function x(e){return O(e).filter((e=>!L(e)))}function P(e){return O(e).filter((e=>L(e)))}async function F(e){switch(e.mode){case"exclusive":await Promise.allSettled(O().filter((t=>t.name===e.name&&t!==e)).map(A));break;case"shared":await Promise.allSettled(O().filter((t=>t.name===e.name&&"exclusive"===t.mode&&t!==e)).map(A))}}function k(e){if(w.has(e))return w.get(e).controller.signal}async function N(e){if(w.has(e)){const{resolve:t,reject:r,promise:n,callback:o,pending:a,controller:i}=w.get(e);return a&&function(e,t=!0){w.has(e)&&w.set(e,{...w.get(e),pending:t})}(e,!1),E(o,e).then(t,r).finally((()=>{w.delete(e),requestIdleCallback((()=>i.abort()))})),n}}class j{constructor(e){if(e!==v)throw new TypeError("Invalid constructor")}static async request(e,...t){let r,n={};t[0]instanceof Function?r=t[0]:t[1]instanceof Function&&([n,r]=t),"string"!=typeof e&&(e=e.toString());const{mode:o="exclusive",ifAvailable:a=!1,steal:i=!1,signal:s}=n;if(i&&a)throw new DOMException("LockManager.request: `steal` and `ifAvailable` cannot be used together");if(e.startsWith("-"))throw new DOMException("LockManager.request: Names starting with `-` are reserved");if(!["exclusive","shared"].includes(o))throw new TypeError(`LockManager.request: '${o}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`);if(s instanceof AbortSignal&&s.aborted)throw s.reason;if("shared"===o&&i)throw new DOMException("LockManager.request: `steal` is only supported for exclusive lock requests");const l=x(e),c=P(e),u=[...l,...c].some((t=>t.name===e));i&&u&&function(e){[...w.entries()].filter((([t])=>t.name===e)).forEach((([e,{reject:t,controller:r}])=>{requestIdleCallback((()=>{r.abort(),w.delete(e)})),t(new DOMException("The lock request is aborted"))}))}(e);const p=M(e,o,r);switch(s instanceof AbortSignal&&s.addEventListener("abort",(()=>{if(w.has(p)){const{reject:e,controller:t}=w.get(p);w.delete(p),e(new DOMException("The lock request is aborted")),t.abort()}}),{once:!0,signal:k(p)}),o){case"exclusive":if(!a||0===l.length&&0===c.length)return await F(p),await N(p);{const e=w.get(p).controller;return w.delete(p),await E(r,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}case"shared":if(a){if([...l,...c].some((e=>"exclusive"===e.mode))){const e=w.get(p).controller;return w.delete(p),await E(r,null).then((t=>(requestIdleCallback((()=>e.abort())),t)))}return await F(p),await N(p)}return await F(p),await N(p);default:throw new TypeError(`LockManager.request: '${o}' (value of 'mode' member of LockOptions) is not a valid value for enumeration LockMode.`)}}static async query(){return{held:x().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null}))),pending:P().map((({name:e,mode:t})=>({name:e,mode:t,clientId:null})))}}}function I(e,t="error"){if(e instanceof Error){const{message:r,name:n,fileName:o,lineNumber:a,columnNumber:i}=e;return new ErrorEvent(t,{error:e,message:`${n}: ${r}`,filename:o,lineno:a,colno:i})}throw new TypeError("`errorToEvent()` only accepts Errors")}let R=!1;new Promise((async e=>{if(T)if(await S)e(!1);else try{navigator.locks.request=j.request,navigator.locks.query=j.query,R=!0,e(!0)}catch(t){globalThis.dispatchEvent(I(t)),e(!1)}else try{navigator.locks=j,R=!0,e(!0)}catch(t){globalThis.dispatchEvent(I(t)),e(!1)}})),navigator.canShare instanceof Function||(navigator.canShare=function({title:e,text:t,url:r,files:n}={}){return navigator.share instanceof Function&&(!Array.isArray(n)||0===n.length)&&(!![e,t,r].every((e=>void 0===e))||[e,t,r].some((e=>"string"==typeof e&&0!==e.length)))}),navigator.setAppBadge instanceof Function||(navigator.setAppBadge=async e=>{if(!Number.isInteger(e))throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is not of type 'unsigned long long'");if(e<0)throw new TypeError("Failed to execute 'setAppBadge' on 'Navigator': Value is outside the 'unsigned long long' value range.");0===e?document.title.startsWith("(")&&(document.title=document.title.replace(/^\((\d{1,2}\+?)\)\s/,"")):e<100?(await navigator.clearAppBadge(),document.title=`(${e}) ${document.title}`):(await navigator.clearAppBadge(),document.title=`(99+) ${document.title}`)}),navigator.clearAppBadge instanceof Function||(navigator.clearAppBadge=()=>navigator.setAppBadge(0)),Navigator.prototype.hasOwnProperty("pdfViewerEnabled")||Object.defineProperty(navigator,"pdfViewerEnabled",{enumerable:!0,configurable:!1,writable:!1,value:!1}),Navigator.prototype.getInstalledRelatedApps instanceof Function||(Navigator.prototype.getInstalledRelatedApps=async()=>[]),Navigator.prototype.getGamepads instanceof Function||(Navigator.prototype.getGamepads=()=>[]),"hardwareConcurrency"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"hardwareConcurrency",{get:()=>1}),"connection"in Navigator.prototype?"type"in navigator.connection||(navigator.connection.type="unknown"):Object.defineProperty(Navigator.prototype,"connection",{get:()=>Object.create(EventTarget.prototype,{type:{value:"unknown"},effectiveType:{value:"4g"},rtt:{value:NaN},downlink:{value:NaN},downlinkMax:{value:1/0},saveData:{value:!1},onchange:{value:null,writable:!0},ontypechange:{value:null,writable:!0}})}),"doNotTrack"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"doNotTrack",{get:()=>"unspecified"}),"globalPrivacyControl"in Navigator.prototype||Object.defineProperty(Navigator.prototype,"globalPrivacyControl",{get:()=>!1}),function(){if(!(globalThis.requestIdleCallback instanceof Function)){const e=e=>Number.isSafeInteger(e)&&e>0;globalThis.requestIdleCallback=function(t,{timeout:r}={}){const n=performance.now(),o=()=>e(r)?Math.max(0,r-(performance.now()-n)):Math.max(0,600-(performance.now()-n));return setTimeout((()=>t({didTimeout:!!e(r)&&0===o(),timeRemaining:o})),1)}}globalThis.cancelIdleCallback instanceof Function||(globalThis.cancelIdleCallback=e=>clearTimeout(e)),globalThis.requestAnimationFrame instanceof Function||(globalThis.requestAnimationFrame=e=>setTimeout((()=>e(performance.now())),1e3/60)),globalThis.cancelAnimationFrame instanceof Function||(globalThis.cancelAnimationFrame=e=>clearTimeout(e)),globalThis.queueMicrotask instanceof Function||(globalThis.queueMicrotask=e=>Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e})))))}(),function(){if(!("AbortSignal"in globalThis)){const e={signal:Symbol("signal"),aborted:Symbol("aborted"),reason:Symbol("reason"),onabort:Symbol("onabort")};globalThis.AbortError=class extends Error{},globalThis.AbortSignal=class t extends EventTarget{constructor(){super(),Object.defineProperties(this,{[e.aborted]:{enumerable:!1,writable:!0,configurable:!1,value:!1},[e.reason]:{enumerable:!1,writable:!0,configurable:!1,value:void 0},[e.onabort]:{enumerable:!1,writable:!0,configurable:!1,value:null}}),this.addEventListener("abort",(e=>{this.onabort instanceof Function&&this.onabort.call(this,e)}))}get aborted(){return this[e.aborted]}get onabort(){return this[e.onabort]}set onabort(t){this[e.onabort]=t instanceof Function?t:null}get reason(){return this[e.reason]}throwIfAborted(){if(this.aborted)throw this.reason}static abort(r=new DOMException("Operation aborted")){const n=new t;return n[e.aborted]=!0,n[e.reason]=r,n}},globalThis.AbortController=class{constructor(){this[e.signal]=new AbortSignal}get signal(){return this[e.signal]}abort(t=new DOMException("Operation aborted")){const r=this.signal;r.aborted||(r[e.aborted]=!0,r[e.reason]=t,r.dispatchEvent(new Event("abort")))}}}if(!("reason"in AbortSignal.prototype)){const e=new WeakMap,t=AbortController.prototype.abort;if(AbortSignal.abort instanceof Function){const t=AbortSignal.abort;AbortSignal.abort=function(r=new DOMException("Operation aborted")){const n=t();return e.set(n,r),n}}else AbortSignal.abort=function(e=new DOMException("Operation aborted")){const t=new AbortController;return t.abort(e),t.reason};Object.defineProperty(AbortSignal.prototype,"reason",{enumerable:!0,configurable:!0,get:function(){return e.has(this)?e.get(this):void 0}}),AbortController.prototype.abort=function(r=new DOMException("Operation aborted")){e.set(this.signal,r),t.call(this)}}AbortSignal.prototype.throwIfAborted instanceof Function||(AbortSignal.prototype.throwIfAborted=function(){if(this.aborted)throw this.reason}),AbortSignal.timeout instanceof Function||(AbortSignal.timeout=function(e){if(void 0===e)throw new TypeError("At least one 1 argument required but only 0 passed");if(Number.isFinite(e)){if(e<0)throw new TypeError("Argument 1 is out of range for unsigned long long.");{const t=new AbortController;return setTimeout((()=>t.abort(new DOMException("The operation timed out."))),e),t.signal}}throw new TypeError("Argument 1 is not a finite value, so it is out of range for unsigned long long.")}),AbortSignal.any instanceof Function||(AbortSignal.any=function(e){if(!Array.isArray(e))throw new TypeError("Expected an array of signals");const t=new AbortController;for(const r of e){if(!(r instanceof AbortSignal)){const e=new TypeError("`signal` is not an `AbortSignal`");throw t.abort(e),e}if(r.aborted){t.abort(r.reason||new DOMException("Operation aborted."));break}r.addEventListener("abort",(({target:e})=>{t.abort(e.reason||new DOMException("Operation aborted."))}),{signal:t.signal})}return t.signal})}(),globalThis.hasOwnProperty("AggregateError")||(globalThis.AggregateError=class extends Error{constructor(e,t){void 0===t?(super(e),this.errors=[]):(super(t),this.errors=e)}}),globalThis.reportError instanceof Function||(globalThis.reportError=function(e){globalThis.dispatchEvent(I(e))}),function(){if("MediaQueryListEvent"in globalThis||(globalThis.MediaQueryListEvent=class extends Event{constructor(e,{media:t,matches:r}={}){super(e),Object.defineProperties(this,{media:{enumerable:!0,configurable:!1,writable:!1,value:t},matches:{enumerable:!0,configurable:!1,writable:!1,value:r}})}}),"MediaQueryList"in globalThis&&!(globalThis.MediaQueryList.prototype.addEventListener instanceof Function)){const e=new WeakMap,t=function(){const{media:e,matches:t}=this;this.dispatchEvent(new MediaQueryListEvent("change",{media:e,matches:t}))},r=function(r){return e.has(r)||(e.set(r,new EventTarget),r.addListener(t.bind(r))),e.get(r)};globalThis.MediaQueryList.prototype.addEventListener=function(e,t,n){r(this).addEventListener(e,t,n)},globalThis.MediaQueryList.prototype.removeEventListener=function(e,t,n){r(this).removeEventListener(e,t,n)},globalThis.MediaQueryList.prototype.dispatchEvent=function(e){r(this).dispatchEvent(e)}}}(),"Promise"in globalThis&&(Promise.prototype.finally instanceof Function||(Promise.prototype.finally=function(e){return this.then((async t=>(await e(),t)),(async t=>(await e(),t)))}),Promise.allSettled instanceof Function||(Promise.allSettled=function(e){return Promise.all(Array.from(e).map((function(e){return new Promise((function(t){e instanceof Promise||(e=Promise.resolve(e)),e.then((function(e){t({status:"fulfilled",value:e})})).catch((function(e){t({status:"rejected",reason:e})}))}))})))}),Promise.any instanceof Function||(Promise.any=e=>new Promise(((t,r)=>{let n=[];e.forEach((o=>{o.then(t).catch((t=>{n.push(t),n.length===e.length&&r(new globalThis.AggregateError(n,"No Promise in Promise.any was resolved"))}))}))}))),Promise.race instanceof Function||(Promise.race=e=>new Promise(((t,r)=>{e.forEach((e=>e.then(t,r)))}))),Promise.try instanceof Function||(Promise.try=e=>new Promise((t=>t(e())))),Promise.withResolvers instanceof Function||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}),Promise.fromEntries instanceof Function||(Promise.fromEntries=async function(e){const t=[],r=[];for(const[n,o]of e)t.push(n),r.push(o);return await Promise.all(r).then((e=>Object.fromEntries(e.map(((e,r)=>[t[r],e])))))}),Promise.ownProperties instanceof Function||(Promise.ownProperties=async function(e){return await Promise.fromEntries(Object.entries(e))}))
|
|
9
9
|
/**
|
|
10
10
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
11
|
-
*/;
|
|
11
|
+
*/;class H{get encoding(){return"utf-8"}encode(e){return new Uint8Array(e.split("").flatMap((e=>{const t=e.charCodeAt(0);if(t<128)return[t];return[194+Math.floor((t-128)/64),t%64+128]})))}encodeInto(e,t){if(t instanceof Uint8Array){const r=this.encode(e),n=Math.min(t.length,r.length);return r.length>t.length?t.set(r.slice(0,n)):t.set(r),{read:n,written:n}}throw new TypeError("TextEncoder.encodeInto: Argument 2 does not implement interface Uint8Array.")}}
|
|
12
12
|
/**
|
|
13
13
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
14
14
|
*/const C=["utf-8","utf8"];class D{constructor(e="utf-8",{fatal:t=!1,ignoreBOM:r=!1}={}){if(e="string"!=typeof e?e.toString().toLowerCase():e.toLowerCase(),!C.includes(e))throw new RangeError(`TextDecoder constructor: The given encoding '${e}' is not supported.`);Object.defineProperties(this,{encoding:{configurable:!1,enumerable:!0,writable:!1,value:e},fatal:{configurable:!1,enumerable:!0,writable:!1,value:t},ignoreBOM:{configurable:!1,enumerable:!0,writable:!1,value:r}})}decode(e){switch(this.encoding){case"utf-8":case"utf8":{let t=NaN;return e.reduce(((e,r,n)=>{if(Number.isNaN(t)&&r<128)return e+String.fromCharCode(r);if(Number.isNaN(t)&&r>193)return t=r,e;if(t>193&&(o=128,i=194,"number"==typeof(a=r)&&a>=o&&a<=i)){const n=64*(t-194);return t=NaN,e+String.fromCharCode(n+r)}if(this.fatal)throw new RangeError(`Unhandled character at postion ${n}`);return t=NaN,e;var o,a,i}),"")}default:throw new TypeError(`Unsupported encoding '${this.encoding}'`)}}}"TextEncoder"in globalThis||(globalThis.TextEncoder=H),"TextDecoder"in globalThis||(globalThis.TextDecoder=D),globalThis.TextEncoder.prototype.encodeInto instanceof Function||(globalThis.TextEncoder.prototype.encodeInto=function(...e){return H.prototype.encodeInto.apply(this,e)}),!(crypto in globalThis)||crypto.randomUUID instanceof Function||(crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))})
|