tiny-essentials 1.29.0 → 1.29.2
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/1/29/1.md +11 -0
- package/changelog/1/29/2.md +82 -0
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyFetchLoader.min.js +1 -0
- package/dist/v1/TinyImageLoader.min.js +1 -0
- package/dist/v1/TinyMediaCache.min.js +1 -0
- package/dist/v1/TinyMediaLoader.min.js +1 -0
- package/dist/v1/basics/index.cjs +5 -0
- package/dist/v1/basics/index.d.mts +2 -1
- package/dist/v1/basics/index.d.mts.map +1 -1
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/media/youtube.cjs +275 -0
- package/dist/v1/basics/media/youtube.d.mts +107 -0
- package/dist/v1/basics/media/youtube.d.mts.map +1 -0
- package/dist/v1/basics/media/youtube.mjs +214 -0
- package/dist/v1/index.cjs +13 -0
- package/dist/v1/index.d.mts +6 -1
- package/dist/v1/index.d.mts.map +1 -1
- package/dist/v1/index.mjs +7 -2
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +0 -1
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +0 -1
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -1
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +0 -1
- package/dist/v1/libs/fs/plugins/OPFS/index.cjs +0 -8
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +0 -8
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -1
- package/dist/v1/libs/fs/plugins/OPFS/index.mjs +0 -8
- package/dist/v1/libs/html/TinyHtml.cjs +1 -1
- package/dist/v1/libs/html/TinyHtml.d.mts +2 -2
- package/dist/v1/libs/html/TinyHtml.d.mts.map +1 -1
- package/dist/v1/libs/html/TinyHtml.mjs +1 -1
- package/dist/v1/libs/html/loader/TinyMediaLoader.cjs +1999 -0
- package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts +999 -0
- package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/TinyMediaLoader.mjs +1852 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.cjs +77 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts +103 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.mjs +67 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.cjs +630 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts +138 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.mjs +576 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.cjs +70 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts +100 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.mjs +60 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.cjs +946 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts +67 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.mjs +896 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.cjs +225 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts +149 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.mjs +197 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.cjs +1454 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts +200 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.mjs +1317 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.cjs +668 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts +83 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.mjs +626 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.cjs +277 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts +118 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.mjs +247 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.cjs +128 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts +49 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.mjs +116 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.cjs +796 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts +354 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.mjs +734 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.cjs +302 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts +256 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.mjs +280 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.cjs +194 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts +138 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.mjs +175 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +359 -55
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +64 -6
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
- package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +320 -57
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +0 -1
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +0 -1
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -1
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +0 -1
- package/dist/v1/webTemplates/bootstrap/5.3/scss/background/_background-grid.scss +15 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-contrast.scss +208 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-ghost.scss +89 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_cube-icon.scss +65 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_sphere-pulse.scss +39 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_badges.scss +90 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_bootstrap-overrides.scss +495 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_buttons.scss +390 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_colors.scss +213 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_effects.scss +153 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms-tones.scss +69 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms.scss +323 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_global.scss +31 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_links.scss +47 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tables.scss +25 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_theme.scss +21 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tokens.scss +161 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_utilities.scss +81 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_variables.scss +63 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_form-tone-mixins.scss +236 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_sizing.scss +68 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_tone-mixins.scss +392 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_typography.scss +112 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/background/_tiny_gradient_1.scss +131 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/colors/_pink.scss +47 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.cjs +2 -2
- package/docs/v1/Exports.md +33 -2
- package/docs/v1/README.md +9 -0
- package/docs/v1/basics/youtube.md +204 -0
- package/docs/v1/libs/html/loader/TinyFetchLoader.md +114 -0
- package/docs/v1/libs/html/loader/TinyImageLoader.md +141 -0
- package/docs/v1/libs/html/loader/TinyMediaCache.md +166 -0
- package/docs/v1/libs/html/loader/TinyMediaLoader.md +300 -0
- package/docs/v1/libs/tools/TinyPkgExportValidator.md +55 -0
- package/docs/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters.md +0 -4
- package/docs/v1/webTemplates/bootstrap/5.3/DeepStrap.md +177 -0
- package/package.json +281 -17
- /package/dist/v1/webTemplates/bootstrap/5.3/scss/input/{Placeholder-Colors-Fix.scss → _placeholder-colors-fix.scss} +0 -0
- /package/dist/v1/webTemplates/bootstrap/5.3/scss/spacing/{Spacing-Plus.scss → _spacing-plus.scss} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## 🧪 Tests & 🛠️ Build Fixes
|
|
2
|
+
|
|
3
|
+
### 🧪 Tests
|
|
4
|
+
|
|
5
|
+
* **New Test Files**: The `test/` folder now ships with a brand-new set of test files covering several modules.
|
|
6
|
+
* This is still a work in progress and will keep evolving over the next releases.
|
|
7
|
+
|
|
8
|
+
### 🐛 Fixes
|
|
9
|
+
|
|
10
|
+
* **Builder**: Fixed the build process so the `dist` folder no longer accidentally includes a `node_modules` folder. 🧹
|
|
11
|
+
* The published output is now clean and only contains what it is supposed to. ✅
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
## 🚀 New Features
|
|
2
|
+
|
|
3
|
+
* **YouTube Utils**: A tiny, dependency-free helper for YouTube links. 🎬
|
|
4
|
+
* **`extractYouTubeVideoId`**: Accepts a raw 11 character id or any `youtube.com`, `m.youtube.com`, `music.youtube.com`, `youtube-nocookie.com` and `youtu.be` URL (`watch`, `embed`, `shorts`, `live`, `v`) and returns the canonical video id.
|
|
5
|
+
* **`getYouTubeThumbnailUrl`**: Builds the thumbnail URL for every supported quality (`default`, `mqdefault`, `hqdefault`, `sddefault`, `maxresdefault`) without any network request.
|
|
6
|
+
* **`fetchYouTubeOEmbed`**: Fetches and validates the official oEmbed metadata, with an injectable `fetch` and `AbortSignal` support.
|
|
7
|
+
* **`assertYouTubeOEmbedResponse`**: Deeply validates an oEmbed payload and returns a brand new, fully typed object.
|
|
8
|
+
* Ships with a browser playground at `test/html/basics/youtube` and a Node.js suite (`npm run test:mjs:youtube`).
|
|
9
|
+
|
|
10
|
+
* **Media Loader Suite**: A brand-new set of libraries dedicated to loading and caching media assets. 🎞️
|
|
11
|
+
* **`TinyMediaLoader`**: The core loader for fetching media assets with progress tracking and cache support. 📦
|
|
12
|
+
* **`TinyImageLoader`**: A specialized loader for images. 🖼️
|
|
13
|
+
* **`TinyAudioLoader` (TEST)**: A specialized loader for audio files. 🔊
|
|
14
|
+
* **`TinyVideoLoader` (TEST)**: A specialized loader for video files. 🎬
|
|
15
|
+
* **`TinyMediaCache`**: A caching layer to avoid re-downloading media that was already loaded. 🗄️
|
|
16
|
+
* **`TinyMediaProgress`**: A helper for tracking and reporting loading progress. 📊
|
|
17
|
+
|
|
18
|
+
### 🧠 `TinyMediaLoader`
|
|
19
|
+
|
|
20
|
+
* **Progressive loading**: new `progressive` option (enabled by default) renders the media while the bytes are still arriving instead of waiting for the whole payload.
|
|
21
|
+
* **HTTP `HEAD` pre-flight**: the new `useHeadRequest` option fetches the response headers before the download starts, so `Content-Length`, `Content-Type` and friends are available up front. The raw objects are exposed through `response` and `headResponse`, and the new `httpHeaders` metadata field carries every captured header.
|
|
22
|
+
* **`TinyMediaMirror`**: concurrent loads of the same URL are now deduplicated. The second loader attaches to the download that is already running, replays the events emitted so far and shares the very same `Blob`. Controlled by the new `mirror` option (enabled by default) and observable through the `mirrored` getter and the `mirror` event.
|
|
23
|
+
* **Request body**: the `body` option (and `body` getter/setter) forwards a payload to the transport, which is required by endpoints that only accept `POST`, `PUT` or `PATCH`. It is ignored by `GET`/`HEAD`, and `_requestInit.body` still wins when both are set.
|
|
24
|
+
* **Cache probes**: `isCached(src?)`, `peekCache(src?)` and the `cached` getter inspect the shared cache without acquiring a reference or touching the `hits`/`misses` counters, and the `pending` getter reports whether a mirrored download for the current source is already in flight. `TinyMediaCache` gained the matching read-only `peek(url)` method.
|
|
25
|
+
* **Chunk level events**: the new `chunk` event streams every downloaded `Uint8Array` together with the `loaded`/`total` counters.
|
|
26
|
+
* **Typed events**: the whole event surface is now described by the `MediaLoaderEvents` typedef and consumed through `ICustomEventEmitter`, so `on`/`once`/`emit` are fully typed.
|
|
27
|
+
* **Pluggable transport**: `_fetch` and `_requestInit` are now overridable, which allows subclasses to inject a custom `fetch` implementation, headers, credentials or a request body.
|
|
28
|
+
* **Richer metadata**: `animation` now carries the full `AnimationProbeData` and `httpHeaders` exposes the response headers.
|
|
29
|
+
* **Hardened validation**: every constructor option is validated and throws a descriptive `TypeError`/`RangeError` instead of failing later.
|
|
30
|
+
|
|
31
|
+
### 🖼️ `TinyImageLoader`
|
|
32
|
+
|
|
33
|
+
* **Full animation control** with four modes: `none`, `native`, `script-only` and `controlled`.
|
|
34
|
+
* **Frame extraction** for `GIF`, `APNG`, `WebP` and `AVIF`, with the individual frames stored in a dedicated `TinyMediaCache`.
|
|
35
|
+
* **Playback API**: `play()`, `pause()`, `freeze(frameIndex)`, `unfreeze()` and the `playbackRate` setter.
|
|
36
|
+
* **`animationScript`** getter/setter to inspect and rewrite the per-frame delays.
|
|
37
|
+
|
|
38
|
+
### 📥 `TinyFetchLoader`
|
|
39
|
+
|
|
40
|
+
* **New generic loader** for arbitrary files, built on top of `TinyMediaLoader`.
|
|
41
|
+
* Supports `blob`, `arraybuffer`, `text` and `json` response types through the `responseType` option.
|
|
42
|
+
* `clone()` creates an independent loader that reuses the shared cache and the custom `fetch` by reference.
|
|
43
|
+
* `exportFetch()` returns a `fetch`-compatible function backed by the loader, which makes it a drop-in replacement for `globalThis.fetch`.
|
|
44
|
+
|
|
45
|
+
### 🗄️ `TinyMediaCache`
|
|
46
|
+
|
|
47
|
+
* **`maxBytes`**: new byte budget, enforced together with `maxItems`.
|
|
48
|
+
* **Parent/child links**: `set()` accepts a `parent` key, `children(url)` lists the owned keys and the `links` getter reports how many entries own at least one child. Deleting the last child now removes the parent as well.
|
|
49
|
+
* **Stricter validation**: `set()` validates `pinned`, `metadata` and `parent`, and `entries()` returns a defensive copy of the metadata.
|
|
50
|
+
* **New `links` counter** in `stats`.
|
|
51
|
+
|
|
52
|
+
### 🧪 `TinyBufferReader` / `TinyIsoBox`
|
|
53
|
+
|
|
54
|
+
* Every read is now bounds-checked and documented, and `has()`, `skip()` and `#require()` reject non-integer or negative counts.
|
|
55
|
+
* `TinyIsoBox` gained complete JSDoc for the box traversal helpers.
|
|
56
|
+
|
|
57
|
+
## 🛠️ Improvements & Refactors
|
|
58
|
+
|
|
59
|
+
* **`TinyPkgExportValidator`** was rewritten to follow the official Node.js `package.json` documentation:
|
|
60
|
+
* Full support for **wildcard targets** (`./css/*.css`), validated against the file system.
|
|
61
|
+
* `null` targets are now accepted and reported as excluded subpaths.
|
|
62
|
+
* Arrays (fallback lists) are traversed, and empty arrays/objects are reported as invalid.
|
|
63
|
+
* New validations for subpath keys, condition keys, path traversal (`..`), URL schemes and invalid characters.
|
|
64
|
+
* New message templates: `itemSkipped`, `itemPattern` and `itemInvalidTarget`.
|
|
65
|
+
* `validate()` now returns `false` (instead of `true`) when `package.json` was never loaded.
|
|
66
|
+
|
|
67
|
+
## 🎨 DeepStrap (Bootstrap 5.3 theme)
|
|
68
|
+
|
|
69
|
+
* **New `deepstrap` theme** with a token based architecture: colors, spacing, typography, effects and utilities are all driven by overridable Sass maps and CSS custom properties.
|
|
70
|
+
* **New components**: ghost buttons, contrast buttons, cube icon and sphere pulse indicator.
|
|
71
|
+
* **New background grid** helper (`_background-grid.scss`).
|
|
72
|
+
* **New Bootstrap 5.3 playground** with a live matrix of every component, section filter and theme switcher.
|
|
73
|
+
* **File renames** (breaking for direct imports):
|
|
74
|
+
* `Placeholder-Colors-Fix.scss` → `input/_placeholder-colors-fix.scss`
|
|
75
|
+
* `Spacing-Plus.scss` → `spacing/_spacing-plus.scss`
|
|
76
|
+
|
|
77
|
+
## 🐛 Fixes
|
|
78
|
+
|
|
79
|
+
* **`TinyHtml.toggleClass`**: the `force` parameter is now correctly documented as optional.
|
|
80
|
+
* **`TinyFS`**: removed the invalid `@override` annotations from the OPFS and Storage Bucket backends.
|
|
81
|
+
* **`TinyWebWorkerEngine`**: removed the invalid `@override` annotation from `emit`.
|
|
82
|
+
* **`package.json`**: every entry point now ships a `"types"` condition, so TypeScript resolves the declarations without `moduleResolution` workarounds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";const e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};function r(e){if(!Array.isArray(e))throw new TypeError("Argument 'items' must be an array.");let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function n(e,t){if(!Array.isArray(e))throw new TypeError("Argument 'phases' must be an array.");if(!Array.isArray(t))throw new TypeError("Argument 'counts' must be an array.");if(e.length!==t.length)throw new RangeError("The 'phases' and 'counts' arrays must have the same length.");const r=[];for(let n=0;n<e.length;n++){if("number"!=typeof t[n]||Number.isNaN(t[n]))throw new TypeError(`Element at counts[${n}] must be a valid number.`);for(let o=0;o<t[n];o++)r.push(e[n])}return r}function o(e,t){if(!Array.isArray(e))throw new TypeError("Argument 'oldItems' must be an array.");if(!Array.isArray(t))throw new TypeError("Argument 'newItems' must be an array.");const r=e.filter(e=>!t.includes(e));return{added:t.filter(t=>!e.includes(t)),removed:r}}function a(e,t=!1){if(null!=e&&"string"!=typeof e)throw new TypeError("Argument 'item' must be a string or null.");if("boolean"!=typeof t)throw new TypeError("Argument 'isReverse' must be a boolean.");return t?function(t,r){return(e?t[e]:t)>(e?r[e]:r)?-1:(e?t[e]:t)<(e?r[e]:r)?1:0}:function(t,r){return(e?t[e]:t)<(e?r[e]:r)?-1:(e?t[e]:t)>(e?r[e]:r)?1:0}}function i(){const e=new Intl.DateTimeFormat(void 0,{hour:"numeric"}).resolvedOptions().hourCycle;return e?.startsWith("h12")?12:24}function s(e=new Date,t="asSeconds",r=null){if(!(e instanceof Date))throw new TypeError("The 'timeData' argument must be an instance of Date.");if("string"!=typeof t)throw new TypeError("The 'durationType' argument must be a string.");const n=["asMilliseconds","asSeconds","asMinutes","asHours","asDays"];if(!n.includes(t))throw new RangeError(`The 'durationType' must be one of: ${n.join(", ")}.`);if(null!==r&&!(r instanceof Date))throw new TypeError("The 'now' argument must be an instance of Date or null.");const o=r instanceof Date?r:new Date,a=e.getTime()-o.getTime();switch(t){case"asMilliseconds":return a;case"asSeconds":default:return a/1e3;case"asMinutes":return a/6e4;case"asHours":return a/36e5;case"asDays":return a/864e5}}function l(e,t="seconds",r="{time}"){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'totalSeconds' argument must be a valid number.");if("string"!=typeof t)throw new TypeError("The 'level' argument must be a string.");const n=["seconds","minutes","hours","days","months","years"];if(!n.includes(t))throw new RangeError(`The 'level' must be one of: ${n.join(", ")}.`);if("string"!=typeof r)throw new TypeError("The 'format' argument must be a string.");e=Math.max(0,Math.floor(e));const o=n.indexOf(t),a=o>=5,i=o>=4,s=o>=3,l=o>=2,u=o>=1,f=o>=0,c={years:a?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:l?0:NaN,minutes:u?0:NaN,seconds:f?0:NaN,total:NaN};let d=e;if(a||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*d),r=new Date(e);if(a)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),c.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),c.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;d=Math.floor((t.getTime()-r.getTime())/1e3)}l&&(c.hours=Math.floor(d/3600),d%=3600),u&&(c.minutes=Math.floor(d/60),d%=60),f&&(c.seconds=d),c.total=+e.toFixed(2).replace(/\.00$/,"");const m=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},p=[l?m(c.hours):null,u?m(c.minutes):null,f?m(c.seconds):null].filter(e=>null!==e).join(":");return r.replace(/\{years\}/g,String(c.years)).replace(/\{months\}/g,String(c.months)).replace(/\{days\}/g,String(c.days)).replace(/\{hours\}/g,m(c.hours)).replace(/\{minutes\}/g,m(c.minutes)).replace(/\{seconds\}/g,m(c.seconds)).replace(/\{time\}/g,p).replace(/\{total\}/g,String(c.total)).trim()}function u(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'seconds' argument must be a valid number.");return l(e,"hours","{hours}:{minutes}:{seconds}")}function f(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'seconds' argument must be a valid number.");return l(e,"days","{days}d {hours}:{minutes}:{seconds}")}function c(e,t="milliseconds"){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'totalMs' argument must be a valid number.");if("string"!=typeof t)throw new TypeError("The 'level' argument must be a string.");const r=["milliseconds","seconds","minutes","hours","days","months","years"];if(!r.includes(t))throw new RangeError(`The 'level' must be one of: ${r.join(", ")}.`);e=Math.max(0,Math.floor(e));const n=r.indexOf(t),o=n>=6,a=n>=5,i=n>=4,s=n>=3,l=n>=2,u=n>=1,f=n>=0,c={years:o?0:NaN,months:a?0:NaN,days:i?0:NaN,hours:s?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,milliseconds:f?0:NaN,total:NaN};let d=e;if(o||a||i){const e=new Date(1980,0,1),t=new Date(e.getTime()+d),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),c.years++;if(a)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),c.months++;if(i)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;d=t.getTime()-r.getTime()}return s&&(c.hours=Math.floor(d/36e5),d%=36e5),l&&(c.minutes=Math.floor(d/6e4),d%=6e4),u&&(c.seconds=Math.floor(d/1e3),d%=1e3),f&&(c.milliseconds=d),c.total=+e,c}function d(e){if(!Array.isArray(e)&&!m(e))throw new TypeError("Argument must be either an Array or a pure JSON Object.");return Array.isArray(e)?e.length:Object.keys(e).length}function m(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}function p(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}e.r(t),e.d(t,{addAiMarkerShortcut:()=>te,areElsCollBottom:()=>ie,areElsCollLeft:()=>se,areElsCollPerfBottom:()=>fe,areElsCollPerfLeft:()=>ce,areElsCollPerfRight:()=>de,areElsCollPerfTop:()=>ue,areElsCollRight:()=>le,areElsCollTop:()=>ae,areElsColliding:()=>me,areElsPerfColliding:()=>pe,arraySortPositions:()=>a,asyncReplace:()=>Z,breakdownDuration:()=>c,browserIs:()=>Ze,calculateMarketcap:()=>G,cloneObjTypeOrder:()=>S,compareMarketcap:()=>K,countObj:()=>d,createSingletonTask:()=>Ye,diffArrayList:()=>o,diffObjList:()=>ne,documentIsFullScreen:()=>P,exitFullScreen:()=>U,extendObjType:()=>k,extractMediaId3Tags:()=>Ue,fetchJson:()=>I,fetchText:()=>x,formatBytes:()=>W,formatCustomTimer:()=>l,formatDayTimer:()=>f,formatTimer:()=>u,genFibonacciSeq:()=>X,getAge:()=>J,getBrowserCssPrefix:()=>Xe,getBrowserPings:()=>Ke,getDuckTyping:()=>Ge,getElsCollDetails:()=>Te,getElsCollDirDepth:()=>Ee,getElsCollOverlap:()=>ge,getElsCollOverlapPos:()=>be,getElsColliding:()=>ye,getElsPerfColliding:()=>we,getElsRelativeCenterOffset:()=>ve,getObjTypeOrder:()=>C,getObjTypeRegistry:()=>L,getPercentage:()=>z,getRectCenter:()=>he,getSimplePerc:()=>V,getTimeDuration:()=>s,getUserTimeFormat:()=>i,hashText:()=>oe,installWindowHiddenScript:()=>A,isAnyClassInstance:()=>g,isBrowser:()=>qe,isBrowserAgent:()=>We,isClass:()=>y,isClassInstance:()=>w,isFullScreenMode:()=>B,isJsonObject:()=>m,isObjType:()=>D,isScreenFilled:()=>R,isValidObj:()=>p,jsonFilter:()=>Ie,jsonFilterByKeys:()=>Ae,jsonFilterRecursive:()=>xe,multiplyArrayBlocks:()=>n,objType:()=>F,objTypeName:()=>O,offFullScreenChange:()=>Y,onFullScreenChange:()=>H,parseMediaMetadata:()=>_e,readBase64Blob:()=>h,readFileBlob:()=>b,readJsonBlob:()=>v,reorderObjTypeOrder:()=>M,requestFullScreen:()=>$,ruleOfThree:()=>q,safeTextTrim:()=>re,saveJsonFile:()=>E,shuffleArray:()=>r,toTitleCase:()=>Q,toTitleCaseLowerFirst:()=>ee,valFetchMediaContent:()=>Be,valMediaContentMetadata:()=>$e,waitForTrue:()=>He});const y=e=>{if("function"!=typeof e)throw new TypeError("The 'target' argument must be a function. Received: "+typeof e);try{return e(),!1}catch(e){return e instanceof TypeError&&e.message.includes("Class constructor")}};function w(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!1;if("function"!=typeof e.constructor)return!1;const r=e.constructor.toString();return/^\s*class\b/.test(r)}function g(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null!==t&&t!==Object.prototype&&"function"==typeof e.constructor}function b(e,t){if(!(e instanceof Blob))return Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'));const r=["readAsArrayBuffer","readAsDataURL","readAsText","readAsBinaryString"];return"string"==typeof t&&r.includes(t)?new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(e){n(e)}},o.onerror=()=>{n(o.error)},o[t](e)}):Promise.reject(new TypeError(`The "method" argument must be one of: ${r.join(", ")}.`))}function h(e,t=!1){return e instanceof Blob?"string"!=typeof t&&"boolean"!=typeof t?Promise.reject(new TypeError("The isDataUrl parameter must be a boolean or a string.")):new Promise((r,n)=>{b(e,"readAsDataURL").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const n=e.match(/^data:(.+);base64,(.*)$/);if(!n||!n[2])throw new Error("Invalid data URL format or missing Base64 content.");const[,o,a]=n;if(!/^[\w/+]+=*$/.test(a))throw new Error("Base64 content is malformed.");if("boolean"==typeof t)return r(t?e:a);if(!/^[\w-]+\/[\w.+-]+$/.test(t))throw new Error(`Invalid MIME type string: ${t}`);return r(`data:${t};base64,${a}`)}).catch(n)}):Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'))}function v(e){return e instanceof Blob?new Promise((t,r)=>b(e,"readAsText").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const r=e.trim();if(0===r.length)throw new Error("File is empty or contains only whitespace.");const n=JSON.parse(r);if("object"!=typeof n||null===n)throw new Error("Parsed content is not a valid JSON object or array.");t(n)}).catch(r)):Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'))}function E(e,t,r=2){if("string"!=typeof e)throw new TypeError('The "filename" argument must be a string.');if("number"!=typeof r||!Number.isInteger(r)||r<0)throw new TypeError('The "spaces" argument must be a non-negative integer.');const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),a=URL.createObjectURL(o),i=document.createElement("a");i.href=a,i.download=e,i.click(),URL.revokeObjectURL(a)}function T(e,t,r=e=>({headers:e.headers,status:e.status,statusText:e.statusText})){if(!(e instanceof Response))throw new TypeError('The "response" argument must be an instance of Response.');if("function"!=typeof t)throw new TypeError('The "onProgress" argument must be a function.');if(!e.body)return e;const n=e.headers.get("content-length"),o=n?parseInt(n,10):0;let a=0;const i=e.body.getReader(),s=new ReadableStream({async start(e){for(;;){const{done:r,value:n}=await i.read();if(r)break;a+=n.byteLength,t(a,o),e.enqueue(n)}e.close()}});return new Response(s,r(e))}async function I(e,t,r){return"string"!=typeof e?Promise.reject(new TypeError('The "url" argument must be a string.')):void 0!==t&&"object"!=typeof t?Promise.reject(new TypeError('The "options" argument must be an object.')):void 0!==r&&"function"!=typeof r?Promise.reject(new TypeError('The "onProgress" option must be a function.')):new Promise((n,o)=>{fetch(e,t??void 0).then(async e=>{const t=r?T(e,r):e,o=t.headers.get("content-type")||"";if(!o.includes("application/json"))throw new Error(`Unexpected content-type: ${o}`);const a=await t.json();if(!Array.isArray(a)&&!m(a))throw new Error("Received invalid data instead of valid JSON.");return n(a)}).catch(o)})}async function x(e,t,r,n){return"string"!=typeof e?Promise.reject(new TypeError('The "url" argument must be a string.')):void 0===t||Array.isArray(t)?void 0!==r&&"object"!=typeof r?Promise.reject(new TypeError('The "options" argument must be an object.')):void 0!==n&&"function"!=typeof n?Promise.reject(new TypeError('The "onProgress" option must be a function.')):new Promise((o,a)=>{fetch(e,r??void 0).then(async e=>{const r=n?T(e,n):e,a=r.headers.get("content-type")||"";if(Array.isArray(t)&&t.length>0&&!t.some(e=>a.includes(e)))throw new Error(`Blocked MIME type: ${a}`);const i=await r.text();return o(i)}).catch(a)}):Promise.reject(new TypeError('The "allowedMimeTypes" argument must be an array of strings.'))}function A(e={}){if(null===e||"object"!=typeof e)throw new TypeError('The "settings" argument must be an object.');const{element:t=document.body,hiddenClass:r="windowHidden",visibleClass:n="windowVisible",onVisible:o,onHidden:a}=e;if(!(t instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof r)throw new TypeError('"hiddenClass" must be a string.');if("string"!=typeof n)throw new TypeError('"visibleClass" must be a string.');if(void 0!==o&&"function"!=typeof o)throw new TypeError('"onVisible" must be a function if provided.');if(void 0!==a&&"function"!=typeof a)throw new TypeError('"onHidden" must be a function if provided.');let i="",s="";const l=()=>{t.classList.remove(r),t.classList.remove(n)};let u=null;const f=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],c=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<c.length;e++)if(c[e]in document){u=c[e];break}const d=function(e){l();const f=e?.type,c=u&&document[u];["focus","focusin","pageshow"].includes(f)?(t.classList.add(n),o?.({type:f,oldClass:s,oldType:i}),s=n):["blur","focusout","pagehide"].includes(f)||c?(t.classList.add(r),a?.({type:f,oldClass:s,oldType:i}),s=r):(t.classList.add(n),o?.({type:f,oldClass:s,oldType:i}),s=n),i=f};let m=()=>{};if(u){const e=f[c.indexOf(u)];document.addEventListener(e,d),window.addEventListener("focus",d),window.addEventListener("blur",d),m=()=>{document.removeEventListener(e,d),window.removeEventListener("focus",d),window.removeEventListener("blur",d),l()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=d,m=()=>{document.onfocusin=document.onfocusout=null,l()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=d,m=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,l()});const p=new Event(u&&document[u]?"blur":"focus");return d(p),m}const N="undefined"!=typeof window&&void 0!==window.document,j={items:{},order:[]};function k(e,t){if("object"!=typeof e||null===e)throw new TypeError("Argument 'ni' must be an object or an array.");if(void 0!==t&&"number"!=typeof t)throw new TypeError("Argument 'index' must be a number.");const r=[];let n;n=Array.isArray(e)?e.length>0&&Array.isArray(e[0])?e:e.length>0?[e]:[]:Object.entries(e);for(const e of n){if(!Array.isArray(e)||e.length<2)throw new TypeError("Each item in the input must be a [key, function] pair.");const[n,o,a]=e;if(void 0!==a&&"function"!=typeof a)throw new TypeError(`Cloner for key '${n}' must be a function.`);const i="function"==typeof a?a:e=>e;if("string"!=typeof n)throw new TypeError("Validator key must be a string.");if("function"!=typeof o)throw new TypeError(`Validator for key '${n}' must be a function.`);if(!j.items.hasOwnProperty(n)){j.items[n]={validator:o,cloner:i};let e="number"==typeof t?t:-1;if(-1===e){const t=j.order.indexOf("object");e=t>-1?t:j.order.length}e=Math.min(Math.max(0,e),j.order.length),j.order.splice(e,0,n),r.push(n)}}return r}function M(e){if(!Array.isArray(e))throw new TypeError("Argument 'newOrder' must be an array of strings.");if(!e.every(e=>"string"==typeof e))throw new TypeError("All elements in 'newOrder' must be strings.");const t=[...j.order];return!!e.every(e=>t.includes(e))&&(j.order=e.slice(),!0)}function S(){return[...j.order]}const O=e=>{if(null===e)return"null";for(const t of j.order)if("function"!=typeof j.items[t].validator||j.items[t].validator(e))return t;return"unknown"};function D(e,t){if("string"!=typeof t)throw new TypeError("Argument 'type' must be a string.");return O(e)===t.toLowerCase()}function F(e,t){if(void 0===e)return null;if(void 0!==t&&"string"!=typeof t)throw new TypeError("Argument 'type' must be a string.");const r=O(e);return"string"==typeof t?r===t.toLowerCase():r}function L(){return Object.fromEntries(Object.entries(j.items).map(([e,t])=>[e,{...t}]))}const C=()=>[...j.order];k([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["nannumber",e=>"number"==typeof e&&Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e]]),k(["array",e=>Array.isArray(e),(e,t,r)=>e.map(e=>t?r.clone(e,t):e)]),N&&k(["file",e=>"undefined"!=typeof File&&e instanceof File,e=>new File([e],e.name,{type:e.type,lastModified:e.lastModified})]),k(["date",e=>e instanceof Date,e=>new Date(e.getTime())]),k(["regexp",e=>e instanceof RegExp,e=>new RegExp(e.source,e.flags)]),k(["map",e=>e instanceof Map,(e,t,r)=>{const n=new Map;for(const[o,a]of e.entries())n.set(o,t?r.clone(a,t):a);return n}]),k(["set",e=>e instanceof Set,(e,t,r)=>{const n=new Set;for(const o of e)n.add(t?r.clone(o,t):o);return n}]),k([["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),k(["url",e=>e instanceof URL,e=>new URL(e.href)]),N&&k(["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement,e=>e.cloneNode(!0)]),k(["object",e=>m(e),(e,t,r)=>{const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t?r.clone(e[o],t):e[o]);return n}]);const P=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),R=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,B=()=>P()||R(),$=e=>new Promise(async(t,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(e):n.mozRequestFullScreen?n.mozRequestFullScreen(e):n.webkitRequestFullScreen?n.webkitRequestFullScreen(e):n.msRequestFullscreen&&n.msRequestFullscreen(e),t()}catch(e){r(e)}}),U=()=>new Promise((e,t)=>{if(document.exitFullscreen)document.exitFullscreen().then(e).catch(t);else try{if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Fullscreen API is not supported");document.msExitFullscreen()}e()}catch(e){t(e)}}),_=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],H=(e,t)=>{_.forEach(r=>{document.addEventListener(r,e,t)})},Y=(e,t)=>{_.forEach(r=>{document.removeEventListener(r,e,t)})};function q(e,t,r,n=!1){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("val1 must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("val2 must be a finite number.");if("number"!=typeof r||!Number.isFinite(r))throw new TypeError("val3 must be a finite number.");if("boolean"!=typeof n)throw new TypeError("inverse must be a boolean.");return n?Number(e*t)/r:Number(r*t)/e}function V(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("price must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("percentage must be a finite number.");return e*(t/100)}function z(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("part must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("total must be a finite number.");return 0===t?0:e/t*100}function J(e=0,t=null){if("number"!=typeof e&&"string"!=typeof e&&!(e instanceof Date))throw new TypeError("timeData must be a number, string, or Date object.");if(null!==t&&!(t instanceof Date))throw new TypeError("now must be a Date object or null.");const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const a=n.getMonth(),i=r.getMonth(),s=n.getDate(),l=r.getDate();return(a<i||a===i&&s<l)&&o--,Math.abs(o)}function W(e,t=null,r=null){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new TypeError("bytes must be a positive number.");if(0===e)return{unit:"Bytes",value:0};if(null!==t&&("number"!=typeof t||!Number.isFinite(t)))throw new TypeError("decimals must be a number or null.");const n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];if(null!==r){if("string"!=typeof r)throw new TypeError("maxUnit must be a string or null.");if(!n.includes(r))throw new RangeError(`maxUnit must be one of: ${n.join(", ")}`)}const o=r&&n.includes(r)?n.indexOf(r):n.length-1,a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),o);let i=e/Math.pow(1024,a);if(null!==t){const e=t<0?0:t;i=parseFloat(i.toFixed(e))}return{unit:n[a],value:i}}function X({baseValues:e=[0,1],length:t=10,combiner:r=(e,t)=>e+t}={}){if(!Array.isArray(e)||2!==e.length||!e.every(e=>"number"==typeof e))throw new Error("baseValues must be an array of exactly two numbers.");if("number"!=typeof t||!Number.isInteger(t))throw new RangeError("length must be an integer.");if("function"!=typeof r)throw new TypeError("combiner must be a function.");const n=[...e.slice(0,2)];for(let e=2;e<t;e++){const t=r(n[e-2],n[e-1],e);n.push(t)}return n}function G(e,t){if("number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Original market cap must be a finite number.");if("number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t))throw new TypeError("Circulating supply must be a finite number.");if(t<=0)throw new RangeError("Circulating supply must be greater than zero.");return e/t}function K(e,t,r){if("number"!=typeof r||Number.isNaN(r)||!Number.isFinite(r))throw new TypeError("New market cap must be a finite number.");const n=G(e,t),o="number"==typeof r?r/t:NaN;return{originalPrice:n,newPrice:o,priceChangePercent:"number"==typeof r?(o-n)/n*100:NaN}}async function Z(e,t,r){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);if(!(t instanceof RegExp))throw new TypeError("Expected a RegExp for 'regex', but received "+typeof t);if("function"!=typeof r)throw new TypeError("Expected a function for 'asyncFn', but received "+typeof r);const n=[];e.replace(t,(e,...t)=>(n.push(r(e,...t)),e));const o=await Promise.all(n);return e.replace(t,()=>o.shift())}function Q(e){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function ee(e){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);const t=e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase());return t.charAt(0).toLowerCase()+t.slice(1)}function te({key:e="a",className:t="detect-made-by-ai"}={}){if("undefined"==typeof HTMLElement)throw new Error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.");if("string"!=typeof e)throw new TypeError("Expected a string for 'config.key', but received "+typeof e);if("string"!=typeof t)throw new TypeError("Expected a string for 'config.className', but received "+typeof t);const r=function(r){if(r.ctrlKey&&r.altKey&&r.key.toLowerCase()===e){if(r.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle(t)}};return document.addEventListener("keydown",r),r}function re(e,t,r=.6){if("string"!=typeof e)throw new TypeError("Expected a string for 'text', but received "+typeof e);if(!Number.isInteger(t)||t<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${t}`);if("number"!=typeof r||r<0||r>1)throw new TypeError(`Expected 'safeCutZone' to be a number between 0 and 1, but received ${r}`);let n=e.trim();if(n.length>t){const e=n.lastIndexOf(" ",t);return e>0&&e>=t*r?`${n.substring(0,e).trim()}...`:`${n.substring(0,t).trim()}...`}return n}function ne(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError("Expected an object for 'oldStrings', but received "+(null===e?"null":typeof e));if("object"!=typeof t||null===t||Array.isArray(t))throw new TypeError("Expected an object for 'newStrings', but received "+(null===t?"null":typeof t));const r={added:{},removed:{},modified:{}};for(const n in e)n in t?e[n]!==t[n]&&(r.modified[n]={old:e[n],new:t[n]}):r.removed[n]=e[n];for(const n in t)n in e||(r.added[n]=t[n]);return r}async function oe(e,t){if("string"!=typeof e)throw new TypeError('The "text" parameter must be a string.');const r=(new TextEncoder).encode(e),n=await crypto.subtle.digest(t,r);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}const ae=(e,t)=>e.bottom<t.top,ie=(e,t)=>e.top>t.bottom,se=(e,t)=>e.right<t.left,le=(e,t)=>e.left>t.right,ue=(e,t)=>e.bottom<=t.top,fe=(e,t)=>e.top>=t.bottom,ce=(e,t)=>e.right<=t.left,de=(e,t)=>e.left>=t.right,me=(e,t)=>!(se(e,t)||le(e,t)||ae(e,t)||ie(e,t)),pe=(e,t)=>!(ce(e,t)||de(e,t)||ue(e,t)||fe(e,t)),ye=(e,t)=>se(e,t)?"left":le(e,t)?"right":ae(e,t)?"top":ie(e,t)?"bottom":null,we=(e,t)=>ce(e,t)?"left":de(e,t)?"right":ue(e,t)?"top":fe(e,t)?"bottom":null,ge=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),be=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),he=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function ve(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function Ee(e,t){if(!pe(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:a}=ge(e,t),{dirX:i,dirY:s}=be({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:a}),l=Math.min(r,n),u=Math.min(o,a);let f;return f=l<u?i:s,{inDir:f,dirX:i,dirY:s,depthX:l,depthY:u}}function Te(e,t){const r=pe(e,t),n={in:null,x:null,y:null},o={y:null,x:null},a={top:0,bottom:0,left:0,right:0},{overlapLeft:i,overlapRight:s,overlapTop:l,overlapBottom:u}=ge(t,e);a.top=l,a.bottom=u,a.left=i,a.right=s;const f=Object.entries(a).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:c,dirY:d}=be({overlapLeft:s,overlapRight:i,overlapTop:u,overlapBottom:l});return n.y=d,n.x=c,a.bottom<0?o.y="bottom":a.top<0&&(o.y="top"),a.left<0?o.x="left":a.right<0&&(o.x="right"),n.in=r?a.top===a.bottom&&a.bottom===a.left&&a.left===a.right?"center":f.length?f[0][0]:"top":null,{dirs:n,depth:a,isNeg:o}}function Ie(e,t){if(!p(e))throw new TypeError("The first argument must be a non-null object.");if("function"!=typeof t)throw new TypeError("The second argument must be a function.");const r=Object.entries(e).filter(t);return Object.fromEntries(r)}function xe(e,t){if(void 0!==t.obj&&"function"!=typeof t.obj)throw new TypeError("filter.obj must be a function if provided.");if(void 0!==t.value&&"function"!=typeof t.value)throw new TypeError("filter.value must be a function if provided.");if(void 0!==t.array&&"function"!=typeof t.array)throw new TypeError("filter.array must be a function if provided.");let r;r=e instanceof Map?new Map:e instanceof Set?new Set:{};const n=(o=e)instanceof Map?Array.from(o.entries()):o instanceof Set?Array.from(o.values()).map(e=>[void 0,e]):Object.entries(o);var o;const a=(e,r)=>{const n=[];for(let o=0;o<e.length;o++){const i=e[o];if(Array.isArray(i))n.push(a(i,r));else if(p(i)){const r=xe(i,t);(void 0===t.obj||t.obj(r,o,e))&&n.push(r)}else(void 0===t.value||t.value([r,i],o,e))&&n.push(i)}return n};for(let e=0;e<n.length;e++){const[o,i]=n[e];if(Array.isArray(i)){const s=a(i,o);(void 0===t.array||t.array([o,s],e,n))&&(r instanceof Map||r instanceof Set?r instanceof Map?r.set(o,s):r.add(s):r[o]=s)}else if(p(i)){const a=xe(i,t);(void 0===t.obj||t.obj(a,e,n))&&(r instanceof Map?r.set(o,a):r instanceof Set?r.add(a):r[o]=a)}else(void 0===t.value||t.value([o,i],e,n))&&(r instanceof Map?r.set(o,i):r instanceof Set?r.add(i):r[o]=i)}return r}function Ae(e,t,r){if(!Array.isArray(t))throw new TypeError("The second argument must be an array.");if(void 0!==r&&!Array.isArray(r))throw new TypeError("The third argument must be an array.");return Ie(e,([e,n])=>t.length>0?t.some(t=>{if(Array.isArray(t)){const[r,o]=t,a=e===r,i="function"==typeof o?o(n):n===o;return a&&i}const o=e===t,a=void 0===r||r.some(e=>"function"==typeof e?e(n):e===n);return o&&a}):void 0!==r&&r.some(e=>"function"==typeof e?e(n):e===n))}const Ne=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("string"!=typeof e)throw new TypeError(`Expected "${t}" to be a string, but received ${typeof e}.`)},je=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("function"!=typeof e)throw new TypeError(`Expected "${t}" to be a function, but received ${typeof e}.`)},ke=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError(`Expected "${t}" to be a plain object, but received ${null===e?"null":Array.isArray(e)?"array":typeof e}.`)},Me=(e,t=!1)=>!t&&void 0===e,Se=(e,t=!1)=>Me(e,t)||"string"==typeof e||!t&&null===e,Oe=(e,t=!1)=>Me(e,t)||"number"==typeof e||!t&&null===e,De=(e,t=!1)=>Me(e,t)||"boolean"==typeof e||!t&&null===e,Fe=(e,t)=>!!Me(e)||(je(t,"valueValidator"),Array.isArray(e)&&e.every(t)),Le=new Map;class Ce extends Error{constructor(e,t,r){if(Ne(e,"message"),Ne(t,"url"),"string"!=typeof r)throw new TypeError(`Expected "stage" to be a string, but received ${typeof r}.`);super(e),this.name="MediaLoadingError",this.url=t,this.stage=r}}const Pe=async e=>{Ne(e,"str");const t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("").substring(0,8)},Re=(e,t="image/jpeg")=>{if(!(e instanceof Uint8Array)&&"string"!=typeof e)throw new TypeError(`Expected "data" to be an instance of Uint8Array or a string, but received ${typeof e}.`);Ne(t,"format");const r=e=>{const t=URL.createObjectURL(e),r=Le.get(t);return Le.set(t,"number"==typeof r?r+1:1),t};if(e instanceof Uint8Array)return r(new Blob([e],{type:t}));if("string"==typeof e&&e.startsWith("data:")){const n=e.split(",")[1],o=atob(n),a=new Uint8Array(o.length);for(let e=0;e<o.length;e++)a[e]=o.charCodeAt(e);return r(new Blob([a],{type:t}))}return"string"==typeof e?e:""},Be=(e,t=!1)=>{if(m(e)){if(4!==d(e)){if(t)return!1;throw new TypeError("Invalid fetch data: Object must be an MediaContentFetchData.")}$e(e.common),ke(e.native,"_fetchData.native"),ke(e.format,"_fetchData.format"),ke(e.quality,"_fetchData.quality");for(const r in e.native){const n=e.native[r];if(!Fe(n,e=>"string"==typeof e.id)){if(t)return!1;throw new TypeError(`Invalid native data: "${r}" must be an array of native fetch data.`)}}}return!0},$e=e=>{if(ke(e,"common"),Be(e._fetchData),!Se(e.title))throw new TypeError('Invalid metadata: "title" must be a string or null.');if(!Se(e.album))throw new TypeError('Invalid metadata: "album" must be a string or null.');if(!Se(e.albumartist))throw new TypeError('Invalid metadata: "albumartist" must be a a string or null.');if(!Se(e.artist))throw new TypeError('Invalid metadata: "artist" must be a string or null.');if(!De(e.compilation))throw new TypeError('Invalid metadata: "compilation" must be a boolean or null.');if(!De(e.podcast))throw new TypeError('Invalid metadata: "podcast" must be a boolean or null.');if(!De(e.gapless))throw new TypeError('Invalid metadata: "gapless" must be a boolean or null.');if(!De(e.showMovement))throw new TypeError('Invalid metadata: "showMovement" must be a boolean or null.');if(!Oe(e.averageLevel))throw new TypeError('Invalid metadata: "averageLevel" must be a number or null.');if(!Oe(e.peakLevel))throw new TypeError('Invalid metadata: "peakLevel" must be a number or null.');if(!Oe(e.hdVideo))throw new TypeError('Invalid metadata: "hdVideo" must be a number or null.');if(!Oe(e.stik))throw new TypeError('Invalid metadata: "stik" must be a number or null.');if(!Oe(e.playCounter))throw new TypeError('Invalid metadata: "playCounter" must be a number or null.');if(!Oe(e.tvSeason))throw new TypeError('Invalid metadata: "tvSeason" must be a number or null.');if(!Oe(e.tvEpisode))throw new TypeError('Invalid metadata: "tvEpisode" must be a number or null.');if(!Oe(e.year))throw new TypeError('Invalid metadata: "year" must be a number or null.');if(!Oe(e.bpm))throw new TypeError('Invalid metadata: "bpm" must be a number or null.');if(!Oe(e.originalyear))throw new TypeError('Invalid metadata: "originalyear" must be a number or null.');if(!Oe(e.movementTotal))throw new TypeError('Invalid metadata: "movementTotal" must be a number or null.');if(!Se(e.date))throw new TypeError('Invalid metadata: "date" must be a string or null.');if(!Se(e.originaldate))throw new TypeError('Invalid metadata: "originaldate" must be a string or null.');if(!Se(e.releasedate))throw new TypeError('Invalid metadata: "releasedate" must be a string or null.');if(!Se(e.albumsort))throw new TypeError('Invalid metadata: "albumsort" must be a string or null.');if(!Se(e.titlesort))throw new TypeError('Invalid metadata: "titlesort" must be a string or null.');if(!Se(e.work))throw new TypeError('Invalid metadata: "work" must be a string or null.');if(!Se(e.artistsort))throw new TypeError('Invalid metadata: "artistsort" must be a string or null.');if(!Se(e.albumartistsort))throw new TypeError('Invalid metadata: "albumartistsort" must be a string or null.');if(!Se(e.composersort))throw new TypeError('Invalid metadata: "composersort" must be a string or null.');if(!Se(e.grouping))throw new TypeError('Invalid metadata: "grouping" must be a string or null.');if(!Se(e.longDescription))throw new TypeError('Invalid metadata: "longDescription" must be a string or null.');if(!Se(e.totaltracks))throw new TypeError('Invalid metadata: "totaltracks" must be a string or null.');if(!Se(e.totaldiscs))throw new TypeError('Invalid metadata: "totaldiscs" must be a string or null.');if(!Se(e.mood))throw new TypeError('Invalid metadata: "mood" must be a string or null.');if(!Se(e.media))throw new TypeError('Invalid metadata: "media" must be a string or null.');if(!Se(e.tvShow))throw new TypeError('Invalid metadata: "tvShow" must be a string or null.');if(!Se(e.tvShowSort))throw new TypeError('Invalid metadata: "tvShowSort" must be a string or null.');if(!Se(e.tvEpisodeId))throw new TypeError('Invalid metadata: "tvEpisodeId" must be a string or null.');if(!Se(e.tvNetwork))throw new TypeError('Invalid metadata: "tvNetwork" must be a string or null.');if(!Se(e.podcasturl))throw new TypeError('Invalid metadata: "podcasturl" must be a string or null.');if(!Se(e.releasestatus))throw new TypeError('Invalid metadata: "releasestatus" must be a string or null.');if(!Se(e.releasecountry))throw new TypeError('Invalid metadata: "releasecountry" must be a string or null.');if(!Se(e.script))throw new TypeError('Invalid metadata: "script" must be a string or null.');if(!Se(e.language))throw new TypeError('Invalid metadata: "language" must be a string or null.');if(!Se(e.copyright))throw new TypeError('Invalid metadata: "copyright" must be a string or null.');if(!Se(e.license))throw new TypeError('Invalid metadata: "license" must be a string or null.');if(!Se(e.encodedby))throw new TypeError('Invalid metadata: "encodedby" must be a string or null.');if(!Se(e.encodersettings))throw new TypeError('Invalid metadata: "encodersettings" must be a string or null.');if(!Se(e.barcode))throw new TypeError('Invalid metadata: "barcode" must be a string or null.');if(!Se(e.asin))throw new TypeError('Invalid metadata: "asin" must be a string or null.');if(!Se(e.website))throw new TypeError('Invalid metadata: "website" must be a string or null.');if(!Se(e.originalalbum))throw new TypeError('Invalid metadata: "originalalbum" must be a string or null.');if(!Se(e.originalartist))throw new TypeError('Invalid metadata: "originalartist" must be a string or null.');if(!Se(e.key))throw new TypeError('Invalid metadata: "key" must be a string or null.');if(!Se(e.movement))throw new TypeError('Invalid metadata: "movement" must be a string or null.');if(!Se(e.podcastId))throw new TypeError('Invalid metadata: "podcastId" must be a string or null.');if(!Fe(e.albumartists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "albumartists" must be an array of strings.');if(!Fe(e.genre,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "genre" must be an array of strings.');if(!Fe(e.label,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "label" must be an array of strings.');if(!Fe(e.composer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "composer" must be an array of strings.');if(!Fe(e.artists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "artists" must be an array of strings.');if(!Fe(e.lyricist,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "lyricist" must be an array of strings.');if(!Fe(e.writer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "writer" must be an array of strings.');if(!Fe(e.conductor,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "conductor" must be an array of strings.');if(!Fe(e.remixer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "remixer" must be an array of strings.');if(!Fe(e.arranger,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "arranger" must be an array of strings.');if(!Fe(e.engineer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "engineer" must be an array of strings.');if(!Fe(e.publisher,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "publisher" must be an array of strings.');if(!Fe(e.producer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "producer" must be an array of strings.');if(!Fe(e.djmixer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "djmixer" must be an array of strings.');if(!Fe(e.mixer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "mixer" must be an array of strings.');if(!Fe(e.technician,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "technician" must be an array of strings.');if(!Fe(e.subtitle,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "subtitle" must be an array of strings.');if(!Fe(e.description,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "description" must be an array of strings.');if(!Fe(e.discsubtitle,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "discsubtitle" must be an array of strings.');if(!Fe(e.releasetype,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "releasetype" must be an array of strings.');if(!Fe(e.isrc,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "isrc" must be an array of strings.');if(!Fe(e.performer_instrument,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "performer_instrument" must be an array of strings.');if(!Fe(e.notes,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "notes" must be an array of strings.');if(!Fe(e.category,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "category" must be an array of strings.');if(!Fe(e.keywords,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "keywords" must be an array of strings.');if(!Fe(e.catalognumber,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "catalognumber" must be an array of strings.');if(!Fe(e.picture,e=>e&&"object"==typeof e&&(void 0===e.description||"string"==typeof e.description)&&(void 0===e.name||"string"==typeof e.name)&&(void 0===e.type||"string"==typeof e.type)&&"string"==typeof e.format&&(e.data instanceof Uint8Array||"string"==typeof e.data)))throw new TypeError('Invalid metadata: "picture" must be an array of pictures.');if(!Fe(e.comment,e=>null!==e&&"object"==typeof e&&Se(e.descriptor)&&Se(e.language)&&Se(e.text)))throw new TypeError('Invalid metadata: "comment" must be an array of valid IComment objects.');if(!Fe(e.lyrics,e=>null!==e&&"object"==typeof e&&Se(e.text)&&Se(e.descriptor)&&Se(e.language)&&(!Array.isArray(e)||Fe(e.syncText,e=>null!==e&&"object"==typeof e&&Se(e.text)&&Oe(e.timestamp)))&&(e=>void 0===e||null!==e&&"object"==typeof e&&Oe(e.notSynchronized)&&Oe(e.mpegFrameNumber)&&Oe(e.milliseconds))(e.timeStampFormat)&&(e=>void 0===e||null!==e&&"object"==typeof e&&Oe(e.other)&&Oe(e.lyrics)&&Oe(e.text)&&Oe(e.movement_part)&&Oe(e.events)&&Oe(e.chord)&&Oe(e.trivia_pop))(e.contentType)))throw new TypeError('Invalid metadata: "lyrics" must be an array of valid ILyricsTag objects.');if(!Fe(e.rating,e=>null!==e&&"object"==typeof e&&Se(e.source)&&Oe(e.rating)))throw new TypeError('Invalid metadata: "rating" must be an array of valid IRating objects.');const t=(e,t)=>{if(!Me(t)&&null!==t){if("object"!=typeof t)throw new TypeError(`Invalid metadata: "${e}" must be an object or null.`);if("number"!=typeof t.no&&null!==t.no)throw new TypeError(`Invalid metadata: "${e}.no" must be a number or null.`);if("number"!=typeof t.of&&null!==t.of)throw new TypeError(`Invalid metadata: "${e}.of" must be a number or null.`)}};t("disk",e.disk),t("track",e.track),t("movementIndex",e.movementIndex)},Ue=async(e,t,r=!0)=>{Ne(e,"url"),je(t,"parseFile");const n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch audio file: ${n.status} ${n.statusText}`);const o=await n.blob(),a=await t(o);if(!a||"object"!=typeof a.common)throw new TypeError('Invalid metadata: "common" property is missing.');void 0!==typeof a.common["performer:instrument"]&&(a.common.performer_instrument=a.common["performer:instrument"]),Be(a);const i=a.common;$e(i);const s=i?.picture?.map(e=>({...e,data:r?Re(e.data,e.format):e.data}))??[];a.common={...a.common,picture:s.map(e=>({...e,data:""}))},r&&Object.keys(a.native).forEach(e=>{a.native[e]=a.native[e].map(e=>{if(e.value&&"object"==typeof e.value&&e.value.data instanceof Uint8Array){const t=i?.picture?.findIndex(t=>t.data===e.value.data&&t.format===e.value.format&&t.description===e.value.description&&t.name===e.value.name)??-1;if(s[t])return{...e,value:{...e.value,data:""}}}return e})});const l=xe({title:i?.title,album:i?.album,albumartist:i?.albumartist,albumartists:i?.albumartists,genre:i?.genre,label:i?.label,composer:i?.composer,year:i?.year,artist:i?.artist,artists:i?.artists,disk:i?.disk?{no:i.disk.no,of:i.disk.of}:void 0,track:i?.track?{no:i.track.no,of:i.track.of}:void 0,movementIndex:i?.movementIndex?{no:i.movementIndex.no,of:i.movementIndex.of}:void 0,picture:s,date:i?.date,originaldate:i?.originaldate,originalyear:i?.originalyear,releasedate:i?.releasedate,comment:i?.comment,lyrics:i?.lyrics,albumsort:i?.albumsort,titlesort:i?.titlesort,work:i?.work,artistsort:i?.artistsort,albumartistsort:i?.albumartistsort,composersort:i?.composersort,lyricist:i?.lyricist,writer:i?.writer,conductor:i?.conductor,remixer:i?.remixer,arranger:i?.arranger,engineer:i?.engineer,publisher:i?.publisher,producer:i?.producer,djmixer:i?.djmixer,mixer:i?.mixer,technician:i?.technician,grouping:i?.grouping,subtitle:i?.subtitle,description:i?.description,longDescription:i?.longDescription,discsubtitle:i?.discsubtitle,totaltracks:i?.totaltracks,totaldiscs:i?.totaldiscs,movementTotal:i?.movementTotal,compilation:i?.compilation,rating:i?.rating,bpm:i?.bpm,mood:i?.mood,media:i?.media,catalognumber:i?.catalognumber,tvShow:i?.tvShow,tvShowSort:i?.tvShowSort,tvSeason:i?.tvSeason,tvEpisode:i?.tvEpisode,tvEpisodeId:i?.tvEpisodeId,tvNetwork:i?.tvNetwork,podcast:i?.podcast,podcasturl:i?.podcasturl,releasestatus:i?.releasestatus,releasetype:i?.releasetype,releasecountry:i?.releasecountry,script:i?.script,language:i?.language,copyright:i?.copyright,license:i?.license,encodedby:i?.encodedby,encodersettings:i?.encodersettings,gapless:i?.gapless,barcode:i?.barcode,isrc:i?.isrc,asin:i?.asin,website:i?.website,performer_instrument:i?.performer_instrument,averageLevel:i?.averageLevel,peakLevel:i?.peakLevel,notes:i?.notes,originalalbum:i?.originalalbum,originalartist:i?.originalartist,key:i?.key,category:i?.category,hdVideo:i?.hdVideo,keywords:i?.keywords,movement:i?.movement,podcastId:i?.podcastId,showMovement:i?.showMovement,stik:i?.stik,playCounter:i?.playCounter},{value:([e,t])=>null!=t,obj:e=>d(e)>0,array:([e,t])=>t.length>0});return l._fetchData=a,l},_e=async(e,t={},r={},n=e=>{if(!(e instanceof Blob))throw new TypeError('Expected "data" to be a Blob.');return new Promise((e,t)=>t(new TypeError("parseFile library not found.")))},o={},a=!0,i="null")=>{if("string"!=typeof e&&!(e instanceof HTMLMediaElement))throw new TypeError("Source must be a string or an HTMLMediaElement.");if(ke(t,"defaultMetadata"),ke(r,"metadata"),je(n,"parseFile"),ke(o,"callbacks"),o.onProgress&&"function"!=typeof o.onProgress)throw new TypeError("callbacks.onProgress must be a function.");if(o.onError&&"function"!=typeof o.onError)throw new TypeError("callbacks.onError must be a function.");if("string"!=typeof i&&"function"!=typeof i)throw new TypeError("unknownArtist must be a string or a function returning a string.");let s,l="";const u=(t,r)=>{if(Ne(t,"stage"),void 0!==r&&!(r instanceof Event))throw new TypeError('Expected "event" to be an Event or undefined.');o.onProgress&&o.onProgress({event:r,status:"loading",stage:t,url:l||(e instanceof HTMLMediaElement?e.src:"unknown")})},f=(t,r)=>{if(!(t instanceof Error))throw new TypeError('Expected "error" to be an Error.');Ne(r,"stage"),o.onError&&o.onError({error:t instanceof Error?t:new Error(String(t)),url:l||(e instanceof HTMLMediaElement?e.src:"unknown"),stage:r})};try{u("INITIALIZING"),"string"==typeof e?(l=e,s=new Audio(l)):(s=e,l=s.src);try{await new Promise((e,t)=>{const r=e=>u("DOWNLOADING",e),n=()=>{a(),e(void 0)},o=e=>{a(),t(new Error(`HTMLMediaElement failed to load: ${e.message||"Unknown error"}`))},a=()=>{s.removeEventListener("progress",r),s.removeEventListener("loadedmetadata",n),s.removeEventListener("error",o)};s.addEventListener("progress",r),s.addEventListener("loadedmetadata",n),s.addEventListener("error",o),s.readyState>=1&&(a(),e(void 0))}),u("METADATA_LOADED")}catch(e){throw new Ce(e instanceof Error?e.message:"UNKNOWN ERROR",l,"METADATA")}const c={id:r.id||await Pe(l),duration:Math.floor(1e3*s.duration),url:l,weight:r.weight??1};let d={};u("EXTRACTING_ID3");try{d=await Ue(l,n,a)}catch(e){f(e instanceof Error?e:new Error("Unknown Error"),"ID3"),console.warn(`[TinyAudioUtils] ID3 extraction failed for ${l}. Falling back to filename.`)}const p=e=>{Ne(e,"url");try{return(e.split(/[?#]/)[0].split("/").pop()??"").replace(/\.[^/.]+$/,"")||"Unknown Track"}catch{return"Unknown Track"}},y=e=>{const t={...e};return m(t._fetchData)&&(m(d._fetchData)&&(t._fetchData={...d._fetchData}),m(e._fetchData)&&(void 0!==e._fetchData.common&&(t._fetchData.common=e._fetchData.common),void 0!==e._fetchData.native&&(t._fetchData.native=e._fetchData.native),void 0!==e._fetchData.format&&(t._fetchData.format=e._fetchData.format),void 0!==e._fetchData.quality&&(t._fetchData.quality=e._fetchData.quality))),t},w={...c,...y(t),...d,...y(r),title:d.title||r.title||p(l),artist:d.artist||r.artist||("string"==typeof i?i:String(i()))};return o.onProgress&&o.onProgress({status:"success",stage:"COMPLETE",url:l}),w}catch(e){if(e instanceof Ce)throw e;const t=new Ce(e instanceof Error?e.message:"UNKNOWN ERROR",l,"INITIALIZING");throw f(t,"INITIALIZING"),t}},He=(e,t=100)=>{if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(!Number.isFinite(t)||t<=0)throw new TypeError("Expected 'checkInterval' to be a positive number.");return new Promise(r=>{const n=setInterval(()=>{e()&&(clearInterval(n),r())},t)})},Ye=(e,t=!0)=>{if("function"!=typeof e)throw new TypeError('The argument "baseFunction" must be a function.');let r=null;const n={ended:!1,failed:!1,loading:!1};return{callback:async(...o)=>(null!==r||(n.loading=!0,r=(async()=>{try{const a=await e(...o);return n.ended=!0,n.failed=!1,n.loading=!1,t&&(r=null),a}catch(e){throw n.ended=!0,n.failed=!0,n.loading=!1,t&&(r=null),e}})()),r),getActivePromise:()=>r,resetActivePromise:()=>{n.ended=!1,n.failed=!1,n.loading=!1,r=null},isEnded:()=>n.ended,isFailed:()=>n.failed,isLoading:()=>n.loading}},qe=()=>"undefined"!=typeof window&&void 0!==window.document,Ve="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null,ze="undefined"!=typeof document?document:null,Je=["chrome","firefox","ie","edge","safari","opera","yandex","other"];function We(){if("undefined"==typeof navigator)return"other";const e=navigator.userAgent;return-1!==e.indexOf("Chrome")?"chrome":-1!==e.indexOf("Firefox")?"firefox":-1!==e.indexOf("MSIE")?"ie":-1!==e.indexOf("Edge")?"edge":-1!==e.indexOf("Safari")?"safari":-1!==e.indexOf("Opera")?"opera":-1!==e.indexOf("YaBrowser")?"yandex":"other"}function Xe(){const e=Ve?.getComputedStyle?(Array.prototype.slice.call(Ve.getComputedStyle(document.documentElement,"")).join("").match(/-(moz|webkit|ms)-/)??["",""])[1]:"";return"moz"===e?"gecko":"webkit"===e?"webkit":"ms"===e?"trident":"other"}function Ge(){const e=!!Ve?.opr&&!!opr.addons||!!Ve?.opera||navigator.userAgent.indexOf(" OPR/")>=0,t="undefined"!=typeof InstallTrigger,r=!!Ve?.HTMLElement&&/constructor/i.test(Ve.HTMLElement)||"[object SafariRemoteNotification]"===(!Ve.safari||"undefined"!=typeof safari&&safari.pushNotification).toString(),n=!!ze?.documentMode,o=!n&&!!Ve?.StyleMedia,a=!!Ve?.chrome;return{isOpera:e,isFirefox:t,isSafari:r,isIE:n,isEdge:o,isChrome:a,isBlink:(a||e)&&!!Ve?.CSS}}function Ke(e=[]){if(!Array.isArray(e))throw new TypeError('The "disable" argument must be an array.');for(const t of e)if(!Je.includes(t))throw new TypeError(`Invalid browser name provided in disable array: ${t}`);const t={chrome:0,firefox:0,ie:0,edge:0,safari:0,opera:0,yandex:0,other:0};t[We()]++;const r=Xe();"gecko"===r?e.indexOf("firefox")<0&&t.firefox++:"webkit"===r?(e.indexOf("chrome")<0&&t.chrome++,e.indexOf("safari")<0&&t.safari++,e.indexOf("opera")<0&&t.opera++,e.indexOf("edge")<0&&t.edge++):"trident"===r?e.indexOf("ie")<0&&t.ie++:e.indexOf("other")<0&&t.other++;const n=Ge();return n.isOpera&&e.indexOf("opera")<0&&t.opera++,n.isFirefox&&e.indexOf("firefox")<0&&t.firefox++,n.isSafari&&e.indexOf("safari")<0&&t.safari++,n.isIE&&e.indexOf("ie")<0&&t.ie++,n.isEdge&&e.indexOf("edge")<0&&t.edge++,n.isChrome&&e.indexOf("chrome")<0&&t.chrome++,t}function Ze(e=[]){const t=Ke(e);return Object.keys(t).reduce((e,r)=>t[r]>t[e]?r:e)}window.TinyBasicsEs=t})();
|
|
1
|
+
(()=>{"use strict";const e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};function r(e){if(!Array.isArray(e))throw new TypeError("Argument 'items' must be an array.");let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function n(e,t){if(!Array.isArray(e))throw new TypeError("Argument 'phases' must be an array.");if(!Array.isArray(t))throw new TypeError("Argument 'counts' must be an array.");if(e.length!==t.length)throw new RangeError("The 'phases' and 'counts' arrays must have the same length.");const r=[];for(let n=0;n<e.length;n++){if("number"!=typeof t[n]||Number.isNaN(t[n]))throw new TypeError(`Element at counts[${n}] must be a valid number.`);for(let o=0;o<t[n];o++)r.push(e[n])}return r}function o(e,t){if(!Array.isArray(e))throw new TypeError("Argument 'oldItems' must be an array.");if(!Array.isArray(t))throw new TypeError("Argument 'newItems' must be an array.");const r=e.filter(e=>!t.includes(e));return{added:t.filter(t=>!e.includes(t)),removed:r}}function a(e,t=!1){if(null!=e&&"string"!=typeof e)throw new TypeError("Argument 'item' must be a string or null.");if("boolean"!=typeof t)throw new TypeError("Argument 'isReverse' must be a boolean.");return t?function(t,r){return(e?t[e]:t)>(e?r[e]:r)?-1:(e?t[e]:t)<(e?r[e]:r)?1:0}:function(t,r){return(e?t[e]:t)<(e?r[e]:r)?-1:(e?t[e]:t)>(e?r[e]:r)?1:0}}function i(){const e=new Intl.DateTimeFormat(void 0,{hour:"numeric"}).resolvedOptions().hourCycle;return e?.startsWith("h12")?12:24}function s(e=new Date,t="asSeconds",r=null){if(!(e instanceof Date))throw new TypeError("The 'timeData' argument must be an instance of Date.");if("string"!=typeof t)throw new TypeError("The 'durationType' argument must be a string.");const n=["asMilliseconds","asSeconds","asMinutes","asHours","asDays"];if(!n.includes(t))throw new RangeError(`The 'durationType' must be one of: ${n.join(", ")}.`);if(null!==r&&!(r instanceof Date))throw new TypeError("The 'now' argument must be an instance of Date or null.");const o=r instanceof Date?r:new Date,a=e.getTime()-o.getTime();switch(t){case"asMilliseconds":return a;case"asSeconds":default:return a/1e3;case"asMinutes":return a/6e4;case"asHours":return a/36e5;case"asDays":return a/864e5}}function l(e,t="seconds",r="{time}"){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'totalSeconds' argument must be a valid number.");if("string"!=typeof t)throw new TypeError("The 'level' argument must be a string.");const n=["seconds","minutes","hours","days","months","years"];if(!n.includes(t))throw new RangeError(`The 'level' must be one of: ${n.join(", ")}.`);if("string"!=typeof r)throw new TypeError("The 'format' argument must be a string.");e=Math.max(0,Math.floor(e));const o=n.indexOf(t),a=o>=5,i=o>=4,s=o>=3,l=o>=2,u=o>=1,c=o>=0,f={years:a?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:l?0:NaN,minutes:u?0:NaN,seconds:c?0:NaN,total:NaN};let m=e;if(a||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*m),r=new Date(e);if(a)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),f.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),f.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),f.days++;m=Math.floor((t.getTime()-r.getTime())/1e3)}l&&(f.hours=Math.floor(m/3600),m%=3600),u&&(f.minutes=Math.floor(m/60),m%=60),c&&(f.seconds=m),f.total=+e.toFixed(2).replace(/\.00$/,"");const d=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},p=[l?d(f.hours):null,u?d(f.minutes):null,c?d(f.seconds):null].filter(e=>null!==e).join(":");return r.replace(/\{years\}/g,String(f.years)).replace(/\{months\}/g,String(f.months)).replace(/\{days\}/g,String(f.days)).replace(/\{hours\}/g,d(f.hours)).replace(/\{minutes\}/g,d(f.minutes)).replace(/\{seconds\}/g,d(f.seconds)).replace(/\{time\}/g,p).replace(/\{total\}/g,String(f.total)).trim()}function u(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'seconds' argument must be a valid number.");return l(e,"hours","{hours}:{minutes}:{seconds}")}function c(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'seconds' argument must be a valid number.");return l(e,"days","{days}d {hours}:{minutes}:{seconds}")}function f(e,t="milliseconds"){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'totalMs' argument must be a valid number.");if("string"!=typeof t)throw new TypeError("The 'level' argument must be a string.");const r=["milliseconds","seconds","minutes","hours","days","months","years"];if(!r.includes(t))throw new RangeError(`The 'level' must be one of: ${r.join(", ")}.`);e=Math.max(0,Math.floor(e));const n=r.indexOf(t),o=n>=6,a=n>=5,i=n>=4,s=n>=3,l=n>=2,u=n>=1,c=n>=0,f={years:o?0:NaN,months:a?0:NaN,days:i?0:NaN,hours:s?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,milliseconds:c?0:NaN,total:NaN};let m=e;if(o||a||i){const e=new Date(1980,0,1),t=new Date(e.getTime()+m),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),f.years++;if(a)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),f.months++;if(i)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),f.days++;m=t.getTime()-r.getTime()}return s&&(f.hours=Math.floor(m/36e5),m%=36e5),l&&(f.minutes=Math.floor(m/6e4),m%=6e4),u&&(f.seconds=Math.floor(m/1e3),m%=1e3),c&&(f.milliseconds=m),f.total=+e,f}function m(e){if(!Array.isArray(e)&&!d(e))throw new TypeError("Argument must be either an Array or a pure JSON Object.");return Array.isArray(e)?e.length:Object.keys(e).length}function d(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}function p(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}e.r(t),e.d(t,{addAiMarkerShortcut:()=>te,areElsCollBottom:()=>ie,areElsCollLeft:()=>se,areElsCollPerfBottom:()=>ce,areElsCollPerfLeft:()=>fe,areElsCollPerfRight:()=>me,areElsCollPerfTop:()=>ue,areElsCollRight:()=>le,areElsCollTop:()=>ae,areElsColliding:()=>de,areElsPerfColliding:()=>pe,arraySortPositions:()=>a,assertYouTubeOEmbedResponse:()=>ut,asyncReplace:()=>K,breakdownDuration:()=>f,browserIs:()=>Ke,calculateMarketcap:()=>G,cloneObjTypeOrder:()=>M,compareMarketcap:()=>Z,countObj:()=>m,createSingletonTask:()=>qe,diffArrayList:()=>o,diffObjList:()=>ne,documentIsFullScreen:()=>C,exitFullScreen:()=>B,extendObjType:()=>k,extractMediaId3Tags:()=>Be,extractYouTubeVideoId:()=>ct,fetchJson:()=>I,fetchText:()=>x,fetchYouTubeOEmbed:()=>ft,formatBytes:()=>W,formatCustomTimer:()=>l,formatDayTimer:()=>c,formatTimer:()=>u,genFibonacciSeq:()=>X,getAge:()=>J,getBrowserCssPrefix:()=>Xe,getBrowserPings:()=>Ze,getDuckTyping:()=>Ge,getElsCollDetails:()=>Te,getElsCollDirDepth:()=>Ee,getElsCollOverlap:()=>ge,getElsCollOverlapPos:()=>be,getElsColliding:()=>ye,getElsPerfColliding:()=>we,getElsRelativeCenterOffset:()=>ve,getObjTypeOrder:()=>$,getObjTypeRegistry:()=>L,getPercentage:()=>z,getRectCenter:()=>he,getSimplePerc:()=>V,getTimeDuration:()=>s,getUserTimeFormat:()=>i,getYouTubeThumbnailUrl:()=>mt,hashText:()=>oe,installWindowHiddenScript:()=>A,isAnyClassInstance:()=>g,isBrowser:()=>He,isBrowserAgent:()=>We,isClass:()=>y,isClassInstance:()=>w,isFullScreenMode:()=>P,isJsonObject:()=>d,isObjType:()=>D,isScreenFilled:()=>R,isValidObj:()=>p,jsonFilter:()=>Ie,jsonFilterByKeys:()=>Ae,jsonFilterRecursive:()=>xe,multiplyArrayBlocks:()=>n,objType:()=>F,objTypeName:()=>O,offFullScreenChange:()=>q,onFullScreenChange:()=>Y,parseMediaMetadata:()=>Ue,readBase64Blob:()=>h,readFileBlob:()=>b,readJsonBlob:()=>v,reorderObjTypeOrder:()=>S,requestFullScreen:()=>_,ruleOfThree:()=>H,safeTextTrim:()=>re,saveJsonFile:()=>E,shuffleArray:()=>r,toTitleCase:()=>Q,toTitleCaseLowerFirst:()=>ee,valFetchMediaContent:()=>Pe,valMediaContentMetadata:()=>_e,waitForTrue:()=>Ye});const y=e=>{if("function"!=typeof e)throw new TypeError("The 'target' argument must be a function. Received: "+typeof e);try{return e(),!1}catch(e){return e instanceof TypeError&&e.message.includes("Class constructor")}};function w(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!1;if("function"!=typeof e.constructor)return!1;const r=e.constructor.toString();return/^\s*class\b/.test(r)}function g(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null!==t&&t!==Object.prototype&&"function"==typeof e.constructor}function b(e,t){if(!(e instanceof Blob))return Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'));const r=["readAsArrayBuffer","readAsDataURL","readAsText","readAsBinaryString"];return"string"==typeof t&&r.includes(t)?new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(e){n(e)}},o.onerror=()=>{n(o.error)},o[t](e)}):Promise.reject(new TypeError(`The "method" argument must be one of: ${r.join(", ")}.`))}function h(e,t=!1){return e instanceof Blob?"string"!=typeof t&&"boolean"!=typeof t?Promise.reject(new TypeError("The isDataUrl parameter must be a boolean or a string.")):new Promise((r,n)=>{b(e,"readAsDataURL").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const n=e.match(/^data:(.+);base64,(.*)$/);if(!n||!n[2])throw new Error("Invalid data URL format or missing Base64 content.");const[,o,a]=n;if(!/^[\w/+]+=*$/.test(a))throw new Error("Base64 content is malformed.");if("boolean"==typeof t)return r(t?e:a);if(!/^[\w-]+\/[\w.+-]+$/.test(t))throw new Error(`Invalid MIME type string: ${t}`);return r(`data:${t};base64,${a}`)}).catch(n)}):Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'))}function v(e){return e instanceof Blob?new Promise((t,r)=>b(e,"readAsText").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const r=e.trim();if(0===r.length)throw new Error("File is empty or contains only whitespace.");const n=JSON.parse(r);if("object"!=typeof n||null===n)throw new Error("Parsed content is not a valid JSON object or array.");t(n)}).catch(r)):Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'))}function E(e,t,r=2){if("string"!=typeof e)throw new TypeError('The "filename" argument must be a string.');if("number"!=typeof r||!Number.isInteger(r)||r<0)throw new TypeError('The "spaces" argument must be a non-negative integer.');const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),a=URL.createObjectURL(o),i=document.createElement("a");i.href=a,i.download=e,i.click(),URL.revokeObjectURL(a)}function T(e,t,r=e=>({headers:e.headers,status:e.status,statusText:e.statusText})){if(!(e instanceof Response))throw new TypeError('The "response" argument must be an instance of Response.');if("function"!=typeof t)throw new TypeError('The "onProgress" argument must be a function.');if(!e.body)return e;const n=e.headers.get("content-length"),o=n?parseInt(n,10):0;let a=0;const i=e.body.getReader(),s=new ReadableStream({async start(e){for(;;){const{done:r,value:n}=await i.read();if(r)break;a+=n.byteLength,t(a,o),e.enqueue(n)}e.close()}});return new Response(s,r(e))}async function I(e,t,r){return"string"!=typeof e?Promise.reject(new TypeError('The "url" argument must be a string.')):void 0!==t&&"object"!=typeof t?Promise.reject(new TypeError('The "options" argument must be an object.')):void 0!==r&&"function"!=typeof r?Promise.reject(new TypeError('The "onProgress" option must be a function.')):new Promise((n,o)=>{fetch(e,t??void 0).then(async e=>{const t=r?T(e,r):e,o=t.headers.get("content-type")||"";if(!o.includes("application/json"))throw new Error(`Unexpected content-type: ${o}`);const a=await t.json();if(!Array.isArray(a)&&!d(a))throw new Error("Received invalid data instead of valid JSON.");return n(a)}).catch(o)})}async function x(e,t,r,n){return"string"!=typeof e?Promise.reject(new TypeError('The "url" argument must be a string.')):void 0===t||Array.isArray(t)?void 0!==r&&"object"!=typeof r?Promise.reject(new TypeError('The "options" argument must be an object.')):void 0!==n&&"function"!=typeof n?Promise.reject(new TypeError('The "onProgress" option must be a function.')):new Promise((o,a)=>{fetch(e,r??void 0).then(async e=>{const r=n?T(e,n):e,a=r.headers.get("content-type")||"";if(Array.isArray(t)&&t.length>0&&!t.some(e=>a.includes(e)))throw new Error(`Blocked MIME type: ${a}`);const i=await r.text();return o(i)}).catch(a)}):Promise.reject(new TypeError('The "allowedMimeTypes" argument must be an array of strings.'))}function A(e={}){if(null===e||"object"!=typeof e)throw new TypeError('The "settings" argument must be an object.');const{element:t=document.body,hiddenClass:r="windowHidden",visibleClass:n="windowVisible",onVisible:o,onHidden:a}=e;if(!(t instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof r)throw new TypeError('"hiddenClass" must be a string.');if("string"!=typeof n)throw new TypeError('"visibleClass" must be a string.');if(void 0!==o&&"function"!=typeof o)throw new TypeError('"onVisible" must be a function if provided.');if(void 0!==a&&"function"!=typeof a)throw new TypeError('"onHidden" must be a function if provided.');let i="",s="";const l=()=>{t.classList.remove(r),t.classList.remove(n)};let u=null;const c=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],f=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<f.length;e++)if(f[e]in document){u=f[e];break}const m=function(e){l();const c=e?.type,f=u&&document[u];["focus","focusin","pageshow"].includes(c)?(t.classList.add(n),o?.({type:c,oldClass:s,oldType:i}),s=n):["blur","focusout","pagehide"].includes(c)||f?(t.classList.add(r),a?.({type:c,oldClass:s,oldType:i}),s=r):(t.classList.add(n),o?.({type:c,oldClass:s,oldType:i}),s=n),i=c};let d=()=>{};if(u){const e=c[f.indexOf(u)];document.addEventListener(e,m),window.addEventListener("focus",m),window.addEventListener("blur",m),d=()=>{document.removeEventListener(e,m),window.removeEventListener("focus",m),window.removeEventListener("blur",m),l()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=m,d=()=>{document.onfocusin=document.onfocusout=null,l()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=m,d=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,l()});const p=new Event(u&&document[u]?"blur":"focus");return m(p),d}const j="undefined"!=typeof window&&void 0!==window.document,N={items:{},order:[]};function k(e,t){if("object"!=typeof e||null===e)throw new TypeError("Argument 'ni' must be an object or an array.");if(void 0!==t&&"number"!=typeof t)throw new TypeError("Argument 'index' must be a number.");const r=[];let n;n=Array.isArray(e)?e.length>0&&Array.isArray(e[0])?e:e.length>0?[e]:[]:Object.entries(e);for(const e of n){if(!Array.isArray(e)||e.length<2)throw new TypeError("Each item in the input must be a [key, function] pair.");const[n,o,a]=e;if(void 0!==a&&"function"!=typeof a)throw new TypeError(`Cloner for key '${n}' must be a function.`);const i="function"==typeof a?a:e=>e;if("string"!=typeof n)throw new TypeError("Validator key must be a string.");if("function"!=typeof o)throw new TypeError(`Validator for key '${n}' must be a function.`);if(!N.items.hasOwnProperty(n)){N.items[n]={validator:o,cloner:i};let e="number"==typeof t?t:-1;if(-1===e){const t=N.order.indexOf("object");e=t>-1?t:N.order.length}e=Math.min(Math.max(0,e),N.order.length),N.order.splice(e,0,n),r.push(n)}}return r}function S(e){if(!Array.isArray(e))throw new TypeError("Argument 'newOrder' must be an array of strings.");if(!e.every(e=>"string"==typeof e))throw new TypeError("All elements in 'newOrder' must be strings.");const t=[...N.order];return!!e.every(e=>t.includes(e))&&(N.order=e.slice(),!0)}function M(){return[...N.order]}const O=e=>{if(null===e)return"null";for(const t of N.order)if("function"!=typeof N.items[t].validator||N.items[t].validator(e))return t;return"unknown"};function D(e,t){if("string"!=typeof t)throw new TypeError("Argument 'type' must be a string.");return O(e)===t.toLowerCase()}function F(e,t){if(void 0===e)return null;if(void 0!==t&&"string"!=typeof t)throw new TypeError("Argument 'type' must be a string.");const r=O(e);return"string"==typeof t?r===t.toLowerCase():r}function L(){return Object.fromEntries(Object.entries(N.items).map(([e,t])=>[e,{...t}]))}const $=()=>[...N.order];k([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["nannumber",e=>"number"==typeof e&&Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e]]),k(["array",e=>Array.isArray(e),(e,t,r)=>e.map(e=>t?r.clone(e,t):e)]),j&&k(["file",e=>"undefined"!=typeof File&&e instanceof File,e=>new File([e],e.name,{type:e.type,lastModified:e.lastModified})]),k(["date",e=>e instanceof Date,e=>new Date(e.getTime())]),k(["regexp",e=>e instanceof RegExp,e=>new RegExp(e.source,e.flags)]),k(["map",e=>e instanceof Map,(e,t,r)=>{const n=new Map;for(const[o,a]of e.entries())n.set(o,t?r.clone(a,t):a);return n}]),k(["set",e=>e instanceof Set,(e,t,r)=>{const n=new Set;for(const o of e)n.add(t?r.clone(o,t):o);return n}]),k([["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),k(["url",e=>e instanceof URL,e=>new URL(e.href)]),j&&k(["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement,e=>e.cloneNode(!0)]),k(["object",e=>d(e),(e,t,r)=>{const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t?r.clone(e[o],t):e[o]);return n}]);const C=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),R=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,P=()=>C()||R(),_=e=>new Promise(async(t,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(e):n.mozRequestFullScreen?n.mozRequestFullScreen(e):n.webkitRequestFullScreen?n.webkitRequestFullScreen(e):n.msRequestFullscreen&&n.msRequestFullscreen(e),t()}catch(e){r(e)}}),B=()=>new Promise((e,t)=>{if(document.exitFullscreen)document.exitFullscreen().then(e).catch(t);else try{if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Fullscreen API is not supported");document.msExitFullscreen()}e()}catch(e){t(e)}}),U=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],Y=(e,t)=>{U.forEach(r=>{document.addEventListener(r,e,t)})},q=(e,t)=>{U.forEach(r=>{document.removeEventListener(r,e,t)})};function H(e,t,r,n=!1){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("val1 must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("val2 must be a finite number.");if("number"!=typeof r||!Number.isFinite(r))throw new TypeError("val3 must be a finite number.");if("boolean"!=typeof n)throw new TypeError("inverse must be a boolean.");return n?Number(e*t)/r:Number(r*t)/e}function V(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("price must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("percentage must be a finite number.");return e*(t/100)}function z(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("part must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("total must be a finite number.");return 0===t?0:e/t*100}function J(e=0,t=null){if("number"!=typeof e&&"string"!=typeof e&&!(e instanceof Date))throw new TypeError("timeData must be a number, string, or Date object.");if(null!==t&&!(t instanceof Date))throw new TypeError("now must be a Date object or null.");const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const a=n.getMonth(),i=r.getMonth(),s=n.getDate(),l=r.getDate();return(a<i||a===i&&s<l)&&o--,Math.abs(o)}function W(e,t=null,r=null){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new TypeError("bytes must be a positive number.");if(0===e)return{unit:"Bytes",value:0};if(null!==t&&("number"!=typeof t||!Number.isFinite(t)))throw new TypeError("decimals must be a number or null.");const n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];if(null!==r){if("string"!=typeof r)throw new TypeError("maxUnit must be a string or null.");if(!n.includes(r))throw new RangeError(`maxUnit must be one of: ${n.join(", ")}`)}const o=r&&n.includes(r)?n.indexOf(r):n.length-1,a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),o);let i=e/Math.pow(1024,a);if(null!==t){const e=t<0?0:t;i=parseFloat(i.toFixed(e))}return{unit:n[a],value:i}}function X({baseValues:e=[0,1],length:t=10,combiner:r=(e,t)=>e+t}={}){if(!Array.isArray(e)||2!==e.length||!e.every(e=>"number"==typeof e))throw new Error("baseValues must be an array of exactly two numbers.");if("number"!=typeof t||!Number.isInteger(t))throw new RangeError("length must be an integer.");if("function"!=typeof r)throw new TypeError("combiner must be a function.");const n=[...e.slice(0,2)];for(let e=2;e<t;e++){const t=r(n[e-2],n[e-1],e);n.push(t)}return n}function G(e,t){if("number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Original market cap must be a finite number.");if("number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t))throw new TypeError("Circulating supply must be a finite number.");if(t<=0)throw new RangeError("Circulating supply must be greater than zero.");return e/t}function Z(e,t,r){if("number"!=typeof r||Number.isNaN(r)||!Number.isFinite(r))throw new TypeError("New market cap must be a finite number.");const n=G(e,t),o="number"==typeof r?r/t:NaN;return{originalPrice:n,newPrice:o,priceChangePercent:"number"==typeof r?(o-n)/n*100:NaN}}async function K(e,t,r){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);if(!(t instanceof RegExp))throw new TypeError("Expected a RegExp for 'regex', but received "+typeof t);if("function"!=typeof r)throw new TypeError("Expected a function for 'asyncFn', but received "+typeof r);const n=[];e.replace(t,(e,...t)=>(n.push(r(e,...t)),e));const o=await Promise.all(n);return e.replace(t,()=>o.shift())}function Q(e){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function ee(e){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);const t=e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase());return t.charAt(0).toLowerCase()+t.slice(1)}function te({key:e="a",className:t="detect-made-by-ai"}={}){if("undefined"==typeof HTMLElement)throw new Error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.");if("string"!=typeof e)throw new TypeError("Expected a string for 'config.key', but received "+typeof e);if("string"!=typeof t)throw new TypeError("Expected a string for 'config.className', but received "+typeof t);const r=function(r){if(r.ctrlKey&&r.altKey&&r.key.toLowerCase()===e){if(r.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle(t)}};return document.addEventListener("keydown",r),r}function re(e,t,r=.6){if("string"!=typeof e)throw new TypeError("Expected a string for 'text', but received "+typeof e);if(!Number.isInteger(t)||t<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${t}`);if("number"!=typeof r||r<0||r>1)throw new TypeError(`Expected 'safeCutZone' to be a number between 0 and 1, but received ${r}`);let n=e.trim();if(n.length>t){const e=n.lastIndexOf(" ",t);return e>0&&e>=t*r?`${n.substring(0,e).trim()}...`:`${n.substring(0,t).trim()}...`}return n}function ne(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError("Expected an object for 'oldStrings', but received "+(null===e?"null":typeof e));if("object"!=typeof t||null===t||Array.isArray(t))throw new TypeError("Expected an object for 'newStrings', but received "+(null===t?"null":typeof t));const r={added:{},removed:{},modified:{}};for(const n in e)n in t?e[n]!==t[n]&&(r.modified[n]={old:e[n],new:t[n]}):r.removed[n]=e[n];for(const n in t)n in e||(r.added[n]=t[n]);return r}async function oe(e,t){if("string"!=typeof e)throw new TypeError('The "text" parameter must be a string.');const r=(new TextEncoder).encode(e),n=await crypto.subtle.digest(t,r);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}const ae=(e,t)=>e.bottom<t.top,ie=(e,t)=>e.top>t.bottom,se=(e,t)=>e.right<t.left,le=(e,t)=>e.left>t.right,ue=(e,t)=>e.bottom<=t.top,ce=(e,t)=>e.top>=t.bottom,fe=(e,t)=>e.right<=t.left,me=(e,t)=>e.left>=t.right,de=(e,t)=>!(se(e,t)||le(e,t)||ae(e,t)||ie(e,t)),pe=(e,t)=>!(fe(e,t)||me(e,t)||ue(e,t)||ce(e,t)),ye=(e,t)=>se(e,t)?"left":le(e,t)?"right":ae(e,t)?"top":ie(e,t)?"bottom":null,we=(e,t)=>fe(e,t)?"left":me(e,t)?"right":ue(e,t)?"top":ce(e,t)?"bottom":null,ge=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),be=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),he=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function ve(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function Ee(e,t){if(!pe(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:a}=ge(e,t),{dirX:i,dirY:s}=be({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:a}),l=Math.min(r,n),u=Math.min(o,a);let c;return c=l<u?i:s,{inDir:c,dirX:i,dirY:s,depthX:l,depthY:u}}function Te(e,t){const r=pe(e,t),n={in:null,x:null,y:null},o={y:null,x:null},a={top:0,bottom:0,left:0,right:0},{overlapLeft:i,overlapRight:s,overlapTop:l,overlapBottom:u}=ge(t,e);a.top=l,a.bottom=u,a.left=i,a.right=s;const c=Object.entries(a).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:f,dirY:m}=be({overlapLeft:s,overlapRight:i,overlapTop:u,overlapBottom:l});return n.y=m,n.x=f,a.bottom<0?o.y="bottom":a.top<0&&(o.y="top"),a.left<0?o.x="left":a.right<0&&(o.x="right"),n.in=r?a.top===a.bottom&&a.bottom===a.left&&a.left===a.right?"center":c.length?c[0][0]:"top":null,{dirs:n,depth:a,isNeg:o}}function Ie(e,t){if(!p(e))throw new TypeError("The first argument must be a non-null object.");if("function"!=typeof t)throw new TypeError("The second argument must be a function.");const r=Object.entries(e).filter(t);return Object.fromEntries(r)}function xe(e,t){if(void 0!==t.obj&&"function"!=typeof t.obj)throw new TypeError("filter.obj must be a function if provided.");if(void 0!==t.value&&"function"!=typeof t.value)throw new TypeError("filter.value must be a function if provided.");if(void 0!==t.array&&"function"!=typeof t.array)throw new TypeError("filter.array must be a function if provided.");let r;r=e instanceof Map?new Map:e instanceof Set?new Set:{};const n=(o=e)instanceof Map?Array.from(o.entries()):o instanceof Set?Array.from(o.values()).map(e=>[void 0,e]):Object.entries(o);var o;const a=(e,r)=>{const n=[];for(let o=0;o<e.length;o++){const i=e[o];if(Array.isArray(i))n.push(a(i,r));else if(p(i)){const r=xe(i,t);(void 0===t.obj||t.obj(r,o,e))&&n.push(r)}else(void 0===t.value||t.value([r,i],o,e))&&n.push(i)}return n};for(let e=0;e<n.length;e++){const[o,i]=n[e];if(Array.isArray(i)){const s=a(i,o);(void 0===t.array||t.array([o,s],e,n))&&(r instanceof Map||r instanceof Set?r instanceof Map?r.set(o,s):r.add(s):r[o]=s)}else if(p(i)){const a=xe(i,t);(void 0===t.obj||t.obj(a,e,n))&&(r instanceof Map?r.set(o,a):r instanceof Set?r.add(a):r[o]=a)}else(void 0===t.value||t.value([o,i],e,n))&&(r instanceof Map?r.set(o,i):r instanceof Set?r.add(i):r[o]=i)}return r}function Ae(e,t,r){if(!Array.isArray(t))throw new TypeError("The second argument must be an array.");if(void 0!==r&&!Array.isArray(r))throw new TypeError("The third argument must be an array.");return Ie(e,([e,n])=>t.length>0?t.some(t=>{if(Array.isArray(t)){const[r,o]=t,a=e===r,i="function"==typeof o?o(n):n===o;return a&&i}const o=e===t,a=void 0===r||r.some(e=>"function"==typeof e?e(n):e===n);return o&&a}):void 0!==r&&r.some(e=>"function"==typeof e?e(n):e===n))}const je=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("string"!=typeof e)throw new TypeError(`Expected "${t}" to be a string, but received ${typeof e}.`)},Ne=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("function"!=typeof e)throw new TypeError(`Expected "${t}" to be a function, but received ${typeof e}.`)},ke=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError(`Expected "${t}" to be a plain object, but received ${null===e?"null":Array.isArray(e)?"array":typeof e}.`)},Se=(e,t=!1)=>!t&&void 0===e,Me=(e,t=!1)=>Se(e,t)||"string"==typeof e||!t&&null===e,Oe=(e,t=!1)=>Se(e,t)||"number"==typeof e||!t&&null===e,De=(e,t=!1)=>Se(e,t)||"boolean"==typeof e||!t&&null===e,Fe=(e,t)=>!!Se(e)||(Ne(t,"valueValidator"),Array.isArray(e)&&e.every(t)),Le=new Map;class $e extends Error{constructor(e,t,r){if(je(e,"message"),je(t,"url"),"string"!=typeof r)throw new TypeError(`Expected "stage" to be a string, but received ${typeof r}.`);super(e),this.name="MediaLoadingError",this.url=t,this.stage=r}}const Ce=async e=>{je(e,"str");const t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("").substring(0,8)},Re=(e,t="image/jpeg")=>{if(!(e instanceof Uint8Array)&&"string"!=typeof e)throw new TypeError(`Expected "data" to be an instance of Uint8Array or a string, but received ${typeof e}.`);je(t,"format");const r=e=>{const t=URL.createObjectURL(e),r=Le.get(t);return Le.set(t,"number"==typeof r?r+1:1),t};if(e instanceof Uint8Array)return r(new Blob([e],{type:t}));if("string"==typeof e&&e.startsWith("data:")){const n=e.split(",")[1],o=atob(n),a=new Uint8Array(o.length);for(let e=0;e<o.length;e++)a[e]=o.charCodeAt(e);return r(new Blob([a],{type:t}))}return"string"==typeof e?e:""},Pe=(e,t=!1)=>{if(d(e)){if(4!==m(e)){if(t)return!1;throw new TypeError("Invalid fetch data: Object must be an MediaContentFetchData.")}_e(e.common),ke(e.native,"_fetchData.native"),ke(e.format,"_fetchData.format"),ke(e.quality,"_fetchData.quality");for(const r in e.native){const n=e.native[r];if(!Fe(n,e=>"string"==typeof e.id)){if(t)return!1;throw new TypeError(`Invalid native data: "${r}" must be an array of native fetch data.`)}}}return!0},_e=e=>{if(ke(e,"common"),Pe(e._fetchData),!Me(e.title))throw new TypeError('Invalid metadata: "title" must be a string or null.');if(!Me(e.album))throw new TypeError('Invalid metadata: "album" must be a string or null.');if(!Me(e.albumartist))throw new TypeError('Invalid metadata: "albumartist" must be a a string or null.');if(!Me(e.artist))throw new TypeError('Invalid metadata: "artist" must be a string or null.');if(!De(e.compilation))throw new TypeError('Invalid metadata: "compilation" must be a boolean or null.');if(!De(e.podcast))throw new TypeError('Invalid metadata: "podcast" must be a boolean or null.');if(!De(e.gapless))throw new TypeError('Invalid metadata: "gapless" must be a boolean or null.');if(!De(e.showMovement))throw new TypeError('Invalid metadata: "showMovement" must be a boolean or null.');if(!Oe(e.averageLevel))throw new TypeError('Invalid metadata: "averageLevel" must be a number or null.');if(!Oe(e.peakLevel))throw new TypeError('Invalid metadata: "peakLevel" must be a number or null.');if(!Oe(e.hdVideo))throw new TypeError('Invalid metadata: "hdVideo" must be a number or null.');if(!Oe(e.stik))throw new TypeError('Invalid metadata: "stik" must be a number or null.');if(!Oe(e.playCounter))throw new TypeError('Invalid metadata: "playCounter" must be a number or null.');if(!Oe(e.tvSeason))throw new TypeError('Invalid metadata: "tvSeason" must be a number or null.');if(!Oe(e.tvEpisode))throw new TypeError('Invalid metadata: "tvEpisode" must be a number or null.');if(!Oe(e.year))throw new TypeError('Invalid metadata: "year" must be a number or null.');if(!Oe(e.bpm))throw new TypeError('Invalid metadata: "bpm" must be a number or null.');if(!Oe(e.originalyear))throw new TypeError('Invalid metadata: "originalyear" must be a number or null.');if(!Oe(e.movementTotal))throw new TypeError('Invalid metadata: "movementTotal" must be a number or null.');if(!Me(e.date))throw new TypeError('Invalid metadata: "date" must be a string or null.');if(!Me(e.originaldate))throw new TypeError('Invalid metadata: "originaldate" must be a string or null.');if(!Me(e.releasedate))throw new TypeError('Invalid metadata: "releasedate" must be a string or null.');if(!Me(e.albumsort))throw new TypeError('Invalid metadata: "albumsort" must be a string or null.');if(!Me(e.titlesort))throw new TypeError('Invalid metadata: "titlesort" must be a string or null.');if(!Me(e.work))throw new TypeError('Invalid metadata: "work" must be a string or null.');if(!Me(e.artistsort))throw new TypeError('Invalid metadata: "artistsort" must be a string or null.');if(!Me(e.albumartistsort))throw new TypeError('Invalid metadata: "albumartistsort" must be a string or null.');if(!Me(e.composersort))throw new TypeError('Invalid metadata: "composersort" must be a string or null.');if(!Me(e.grouping))throw new TypeError('Invalid metadata: "grouping" must be a string or null.');if(!Me(e.longDescription))throw new TypeError('Invalid metadata: "longDescription" must be a string or null.');if(!Me(e.totaltracks))throw new TypeError('Invalid metadata: "totaltracks" must be a string or null.');if(!Me(e.totaldiscs))throw new TypeError('Invalid metadata: "totaldiscs" must be a string or null.');if(!Me(e.mood))throw new TypeError('Invalid metadata: "mood" must be a string or null.');if(!Me(e.media))throw new TypeError('Invalid metadata: "media" must be a string or null.');if(!Me(e.tvShow))throw new TypeError('Invalid metadata: "tvShow" must be a string or null.');if(!Me(e.tvShowSort))throw new TypeError('Invalid metadata: "tvShowSort" must be a string or null.');if(!Me(e.tvEpisodeId))throw new TypeError('Invalid metadata: "tvEpisodeId" must be a string or null.');if(!Me(e.tvNetwork))throw new TypeError('Invalid metadata: "tvNetwork" must be a string or null.');if(!Me(e.podcasturl))throw new TypeError('Invalid metadata: "podcasturl" must be a string or null.');if(!Me(e.releasestatus))throw new TypeError('Invalid metadata: "releasestatus" must be a string or null.');if(!Me(e.releasecountry))throw new TypeError('Invalid metadata: "releasecountry" must be a string or null.');if(!Me(e.script))throw new TypeError('Invalid metadata: "script" must be a string or null.');if(!Me(e.language))throw new TypeError('Invalid metadata: "language" must be a string or null.');if(!Me(e.copyright))throw new TypeError('Invalid metadata: "copyright" must be a string or null.');if(!Me(e.license))throw new TypeError('Invalid metadata: "license" must be a string or null.');if(!Me(e.encodedby))throw new TypeError('Invalid metadata: "encodedby" must be a string or null.');if(!Me(e.encodersettings))throw new TypeError('Invalid metadata: "encodersettings" must be a string or null.');if(!Me(e.barcode))throw new TypeError('Invalid metadata: "barcode" must be a string or null.');if(!Me(e.asin))throw new TypeError('Invalid metadata: "asin" must be a string or null.');if(!Me(e.website))throw new TypeError('Invalid metadata: "website" must be a string or null.');if(!Me(e.originalalbum))throw new TypeError('Invalid metadata: "originalalbum" must be a string or null.');if(!Me(e.originalartist))throw new TypeError('Invalid metadata: "originalartist" must be a string or null.');if(!Me(e.key))throw new TypeError('Invalid metadata: "key" must be a string or null.');if(!Me(e.movement))throw new TypeError('Invalid metadata: "movement" must be a string or null.');if(!Me(e.podcastId))throw new TypeError('Invalid metadata: "podcastId" must be a string or null.');if(!Fe(e.albumartists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "albumartists" must be an array of strings.');if(!Fe(e.genre,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "genre" must be an array of strings.');if(!Fe(e.label,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "label" must be an array of strings.');if(!Fe(e.composer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "composer" must be an array of strings.');if(!Fe(e.artists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "artists" must be an array of strings.');if(!Fe(e.lyricist,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "lyricist" must be an array of strings.');if(!Fe(e.writer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "writer" must be an array of strings.');if(!Fe(e.conductor,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "conductor" must be an array of strings.');if(!Fe(e.remixer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "remixer" must be an array of strings.');if(!Fe(e.arranger,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "arranger" must be an array of strings.');if(!Fe(e.engineer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "engineer" must be an array of strings.');if(!Fe(e.publisher,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "publisher" must be an array of strings.');if(!Fe(e.producer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "producer" must be an array of strings.');if(!Fe(e.djmixer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "djmixer" must be an array of strings.');if(!Fe(e.mixer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "mixer" must be an array of strings.');if(!Fe(e.technician,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "technician" must be an array of strings.');if(!Fe(e.subtitle,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "subtitle" must be an array of strings.');if(!Fe(e.description,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "description" must be an array of strings.');if(!Fe(e.discsubtitle,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "discsubtitle" must be an array of strings.');if(!Fe(e.releasetype,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "releasetype" must be an array of strings.');if(!Fe(e.isrc,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "isrc" must be an array of strings.');if(!Fe(e.performer_instrument,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "performer_instrument" must be an array of strings.');if(!Fe(e.notes,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "notes" must be an array of strings.');if(!Fe(e.category,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "category" must be an array of strings.');if(!Fe(e.keywords,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "keywords" must be an array of strings.');if(!Fe(e.catalognumber,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "catalognumber" must be an array of strings.');if(!Fe(e.picture,e=>e&&"object"==typeof e&&(void 0===e.description||"string"==typeof e.description)&&(void 0===e.name||"string"==typeof e.name)&&(void 0===e.type||"string"==typeof e.type)&&"string"==typeof e.format&&(e.data instanceof Uint8Array||"string"==typeof e.data)))throw new TypeError('Invalid metadata: "picture" must be an array of pictures.');if(!Fe(e.comment,e=>null!==e&&"object"==typeof e&&Me(e.descriptor)&&Me(e.language)&&Me(e.text)))throw new TypeError('Invalid metadata: "comment" must be an array of valid IComment objects.');if(!Fe(e.lyrics,e=>null!==e&&"object"==typeof e&&Me(e.text)&&Me(e.descriptor)&&Me(e.language)&&(!Array.isArray(e)||Fe(e.syncText,e=>null!==e&&"object"==typeof e&&Me(e.text)&&Oe(e.timestamp)))&&(e=>void 0===e||null!==e&&"object"==typeof e&&Oe(e.notSynchronized)&&Oe(e.mpegFrameNumber)&&Oe(e.milliseconds))(e.timeStampFormat)&&(e=>void 0===e||null!==e&&"object"==typeof e&&Oe(e.other)&&Oe(e.lyrics)&&Oe(e.text)&&Oe(e.movement_part)&&Oe(e.events)&&Oe(e.chord)&&Oe(e.trivia_pop))(e.contentType)))throw new TypeError('Invalid metadata: "lyrics" must be an array of valid ILyricsTag objects.');if(!Fe(e.rating,e=>null!==e&&"object"==typeof e&&Me(e.source)&&Oe(e.rating)))throw new TypeError('Invalid metadata: "rating" must be an array of valid IRating objects.');const t=(e,t)=>{if(!Se(t)&&null!==t){if("object"!=typeof t)throw new TypeError(`Invalid metadata: "${e}" must be an object or null.`);if("number"!=typeof t.no&&null!==t.no)throw new TypeError(`Invalid metadata: "${e}.no" must be a number or null.`);if("number"!=typeof t.of&&null!==t.of)throw new TypeError(`Invalid metadata: "${e}.of" must be a number or null.`)}};t("disk",e.disk),t("track",e.track),t("movementIndex",e.movementIndex)},Be=async(e,t,r=!0)=>{je(e,"url"),Ne(t,"parseFile");const n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch audio file: ${n.status} ${n.statusText}`);const o=await n.blob(),a=await t(o);if(!a||"object"!=typeof a.common)throw new TypeError('Invalid metadata: "common" property is missing.');void 0!==typeof a.common["performer:instrument"]&&(a.common.performer_instrument=a.common["performer:instrument"]),Pe(a);const i=a.common;_e(i);const s=i?.picture?.map(e=>({...e,data:r?Re(e.data,e.format):e.data}))??[];a.common={...a.common,picture:s.map(e=>({...e,data:""}))},r&&Object.keys(a.native).forEach(e=>{a.native[e]=a.native[e].map(e=>{if(e.value&&"object"==typeof e.value&&e.value.data instanceof Uint8Array){const t=i?.picture?.findIndex(t=>t.data===e.value.data&&t.format===e.value.format&&t.description===e.value.description&&t.name===e.value.name)??-1;if(s[t])return{...e,value:{...e.value,data:""}}}return e})});const l=xe({title:i?.title,album:i?.album,albumartist:i?.albumartist,albumartists:i?.albumartists,genre:i?.genre,label:i?.label,composer:i?.composer,year:i?.year,artist:i?.artist,artists:i?.artists,disk:i?.disk?{no:i.disk.no,of:i.disk.of}:void 0,track:i?.track?{no:i.track.no,of:i.track.of}:void 0,movementIndex:i?.movementIndex?{no:i.movementIndex.no,of:i.movementIndex.of}:void 0,picture:s,date:i?.date,originaldate:i?.originaldate,originalyear:i?.originalyear,releasedate:i?.releasedate,comment:i?.comment,lyrics:i?.lyrics,albumsort:i?.albumsort,titlesort:i?.titlesort,work:i?.work,artistsort:i?.artistsort,albumartistsort:i?.albumartistsort,composersort:i?.composersort,lyricist:i?.lyricist,writer:i?.writer,conductor:i?.conductor,remixer:i?.remixer,arranger:i?.arranger,engineer:i?.engineer,publisher:i?.publisher,producer:i?.producer,djmixer:i?.djmixer,mixer:i?.mixer,technician:i?.technician,grouping:i?.grouping,subtitle:i?.subtitle,description:i?.description,longDescription:i?.longDescription,discsubtitle:i?.discsubtitle,totaltracks:i?.totaltracks,totaldiscs:i?.totaldiscs,movementTotal:i?.movementTotal,compilation:i?.compilation,rating:i?.rating,bpm:i?.bpm,mood:i?.mood,media:i?.media,catalognumber:i?.catalognumber,tvShow:i?.tvShow,tvShowSort:i?.tvShowSort,tvSeason:i?.tvSeason,tvEpisode:i?.tvEpisode,tvEpisodeId:i?.tvEpisodeId,tvNetwork:i?.tvNetwork,podcast:i?.podcast,podcasturl:i?.podcasturl,releasestatus:i?.releasestatus,releasetype:i?.releasetype,releasecountry:i?.releasecountry,script:i?.script,language:i?.language,copyright:i?.copyright,license:i?.license,encodedby:i?.encodedby,encodersettings:i?.encodersettings,gapless:i?.gapless,barcode:i?.barcode,isrc:i?.isrc,asin:i?.asin,website:i?.website,performer_instrument:i?.performer_instrument,averageLevel:i?.averageLevel,peakLevel:i?.peakLevel,notes:i?.notes,originalalbum:i?.originalalbum,originalartist:i?.originalartist,key:i?.key,category:i?.category,hdVideo:i?.hdVideo,keywords:i?.keywords,movement:i?.movement,podcastId:i?.podcastId,showMovement:i?.showMovement,stik:i?.stik,playCounter:i?.playCounter},{value:([e,t])=>null!=t,obj:e=>m(e)>0,array:([e,t])=>t.length>0});return l._fetchData=a,l},Ue=async(e,t={},r={},n=e=>{if(!(e instanceof Blob))throw new TypeError('Expected "data" to be a Blob.');return new Promise((e,t)=>t(new TypeError("parseFile library not found.")))},o={},a=!0,i="null")=>{if("string"!=typeof e&&!(e instanceof HTMLMediaElement))throw new TypeError("Source must be a string or an HTMLMediaElement.");if(ke(t,"defaultMetadata"),ke(r,"metadata"),Ne(n,"parseFile"),ke(o,"callbacks"),o.onProgress&&"function"!=typeof o.onProgress)throw new TypeError("callbacks.onProgress must be a function.");if(o.onError&&"function"!=typeof o.onError)throw new TypeError("callbacks.onError must be a function.");if("string"!=typeof i&&"function"!=typeof i)throw new TypeError("unknownArtist must be a string or a function returning a string.");let s,l="";const u=(t,r)=>{if(je(t,"stage"),void 0!==r&&!(r instanceof Event))throw new TypeError('Expected "event" to be an Event or undefined.');o.onProgress&&o.onProgress({event:r,status:"loading",stage:t,url:l||(e instanceof HTMLMediaElement?e.src:"unknown")})},c=(t,r)=>{if(!(t instanceof Error))throw new TypeError('Expected "error" to be an Error.');je(r,"stage"),o.onError&&o.onError({error:t instanceof Error?t:new Error(String(t)),url:l||(e instanceof HTMLMediaElement?e.src:"unknown"),stage:r})};try{u("INITIALIZING"),"string"==typeof e?(l=e,s=new Audio(l)):(s=e,l=s.src);try{await new Promise((e,t)=>{const r=e=>u("DOWNLOADING",e),n=()=>{a(),e(void 0)},o=e=>{a(),t(new Error(`HTMLMediaElement failed to load: ${e.message||"Unknown error"}`))},a=()=>{s.removeEventListener("progress",r),s.removeEventListener("loadedmetadata",n),s.removeEventListener("error",o)};s.addEventListener("progress",r),s.addEventListener("loadedmetadata",n),s.addEventListener("error",o),s.readyState>=1&&(a(),e(void 0))}),u("METADATA_LOADED")}catch(e){throw new $e(e instanceof Error?e.message:"UNKNOWN ERROR",l,"METADATA")}const f={id:r.id||await Ce(l),duration:Math.floor(1e3*s.duration),url:l,weight:r.weight??1};let m={};u("EXTRACTING_ID3");try{m=await Be(l,n,a)}catch(e){c(e instanceof Error?e:new Error("Unknown Error"),"ID3"),console.warn(`[TinyAudioUtils] ID3 extraction failed for ${l}. Falling back to filename.`)}const p=e=>{je(e,"url");try{return(e.split(/[?#]/)[0].split("/").pop()??"").replace(/\.[^/.]+$/,"")||"Unknown Track"}catch{return"Unknown Track"}},y=e=>{const t={...e};return d(t._fetchData)&&(d(m._fetchData)&&(t._fetchData={...m._fetchData}),d(e._fetchData)&&(void 0!==e._fetchData.common&&(t._fetchData.common=e._fetchData.common),void 0!==e._fetchData.native&&(t._fetchData.native=e._fetchData.native),void 0!==e._fetchData.format&&(t._fetchData.format=e._fetchData.format),void 0!==e._fetchData.quality&&(t._fetchData.quality=e._fetchData.quality))),t},w={...f,...y(t),...m,...y(r),title:m.title||r.title||p(l),artist:m.artist||r.artist||("string"==typeof i?i:String(i()))};return o.onProgress&&o.onProgress({status:"success",stage:"COMPLETE",url:l}),w}catch(e){if(e instanceof $e)throw e;const t=new $e(e instanceof Error?e.message:"UNKNOWN ERROR",l,"INITIALIZING");throw c(t,"INITIALIZING"),t}},Ye=(e,t=100)=>{if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(!Number.isFinite(t)||t<=0)throw new TypeError("Expected 'checkInterval' to be a positive number.");return new Promise(r=>{const n=setInterval(()=>{e()&&(clearInterval(n),r())},t)})},qe=(e,t=!0)=>{if("function"!=typeof e)throw new TypeError('The argument "baseFunction" must be a function.');let r=null;const n={ended:!1,failed:!1,loading:!1};return{callback:async(...o)=>(null!==r||(n.loading=!0,r=(async()=>{try{const a=await e(...o);return n.ended=!0,n.failed=!1,n.loading=!1,t&&(r=null),a}catch(e){throw n.ended=!0,n.failed=!0,n.loading=!1,t&&(r=null),e}})()),r),getActivePromise:()=>r,resetActivePromise:()=>{n.ended=!1,n.failed=!1,n.loading=!1,r=null},isEnded:()=>n.ended,isFailed:()=>n.failed,isLoading:()=>n.loading}},He=()=>"undefined"!=typeof window&&void 0!==window.document,Ve="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null,ze="undefined"!=typeof document?document:null,Je=["chrome","firefox","ie","edge","safari","opera","yandex","other"];function We(){if("undefined"==typeof navigator)return"other";const e=navigator.userAgent;return-1!==e.indexOf("Chrome")?"chrome":-1!==e.indexOf("Firefox")?"firefox":-1!==e.indexOf("MSIE")?"ie":-1!==e.indexOf("Edge")?"edge":-1!==e.indexOf("Safari")?"safari":-1!==e.indexOf("Opera")?"opera":-1!==e.indexOf("YaBrowser")?"yandex":"other"}function Xe(){const e=Ve?.getComputedStyle?(Array.prototype.slice.call(Ve.getComputedStyle(document.documentElement,"")).join("").match(/-(moz|webkit|ms)-/)??["",""])[1]:"";return"moz"===e?"gecko":"webkit"===e?"webkit":"ms"===e?"trident":"other"}function Ge(){const e=!!Ve?.opr&&!!opr.addons||!!Ve?.opera||navigator.userAgent.indexOf(" OPR/")>=0,t="undefined"!=typeof InstallTrigger,r=!!Ve?.HTMLElement&&/constructor/i.test(Ve.HTMLElement)||"[object SafariRemoteNotification]"===(!Ve.safari||"undefined"!=typeof safari&&safari.pushNotification).toString(),n=!!ze?.documentMode,o=!n&&!!Ve?.StyleMedia,a=!!Ve?.chrome;return{isOpera:e,isFirefox:t,isSafari:r,isIE:n,isEdge:o,isChrome:a,isBlink:(a||e)&&!!Ve?.CSS}}function Ze(e=[]){if(!Array.isArray(e))throw new TypeError('The "disable" argument must be an array.');for(const t of e)if(!Je.includes(t))throw new TypeError(`Invalid browser name provided in disable array: ${t}`);const t={chrome:0,firefox:0,ie:0,edge:0,safari:0,opera:0,yandex:0,other:0};t[We()]++;const r=Xe();"gecko"===r?e.indexOf("firefox")<0&&t.firefox++:"webkit"===r?(e.indexOf("chrome")<0&&t.chrome++,e.indexOf("safari")<0&&t.safari++,e.indexOf("opera")<0&&t.opera++,e.indexOf("edge")<0&&t.edge++):"trident"===r?e.indexOf("ie")<0&&t.ie++:e.indexOf("other")<0&&t.other++;const n=Ge();return n.isOpera&&e.indexOf("opera")<0&&t.opera++,n.isFirefox&&e.indexOf("firefox")<0&&t.firefox++,n.isSafari&&e.indexOf("safari")<0&&t.safari++,n.isIE&&e.indexOf("ie")<0&&t.ie++,n.isEdge&&e.indexOf("edge")<0&&t.edge++,n.isChrome&&e.indexOf("chrome")<0&&t.chrome++,t}function Ke(e=[]){const t=Ze(e);return Object.keys(t).reduce((e,r)=>t[r]>t[e]?r:e)}const Qe=/^[A-Za-z0-9_-]{11}$/,et="https://www.youtube.com/oembed",tt="https://i.ytimg.com/vi",rt=new Set(["youtube.com","m.youtube.com","music.youtube.com","youtube-nocookie.com","youtu.be"]),nt=new Set(["http:","https:"]),ot=new Set(["default","mqdefault","hqdefault","sddefault","maxresdefault"]),at="video";function it(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError(`${t} must be a plain object, received ${Array.isArray(e)?"array":typeof e}.`);return e}function st(e,t,r){const n=e[t];if("string"!=typeof n)throw new TypeError(`${r}: "${t}" must be a string, received ${typeof n}.`);const o=n.trim();if(0===o.length)throw new RangeError(`${r}: "${t}" cannot be empty.`);return o}function lt(e,t,r){const n=e[t];if("number"!=typeof n)throw new TypeError(`${r}: "${t}" must be a number, received ${typeof n}.`);if(!Number.isInteger(n)||n<=0)throw new RangeError(`${r}: "${t}" must be a positive integer, received ${n}.`);return n}function ut(e,t="assertYouTubeOEmbedResponse"){const r=it(e,`${t}: payload`),n=st(r,"type",t);if(n!==at)throw new RangeError(`${t}: "type" must be "${at}", received "${n}".`);return{title:st(r,"title",t),author_name:st(r,"author_name",t),author_url:st(r,"author_url",t),type:n,version:st(r,"version",t),provider_name:st(r,"provider_name",t),provider_url:st(r,"provider_url",t),html:st(r,"html",t),width:lt(r,"width",t),height:lt(r,"height",t),thumbnail_url:st(r,"thumbnail_url",t),thumbnail_width:lt(r,"thumbnail_width",t),thumbnail_height:lt(r,"thumbnail_height",t)}}function ct(e){if("string"!=typeof e)throw new TypeError('extractYouTubeVideoId: "input" must be a string.');const t=e.trim();if(0===t.length)throw new RangeError('extractYouTubeVideoId: "input" cannot be empty.');if(Qe.test(t))return t;let r;try{r=new URL(t)}catch{throw new SyntaxError(`extractYouTubeVideoId: "${e}" is neither a video id nor a valid URL.`)}if(!nt.has(r.protocol))throw new RangeError(`extractYouTubeVideoId: unsupported protocol "${r.protocol}".`);const n=r.hostname.replace(/^www\./,"").toLowerCase();if(!rt.has(n))throw new RangeError(`extractYouTubeVideoId: unsupported host "${n}".`);const o=r.pathname.match(/^\/(?:embed|shorts|live|v)\/([A-Za-z0-9_-]{11})/),a="youtu.be"===n?r.pathname.slice(1).split("/")[0]:r.searchParams.get("v")??o?.[1]??null;if("string"!=typeof a||!Qe.test(a))throw new SyntaxError(`extractYouTubeVideoId: no valid video id found in "${e}".`);return a}async function ft(e,t={}){const r="fetchYouTubeOEmbed",n=it(t,`${r}: "options"`),{signal:o,fetchImpl:a=fetch}=n;if(void 0!==o&&!(o instanceof AbortSignal))throw new TypeError(`${r}: "options.signal" must be an AbortSignal.`);if("function"!=typeof a)throw new TypeError(`${r}: "options.fetchImpl" must be a function.`);const i=ct(e),s=new URL(et);s.searchParams.set("format","json"),s.searchParams.set("url",`https://www.youtube.com/watch?v=${i}`);const l=await a(s,{method:"GET",signal:o});if("object"!=typeof l||null===l||"function"!=typeof l.json)throw new TypeError(`${r}: "options.fetchImpl" did not resolve to a Response.`);if(!l.ok)throw new Error(`${r}: request failed with status ${l.status} for video "${i}".`);return ut(await l.json(),r)}function mt(e,t="hqdefault"){if("string"!=typeof t)throw new TypeError(`getYouTubeThumbnailUrl: "quality" must be a string, received ${typeof t}.`);if(!ot.has(t))throw new RangeError(`getYouTubeThumbnailUrl: "quality" must be one of ${[...ot].join(", ")}.`);return`${tt}/${ct(e)}/${t}.jpg`}window.TinyBasicsEs=t})();
|